text stringlengths 4 6.14k |
|---|
/*
* Copyright (c) 2017-2019 Cisco and/or its affiliates.
* 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_ldp_h
#define included_ldp_h
#if (CLIB_DEBUG > 0)
/* Set LDP_DEBUG 2 for connection debug, 3 for read/write debug output */
#define LDP_DEBUG_INIT 1
#else
#define LDP_DEBUG_INIT 0
#endif
#include <vppinfra/error.h>
#include <vppinfra/types.h>
#include <vcl/ldp_glibc_socket.h>
#define LDP_ENV_DEBUG "LDP_DEBUG"
#define LDP_ENV_APP_NAME "LDP_APP_NAME"
#define LDP_ENV_SID_BIT "LDP_SID_BIT"
#define LDP_ENV_TLS_CERT "LDP_TLS_CERT_FILE"
#define LDP_ENV_TLS_KEY "LDP_TLS_KEY_FILE"
#define LDP_ENV_TLS_TRANS "LDP_TRANSPARENT_TLS"
#define LDP_SID_BIT_MIN 5
#define LDP_SID_BIT_MAX 30
#define LDP_APP_NAME_MAX 256
#endif /* included_ldp_h */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|
/*
Q Light Controller Plus
oscpacketizer.h
Copyright (c) Massimo Callegari
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.
*/
#include <QHostAddress>
#include <QByteArray>
#include <QString>
#include <QHash>
#include <QPair>
#ifndef OSCPACKETIZER_H
#define OSCPACKETIZER_H
class OSCPacketizer
{
/*********************************************************************
* Initialization
*********************************************************************/
public:
OSCPacketizer();
~OSCPacketizer();
enum TagType { Integer = 0x01, Float = 0x02, Time = 0x03, String = 0x04, Blob = 0x05 };
public:
/*********************************************************************
* Sender functions
*********************************************************************/
/** Prepare an OSC DMX packet
*/
/**
* Prepare an OSC DMX message using a OSC path like
* /$universe/dmx/$channel
* All values are transmitted as float (OSC 'f')
*
* @param data the message composed by this function to be sent on the network
* @param universe the universe used to compose the OSC message path
* @param channel the DMX channel used to compose the OSC message path
* @param value the value to be transmitted (as float)
*/
void setupOSCDmx(QByteArray& data, quint32 universe, quint32 channel, uchar value);
/**
* Prepare an generic OSC message using the specified $path.
* Values are appended to the message as specified by their $types.
* Note that $types and $values must have the same length
*
* @param data the message composed by this function to be sent on the network
* @param path the OSC path to be used in the message
* @param types the list of types of the following $values
* @param values the actual values to be appended to the message
*/
void setupOSCGeneric(QByteArray& data, QString &path, QString types, QByteArray &values);
/*********************************************************************
* Receiver functions
*********************************************************************/
private:
/**
* Extract an OSC message received from a buffer.
* As a result, it returns the extracted OSC path and values
* (empty if invalid)
*
* @param data the buffer containing the OSC message
* @param path the OSC path extracted from the buffer
* @param values the array of values extracted from the buffer
* @return true on successful parsing, otherwise false
*/
bool parseMessage(QByteArray const& data, QString& path, QByteArray& values);
public:
/**
* Parse a OSC packet received from the network.
*
* @param data the payload of a UDP packet received from the network
* @return a list of couples of OSC path/values
*/
QList<QPair<QString, QByteArray> > parsePacket(QByteArray const& data);
};
#endif
|
#import <UIKit/UIKit.h>
@interface XNGMarkdownTestViewController : UIViewController
@end
|
/*
* Copyright 2006-2007 Anthony Rowe and Adam Goode
*
* 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 DEVICES_H
#define DEVICES_H
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
typedef enum {
_CC3_DEVICE_UART = 0, // must be zero for normal stdin/out/err to work
_CC3_DEVICE_MMC,
_CC3_NUM_DEVICES
} _cc3_device_t;
typedef const struct {
_cc3_device_t id;
bool (*recognize) (const char *name);
bool is_tty;
int (*open) (const char *name, int flags, int mode);
int (*close) (int file);
ssize_t (*read) (int file, void *ptr, size_t len);
ssize_t (*write) (int file, const void *ptr, size_t len);
off_t (*lseek) (int file, off_t offset, int dir);
int (*unlink) (const char *name);
int (*rename) (const char *oldname, const char *newname);
int (*fstat) (int file, struct stat *st);
} _cc3_device_driver_t;
// the device drivers
extern _cc3_device_driver_t _cc3_uart_driver;
extern _cc3_device_driver_t _cc3_mmc_driver;
_cc3_device_driver_t *_cc3_get_driver_for_name (const char *name);
uint8_t _cc3_get_internal_file_number (const int file);
_cc3_device_driver_t *_cc3_get_driver_for_file_number (const int file);
int _cc3_make_file_number (const _cc3_device_driver_t *dev,
const int16_t file);
#endif
|
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_CBLAS_CONV_H_
#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_CBLAS_CONV_H_
// The Conv implementation based on CBLAS interface. This is only used on iOS
// for now, utilizing Apple's Accelerate framework.
#if TFLITE_USE_APPLE_ACCELERATE_FOR_CONV
#include <Accelerate/Accelerate.h>
#else
#include "tensorflow/lite/kernels/internal/optimized/cblas_reference.h"
#endif
#include "tensorflow/lite/kernels/internal/optimized/multithreaded_conv.h"
#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
namespace tflite {
namespace cblas_ops {
inline void Conv(const ConvParams& params, const RuntimeShape& input_shape,
const float* input_data, const RuntimeShape& filter_shape,
const float* filter_data, const RuntimeShape& bias_shape,
const float* bias_data, const RuntimeShape& output_shape,
float* output_data, const RuntimeShape& im2col_shape,
float* im2col_data) {
const int stride_width = params.stride_width;
const int stride_height = params.stride_height;
const int pad_width = params.padding_values.width;
const int pad_height = params.padding_values.height;
const int dilation_width_factor = params.dilation_width_factor;
const int dilation_height_factor = params.dilation_height_factor;
const float output_activation_min = params.float_activation_min;
const float output_activation_max = params.float_activation_max;
TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
gemmlowp::ScopedProfilingLabel label("Conv/cblas");
const float* gemm_input_data = nullptr;
const RuntimeShape* gemm_input_shape = nullptr;
const int filter_width = filter_shape.Dims(2);
const int filter_height = filter_shape.Dims(1);
const bool need_im2col = stride_width != 1 || stride_height != 1 ||
filter_width != 1 || filter_height != 1;
if (need_im2col) {
TFLITE_DCHECK(im2col_data);
ConvParams op_params;
op_params.padding_type = PaddingType::kSame;
op_params.padding_values.width = pad_width;
op_params.padding_values.height = pad_height;
op_params.stride_width = stride_width;
op_params.stride_height = stride_height;
op_params.dilation_width_factor = dilation_width_factor;
op_params.dilation_height_factor = dilation_height_factor;
optimized_ops::Im2col(op_params, filter_height, filter_width, 0,
input_shape, input_data, im2col_shape, im2col_data);
gemm_input_data = im2col_data;
gemm_input_shape = &im2col_shape;
} else {
TFLITE_DCHECK(!im2col_data);
gemm_input_data = input_data;
gemm_input_shape = &input_shape;
}
// The following code computes matrix multiplication c = a * transponse(b)
// with CBLAS, where:
// * `a` is a matrix with dimensions (m, k).
// * `b` is a matrix with dimensions (n, k), so transpose(b) is (k, n).
// * `c` is a matrix with dimensions (m, n).
// The naming of variables are aligned with CBLAS specification here.
const float* a = gemm_input_data;
const float* b = filter_data;
float* c = output_data;
const int gemm_input_dims = gemm_input_shape->DimensionsCount();
int m = FlatSizeSkipDim(*gemm_input_shape, gemm_input_dims - 1);
int n = output_shape.Dims(3);
int k = gemm_input_shape->Dims(gemm_input_dims - 1);
// The stride of matrix a, b and c respectively.
int stride_a = k;
int stride_b = k;
int stride_c = n;
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1.0f, a,
stride_a, b, stride_b, 0.0f, c, stride_c);
optimized_ops::AddBiasAndEvalActivationFunction(
output_activation_min, output_activation_max, bias_shape, bias_data,
output_shape, output_data);
}
} // namespace cblas_ops
} // namespace tflite
#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_CBLAS_CONV_H_
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/sesv2/SESV2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/sesv2/model/PlacementStatistics.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace SESV2
{
namespace Model
{
/**
* <p>An object that describes how email sent during the predictive inbox placement
* test was handled by a certain email provider.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/sesv2-2019-09-27/IspPlacement">AWS
* API Reference</a></p>
*/
class AWS_SESV2_API IspPlacement
{
public:
IspPlacement();
IspPlacement(Aws::Utils::Json::JsonView jsonValue);
IspPlacement& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline const Aws::String& GetIspName() const{ return m_ispName; }
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline bool IspNameHasBeenSet() const { return m_ispNameHasBeenSet; }
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline void SetIspName(const Aws::String& value) { m_ispNameHasBeenSet = true; m_ispName = value; }
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline void SetIspName(Aws::String&& value) { m_ispNameHasBeenSet = true; m_ispName = std::move(value); }
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline void SetIspName(const char* value) { m_ispNameHasBeenSet = true; m_ispName.assign(value); }
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline IspPlacement& WithIspName(const Aws::String& value) { SetIspName(value); return *this;}
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline IspPlacement& WithIspName(Aws::String&& value) { SetIspName(std::move(value)); return *this;}
/**
* <p>The name of the email provider that the inbox placement data applies to.</p>
*/
inline IspPlacement& WithIspName(const char* value) { SetIspName(value); return *this;}
/**
* <p>An object that contains inbox placement metrics for a specific email
* provider.</p>
*/
inline const PlacementStatistics& GetPlacementStatistics() const{ return m_placementStatistics; }
/**
* <p>An object that contains inbox placement metrics for a specific email
* provider.</p>
*/
inline bool PlacementStatisticsHasBeenSet() const { return m_placementStatisticsHasBeenSet; }
/**
* <p>An object that contains inbox placement metrics for a specific email
* provider.</p>
*/
inline void SetPlacementStatistics(const PlacementStatistics& value) { m_placementStatisticsHasBeenSet = true; m_placementStatistics = value; }
/**
* <p>An object that contains inbox placement metrics for a specific email
* provider.</p>
*/
inline void SetPlacementStatistics(PlacementStatistics&& value) { m_placementStatisticsHasBeenSet = true; m_placementStatistics = std::move(value); }
/**
* <p>An object that contains inbox placement metrics for a specific email
* provider.</p>
*/
inline IspPlacement& WithPlacementStatistics(const PlacementStatistics& value) { SetPlacementStatistics(value); return *this;}
/**
* <p>An object that contains inbox placement metrics for a specific email
* provider.</p>
*/
inline IspPlacement& WithPlacementStatistics(PlacementStatistics&& value) { SetPlacementStatistics(std::move(value)); return *this;}
private:
Aws::String m_ispName;
bool m_ispNameHasBeenSet;
PlacementStatistics m_placementStatistics;
bool m_placementStatisticsHasBeenSet;
};
} // namespace Model
} // namespace SESV2
} // namespace Aws
|
/******************************************************************************
* Copyright 2019 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.
*****************************************************************************/
#pragma once
#include <iostream>
#include <list>
#include <map>
#include <vector>
#include "modules/perception/tool/benchmark/lidar/util/object.h"
namespace apollo {
namespace perception {
namespace benchmark {
template <typename ObjectKey>
using SequenceType = std::map<ObjectKey, ObjectPtr>;
template <typename ObjectKey>
class SequenceMaintainer {
public:
SequenceMaintainer() = default;
~SequenceMaintainer() = default;
bool add_data(const std::vector<ObjectPtr>& objects, ObjectKey key);
auto get_sequence(int sequence_id) -> SequenceType<ObjectKey>*;
void clear() { _sequence.clear(); }
protected:
std::map<int, SequenceType<ObjectKey>> _sequence;
private:
static const std::size_t _s_max_sample_num = 10;
static constexpr double _s_max_lift_time = 10.0;
};
template <typename ObjectKey>
bool SequenceMaintainer<ObjectKey>::add_data(
const std::vector<ObjectPtr>& objects, ObjectKey key) {
for (const auto& obj : objects) {
auto& id = obj->track_id;
if (_sequence.size() > 0 && _sequence.begin()->first > id) {
std::cerr << "Find track_id roll back, so clear the cache sequence, "
<< "current id " << id << " oldest id "
<< _sequence.begin()->first << "." << std::endl;
_sequence.clear();
}
auto& sub = _sequence[id];
if (sub.size() > 0 && sub.rbegin()->first >= key) {
// std::cerr << "New added key can not be less than old key, "
// << key << " to be added but " << sub.rbegin()->first << " exist."
// << std::endl;
return false;
}
sub[key] = obj;
auto iter = sub.begin();
while (sub.size() > _s_max_sample_num) {
sub.erase(iter++);
}
}
auto iter = _sequence.begin();
while (iter != _sequence.end()) {
if (iter->second.empty() ||
static_cast<double>(key - iter->second.rbegin()->first) >
_s_max_lift_time) {
_sequence.erase(iter++);
} else {
++iter;
}
}
return true;
}
template <typename ObjectKey>
auto SequenceMaintainer<ObjectKey>::get_sequence(int sequence_id)
-> SequenceType<ObjectKey>* {
auto iter = _sequence.find(sequence_id);
if (iter == _sequence.end()) {
return nullptr;
} else {
return &(iter->second);
}
}
} // namespace benchmark
} // namespace perception
} // namespace apollo
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 1997-2009. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* %CopyrightEnd%
*/
/*
* File: frc5te_wd.c
* Purpose: Watchdog NMI handling for FORCE 5TE
*
* Description:
* The watchdog handler routines are system specific. A program that
* wants to utilize a hardware watchdog should call wd_init and test
* the return value. If wd_init returns true (!0); there is a hardware
* watchdog, and that watchdog has been activated. If no watchdog exists,
* wd_init returns false (0).
*
* To keep the watchdog happy, call wd_reset at least every X seconds,
* where X is the number of seconds specified in the call to wd_init.
*
* The watchdog can be disarmed by setting the variable wd_disarmed to 1,
* and armed again by setting the same variable to 0. Watchdog status
* information can be retrieved using the function wd_status.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <frc5e.h>
#include <logLib.h>
#include <taskLib.h>
#include <sysLib.h>
#include <stdio.h>
#include "hw_watchdog.h"
/* prototypes */
extern sysNMIConnect();
#ifdef __STDC__
void wd_keeper(int);
void wd_nmi_int(UINT8);
void wd_status(void);
#else
void wd_keeper();
void wd_nmi_int();
void wd_status();
#endif
#define WD_NMI_MIN_DELAY 0.830 /* Min time before watchdog NMI (in seconds) */
#define WD_RESET_FREQUENCY (WD_NMI_MIN_DELAY / 2) /* how often the timer is reset */
#define WD_KEEPER_STACK_SIZE 10000
/* global variables */
extern int spTaskOptions;
static volatile int wd_count_startval; /* start value set by wd_init */
static volatile int wd_count; /* counter for wd_keeper */
volatile int wd_disarmed = 0; /* debug feature */
/* wd_init is executed to initialize the watchdog. It spawns the task */
/* wd_keeper and returns true (non-zero) if a hardware watchdog exists, */
/* or returns false (zero) otherwise. */
int wd_init(timeout, prio)
int timeout, prio;
{
taskSpawn("wd_keeper", prio, spTaskOptions, WD_KEEPER_STACK_SIZE,
(FUNCPTR)wd_keeper, timeout,0,0,0,0,0,0,0,0,0);
return !0; /* watchdog exists */
}
/* wd_reset is called as an alive-signal from the supervisor process. */
/* If there is no call to this function within a certain time, the */
/* watchdog will reboot the system. */
void wd_reset()
{
wd_count = wd_count_startval;
}
/* wd_keeper runs as a separate task and resets the watchdog timer */
/* before an NMI is generated. This task uses the counter wd_count to */
/* decide if it should exit or keep resetting the timer. */
/* Note! This task must run with higher priority than the application! */
void wd_keeper(timeout)
int timeout;
{
int wd_delay = sysClkRateGet() * WD_RESET_FREQUENCY;
wd_count_startval = (int)(timeout / WD_RESET_FREQUENCY);
wd_count = wd_count_startval;
/* Connect and enable level 15 interrupts */
sysNMIConnect((VOIDFUNCPTR) wd_nmi_int, WD_NMI, WD_NMI);
*(char *)FRC5CE_GEN_PURPOSE2_REG |= FRC5CE_NMI_ENABLE;
while ((wd_count > 0) || wd_disarmed) {
*(char *)FRC5CE_VME_A32MAP_REG |= FRC5CE_WATCHDOG_ENABLE;
taskDelay(wd_delay);
if (!wd_disarmed) wd_count--;
else wd_count = wd_count_startval;
}
logMsg("Watchdog keeper exits. No alive signal from application in %d seconds.\n",wd_count_startval * WD_RESET_FREQUENCY,0,0,0,0,0);
}
/* wd_nmi_int is the function connected to the watchdog interrupt. */
/* It will report the failure to reset the watchdog timer. */
void wd_nmi_int(type)
UINT8 type;
{
switch(type) {
case WD_NMI:
logMsg("Watchdog interrupt! System will reboot.\n",0,0,0,0,0,0);
break;
default:
logMsg("Bad type (%d) in call to watchdog interrupt handler.\n",type,0,0,0,0,0);
break;
}
}
/* wd_status displays the current value of the counter. */
void wd_status()
{
fprintf(stderr, "Watchdog is %sarmed.\n", wd_disarmed ? "dis" : "");
fprintf(stderr, "Counter value: %d\n", wd_count);
fprintf(stderr, "Start value is: %d (%d seconds)\n",
wd_count_startval, (int)(wd_count_startval * WD_RESET_FREQUENCY));
}
|
/*
* Copyright 2011-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#ifndef BGFX_RENDERDOC_H_HEADER_GUARD
#define BGFX_RENDERDOC_H_HEADER_GUARD
namespace bgfx
{
void* loadRenderDoc();
void unloadRenderDoc(void*);
void renderDocTriggerCapture();
} // namespace bgfx
#endif // BGFX_RENDERDOC_H_HEADER_GUARD
|
/*
* Copyright (C) 2005, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE 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.
*/
#import <Foundation/Foundation.h>
@interface NSFileManager (WebNSFileManagerExtras)
#if !TARGET_OS_IPHONE
- (void)_webkit_setMetadataURL:(NSString *)URLString referrer:(NSString *)referrer atPath:(NSString *)path;
#endif
- (NSString *)_webkit_pathWithUniqueFilenameForPath:(NSString *)path;
#if TARGET_OS_IPHONE
- (NSString *)_webkit_createTemporaryDirectoryWithTemplatePrefix:(NSString *)prefix;
#endif
@end
|
// 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 CC_OUTPUT_RENDERER_SETTINGS_H_
#define CC_OUTPUT_RENDERER_SETTINGS_H_
#include <stddef.h>
#include "cc/base/cc_export.h"
#include "cc/output/buffer_to_texture_target_map.h"
#include "cc/resources/resource_format.h"
namespace cc {
namespace proto {
class RendererSettings;
} // namespace proto
class CC_EXPORT RendererSettings {
public:
RendererSettings();
RendererSettings(const RendererSettings& other);
~RendererSettings();
bool allow_antialiasing;
bool force_antialiasing;
bool force_blending_with_shaders;
bool partial_swap_enabled;
bool finish_rendering_on_resize;
bool should_clear_root_render_pass;
bool disable_display_vsync;
bool release_overlay_resources_after_gpu_query;
bool gl_composited_texture_quad_border;
double refresh_rate;
int highp_threshold_min;
size_t texture_id_allocation_chunk_size;
bool use_gpu_memory_buffer_resources;
ResourceFormat preferred_tile_format;
BufferToTextureTargetMap buffer_to_texture_target_map;
void ToProtobuf(proto::RendererSettings* proto) const;
void FromProtobuf(const proto::RendererSettings& proto);
bool operator==(const RendererSettings& other) const;
};
} // namespace cc
#endif // CC_OUTPUT_RENDERER_SETTINGS_H_
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_
#define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "ipc/ipc_listener.h"
#include "media/video/video_encode_accelerator.h"
#include "ui/gfx/geometry/size.h"
struct AcceleratedVideoEncoderMsg_Encode_Params;
struct AcceleratedVideoEncoderMsg_Encode_Params2;
namespace base {
class SharedMemory;
} // namespace base
namespace gpu {
struct GpuPreferences;
} // namespace gpu
namespace media {
// This class encapsulates the GPU process view of a VideoEncodeAccelerator,
// wrapping the platform-specific VideoEncodeAccelerator instance. It handles
// IPC coming in from the renderer and passes it to the underlying VEA.
class GpuVideoEncodeAccelerator
: public IPC::Listener,
public media::VideoEncodeAccelerator::Client,
public gpu::GpuCommandBufferStub::DestructionObserver {
public:
GpuVideoEncodeAccelerator(int32_t host_route_id,
gpu::GpuCommandBufferStub* stub);
~GpuVideoEncodeAccelerator() override;
// Initialize this accelerator with the given parameters and send
// |init_done_msg| when complete.
bool Initialize(media::VideoPixelFormat input_format,
const gfx::Size& input_visible_size,
media::VideoCodecProfile output_profile,
uint32_t initial_bitrate);
// IPC::Listener implementation
bool OnMessageReceived(const IPC::Message& message) override;
// media::VideoEncodeAccelerator::Client implementation.
void RequireBitstreamBuffers(unsigned int input_count,
const gfx::Size& input_coded_size,
size_t output_buffer_size) override;
void BitstreamBufferReady(int32_t bitstream_buffer_id,
size_t payload_size,
bool key_frame) override;
void NotifyError(media::VideoEncodeAccelerator::Error error) override;
// gpu::GpuCommandBufferStub::DestructionObserver implementation.
void OnWillDestroyStub() override;
// Static query for supported profiles. This query calls the appropriate
// platform-specific version. The returned supported profiles vector will
// not contain duplicates.
static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles(
const gpu::GpuPreferences& gpu_preferences);
private:
typedef std::unique_ptr<media::VideoEncodeAccelerator> (*CreateVEAFp)();
// Return a set of VEA Create function pointers applicable to the current
// platform.
static std::vector<CreateVEAFp> CreateVEAFps(
const gpu::GpuPreferences& gpu_preferences);
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
static std::unique_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA();
#endif
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
static std::unique_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA();
#endif
#if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
static std::unique_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA();
#endif
#if defined(OS_MACOSX)
static std::unique_ptr<media::VideoEncodeAccelerator> CreateVTVEA();
#endif
// IPC handlers, proxying media::VideoEncodeAccelerator for the renderer
// process.
void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params);
void OnEncode2(const AcceleratedVideoEncoderMsg_Encode_Params2& params);
void OnUseOutputBitstreamBuffer(int32_t buffer_id,
base::SharedMemoryHandle buffer_handle,
uint32_t buffer_size);
void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate);
void OnDestroy();
void EncodeFrameFinished(int32_t frame_id,
std::unique_ptr<base::SharedMemory> shm);
void Send(IPC::Message* message);
// Route ID to communicate with the host.
const uint32_t host_route_id_;
// Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is
// registered as a DestuctionObserver of |stub_| and will self-delete when
// |stub_| is destroyed.
gpu::GpuCommandBufferStub* const stub_;
// Owned pointer to the underlying VideoEncodeAccelerator.
std::unique_ptr<media::VideoEncodeAccelerator> encoder_;
base::Callback<bool(void)> make_context_current_;
// Video encoding parameters.
media::VideoPixelFormat input_format_;
gfx::Size input_visible_size_;
gfx::Size input_coded_size_;
size_t output_buffer_size_;
// Weak pointer for media::VideoFrames that refer back to |this|.
base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_;
DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
};
} // namespace media
#endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkLongLongArray.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 vtkLongLongArray - dynamic, self-adjusting array of long long
// .SECTION Description
// vtkLongLongArray is an array of values of type long long.
// It provides methods for insertion and retrieval of values and will
// automatically resize itself to hold new data.
#ifndef __vtkLongLongArray_h
#define __vtkLongLongArray_h
// Tell the template header how to give our superclass a DLL interface.
#if !defined(__vtkLongLongArray_cxx)
# define VTK_DATA_ARRAY_TEMPLATE_TYPE long long
#endif
#include "vtkCommonCoreModule.h" // For export macro
#include "vtkDataArray.h"
#include "vtkDataArrayTemplate.h" // Real Superclass
// Fake the superclass for the wrappers.
#ifndef __WRAP__
#define vtkDataArray vtkDataArrayTemplate<long long>
#endif
class VTKCOMMONCORE_EXPORT vtkLongLongArray : public vtkDataArray
#ifndef __WRAP__
#undef vtkDataArray
#endif
{
public:
static vtkLongLongArray* New();
vtkTypeMacro(vtkLongLongArray,vtkDataArray);
void PrintSelf(ostream& os, vtkIndent indent);
// This macro expands to the set of method declarations that
// make up the interface of vtkDataArrayTemplate, which is ignored
// by the wrappers.
#if defined(__WRAP__) || defined (__WRAP_GCCXML__)
vtkCreateWrappedArrayInterface(long long);
#endif
// Description:
// Get the minimum data value in its native type.
static long long GetDataTypeValueMin() { return VTK_LONG_LONG_MIN; }
// Description:
// Get the maximum data value in its native type.
static long long GetDataTypeValueMax() { return VTK_LONG_LONG_MAX; }
protected:
vtkLongLongArray();
~vtkLongLongArray();
private:
//BTX
typedef vtkDataArrayTemplate<long long> RealSuperclass;
//ETX
vtkLongLongArray(const vtkLongLongArray&); // Not implemented.
void operator=(const vtkLongLongArray&); // Not implemented.
};
#endif
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_RENDER_VIEW_VISITOR_H_
#define CONTENT_RENDERER_RENDER_VIEW_VISITOR_H_
#pragma once
class RenderView;
class RenderViewVisitor {
public:
// Return true to continue visiting RenderViews or false to stop.
virtual bool Visit(RenderView* render_view) = 0;
protected:
virtual ~RenderViewVisitor() {}
};
#endif // CONTENT_RENDERER_RENDER_VIEW_VISITOR_H_
|
#ifndef __EXCEPTION_H__
#define __EXCEPTION_H__
#include <psptypes.h>
/* Define maximum number of thread exception context */
#define PSPLINK_MAX_CONTEXT 8
#define PSPLINK_EXTYPE_NORMAL 0
#define PSPLINK_EXTYPE_DEBUG 1
/* Define continue flags */
#define PSP_EXCEPTION_EXIT 0
#define PSP_EXCEPTION_CONTINUE 1
#define PSP_EXCEPTION_STEP 2
#define PSP_EXCEPTION_SKIP 3
#define PSP_EXCEPTION_NOT_HANDLED 4
/** Structure to hold the register data associated with an exception */
typedef struct _PsplinkRegBlock
{
unsigned int frame[6];
/** Array of the 32 GPRs */
unsigned int r[32];
/** The status register */
unsigned int status;
/** lo */
unsigned int lo;
unsigned int hi;
unsigned int badvaddr;
unsigned int cause;
unsigned int epc;
float fpr[32];
unsigned int fsr;
unsigned int fir;
unsigned int frame_ptr;
unsigned int unused;
/* Unused on PSP */
unsigned int index;
unsigned int random;
unsigned int entrylo0;
unsigned int entrylo1;
unsigned int context;
unsigned int pagemask;
unsigned int wired;
unsigned int cop0_7;
unsigned int cop0_8;
unsigned int cop0_9;
unsigned int entryhi;
unsigned int cop0_11;
unsigned int cop0_12;
unsigned int cop0_13;
unsigned int cop0_14;
/* PRId should still be okay */
unsigned int prid;
/* Type of exception (normal or debug) */
unsigned int type;
/* Pad vfpu to 128bit boundary */
int pad;
float vfpu[128];
} PsplinkRegBlock;
/* A thread context during an exception */
struct PsplinkContext
{
int valid;
struct PsplinkContext *pNext;
PsplinkRegBlock regs;
SceUID thid;
unsigned int drcntl;
/* Continue type */
int cont;
/* Indicates whether this was an error or planned */
int error;
};
#define VFPU_PRINT_SINGLE 0
#define VFPU_PRINT_COL 1
#define VFPU_PRINT_ROW 2
#define VFPU_PRINT_MATRIX 3
#define VFPU_PRINT_TRANS 4
extern struct PsplinkContext *g_currex;
void exceptionInit(void);
void exceptionPrint(struct PsplinkContext *ctx);
void exceptionFpuPrint(struct PsplinkContext *ctx);
void exceptionVfpuPrint(struct PsplinkContext *ctx, int mode);
unsigned int *exceptionGetReg(const char *reg);
void exceptionResume(struct PsplinkContext *ctx, int cont);
void exceptionPrintFPURegs(float *pFpu, unsigned int fsr, unsigned int fir);
void exceptionPrintCPURegs(unsigned int *pRegs);
void exceptionList(void);
void exceptionSetCtx(int ex);
#endif
|
/*
FUNCTION
<<memset>>---set an area of memory
INDEX
memset
ANSI_SYNOPSIS
#include <string.h>
void *memset(const void *<[dst]>, int <[c]>, size_t <[length]>);
TRAD_SYNOPSIS
#include <string.h>
void *memset(<[dst]>, <[c]>, <[length]>)
void *<[dst]>;
int <[c]>;
size_t <[length]>;
DESCRIPTION
This function converts the argument <[c]> into an unsigned
char and fills the first <[length]> characters of the array
pointed to by <[dst]> to the value.
RETURNS
<<memset>> returns the value of <[m]>.
PORTABILITY
<<memset>> is ANSI C.
<<memset>> requires no supporting OS subroutines.
QUICKREF
memset ansi pure
*/
#include <string.h>
#define LBLOCKSIZE (sizeof(long))
#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1))
#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
_PTR
_DEFUN (memset, (m, c, n),
_PTR m _AND
int c _AND
size_t n)
{
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
char *s = (char *) m;
while (n-- != 0)
{
*s++ = (char) c;
}
return m;
#else
char *s = (char *) m;
int i;
unsigned long buffer;
unsigned long *aligned_addr;
if (!TOO_SMALL (n) && !UNALIGNED (m))
{
/* If we get this far, we know that n is large and m is word-aligned. */
aligned_addr = (unsigned long*)m;
/* Store C into each char sized location in BUFFER so that
we can set large blocks quickly. */
c &= 0xff;
if (LBLOCKSIZE == 4)
{
buffer = (c << 8) | c;
buffer |= (buffer << 16);
}
else
{
buffer = 0;
for (i = 0; i < LBLOCKSIZE; i++)
buffer = (buffer << 8) | c;
}
while (n >= LBLOCKSIZE*4)
{
*aligned_addr++ = buffer;
*aligned_addr++ = buffer;
*aligned_addr++ = buffer;
*aligned_addr++ = buffer;
n -= 4*LBLOCKSIZE;
}
while (n >= LBLOCKSIZE)
{
*aligned_addr++ = buffer;
n -= LBLOCKSIZE;
}
/* Pick up the remainder with a bytewise loop. */
s = (char*)aligned_addr;
}
while (n--)
{
*s++ = (char)c;
}
return m;
#endif /* not PREFER_SIZE_OVER_SPEED */
}
|
// -*-Mode: C++;-*- // technically C99
// * BeginRiceCopyright *****************************************************
//
// $HeadURL$
// $Id$
//
// --------------------------------------------------------------------------
// Part of HPCToolkit (hpctoolkit.org)
//
// Information about sources of support for research and development of
// HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
// --------------------------------------------------------------------------
//
// Copyright ((c)) 2002-2015, Rice University
// 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 Rice University (RICE) 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 RICE 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 RICE 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.
//
// ******************************************************* EndRiceCopyright *
#ifndef CSPROF_SYNCHRONOUS_H
#define CSPROF_SYNCHRONOUS_H
/* hpcrun_fetch_stack_pointer takes a `void **' to force procedures in
which it is used to require a stack frame. this gets around several
problems, notably the problem of return addresses being in registers. */
#if defined(OSF) && defined(__DECC)
static inline void
hpcrun_fetch_stack_pointer(void **stack_pointer_loc)
{
asm("stq sp, 0(v0)", stack_pointer_loc);
}
/* is this procedure general enough to be moved outside #if? */
static inline void
hpcrun_take_synchronous_sample(unsigned int sample_count)
{
void *ra_loc;
hpcrun_state_t *state = hpcrun_get_state();
hpcrun_undo_swizzled_data(state, NULL);
hpcrun_fetch_stack_pointer(&ra_loc);
hpcrun_take_sample(sample_count);
hpcrun_swizzle_location(state, ra_loc);
}
#endif
#endif
|
/*
Copyright (C) 2003 Commonwealth Scientific and Industrial Research
Organisation (CSIRO) Australia
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 CSIRO Australia 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 ORGANISATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include <string.h>
#include "oggz/oggz.h"
#include "oggz_tests.h"
/*#define DEBUG*/
#define DATA_BUF_LEN 4096
static long serialno;
static int read_called = 0;
static unsigned char packet_buf[1024];
static long total_bytes_written = 0;
static long total_bytes_read = 0;
#define MAX_ITER 10
static int
hungry (OGGZ * oggz, int empty, void * user_data)
{
ogg_packet op;
int err;
static long packet_bytes_w = 1;
static int iter = 0;
static long b_o_s = 1;
static long e_o_s = 0;
if (iter > MAX_ITER) return 1;
total_bytes_written += packet_bytes_w;
memset (packet_buf, 'a' + iter, 1024);
op.packet = packet_buf;
op.bytes = packet_bytes_w;
op.b_o_s = b_o_s;
op.e_o_s = e_o_s;
op.granulepos = total_bytes_written-1;
op.packetno = iter;
if ((err = oggz_write_feed (oggz, &op, serialno, 0, NULL)) != 0) {
#ifdef DEBUG
printf ("oggz_write_feed: error %d\n", err);
#endif
FAIL ("Could not feed OGGZ");
}
#ifdef DEBUG
printf ("hungry: packet_bytes_w %ld, eos %d\n", packet_bytes_w, e_o_s);
#endif
iter++;
b_o_s = 0;
if (iter == MAX_ITER) e_o_s = 1;
packet_bytes_w *= 2;
return 0;
}
static int
read_packet (OGGZ * oggz, oggz_packet * zp, long serialno, void * user_data)
{
ogg_packet * op = &zp->op;
static long packet_bytes_r = 1;
static int iter = 0;
static long b_o_s = 1;
static long e_o_s = 0;
if (iter > MAX_ITER) return 1;
#ifdef DEBUG
printf ("%08" PRI_OGGZ_OFF_T "x: serialno %010lu, "
"granulepos %" PRId64 ", packetno %" PRId64,
oggz_tell (oggz), serialno, op->granulepos, op->packetno);
if (op->b_o_s) {
printf (" *** bos");
}
if (op->e_o_s) {
printf (" *** eos");
}
printf ("\n");
#endif
total_bytes_read += op->bytes;
#ifdef DEBUG
printf ("packet_bytes_r expected: %ld, ", packet_bytes_r);
printf ("op->bytes got: %ld\n", op->bytes);
#endif
if (op->bytes != packet_bytes_r)
FAIL ("Read incorrect length packet");
if (op->packet[packet_bytes_r-1] != 'a' + iter)
FAIL ("Packet contains incorrect data");
if ((op->b_o_s == 0) != (b_o_s == 0))
FAIL ("Packet has incorrect b_o_s");
if ((op->e_o_s == 0) != (e_o_s == 0))
FAIL ("Packet has incorrect e_o_s");
if (op->granulepos != -1 && op->granulepos != total_bytes_read-1)
FAIL ("Packet has incorrect granulepos");
if (op->packetno != iter)
FAIL ("Packet has incorrect packetno");
iter++;
b_o_s = 0;
if (iter == MAX_ITER) e_o_s = 1;
packet_bytes_r *= 2;
return 0;
}
static size_t
my_io_read (void * user_handle, void * buf, size_t n)
{
unsigned char * data_buf = (unsigned char *)user_handle;
static int offset = 0;
int len;
len = MIN ((int)n, DATA_BUF_LEN - offset);
memcpy (buf, &data_buf[offset], len);
offset += len;
return len;
}
int
main (int argc, char * argv[])
{
OGGZ * reader, * writer;
unsigned char data_buf[DATA_BUF_LEN];
long n, nread;
INFO ("Counting bytes read from packets written");
writer = oggz_new (OGGZ_WRITE);
if (writer == NULL)
FAIL("newly created OGGZ writer == NULL");
serialno = oggz_serialno_new (writer);
if (oggz_write_set_hungry_callback (writer, hungry, 1, NULL) == -1)
FAIL("Could not set hungry callback");
reader = oggz_new (OGGZ_READ);
if (reader == NULL)
FAIL("newly created OGGZ reader == NULL");
oggz_io_set_read (reader, my_io_read, data_buf);
oggz_set_read_callback (reader, -1, read_packet, NULL);
while ((n = oggz_write_output (writer, data_buf, DATA_BUF_LEN)) != 0) {
#ifdef DEBUG
printf ("Wrote %ld bytes ...\n", n);
#endif
if (n > DATA_BUF_LEN)
FAIL("Too much data generated by writer");
if (n > 0) {
nread = oggz_read (reader, n);
#ifdef DEBUG
printf ("Read %ld bytes ...\n", n);
#endif
} else break;
}
if (oggz_close (writer) != 0)
FAIL("Could not close OGGZ writer");
while (oggz_read (reader, n) > 0);
if (oggz_close (reader) != 0)
FAIL("Could not close OGGZ reader");
#ifdef DEBUG
printf ("total_bytes_written: %ld\n", total_bytes_written);
printf ("total_bytes_read: %ld\n", total_bytes_read);
#endif
if (total_bytes_written < total_bytes_read)
FAIL ("Read more data than was written");
if (total_bytes_written > total_bytes_read)
FAIL ("Failed to read all data that was written");
exit (0);
}
|
#include "common.h"
const char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return_t rc)
{
switch (rc)
{
case MEMCACHED_SUCCESS:
return "SUCCESS";
case MEMCACHED_FAILURE:
return "FAILURE";
case MEMCACHED_HOST_LOOKUP_FAILURE:
return "HOSTNAME LOOKUP FAILURE";
case MEMCACHED_CONNECTION_FAILURE:
return "CONNECTION FAILURE";
case MEMCACHED_CONNECTION_BIND_FAILURE:
return "CONNECTION BIND FAILURE";
case MEMCACHED_READ_FAILURE:
return "READ FAILURE";
case MEMCACHED_UNKNOWN_READ_FAILURE:
return "UNKNOWN READ FAILURE";
case MEMCACHED_PROTOCOL_ERROR:
return "PROTOCOL ERROR";
case MEMCACHED_CLIENT_ERROR:
return "CLIENT ERROR";
case MEMCACHED_SERVER_ERROR:
return "SERVER ERROR";
case MEMCACHED_WRITE_FAILURE:
return "WRITE FAILURE";
case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE:
return "CONNECTION SOCKET CREATE FAILURE";
case MEMCACHED_DATA_EXISTS:
return "CONNECTION DATA EXISTS";
case MEMCACHED_DATA_DOES_NOT_EXIST:
return "CONNECTION DATA DOES NOT EXIST";
case MEMCACHED_NOTSTORED:
return "NOT STORED";
case MEMCACHED_STORED:
return "STORED";
case MEMCACHED_NOTFOUND:
return "NOT FOUND";
case MEMCACHED_MEMORY_ALLOCATION_FAILURE:
return "MEMORY ALLOCATION FAILURE";
case MEMCACHED_PARTIAL_READ:
return "PARTIAL READ";
case MEMCACHED_SOME_ERRORS:
return "SOME ERRORS WERE REPORTED";
case MEMCACHED_NO_SERVERS:
return "NO SERVERS DEFINED";
case MEMCACHED_END:
return "SERVER END";
case MEMCACHED_DELETED:
return "SERVER DELETE";
case MEMCACHED_VALUE:
return "SERVER VALUE";
case MEMCACHED_STAT:
return "STAT VALUE";
case MEMCACHED_ITEM:
return "ITEM VALUE";
case MEMCACHED_ERRNO:
return "SYSTEM ERROR";
case MEMCACHED_FAIL_UNIX_SOCKET:
return "COULD NOT OPEN UNIX SOCKET";
case MEMCACHED_NOT_SUPPORTED:
return "ACTION NOT SUPPORTED";
case MEMCACHED_FETCH_NOTFINISHED:
return "FETCH WAS NOT COMPLETED";
case MEMCACHED_NO_KEY_PROVIDED:
return "A KEY LENGTH OF ZERO WAS PROVIDED";
case MEMCACHED_BUFFERED:
return "ACTION QUEUED";
case MEMCACHED_TIMEOUT:
return "A TIMEOUT OCCURRED";
case MEMCACHED_BAD_KEY_PROVIDED:
return "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE";
case MEMCACHED_INVALID_HOST_PROTOCOL:
return "THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT";
case MEMCACHED_SERVER_MARKED_DEAD:
return "SERVER IS MARKED DEAD";
case MEMCACHED_UNKNOWN_STAT_KEY:
return "ENCOUNTERED AN UNKNOWN STAT KEY";
case MEMCACHED_E2BIG:
return "ITEM TOO BIG";
case MEMCACHED_INVALID_ARGUMENTS:
return "INVALID ARGUMENTS";
case MEMCACHED_KEY_TOO_BIG:
return "KEY RETURNED FROM SERVER WAS TOO LARGE";
case MEMCACHED_AUTH_PROBLEM:
return "FAILED TO SEND AUTHENTICATION TO SERVER";
case MEMCACHED_AUTH_FAILURE:
return "AUTHENTICATION FAILURE";
case MEMCACHED_AUTH_CONTINUE:
return "CONTINUE AUTHENTICATION";
case MEMCACHED_MAXIMUM_RETURN:
return "Gibberish returned!";
default:
return "Gibberish returned!";
}
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
#define BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
#include "base/base_export.h"
#include "base/macros.h"
#include "base/message_loop/message_pump.h"
#include "base/synchronization/waitable_event.h"
#include "base/time/time.h"
#include "build/build_config.h"
namespace base {
class BASE_EXPORT MessagePumpDefault : public MessagePump {
public:
MessagePumpDefault();
MessagePumpDefault(const MessagePumpDefault&) = delete;
MessagePumpDefault& operator=(const MessagePumpDefault&) = delete;
~MessagePumpDefault() override;
// MessagePump methods:
void Run(Delegate* delegate) override;
void Quit() override;
void ScheduleWork() override;
void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
#if defined(OS_APPLE)
void SetTimerSlack(TimerSlack timer_slack) override;
#endif
private:
// This flag is set to false when Run should return.
bool keep_running_;
// Used to sleep until there is more work to do.
WaitableEvent event_;
};
} // namespace base
#endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_TOOLS_PLAYER_X11_GLES_VIDEO_RENDERER_H_
#define MEDIA_TOOLS_PLAYER_X11_GLES_VIDEO_RENDERER_H_
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <utility>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "media/base/filters.h"
#include "media/base/video_frame.h"
#include "media/filters/video_renderer_base.h"
class GlesVideoRenderer : public media::VideoRendererBase {
public:
GlesVideoRenderer(Display* display, Window window, MessageLoop* message_loop);
// This method is called to paint the current video frame to the assigned
// window.
void Paint();
static GlesVideoRenderer* instance() { return instance_; }
MessageLoop* glx_thread_message_loop() {
return glx_thread_message_loop_;
}
protected:
// VideoRendererBase implementation.
virtual bool OnInitialize(media::VideoDecoder* decoder);
virtual void OnStop(media::FilterCallback* callback);
virtual void OnFrameAvailable();
private:
// Only allow to be deleted by reference counting.
friend class scoped_refptr<GlesVideoRenderer>;
virtual ~GlesVideoRenderer();
GLuint FindTexture(scoped_refptr<media::VideoFrame> video_frame);
bool InitializeGles();
void CreateShader(GLuint program, GLenum type,
const char* vs_source, int vs_size);
void LinkProgram(GLuint program);
void CreateTextureAndProgramEgl();
void CreateTextureAndProgramYuv2Rgb();
void DeInitializeGlesTask(media::FilterCallback* callback);
PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr_;
PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr_;
Display* display_;
Window window_;
// EGL context.
EGLDisplay egl_display_;
EGLSurface egl_surface_;
EGLContext egl_context_;
// textures for EGL image
typedef std::pair<scoped_refptr<media::VideoFrame>, GLuint> EglFrame;
std::vector<EglFrame> egl_frames_;
// 3 textures, one for each plane.
GLuint textures_[3];
MessageLoop* glx_thread_message_loop_;
static GlesVideoRenderer* instance_;
DISALLOW_COPY_AND_ASSIGN(GlesVideoRenderer);
};
#endif // MEDIA_TOOLS_PLAYER_X11_GLES_VIDEO_RENDERER_H_
|
/*
* (C) Copyright 2010-2012
* NVIDIA Corporation <www.nvidia.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __TEGRA_COMMON_POST_H
#define __TEGRA_COMMON_POST_H
/*
* Size of malloc() pool
*/
#ifdef CONFIG_USB_FUNCTION_DFU
#define CONFIG_SYS_MALLOC_LEN (SZ_4M + \
CONFIG_SYS_DFU_DATA_BUF_SIZE + \
CONFIG_SYS_DFU_MAX_FILE_SIZE)
#else
#define CONFIG_SYS_MALLOC_LEN (4 << 20) /* 4MB */
#endif
#define CONFIG_SYS_NONCACHED_MEMORY (1 << 20) /* 1 MiB */
#ifndef CONFIG_SPL_BUILD
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 1) \
func(MMC, mmc, 0) \
func(USB, usb, 0) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
#include <config_distro_bootcmd.h>
#else
#define BOOTENV
#endif
#ifdef CONFIG_TEGRA_KEYBOARD
#define STDIN_KBD_KBC ",tegra-kbc"
#else
#define STDIN_KBD_KBC ""
#endif
#ifdef CONFIG_USB_KEYBOARD
#define STDIN_KBD_USB ",usbkbd"
#define CONFIG_PREBOOT "usb start"
#else
#define STDIN_KBD_USB ""
#endif
#ifdef CONFIG_LCD
#define STDOUT_LCD ",lcd"
#else
#define STDOUT_LCD ""
#endif
#ifdef CONFIG_DM_VIDEO
#define STDOUT_VIDEO ",vidconsole"
#else
#define STDOUT_VIDEO ""
#endif
#ifdef CONFIG_CROS_EC_KEYB
#define STDOUT_CROS_EC ",cros-ec-keyb"
#else
#define STDOUT_CROS_EC ""
#endif
#define TEGRA_DEVICE_SETTINGS \
"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB STDOUT_CROS_EC "\0" \
"stdout=serial" STDOUT_LCD STDOUT_VIDEO "\0" \
"stderr=serial" STDOUT_LCD STDOUT_VIDEO "\0" \
""
#ifndef BOARD_EXTRA_ENV_SETTINGS
#define BOARD_EXTRA_ENV_SETTINGS
#endif
#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
#ifndef CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
#define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
#endif
#ifdef CONFIG_ARM64
#define FDT_HIGH "ffffffffffffffff"
#define INITRD_HIGH "ffffffffffffffff"
#else
#define FDT_HIGH "ffffffff"
#define INITRD_HIGH "ffffffff"
#endif
#define CONFIG_EXTRA_ENV_SETTINGS \
TEGRA_DEVICE_SETTINGS \
MEM_LAYOUT_ENV_SETTINGS \
"fdt_high=" FDT_HIGH "\0" \
"initrd_high=" INITRD_HIGH "\0" \
BOOTENV \
BOARD_EXTRA_ENV_SETTINGS \
CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
#if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
#define CONFIG_TEGRA_SPI
#endif
/* overrides for SPL build here */
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
/* remove I2C support */
#ifdef CONFIG_SYS_I2C_TEGRA
#undef CONFIG_SYS_I2C_TEGRA
#endif
#ifdef CONFIG_CMD_I2C
#endif
/* remove partitions/filesystems */
#ifdef CONFIG_FS_EXT4
#undef CONFIG_FS_EXT4
#endif
/* remove USB */
#ifdef CONFIG_USB_EHCI_TEGRA
#undef CONFIG_USB_EHCI_TEGRA
#endif
#ifdef CONFIG_CMD_USB
#endif
#endif /* CONFIG_SPL_BUILD */
#endif /* __TEGRA_COMMON_POST_H */
|
/*
* Packed Animation File audio decoder
* Copyright (c) 2012 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
#include "mathops.h"
#define PAF_SOUND_SAMPLES 2205
#define PAF_SOUND_FRAME_SIZE ((256 + PAF_SOUND_SAMPLES) * 2)
static av_cold int paf_audio_init(AVCodecContext *avctx)
{
if (avctx->channels != 2) {
av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
return AVERROR_INVALIDDATA;
}
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
return 0;
}
static int paf_audio_decode(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *pkt)
{
AVFrame *frame = data;
int16_t *output_samples;
const uint8_t *src = pkt->data;
int frames, ret, i, j;
int16_t cb[256];
frames = pkt->size / PAF_SOUND_FRAME_SIZE;
if (frames < 1)
return AVERROR_INVALIDDATA;
frame->nb_samples = PAF_SOUND_SAMPLES * frames;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
output_samples = (int16_t *)frame->data[0];
// codebook of 256 16-bit samples and 8-bit indices to it
for (j = 0; j < frames; j++) {
for (i = 0; i < 256; i++)
cb[i] = sign_extend(AV_RL16(src + i * 2), 16);
src += 256 * 2;
// always 2 channels
for (i = 0; i < PAF_SOUND_SAMPLES * 2; i++)
*output_samples++ = cb[*src++];
}
*got_frame = 1;
return pkt->size;
}
AVCodec ff_paf_audio_decoder = {
.name = "paf_audio",
.long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Audio"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_PAF_AUDIO,
.init = paf_audio_init,
.decode = paf_audio_decode,
.capabilities = CODEC_CAP_DR1,
};
|
//
// NSBundle+YYAdd.h
// YYCategories <https://github.com/ibireme/YYCategories>
//
// Created by ibireme on 14/10/20.
// Copyright (c) 2015 ibireme.
//
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
Provides extensions for `NSBundle` to get resource by @2x or @3x...
Example: ico.png, ico@2x.png, ico@3x.png. Call scaledResource:@"ico" ofType:@"png"
on iPhone6 will return "ico@2x.png"'s path.
*/
@interface NSBundle (YYAdd)
/**
An array of NSNumber objects, shows the best order for path scale search.
e.g. iPhone3GS:@[@1,@2,@3] iPhone5:@[@2,@3,@1] iPhone6 Plus:@[@3,@2,@1]
*/
+ (NSArray *)preferredScales;
/**
Returns the full pathname for the resource file identified by the specified
name and extension and residing in a given bundle directory. It first search
the file with current screen's scale (such as @2x), then search from higher
scale to lower scale.
@param name The name of a resource file contained in the directory
specified by bundlePath.
@param ext If extension is an empty string or nil, the extension is
assumed not to exist and the file is the first file encountered that exactly matches name.
@param bundlePath The path of a top-level bundle directory. This must be a
valid path. For example, to specify the bundle directory for a Mac app, you
might specify the path /Applications/MyApp.app.
@return The full pathname for the resource file or nil if the file could not be
located. This method also returns nil if the bundle specified by the bundlePath
parameter does not exist or is not a readable directory.
*/
+ (NSString *)pathForScaledResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)bundlePath;
/**
Returns the full pathname for the resource identified by the specified name and
file extension. It first search the file with current screen's scale (such as @2x),
then search from higher scale to lower scale.
@param name The name of the resource file. If name is an empty string or
nil, returns the first file encountered of the supplied type.
@param ext If extension is an empty string or nil, the extension is
assumed not to exist and the file is the first file encountered that exactly matches name.
@return The full pathname for the resource file or nil if the file could not be located.
*/
- (NSString *)pathForScaledResource:(NSString *)name ofType:(NSString *)ext;
/**
Returns the full pathname for the resource identified by the specified name and
file extension and located in the specified bundle subdirectory. It first search
the file with current screen's scale (such as @2x), then search from higher
scale to lower scale.
@param name The name of the resource file.
@param ext If extension is an empty string or nil, all the files in
subpath and its subdirectories are returned. If an extension is provided the
subdirectories are not searched.
@param subpath The name of the bundle subdirectory. Can be nil.
@return The full pathname for the resource file or nil if the file could not be located.
*/
- (NSString *)pathForScaledResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)subpath;
@end
|
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
void error(char *msg)
{
perror(msg);
exit(0);
}
int main(int argc, char *argv[])
{
int sockfd, portno, n;
struct sockaddr_in serv_addr;
struct hostent *server;
char buffer[256];
if (argc < 3) {
fprintf(stderr,"usage %s hostname port\n", argv[0]);
exit(0);
}
portno = atoi(argv[2]);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
server = gethostbyname(argv[1]);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(portno);
if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0)
error("ERROR connecting");
printf("Please enter the message: ");
bzero(buffer,256);
fgets(buffer,255,stdin);
n = write(sockfd,buffer,strlen(buffer));
if (n < 0)
error("ERROR writing to socket");
bzero(buffer,256);
n = read(sockfd,buffer,255);
if (n < 0)
error("ERROR reading from socket");
printf("%s\n",buffer);
return 0;
}
|
// ---------------------------------------------------------------------------------
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ---------------------------------------------------------------------------------
#pragma once
#ifndef _AMQP_AMQPSYMBOL_H_
#define _AMQP_AMQPSYMBOL_H_
#include <string>
#include "IAMQPData.h"
namespace amqp
{
class AMQPSymbol : public IAMQPData
{
public:
AMQPSymbol(std::string const &symbol);
virtual ~AMQPSymbol()
{
};
pn_bytes_t getSymbol() const;
virtual Type getDataType() const;
virtual std::shared_ptr<IAMQPData> copy() const;
private:
std::string m_symbol;
};
};
#endif // _AMQP_AMQPSYMBOL_H_ |
// Copyright (c) 2009-2012 The Bitcoin Developers
// Copyright (c) 2011-2012 BBQCoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef __CRYPTER_H__
#define __CRYPTER_H__
#include "allocators.h" /* for SecureString */
#include "key.h"
#include "serialize.h"
const unsigned int WALLET_CRYPTO_KEY_SIZE = 32;
const unsigned int WALLET_CRYPTO_SALT_SIZE = 8;
/*
Private key encryption is done based on a CMasterKey,
which holds a salt and random encryption key.
CMasterKeys are encrypted using AES-256-CBC using a key
derived using derivation method nDerivationMethod
(0 == EVP_sha512()) and derivation iterations nDeriveIterations.
vchOtherDerivationParameters is provided for alternative algorithms
which may require more parameters (such as scrypt).
Wallet Private Keys are then encrypted using AES-256-CBC
with the double-sha256 of the public key as the IV, and the
master key's key as the encryption key (see keystore.[ch]).
*/
/** Master key for wallet encryption */
class CMasterKey
{
public:
std::vector<unsigned char> vchCryptedKey;
std::vector<unsigned char> vchSalt;
// 0 = EVP_sha512()
// 1 = scrypt()
unsigned int nDerivationMethod;
unsigned int nDeriveIterations;
// Use this for more parameters to key derivation,
// such as the various parameters to scrypt
std::vector<unsigned char> vchOtherDerivationParameters;
IMPLEMENT_SERIALIZE
(
READWRITE(vchCryptedKey);
READWRITE(vchSalt);
READWRITE(nDerivationMethod);
READWRITE(nDeriveIterations);
READWRITE(vchOtherDerivationParameters);
)
CMasterKey()
{
// 25000 rounds is just under 0.1 seconds on a 1.86 GHz Pentium M
// ie slightly lower than the lowest hardware we need bother supporting
nDeriveIterations = 25000;
nDerivationMethod = 0;
vchOtherDerivationParameters = std::vector<unsigned char>(0);
}
};
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
/** Encryption/decryption context with key information */
class CCrypter
{
private:
unsigned char chKey[WALLET_CRYPTO_KEY_SIZE];
unsigned char chIV[WALLET_CRYPTO_KEY_SIZE];
bool fKeySet;
public:
bool SetKeyFromPassphrase(const SecureString &strKeyData, const std::vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod);
bool Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext);
bool Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext);
bool SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigned char>& chNewIV);
void CleanKey()
{
memset(&chKey, 0, sizeof chKey);
memset(&chIV, 0, sizeof chIV);
munlock(&chKey, sizeof chKey);
munlock(&chIV, sizeof chIV);
fKeySet = false;
}
CCrypter()
{
fKeySet = false;
}
~CCrypter()
{
CleanKey();
}
};
bool EncryptSecret(CKeyingMaterial& vMasterKey, const CSecret &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext);
bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char> &vchCiphertext, const uint256& nIV, CSecret &vchPlaintext);
#endif
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_KEYSTORE_H
#define BITCOIN_KEYSTORE_H
#include <hdchain.h>
#include <key.h>
#include <pubkey.h>
#include <script/script.h>
#include <script/sign.h>
#include <script/standard.h>
#include <sync.h>
#include <boost/signals2/signal.hpp>
/** A virtual base class for key stores */
class CKeyStore : public SigningProvider
{
public:
//! Add a key to the store.
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) =0;
//! Check whether a key corresponding to a given address is present in the store.
virtual bool HaveKey(const CKeyID &address) const =0;
virtual std::set<CKeyID> GetKeys() const =0;
//! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
virtual bool AddCScript(const CScript& redeemScript) =0;
virtual bool HaveCScript(const CScriptID &hash) const =0;
virtual std::set<CScriptID> GetCScripts() const =0;
//! Support for Watch-only addresses
virtual bool AddWatchOnly(const CScript &dest) =0;
virtual bool RemoveWatchOnly(const CScript &dest) =0;
virtual bool HaveWatchOnly(const CScript &dest) const =0;
virtual bool HaveWatchOnly() const =0;
};
/** Basic key store, that keeps keys in an address->secret map */
class CBasicKeyStore : public CKeyStore
{
protected:
mutable CCriticalSection cs_KeyStore;
using KeyMap = std::map<CKeyID, CKey>;
using WatchKeyMap = std::map<CKeyID, CPubKey>;
using ScriptMap = std::map<CScriptID, CScript>;
using WatchOnlySet = std::set<CScript>;
KeyMap mapKeys GUARDED_BY(cs_KeyStore);
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore);
ScriptMap mapScripts GUARDED_BY(cs_KeyStore);
WatchOnlySet setWatchOnly GUARDED_BY(cs_KeyStore);
/* the HD chain data model*/
CHDChain hdChain GUARDED_BY(cs_KeyStore);
public:
bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey) override;
bool AddKey(const CKey &key) { return AddKeyPubKey(key, key.GetPubKey()); }
bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override;
bool HaveKey(const CKeyID &address) const override;
std::set<CKeyID> GetKeys() const override;
bool GetKey(const CKeyID &address, CKey &keyOut) const override;
bool AddCScript(const CScript& redeemScript) override;
bool HaveCScript(const CScriptID &hash) const override;
std::set<CScriptID> GetCScripts() const override;
bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override;
bool AddWatchOnly(const CScript &dest) override;
bool RemoveWatchOnly(const CScript &dest) override;
bool HaveWatchOnly(const CScript &dest) const override;
bool HaveWatchOnly() const override;
virtual bool GetHDChain(CHDChain& hdChainRet) const;
};
#endif // BITCOIN_KEYSTORE_H
|
/************************************************************************
*
* CppSharp
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/
#pragma once
#include <llvm/Object/ELF.h>
namespace CppSharp { namespace CppParser {
template<typename ELFT>
class ELFDumper {
public:
ELFDumper(const llvm::object::ELFFile<ELFT> *Obj);
std::vector<llvm::StringRef> getNeededLibraries() const;
private:
typedef llvm::object::ELFFile<ELFT> ELFO;
typedef typename ELFO::Elf_Sym Elf_Sym;
typedef typename ELFO::Elf_Dyn Elf_Dyn;
typedef typename ELFO::Elf_Dyn_Range Elf_Dyn_Range;
typedef typename ELFO::Elf_Phdr Elf_Phdr;
typedef typename ELFO::uintX_t uintX_t;
/// \brief Represents a region described by entries in the .dynamic table.
struct DynRegionInfo {
DynRegionInfo() : Addr(nullptr), Size(0), EntSize(0) {}
/// \brief Address in current address space.
const void *Addr;
/// \brief Size in bytes of the region.
uintX_t Size;
/// \brief Size of each entity in the region.
uintX_t EntSize;
};
llvm::StringRef getDynamicString(uint64_t Offset) const;
const Elf_Dyn *dynamic_table_begin() const;
const Elf_Dyn *dynamic_table_end() const;
llvm::iterator_range<const Elf_Dyn*> dynamic_table() const {
return llvm::make_range(dynamic_table_begin(), dynamic_table_end());
}
const ELFO *Obj;
DynRegionInfo DynamicRegion;
llvm::StringRef DynamicStringTable;
};
template <typename ELFT>
ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> *Obj) {
llvm::SmallVector<const Elf_Phdr *, 4> LoadSegments;
auto ProgramHeaders = Obj->program_headers();
if (ProgramHeaders.takeError())
{
llvm::report_fatal_error("Error reading program headers");
return;
}
for (const Elf_Phdr &Phdr : ProgramHeaders.get()) {
if (Phdr.p_type == llvm::ELF::PT_DYNAMIC) {
DynamicRegion.Addr = Obj->base() + Phdr.p_offset;
uint64_t Size = Phdr.p_filesz;
if (Size % sizeof(Elf_Dyn))
llvm::report_fatal_error("Invalid dynamic table size");
DynamicRegion.Size = Phdr.p_filesz;
continue;
}
if (Phdr.p_type != llvm::ELF::PT_LOAD || Phdr.p_filesz == 0)
continue;
LoadSegments.push_back(&Phdr);
}
auto toMappedAddr = [&](uint64_t VAddr) -> const uint8_t *{
const Elf_Phdr **I = std::upper_bound(
LoadSegments.begin(), LoadSegments.end(), VAddr, llvm::object::compareAddr<ELFT>);
if (I == LoadSegments.begin())
llvm::report_fatal_error("Virtual address is not in any segment");
--I;
const Elf_Phdr &Phdr = **I;
uint64_t Delta = VAddr - Phdr.p_vaddr;
if (Delta >= Phdr.p_filesz)
llvm::report_fatal_error("Virtual address is not in any segment");
return Obj->base() + Phdr.p_offset + Delta;
};
const char *StringTableBegin = nullptr;
uint64_t StringTableSize = 0;
for (const Elf_Dyn &Dyn : dynamic_table()) {
switch (Dyn.d_tag) {
case llvm::ELF::DT_STRTAB:
StringTableBegin = (const char *)toMappedAddr(Dyn.getPtr());
break;
case llvm::ELF::DT_STRSZ:
StringTableSize = Dyn.getVal();
break;
}
}
if (StringTableBegin)
DynamicStringTable = StringRef(StringTableBegin, StringTableSize);
}
template <typename ELFT>
const typename ELFDumper<ELFT>::Elf_Dyn *
ELFDumper<ELFT>::dynamic_table_begin() const {
return reinterpret_cast<const Elf_Dyn *>(DynamicRegion.Addr);
}
template <typename ELFT>
const typename ELFDumper<ELFT>::Elf_Dyn *
ELFDumper<ELFT>::dynamic_table_end() const {
uint64_t Size = DynamicRegion.Size;
return dynamic_table_begin() + Size / sizeof(Elf_Dyn);
}
template <class ELFT>
llvm::StringRef ELFDumper<ELFT>::getDynamicString(uint64_t Value) const {
return llvm::StringRef(DynamicStringTable.data() + Value);
}
template<class ELFT>
std::vector<llvm::StringRef> ELFDumper<ELFT>::getNeededLibraries() const {
std::vector<llvm::StringRef> Libs;
for (const auto &Entry : dynamic_table())
if (Entry.d_tag == llvm::ELF::DT_NEEDED)
Libs.push_back(getDynamicString(Entry.d_un.d_val));
return Libs;
}
} }
|
// -*- Mode: C++; -*-
// Package : omniORB
// callHandle.h Created on: 16/05/2001
// Author : Duncan Grisby (dpg1)
//
// Copyright (C) 2001 AT&T Laboratories Cambridge
//
// This file is part of the omniORB library
//
// The omniORB library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Description:
//
// Call handle used during remote or in-process operation dispatch.
/*
$Log: callHandle.h,v $
Revision 1.1.4.3 2006/07/02 22:52:05 dgrisby
Store self thread in task objects to avoid calls to self(), speeding
up Current. Other minor performance tweaks.
Revision 1.1.4.2 2005/07/22 17:18:40 dgrisby
Another merge from omni4_0_develop.
Revision 1.1.4.1 2003/03/23 21:04:17 dgrisby
Start of omniORB 4.1.x development branch.
Revision 1.1.2.5 2003/01/14 11:48:15 dgrisby
Remove warnings from gcc -Wshadow. Thanks Pablo Mejia.
Revision 1.1.2.4 2001/08/15 10:26:07 dpg1
New object table behaviour, correct POA semantics.
Revision 1.1.2.3 2001/08/01 10:08:19 dpg1
Main thread policy.
Revision 1.1.2.2 2001/06/07 16:24:08 dpg1
PortableServer::Current support.
Revision 1.1.2.1 2001/05/29 17:03:48 dpg1
In process identity.
*/
#ifndef __OMNIORB_CALLHANDLE_H__
#define __OMNIORB_CALLHANDLE_H__
#include <omniORB4/callDescriptor.h>
#include <omniORB4/IOP_S.h>
OMNI_NAMESPACE_BEGIN(omni)
class omniOrbPOA;
OMNI_NAMESPACE_END(omni)
class omniLocalIdentity;
class omniCallHandle {
public:
inline omniCallHandle(_OMNI_NS(IOP_S)* iop_s_, omni_thread* self_thread)
: pd_iop_s(iop_s_),
pd_call_desc(0),
pd_op(iop_s_->operation_name()),
pd_postinvoke_hook(0),
pd_poa(0),
pd_localId(0),
pd_mainthread_mu(0),
pd_self_thread(self_thread),
pd_try_direct(0)
{}
inline omniCallHandle(omniCallDescriptor* call_desc_,
_CORBA_Boolean try_direct_)
: pd_iop_s(0),
pd_call_desc(call_desc_),
pd_op(call_desc_->op()),
pd_postinvoke_hook(0),
pd_poa(0),
pd_localId(0),
pd_mainthread_mu(0),
pd_self_thread(0),
pd_try_direct(try_direct_)
{}
inline const char* operation_name() const { return pd_op; }
inline _OMNI_NS(IOP_S*) iop_s() const { return pd_iop_s; }
inline omniCallDescriptor* call_desc() const { return pd_call_desc; }
inline _CORBA_Boolean try_direct() const { return pd_try_direct; }
void upcall(omniServant* servant, omniCallDescriptor& desc);
// Class PostInvokeHook is used to insert extra processing after the
// upcall is made but before the results are marshalled. It is used
// in ServantLocator dispatch.
class PostInvokeHook {
public:
virtual void postinvoke() = 0;
virtual ~PostInvokeHook();
};
inline void postinvoke_hook(PostInvokeHook* hook) {
pd_postinvoke_hook = hook;
}
void SkipRequestBody();
// SkipRequestBody is called if an exception occurs while
// unmarshalling arguments. It skips any remaining input data so the
// exception may be returned as soon as possible.
inline void poa(_OMNI_NS(omniOrbPOA)* poa_) { pd_poa = poa_; }
inline void localId(omniLocalIdentity* id) { pd_localId = id; }
inline void mainThread(omni_tracedmutex* mu, omni_tracedcondition* cond) {
pd_mainthread_mu = mu;
pd_mainthread_cond = cond;
}
// Accessors
inline PostInvokeHook* postinvoke_hook() { return pd_postinvoke_hook; }
inline _OMNI_NS(omniOrbPOA)* poa() { return pd_poa; }
inline omniLocalIdentity* localId() { return pd_localId; }
inline omni_tracedmutex* mainthread_mu() { return pd_mainthread_mu; }
inline omni_tracedcondition* mainthread_cond() { return pd_mainthread_cond; }
private:
_OMNI_NS(IOP_S)* pd_iop_s;
omniCallDescriptor* pd_call_desc;
const char* pd_op;
PostInvokeHook* pd_postinvoke_hook;
_OMNI_NS(omniOrbPOA)* pd_poa;
omniLocalIdentity* pd_localId;
omni_tracedmutex* pd_mainthread_mu;
omni_tracedcondition* pd_mainthread_cond;
omni_thread* pd_self_thread;
_CORBA_Boolean pd_try_direct;
private:
// Not implemented
omniCallHandle(const omniCallHandle&);
omniCallHandle& operator=(const omniCallHandle&);
};
#endif // __OMNIORB_CALLHANDLE_H__
|
// Copyright (c) Microsoft Corporation. All rights reserved.
#pragma once
namespace Microsoft { namespace WindowsAPICodePack { namespace DirectX { namespace Direct2D1 {
ref class D2DResource;
ref class Bitmap;
ref class GradientStopCollection;
ref class Brush;
ref class BitmapBrush;
ref class SolidColorBrush;
ref class LinearGradientBrush;
ref class RadialGradientBrush;
ref class DrawingStateBlock;
ref class RenderTarget;
ref class BitmapRenderTarget;
ref class HwndRenderTarget;
interface class IGdiInteropRenderTarget;
ref class GdiInteropRenderTarget;
ref class DCRenderTarget;
ref class StrokeStyle;
ref class Geometry;
ref class RectangleGeometry;
ref class RoundedRectangleGeometry;
ref class EllipseGeometry;
interface class ISimplifiedGeometrySink;
ref class SimplifiedGeometrySink;
interface class IGeometrySink;
ref class GeometrySink;
interface class ITessellationSink;
ref class TessellationSink;
ref class PathGeometry;
ref class GeometryGroup;
ref class TransformedGeometry;
ref class Mesh;
ref class Layer;
ref class D2DFactory;
} } } }
|
/*
* linux/arch/x86_64/kernel/ioport.c
*
* This contains the io-permission bitmap code - written by obz, with changes
* by Linus.
*/
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/ioport.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/stddef.h>
/* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
static void set_bitmap(unsigned long *bitmap, short base, short extent, int new_value)
{
int i;
if (new_value)
for (i = base; i < base + extent; i++)
__set_bit(i, bitmap);
else
for (i = base; i < base + extent; i++)
clear_bit(i, bitmap);
}
/*
* this changes the io permissions bitmap in the current task.
*/
asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{
struct thread_struct * t = ¤t->thread;
struct tss_struct * tss = init_tss + smp_processor_id();
if ((from + num <= from) || (from + num > IO_BITMAP_SIZE*32))
return -EINVAL;
if (turn_on && !capable(CAP_SYS_RAWIO))
return -EPERM;
/*
* If it's the first ioperm() call in this thread's lifetime, set the
* IO bitmap up. ioperm() is much less timing critical than clone(),
* this is why we delay this operation until now:
*/
if (!t->io_bitmap_ptr) {
t->io_bitmap_ptr = kmalloc((IO_BITMAP_SIZE+1)*4, GFP_KERNEL);
if (!t->io_bitmap_ptr)
return -ENOMEM;
memset(t->io_bitmap_ptr,0xff,(IO_BITMAP_SIZE+1)*4);
/*
* this activates it in the TSS
*/
}
/*
* do it in the per-thread copy and in the TSS ...
*/
set_bitmap((unsigned long *) t->io_bitmap_ptr, from, num, !turn_on);
if (tss->io_map_base != IO_BITMAP_OFFSET) {
memcpy(tss->io_bitmap, t->io_bitmap_ptr, sizeof(tss->io_bitmap));
tss->io_map_base = IO_BITMAP_OFFSET;
} else {
set_bitmap((unsigned long *) tss->io_bitmap, from, num, !turn_on);
}
return 0;
}
/*
* sys_iopl has to be used when you want to access the IO ports
* beyond the 0x3ff range: to get the full 65536 ports bitmapped
* you'd need 8kB of bitmaps/process, which is a bit excessive.
*
* Here we just change the eflags value on the stack: we allow
* only the super-user to do it. This depends on the stack-layout
* on system-call entry - see also fork() and the signal handling
* code.
*/
asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
{
unsigned int old = (regs->eflags >> 12) & 3;
if (level > 3)
return -EINVAL;
/* Trying to gain more privileges? */
if (level > old) {
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
}
regs->eflags = (regs->eflags &~ 0x3000UL) | (level << 12);
return 0;
}
|
/*
*
* Iter Vehemens ad Necem (IVAN)
* Copyright (C) Timo Kiviluoto
* Released under the GNU General
* Public License
*
* See LICENSING which should be included
* along with this file for more details
*
*/
#ifndef __LIST_H__
#define __LIST_H__
#include <vector>
#include "v2.h"
class outputfile;
class inputfile;
class rawbitmap;
class bitmap;
class festring;
struct felistentry;
struct felistdescription;
typedef void (*entrydrawer)(bitmap*, v2, uint);
struct EntryRect {
uint iSelectableIndex;
v2 v2TopLeft;
v2 v2BottomRight;
};
class felist
{
public:
felist(cfestring&, col16 = WHITE, uint = 0);
~felist();
void AddEntry(cfestring&, col16, uint = 0,
uint = NO_IMAGE, truth = true);
void SetLastEntryHelp(cfestring Help);
void AddDescription(cfestring&, col16 = WHITE);
static void SetAllowMouse(bool b);
uint Draw();
uint ScrollToLastPage(bool& JustSelectMoveOnce,bitmap& BackGround,bitmap* Buffer);
void SetFirstDrawNoFade(bool b);
uint GetMouseSelectedEntry(v2 v2MousePos);
void QuickDraw(bitmap*, uint) const;
void Empty();
void EmptyDescription();
festring GetEntry(uint) const;
col16 GetColor(uint) const;
void SetColor(uint, col16);
uint GetLength() const;
uint GetLastEntryIndex() const;
void Load(inputfile&);
void Save(outputfile&) const;
truth IsEmpty() const;
uint GetSelected() const { return Selected; }
void SetSelected(uint What) { Selected = What; }
void EditSelected(int What) { Selected += What; }
static void SetDefaultEntryImageSize(v2 v2Size){v2DefaultEntryImageSize=v2Size;}
static bool IsEntryDrawingAtValidPos(bitmap* Buffer,v2 pos);
truth DrawPage(bitmap* Buffer, v2* pv2FinalPageSize = NULL, std::vector<EntryRect>* pvEntryRect = NULL) const;
// truth DrawPageAndSelect(bitmap* Buffer, v2 v2MousePos, bool* = NULL);
void Pop();
static void CreateQuickDrawFontCaches(rawbitmap*, col16, uint);
void PrintToFile(cfestring&);
void SetPos(v2 What) { Pos = What; }
void SetWidth(uint What) { Width = What; }
void SetPageLength(uint What) { PageLength = What; }
void SetBackColor(col16 What) { BackColor = What; }
void SetFlags(uint What) { Flags = What; }
void AddFlags(uint What) { Flags |= What; }
void RemoveFlags(uint What) { Flags &= ~What; }
void SetUpKey(uint What) { UpKey = What; }
void SetDownKey(uint What) { DownKey = What; }
void SetEntryDrawer(entrydrawer What) { EntryDrawer = What; }
static truth isAnyFelistCurrentlyDrawn();
static bool PrepareListItemAltPosBackground(blitdata& rB,bool bAltPosFullBkg);
static void SetListItemAltPosMinY(int iY);
static v2 GetCurrentListSelectedItemPos(){return v2SelectedPos;};
static void SetSelectedBkgColor(col16 col){colSelectedBkg=col;}
void SetOriginalPos(v2 pos){v2OriginalPos = pos;};
void ClearFilter();
private:
void PrepareToReturn();
void ApplyFilter();
void UpdateFilterDesc();
void SetFilter(festring Filter);
festring GetFilter();
uint DrawFiltered(bool& bJustExitTheList);
void DrawDescription(bitmap*) const;
bool FirstDrawNoFade;
std::vector<EntryRect> vEntryRect;
std::vector<felistentry*> Entry;
std::vector<felistentry*> EntryBkp;
bool bJustRestoreEntries;
std::vector<felistdescription*> Description;
uint PageBegin;
uint Maximum;
uint Selected;
v2 Pos;
uint Width;
uint PageLength;
col16 BackColor;
uint Flags;
uint UpKey;
uint DownKey;
entrydrawer EntryDrawer;
v2 v2FinalPageSize;
static v2 v2SelectedPos;
static col16 colSelectedBkg;
v2 v2OriginalPos;
static v2 v2DefaultEntryImageSize;
};
#endif
|
/* This testcase is part of GDB, the GNU debugger.
Copyright 2011-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; 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/>. */
#include "change-loc.h"
void func1 (int x)
{
int y = x + 4;
func4 ();
}
void func (int x)
{
func1 (x);
}
|
/**************************************************************************
** diffparser.h
** ------------
** begin : Sun Aug 4 15:05:35 2002
** Copyright 2002-2004 Otto Bruggeman <otto.bruggeman@home.nl>
***************************************************************************/
/***************************************************************************
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** ( at your option ) any later version.
**
***************************************************************************/
#ifndef DIFFPARSER_H
#define DIFFPARSER_H
#include "parserbase.h"
namespace Diff2
{
class DiffParser : public ParserBase
{
public:
DiffParser( const KompareModelList* list, const QStringList& diff );
virtual ~DiffParser();
protected:
virtual enum Kompare::Format determineFormat();
};
} // End of namespace Diff2
#endif
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* 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
*/
/*
* Test Name: getresgid02
*
* Test Description:
* Verify that getresgid() will be successful to get the real, effective
* and saved user ids after calling process invokes setregid() to change
* the effective/saved gids to that of specified user.
*
* Expected Result:
* getresgid() should return with 0 value and the real/effective/saved
* user ids should match the expected values.
*
* Algorithm:
* Setup:
* Setup signal handling.
* Pause for SIGUSR1 if option specified.
*
* Test:
* Loop if the proper options are given.
* Execute system call
* Check return code, if system call failed (return=-1)
* Log the errno and Issue a FAIL message.
* Otherwise,
* Verify the Functionality of system call
* if successful,
* Issue Functionality-Pass message.
* Otherwise,
* Issue Functionality-Fail message.
* Cleanup:
* Print errno log and/or timing stats if options given
*
* Usage: <for command-line>
* getresgid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -f : Turn off functionality Testing.
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
*
* RESTRICTIONS:
* This test should be run by 'super-user' (root) only.
*
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <signal.h>
#include <pwd.h>
#include "test.h"
#define LTPUSER "nobody"
extern int getresgid(gid_t *, gid_t *, gid_t *);
char *TCID = "getresgid02";
int TST_TOTAL = 1;
gid_t pr_gid, pe_gid, ps_gid; /* calling process real/effective/saved gid */
void setup(); /* Main setup function of test */
void cleanup(); /* cleanup function for the test */
int main(int ac, char **av)
{
int lc;
gid_t real_gid, /* real/eff./saved user id from getresgid() */
eff_gid, sav_gid;
tst_parse_opts(ac, av, NULL, NULL);
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
/*
* Call getresgid() to get the real/effective/saved
* user id's of the calling process after
* setregid() in setup.
*/
TEST(getresgid(&real_gid, &eff_gid, &sav_gid));
if (TEST_RETURN == -1) {
tst_resm(TFAIL, "getresgid() Failed, errno=%d : %s",
TEST_ERRNO, strerror(TEST_ERRNO));
continue;
}
/*
* Verify the real/effective/saved gid
* values returned by getresgid with the
* expected values.
*/
if ((real_gid != pr_gid) || (eff_gid != pe_gid) ||
(sav_gid != ps_gid)) {
tst_resm(TFAIL, "real:%d, effective:%d, "
"saved-user:%d ids differ",
real_gid, eff_gid, sav_gid);
} else {
tst_resm(TPASS, "Functionality of getresgid() "
"successful");
}
}
cleanup();
tst_exit();
}
/*
* setup() - performs all ONE TIME setup for this test.
* Get the real/effective/saved user id of the calling process.
*/
void setup(void)
{
struct passwd *user_id; /* passwd struct for test user */
tst_require_root(NULL);
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
/* Real user-id of the calling process */
pr_gid = getgid();
/* Get effective gid of LTPUSER user from passwd file */
if ((user_id = getpwnam(LTPUSER)) == NULL) {
tst_brkm(TBROK, cleanup, "getpwnam(%s) Failed", LTPUSER);
}
/* Effective user-id of the test-user LTPUSER */
pe_gid = user_id->pw_gid;
/* Saved user-id of the test-user LTPUSER */
ps_gid = user_id->pw_gid;
/*
* Set the effective user-id of the process to that of
* test user LTPUSER
* The real user id remains same as of caller.
*/
if (setregid(-1, ps_gid) < 0) {
tst_brkm(TBROK, cleanup,
"setregid(-1, %d) Fails, errno:%d : %s",
ps_gid, errno, strerror(errno));
}
}
/*
* cleanup() - performs all ONE TIME cleanup for this test at
* completion or premature exit.
* Restore the test process gid to root.
*/
void cleanup(void)
{
/* Reset the effective/saved gid of the calling process */
if (setregid(-1, pr_gid) < 0) {
tst_brkm(TBROK, NULL, "resetting process effective gid failed");
}
}
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
// clang-format off
PairStyle(yukawa/colloid/omp,PairYukawaColloidOMP);
// clang-format on
#else
#ifndef LMP_PAIR_YUKAWA_COLLOID_OMP_H
#define LMP_PAIR_YUKAWA_COLLOID_OMP_H
#include "pair_yukawa_colloid.h"
#include "thr_omp.h"
namespace LAMMPS_NS {
class PairYukawaColloidOMP : public PairYukawaColloid, public ThrOMP {
public:
PairYukawaColloidOMP(class LAMMPS *);
void compute(int, int) override;
double memory_usage() override;
private:
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void eval(int ifrom, int ito, ThrData *const thr);
};
} // namespace LAMMPS_NS
#endif
#endif
|
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE 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.
*/
#pragma once
#include "Color.h"
#include <wtf/HashTraits.h>
namespace WTF {
struct ColorHash {
static unsigned hash(const WebCore::Color& key) { return key.hash(); }
static bool equal(const WebCore::Color& a, const WebCore::Color& b) { return a == b; }
static const bool safeToCompareToEmptyOrDeleted = true;
};
template<> struct DefaultHash<WebCore::Color> {
using Hash = ColorHash;
};
template<> struct HashTraits<WebCore::Color> : GenericHashTraits<WebCore::Color> {
static const bool emptyValueIsZero = false;
static WebCore::Color emptyValue() { return WebCore::Color(HashTableEmptyValue); }
static void constructDeletedValue(WebCore::Color& slot) { new (NotNull, &slot) WebCore::Color(HashTableDeletedValue); }
static bool isDeletedValue(const WebCore::Color& value) { return value.isHashTableDeletedValue(); }
};
} // namespace WTF
|
//
// Copyright(C) 2005-2014 Simon Howard
//
// 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.
//
#include <stdlib.h>
#include "textscreen.h"
#include "doomtype.h"
#include "m_config.h"
#include "m_controls.h"
#include "execute.h"
#include "txt_mouseinput.h"
#include "mode.h"
#include "mouse.h"
#define WINDOW_HELP_URL "http://www.chocolate-doom.org/setup-mouse"
static int usemouse = 1;
static int mouseSensitivity = 5;
static float mouse_acceleration = 2.0;
static int mouse_threshold = 10;
static int grabmouse = 1;
int novert = 0;
static int *all_mouse_buttons[] = {
&mousebfire,
&mousebstrafe,
&mousebforward,
&mousebstrafeleft,
&mousebstraferight,
&mousebbackward,
&mousebuse,
&mousebjump,
&mousebprevweapon,
&mousebnextweapon
};
static void MouseSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable))
{
TXT_CAST_ARG(int, variable);
unsigned int i;
// Check if the same mouse button is used for a different action
// If so, set the other action(s) to -1 (unset)
for (i=0; i<arrlen(all_mouse_buttons); ++i)
{
if (*all_mouse_buttons[i] == *variable
&& all_mouse_buttons[i] != variable)
{
*all_mouse_buttons[i] = -1;
}
}
}
static void AddMouseControl(txt_table_t *table, char *label, int *var)
{
txt_mouse_input_t *mouse_input;
TXT_AddWidget(table, TXT_NewLabel(label));
mouse_input = TXT_NewMouseInput(var);
TXT_AddWidget(table, mouse_input);
TXT_SignalConnect(mouse_input, "set", MouseSetCallback, var);
}
static void ConfigExtraButtons(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
{
txt_window_t *window;
txt_table_t *buttons_table;
window = TXT_NewWindow("Additional mouse buttons");
TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
TXT_AddWidgets(window,
buttons_table = TXT_NewTable(2),
NULL);
TXT_SetColumnWidths(buttons_table, 29, 5);
AddMouseControl(buttons_table, "Move backward", &mousebbackward);
AddMouseControl(buttons_table, "Use", &mousebuse);
AddMouseControl(buttons_table, "Strafe left", &mousebstrafeleft);
AddMouseControl(buttons_table, "Strafe right", &mousebstraferight);
if (gamemission == hexen)
{
AddMouseControl(buttons_table, "Jump", &mousebjump);
}
AddMouseControl(buttons_table, "Previous weapon", &mousebprevweapon);
AddMouseControl(buttons_table, "Next weapon", &mousebnextweapon);
}
void ConfigMouse(void)
{
txt_window_t *window;
txt_table_t *motion_table;
txt_table_t *buttons_table;
window = TXT_NewWindow("Mouse configuration");
TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
TXT_AddWidgets(window,
TXT_NewCheckBox("Enable mouse", &usemouse),
TXT_NewInvertedCheckBox("Allow vertical mouse movement",
&novert),
TXT_NewCheckBox("Grab mouse in windowed mode",
&grabmouse),
TXT_NewCheckBox("Double click acts as \"use\"",
&dclick_use),
TXT_NewSeparator("Mouse motion"),
motion_table = TXT_NewTable(2),
TXT_NewSeparator("Buttons"),
buttons_table = TXT_NewTable(2),
TXT_NewButton2("More controls...",
ConfigExtraButtons,
NULL),
NULL);
TXT_SetColumnWidths(motion_table, 27, 5);
TXT_AddWidgets(motion_table,
TXT_NewLabel("Speed"),
TXT_NewSpinControl(&mouseSensitivity, 1, 256),
TXT_NewLabel("Acceleration"),
TXT_NewFloatSpinControl(&mouse_acceleration, 1.0, 5.0),
TXT_NewLabel("Acceleration threshold"),
TXT_NewSpinControl(&mouse_threshold, 0, 32),
NULL);
TXT_SetColumnWidths(buttons_table, 27, 5);
AddMouseControl(buttons_table, "Fire/Attack", &mousebfire);
AddMouseControl(buttons_table, "Move forward", &mousebforward);
AddMouseControl(buttons_table, "Strafe on", &mousebstrafe);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction());
}
void BindMouseVariables(void)
{
M_BindIntVariable("use_mouse", &usemouse);
M_BindIntVariable("novert", &novert);
M_BindIntVariable("grabmouse", &grabmouse);
M_BindIntVariable("mouse_sensitivity", &mouseSensitivity);
M_BindIntVariable("mouse_threshold", &mouse_threshold);
M_BindFloatVariable("mouse_acceleration", &mouse_acceleration);
}
|
/*
* HuaWei HG255D board support by lintel
*
* Copyright (C) 2012 lintel<lintel.huang@gmail.com>
* Copyright (C) 2012 Rui Shen<shenrui01@gmail.com>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/leds.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <asm/mach-ralink/machine.h>
#include <asm/mach-ralink/dev-gpio-buttons.h>
#include <asm/mach-ralink/dev-gpio-leds.h>
#include <asm/mach-ralink/rt305x.h>
#include <asm/mach-ralink/rt305x_regs.h>
#include "devices.h"
#define HG255D_MTD_PARTITIONS 3 // 1 bootform 0x20000 ,2 bootform 0x40000,3 bootform 0x80000
/*
Note:
GPIO [6:3] is share with SPI interface,so,if use for gpio,must disable the SPI.
see datasheet Page NO.37.
*/
#define HG255D_GPIO_BUTTON_RESET 4
#define HG255D_GPIO_BUTTON_WPS 10
#define HG255D_GPIO_BUTTON_WLAN 0
#define HG255D_GPIO_LED_POWER 8
#define HG255D_GPIO_LED_USB 9
#define HG255D_GPIO_LED_INTERNET 13
#define HG255D_GPIO_LED_WLAN 14
#define HG255D_GPIO_LED_WPS 12
#define HG255D_GPIO_LED_VOICE 5
#define HG255D_KEYS_POLL_INTERVAL 10 /* msecs */
#define HG255D_KEYS_DEBOUNCE_INTERVAL (3 * HG255D_KEYS_POLL_INTERVAL)
#define SZ_128K 0x020000
#define SZ_1M 0x100000
#define BLOCK_SZ_128K SZ_128K
#define FLASH_SIZE BLOCK_SZ_128K*128
#ifdef CONFIG_MTD_PARTITIONS
#if (HG255D_MTD_PARTITIONS == 1)
static struct mtd_partition hg255d_partitions[] = {
{
.name = "u-boot",
.offset = 0,
.size = 0x020000,
// .mask_flags = MTD_WRITEABLE,
}, {
.name = "kernel",
.offset = 0x0020000,
.size = 0x0100000,
}, {
.name = "rootfs",
.offset = 0x0120000,
.size = 0x06e0000,
}, {
.name = "firmware",
.offset = 0x0020000,
.size = 0x07e0000,
}, {
.name = "factory",
.offset = 0x0fa0000,
.size = 0x0020000,
// .mask_flags = MTD_WRITEABLE,
}, {
.name = "fullflash",
.offset = 0x000000,
.size = 0x01000000,
}
};
#elif (HG255D_MTD_PARTITIONS == 2)
static struct mtd_partition hg255d_partitions[] = {
{
.name = "u-boot",
.offset = 0,
.size = 0x040000,
// .mask_flags = MTD_WRITEABLE,
}, {
.name = "kernel",
.offset = 0x040000,
.size = 0x100000,
}, {
.name = "rootfs",
.offset = 0x140000,
.size = 0x600000,
}, {
.name = "firmware",
.offset = 0x040000,
.size = 0xe60000,
}, {
.name = "factory",
.offset = 0x0fa0000,
.size = 0x0020000,
// .mask_flags = MTD_WRITEABLE,
}, {
.name = "fullflash",
.offset = 0x000000,
.size = 0xfa0000,
}
};
#elif (HG255D_MTD_PARTITIONS == 3)
static struct mtd_partition hg255d_partitions[] = {
{
.name = "u-boot",
.offset = 0,
.size = SZ_128K * 2,
}, {
.name = "u-boot-env",
.offset = SZ_128K * 2,
.size = SZ_128K,
}, {
.name = "factory",
.offset = SZ_128K * 3,
.size = SZ_128K,
}, {
.name = "kernel",
.offset = SZ_128K * 4,
.size = SZ_1M,
}, {
.name = "rootfs",
.offset = SZ_1M + SZ_128K * 4,
.size = FLASH_SIZE - (SZ_1M + SZ_128K * 4),
}, {
.name = "firmware",
.offset = SZ_128K * 4,
.size = FLASH_SIZE - (SZ_128K * 4),
}, {
.name = "fullflash",
.offset = 0x000000,
.size = FLASH_SIZE,
}
};
#endif /* CONFIG_MTD_PARTITIONS */
#endif /* CONFIG_MTD_PARTITIONS */
static struct physmap_flash_data hg255d_flash_data = {
#ifdef CONFIG_MTD_PARTITIONS
.nr_parts = ARRAY_SIZE(hg255d_partitions),
.parts = hg255d_partitions,
#endif
};
static struct gpio_led hg255d_leds_gpio[] __initdata = {
{
.name = "hg255d:power",
.gpio = HG255D_GPIO_LED_POWER,
.active_low = 1,
.default_trigger= "default-on",
}, {
.name = "hg255d:internet",
.gpio = HG255D_GPIO_LED_INTERNET,
.active_low = 1,
}, {
.name = "hg255d:wlan",
.gpio = HG255D_GPIO_LED_WLAN,
.active_low = 1,
}, {
.name = "hg255d:usb",
.gpio = HG255D_GPIO_LED_USB,
.active_low = 1,
}, {
.name = "hg255d:wps",
.gpio = HG255D_GPIO_LED_WPS,
.active_low = 1,
}, {
.name = "hg255d:voice",
.gpio = HG255D_GPIO_LED_VOICE,
.active_low = 1,
}
};
static struct gpio_keys_button hg255d_gpio_buttons[] __initdata = {
{
.desc = "reset",
.type = EV_KEY,
.code = BTN_0,
.gpio = HG255D_GPIO_BUTTON_RESET,
.active_low = 1,
.debounce_interval = HG255D_KEYS_DEBOUNCE_INTERVAL,
}, {
.desc = "wlan",
.type = EV_KEY,
.code = BTN_1,
.gpio = HG255D_GPIO_BUTTON_WLAN,
.active_low = 1,
.debounce_interval = HG255D_KEYS_DEBOUNCE_INTERVAL,
}, {
.desc = "wps",
.type = EV_KEY,
.code = BTN_2,
.gpio = HG255D_GPIO_BUTTON_WPS,
.active_low = 1,
.debounce_interval = HG255D_KEYS_DEBOUNCE_INTERVAL,
}
};
static void __init hg255d_setup(void)
{
rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT | RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI);
rt305x_register_flash(0);
ramips_register_gpio_leds(-1, ARRAY_SIZE(hg255d_leds_gpio),
hg255d_leds_gpio);
ramips_register_gpio_buttons(-1, HG255D_KEYS_POLL_INTERVAL,
ARRAY_SIZE(hg255d_gpio_buttons),
hg255d_gpio_buttons);
rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
rt305x_register_ethernet();
rt305x_register_wifi();
rt305x_register_wdt();
rt305x_register_usb();
// rt305x_register_gpiodev();
}
MIPS_MACHINE(RAMIPS_MACH_HG255D, "HG255D", "HuaWei HG255D",
hg255d_setup);
|
/*
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
*
* Copyright (C) 2009-2010 TrinityZero <http://www.trinityzero.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OUTDOOR_PVP_SI_
#define OUTDOOR_PVP_SI_
#include "OutdoorPvP.h"
const uint32 SI_SILITHYST_FLAG_GO_SPELL = 29518;
const uint32 SI_SILITHYST_FLAG = 29519;
const uint32 SI_TRACES_OF_SILITHYST = 29534;
const uint32 SI_CENARION_FAVOR = 30754;
const uint32 SI_MAX_RESOURCES = 200;
const uint32 OutdoorPvPSIBuffZonesNum = 3;
const uint32 OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum] = { 1377, 3428, 3429 };
const uint32 SI_AREATRIGGER_H = 4168;
const uint32 SI_AREATRIGGER_A = 4162;
const uint32 SI_TURNIN_QUEST_CM_A = 17090;
const uint32 SI_TURNIN_QUEST_CM_H = 18199;
const uint32 SI_SILITHYST_MOUND = 181597;
enum SI_WorldStates{
SI_GATHERED_A = 2313,
SI_GATHERED_H = 2314,
SI_SILITHYST_MAX = 2317
};
class OutdoorPvPSI : public OutdoorPvP
{
public:
OutdoorPvPSI();
bool SetupOutdoorPvP();
void HandlePlayerEnterZone(Player *plr, uint32 zone);
void HandlePlayerLeaveZone(Player *plr, uint32 zone);
bool Update(uint32 diff);
void FillInitialWorldStates(WorldPacket &data);
void SendRemoveWorldStates(Player * plr);
bool HandleAreaTrigger(Player * plr, uint32 trigger);
bool HandleDropFlag(Player * plr, uint32 spellId);
bool HandleCustomSpell(Player * plr, uint32 spellId, GameObject *go);
void BuffTeam(uint32 team);
void UpdateWorldState();
private:
uint32 m_Gathered_A;
uint32 m_Gathered_H;
uint32 m_LastController;
};
#endif
|
/* Copyright (C) 2004, 2009, 2011 Free Software Foundation, Inc.
Contributed by Douglas B Rupp <rupp@gnat.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Locate the FDE entry for a given address, using VMS Starlet routines
to avoid register/deregister calls at DSO load/unload. */
#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
#include "tm.h"
#include "libgcc_tm.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include "unwind-ia64.h"
#include <ossddef.h>
#ifndef SS$_NORMAL
#define SS$_NORMAL 1
#endif
#define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
typedef struct
{
unw_word start_offset;
unw_word end_offset;
unw_word info_offset;
unw_word gp_value;
} vms_unw_table_entry;
typedef unsigned long long uqword;
/* ENTRY is the unwind table entry found for a PC part of call chain we're
unwinding through. Return whether we should force the generic unwinder
to resort to "fallback" processing. */
static int
force_fallback_processing_for (void * pc, vms_unw_table_entry * entry)
{
static int eh_debug = -1;
uqword * unw_info_block = (uqword *)entry->info_offset;
uqword header = *unw_info_block;
/* We need to force fallback processing in two cases:
1/ The exception dispatch frame, since only our fallback
processing knows how to properly unwind through it, and
2/ A bottom of stack frame, since only our fallback processing
will ensure we don't try to unwind further past it, which
would get us into unknown territory and likely cause a severe
crash along the way.
The two cases are indicated by non-default values for specific
bits in the OS Specific Data (OSSD) General Information block
associated with such frames. */
ossddef * ossd;
if (eh_debug == -1)
{
char * EH_DEBUG = getenv ("EH_DEBUG");
eh_debug = EH_DEBUG ? atoi (EH_DEBUG) : 0;
}
if (eh_debug)
{
printf ("pc @ 0x%p, block @ 0x%p, header = 0x%016llx\n",
pc, unw_info_block, header);
printf ("mode = %d, length = %ld, handler = %d\n",
(int)UNW_IVMS_MODE (header), UNW_LENGTH (header),
UNW_FLAG_EHANDLER (header) || UNW_FLAG_EHANDLER (header));
}
/* An OSSD block is there for IVMS_MODE == 3 only. */
if (UNW_IVMS_MODE (header) != 3)
return 0;
/* The OSSD block is found past the header, unwind descriptor area
and condition handler pointer, if any. */
ossd = (ossddef *)
/* Beware: uqword pointer arithmetic below. */
(unw_info_block
+ 1
+ UNW_LENGTH (header)
+ (UNW_FLAG_EHANDLER (header) || UNW_FLAG_EHANDLER (header)));
/* "A General Information segment may be omitted if all of its fields
would have their default values. If a General Information segment
is present, it must be the first in the OSSD area." So ... */
if (eh_debug)
printf ("ossd @ 0x%p\n", ossd);
if (eh_debug && ossd->ossd$v_type == OSSD$K_GENERAL_INFO)
printf ("exc_frame = %d - bot_frame = %d - base_frame = %d\n",
ossd->ossd$v_exception_frame,
ossd->ossd$v_bottom_of_stack,
ossd->ossd$v_base_frame);
return
ossd->ossd$v_type == OSSD$K_GENERAL_INFO
&& (ossd->ossd$v_exception_frame
|| ossd->ossd$v_bottom_of_stack || ossd->ossd$v_base_frame);
}
/* Return a pointer to the unwind table entry for the function
containing PC, 0 if we cannot find an entry or if the one we find
calls for fallback processing. */
struct unw_table_entry *
_Unwind_FindTableEntry (void *pc, unw_word *segment_base,
unw_word *gp, struct unw_table_entry *ent)
{
vms_unw_table_entry vueblock;
if (SYS$GET_UNWIND_ENTRY_INFO (pc, &vueblock, 0) != SS$_NORMAL)
return 0;
/* If there is no unwind information, use fallback. */
if (vueblock.info_offset == 0)
return 0;
/* If we need to force fallback processing, just pretend there is
no entry. */
if (force_fallback_processing_for (pc, &vueblock))
return 0;
*segment_base = 0; /* ??? Fixme. ??? */
*gp = vueblock.gp_value;
ent->start_offset = vueblock.start_offset;
ent->end_offset = vueblock.end_offset;
ent->info_offset = vueblock.info_offset;
return ent;
}
|
#pragma once
#include "../VulkanAPI.h"
#include "../../Common/TextureUtils.h"
#include "commands.h"
#include "device.h"
#include "memory.h"
#include <stack>
//using enum rsx::format_class;
using namespace ::rsx::format_class_;
#ifdef __APPLE__
#define VK_DISABLE_COMPONENT_SWIZZLE 1
#else
#define VK_DISABLE_COMPONENT_SWIZZLE 0
#endif
namespace vk
{
enum : u32// special remap_encoding enums
{
VK_REMAP_IDENTITY = 0xCAFEBABE, // Special view encoding to return an identity image view
VK_REMAP_VIEW_MULTISAMPLED = 0xDEADBEEF, // Special encoding for multisampled images; returns a multisampled image view
VK_IMAGE_CREATE_ALLOW_NULL = 0x80000000, // Special flag that allows null images to be created if there is no memory
};
class image
{
std::stack<VkImageLayout> m_layout_stack;
VkImageAspectFlags m_storage_aspect = 0;
rsx::format_class m_format_class = RSX_FORMAT_CLASS_UNDEFINED;
void validate(const vk::render_device& dev, const VkImageCreateInfo& info) const;
protected:
image() = default;
void create_impl(const vk::render_device& dev, u32 access_flags, const memory_type_info& memory_type, vmm_allocation_pool allocation_pool);
public:
VkImage value = VK_NULL_HANDLE;
VkComponentMapping native_component_map = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
VkImageLayout current_layout = VK_IMAGE_LAYOUT_UNDEFINED;
u32 current_queue_family = VK_QUEUE_FAMILY_IGNORED;
VkImageCreateInfo info = {};
std::shared_ptr<vk::memory_block> memory;
image(const vk::render_device& dev,
const memory_type_info& memory_type,
u32 access_flags,
VkImageType image_type,
VkFormat format,
u32 width, u32 height, u32 depth,
u32 mipmaps, u32 layers,
VkSampleCountFlagBits samples,
VkImageLayout initial_layout,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkImageCreateFlags image_flags,
vmm_allocation_pool allocation_pool,
rsx::format_class format_class = RSX_FORMAT_CLASS_UNDEFINED);
virtual ~image();
image(const image&) = delete;
image(image&&) = delete;
// Properties
u32 width() const;
u32 height() const;
u32 depth() const;
u32 mipmaps() const;
u32 layers() const;
u8 samples() const;
VkFormat format() const;
VkImageType type() const;
VkImageAspectFlags aspect() const;
rsx::format_class format_class() const;
// Pipeline management
void push_layout(VkCommandBuffer cmd, VkImageLayout layout);
void push_barrier(VkCommandBuffer cmd, VkImageLayout layout);
void pop_layout(VkCommandBuffer cmd);
void change_layout(const command_buffer& cmd, VkImageLayout new_layout);
void change_layout(const command_buffer& cmd, VkImageLayout new_layout, u32 new_queue_family);
// Debug utils
void set_debug_name(const std::string& name);
protected:
VkDevice m_device;
};
struct image_view
{
VkImageView value = VK_NULL_HANDLE;
VkImageViewCreateInfo info = {};
image_view(VkDevice dev, VkImage image, VkImageViewType view_type, VkFormat format, VkComponentMapping mapping, VkImageSubresourceRange range);
image_view(VkDevice dev, VkImageViewCreateInfo create_info);
image_view(VkDevice dev, vk::image* resource,
VkImageViewType view_type = VK_IMAGE_VIEW_TYPE_MAX_ENUM,
const VkComponentMapping& mapping = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A },
const VkImageSubresourceRange& range = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 });
~image_view();
u32 encoded_component_map() const;
vk::image* image() const;
image_view(const image_view&) = delete;
image_view(image_view&&) = delete;
private:
VkDevice m_device;
vk::image* m_resource = nullptr;
void create_impl();
};
class viewable_image : public image
{
protected:
std::unordered_multimap<u32, std::unique_ptr<vk::image_view>> views;
viewable_image* clone();
public:
using image::image;
virtual image_view* get_view(u32 remap_encoding, const std::pair<std::array<u8, 4>, std::array<u8, 4>>& remap,
VkImageAspectFlags mask = VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT);
void set_native_component_layout(VkComponentMapping new_layout);
};
}
|
/*
* Copyright (C) 2014 Citrix Systems UK Ltd.
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
* Contributions after 2012-01-13 are licensed under the terms of the
* GNU GPL, version 2 or (at your option) any later version.
*/
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "hw/xen/xen-legacy-backend.h"
#include "chardev/char.h"
#include "sysemu/accel.h"
#include "migration/misc.h"
#include "migration/global_state.h"
//#define DEBUG_XEN
#ifdef DEBUG_XEN
#define DPRINTF(fmt, ...) \
do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, ...) \
do { } while (0)
#endif
xc_interface *xen_xc;
xenforeignmemory_handle *xen_fmem;
xendevicemodel_handle *xen_dmod;
static int store_dev_info(int domid, Chardev *cs, const char *string)
{
struct xs_handle *xs = NULL;
char *path = NULL;
char *newpath = NULL;
char *pts = NULL;
int ret = -1;
/* Only continue if we're talking to a pty. */
if (!CHARDEV_IS_PTY(cs)) {
return 0;
}
pts = cs->filename + 4;
/* We now have everything we need to set the xenstore entry. */
xs = xs_open(0);
if (xs == NULL) {
fprintf(stderr, "Could not contact XenStore\n");
goto out;
}
path = xs_get_domain_path(xs, domid);
if (path == NULL) {
fprintf(stderr, "xs_get_domain_path() error\n");
goto out;
}
newpath = realloc(path, (strlen(path) + strlen(string) +
strlen("/tty") + 1));
if (newpath == NULL) {
fprintf(stderr, "realloc error\n");
goto out;
}
path = newpath;
strcat(path, string);
strcat(path, "/tty");
if (!xs_write(xs, XBT_NULL, path, pts, strlen(pts))) {
fprintf(stderr, "xs_write for '%s' fail", string);
goto out;
}
ret = 0;
out:
free(path);
xs_close(xs);
return ret;
}
void xenstore_store_pv_console_info(int i, Chardev *chr)
{
if (i == 0) {
store_dev_info(xen_domid, chr, "/console");
} else {
char buf[32];
snprintf(buf, sizeof(buf), "/device/console/%d", i);
store_dev_info(xen_domid, chr, buf);
}
}
static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
{
char path[50];
if (xs == NULL) {
error_report("xenstore connection not initialized");
exit(1);
}
snprintf(path, sizeof (path), "device-model/%u/state", xen_domid);
/*
* This call may fail when running restricted so don't make it fatal in
* that case. Toolstacks should instead use QMP to listen for state changes.
*/
if (!xs_write(xs, XBT_NULL, path, state, strlen(state)) &&
!xen_domid_restrict) {
error_report("error recording dm state");
exit(1);
}
}
static void xen_change_state_handler(void *opaque, int running,
RunState state)
{
if (running) {
/* record state running */
xenstore_record_dm_state(xenstore, "running");
}
}
static void xen_setup_post(MachineState *ms, AccelState *accel)
{
int rc;
if (xen_domid_restrict) {
rc = xen_restrict(xen_domid);
if (rc < 0) {
perror("xen: failed to restrict");
exit(1);
}
}
}
static int xen_init(MachineState *ms)
{
xen_xc = xc_interface_open(0, 0, 0);
if (xen_xc == NULL) {
xen_pv_printf(NULL, 0, "can't open xen interface\n");
return -1;
}
xen_fmem = xenforeignmemory_open(0, 0);
if (xen_fmem == NULL) {
xen_pv_printf(NULL, 0, "can't open xen fmem interface\n");
xc_interface_close(xen_xc);
return -1;
}
xen_dmod = xendevicemodel_open(0, 0);
if (xen_dmod == NULL) {
xen_pv_printf(NULL, 0, "can't open xen devicemodel interface\n");
xenforeignmemory_close(xen_fmem);
xc_interface_close(xen_xc);
return -1;
}
qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
return 0;
}
static void xen_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
static GlobalProperty compat[] = {
{ "migration", "store-global-state", "off" },
{ "migration", "send-configuration", "off" },
{ "migration", "send-section-footer", "off" },
};
ac->name = "Xen";
ac->init_machine = xen_init;
ac->setup_post = xen_setup_post;
ac->allowed = &xen_allowed;
ac->compat_props = g_ptr_array_new();
compat_props_add(ac->compat_props, compat, G_N_ELEMENTS(compat));
}
#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
static const TypeInfo xen_accel_type = {
.name = TYPE_XEN_ACCEL,
.parent = TYPE_ACCEL,
.class_init = xen_accel_class_init,
};
static void xen_type_init(void)
{
type_register_static(&xen_accel_type);
}
type_init(xen_type_init);
|
/* packet-aruba-iap.c
* Routines for Aruba IAP header disassembly
* Copyright 2014, Alexis La Goutte <alexis.lagoutte at gmail dot com>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*/
/*
* Aruba Instant AP broadcast on L2 Layer with ethertype 0x8ffd
* All frame start with 0xbeef (Magic number ?)
* The address IP(v4) of Aruba Instant AP is available start in offset 11
* the 3 octet is may be a type field(found some frame with this octet is different and data is different)
* Octet to 7 to 10 is may be uptime of AP (the value always increment )
*/
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#define ETHERTYPE_IAP 0x8ffd
#define MAGIC_IAP 0xbeef
void proto_register_aruba_iap(void);
void proto_reg_handoff_aruba_iap(void);
static int proto_aruba_iap = -1;
static gint ett_aruba_iap = -1;
static int hf_iap_magic = -1;
static int hf_iap_type = -1;
static int hf_iap_ip = -1;
static int hf_iap_unknown_uint = -1;
static int hf_iap_unknown_bytes = -1;
static int
dissect_aruba_iap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ti;
proto_tree *aruba_iap_tree;
guint16 magic;
int offset = 0;
magic = tvb_get_ntohs(tvb, offset);
if(magic != MAGIC_IAP)
{
return 0;
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IAP");
col_clear(pinfo->cinfo, COL_INFO);
ti = proto_tree_add_item(tree, proto_aruba_iap, tvb, 0, -1, ENC_NA);
aruba_iap_tree = proto_item_add_subtree(ti, ett_aruba_iap);
proto_tree_add_item(aruba_iap_tree, hf_iap_magic, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(aruba_iap_tree, hf_iap_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_uint, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_uint, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(aruba_iap_tree, hf_iap_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
col_add_fstr(pinfo->cinfo, COL_INFO, "Aruba Instant AP IP: %s", tvb_ip_to_str(tvb, offset));
offset += 4;
proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_uint, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_uint, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_bytes, tvb, offset, -1, ENC_NA);
return tvb_reported_length(tvb);
}
void
proto_register_aruba_iap(void)
{
static hf_register_info hf[] = {
{ &hf_iap_magic,
{ "Magic", "aruba_iap.magic", FT_UINT16, BASE_HEX, NULL,0x0,
"Magic Number of IAP trafic (Always 0x8ffd)", HFILL}},
{ &hf_iap_type,
{ "Type (?)", "aruba_iap.type", FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
"May type field...", HFILL}},
{ &hf_iap_ip,
{ "IP", "aruba_iap.ip", FT_IPv4, BASE_NONE, NULL, 0x0,
"Address IP of IAP", HFILL}},
{ &hf_iap_unknown_bytes,
{ "Unknown", "aruba_iap.unknown.bytes", FT_BYTES, BASE_NONE, NULL, 0x0,
"Unknown Data...", HFILL}},
{ &hf_iap_unknown_uint,
{ "Unknown", "aruba_iap.unknown.uint", FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
"Unknown (UINT) Data...", HFILL}},
};
static gint *ett[] = {
&ett_aruba_iap,
};
proto_aruba_iap = proto_register_protocol("Aruba Instant AP Protocol",
"aruba_iap", "aruba_iap");
proto_register_field_array(proto_aruba_iap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_aruba_iap(void)
{
dissector_handle_t iap_handle;
iap_handle = new_create_dissector_handle(dissect_aruba_iap, proto_aruba_iap);
dissector_add_uint("ethertype", ETHERTYPE_IAP, iap_handle);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
|
/***************************************************************************
qgsmaptooloffsetcurve.h
------------------------------------------------------------
begin : February 2012
copyright : (C) 2012 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSMAPTOOLOFFSETCURVE_H
#define QGSMAPTOOLOFFSETCURVE_H
#include "qgsmaptooledit.h"
#include "qgsgeometry.h"
class QgsVertexMarker;
class QgsDoubleSpinBox;
class QGraphicsProxyWidget;
class APP_EXPORT QgsMapToolOffsetCurve: public QgsMapToolEdit
{
Q_OBJECT
public:
QgsMapToolOffsetCurve( QgsMapCanvas* canvas );
~QgsMapToolOffsetCurve();
void canvasReleaseEvent( QgsMapMouseEvent* e ) override;
void canvasMoveEvent( QgsMapMouseEvent* e ) override;
private slots:
/** Places curve offset to value entered in the spin box*/
void placeOffsetCurveToValue();
/** Apply the offset either from the spin box or from the mouse event */
void applyOffset();
private:
/** Rubberband that shows the position of the offset curve*/
QgsRubberBand* mRubberBand;
/** Geometry to manipulate*/
QgsGeometry mOriginalGeometry;
/** Geometry after manipulation*/
QgsGeometry mModifiedGeometry;
/** ID of manipulated feature*/
QgsFeatureId mModifiedFeature;
/** Layer ID of source layer*/
QString mSourceLayerId;
/** Internal flag to distinguish move from click*/
bool mGeometryModified;
/** Shows current distance value and allows numerical editing*/
QgsDoubleSpinBox* mDistanceWidget;
/** Marker to show the cursor was snapped to another location*/
QgsVertexMarker* mSnapVertexMarker;
/** Forces geometry copy (no modification of geometry in current layer)*/
bool mForceCopy;
bool mMultiPartGeometry;
void deleteRubberBandAndGeometry();
QgsGeometry createOriginGeometry( QgsVectorLayer* vl, const QgsPointLocator::Match& match, QgsFeature& snappedFeature );
void createDistanceWidget();
void deleteDistanceWidget();
void setOffsetForRubberBand( double offset );
/** Creates a linestring from the polygon ring containing the snapped vertex. Caller takes ownership of the created object*/
QgsGeometry linestringFromPolygon( const QgsGeometry& featureGeom, int vertex );
/** Returns a single line from a multiline (or does nothing if geometry is already a single line). Deletes the input geometry*/
QgsGeometry convertToSingleLine( const QgsGeometry& geom, int vertex, bool& isMulti );
/** Converts offset line back to a multiline if necessary*/
QgsGeometry* convertToMultiLine( QgsGeometry* geom );
};
#endif // QGSMAPTOOLOFFSETCURVE_H
|
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/*
* NAME
* mlock01.c
*
* DESCRIPTION
* Test to see that mlock works
*$
* ALGORITHM
* test 1:
* Call mlock with various valid addresses and lengths. No
* error should be returned
*
* USAGE: <for command-line>
* -c n Run n copies concurrently
* -e Turn on errno logging
* -f Turn off functional testing
* -h Show this help screen
* -i n Execute test n times
* -I x Execute test for x seconds
* -p Pause for SIGUSR1 before starting
* -P x Pause for x seconds between iterations
* -t Turn on syscall timing
*
* HISTORY
* 06/2002 Written by Paul Larson
*
* RESTRICTIONS
* None
*/
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
#include "test.h"
void setup();
void setup1(int);
void cleanup();
char *TCID = "mlock01";
int TST_TOTAL = 4;
void *addr1;
struct test_case_t {
void **addr;
int len;
void (*setupfunc) ();
} TC[] = {
/* mlock should return ENOMEM when some or all of the address
* range pointed to by addr and len are not valid mapped pages
* in the address space of the process
*/
{
&addr1, 1, setup1}, {
&addr1, 1024, setup1}, {
&addr1, 1024 * 1024, setup1}, {
&addr1, 1024 * 1024 * 10, setup1}
};
#if !defined(UCLINUX)
int main(int ac, char **av)
{
int lc, i;
tst_parse_opts(ac, av, NULL, NULL);
setup();
/*
* FIXME (garrcoop): this should really test out whether or not the
* process's mappable address space is indeed accessible by the
* current user, instead of needing to be run by root all the time.
*/
tst_require_root(NULL);
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
for (i = 0; i < TST_TOTAL; i++) {
if (TC[i].setupfunc != NULL)
TC[i].setupfunc(TC[i].len);
TEST(mlock(*(TC[i].addr), TC[i].len));
/* I'm confused -- given the description above this
* should fail as designed, but this application
* */
if (TEST_RETURN == -1)
tst_resm(TFAIL | TTERRNO, "mlock failed");
else
tst_resm(TPASS, "mlock passed");
}
}
cleanup();
tst_exit();
}
#else
int main(void)
{
tst_brkm(TCONF, NULL, "test is not available on uClinux");
}
#endif /* if !defined(UCLINUX) */
void setup(void)
{
TEST_PAUSE;
}
void setup1(int len)
{
addr1 = malloc(len);
if (addr1 == NULL)
tst_brkm(TFAIL, cleanup, "malloc failed");
}
void cleanup(void)
{
}
|
/*
* Copyright 2008-2013 Freescale Semiconductor, Inc.
*
* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <asm/mmu.h>
struct fsl_e_tlb_entry tlb_table[] = {
/* TLB 0 - for temp stack in cache */
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR,
CONFIG_SYS_INIT_RAM_ADDR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
/* TLB 1 */
/* *I*** - Covers boot page */
#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L3_ADDR)
/*
* *I*G - L3SRAM. When L3 is used as 1M SRAM, the address of the
* SRAM is at 0xfff00000, it covered the 0xfffff000.
*/
SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L3_ADDR, CONFIG_SYS_INIT_L3_ADDR,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 0, BOOKE_PAGESZ_1M, 1),
#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE)
/*
* SRIO_PCIE_BOOT-SLAVE. When slave boot, the address of the
* space is at 0xfff00000, it covered the 0xfffff000.
*/
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR,
CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_W|MAS2_G,
0, 0, BOOKE_PAGESZ_1M, 1),
#else
SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 0, BOOKE_PAGESZ_4K, 1),
#endif
/* *I*G* - CCSRBAR */
SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 1, BOOKE_PAGESZ_16M, 1),
/* *I*G* - Flash, localbus */
/* This will be changed to *I*G* after relocation to RAM. */
SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
0, 2, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCIe 1, 0x80000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 3, BOOKE_PAGESZ_512M, 1),
/* *I*G* - PCIe 2, 0xa0000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE2_MEM_VIRT, CONFIG_SYS_PCIE2_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 4, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCIe 3, 0xb0000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT, CONFIG_SYS_PCIE3_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 5, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCIe 4, 0xc0000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE4_MEM_VIRT, CONFIG_SYS_PCIE4_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 6, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCI I/O */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_IO_VIRT, CONFIG_SYS_PCIE1_IO_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 7, BOOKE_PAGESZ_256K, 1),
/* Bman/Qman */
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_BMAN_MEM_BASE, CONFIG_SYS_BMAN_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 9, BOOKE_PAGESZ_16M, 1),
SET_TLB_ENTRY(1, CONFIG_SYS_BMAN_MEM_BASE + 0x01000000,
CONFIG_SYS_BMAN_MEM_PHYS + 0x01000000,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 10, BOOKE_PAGESZ_16M, 1),
#endif
#ifdef CONFIG_SYS_QMAN_MEM_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_QMAN_MEM_BASE, CONFIG_SYS_QMAN_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 11, BOOKE_PAGESZ_16M, 1),
SET_TLB_ENTRY(1, CONFIG_SYS_QMAN_MEM_BASE + 0x01000000,
CONFIG_SYS_QMAN_MEM_PHYS + 0x01000000,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 12, BOOKE_PAGESZ_16M, 1),
#endif
#ifdef CONFIG_SYS_DCSRBAR_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 13, BOOKE_PAGESZ_32M, 1),
#endif
#ifdef CONFIG_SYS_NAND_BASE
/*
* *I*G - NAND
* entry 14 and 15 has been used hard coded, they will be disabled
* in cpu_init_f, so we use entry 16 for nand.
*/
SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 16, BOOKE_PAGESZ_64K, 1),
#endif
#ifdef QIXIS_BASE_PHYS
SET_TLB_ENTRY(1, QIXIS_BASE, QIXIS_BASE_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 17, BOOKE_PAGESZ_4K, 1),
#endif
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
/*
* SRIO_PCIE_BOOT-SLAVE. 1M space from 0xffe00000 for
* fetching ucode and ENV from master
*/
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR,
CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
0, 18, BOOKE_PAGESZ_1M, 1),
#endif
};
int num_tlb_entries = ARRAY_SIZE(tlb_table);
|
/*
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUCTION_HOUSE_BOT_BUYER_H
#define AUCTION_HOUSE_BOT_BUYER_H
#include "Define.h"
#include "AuctionHouseMgr.h"
#include "AuctionHouseBot.h"
struct BuyerAuctionEval
{
BuyerAuctionEval(): AuctionId(0), LastChecked(0), LastExist(0) {}
uint32 AuctionId;
time_t LastChecked;
time_t LastExist;
};
struct BuyerItemInfo
{
BuyerItemInfo(): ItemCount(0), BuyPrice(0), BidPrice(0), MinBuyPrice(0), MinBidPrice(0) {}
uint32 ItemCount;
double BuyPrice;
double BidPrice;
uint32 MinBuyPrice;
uint32 MinBidPrice;
};
typedef std::map<uint32, BuyerItemInfo> BuyerItemInfoMap;
typedef std::map<uint32, BuyerAuctionEval> CheckEntryMap;
struct BuyerConfiguration
{
BuyerConfiguration(): FactionChance(3), BuyerEnabled(false), BuyerPriceRatio(100), _houseType(AUCTION_HOUSE_NEUTRAL) {}
void Initialize(AuctionHouseType houseType)
{
_houseType = houseType;
}
AuctionHouseType GetHouseType() const { return _houseType; }
BuyerItemInfoMap SameItemInfo;
CheckEntryMap CheckedEntry;
uint32 FactionChance;
bool BuyerEnabled;
uint32 BuyerPriceRatio;
private:
AuctionHouseType _houseType;
};
// This class handle all Buyer method
// (holder of AuctionBotConfig for each auction house type)
class AuctionBotBuyer : public AuctionBotAgent
{
public:
AuctionBotBuyer();
~AuctionBotBuyer();
bool Initialize() override;
bool Update(AuctionHouseType houseType) override;
void LoadConfig();
void AddNewAuctionBuyerBotBid(BuyerConfiguration& config);
private:
uint32 _checkInterval;
BuyerConfiguration _houseConfig[MAX_AUCTION_HOUSE_TYPE];
void LoadBuyerValues(BuyerConfiguration& config);
bool IsBuyableEntry(uint32 buyoutPrice, double inGameBuyPrice, uint32 maxBuyablePrice, uint32 minBuyPrice, uint32 maxChance, uint32 chanceRatio);
bool IsBidableEntry(uint32 bidPrice, double inGameBuyPrice, double maxBidablePrice, uint32 minBidPrice, uint32 maxChance, uint32 chanceRatio);
void PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice);
void BuyEntry(AuctionEntry* auction);
void PrepareListOfEntry(BuyerConfiguration& config);
uint32 GetBuyableEntry(BuyerConfiguration& config);
};
#endif
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Copyright (C) 2016 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * 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 Google Inc. 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.
#pragma once
#include "CSSPropertyNames.h"
#include "CSSValue.h"
#include "CSSVariableReferenceValue.h"
namespace WebCore {
class CSSPendingSubstitutionValue : public CSSValue {
public:
static Ref<CSSPendingSubstitutionValue> create(CSSPropertyID shorthandPropertyId, Ref<CSSVariableReferenceValue>&& shorthandValue)
{
return adoptRef(*new CSSPendingSubstitutionValue(shorthandPropertyId, WTFMove(shorthandValue)));
}
CSSVariableReferenceValue* shorthandValue() const
{
return m_shorthandValue.get();
}
CSSPropertyID shorthandPropertyId() const
{
return m_shorthandPropertyId;
}
bool equals(const CSSPendingSubstitutionValue& other) const { return m_shorthandValue == other.m_shorthandValue; }
String customCSSText() const;
private:
CSSPendingSubstitutionValue(CSSPropertyID shorthandPropertyId, Ref<CSSVariableReferenceValue>&& shorthandValue)
: CSSValue(PendingSubstitutionValueClass)
, m_shorthandPropertyId(shorthandPropertyId)
, m_shorthandValue(WTFMove(shorthandValue))
{
}
CSSPropertyID m_shorthandPropertyId;
RefPtr<CSSVariableReferenceValue> m_shorthandValue;
};
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSPendingSubstitutionValue, isPendingSubstitutionValue())
|
/*****************************************************************************
* log.c: libvlc new API log functions
*****************************************************************************
* Copyright (C) 2005 VLC authors and VideoLAN
*
* $Id$
*
* Authors: Damien Fouilleul <damienf@videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <vlc/libvlc.h>
#include "libvlc_internal.h"
#include <vlc_common.h>
#include <vlc_interface.h>
/*** Logging core dispatcher ***/
void libvlc_log_get_context(const libvlc_log_t *ctx,
const char **restrict module,
const char **restrict file,
unsigned *restrict line)
{
if (module != NULL)
*module = ctx->psz_module;
if (file != NULL)
*file = NULL;
if (line != NULL)
*line = 0;
}
void libvlc_log_get_object(const libvlc_log_t *ctx,
const char **restrict name,
const char **restrict header,
uintptr_t *restrict id)
{
if (name != NULL)
*name = (ctx->psz_object_type != NULL)
? ctx->psz_object_type : "generic";
if (header != NULL)
*header = ctx->psz_header;
if (id != NULL)
*id = ctx->i_object_id;
}
static void libvlc_logf (void *data, int level, const vlc_log_t *item,
const char *fmt, va_list ap)
{
libvlc_instance_t *inst = data;
switch (level)
{
case VLC_MSG_INFO: level = LIBVLC_NOTICE; break;
case VLC_MSG_ERR: level = LIBVLC_ERROR; break;
case VLC_MSG_WARN: level = LIBVLC_WARNING; break;
case VLC_MSG_DBG: level = LIBVLC_DEBUG; break;
}
inst->log.cb (inst->log.data, level, item, fmt, ap);
}
void libvlc_log_unset (libvlc_instance_t *inst)
{
vlc_LogSet (inst->p_libvlc_int, NULL, NULL);
}
void libvlc_log_set (libvlc_instance_t *inst, libvlc_log_cb cb, void *data)
{
libvlc_log_unset (inst); /* <- Barrier before modifying the callback */
inst->log.cb = cb;
inst->log.data = data;
vlc_LogSet (inst->p_libvlc_int, libvlc_logf, inst);
}
/*** Helpers for logging to files ***/
static void libvlc_log_file (void *data, int level, const libvlc_log_t *log,
const char *fmt, va_list ap)
{
FILE *stream = data;
flockfile (stream);
vfprintf (stream, fmt, ap);
fputc ('\n', stream);
funlockfile (stream);
(void) level; (void) log;
}
void libvlc_log_set_file (libvlc_instance_t *inst, FILE *stream)
{
libvlc_log_set (inst, libvlc_log_file, stream);
}
/*** Stubs for the old interface ***/
unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instance )
{
(void) p_instance;
return -1;
}
void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level )
{
(void) p_instance;
(void) level;
}
libvlc_log_t *libvlc_log_open( libvlc_instance_t *p_instance )
{
(void) p_instance;
return malloc(sizeof(libvlc_log_t));
}
void libvlc_log_close( libvlc_log_t *p_log )
{
free(p_log);
}
unsigned libvlc_log_count( const libvlc_log_t *p_log )
{
(void) p_log;
return 0;
}
void libvlc_log_clear( libvlc_log_t *p_log )
{
(void) p_log;
}
libvlc_log_iterator_t *libvlc_log_get_iterator( const libvlc_log_t *p_log )
{
return (p_log != NULL) ? malloc(1) : NULL;
}
void libvlc_log_iterator_free( libvlc_log_iterator_t *p_iter )
{
free( p_iter );
}
int libvlc_log_iterator_has_next( const libvlc_log_iterator_t *p_iter )
{
(void) p_iter;
return 0;
}
libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterator_t *p_iter,
libvlc_log_message_t *buffer )
{
(void) p_iter; (void) buffer;
return NULL;
}
|
/* Copyright (c) 2000, 2001, 2003, 2007 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
/* Defines used by filesort and uniques */
#define MERGEBUFF 7
#define MERGEBUFF2 15
/*
The structure SORT_ADDON_FIELD describes a fixed layout
for field values appended to sorted values in records to be sorted
in the sort buffer.
Only fixed layout is supported now.
Null bit maps for the appended values is placed before the values
themselves. Offsets are from the last sorted field, that is from the
record referefence, which is still last component of sorted records.
It is preserved for backward compatiblility.
The structure is used tp store values of the additional fields
in the sort buffer. It is used also when these values are read
from a temporary file/buffer. As the reading procedures are beyond the
scope of the 'filesort' code the values have to be retrieved via
the callback function 'unpack_addon_fields'.
*/
typedef struct st_sort_addon_field { /* Sort addon packed field */
Field *field; /* Original field */
uint offset; /* Offset from the last sorted field */
uint null_offset; /* Offset to to null bit from the last sorted field */
uint length; /* Length in the sort buffer */
uint8 null_bit; /* Null bit mask for the field */
} SORT_ADDON_FIELD;
typedef struct st_buffpek { /* Struktur om sorteringsbuffrarna */
my_off_t file_pos; /* Where we are in the sort file */
uchar *base,*key; /* key pointers */
ha_rows count; /* Number of rows in table */
ulong mem_count; /* numbers of keys in memory */
ulong max_keys; /* Max keys in buffert */
} BUFFPEK;
struct BUFFPEK_COMPARE_CONTEXT
{
qsort_cmp2 key_compare;
void *key_compare_arg;
};
typedef struct st_sort_param {
uint rec_length; /* Length of sorted records */
uint sort_length; /* Length of sorted columns */
uint ref_length; /* Length of record ref. */
uint addon_length; /* Length of added packed fields */
uint res_length; /* Length of records in final sorted file/buffer */
uint keys; /* Max keys / buffer */
ha_rows max_rows,examined_rows;
TABLE *sort_form; /* For quicker make_sortkey */
SORT_FIELD *local_sortorder;
SORT_FIELD *end;
SORT_ADDON_FIELD *addon_field; /* Descriptors for companion fields */
uchar *unique_buff;
bool not_killable;
char* tmp_buffer;
/* The fields below are used only by Unique class */
qsort2_cmp compare;
BUFFPEK_COMPARE_CONTEXT cmp_context;
} SORTPARAM;
int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
BUFFPEK *buffpek,
uint *maxbuffer, IO_CACHE *t_file);
uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
int merge_buffers(SORTPARAM *param,IO_CACHE *from_file,
IO_CACHE *to_file, uchar *sort_buffer,
BUFFPEK *lastbuff,BUFFPEK *Fb,
BUFFPEK *Tb,int flag);
void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length);
|
/*
The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
Copyright (C) 2001,2002,2003,2004 Aymeric MOIZARD jack@atosc.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LIST_H_
#define _LIST_H_
#ifdef ENABLE_MPATROL
#include <mpatrol.h>
#endif
/**
* @file osip_list.h
* @brief oSIP list Routines
*
* This is a very simple implementation of a linked list.
* <BR>There is not much to say about it... Except that it
* could be a lot improved. Sadly, it would be difficult
* to improve it without breaking the compatibility with
* older version!
*/
/**
* @defgroup oSIP_LIST oSIP list Handling
* @{
*/
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef DOXYGEN
/**
* Structure for referencing a node in a osip_list_t element.
* @var __node_t
*/
typedef struct __node __node_t;
/**
* Structure for referencing a node in a osip_list_t element.
* @struct __node
*/
struct __node
{
void *next; /**< next __node_t containing element */
void *element; /**< element in Current node */
};
#endif
/**
* Structure for referencing a list of elements.
* @var osip_list_t
*/
typedef struct osip_list osip_list_t;
/* added by bennewit@cs.tu-berlin.de */
typedef struct
{
__node_t *actual;
__node_t **prev;
osip_list_t *li;
int pos;
} osip_list_iterator_t;
/**
* Structure for referencing a list of elements.
* @struct osip_list
*/
struct osip_list
{
int nb_elt; /**< Number of element in the list */
__node_t *node; /**< Next node containing element */
};
/* added by bennewit@cs.tu-berlin.de */
#define osip_list_iterator_has_elem( it ) ( 0 != (it).actual && (it).pos < (it).li->nb_elt )
/**
* Initialise a osip_list_t element.
* NOTE: this element MUST be previously allocated with
* osip_malloc(). The osip_free() call on the list is
* still automatically done by osip_list_free(). This
* also means you can't use a static osip_list_t variable
* if you want to use osip_list_free().
* @param li The element to initialise.
*/
int osip_list_init (osip_list_t * li);
/**
* Free a list of element.
* Each element will be free with the method given as the second parameter.
* @param li The element to work on.
* @param free_func The method that is able to release one element of the list.
*/
void osip_list_special_free (osip_list_t * li, void *(*free_func) (void *));
/**
* Free a list of element where elements are pointer to 'char'.
* @param li The element to work on.
*/
void osip_list_ofchar_free (osip_list_t * li);
/**
* Get the size of a list of element.
* @param li The element to work on.
*/
int osip_list_size (const osip_list_t * li);
/**
* Check if the end of list is detected .
* @param li The element to work on.
* @param pos The index of the possible element.
*/
int osip_list_eol (const osip_list_t * li, int pos);
/**
* Add an element in a list.
* @param li The element to work on.
* @param element The pointer on the element to add.
* @param pos the index of the element to add. (or -1 to append the element at the end)
*/
int osip_list_add (osip_list_t * li, void *element, int pos);
/**
* Get an element from a list.
* @param li The element to work on.
* @param pos the index of the element to get.
*/
void *osip_list_get (const osip_list_t * li, int pos);
/**
* Remove an element from a list.
* @param li The element to work on.
* @param pos the index of the element to remove.
*/
int osip_list_remove (osip_list_t * li, int pos);
/* added by bennewit@cs.tu-berlin.de */
void *osip_list_get_first (osip_list_t * li, osip_list_iterator_t * it);
/* added by bennewit@cs.tu-berlin.de */
void *osip_list_get_next (osip_list_iterator_t * it);
/* added by bennewit@cs.tu-berlin.de */
void *osip_list_iterator_remove (osip_list_iterator_t * it);
#ifdef __cplusplus
}
#endif
/** @} */
#endif
|
/* Test ULONG_PARITY.
Copyright 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
#include "gmp-impl.h"
#include "tests.h"
void
check_one (int want, unsigned long n)
{
int got;
ULONG_PARITY (got, n);
if (got != want)
{
printf ("ULONG_PARITY wrong\n");
printf (" n %lX\n", n);
printf (" want %d\n", want);
printf (" got %d\n", got);
abort ();
}
}
void
check_various (void)
{
int i;
check_one (0, 0L);
check_one (BITS_PER_ULONG & 1, ULONG_MAX);
check_one (0, 0x11L);
check_one (1, 0x111L);
check_one (1, 0x3111L);
for (i = 0; i < BITS_PER_ULONG; i++)
check_one (1, 1L << i);
}
int
main (int argc, char *argv[])
{
tests_start ();
mp_trace_base = 16;
check_various ();
tests_end ();
exit (0);
}
|
/* pthread_barrier_init with error checking.
Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <support/xthread.h>
void
xpthread_barrier_init (pthread_barrier_t *barrier,
pthread_barrierattr_t *attr, unsigned int count)
{
xpthread_check_return ("pthread_barrier_init",
pthread_barrier_init (barrier, attr, count));
}
|
/*
* This is the source code of Telegram for iOS v. 1.1
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Peter Iakovlev, 2013.
*/
#import <UIKit/UIKit.h>
@interface TGToolbar : UIToolbar
@end
|
/******************************************************************************/
/* */
/* Copyright (c) 2009 FUJITSU LIMITED */
/* */
/* 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 */
/* */
/* Author: Li Zefan <lizf@cn.fujitsu.com> */
/* */
/******************************************************************************/
#include <unistd.h>
#include <wait.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
char *filename;
char *filepath;
int fd;
int old_inode_version;
int new_inode_version;
int get_inode_version(void)
{
char buf[1024];
sprintf(buf, "./ext4_get_inode_version.sh %s 1", filename);
/* sync before run debugfs to get inode version */
sync();
return WEXITSTATUS(system(buf));
}
void test_chmod(void)
{
if (fchmod(fd, S_IRUSR | S_IWUSR)) {
fprintf(stderr, "fchmod failed\n");
exit(1);
}
}
void test_chown(void)
{
if (fchown(fd, 1, 1)) {
fprintf(stderr, "fchown failed\n");
exit(1);
}
}
void test_read(void)
{
char buf[2];
/* write something before read */
if (write(fd, "abc", 4) == -1) {
perror("write");
exit(1);
}
close(fd);
if (open(filepath, O_RDONLY) == -1) {
perror("open");
exit(1);
}
old_inode_version = get_inode_version();
if (read(fd, buf, 1) == -1) {
perror("read");
exit(1);
}
}
void test_write(void)
{
if (write(fd, "a", 1) == -1) {
fprintf(stderr, "write failed\n");
exit(1);
}
}
void test_mmap_read(void)
{
char *p;
char c;
/* write something before read */
if (write(fd, "abc", 4) == -1) {
perror("write");
exit(1);
}
close(fd);
if (open(filepath, O_RDONLY) == -1) {
perror("open");
exit(1);
}
old_inode_version = get_inode_version();
p = mmap(NULL, 1, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
if (p == (void *)-1) {
perror("mmap");
exit(1);
}
c = *p;
new_inode_version = get_inode_version();
msync(p, 1, MS_SYNC);
}
void test_mmap_write(void)
{
char *p;
if (write(fd, "abc", 4) == -1) {
perror("write");
exit(1);
}
close(fd);
if (open(filepath, O_RDWR) == -1) {
perror("open");
exit(1);
}
old_inode_version = get_inode_version();
p = mmap(NULL, 1, PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0);
if (p == (void *)-1) {
perror("mmap");
exit(1);
}
*p = 'x';
new_inode_version = get_inode_version();
msync(p, 1, MS_SYNC);
}
/**
* argv[1]: file operation
* argv[2]: file to test (with path)
* argv[3]: file to test (without path)
*/
int main(int argc, char *argv[])
{
if (argc != 4) {
fprintf(stderr, "wrong argument number\n");
return 1;
}
filepath = argv[2];
filename = argv[3];
/* create file and get the initial inode version */
fd = creat(argv[2], O_RDWR);
if (fd == -1) {
fprintf(stderr, "failed to create file: %s\n", argv[2]);
return 1;
}
old_inode_version = get_inode_version();
if (strcmp(argv[1], "create") == 0) {
printf("%d\n", old_inode_version);
return 0;
} else if (strcmp(argv[1], "chmod") == 0) {
test_chmod();
} else if (strcmp(argv[1], "chown") == 0) {
test_chown();
} else if (strcmp(argv[1], "read") == 0) {
test_read();
} else if (strcmp(argv[1], "write") == 0) {
test_write();
} else if (strcmp(argv[1], "mmap_read") == 0) {
test_mmap_read();
} else if (strcmp(argv[1], "mmap_write") == 0) {
test_mmap_write();
} else {
fprintf(stderr, "wrong file operation: %s\n", argv[1]);
return 1;
}
new_inode_version = get_inode_version();
#if 0
fprintf(stderr, "test_inode_version: old - %d\n", old_inode_version);
fprintf(stderr, "test_inode_version: new - %d\n", new_inode_version);
#endif
/* wrong inode version, test failed */
if (new_inode_version <= old_inode_version)
return 1;
printf("%d\n", new_inode_version);
close(fd);
return 0;
}
|
// Copyright (c) 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 CONTENT_COMMON_INPUT_INPUT_EVENT_ACK_SOURCE_H_
#define CONTENT_COMMON_INPUT_INPUT_EVENT_ACK_SOURCE_H_
namespace content {
// Describes the source of where the input event ACK was
// generated from inside the renderer.
enum class InputEventAckSource {
UNKNOWN,
COMPOSITOR_THREAD,
MAIN_THREAD,
MAX = MAIN_THREAD
};
} // namespace content
#endif // CONTENT_COMMON_INPUT_INPUT_EVENT_ACK_SOURCE_H_
|
/* Normalization insensitive comparison of Unicode strings.
Copyright (C) 2009-2013 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
int
FUNC (const UNIT *s1, size_t n1, const UNIT *s2, size_t n2,
uninorm_t nf, int *resultp)
{
UNIT buf1[2048 / sizeof (UNIT)];
UNIT buf2[2048 / sizeof (UNIT)];
UNIT *norms1;
size_t norms1_length;
UNIT *norms2;
size_t norms2_length;
int cmp;
/* Normalize S1. */
norms1_length = sizeof (buf1) / sizeof (UNIT);
norms1 = U_NORMALIZE (nf, s1, n1, buf1, &norms1_length);
if (norms1 == NULL)
/* errno is set here. */
return -1;
/* Normalize S2. */
norms2_length = sizeof (buf2) / sizeof (UNIT);
norms2 = U_NORMALIZE (nf, s2, n2, buf2, &norms2_length);
if (norms2 == NULL)
{
if (norms1 != buf1)
{
int saved_errno = errno;
free (norms1);
errno = saved_errno;
}
return -1;
}
/* Compare the normalized strings. */
cmp = U_CMP2 (norms1, norms1_length, norms2, norms2_length);
if (cmp > 0)
cmp = 1;
else if (cmp < 0)
cmp = -1;
if (norms2 != buf2)
free (norms2);
if (norms1 != buf1)
free (norms1);
*resultp = cmp;
return 0;
}
|
//
// UITableView+Extras.h
// Petunia
//
// Created by Christopher Prince on 8/28/14.
// Copyright (c) 2014 Spastic Muffin, LLC. All rights reserved.
//
#import <UIKit/UIKit.h>
// In seconds.
#define DEFAULT_DURATION_OF_FLASH 2.0
@interface UITableView (Extras)
/**
* Give a negative value for durationOfFlash if you want to use the default. Give a value of 0.0 for duration if you want to use Apple's duration (looks OK on iOS6).
*/
- (void) flashRow: (NSUInteger) rowNumber withDuration: (NSTimeInterval) durationOfFlash;
- (void) flashRow: (NSUInteger) rowNumber withDuration: (NSTimeInterval) durationOfFlash andCompletion: (void (^)(void)) callback;
// For iOS7 and iOS8
// For iOS8, you also need to use the corresponding UITableViewCell category method in cellForRowAtIndexPath:
- (void) makeFullLengthSeparator;
@end
|
/************************************************************************/
/* */
/* This file is part of VDrift. */
/* */
/* VDrift 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. */
/* */
/* VDrift 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 VDrift. If not, see <http://www.gnu.org/licenses/>. */
/* */
/************************************************************************/
#ifndef _TEXTUREINFO_H
#define _TEXTUREINFO_H
struct TextureInfo
{
enum Size { SMALL, LARGE, MEDIUM };
unsigned char* data; ///< raw data pointer
short width; ///< texture width, only set if data not null
short height; ///< texture height, only set if data not null
char bytespp; ///< bytes per pixel, only set if data not null
char anisotropy; ///< anisotropic filter level
Size maxsize; ///< max texture size 128, 256, 2048
bool mipmap; ///< build mip maps
bool cube; ///< is a cube map
bool verticalcross; ///< is a vertical cross cube map
bool compress; ///< can be compressed (not a normal map e.g.)
bool repeatu; ///< repeat texture along u coordinate
bool repeatv; ///< repeat texture along v coordinate
bool npot; ///< is not power of two
bool nearest; ///< use nearest-neighbor interpolation filter
bool premultiply_alpha; ///< pre-multiply the color by the alpha value; allows using glstate.BlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); when drawing the texture to get correct blending
bool srgb; ///< apply srgb colorspace correction
TextureInfo() :
data(0),
width(0),
height(0),
bytespp(4),
anisotropy(0),
maxsize(LARGE),
mipmap(true),
cube(false),
verticalcross(false),
compress(true),
repeatu(true),
repeatv(true),
npot(true),
nearest(false),
premultiply_alpha(false),
srgb(false)
{
// ctor
}
};
#endif // _TEXTUREINFO_H
|
#ifndef _NTDBG_H
#define _NTDBG_H
// Definitions
typedef struct _DBGKM_EXCEPTION
{
EXCEPTION_RECORD ExceptionRecord;
ULONG FirstChance;
} DBGKM_EXCEPTION, *PDBGKM_EXCEPTION;
typedef struct _DBGKM_CREATE_THREAD
{
ULONG SubSystemKey;
PVOID StartAddress;
} DBGKM_CREATE_THREAD, *PDBGKM_CREATE_THREAD;
typedef struct _DBGKM_CREATE_PROCESS
{
ULONG SubSystemKey;
HANDLE FileHandle;
PVOID BaseOfImage;
ULONG DebugInfoFileOffset;
ULONG DebugInfoSize;
DBGKM_CREATE_THREAD InitialThread;
} DBGKM_CREATE_PROCESS, *PDBGKM_CREATE_PROCESS;
typedef struct _DBGKM_EXIT_THREAD
{
NTSTATUS ExitStatus;
} DBGKM_EXIT_THREAD, *PDBGKM_EXIT_THREAD;
typedef struct _DBGKM_EXIT_PROCESS
{
NTSTATUS ExitStatus;
} DBGKM_EXIT_PROCESS, *PDBGKM_EXIT_PROCESS;
typedef struct _DBGKM_LOAD_DLL
{
HANDLE FileHandle;
PVOID BaseOfDll;
ULONG DebugInfoFileOffset;
ULONG DebugInfoSize;
PVOID NamePointer;
} DBGKM_LOAD_DLL, *PDBGKM_LOAD_DLL;
typedef struct _DBGKM_UNLOAD_DLL
{
PVOID BaseAddress;
} DBGKM_UNLOAD_DLL, *PDBGKM_UNLOAD_DLL;
typedef enum _DBG_STATE
{
DbgIdle,
DbgReplyPending,
DbgCreateThreadStateChange,
DbgCreateProcessStateChange,
DbgExitThreadStateChange,
DbgExitProcessStateChange,
DbgExceptionStateChange,
DbgBreakpointStateChange,
DbgSingleStepStateChange,
DbgLoadDllStateChange,
DbgUnloadDllStateChange
} DBG_STATE, *PDBG_STATE;
typedef struct _DBGUI_CREATE_THREAD
{
HANDLE HandleToThread;
DBGKM_CREATE_THREAD NewThread;
} DBGUI_CREATE_THREAD, *PDBGUI_CREATE_THREAD;
typedef struct _DBGUI_CREATE_PROCESS
{
HANDLE HandleToProcess;
HANDLE HandleToThread;
DBGKM_CREATE_PROCESS NewProcess;
} DBGUI_CREATE_PROCESS, *PDBGUI_CREATE_PROCESS;
typedef struct _DBGUI_WAIT_STATE_CHANGE
{
DBG_STATE NewState;
CLIENT_ID AppClientId;
union
{
DBGKM_EXCEPTION Exception;
DBGUI_CREATE_THREAD CreateThread;
DBGUI_CREATE_PROCESS CreateProcessInfo;
DBGKM_EXIT_THREAD ExitThread;
DBGKM_EXIT_PROCESS ExitProcess;
DBGKM_LOAD_DLL LoadDll;
DBGKM_UNLOAD_DLL UnloadDll;
} StateInfo;
} DBGUI_WAIT_STATE_CHANGE, *PDBGUI_WAIT_STATE_CHANGE;
// System calls
#define DEBUG_READ_EVENT 0x0001
#define DEBUG_PROCESS_ASSIGN 0x0002
#define DEBUG_SET_INFORMATION 0x0004
#define DEBUG_QUERY_INFORMATION 0x0008
#define DEBUG_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
DEBUG_READ_EVENT | DEBUG_PROCESS_ASSIGN | DEBUG_SET_INFORMATION | \
DEBUG_QUERY_INFORMATION)
#define DEBUG_KILL_ON_CLOSE 0x1
typedef enum _DEBUGOBJECTINFOCLASS
{
DebugObjectFlags = 1,
MaxDebugObjectInfoClass
} DEBUGOBJECTINFOCLASS, *PDEBUGOBJECTINFOCLASS;
NTSYSCALLAPI
NTSTATUS
NTAPI
NtCreateDebugObject(
_Out_ PHANDLE DebugObjectHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_ ULONG Flags
);
NTSYSCALLAPI
NTSTATUS
NTAPI
NtDebugActiveProcess(
_In_ HANDLE ProcessHandle,
_In_ HANDLE DebugObjectHandle
);
NTSYSCALLAPI
NTSTATUS
NTAPI
NtDebugContinue(
_In_ HANDLE DebugObjectHandle,
_In_ PCLIENT_ID ClientId,
_In_ NTSTATUS ContinueStatus
);
NTSYSCALLAPI
NTSTATUS
NTAPI
NtRemoveProcessDebug(
_In_ HANDLE ProcessHandle,
_In_ HANDLE DebugObjectHandle
);
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetInformationDebugObject(
_In_ HANDLE DebugObjectHandle,
_In_ DEBUGOBJECTINFOCLASS DebugObjectInformationClass,
_In_ PVOID DebugInformation,
_In_ ULONG DebugInformationLength,
_Out_opt_ PULONG ReturnLength
);
NTSYSCALLAPI
NTSTATUS
NTAPI
NtWaitForDebugEvent(
_In_ HANDLE DebugObjectHandle,
_In_ BOOLEAN Alertable,
_In_opt_ PLARGE_INTEGER Timeout,
_Out_ PVOID WaitStateChange
);
// Debugging UI
NTSYSAPI
NTSTATUS
NTAPI
DbgUiConnectToDbg(
VOID
);
NTSYSAPI
HANDLE
NTAPI
DbgUiGetThreadDebugObject(
VOID
);
NTSYSAPI
VOID
NTAPI
DbgUiSetThreadDebugObject(
_In_ HANDLE DebugObject
);
NTSYSAPI
NTSTATUS
NTAPI
DbgUiWaitStateChange(
_Out_ PDBGUI_WAIT_STATE_CHANGE StateChange,
_In_opt_ PLARGE_INTEGER Timeout
);
NTSYSAPI
NTSTATUS
NTAPI
DbgUiContinue(
_In_ PCLIENT_ID AppClientId,
_In_ NTSTATUS ContinueStatus
);
NTSYSAPI
NTSTATUS
NTAPI
DbgUiStopDebugging(
_In_ HANDLE Process
);
NTSYSAPI
NTSTATUS
NTAPI
DbgUiDebugActiveProcess(
_In_ HANDLE Process
);
NTSYSAPI
VOID
NTAPI
DbgUiRemoteBreakin(
_In_ PVOID Context
);
NTSYSAPI
NTSTATUS
NTAPI
DbgUiIssueRemoteBreakin(
_In_ HANDLE Process
);
struct _DEBUG_EVENT;
NTSYSAPI
NTSTATUS
NTAPI
DbgUiConvertStateChangeStructure(
_In_ PDBGUI_WAIT_STATE_CHANGE StateChange,
_Out_ struct _DEBUG_EVENT *DebugEvent
);
#endif
|
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define USE_TARGET_CONFIG
#define TARGET_BOARD_IDENTIFIER "NOX1"
#define USBD_PRODUCT_STRING "NoxF4V1"
#define LED0_PIN PA4
#define USE_BEEPER
#define BEEPER_PIN PC13
#define BEEPER_INVERTED
#define INVERTER_PIN_UART2 PC14
#define USE_ACC
#define USE_ACC_SPI_MPU6500
#define USE_ACC_SPI_MPU6000
#define USE_GYRO
#define USE_GYRO_SPI_MPU6500
#define USE_GYRO_SPI_MPU6000
#define GYRO_1_CS_PIN PB12
#define GYRO_1_SPI_INSTANCE SPI2
#define USE_EXTI
#define USE_GYRO_EXTI
#define GYRO_1_EXTI_PIN PA8
#define USE_MPU_DATA_READY_SIGNAL
#define USE_BARO
#define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280
#define BARO_SPI_INSTANCE SPI2
#define BARO_CS_PIN PA9
#define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI2
#define MAX7456_SPI_CS_PIN PA10
#define USE_VCP
#define USE_USB_DETECT
//#define USB_DETECT_PIN PC5
#define USE_UART1
#define UART1_RX_PIN PB7
#define UART1_TX_PIN PB6
#define USE_UART2
#define UART2_RX_PIN PA3
#define UART2_TX_PIN PA2
#define USE_SOFTSERIAL1
#define SOFTSERIAL1_RX_PIN PA2 // Backdoor timer on UART2_TX, used for ESC telemetry
#define SOFTSERIAL1_TX_PIN PA2 // Workaround for softserial not initializing with only RX
#define USE_SOFTSERIAL2
#define SOFTSERIAL2_RX_PIN NONE
#define SOFTSERIAL2_TX_PIN NONE
#define SERIAL_PORT_COUNT 5 //VCP, USART1, USART2, SOFTSERIAL1, SOFTSERIAL2
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PB10
#define USE_SPI
#define USE_SPI_DEVICE_1
#define SPI1_SCK_PIN PB3
#define SPI1_MISO_PIN PB4
#define SPI1_MOSI_PIN PB5
#define USE_SPI_DEVICE_2
#define SPI2_SCK_PIN PB13
#define SPI2_MISO_PIN PB14
#define SPI2_MOSI_PIN PB15
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define FLASH_SPI_INSTANCE SPI1
#define FLASH_CS_PIN PA15
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
#define USE_ADC
#define CURRENT_METER_ADC_PIN NONE // PA6 Available from TP33
#define VBAT_ADC_PIN PA5 // 11:1 (10K + 1K) divider
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ESC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ESC
#define SERIALRX_UART SERIAL_PORT_USART2
#define USE_TRANSPONDER
#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
#define SERIALRX_PROVIDER SERIALRX_SBUS
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_SOFTSERIAL | FEATURE_ESC_SENSOR)
#define TARGET_IO_PORTA (0xffff & ~(BIT(14)|BIT(13)))
#define TARGET_IO_PORTB (0xffff & ~(BIT(2)|BIT(11)))
#define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
#define USABLE_TIMER_CHANNEL_COUNT 8
#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(9) )
|
/*
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/>.
*/
#pragma once
#include <AP_Common/AP_Common.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_Param/AP_Param.h>
#include <AP_Math/AP_Math.h>
// Maximum number of WheelEncoder measurement instances available on this platform
#define WHEELENCODER_MAX_INSTANCES 2
#define WHEELENCODER_CPR_DEFAULT 3200 // default encoder counts per full revolution of the wheel
#define WHEELENCODER_RADIUS_DEFAULT 0.05f // default wheel radius of 5cm (0.05m)
class AP_WheelEncoder_Backend;
class AP_WheelEncoder
{
public:
friend class AP_WheelEncoder_Backend;
friend class AP_WheelEncoder_Quadrature;
AP_WheelEncoder(void);
/* Do not allow copies */
AP_WheelEncoder(const AP_WheelEncoder &other) = delete;
AP_WheelEncoder &operator=(const AP_WheelEncoder&) = delete;
// WheelEncoder driver types
enum WheelEncoder_Type : uint8_t {
WheelEncoder_TYPE_NONE = 0,
WheelEncoder_TYPE_QUADRATURE = 1
};
// The WheelEncoder_State structure is filled in by the backend driver
struct WheelEncoder_State {
uint8_t instance; // the instance number of this WheelEncoder
int32_t distance_count; // cumulative number of forward + backwards events received from wheel encoder
float distance; // total distance measured in meters
uint32_t total_count; // total number of successful readings from sensor (used for sensor quality calcs)
uint32_t error_count; // total number of errors reading from sensor (used for sensor quality calcs)
uint32_t last_reading_ms; // time of last reading
int32_t dist_count_change; // distance count change during the last update (used to calculating rate)
uint32_t dt_ms; // time change (in milliseconds) for the previous period (used to calculating rate)
};
// detect and initialise any available rpm sensors
void init(void);
// update state of all sensors. Should be called from main loop
void update(void);
// return the number of wheel encoder sensor instances
uint8_t num_sensors(void) const { return num_instances; }
// return true if healthy
bool healthy(uint8_t instance) const;
// return true if the instance is enabled
bool enabled(uint8_t instance) const;
// get the counts per revolution of the encoder
uint16_t get_counts_per_revolution(uint8_t instance) const;
// get the wheel radius in meters
float get_wheel_radius(uint8_t instance) const;
// get the position of the wheel associated with the wheel encoder
Vector3f get_position(uint8_t instance) const;
// get total delta angle (in radians) measured by the wheel encoder
float get_delta_angle(uint8_t instance) const;
// get the total distance traveled in meters
float get_distance(uint8_t instance) const;
// get the instantaneous rate in radians/second
float get_rate(uint8_t instance) const;
// get the total number of sensor reading from the encoder
uint32_t get_total_count(uint8_t instance) const;
// get the total number of errors reading from the encoder
uint32_t get_error_count(uint8_t instance) const;
// get the signal quality for a sensor (0 = extremely poor quality, 100 = extremely good quality)
float get_signal_quality(uint8_t instance) const;
// get the system time (in milliseconds) of the last update
uint32_t get_last_reading_ms(uint8_t instance) const;
static const struct AP_Param::GroupInfo var_info[];
protected:
// parameters for each instance
AP_Int8 _type[WHEELENCODER_MAX_INSTANCES];
AP_Int16 _counts_per_revolution[WHEELENCODER_MAX_INSTANCES];
AP_Float _wheel_radius[WHEELENCODER_MAX_INSTANCES];
AP_Vector3f _pos_offset[WHEELENCODER_MAX_INSTANCES];
AP_Int8 _pina[WHEELENCODER_MAX_INSTANCES];
AP_Int8 _pinb[WHEELENCODER_MAX_INSTANCES];
WheelEncoder_State state[WHEELENCODER_MAX_INSTANCES];
AP_WheelEncoder_Backend *drivers[WHEELENCODER_MAX_INSTANCES];
uint8_t num_instances;
};
|
/*
zip_add_dir.c -- add directory
Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
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 names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
#include <string.h>
#include "zipint.h"
/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */
ZIP_EXTERN(zip_int64_t)
zip_add_dir(struct zip *za, const char *name)
{
int len;
zip_int64_t ret;
char *s;
struct zip_source *source;
if (ZIP_IS_RDONLY(za)) {
_zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
return -1;
}
if (name == NULL) {
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
s = NULL;
len = strlen(name);
if (name[len-1] != '/') {
if ((s=(char *)malloc(len+2)) == NULL) {
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return -1;
}
strcpy(s, name);
s[len] = '/';
s[len+1] = '\0';
}
if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) {
free(s);
return -1;
}
ret = _zip_replace(za, -1, s ? s : name, source);
free(s);
if (ret < 0)
zip_source_free(source);
return ret;
}
|
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_DECODER_H_
#define WEBRTC_VIDEO_DECODER_H_
#include <memory>
#include <string>
#include <vector>
#include "webrtc/common_types.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_frame.h"
namespace webrtc {
class RTPFragmentationHeader;
// TODO(pbos): Expose these through a public (root) header or change these APIs.
struct CodecSpecificInfo;
struct VideoCodec;
class DecodedImageCallback {
public:
virtual ~DecodedImageCallback() {}
virtual int32_t Decoded(VideoFrame& decodedImage) = 0;
// Provides an alternative interface that allows the decoder to specify the
// decode time excluding waiting time for any previous pending frame to
// return. This is necessary for breaking positive feedback in the delay
// estimation when the decoder has a single output buffer.
// TODO(perkj): Remove default implementation when chromium has been updated.
virtual int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) {
// The default implementation ignores custom decode time value.
return Decoded(decodedImage);
}
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {
return -1;
}
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; }
};
class VideoDecoder {
public:
enum DecoderType {
kH264,
kVp8,
kVp9,
kUnsupportedCodec,
};
static VideoDecoder* Create(DecoderType codec_type);
virtual ~VideoDecoder() {}
virtual int32_t InitDecode(const VideoCodec* codec_settings,
int32_t number_of_cores) = 0;
virtual int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codec_specific_info = NULL,
int64_t render_time_ms = -1) = 0;
virtual int32_t RegisterDecodeCompleteCallback(
DecodedImageCallback* callback) = 0;
virtual int32_t Release() = 0;
// Returns true if the decoder prefer to decode frames late.
// That is, it can not decode infinite number of frames before the decoded
// frame is consumed.
virtual bool PrefersLateDecoding() const { return true; }
virtual const char* ImplementationName() const { return "unknown"; }
};
// Class used to wrap external VideoDecoders to provide a fallback option on
// software decoding when a hardware decoder fails to decode a stream due to
// hardware restrictions, such as max resolution.
class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder {
public:
VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type,
VideoDecoder* decoder);
int32_t InitDecode(const VideoCodec* codec_settings,
int32_t number_of_cores) override;
int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms) override;
int32_t RegisterDecodeCompleteCallback(
DecodedImageCallback* callback) override;
int32_t Release() override;
bool PrefersLateDecoding() const override;
const char* ImplementationName() const override;
private:
bool InitFallbackDecoder();
const DecoderType decoder_type_;
VideoDecoder* const decoder_;
VideoCodec codec_settings_;
int32_t number_of_cores_;
std::string fallback_implementation_name_;
std::unique_ptr<VideoDecoder> fallback_decoder_;
DecodedImageCallback* callback_;
};
// Video decoder class to be used for unknown codecs. Doesn't support decoding
// but logs messages to LS_ERROR.
class NullVideoDecoder : public VideoDecoder {
public:
NullVideoDecoder();
int32_t InitDecode(const VideoCodec* codec_settings,
int32_t number_of_cores) override;
int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms) override;
int32_t RegisterDecodeCompleteCallback(
DecodedImageCallback* callback) override;
int32_t Release() override;
const char* ImplementationName() const override;
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_DECODER_H_
|
/*
* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CasparCG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Robert Nagy, ronag89@gmail.com
*/
#pragma once
#include <core/fwd.h>
#include <common/memory.h>
#include <string>
#include <vector>
namespace caspar { namespace flash {
spl::shared_ptr<core::frame_producer> create_producer(const core::frame_producer_dependencies& dependencies,
const std::vector<std::wstring>& params);
spl::shared_ptr<core::frame_producer> create_swf_producer(const core::frame_producer_dependencies& dependencies,
const std::vector<std::wstring>& params);
std::wstring find_template(const std::wstring& templateName);
}} // namespace caspar::flash |
/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.11 2007/03/26 21:44:11 momjian Exp $ */
/* This is used by psql under Win32 */
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
*/
#include <stdio.h>
#include <string.h>
#ifdef _MSC_VER
/* disable the following warnings
* C4706: assignment within conditional expression
*/
#pragma warning(disable:4706)
#endif
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
char *optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""
/*
* getopt
* Parse argc/argv argument vector.
*/
int
getopt(int nargc, char * const *nargv, const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
if (optreset || !*place)
{ /* update scanning pointer */
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-')
{
place = EMSG;
return -1;
}
if (place[1] && *++place == '-' && place[1] == '\0')
{ /* found "--" */
++optind;
place = EMSG;
return -1;
}
} /* option letter okay? */
if ((optopt = (int) *place++) == (int) ':' ||
!(oli = strchr(ostr, optopt)))
{
/*
* if the user didn't specify '-' as an option, assume it means -1.
*/
if (optopt == (int) '-')
return -1;
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void) fprintf(stderr,
"illegal option -- %c\n", optopt);
return BADCH;
}
if (*++oli != ':')
{ /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else
{ /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind)
{ /* no arg */
place = EMSG;
if (*ostr == ':')
return BADARG;
if (opterr)
(void) fprintf(stderr,
"option requires an argument -- %c\n",
optopt);
return BADCH;
}
else
/* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return optopt; /* dump back option letter */
}
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 2014 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/log.h"
#include "dbinc/mp.h"
/*
* memp_register_pp --
* ENV->memp_register pre/post processing.
*
* PUBLIC: int __memp_register_pp __P((DB_ENV *, int,
* PUBLIC: int (*)(DB_ENV *, db_pgno_t, void *, DBT *),
* PUBLIC: int (*)(DB_ENV *, db_pgno_t, void *, DBT *)));
*/
int
__memp_register_pp(dbenv, ftype, pgin, pgout)
DB_ENV *dbenv;
int ftype;
int (*pgin) __P((DB_ENV *, db_pgno_t, void *, DBT *));
int (*pgout) __P((DB_ENV *, db_pgno_t, void *, DBT *));
{
DB_THREAD_INFO *ip;
ENV *env;
int ret;
env = dbenv->env;
ENV_REQUIRES_CONFIG(env,
env->mp_handle, "DB_ENV->memp_register", DB_INIT_MPOOL);
if (REP_ON(env)) {
__db_errx(env, DB_STR_A("3001",
"%smethod not permitted when replication is configured",
"%s"), "DB_ENV->memp_register: ");
return (EINVAL);
}
ENV_ENTER(env, ip);
ret = __memp_register(env, ftype, pgin, pgout);
ENV_LEAVE(env, ip);
return (ret);
}
/*
* memp_register --
* ENV->memp_register.
*
* PUBLIC: int __memp_register __P((ENV *, int,
* PUBLIC: int (*)(DB_ENV *, db_pgno_t, void *, DBT *),
* PUBLIC: int (*)(DB_ENV *, db_pgno_t, void *, DBT *)));
*/
int
__memp_register(env, ftype, pgin, pgout)
ENV *env;
int ftype;
int (*pgin) __P((DB_ENV *, db_pgno_t, void *, DBT *));
int (*pgout) __P((DB_ENV *, db_pgno_t, void *, DBT *));
{
DB_MPOOL *dbmp;
DB_MPREG *mpreg;
int ret;
dbmp = env->mp_handle;
/*
* We keep the DB pgin/pgout functions outside of the linked list
* to avoid locking/unlocking the linked list on every page I/O.
*
* The Berkeley DB I/O conversion functions are registered when the
* environment is first created, so there's no need for locking here.
*/
if (ftype == DB_FTYPE_SET) {
if (dbmp->pg_inout != NULL)
return (0);
if ((ret =
__os_malloc(env, sizeof(DB_MPREG), &dbmp->pg_inout)) != 0)
return (ret);
dbmp->pg_inout->ftype = ftype;
dbmp->pg_inout->pgin = pgin;
dbmp->pg_inout->pgout = pgout;
return (0);
}
/*
* The item may already have been registered. If already registered,
* just update the entry, although it's probably unchanged.
*/
MUTEX_LOCK(env, dbmp->mutex);
LIST_FOREACH(mpreg, &dbmp->dbregq, q)
if (mpreg->ftype == ftype) {
mpreg->pgin = pgin;
mpreg->pgout = pgout;
break;
}
if (mpreg == NULL) { /* New entry. */
if ((ret = __os_malloc(env, sizeof(DB_MPREG), &mpreg)) != 0)
return (ret);
mpreg->ftype = ftype;
mpreg->pgin = pgin;
mpreg->pgout = pgout;
LIST_INSERT_HEAD(&dbmp->dbregq, mpreg, q);
}
MUTEX_UNLOCK(env, dbmp->mutex);
return (0);
}
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef SEARCHRESULTWIDGET_H
#define SEARCHRESULTWIDGET_H
#include "searchresultwindow.h"
#include <coreplugin/infobar.h>
#include <QWidget>
QT_BEGIN_NAMESPACE
class QFrame;
class QLabel;
class QLineEdit;
class QToolButton;
class QCheckBox;
QT_END_NAMESPACE
namespace Find {
namespace Internal {
class SearchResultTreeView;
class SearchResultColor;
class SearchResultWidget : public QWidget
{
Q_OBJECT
public:
explicit SearchResultWidget(QWidget *parent = 0);
~SearchResultWidget();
void setInfo(const QString &label, const QString &toolTip, const QString &term);
void addResult(const QString &fileName, int lineNumber, const QString &lineText,
int searchTermStart, int searchTermLength, const QVariant &userData = QVariant());
void addResults(const QList<SearchResultItem> &items, SearchResult::AddMode mode);
int count() const;
QString dontAskAgainGroup() const;
void setDontAskAgainGroup(const QString &group);
void setTextToReplace(const QString &textToReplace);
QString textToReplace() const;
void setShowReplaceUI(bool visible);
bool hasFocusInternally() const;
void setFocusInternally();
bool canFocusInternally() const;
void notifyVisibilityChanged(bool visible);
void setTextEditorFont(const QFont &font, const SearchResultColor color);
void setAutoExpandResults(bool expand);
void expandAll();
void collapseAll();
void goToNext();
void goToPrevious();
void restart();
void setSearchAgainSupported(bool supported);
void setSearchAgainEnabled(bool enabled);
public slots:
void finishSearch(bool canceled);
void sendRequestPopup();
signals:
void activated(const Find::SearchResultItem &item);
void replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems, bool preserveCase);
void searchAgainRequested();
void cancelled();
void paused(bool paused);
void restarted();
void visibilityChanged(bool visible);
void requestPopup(bool focus);
void navigateStateChanged();
private slots:
void continueAfterSizeWarning();
void cancelAfterSizeWarning();
void handleJumpToSearchResult(const SearchResultItem &item);
void handleReplaceButton();
void cancel();
void searchAgain();
private:
QList<SearchResultItem> checkedItems() const;
void updateMatchesFoundLabel();
SearchResultTreeView *m_searchResultTreeView;
int m_count;
QString m_dontAskAgainGroup;
QFrame *m_messageWidget;
Core::InfoBar m_infoBar;
Core::InfoBarDisplay m_infoBarDisplay;
bool m_isShowingReplaceUI;
QLabel *m_replaceLabel;
QLineEdit *m_replaceTextEdit;
QToolButton *m_replaceButton;
QToolButton *m_searchAgainButton;
QCheckBox *m_preserveCaseCheck;
bool m_searchAgainSupported;
QWidget *m_descriptionContainer;
QLabel *m_label;
QLabel *m_searchTerm;
QToolButton *m_cancelButton;
QLabel *m_matchesFoundLabel;
};
} // Internal
} // Find
#endif // SEARCHRESULTWIDGET_H
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of Qt Designer. This header
// file may change from version to version without notice, or even be removed.
//
// We mean it.
//
#ifndef QDESIGNER_INTEGRATION_H
#define QDESIGNER_INTEGRATION_H
#include "shared_global_p.h"
#include <QDesignerIntegrationInterface>
#include <QObject>
QT_BEGIN_NAMESPACE
class QDesignerFormEditorInterface;
class QDesignerFormWindowInterface;
class QDesignerResourceBrowserInterface;
class QVariant;
class QWidget;
namespace qdesigner_internal {
struct Selection;
class QDesignerIntegrationPrivate;
class QDESIGNER_SHARED_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface
{
Q_OBJECT
public:
explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = 0);
virtual ~QDesignerIntegration();
static void requestHelp(const QDesignerFormEditorInterface *core, const QString &manual, const QString &document);
virtual QWidget *containerWindow(QWidget *widget) const;
// Load plugins into widget database and factory.
static void initializePlugins(QDesignerFormEditorInterface *formEditor);
void emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object,
const QString &newName, const QString &oldName);
void emitNavigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList ¶meterNames);
void emitNavigateToSlot(const QString &slotSignature);
// Create a resource browser specific to integration. Language integration takes precedence
virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = 0);
enum ResourceFileWatcherBehaviour {
NoWatcher,
ReloadSilently,
PromptAndReload
};
ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const;
bool isResourceEditingEnabled() const;
bool isSlotNavigationEnabled() const;
QString contextHelpId() const;
protected:
void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour); // PromptAndReload by default
void setResourceEditingEnabled(bool enable); // true by default
void setSlotNavigationEnabled(bool enable); // false by default
signals:
void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value);
void objectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName);
void helpRequested(const QString &manual, const QString &document);
void navigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList ¶meterNames);
void navigateToSlot(const QString &slotSignature);
public slots:
virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
// Additional signals of designer property editor
virtual void resetProperty(const QString &name);
virtual void addDynamicProperty(const QString &name, const QVariant &value);
virtual void removeDynamicProperty(const QString &name);
virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow);
virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow);
virtual void updateSelection();
virtual void updateGeometry();
virtual void activateWidget(QWidget *widget);
void updateCustomWidgetPlugins();
private slots:
void updatePropertyPrivate(const QString &name, const QVariant &value);
private:
void initialize();
void getSelection(Selection &s);
QObject *propertyEditorObject();
QDesignerIntegrationPrivate *m_d;
};
} // namespace qdesigner_internal
QT_END_NAMESPACE
#endif // QDESIGNER_INTEGRATION_H
|
#ifndef foodbuswatchgluehfoo
#define foodbuswatchgluehfoo
/* $Id$ */
/***
This file is part of avahi.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi 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 avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
#include <dbus/dbus.h>
#include <avahi-common/watch.h>
AVAHI_C_DECL_BEGIN
int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api);
AVAHI_C_DECL_END
#endif
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef RMQTOPERATION_H
#define RMQTOPERATION_H
#include "operation.h"
#include <QString>
class RmQtOperation : public Operation
{
public:
QString name() const;
QString helpText() const;
QString argumentsHelpText() const;
bool setArguments(const QStringList &args);
int execute() const;
#ifdef WITH_TESTS
bool test() const;
#endif
static QVariantMap rmQt(const QVariantMap &map, const QString &id);
private:
QString m_id;
};
#endif // RMQTOPERATION_H
|
/* vim:expandtab:ts=2 sw=2:
*/
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2008 Adrien Destugues
Grafx2 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
Grafx2 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 Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
//////////////////////////////////////////////////////////////////////////////
///@file realpath.h
/// Implementation of realpath() that is portable on all our platforms.
//////////////////////////////////////////////////////////////////////////////
#ifndef _REALPATH_H
#define _REALPATH_H
///
/// Makes an absolute filename, resolving symbolic links etc.
/// @param _path Input path
/// @param resolved_path Output path, allocated by caller
/// @return (points to resolved_path)
char *Realpath(const char *_path, char *resolved_path);
#endif
|
/*
* Copyright (C) 2014 Project Hatohol
*
* This file is part of Hatohol.
*
* Hatohol is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 3
* as published by the Free Software Foundation.
*
* Hatohol 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 Hatohol. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef IncidentSenderRedmine_h
#define IncidentSenderRedmine_h
#include "IncidentSender.h"
class IncidentSenderRedmine : public IncidentSender
{
public:
IncidentSenderRedmine(const IncidentTrackerInfo &tracker);
virtual ~IncidentSenderRedmine();
virtual HatoholError send(const EventInfo &event) override;
virtual HatoholError send(const IncidentInfo &incident,
const std::string &comment) override;
protected:
std::string buildJSON(const EventInfo &event);
std::string buildJSON(const IncidentInfo &incident,
const std::string &comment);
std::string getProjectURL(void);
std::string buildDescription(const EventInfo &event,
const MonitoringServerInfo *server);
std::string getIssuesJSONURL(void);
std::string getIssueURL(const std::string &id);
HatoholError parseResponse(IncidentInfo &incidentInfo,
const std::string &response);
HatoholError buildIncidentInfo(IncidentInfo &incidentInfo,
const std::string &response,
const EventInfo &event);
// TODO: Move to MonitoringServer?
static std::string buildURLMonitoringServerEvent(
const EventInfo &event,
const MonitoringServerInfo *server);
private:
struct Impl;
std::unique_ptr<Impl> m_impl;
};
#endif // IncidentSenderRedmine_h
|
/*
* gstcmmlenc.h - GStreamer CMML encoder
* Copyright (C) 2005 Alessandro Decina
*
* Authors:
* Alessandro Decina <alessandro@nnva.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CMML_ENC_H__
#define __GST_CMML_ENC_H__
#define GST_TYPE_CMML_ENC (gst_cmml_enc_get_type())
#define GST_CMML_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CMML_ENC, GstCmmlEnc))
#define GST_CMML_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CMML_ENC, GstCmmlEncClass))
#define GST_IS_CMML_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CMML_ENC))
#define GST_IS_CMML_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CMML_ENC))
#define GST_CMML_ENC_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_CMML_ENC, GstCmmlEncClass))
#include <glib.h>
#include <gst/gst.h>
#include "gstcmmlparser.h"
#include "gstcmmlutils.h"
typedef struct _GstCmmlEnc GstCmmlEnc;
typedef struct _GstCmmlEncClass GstCmmlEncClass;
struct _GstCmmlEnc
{
GstElement element;
GstPad *sinkpad;
GstPad *srcpad;
gint16 major;
gint16 minor;
gint64 granulerate_n;
gint64 granulerate_d;
gint8 granuleshift;
GstCmmlParser *parser;
gboolean streaming;
GHashTable *tracks;
GstFlowReturn flow_return;
guchar *preamble;
gboolean sent_headers;
gboolean sent_eos;
};
struct _GstCmmlEncClass
{
GstElementClass parent_class;
};
gboolean gst_cmml_enc_plugin_init (GstPlugin * plugin);
#endif /* __GST_CMML_ENC_H__ */
|
/* =========================================================================
* This file is part of NITRO
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* NITRO is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, If not,
* see <http://www.gnu.org/licenses/>.
*
*/
#include <import/nitf.h>
#include "nitf_LabelSegment.h"
#include "nitf_JNI.h"
NITF_JNI_DECLARE_OBJ(nitf_LabelSegment)
/*
* Class: nitf_LabelSegment
* Method: getSubheader
* Signature: ()Lnitf/LabelSubheader;
*/
JNIEXPORT jobject JNICALL Java_nitf_LabelSegment_getSubheader
(JNIEnv * env, jobject self)
{
nitf_LabelSegment *segment = _GetObj(env, self);
jclass subheaderClass = (*env)->FindClass(env, "nitf/LabelSubheader");
jmethodID methodID =
(*env)->GetMethodID(env, subheaderClass, "<init>", "(J)V");
return (*env)->NewObject(env,
subheaderClass,
methodID, (jlong) segment->subheader);
}
/*
* Class: nitf_LabelSegment
* Method: getOffset
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_nitf_LabelSegment_getOffset
(JNIEnv * env, jobject self)
{
nitf_LabelSegment *segment = _GetObj(env, self);
return segment->offset;
}
/*
* Class: nitf_LabelSegment
* Method: getEnd
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_nitf_LabelSegment_getEnd
(JNIEnv * env, jobject self)
{
nitf_LabelSegment *segment = _GetObj(env, self);
return segment->end;
}
|
/* Copyright (c) 2007-2008 CSIRO
Copyright (c) 2007-2009 Xiph.Org Foundation
Written by Jean-Marc Valin */
/*
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 Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RATE_H
#define RATE_H
#define MAX_PSEUDO 40
#define LOG_MAX_PSEUDO 6
#define MAX_PULSES 128
#define MAX_FINE_BITS 8
#define FINE_OFFSET 21
#define QTHETA_OFFSET 4
#define QTHETA_OFFSET_TWOPHASE 16
#include "cwrs.h"
#include "modes.h"
void compute_pulse_cache(CELTMode *m, int LM);
static inline int get_pulses(int i)
{
return i<8 ? i : (8 + (i&7)) << ((i>>3)-1);
}
static inline int bits2pulses(const CELTMode *m, int band, int LM, int bits)
{
int i;
int lo, hi;
const unsigned char *cache;
LM++;
cache = m->cache.bits + m->cache.index[LM*m->nbEBands+band];
lo = 0;
hi = cache[0];
bits--;
for (i=0;i<LOG_MAX_PSEUDO;i++)
{
int mid = (lo+hi+1)>>1;
/* OPT: Make sure this is implemented with a conditional move */
if (cache[mid] >= bits)
hi = mid;
else
lo = mid;
}
if (bits- (lo == 0 ? -1 : cache[lo]) <= cache[hi]-bits)
return lo;
else
return hi;
}
static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses)
{
const unsigned char *cache;
LM++;
cache = m->cache.bits + m->cache.index[LM*m->nbEBands+band];
return pulses == 0 ? 0 : cache[pulses]+1;
}
/** Compute the pulse allocation, i.e. how many pulses will go in each
* band.
@param m mode
@param offsets Requested increase or decrease in the number of bits for
each band
@param total Number of bands
@param pulses Number of pulses per band (returned)
@return Total number of bits allocated
*/
int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stero,
opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev);
#endif
|
/*
* HttpSessionList.h
*
* Created on: Jun 2, 2011
* Author: kyle
*/
#ifndef HTTPSESSIONLIST_H_
#define HTTPSESSIONLIST_H_
#include "engine/engine.h"
using namespace server::web;
namespace server {
namespace web {
namespace session {
class HttpSessionList : public VectorMap<String, HttpSession*> {
public:
HttpSessionList() {
}
virtual ~HttpSessionList() {
}
};
}
}
}
using namespace server::web::session;
#endif /* HTTPSESSIONLIST_H_ */
|
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
/*
* Copyright 2013-2016 IBM Corp
*/
#include <ccan/short_types/short_types.h>
#include <io.h>
#include <string.h>
void *memcpy_from_ci(void *destpp, const void *srcpp, size_t len)
{
const size_t block = sizeof(uint64_t);
unsigned long int destp = (long int) destpp;
unsigned long int srcp = (long int) srcpp;
/* Copy as many blocks as possible if srcp is block aligned */
if ((srcp % block) == 0) {
while ((len - block) > -1) {
uint64_t v;
if (HAVE_BIG_ENDIAN)
v = in_be64((beint64_t*)srcp);
else
v = in_le64((leint64_t*)srcp);
*((uint64_t *) destp) = v;
srcp += block;
destp += block;
len -= block;
}
}
/*
* Byte-by-byte copy if srcp is not block aligned or len is/becomes
* less than one block
*/
while (len > 0) {
*((uint8_t*) destp) = in_8((uint8_t*)srcp);
srcp += 1;
destp += 1;
len--;
}
return destpp;
}
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#pragma once
#include "rocksdb/env.h"
#include "rocksdb/statistics.h"
namespace rocksdb {
class ConcurrentTaskLimiter {
public:
virtual ~ConcurrentTaskLimiter() {}
// Returns a name that identifies this concurrent task limiter.
virtual const std::string& GetName() const = 0;
// Set max concurrent tasks.
// limit = 0 means no new task allowed.
// limit < 0 means no limitation.
virtual void SetMaxOutstandingTask(int32_t limit) = 0;
// Reset to unlimited max concurrent task.
virtual void ResetMaxOutstandingTask() = 0;
// Returns current outstanding task count.
virtual int32_t GetOutstandingTask() const = 0;
};
// Create a ConcurrentTaskLimiter that can be shared with mulitple CFs
// across RocksDB instances to control concurrent tasks.
//
// @param name: Name of the limiter.
// @param limit: max concurrent tasks.
// limit = 0 means no new task allowed.
// limit < 0 means no limitation.
extern ConcurrentTaskLimiter* NewConcurrentTaskLimiter(const std::string& name,
int32_t limit);
} // namespace rocksdb
|
// 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.
// This API is EXPERIMENTAL.
#pragma once
#include "arrow/compute/exec/expression.h"
#include "arrow/dataset/dataset.h"
#include "arrow/dataset/discovery.h"
#include "arrow/dataset/file_base.h"
#include "arrow/dataset/file_csv.h"
#include "arrow/dataset/file_ipc.h"
#include "arrow/dataset/file_orc.h"
#include "arrow/dataset/file_parquet.h"
#include "arrow/dataset/scanner.h"
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_GENERATED_REMOVEINFOMARSHALLER_H_
#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_GENERATED_REMOVEINFOMARSHALLER_H_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <activemq/wireformat/openwire/marshal/generated/BaseCommandMarshaller.h>
#include <decaf/io/DataInputStream.h>
#include <decaf/io/DataOutputStream.h>
#include <decaf/io/IOException.h>
#include <activemq/util/Config.h>
#include <activemq/commands/DataStructure.h>
#include <activemq/wireformat/openwire/OpenWireFormat.h>
#include <activemq/wireformat/openwire/utils/BooleanStream.h>
namespace activemq {
namespace wireformat {
namespace openwire {
namespace marshal {
namespace generated {
/**
* Marshaling code for Open Wire Format for RemoveInfoMarshaller
*
* NOTE!: This file is auto generated - do not modify!
* if you need to make a change, please see the Java Classes
* in the activemq-openwire-generator module
*/
class AMQCPP_API RemoveInfoMarshaller : public BaseCommandMarshaller {
public:
RemoveInfoMarshaller() {}
virtual ~RemoveInfoMarshaller() {}
virtual commands::DataStructure* createObject() const;
virtual unsigned char getDataStructureType() const;
virtual void tightUnmarshal(OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataInputStream* dataIn,
utils::BooleanStream* bs);
virtual int tightMarshal1(OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
utils::BooleanStream* bs);
virtual void tightMarshal2(OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataOutputStream* dataOut,
utils::BooleanStream* bs);
virtual void looseUnmarshal(OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataInputStream* dataIn);
virtual void looseMarshal(OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataOutputStream* dataOut);
};
}}}}}
#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_GENERATED_REMOVEINFOMARSHALLER_H_*/
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeSurfaceLICMapper.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 vtkCompositeSurfaceLICMapper - mapper for composite dataset
// .SECTION Description
// vtkCompositeSurfaceLICMapper is similar to
// vtkGenericCompositeSurfaceLICMapper but requires that its inputs all have the
// same properties (normals, tcoord, scalars, etc) It will only draw
// polys and it does not support edge flags. The advantage to using
// this class is that it generally should be faster
#ifndef vtkCompositeSurfaceLICMapper_h
#define vtkCompositeSurfaceLICMapper_h
#include "vtkRenderingLICOpenGL2Module.h" // For export macro
#include "vtkSmartPointer.h" // for vtkSmartPointer
#include "vtkSurfaceLICMapper.h"
#include "vtkColor.h" // used for ivars
#include <map> // use for ivars
#include <stack> // used for ivars
class vtkCompositeDataDisplayAttributes;
class vtkCompositeLICHelper;
class VTKRENDERINGLICOPENGL2_EXPORT vtkCompositeSurfaceLICMapper
: public vtkSurfaceLICMapper
{
public:
static vtkCompositeSurfaceLICMapper* New();
vtkTypeMacro(vtkCompositeSurfaceLICMapper, vtkSurfaceLICMapper);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// This calls RenderPiece (in a for loop if streaming is necessary).
virtual void Render(vtkRenderer *ren, vtkActor *act);
// Description:
// Release any graphics resources that are being consumed by this mapper.
// The parameter window could be used to determine which graphic
// resources to release. In this case, releases the display lists.
virtual void ReleaseGraphicsResources(vtkWindow * win);
// Description:
// Returns if the mapper does not expect to have translucent geometry. This
// may happen when using ScalarMode is set to not map scalars i.e. render the
// scalar array directly as colors and the scalar array has opacity i.e. alpha
// component. Note that even if this method returns true, an actor may treat
// the geometry as translucent since a constant translucency is set on the
// property, for example.
// Overridden to use the actual data and ScalarMode to determine if we have
// opaque geometry.
virtual bool GetIsOpaque();
// Description:
// Set/get the composite data set attributes.
void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes);
vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
// Description:
// Set/get the visibility for a block given its flat index.
void SetBlockVisibility(unsigned int index, bool visible);
bool GetBlockVisibility(unsigned int index) const;
void RemoveBlockVisibility(unsigned int index);
void RemoveBlockVisibilites();
// Description:
// Set/get the color for a block given its flat index.
void SetBlockColor(unsigned int index, double color[3]);
void SetBlockColor(unsigned int index, double r, double g, double b)
{
double color[3] = {r, g, b};
this->SetBlockColor(index, color);
}
double* GetBlockColor(unsigned int index);
void RemoveBlockColor(unsigned int index);
void RemoveBlockColors();
// Description:
// Set/get the opacity for a block given its flat index.
void SetBlockOpacity(unsigned int index, double opacity);
double GetBlockOpacity(unsigned int index);
void RemoveBlockOpacity(unsigned int index);
void RemoveBlockOpacities();
// copy values to the helpers
void CopyMapperValuesToHelper(vtkCompositeLICHelper *helper);
protected:
vtkCompositeSurfaceLICMapper();
~vtkCompositeSurfaceLICMapper();
// Description:
// Take part in garbage collection.
virtual void ReportReferences(vtkGarbageCollector *collector);
// Description:
// We need to override this method because the standard streaming
// demand driven pipeline is not what we want - we are expecting
// hierarchical data as input
vtkExecutive* CreateDefaultExecutive();
// Description:
// Need to define the type of data handled by this mapper.
virtual int FillInputPortInformation(int port, vtkInformation* info);
// Description:
// Need to loop over the hierarchy to compute bounds
virtual void ComputeBounds();
// Description:
// Time stamp for computation of bounds.
vtkTimeStamp BoundsMTime;
// what "index" are we currently rendering, -1 means none
int CurrentFlatIndex;
class RenderBlockState
{
public:
std::stack<bool> Visibility;
std::stack<double> Opacity;
std::stack<vtkColor3d> AmbientColor;
std::stack<vtkColor3d> DiffuseColor;
std::stack<vtkColor3d> SpecularColor;
};
RenderBlockState BlockState;
void RenderBlock(vtkRenderer *renderer,
vtkActor *actor,
vtkDataObject *dobj,
unsigned int &flat_index);
std::map<const vtkDataSet *, vtkCompositeLICHelper *> Helpers;
vtkTimeStamp HelperMTime;
friend class vtkCompositeLICHelper;
// Description:
// Composite data set attributes.
vtkSmartPointer<vtkCompositeDataDisplayAttributes> CompositeAttributes;
private:
unsigned long int LastOpaqueCheckTime;
bool LastOpaqueCheckValue;
double ColorResult[3];
vtkCompositeSurfaceLICMapper(
const vtkCompositeSurfaceLICMapper&); // Not implemented.
void operator=(const vtkCompositeSurfaceLICMapper&); // Not implemented.
};
#endif
|
//
// FPEnvironment_SUN.h
//
// Library: Foundation
// Package: Core
// Module: FPEnvironment
//
// Definitions of class FPEnvironmentImpl for Solaris.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_FPEnvironment_SUN_INCLUDED
#define Foundation_FPEnvironment_SUN_INCLUDED
#include "Poco/Foundation.h"
#include <ieeefp.h>
namespace Poco {
class FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
FP_ROUND_DOWNWARD_IMPL = FP_RM,
FP_ROUND_UPWARD_IMPL = FP_RP,
FP_ROUND_TONEAREST_IMPL = FP_RN,
FP_ROUND_TOWARDZERO_IMPL = FP_RZ
};
enum FlagImpl
{
FP_DIVIDE_BY_ZERO_IMPL = FP_X_DZ,
FP_INEXACT_IMPL = FP_X_IMP,
FP_OVERFLOW_IMPL = FP_X_OFL,
FP_UNDERFLOW_IMPL = FP_X_UFL,
FP_INVALID_IMPL = FP_X_INV
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl& env);
~FPEnvironmentImpl();
FPEnvironmentImpl& operator = (const FPEnvironmentImpl& env);
void keepCurrentImpl();
static void clearFlagsImpl();
static bool isFlagImpl(FlagImpl flag);
static void setRoundingModeImpl(RoundingModeImpl mode);
static RoundingModeImpl getRoundingModeImpl();
static bool isInfiniteImpl(float value);
static bool isInfiniteImpl(double value);
static bool isInfiniteImpl(long double value);
static bool isNaNImpl(float value);
static bool isNaNImpl(double value);
static bool isNaNImpl(long double value);
static float copySignImpl(float target, float source);
static double copySignImpl(double target, double source);
static long double copySignImpl(long double target, long double source);
private:
fp_rnd _rnd;
fp_except _exc;
};
} // namespace Poco
#endif // Foundation_FPEnvironment_SUN_INCLUDED
|
/* GStreamer Intel MSDK plugin
* Copyright (c) 2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GST_MSDKDECPROPUTIL_H
#define GST_MSDKDECPROPUTIL_H
#include "msdk-enums.h"
G_BEGIN_DECLS
#define PROP_OUTPUT_ORDER_DEFAULT GST_MSDKDEC_OUTPUT_ORDER_DISPLAY
enum
{
GST_MSDKDEC_PROP_0,
GST_MSDKDEC_PROP_HARDWARE,
GST_MSDKDEC_PROP_ASYNC_DEPTH,
GST_MSDKDEC_PROP_OUTPUT_ORDER,
};
void
gst_msdkdec_prop_install_output_oder_property(GObjectClass * gobject_class);
gboolean
gst_msdkdec_prop_check_state(GstState state, GParamSpec * pspec);
G_END_DECLS
#endif /* GST_MSDKDECPROPUTIL_H */
|
#ifndef __MORDOR_FACTORY_H__
#define __MORDOR_FACTORY_H__
// Copyright (c) 2010 - Mozy, Inc.
namespace Mordor {
// Wish I could use boost functional/factory, but that's new in boost 1.43,
// which no version of Debian currently has
struct Dummy;
template <class BaseType, class T, class A1 = Dummy, class A2 = Dummy>
class Creator
{
public:
BaseType *create0() { return new T(); }
BaseType *create1(A1 a1) { return new T(a1); }
BaseType *create2(A1 a1, A2 a2) { return new T(a1, a2); }
};
};
#endif
|
/*
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#include <sys/atomic.h>
#include <sys/syscalls.h>
int atomic_add(int *val, int incr)
{
return _kern_atomic_add(val, incr);
}
int atomic_and(int *val, int incr)
{
return _kern_atomic_and(val, incr);
}
int atomic_or(int *val, int incr)
{
return _kern_atomic_or(val, incr);
}
int atomic_set(int *val, int set_to)
{
return _kern_atomic_set(val, set_to);
}
int test_and_set(int *val, int set_to, int test_val)
{
return _kern_test_and_set(val, set_to, test_val);
}
|
#include "../include/string.h"
int strcmp(char * str1, char * str2){
int i;
int length1 = strlen(str1);
int lenght2 = strlen(str2);
if(length1 != lenght2){
return length1 - lenght2;
}
for(i = 0; i < length1; i++){
if(str1[i] != str2[i]){
return str1[i] > str2[i] ? 1 : -1;
}
}
return 0;
}
int strlen(char * str){
int i = 0;
while (str[i]){
i++;
}
return i;
} |
#pragma once
#define ALLORECEIVER_NS au
#if defined (_WIN32)
#if defined(AlloReceiver_EXPORTS)
#define ALLORECEIVER_API __declspec(dllexport)
#else
#define ALLORECEIVER_API __declspec(dllimport)
#endif
#else
#define ALLORECEIVER_API
#endif
#include "CubemapSource.hpp" |
/*-
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
* 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.
*
* $FreeBSD$
*/
/*
* Little program to dump the crypto statistics block and, optionally,
* zero all the stats or just the timing stuff.
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <crypto/cryptodev.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
static void
printt(const char* tag, struct cryptotstat *ts)
{
uint64_t avg, min, max;
if (ts->count == 0)
return;
avg = (1000000000LL*ts->acc.tv_sec + ts->acc.tv_nsec) / ts->count;
min = 1000000000LL*ts->min.tv_sec + ts->min.tv_nsec;
max = 1000000000LL*ts->max.tv_sec + ts->max.tv_nsec;
printf("%16.16s: avg %6llu ns : min %6llu ns : max %7llu ns [%u samps]\n",
tag, avg, min, max, ts->count);
}
int
main(int argc, char *argv[])
{
struct cryptostats stats;
size_t slen;
slen = sizeof (stats);
if (sysctlbyname("kern.crypto_stats", &stats, &slen, NULL, 0) < 0)
err(1, "kern.cryptostats");
if (argc > 1 && strcmp(argv[1], "-z") == 0) {
bzero(&stats.cs_invoke, sizeof (stats.cs_invoke));
bzero(&stats.cs_done, sizeof (stats.cs_done));
bzero(&stats.cs_cb, sizeof (stats.cs_cb));
bzero(&stats.cs_finis, sizeof (stats.cs_finis));
stats.cs_invoke.min.tv_sec = 10000;
stats.cs_done.min.tv_sec = 10000;
stats.cs_cb.min.tv_sec = 10000;
stats.cs_finis.min.tv_sec = 10000;
if (sysctlbyname("kern.crypto_stats", NULL, NULL, &stats, sizeof (stats)) < 0)
err(1, "kern.cryptostats");
exit(0);
}
if (argc > 1 && strcmp(argv[1], "-Z") == 0) {
bzero(&stats, sizeof (stats));
stats.cs_invoke.min.tv_sec = 10000;
stats.cs_done.min.tv_sec = 10000;
stats.cs_cb.min.tv_sec = 10000;
stats.cs_finis.min.tv_sec = 10000;
if (sysctlbyname("kern.crypto_stats", NULL, NULL, &stats, sizeof (stats)) < 0)
err(1, "kern.cryptostats");
exit(0);
}
printf("%u symmetric crypto ops (%u errors, %u times driver blocked)\n"
, stats.cs_ops, stats.cs_errs, stats.cs_blocks);
printf("%u key ops (%u errors, %u times driver blocked)\n"
, stats.cs_kops, stats.cs_kerrs, stats.cs_kblocks);
printf("%u crypto dispatch thread activations\n", stats.cs_intrs);
printf("%u crypto return thread activations\n", stats.cs_rets);
if (stats.cs_invoke.count) {
printf("\n");
printt("dispatch->invoke", &stats.cs_invoke);
printt("invoke->done", &stats.cs_done);
printt("done->cb", &stats.cs_cb);
printt("cb->finis", &stats.cs_finis);
}
return 0;
}
|
/*-
* Copyright (c) 2013-2016 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 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.
*
* $FreeBSD$
*/
#ifndef _DPV_PRIVATE_H_
#define _DPV_PRIVATE_H_
#include <sys/types.h>
/* Debugging */
extern uint8_t debug;
/* Data to process */
extern unsigned int dpv_nfiles;
/* Extra display information */
extern uint8_t keep_tite;
extern uint8_t no_labels;
extern uint8_t wide;
extern char *msg_done, *msg_fail, *msg_pending;
extern char *pprompt, *aprompt;
extern const char status_format[];
/* Defaults */
#define DIALOG_UPDATES_PER_SEC 16
#define XDIALOG_UPDATES_PER_SEC 4
#define DISPLAY_LIMIT_DEFAULT 0 /* Auto-calculate */
#define LABEL_SIZE_DEFAULT 28
#define PBAR_SIZE_DEFAULT 17
#define STATUS_UPDATES_PER_SEC 2
/* states for dprompt_add_files() of dprompt.c */
enum dprompt_state {
DPROMPT_NONE = 0, /* Default */
DPROMPT_PENDING, /* Pending */
DPROMPT_PBAR, /* Progress bar */
DPROMPT_END_STATE, /* Done/Fail */
DPROMPT_DETAILS, /* dpv_file_node->read */
DPROMPT_CUSTOM_MSG, /* dpv_file_node->msg */
DPROMPT_MINIMAL, /* whitespace */
};
#endif /* !_DPV_PRIVATE_H_ */
|
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for license. */
//-----------------------------------NOTICE----------------------------------//
// Some of this file is automatically filled in by a Python script. Only //
// add custom code in the designated areas or it will be overwritten during //
// the next update. //
//-----------------------------------NOTICE----------------------------------//
#ifndef _NIPSFACINGQUADGENERATOR_H_
#define _NIPSFACINGQUADGENERATOR_H_
//--BEGIN FILE HEAD CUSTOM CODE--//
//--END CUSTOM CODE--//
#include "NiObject.h"
namespace Niflib {
class NiPSFacingQuadGenerator;
typedef Ref<NiPSFacingQuadGenerator> NiPSFacingQuadGeneratorRef;
/*! */
class NiPSFacingQuadGenerator : public NiObject {
public:
/*! Constructor */
NIFLIB_API NiPSFacingQuadGenerator();
/*! Destructor */
NIFLIB_API virtual ~NiPSFacingQuadGenerator();
/*!
* A constant value which uniquly identifies objects of this type.
*/
NIFLIB_API static const Type TYPE;
/*!
* A factory function used during file reading to create an instance of this type of object.
* \return A pointer to a newly allocated instance of this type of object.
*/
NIFLIB_API static NiObject * Create();
/*!
* Summarizes the information contained in this object in English.
* \param[in] verbose Determines whether or not detailed information about large areas of data will be printed out.
* \return A string containing a summary of the information within the object in English. This is the function that Niflyze calls to generate its analysis, so the output is the same.
*/
NIFLIB_API virtual string asString( bool verbose = false ) const;
/*!
* Used to determine the type of a particular instance of this object.
* \return The type constant for the actual type of the object.
*/
NIFLIB_API virtual const Type & GetType() const;
//--BEGIN MISC CUSTOM CODE--//
//--END CUSTOM CODE--//
protected:
/*! Unknown. */
byte unknown1;
/*! Unknown. */
byte unknown2;
/*! Unknown. */
byte unknown3;
/*! Unknown. */
byte unknown4;
/*! Unknown. */
byte unknown5;
/*! Unknown. */
byte unknown6;
/*! Unknown. */
byte unknown7;
/*! Unknown. */
byte unknown8;
/*! Unknown. */
byte unknown9;
/*! Unknown. */
byte unknown10;
/*! Unknown. */
byte unknown11;
/*! Unknown. */
byte unknown12;
public:
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual void Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info );
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual void Write( ostream& out, const map<NiObjectRef,unsigned int> & link_map, list<NiObject *> & missing_link_stack, const NifInfo & info ) const;
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, list<NiObjectRef> & missing_link_stack, const NifInfo & info );
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual list<NiObject *> GetPtrs() const;
};
//--BEGIN FILE FOOT CUSTOM CODE--//
//--END CUSTOM CODE--//
} //End Niflib namespace
#endif
|
// SPDX-License-Identifier: GPL-2.0+
/*
* (c) Copyright 2012 by National Instruments,
* Joe Hershberger <joe.hershberger@ni.com>
*/
#include <common.h>
#include <command.h>
#include <env.h>
#include <env_internal.h>
#include <errno.h>
#include <malloc.h>
#include <memalign.h>
#include <search.h>
#include <ubi_uboot.h>
#undef crc32
#define _QUOTE(x) #x
#define QUOTE(x) _QUOTE(x)
#if (CONFIG_ENV_UBI_VID_OFFSET == 0)
#define UBI_VID_OFFSET NULL
#else
#define UBI_VID_OFFSET QUOTE(CONFIG_ENV_UBI_VID_OFFSET)
#endif
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_CMD_SAVEENV
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
static int env_ubi_save(void)
{
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
int ret;
ret = env_export(env_new);
if (ret)
return ret;
if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
return 1;
}
if (gd->env_valid == ENV_VALID) {
puts("Writing to redundant UBI... ");
if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME_REDUND,
(void *)env_new, CONFIG_ENV_SIZE)) {
printf("\n** Unable to write env to %s:%s **\n",
CONFIG_ENV_UBI_PART,
CONFIG_ENV_UBI_VOLUME_REDUND);
return 1;
}
} else {
puts("Writing to UBI... ");
if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME,
(void *)env_new, CONFIG_ENV_SIZE)) {
printf("\n** Unable to write env to %s:%s **\n",
CONFIG_ENV_UBI_PART,
CONFIG_ENV_UBI_VOLUME);
return 1;
}
}
puts("done\n");
gd->env_valid = gd->env_valid == ENV_REDUND ? ENV_VALID : ENV_REDUND;
return 0;
}
#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
static int env_ubi_save(void)
{
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
int ret;
ret = env_export(env_new);
if (ret)
return ret;
if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
return 1;
}
if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME, (void *)env_new,
CONFIG_ENV_SIZE)) {
printf("\n** Unable to write env to %s:%s **\n",
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
return 1;
}
puts("done\n");
return 0;
}
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
#endif /* CONFIG_CMD_SAVEENV */
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
static int env_ubi_load(void)
{
ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
int read1_fail, read2_fail;
env_t *tmp_env1, *tmp_env2;
/*
* In case we have restarted u-boot there is a chance that buffer
* contains old environment (from the previous boot).
* If UBI volume is zero size, ubi_volume_read() doesn't modify the
* buffer.
* We need to clear buffer manually here, so the invalid CRC will
* cause setting default environment as expected.
*/
memset(env1_buf, 0x0, CONFIG_ENV_SIZE);
memset(env2_buf, 0x0, CONFIG_ENV_SIZE);
tmp_env1 = (env_t *)env1_buf;
tmp_env2 = (env_t *)env2_buf;
if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
env_set_default(NULL, 0);
return -EIO;
}
read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
CONFIG_ENV_SIZE);
if (read1_fail)
printf("\n** Unable to read env from %s:%s **\n",
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
read2_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME_REDUND,
(void *)tmp_env2, CONFIG_ENV_SIZE);
if (read2_fail)
printf("\n** Unable to read redundant env from %s:%s **\n",
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME_REDUND);
return env_import_redund((char *)tmp_env1, read1_fail, (char *)tmp_env2,
read2_fail, H_EXTERNAL);
}
#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
static int env_ubi_load(void)
{
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
/*
* In case we have restarted u-boot there is a chance that buffer
* contains old environment (from the previous boot).
* If UBI volume is zero size, ubi_volume_read() doesn't modify the
* buffer.
* We need to clear buffer manually here, so the invalid CRC will
* cause setting default environment as expected.
*/
memset(buf, 0x0, CONFIG_ENV_SIZE);
if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
env_set_default(NULL, 0);
return -EIO;
}
if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) {
printf("\n** Unable to read env from %s:%s **\n",
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
env_set_default(NULL, 0);
return -EIO;
}
return env_import(buf, 1, H_EXTERNAL);
}
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
U_BOOT_ENV_LOCATION(ubi) = {
.location = ENVL_UBI,
ENV_NAME("UBI")
.load = env_ubi_load,
.save = env_save_ptr(env_ubi_save),
};
|
/*
* Copyright 2009 by Artur Duque de Souza <morpheuz@gmail.com>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License 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 Library 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 STRIPWIDGET_H
#define STRIPWIDGET_H
#include <KConfigGroup>
#include <KService>
#include <QGraphicsLinearLayout>
#include <QGraphicsSceneResizeEvent>
#include <QGraphicsWidget>
#include <Plasma/RunnerContext>
#include "itemview.h"
namespace Plasma
{
class IconWidget;
class ToolButton;
}
class QTimer;
class IconActionCollection;
class FavouritesModel;
class StripWidget : public QGraphicsWidget
{
Q_OBJECT
public:
StripWidget(QGraphicsWidget *parent = 0);
~StripWidget();
void save(KConfigGroup &cg);
void restore(KConfigGroup &cg);
void setIconSize(int iconSize);
int iconSize() const;
//TODO: geter and setter?
void setImmutability(Plasma::ImmutabilityType immutability);
void add(const QUrl &url);
protected:
Plasma::IconWidget *createIcon(const QPointF &point);
void focusInEvent(QFocusEvent *event);
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
void dropEvent(QGraphicsSceneDragDropEvent *event);
private Q_SLOTS:
void launchFavourite(const QModelIndex &index);
void arrowsNeededChanged(ItemView::ScrollBarFlags flags);
void goLeft();
void goRight();
void scrollTimeout();
void reorderItem(const QModelIndex &index, const QPointF &point);
void showDeleteTarget();
Q_SIGNALS:
void saveNeeded();
private:
Plasma::ToolButton *m_leftArrow;
Plasma::ToolButton *m_rightArrow;
QGraphicsLinearLayout *m_arrowsLayout;
QHash<Plasma::IconWidget*, KService::Ptr> m_services;
ItemView *m_itemView;
Plasma::RunnerContext *m_context;
QTimer *m_scrollTimer;
Plasma::IconWidget *m_deleteTarget;
IconActionCollection *m_iconActionCollection;
int m_shownIcons;
int m_offset;
bool m_startupCompleted;
FavouritesModel *m_favouritesModel;
};
#endif
|
/* AADL plugin for DIA
*
* Copyright (C) 2005 Laboratoire d'Informatique de Paris 6
* Author: Pierre Duquesne
*
* 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.
*/
#include "aadl.h"
#include "pixmaps/aadlmemory.xpm"
/***********************************************
** AADL MEMORY **
***********************************************/
static void aadlmemory_draw_borders(Aadlbox *aadlbox, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Element *elem;
real x, y, w, h;
BezPoint bez[5];
assert(aadlbox != NULL);
assert(renderer != NULL);
elem = &aadlbox->element;
x = elem->corner.x;
y = elem->corner.y;
w = elem->width;
h = elem->height;
bez[0].type = BEZ_MOVE_TO;
bez[1].type = BEZ_CURVE_TO;
bez[2].type = BEZ_LINE_TO;
bez[3].type = BEZ_CURVE_TO;
bez[4].type = BEZ_LINE_TO;
bez[0].p1.x = x;
bez[0].p1.y = y + h*AADL_MEMORY_FACTOR;
bez[1].p1.x = x;
bez[1].p1.y = y;
bez[1].p2.x = x+w;
bez[1].p2.y = y;
bez[1].p3.x = x + w;
bez[1].p3.y = y + h*AADL_MEMORY_FACTOR;
bez[2].p1.x = x + w;
bez[2].p1.y = y + h - h*AADL_MEMORY_FACTOR;
bez[3].p1.x = x + w;
bez[3].p1.y = y + h;
bez[3].p2.x = x;
bez[3].p2.y = y + h;
bez[3].p3.x = x;
bez[3].p3.y = y + h - h*AADL_MEMORY_FACTOR;
point_copy(&bez[4].p1, &bez[0].p1);
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, AADLBOX_BORDERWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID);
renderer_ops->fill_bezier(renderer, bez, 5, &aadlbox->fill_color);
renderer_ops->draw_bezier(renderer, bez, 5, &aadlbox->line_color);
bez[1].p1.x = x;
bez[1].p1.y = y + 2*h*AADL_MEMORY_FACTOR;
bez[1].p2.x = x+w;
bez[1].p2.y = y+ 2*h*AADL_MEMORY_FACTOR;
bez[1].p3.x = x + w;
bez[1].p3.y = y + h*AADL_MEMORY_FACTOR;
renderer_ops->draw_bezier(renderer, bez, 3, &aadlbox->line_color);
}
static Aadlbox_specific aadlmemory_specific =
{
(AadlProjectionFunc) aadldata_project_point_on_nearest_border,
(AadlTextPosFunc) aadlmemory_text_position,
(AadlSizeFunc) aadlmemory_minsize
};
static void aadlmemory_draw(Aadlbox *aadlbox, DiaRenderer *renderer)
{
aadlmemory_draw_borders(aadlbox, renderer);
aadlbox_draw(aadlbox, renderer);
}
ObjectTypeOps aadlmemory_type_ops;
DiaObjectType aadlmemory_type =
{
"AADL - Memory", /* name */
0, /* version */
(char **) aadlmemory_xpm, /* pixmap */
&aadlmemory_type_ops, /* ops */
NULL,
&aadlmemory_specific /* user data */
};
static ObjectOps aadlmemory_ops =
{
(DestroyFunc) aadlbox_destroy,
(DrawFunc) aadlmemory_draw, /* redefined */
(DistanceFunc) aadlbox_distance_from,
(SelectFunc) aadlbox_select,
(CopyFunc) aadlbox_copy,
(MoveFunc) aadlbox_move,
(MoveHandleFunc) aadlbox_move_handle,
(GetPropertiesFunc) object_create_props_dialog,
(ApplyPropertiesDialogFunc) object_apply_props_from_dialog,
(ObjectMenuFunc) aadlbox_get_object_menu,
(DescribePropsFunc) aadlbox_describe_props,
(GetPropsFunc) aadlbox_get_props,
(SetPropsFunc) aadlbox_set_props,
(TextEditFunc) 0,
(ApplyPropertiesListFunc) object_apply_props,
};
static DiaObject *aadlmemory_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2)
{
DiaObject *obj = aadlbox_create(startpoint, user_data, handle1, handle2);
obj->type = &aadlmemory_type;
obj->ops = &aadlmemory_ops;
return obj;
}
static DiaObject *aadlmemory_load(ObjectNode obj_node, int version, const char *filename)
{
DiaObject *obj;
Point startpoint = {0.0,0.0};
Handle *handle1,*handle2;
obj = aadlmemory_create(&startpoint,&aadlmemory_specific, &handle1,&handle2);
aadlbox_load(obj_node, version, filename, (Aadlbox *) obj);
return obj;
}
ObjectTypeOps aadlmemory_type_ops =
{
(CreateFunc) aadlmemory_create,
(LoadFunc) aadlmemory_load,/*using_properties*/ /* load */
(SaveFunc) aadlbox_save, /* save */
(GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
|
/*****************************************************************************
Copyright(c) 2009 FCI Inc. All Rights Reserved
File name : fci_i2c.h
Description : fci i2c driver header
History :
----------------------------------------------------------------------
2009/09/11 jason initial
*******************************************************************************/
#ifndef __FCI_I2C_H__
#define __FCI_I2C_H__
#include "fci_types.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int fci_i2c_init(HANDLE hDevice, int speed, int slaveaddr);
extern int fci_i2c_read(HANDLE hDevice, u8 chip, u8 addr, u8 alen, u8* data, u8 len);
extern int fci_i2c_write(HANDLE hDevice, u8 chip, u8 addr, u8 alen, u8* data, u8 len);
#ifdef __cplusplus
}
#endif
#endif // __FCI_I2C_H__
|
/* arch/arm/mach-imap/include/mach/memory.h
*
* Copyright (C) 1996,1997,1998 Russell King.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
#define PHYS_OFFSET UL(0x40000000)
/*
*#define __virt_to_bus(x) __virt_to_phys(x)
*#define __bus_to_virt(x) __phys_to_virt(x)
*/
#endif
|
#ifndef __MSM_ROTATOR_H__
#define __MSM_ROTATOR_H__
#include <linux/types.h>
#include <linux/msm_mdp.h>
#define MSM_ROTATOR_IOCTL_MAGIC 'R'
#define MSM_ROTATOR_IOCTL_START \
_IOWR(MSM_ROTATOR_IOCTL_MAGIC, 1, struct msm_rotator_img_info)
#define MSM_ROTATOR_IOCTL_ROTATE \
_IOW(MSM_ROTATOR_IOCTL_MAGIC, 2, struct msm_rotator_data_info)
#define MSM_ROTATOR_IOCTL_FINISH \
_IOW(MSM_ROTATOR_IOCTL_MAGIC, 3, int)
#define ROTATOR_VERSION_01 0xA5B4C301
enum rotator_clk_type {
ROTATOR_CORE_CLK,
ROTATOR_PCLK,
ROTATOR_IMEM_CLK
};
struct msm_rotator_img_info {
unsigned int session_id;
struct msmfb_img src;
struct msmfb_img dst;
struct mdp_rect src_rect;
unsigned int dst_x;
unsigned int dst_y;
unsigned char rotations;
int enable;
unsigned int downscale_ratio;
unsigned int secure;
};
struct msm_rotator_data_info {
int session_id;
struct msmfb_data src;
struct msmfb_data dst;
#ifndef CONFIG_MSM_ROTATOR_LEGACY
unsigned int version_key;
struct msmfb_data src_chroma;
struct msmfb_data dst_chroma;
#endif
};
struct msm_rot_clocks {
const char *clk_name;
enum rotator_clk_type clk_type;
unsigned int clk_rate;
};
struct msm_rotator_platform_data {
unsigned int number_of_clocks;
unsigned int hardware_version_number;
struct msm_rot_clocks *rotator_clks;
const char *regulator_name;
#ifdef CONFIG_MSM_BUS_SCALING
struct msm_bus_scale_pdata *bus_scale_table;
#endif
};
#endif
|
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _WFD_ENC_SUBDEV_
#define _WFD_ENC_SUBDEV_
#include <linux/list.h>
#include <linux/msm_ion.h>
#include <media/v4l2-subdev.h>
#include <media/videobuf2-core.h>
#define VENC_MAGIC_IOCTL 'V'
enum venc_framerate_modes {
VENC_MODE_CFR,
VENC_MODE_VFR,
};
enum venc_event {
VENC_EVENT_HARDWARE_ERROR,
};
struct mem_region {
struct list_head list;
u8 *kvaddr;
u8 *paddr;
u32 size;
u32 offset;
u32 fd;
u32 cookie;
struct ion_handle *ion_handle;
};
/* */
struct mem_region_map {
struct mem_region *mregion;
struct ion_client *ion_client;
uint32_t flags;
void *cookie;
};
struct bufreq {
u32 count;
u32 height;
u32 width;
u32 size;
};
struct venc_buf_info {
u64 timestamp;
struct mem_region *mregion;
};
struct venc_msg_ops {
void *cookie;
void *cbdata;
bool secure;
void (*op_buffer_done)(void *cookie, u32 status,
struct vb2_buffer *buf);
void (*ip_buffer_done)(void *cookie, u32 status,
struct mem_region *mregion);
void (*on_event)(void *cookie, enum venc_event e);
};
static inline bool mem_region_equals(struct mem_region *a,
struct mem_region *b)
{
if (a == b)
return true;
else if (a->fd || b->fd)
return (a->fd == b->fd) &&
(a->offset == b->offset);
else if (a->kvaddr || b->kvaddr)
return a->kvaddr == b->kvaddr;
else if (a->paddr || b->paddr)
return a->paddr == b->paddr;
else
return false;
}
#define OPEN _IOR('V', 1, void *)
#define CLOSE _IO('V', 2)
#define ENCODE_START _IO('V', 3)
#define ENCODE_FRAME _IOW('V', 4, struct venc_buf_info *)
#define PAUSE _IO('V', 5)
#define RESUME _IO('V', 6)
#define FLUSH _IO('V', 7)
#define ENCODE_STOP _IO('V', 8)
#define SET_PROP _IO('V', 9)
#define GET_PROP _IO('V', 10)
#define SET_BUFFER_REQ _IOWR('V', 11, struct v4l2_requestbuffers *)
#define GET_BUFFER_REQ _IOWR('V', 12, struct v4l2_requestbuffers *)
#define ALLOCATE_BUFFER _IO('V', 13)
#define FREE_BUFFER _IO('V', 14)
#define FILL_OUTPUT_BUFFER _IO('V', 15)
#define SET_FORMAT _IOW('V', 16, struct v4l2_format *)
#define SET_FRAMERATE _IOW('V', 17, struct v4l2_fract *)
#define SET_INPUT_BUFFER _IOWR('V', 18, struct mem_region *)
#define SET_OUTPUT_BUFFER _IOWR('V', 19, struct mem_region *)
#define ALLOC_RECON_BUFFERS _IO('V', 20)
#define FREE_OUTPUT_BUFFER _IOWR('V', 21, struct mem_region *)
#define FREE_INPUT_BUFFER _IOWR('V', 22, struct mem_region *)
#define FREE_RECON_BUFFERS _IO('V', 23)
#define ENCODE_FLUSH _IO('V', 24)
#define ENC_MMAP _IOWR('V', 25, struct mem_region_map *)
#define ENC_MUNMAP _IOWR('V', 26, struct mem_region_map *)
#define SET_FRAMERATE_MODE _IO('V', 27)
#define ENC_SECURE _IO('V', 28)
extern int venc_init(struct v4l2_subdev *sd, u32 val);
extern int venc_load_fw(struct v4l2_subdev *sd);
extern long venc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
#endif /* */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.