text stringlengths 4 6.14k |
|---|
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* GnuTLS 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.
*
* GnuTLS 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 GnuTLS; 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#include "utils.h"
#define SELF_TEST_SIG(x) \
ret = gnutls_oid_to_sign(gnutls_sign_get_oid(x)); \
if (ret != x) { \
fail("error testing %s\n", gnutls_sign_get_name(x)); \
}
#define SELF_TEST_PK(x) \
ret = gnutls_oid_to_pk(gnutls_pk_get_oid(x)); \
if (ret != x) { \
fail("error testing %s\n", gnutls_pk_get_name(x)); \
}
#define SELF_TEST_DIG(x) \
ret = gnutls_oid_to_digest(gnutls_digest_get_oid(x)); \
if (ret != x) { \
fail("error testing %s\n", gnutls_digest_get_name(x)); \
}
void doit(void)
{
int ret;
SELF_TEST_SIG(GNUTLS_SIGN_RSA_SHA1);
SELF_TEST_SIG(GNUTLS_SIGN_RSA_SHA256);
SELF_TEST_SIG(GNUTLS_SIGN_ECDSA_SHA1);
SELF_TEST_SIG(GNUTLS_SIGN_ECDSA_SHA256);
SELF_TEST_SIG(GNUTLS_SIGN_ECDSA_SHA512);
SELF_TEST_PK(GNUTLS_PK_RSA);
SELF_TEST_PK(GNUTLS_PK_DSA);
SELF_TEST_PK(GNUTLS_PK_EC);
SELF_TEST_DIG(GNUTLS_DIG_MD5);
SELF_TEST_DIG(GNUTLS_DIG_SHA1);
SELF_TEST_DIG(GNUTLS_DIG_SHA256);
SELF_TEST_DIG(GNUTLS_DIG_SHA512);
}
|
#ifndef WEIGHTEDEVENTTEST_H_
#define WEIGHTEDEVENTTEST_H_ 1
#include <cxxtest/TestSuite.h>
#include "MantidDataObjects/Events.h"
#include "MantidKernel/Timer.h"
#include <cmath>
using namespace Mantid;
using namespace Mantid::Kernel;
using namespace Mantid::DataObjects;
using std::runtime_error;
using std::size_t;
using std::vector;
//==========================================================================================
class WeightedEventTest : public CxxTest::TestSuite {
public:
void testConstructors() {
TofEvent e(123, 456);
WeightedEvent we, we2;
// Empty
we = WeightedEvent();
TS_ASSERT_EQUALS(we.tof(), 0);
TS_ASSERT_EQUALS(we.pulseTime(), 0);
TS_ASSERT_EQUALS(we.weight(), 1.0);
TS_ASSERT_EQUALS(we.error(), 1.0);
// Default one weight
we = WeightedEvent(e);
TS_ASSERT_EQUALS(we.tof(), 123);
TS_ASSERT_EQUALS(we.pulseTime(), 456);
TS_ASSERT_EQUALS(we.weight(), 1.0);
TS_ASSERT_EQUALS(we.error(), 1.0);
// TofEvent + weights
we = WeightedEvent(e, 3.5, 0.5 * 0.5);
TS_ASSERT_EQUALS(we.tof(), 123);
TS_ASSERT_EQUALS(we.pulseTime(), 456);
TS_ASSERT_EQUALS(we.weight(), 3.5);
TS_ASSERT_EQUALS(we.error(), 0.5);
// Full constructor
we = WeightedEvent(456, 789, 2.5, 1.5 * 1.5);
TS_ASSERT_EQUALS(we.tof(), 456);
TS_ASSERT_EQUALS(we.pulseTime(), 789);
TS_ASSERT_EQUALS(we.weight(), 2.5);
TS_ASSERT_EQUALS(we.error(), 1.5);
}
void testAssignAndCopy() {
WeightedEvent we, we2;
// Copy constructor
we = WeightedEvent();
we2 = WeightedEvent(456, 789, 2.5, 1.5 * 1.5);
we = we2;
TS_ASSERT_EQUALS(we.tof(), 456);
TS_ASSERT_EQUALS(we.pulseTime(), 789);
TS_ASSERT_EQUALS(we.weight(), 2.5);
TS_ASSERT_EQUALS(we.error(), 1.5);
}
};
#endif /// EVENTLISTTEST_H_
|
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "TSYapDatabaseObject.h"
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class TSInteraction;
@class TSInvalidIdentityKeyReceivingErrorMessage;
/**
* TSThread is the superclass of TSContactThread and TSGroupThread
*/
@interface TSThread : TSYapDatabaseObject
/**
* Whether the object is a group thread or not.
*
* @return YES if is a group thread, NO otherwise.
*/
- (BOOL)isGroupThread;
/**
* Returns the name of the thread.
*
* @return The name of the thread.
*/
- (NSString *)name;
/**
* @returns
* Signal Id (e164) of the contact if it's a contact thread.
*/
- (nullable NSString *)contactIdentifier;
/**
* @returns recipientId for each recipient in the thread
*/
@property (nonatomic, readonly) NSArray<NSString *> *recipientIdentifiers;
#if TARGET_OS_IOS
/**
* Returns the image representing the thread. Nil if not available.
*
* @return UIImage of the thread, or nil.
*/
- (nullable UIImage *)image;
#endif
#pragma mark Interactions
/**
* @return The number of interactions in this thread.
*/
- (NSUInteger)numberOfInteractions;
/**
* Get all messages in the thread we weren't able to decrypt
*/
- (NSArray<TSInvalidIdentityKeyReceivingErrorMessage *> *)receivedMessagesForInvalidKey:(NSData *)key;
/**
* Returns whether or not the thread has unread messages.
*
* @return YES if it has unread TSIncomingMessages, NO otherwise.
*/
- (BOOL)hasUnreadMessages;
- (BOOL)hasSafetyNumbers;
- (void)markAllAsReadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
/**
* Returns the latest date of a message in the thread or the thread creation date if there are no messages in that
*thread.
*
* @return The date of the last message or thread creation date.
*/
- (NSDate *)lastMessageDate;
/**
* Returns the string that will be displayed typically in a conversations view as a preview of the last message
*received in this thread.
*
* @return Thread preview string.
*/
- (NSString *)lastMessageLabel;
/**
* Updates the thread's caches of the latest interaction.
*
* @param lastMessage Latest Interaction to take into consideration.
* @param transaction Database transaction.
*/
- (void)updateWithLastMessage:(TSInteraction *)lastMessage transaction:(YapDatabaseReadWriteTransaction *)transaction;
#pragma mark Archival
/**
* Returns the last date at which a string was archived or nil if the thread was never archived or brought back to the
*inbox.
*
* @return Last archival date.
*/
- (nullable NSDate *)archivalDate;
/**
* Archives a thread with the current date.
*
* @param transaction Database transaction.
*/
- (void)archiveThreadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
/**
* Archives a thread with the reference date. This is currently only used for migrating older data that has already
* been archived.
*
* @param transaction Database transaction.
* @param date Date at which the thread was archived.
*/
- (void)archiveThreadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction referenceDate:(NSDate *)date;
/**
* Unarchives a thread that was archived previously.
*
* @param transaction Database transaction.
*/
- (void)unarchiveThreadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
#pragma mark Drafts
/**
* Returns the last known draft for that thread. Always returns a string. Empty string if nil.
*
* @param transaction Database transaction.
*
* @return Last known draft for that thread.
*/
- (NSString *)currentDraftWithTransaction:(YapDatabaseReadTransaction *)transaction;
/**
* Sets the draft of a thread. Typically called when leaving a conversation view.
*
* @param draftString Draft string to be saved.
* @param transaction Database transaction.
*/
- (void)setDraft:(NSString *)draftString transaction:(YapDatabaseReadWriteTransaction *)transaction;
@property (atomic, readonly) BOOL isMuted;
@property (atomic, readonly, nullable) NSDate *mutedUntilDate;
// This model may be updated from many threads. We don't want to save
// our local copy (this instance) since it may be out of date. Instead, we
// use these "updateWith..." methods to:
//
// a) Update a property of this instance.
// b) Load an up-to-date instance of this model from from the data store.
// c) Update and save that fresh instance.
// d) If this instance hasn't yet been saved, save this local instance.
//
// After "updateWith...":
//
// a) An updated copy of this instance will always have been saved in the
// data store.
// b) The local property on this instance will always have been updated.
// c) Other properties on this instance may be out of date.
//
// All mutable properties of this class have been made read-only to
// prevent accidentally modifying them directly.
//
// This isn't a perfect arrangement, but in practice this will prevent
// data loss and will resolve all known issues.
- (void)updateWithMutedUntilDate:(NSDate *)mutedUntilDate;
@end
NS_ASSUME_NONNULL_END
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwpd
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004 Fridrich Strba (fridrich.strba@bluewin.ch)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwpd.sourceforge.net
*/
/* "This product is not manufactured, approved, or supported by
* Corel Corporation or Corel Corporation Limited."
*/
#ifndef WP6HIGHLIGHTGROUP_H
#define WP6HIGHLIGHTGROUP_H
#include "WP6FixedLengthGroup.h"
class WP6HighlightGroup : public WP6FixedLengthGroup
{
public:
WP6HighlightGroup(WPXInputStream *input, WPXEncryption *encryption, uint8_t groupID);
virtual void parse(WP6Listener *listener) = 0;
const RGBSColor getColor() const
{
return m_color;
}
protected:
virtual void _readContents(WPXInputStream *input, WPXEncryption *encryption);
private:
RGBSColor m_color;
};
class WP6HighlightOnGroup : public WP6HighlightGroup
{
public:
WP6HighlightOnGroup(WPXInputStream *input, WPXEncryption *encryption, uint8_t groupID);
void parse(WP6Listener *listener);
};
class WP6HighlightOffGroup : public WP6HighlightGroup
{
public:
WP6HighlightOffGroup(WPXInputStream *input, WPXEncryption *encryption, uint8_t groupID);
void parse(WP6Listener *listener);
};
#endif /* WP6HIGHLIGHTGROUP_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
|
#ifndef NTL_vec_ZZVec__H
#define NTL_vec_ZZVec__H
#include <NTL/vector.h>
#include <NTL/ZZVec.h>
NTL_OPEN_NNS
typedef Vec<ZZVec> vec_ZZVec;
NTL_CLOSE_NNS
#endif
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*
tr.h
*/
#ifndef TR_H
#define TR_H
#include <qstring.h>
QT_BEGIN_NAMESPACE
inline QString tr( const char *sourceText, const char * /* comment */ = 0 )
{
return QString( QLatin1String(sourceText) );
}
QT_END_NAMESPACE
#endif
|
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_PROCESS_CALLSTACK_H
#define ANDROID_PROCESS_CALLSTACK_H
#include <utils/CallStack.h>
#include <android/log.h>
#include <utils/KeyedVector.h>
#include <utils/String8.h>
#include <time.h>
#include <sys/types.h>
namespace android {
class Printer;
// Collect/print the call stack (function, file, line) traces for all threads in a process.
class ProcessCallStack {
public:
// Create an empty call stack. No-op.
ProcessCallStack();
// Copy the existing process callstack (no other side effects).
ProcessCallStack(const ProcessCallStack& rhs);
~ProcessCallStack();
// Immediately collect the stack traces for all threads.
void update(int32_t maxDepth = CallStack::MAX_DEPTH);
// Print all stack traces to the log using the supplied logtag.
void log(const char* logtag, android_LogPriority priority = ANDROID_LOG_DEBUG,
const char* prefix = 0) const;
// Dump all stack traces to the specified file descriptor.
void dump(int fd, int indent = 0, const char* prefix = 0) const;
// Return a string (possibly very long) containing all the stack traces.
String8 toString(const char* prefix = 0) const;
// Dump a serialized representation of all the stack traces to the specified printer.
void print(Printer& printer) const;
// Get the number of threads whose stack traces were collected.
size_t size() const;
private:
void printInternal(Printer& printer, Printer& csPrinter) const;
// Reset the process's stack frames and metadata.
void clear();
struct ThreadInfo {
CallStack callStack;
String8 threadName;
};
// tid -> ThreadInfo
KeyedVector<pid_t, ThreadInfo> mThreadMap;
// Time that update() was last called
struct tm mTimeUpdated;
};
}; // namespace android
#endif // ANDROID_PROCESS_CALLSTACK_H
|
/*
* Copyright (C) 2010 Stefan Kost <ensonic@users.sf.net>
*
* 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; version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#undef G_DISABLE_ASSERT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <grilo.h>
#define CHECK_MESSAGE(domain, error_message) \
(g_strcmp0 (log_domain, domain) == 0 && strstr (message, error_message))
#if GLIB_CHECK_VERSION(2,22,0)
static gboolean
registry_load_error_handler (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data)
{
if (CHECK_MESSAGE ("Grilo", "Failed to initialize plugin") ||
CHECK_MESSAGE ("Grilo", "Configuration not provided") ||
CHECK_MESSAGE ("Grilo", "Missing configuration") ||
CHECK_MESSAGE ("Grilo", "Could not open plugin directory") ||
CHECK_MESSAGE ("Grilo", "Could not read XML file")) {
return FALSE;
}
return TRUE;
}
#endif
typedef struct {
GrlRegistry *registry;
GMainLoop *loop;
} RegistryFixture;
static void
registry_fixture_setup (RegistryFixture *fixture, gconstpointer data)
{
#if GLIB_CHECK_VERSION(2,22,0)
g_test_log_set_fatal_handler (registry_load_error_handler, NULL);
#endif
fixture->registry = grl_registry_get_default ();
fixture->loop = g_main_loop_new (NULL, TRUE);
}
static void
registry_fixture_teardown (RegistryFixture *fixture, gconstpointer data)
{
g_main_loop_unref(fixture->loop);
}
static void
registry_init (void)
{
GrlRegistry *registry;
registry = grl_registry_get_default ();
g_assert (registry);
}
static void
registry_load (RegistryFixture *fixture, gconstpointer data)
{
gboolean res;
res = grl_registry_load_all_plugins (fixture->registry, NULL);
g_assert_cmpint (res, ==, TRUE);
}
static void
registry_unregister (RegistryFixture *fixture, gconstpointer data)
{
GList *sources = NULL;
GList *sources_iter;
int i;
g_test_bug ("627207");
sources = grl_registry_get_sources (fixture->registry, FALSE);
for (sources_iter = sources, i = 0; sources_iter;
sources_iter = g_list_next (sources_iter), i++) {
GrlMediaPlugin *source = GRL_MEDIA_PLUGIN (sources_iter->data);
grl_registry_unregister_source (fixture->registry, source, NULL);
}
g_list_free (sources);
/* We expect to have loaded sources */
g_assert_cmpint (i, !=, 0);
sources = grl_registry_get_sources (fixture->registry, FALSE);
for (sources_iter = sources, i = 0; sources_iter;
sources_iter = g_list_next (sources_iter), i++)
;
g_list_free (sources);
/* After unregistering the sources, we don't expect any */
g_assert_cmpint (i, ==, 0);
}
int
main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugs.gnome.org/%s");
grl_init (&argc, &argv);
/* registry tests */
g_test_add_func ("/registry/init", registry_init);
g_test_add ("/registry/load",
RegistryFixture, NULL,
registry_fixture_setup,
registry_load,
registry_fixture_teardown);
g_test_add ("/registry/unregister",
RegistryFixture, NULL,
registry_fixture_setup,
registry_unregister,
registry_fixture_teardown);
return g_test_run ();
}
|
/***************************************************************************
begin : Thu Jun 24 2010
copyright : (C) 2010 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* Please see toplevel file COPYING for license details *
***************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "globals.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/ct.h>
#include <gwenhywfar/ctplugin.h>
#include <gwenhywfar/text.h>
int activateKey(GWEN_DB_NODE *dbArgs, int argc, char **argv)
{
GWEN_DB_NODE *db;
const char *ttype;
const char *tname;
GWEN_CRYPT_TOKEN *ct;
unsigned int keyId;
int rv;
const char *s;
const GWEN_ARGS args[]= {
{
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
GWEN_ArgsType_Int, /* type */
"keyId", /* name */
1, /* minnum */
1, /* maxnum */
"k", /* short option */
"key", /* long option */
"Key id", /* short description */
"Key id" /* long description */
},
{
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
GWEN_ArgsType_Char, /* type */
"tokenType", /* name */
1, /* minnum */
1, /* maxnum */
"t", /* short option */
"ttype", /* long option */
"Specify the crypt token type", /* short description */
"Specify the crypt token type" /* long description */
},
{
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
GWEN_ArgsType_Char, /* type */
"tokenName", /* name */
0, /* minnum */
1, /* maxnum */
"n", /* short option */
"tname", /* long option */
"Specify the crypt token name", /* short description */
"Specify the crypt token name" /* long description */
},
{
GWEN_ARGS_FLAGS_HELP | GWEN_ARGS_FLAGS_LAST, /* flags */
GWEN_ArgsType_Int, /* type */
"help", /* name */
0, /* minnum */
0, /* maxnum */
"h", /* short option */
"help", /* long option */
"Show this help screen", /* short description */
"Show this help screen" /* long description */
}
};
db=GWEN_DB_GetGroup(dbArgs, GWEN_DB_FLAGS_DEFAULT, "local");
rv=GWEN_Args_Check(argc, argv, 1,
GWEN_ARGS_MODE_ALLOW_FREEPARAM,
args,
db);
if (rv==GWEN_ARGS_RESULT_ERROR) {
fprintf(stderr, "ERROR: Could not parse arguments\n");
return 1;
}
else if (rv==GWEN_ARGS_RESULT_HELP) {
GWEN_BUFFER *ubuf;
ubuf=GWEN_Buffer_new(0, 1024, 0, 1);
if (GWEN_Args_Usage(args, ubuf, GWEN_ArgsOutType_Txt)) {
fprintf(stderr, "ERROR: Could not create help string\n");
return 1;
}
fprintf(stderr, "%s\n", GWEN_Buffer_GetStart(ubuf));
GWEN_Buffer_free(ubuf);
return 0;
}
keyId=GWEN_DB_GetIntValue(db, "keyId", 0, 0);
if (keyId==0) {
DBG_ERROR(0, "Key Id must not be zero");
return 1;
}
s=GWEN_DB_GetCharValue(db, "algo", 0, "rsa");
if (!s) {
DBG_ERROR(0, "Algo id missing");
return 1;
}
ttype=GWEN_DB_GetCharValue(db, "tokenType", 0, 0);
assert(ttype);
tname=GWEN_DB_GetCharValue(db, "tokenName", 0, 0);
/* get crypt token */
ct=getCryptToken(ttype, tname);
if (ct==0)
return 3;
if (GWEN_DB_GetIntValue(dbArgs, "forcePin", 0, 0))
GWEN_Crypt_Token_AddModes(ct, GWEN_CRYPT_TOKEN_MODE_FORCE_PIN_ENTRY);
/* open crypt token for use */
rv=GWEN_Crypt_Token_Open(ct, 1, 0);
if (rv) {
DBG_ERROR(0, "Could not open token");
return 3;
}
else {
/* activate key */
rv=GWEN_Crypt_Token_ActivateKey(ct, keyId, 0);
if (rv) {
DBG_ERROR(GWEN_LOGDOMAIN,
"Error activating key (%d)", rv);
return 3;
}
}
/* close crypt token */
rv=GWEN_Crypt_Token_Close(ct, 0, 0);
if (rv) {
DBG_ERROR(0, "Could not close token");
return 3;
}
fprintf(stderr, "Key %d successfully activated.\n", keyId);
return 0;
}
|
#define _GNU_SOURCE
#include <math.h>
void sincos(double t, double *y, double *x)
{
*y = sin(t);
*x = cos(t);
}
|
/***************************************************************************/
/* */
/* ftxf86.h */
/* */
/* Support functions for X11. */
/* */
/* Copyright 2002, 2003, 2004, 2006, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FTXF86_H__
#define __FTXF86_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* font_formats */
/* */
/* <Title> */
/* Font Formats */
/* */
/* <Abstract> */
/* Getting the font format. */
/* */
/* <Description> */
/* The single function in this section can be used to get the font */
/* format. Note that this information is not needed normally; */
/* however, there are special cases (like in PDF devices) where it is */
/* important to differentiate, in spite of FreeType's uniform API. */
/* */
/* This function is in the X11/xf86 namespace for historical reasons */
/* and in no way depends on that windowing system. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_X11_Font_Format */
/* */
/* <Description> */
/* Return a string describing the format of a given face, using values */
/* which can be used as an X11 FONT_PROPERTY. Possible values are */
/* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */
/* `PFR', and `Windows~FNT'. */
/* */
/* <Input> */
/* face :: */
/* Input face handle. */
/* */
/* <Return> */
/* Font format string. NULL in case of error. */
/* */
FT_EXPORT(const char*)
FT_Get_X11_Font_Format(FT_Face face);
/* */
FT_END_HEADER
#endif /* __FTXF86_H__ */ |
/*
kopeteaddrbookexport.h - Kopete Online Status
Logic for exporting data acquired from messaging systems to the
KDE address book
Copyright (c) 2004 by Will Stephenson <wstephenson@kde.org>
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.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. *
* *
*************************************************************************
*/
#ifndef KOPETEADDRBOOKEXPORT_H
#define KOPETEADDRBOOKEXPORT_H
#include <kabc/stdaddressbook.h>
#include <kabc/addressee.h>
#include "kopeteproperty.h"
#include "ui_kopeteaddrbookexportui.h"
#include <QPixmap>
class KDialog;
class K3ListBox;
namespace Kopete
{
class Contact;
class MetaContact;
}
class KopeteAddressBookExport : public QObject, private Ui::AddressBookExportUI
{
Q_OBJECT
public:
KopeteAddressBookExport( QWidget *parent, Kopete::MetaContact *mc );
~KopeteAddressBookExport();
/**
* Display the dialog
* @return a QDialog return code
*/
int showDialog();
/**
* Export the data to KABC if changed, omitting any duplicates
*/
void exportData();
protected:
/**
* Initialise the GUI labels with labels from KABC
*/
void initLabels();
/**
* Populate the GUI with data from KABC
*/
void fetchKABCData();
/**
* Populate a listbox with a given type of phone number
*/
void fetchPhoneNumbers( K3ListBox * listBox, KABC::PhoneNumber::Type type, uint& counter );
/**
* Populate the GUI with data from IM systems
*/
void fetchIMData();
/**
* Populate a combobox with a contact's IM data
*/
void populateIM( const Kopete::Contact *contact, const QPixmap &icon,
QComboBox *combo, const Kopete::PropertyTmpl &property );
/**
* Populate a listbox with a contact's IM data
*/
void populateIM( const Kopete::Contact *contact, const QPixmap &icon,
K3ListBox *combo, const Kopete::PropertyTmpl &property );
/** Check the selected item is not the first (existing KABC) item, or the same as it */
bool newValue( QComboBox *combo );
QStringList newValues( K3ListBox *listBox, uint counter );
// the GUI
QWidget *mParent;
KDialog * mDialog;
QPixmap mAddrBookIcon;
AddressBookExportUI *mUI;
Kopete::MetaContact *mMetaContact;
KABC::AddressBook *mAddressBook;
KABC::Addressee mAddressee;
// counters tracking the number of KABC values where multiple values are possible in a single key
uint numEmails, numHomePhones, numWorkPhones, numMobilePhones;
};
#endif
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWHATSTHIS_H
#define QWHATSTHIS_H
#include <QtCore/qobject.h>
#include <QtGui/qcursor.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_WHATSTHIS
class QAction;
#ifdef QT3_SUPPORT
class QToolButton;
#endif
class Q_GUI_EXPORT QWhatsThis
{
QWhatsThis();
public:
static void enterWhatsThisMode();
static bool inWhatsThisMode();
static void leaveWhatsThisMode();
static void showText(const QPoint &pos, const QString &text, QWidget *w = 0);
static void hideText();
static QAction *createAction(QObject *parent = 0);
#ifdef QT3_SUPPORT
static QT3_SUPPORT void add(QWidget *w, const QString &s);
static QT3_SUPPORT void remove(QWidget *);
static QT3_SUPPORT QToolButton *whatsThisButton(QWidget *parent);
#endif
};
#endif // QT_NO_WHATSTHIS
QT_END_NAMESPACE
QT_END_HEADER
#endif // QWHATSTHIS_H
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// 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 LIBMESH_QUADRATURE_CLOUGH_H
#define LIBMESH_QUADRATURE_CLOUGH_H
// Local includes
#include "libmesh/quadrature.h"
namespace libMesh
{
/**
* This class creates a Gaussian quadrature rule duplicated for each
* subelement of a Clough-Tocher divided macroelement.
*
* \author Roy Stogner
* \date 2005
* \brief Implements quadrature rules for Clough-Tocher macroelements.
*/
class QClough libmesh_final : public QBase
{
public:
/**
* Constructor. Declares the order of the quadrature rule.
*/
QClough (const unsigned int _dim,
const Order _order=INVALID_ORDER) :
QBase(_dim, _order)
{}
/**
* Destructor.
*/
~QClough() {}
/**
* \returns \p QCLOUGH.
*/
virtual QuadratureType type() const libmesh_override { return QCLOUGH; }
private:
void init_1D (const ElemType _type=INVALID_ELEM,
unsigned int p_level=0) libmesh_override;
void init_2D (const ElemType _type=INVALID_ELEM,
unsigned int p_level=0) libmesh_override;
void init_3D (const ElemType _type=INVALID_ELEM,
unsigned int p_level=0) libmesh_override;
};
} // namespace libMesh
#endif // LIBMESH_QUADRATURE_CLOUGH_H
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSIMULATORGALLERYRESULTSET_H
#define QSIMULATORGALLERYRESULTSET_H
#include <qmobilityglobal.h>
#include "docgalleryconnection_simulator.h"
#include "qgalleryresultset.h"
#include "qgalleryqueryrequest.h"
#include "qgalleryitemrequest.h"
#include <QtCore/QObject>
#include <QtCore/QFileInfo>
#include <QtGui/QImage>
QTM_BEGIN_NAMESPACE
class QSimulatorGalleryResultSet : public QGalleryResultSet
{
Q_OBJECT
public:
explicit QSimulatorGalleryResultSet(QObject *parent = 0);
~QSimulatorGalleryResultSet();
int propertyKey(const QString &property) const;
QGalleryProperty::Attributes propertyAttributes(int key) const ;
QVariant::Type propertyType(int key) const;
int itemCount() const;
bool isValid() const;
QVariant itemId() const;
QUrl itemUrl() const;
QString itemType() const;
QVariant metaData(int key) const;
bool setMetaData(int key, const QVariant &value);
int currentIndex() const;
bool fetch(int index);
signals:
public slots:
private:
QFileInfo currentFileInfo() const;
Simulator::DocGalleryConnection* connection;
QGalleryQueryRequest* queryRequest;
QGalleryItemRequest* itemRequest;
QString filePath;
QString itemTypeString;
QImage image;
bool valid;
int mCurrentIndex;
};
QTM_END_NAMESPACE
#endif // QSIMULATORGALLERYRESULTSET_H
|
/////////////////////////////////////////////////////////////////////////
// $Id: bswap.h 11891 2013-10-16 19:33:30Z vruppert $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2012-2013 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/////////////////////////////////////////////////////////////////////////
#ifndef BX_BSWAP_H
#define BX_BSWAP_H
BX_CPP_INLINE Bit16u bx_bswap16(Bit16u val16)
{
return (val16<<8) | (val16>>8);
}
#if BX_HAVE___BUILTIN_BSWAP32
#define bx_bswap32 __builtin_bswap32
#else
BX_CPP_INLINE Bit32u bx_bswap32(Bit32u val32)
{
val32 = ((val32<<8) & 0xFF00FF00) | ((val32>>8) & 0x00FF00FF);
return (val32<<16) | (val32>>16);
}
#endif
#if BX_HAVE___BUILTIN_BSWAP64
#define bx_bswap64 __builtin_bswap64
#else
BX_CPP_INLINE Bit64u bx_bswap64(Bit64u val64)
{
Bit32u lo = bx_bswap32((Bit32u)(val64 >> 32));
Bit32u hi = bx_bswap32((Bit32u)(val64 & 0xFFFFFFFF));
return ((Bit64u)hi << 32) | (Bit64u)lo;
}
#endif
#endif
|
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef JSStorageEvent_h
#define JSStorageEvent_h
#if ENABLE(DOM_STORAGE)
#include "JSEvent.h"
namespace WebCore {
class StorageEvent;
class JSStorageEvent : public JSEvent {
typedef JSEvent Base;
public:
JSStorageEvent(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<StorageEvent>);
static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
static const JSC::ClassInfo s_info;
static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
{
return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
}
static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);
protected:
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
class JSStorageEventPrototype : public JSC::JSObject {
typedef JSC::JSObject Base;
public:
static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
static const JSC::ClassInfo s_info;
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
{
return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
}
JSStorageEventPrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }
protected:
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
// Functions
JSC::JSValue JSC_HOST_CALL jsStorageEventPrototypeFunctionInitStorageEvent(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
// Attributes
JSC::JSValue jsStorageEventKey(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsStorageEventOldValue(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsStorageEventNewValue(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsStorageEventUri(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsStorageEventStorageArea(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsStorageEventConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
} // namespace WebCore
#endif // ENABLE(DOM_STORAGE)
#endif
|
// $Id: TGWin32InterpreterProxy.h,v 1.15 2007/03/08 15:52:17 rdm Exp $
// Author: Valeriy Onuchin 15/11/03
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGWin32InterpreterProxy
#define ROOT_TGWin32InterpreterProxy
//////////////////////////////////////////////////////////////////////////
// //
// TGWin32InterpreterProxy //
// //
// This class defines thread-safe interface to a command line //
// interpreter. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TInterpreter
#include "TInterpreter.h"
#endif
#ifndef ROOT_TGWin32ProxyBase
#include "TGWin32ProxyBase.h"
#endif
class TGWin32InterpreterProxy : public TInterpreter , public TGWin32ProxyBase {
protected:
void Execute(TMethod *method, TObjArray *params, int *error = 0) {}
public:
TGWin32InterpreterProxy() { fMaxResponseTime = 1000000; fIsVirtualX = kFALSE; }
TGWin32InterpreterProxy(const char *name, const char *title = "Generic Interpreter") {}
virtual ~TGWin32InterpreterProxy() {}
void AddIncludePath(const char *path);
Int_t AutoLoad(const char *classname);
void ClearFileBusy();
void ClearStack();
Bool_t Declare(const char* code);
void EnableAutoLoading();
void EndOfLineAction();
void Initialize();
void InspectMembers(TMemberInspector&, void* obj, const TClass* cl);
Int_t Load(const char *filenam, Bool_t system = kFALSE);
void LoadMacro(const char *filename, EErrorCode *error = 0);
Int_t LoadLibraryMap(const char *rootmapfile = 0);
Int_t RescanLibraryMap();
Int_t ReloadAllSharedLibraryMaps();
Int_t UnloadAllSharedLibraryMaps();
Int_t UnloadLibraryMap(const char *library);
Long_t ProcessLine(const char *line, EErrorCode *error = 0);
Long_t ProcessLineSynch(const char *line, EErrorCode *error = 0);
void PrintIntro();
Int_t SetClassSharedLibs(const char *cls, const char *libs);
void SetGetline(const char*(*getlineFunc)(const char* prompt),
void (*histaddFunc)(const char* line));
void Reset();
void ResetAll();
void ResetGlobals();
void ResetGlobalVar(void *obj);
void RewindDictionary();
Int_t DeleteGlobal(void *obj);
Int_t DeleteVariable(const char *name);
void SaveContext();
void SaveGlobalsContext();
void UpdateListOfGlobals();
void UpdateListOfGlobalFunctions();
void UpdateListOfTypes();
void SetClassInfo(TClass *cl, Bool_t reload = kFALSE);
Bool_t CheckClassInfo(const char *name, Bool_t autoload, Bool_t isClassOrNamespaceOnly = kFALSE);
Bool_t CheckClassTemplate(const char *name);
Long_t Calc(const char *line, EErrorCode* error = 0);
void CreateListOfBaseClasses(TClass *cl);
void CreateListOfDataMembers(TClass *cl);
void CreateListOfMethods(TClass *cl);
void UpdateListOfMethods(TClass *cl);
void CreateListOfMethodArgs(TFunction *m);
TString GetMangledName(TClass *cl, const char *method, const char *params);
TString GetMangledNameWithPrototype(TClass *cl, const char *method, const char *proto);
Long_t ExecuteMacro(const char *filename, EErrorCode *error = 0);
Bool_t IsErrorMessagesEnabled() const { return RealObject()->IsErrorMessagesEnabled(); }
Bool_t SetErrorMessages(Bool_t enable = kTRUE);
Bool_t IsProcessLineLocked() const { return RealObject()->IsProcessLineLocked(); }
void SetProcessLineLock(Bool_t lock = kTRUE);
Int_t GetExitCode() const { return RealObject()->GetExitCode(); }
TClass *GenerateTClass(const char *classname, Bool_t emulation, Bool_t silent = kFALSE);
TClass *GenerateTClass(ClassInfo_t *classinfo, Bool_t silent = kFALSE);
Int_t GenerateDictionary(const char *classes, const char *includes = 0, const char *options = 0);
Int_t GetMore() const { return RealObject()->GetMore(); }
Bool_t IsLoaded(const char *filename) const { return RealObject()->IsLoaded(filename); }
char *GetPrompt();
void *GetInterfaceMethod(TClass *cl, const char *method, const char *params);
void *GetInterfaceMethodWithPrototype(TClass *cl, const char *method, const char *proto);
void GetInterpreterTypeName(const char*,std::string &output,Bool_t=kFALSE);
void Execute(const char *function, const char *params, int *error = 0);
void Execute(TObject *obj, TClass *cl, const char *method, const char *params, int *error = 0);
void Execute(TObject *obj, TClass *cl, TMethod *method, TObjArray *params, int *error = 0);
const char *GetSharedLibs();
const char *GetClassSharedLibs(const char *cls);
const char *GetSharedLibDeps(const char *lib);
const char *GetIncludePath();
TObjArray *GetRootMapFiles() const { return RealObject()->GetRootMapFiles(); }
const char *TypeName(const char *s);
static TInterpreter *RealObject();
static TInterpreter *ProxyObject();
};
#endif
|
/* Define to the type of arg 1 for `readlink'. */
#define READLINK_TYPE_ARG1 const char *path
/* Define to the type of arg 2 for `readlink'. */
#define READLINK_TYPE_ARG2 char *buf
/* Define to the type of arg 3 for `readlink'. */
#define READLINK_TYPE_ARG3 size_t bufsiz
/* Define to the type of arg 1 for `scandir'. */
#define SCANDIR_TYPE_ARG1 const char *dir
/* Define to the type of arg 2 for `scandir'. */
#define SCANDIR_TYPE_ARG2 struct dirent ***namelist
/* Define to the type of arg 3 for `scandir'. */
#define SCANDIR_TYPE_ARG3 int(*filter)(const struct dirent *)
/* Define to the type of arg 4 for `scandir'. */
#define SCANDIR_TYPE_ARG4 int(*compar)(const void *,const void *)
|
#ifndef __TESTLIB_H__
#define __TESTLIB_H__
#include <gtk/gtk.h>
void fake_realize (GtkWidget *widget);
gboolean g_main_context_wait_for_event (GMainContext *context,
int timeout);
#endif
|
#include <stdio.h>
#include <stdlib.h>
#include "dataview-uniq.h"
extern void adainit();
extern void controlflow_PI_run();
void controlflow_RI_assert(asn1SccBoolean *res, asn1SccCharString *msg) {
if (!*res) {
fprintf(stderr, "%.*s\n", (int)msg->nCount, msg->arr);
exit(1);
}
}
void controlflow_RI_fail(asn1SccCharString *msg) {
fprintf(stderr, "%.*s\n", (int)msg->nCount, msg->arr);
exit(1);
}
int main() {
adainit();
controlflow_PI_run();
return 0;
}
|
/** \file
* \brief Definitions of functors used in FME layout.
*
* \author Martin Gronemann
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* \par
* Copyright (C)<br>
* See README.md in the OGDF root directory for details.
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* 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.
*
* \par
* You should have received a copy of the GNU General Public
* License along with this program; if not, see
* http://www.gnu.org/copyleft/gpl.html
*/
#pragma once
#include <ogdf/basic/basic.h>
namespace ogdf {
namespace fast_multipole_embedder {
//! the useless do nothing function
struct do_nothing
{
template<typename A> inline void operator()(A a) { }
template<typename A, typename B> inline void operator()(A a, B b) { }
};
//! condition functor for returning a constant boolean value
template<bool result>
struct const_condition
{
template<typename A> inline bool operator()(A a) { return result; }
template<typename A, typename B> inline bool operator()(A a, B b) { return result; }
};
//! the corresponding typedefs
using true_condition = const_condition<true>;
using false_condition = const_condition<false>;
//! functor for negating a condition
template<typename Func>
struct not_condition_functor
{
Func cond_func;
not_condition_functor(const Func& cond) : cond_func(cond) { }
template<typename A> inline bool operator()(A a) { return !cond_func(a); }
template<typename A, typename B> inline void operator()(A a, B b) { return !cond_func(a, b); }
};
//! creator of the negator
template<typename Func>
static inline not_condition_functor<Func> not_condition(const Func& func)
{
return not_condition_functor<Func>(func);
}
//! Functor for conditional usage of a functor
template<typename CondType, typename ThenType, typename ElseType = do_nothing>
struct if_then_else_functor
{
CondType condFunc;
ThenType thenFunc;
ElseType elseFunc;
if_then_else_functor(const CondType& c, const ThenType& f1) : condFunc(c), thenFunc(f1) { }
if_then_else_functor(const CondType& c, const ThenType& f1, const ElseType& f2) : condFunc(c), thenFunc(f1), elseFunc(f2) { }
template<typename A>
inline void operator()(A a)
{
if (condFunc(a))
thenFunc(a);
else
elseFunc(a);
}
template<typename A, typename B>
inline void operator()(A a, B b)
{
if (condFunc(a, b))
thenFunc(a, b);
else
elseFunc(a, b);
}
};
//! creates an if then else functor with a condition and a then and an else functor
template<typename CondType, typename ThenType, typename ElseType>
static inline if_then_else_functor<CondType, ThenType, ElseType> if_then_else(const CondType& cond, const ThenType& thenFunc, const ElseType& elseFunc)
{
return if_then_else_functor<CondType, ThenType, ElseType>(cond, thenFunc, elseFunc);
}
//! creates an if then functor with a condition and a then functor
template<typename CondType, typename ThenType>
static inline if_then_else_functor<CondType, ThenType> if_then(const CondType& cond, const ThenType& thenFunc)
{
return if_then_else_functor<CondType, ThenType>(cond, thenFunc);
}
//! helper functor to generate a pair as parameters
template<typename F, typename A>
struct pair_call_functor
{
F func;
A first;
pair_call_functor(F f, A a) : func(f), first(a) {};
template<typename B>
inline void operator()(B second)
{
func(first, second);
}
};
//! creates a pair call resulting in a call f(a, *)
template<typename F, typename A>
static inline pair_call_functor<F, A> pair_call(F f, A a)
{
return pair_call_functor<F, A>(f, a);
}
//! Functor for composing two other functors
template<typename FuncFirst, typename FuncSecond>
struct composition_functor
{
FuncFirst firstFunc;
FuncSecond secondFunc;
composition_functor(const FuncFirst& first, const FuncSecond& second) : firstFunc(first), secondFunc(second) {};
template<typename A>
void operator()(A a)
{
firstFunc(a);
secondFunc(a);
}
template<typename A, typename B>
void operator()(A a, B b)
{
firstFunc(a, b);
secondFunc(a, b);
}
};
//! create a functor composition of two functors
template<typename FuncFirst, typename FuncSecond>
static inline composition_functor<FuncFirst, FuncSecond> func_comp(const FuncFirst& first, const FuncSecond& second)
{
return composition_functor<FuncFirst, FuncSecond>(first, second);
}
//! functor for invoking a functor for a pair(u,v) and then (v,u)
template<typename Func>
struct pair_vice_versa_functor
{
Func func;
pair_vice_versa_functor(const Func& f) : func(f) { }
template<typename A, typename B>
void operator()(A a, B b)
{
func(a, b);
func(b, a);
}
};
//! creates a functor for invoking a functor for a pair(u,v) and then (v,u)
template<typename Func>
static inline pair_vice_versa_functor<Func> pair_vice_versa(const Func& f)
{
return pair_vice_versa_functor<Func>(f);
}
//! generic min max functor for an array
template<typename T>
struct min_max_functor
{
const T* a;
T& min_value;
T& max_value;
min_max_functor(const T* ptr, T& min_var, T& max_var) : a(ptr), min_value(min_var), max_value(max_var)
{
min_value = a[0];
max_value = a[0];
}
inline void operator()(uint32_t i)
{
min_value = min<T>(min_value, a[i]);
max_value = max<T>(max_value, a[i]);
}
};
}
}
|
/*******************************************************************************
* This file is part of PlexyDesk.
* Maintained by : Siraj Razick <siraj@plexydesk.com>
* Authored By :
*
* PlexyDesk 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.
*
* PlexyDesk 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 General Public License
* along with PlexyDesk. If not, see <http://www.gnu.org/licenses/lgpl.html>
*******************************************************************************/
#ifndef OPENWEATHERMAPS_DATA_I
#define OPENWEATHERMAPS_DATA_I
#include <QtCore>
#include <ck_data_plugin_interface.h>
class openweathermapsInterface : public QObject,
public PlexyDesk::DataPluginInterface {
Q_OBJECT
Q_INTERFACES(PlexyDesk::DataPluginInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.openstreatmap")
public:
virtual ~openweathermapsInterface() {}
/* this will return a valid data plugin pointer*/
QSharedPointer<PlexyDesk::DataSource> model();
};
#endif
|
/*
* $Revision: 3832 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2013-11-13 11:16:27 +0100 (Wed, 13 Nov 2013) $
***************************************************************/
/** \file
* \brief Declaration and implementation of the optimal third
* phase of the Sugiyama algorithm.
*
* \author Carsten Gutwenger
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* \par
* Copyright (C)<br>
* See README.txt in the root directory of the OGDF installation for details.
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* 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.
*
* \par
* 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.
*
* \see http://www.gnu.org/copyleft/gpl.html
***************************************************************/
#ifdef _MSC_VER
#pragma once
#endif
#ifndef OGDF_OPTIMAL_HIERARCHY_LAYOUT_H
#define OGDF_OPTIMAL_HIERARCHY_LAYOUT_H
#include <ogdf/module/HierarchyLayoutModule.h>
namespace ogdf {
//! The LP-based hierarchy layout algorithm.
/**
* OptimalHierarchyLayout implements a hierarchy layout algorithm that is based
* on an LP-formulation. It is only available if OGDF is compiled with LP-solver
* support (e.g., Coin).
*
* The used model avoids Spaghetti-effect like routing of edges by using
* long vertical segments as in FastHierarchyLayout. An additional balancing
* can be used which balances the successors below a node.
*
* <H3>Optional parameters</H3>
*
* <table>
* <tr>
* <th><i>Option</i><th><i>Type</i><th><i>Default</i><th><i>Description</i>
* </tr><tr>
* <td><i>nodeDistance</i><td>double<td>3.0
* <td>The minimal allowed x-distance between nodes on a layer.
* </tr><tr>
* <td><i>layerDistance</i><td>double<td>3.0
* <td>The minimal allowed y-distance between layers.
* </tr><tr>
* <td><i>fixedLayerDistance</i><td>bool<td>false
* <td>If set to true, the distance between neighboured layers is always
* layerDistance; otherwise the distance is adjusted (increased) to improve readability.
* </tr><tr>
* <td><i>weightSegments</i><td>double<td>2.0
* <td>The weight of edge segments connecting to vertical segments.
* </tr><tr>
* <td><i>weightBalancing</i><td>double<td>0.1
* <td>The weight for balancing successors below a node; 0.0 means no balancing.
* </tr>
* </table>
*/
class OGDF_EXPORT OptimalHierarchyLayout : public HierarchyLayoutModule
{
#ifndef OGDF_LP_SOLVER
protected:
void doCall(const HierarchyLevelsBase& /*levels*/, GraphCopyAttributes & /*AGC*/) {
OGDF_THROW_PARAM(LibraryNotSupportedException, lnscCoin);
}
#else
public:
//! Creates an instance of optimal hierarchy layout.
OptimalHierarchyLayout();
//! Copy constructor.
OptimalHierarchyLayout(const OptimalHierarchyLayout &);
// destructor
~OptimalHierarchyLayout() { }
//! Assignment operator.
OptimalHierarchyLayout &operator=(const OptimalHierarchyLayout &);
/**
* @name Optional parameters
* @{
*/
//! Returns the minimal allowed x-distance between nodes on a layer.
double nodeDistance() const {
return m_nodeDistance;
}
//! Sets the minimal allowed x-distance between nodes on a layer to \a x.
void nodeDistance(double x) {
if(x >= 0)
m_nodeDistance = x;
}
//! Returns the minimal allowed y-distance between layers.
double layerDistance() const {
return m_layerDistance;
}
//! Sets the minimal allowed y-distance between layers to \a x.
void layerDistance(double x) {
if(x >= 0)
m_layerDistance = x;
}
//! Returns the current setting of option <i>fixedLayerDistance</i>.
/**
* If set to true, the distance is always layerDistance; otherwise
* the distance is adjusted (increased) to improve readability.
*/
bool fixedLayerDistance() const {
return m_fixedLayerDistance;
}
//! Sets the option <i>fixedLayerDistance</i> to \a b.
void fixedLayerDistance(bool b) {
m_fixedLayerDistance = b;
}
//! Returns the weight of edge segments connecting to vertical segments.
double weightSegments() const {
return m_weightSegments;
}
//! Sets the weight of edge segments connecting to vertical segments to \a w.
void weightSegments(double w) {
if(w > 0.0 && w <= 100.0)
m_weightSegments = w;
}
//! Returns the weight for balancing successors below a node; 0.0 means no balancing.
double weightBalancing() const {
return m_weightBalancing;
}
//! Sets the weight for balancing successors below a node to \a w; 0.0 means no balancing.
void weightBalancing(double w) {
if(w >= 0.0 && w <= 100.0)
m_weightBalancing = w;
}
//! @}
protected:
//! Implements the algorithm call.
void doCall(const HierarchyLevelsBase &levels,GraphCopyAttributes &AGC);
private:
void computeXCoordinates(
const HierarchyLevelsBase &levels,
GraphCopyAttributes &AGC);
void computeYCoordinates(
const HierarchyLevelsBase &levels,
GraphCopyAttributes &AGC);
// options
double m_nodeDistance; //!< The minimal distance between nodes.
double m_layerDistance; //!< The minimal distance between layers.
bool m_fixedLayerDistance; //!< Use fixed layer distances?
double m_weightSegments; //!< The weight of edge segments.
double m_weightBalancing; //!< The weight for balancing.
#endif
};
}
#endif
|
/////////////////////////////////////////////////////////////////////////////
// Authors: Laurent Pugin and Rodolfo Zitellini
// Created: 2014
// Copyright (c) Authors and others. All rights reserved.
//
// Code generated using a modified version of libmei
// by Andrew Hankinson, Alastair Porter, and Others
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NOTE: this file was generated with the Verovio libmei version and
// should not be edited because changes will be lost.
/////////////////////////////////////////////////////////////////////////////
#ifndef __VRV_ATTS_EDITTRANS_H__
#define __VRV_ATTS_EDITTRANS_H__
#include "att.h"
#include "pugixml.hpp"
//----------------------------------------------------------------------------
#include <string>
namespace vrv {
//----------------------------------------------------------------------------
// AttAgentident
//----------------------------------------------------------------------------
class AttAgentident: public Att
{
public:
AttAgentident();
virtual ~AttAgentident();
/** Reset the default values for the attribute class **/
void ResetAgentident();
/** Read the values for the attribute class **/
bool ReadAgentident( pugi::xml_node element );
/** Write the values for the attribute class **/
bool WriteAgentident( pugi::xml_node element );
/**
* @name Setters, getters and presence checker for class members.
* The checker returns true if the attribute class is set (e.g., not equal
* to the default value)
**/
///@{
void SetAgent(std::string agent_) { m_agent = agent_; };
std::string GetAgent() const { return m_agent; };
bool HasAgent( );
///@}
private:
/**
* Signifies the causative agent of damage, illegibility, or other loss of original
* text.
**/
std::string m_agent;
/* include <attagent> */
};
//----------------------------------------------------------------------------
// AttEdit
//----------------------------------------------------------------------------
class AttEdit: public Att
{
public:
AttEdit();
virtual ~AttEdit();
/** Reset the default values for the attribute class **/
void ResetEdit();
/** Read the values for the attribute class **/
bool ReadEdit( pugi::xml_node element );
/** Write the values for the attribute class **/
bool WriteEdit( pugi::xml_node element );
/**
* @name Setters, getters and presence checker for class members.
* The checker returns true if the attribute class is set (e.g., not equal
* to the default value)
**/
///@{
void SetCert(std::string cert_) { m_cert = cert_; };
std::string GetCert() const { return m_cert; };
bool HasCert( );
//
void SetEvidence(std::string evidence_) { m_evidence = evidence_; };
std::string GetEvidence() const { return m_evidence; };
bool HasEvidence( );
///@}
private:
/** Signifies the degree of certainty or precision associated with a feature. **/
std::string m_cert;
/**
* Indicates the nature of the evidence supporting the reliability or accuracy of
* the intervention or interpretation.
* Suggested values include: 'internal', 'external', 'conjecture'.
**/
std::string m_evidence;
/* include <attevidence> */
};
//----------------------------------------------------------------------------
// AttExtent
//----------------------------------------------------------------------------
class AttExtent: public Att
{
public:
AttExtent();
virtual ~AttExtent();
/** Reset the default values for the attribute class **/
void ResetExtent();
/** Read the values for the attribute class **/
bool ReadExtent( pugi::xml_node element );
/** Write the values for the attribute class **/
bool WriteExtent( pugi::xml_node element );
/**
* @name Setters, getters and presence checker for class members.
* The checker returns true if the attribute class is set (e.g., not equal
* to the default value)
**/
///@{
void SetExtent(std::string extent_) { m_extent = extent_; };
std::string GetExtent() const { return m_extent; };
bool HasExtent( );
///@}
private:
/** Indicates the extent of damage or omission. **/
std::string m_extent;
/* include <attextent> */
};
//----------------------------------------------------------------------------
// AttReasonident
//----------------------------------------------------------------------------
class AttReasonident: public Att
{
public:
AttReasonident();
virtual ~AttReasonident();
/** Reset the default values for the attribute class **/
void ResetReasonident();
/** Read the values for the attribute class **/
bool ReadReasonident( pugi::xml_node element );
/** Write the values for the attribute class **/
bool WriteReasonident( pugi::xml_node element );
/**
* @name Setters, getters and presence checker for class members.
* The checker returns true if the attribute class is set (e.g., not equal
* to the default value)
**/
///@{
void SetReason(std::string reason_) { m_reason = reason_; };
std::string GetReason() const { return m_reason; };
bool HasReason( );
///@}
private:
/**
* Holds a short phrase describing the reason for missing textual material (gap),
* why material is supplied (supplied), or why transcription is difficult
* (unclear).
**/
std::string m_reason;
/* include <attreason> */
};
} // vrv namespace
#endif // __VRV_ATTS_EDITTRANS_H__
|
/* Z Kit - keys/mathematics/geometry.h
_____ _______________
/_ /_/ -_/_ _/ _ |
/____/\___/ /__//___/_| Kit
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
Released under the terms of the GNU Lesser General Public License v3. */
#ifndef _Z_keys_mathematics_geometry_H_
#define _Z_keys_mathematics_geometry_H_
#define Z_BRAVAIS_LATTICE_TRICLINIC_P 1
#define Z_BRAVAIS_LATTICE_MONOCLINIC_P 2
#define Z_BRAVAIS_LATTICE_MONOCLINIC_C 3
#define Z_BRAVAIS_LATTICE_ORTHORHOMBIC_P 4
#define Z_BRAVAIS_LATTICE_ORTHORHOMBIC_C 5
#define Z_BRAVAIS_LATTICE_ORTHORHOMBIC_I 6
#define Z_BRAVAIS_LATTICE_ORTHORHOMBIC_F 7
#define Z_BRAVAIS_LATTICE_TETRAGONAL_P 8
#define Z_BRAVAIS_LATTICE_TETRAGONAL_I 9
#define Z_BRAVAIS_LATTICE_RHOMBOHEDRAL_P 10
#define Z_BRAVAIS_LATTICE_HEXAGONAL_P 11
#define Z_BRAVAIS_LATTICE_CUBIC_P 12
#define Z_BRAVAIS_LATTICE_CUBIC_I 13
#define Z_BRAVAIS_LATTICE_CUBIC_F 14
#define Z_KEY_BITS_BRAVAIS_LATTICE 8
#define Z_KEY_LAST_BRAVAIS_LATTICE Z_BRAVAIS_LATTICE_CUBIC_F
#endif /* _Z_keys_mathematics_geometry_H_ */
|
/// @file
/// @brief QK/C++ port to ARM, preemptive QK kernel, generic C++ compiler
/// @cond
///***************************************************************************
/// Last updated for version 5.4.0
/// Last updated on 2015-05-04
///
/// Q u a n t u m L e a P s
/// ---------------------------
/// innovating embedded systems
///
/// Copyright (C) Quantum Leaps, All rights reserved.
///
/// This program is open source 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.
///
/// Alternatively, this program may be distributed and modified under the
/// terms of Quantum Leaps commercial licenses, which expressly supersede
/// the GNU General Public License and are specifically designed for
/// licensees interested in retaining the proprietary status of their code.
///
/// 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/>.
///
/// Contact information:
/// Web: www.state-machine.com
/// Email: info@state-machine.com
///***************************************************************************
/// @endcond
#ifndef qk_port_h
#define qk_port_h
extern "C" {
void QK_irq(void);
void BSP_irq(void);
// void BSP_fiq(void); see NOTE1
}
#include "qk.h" // QK platform-independent public interface
//****************************************************************************
// NOTE1:
// The FIQ-type interrupts are never disabled in this port, so the FIQ is
// a "kernel-unaware" interrupt.
//
// If the FIQ is ever used in the application, it must be implemented in
// assembly.
//
#endif // qk_port_h
|
/**
* @file rand.c
* @provides srand, rand
*
* $Id: rand.c 221 2007-07-11 18:45:46Z mschul $
*/
/* Embedded XINU, Copyright (C) 2007. All rights reserved. */
static unsigned long randx = 1;
/**
* Sets the random seed.
* @param x random seed
*/
void srand(unsigned long x)
{
randx = x;
}
/**
* Generates a random long.
* @return random long
*/
unsigned long rand(void)
{
return (((randx = randx*1103515245 + 12345)>>16) & 077777);
}
|
#ifndef ROESOUND_H_
#define ROESOUND_H_
#include "RoeCommon.h"
#ifdef ROE_COMPILE_AUDIO
#include <SDL_mixer.h>
#include <string>
#include <map>
namespace roe {
struct S_SoundIntern {
Mix_Chunk *chunk; //chunk
float fStdVolume; //faktor
};
class Sound
{
public:
Sound(const float fVolume = 1.0f);
Sound(const std::string &sPath, const float fVolume = 1.0f);
Sound(const Sound& rhs);
~Sound();
Sound& operator = (const Sound& rhs);
//initialises path for instance
void load (std::string sPath);
std::string getName () const {return m_sName;}
std::string getPath () const {return m_sPath;}
//call all functions only after load()
void play (const int iLoops = 0);
void resume ();
void pause ();
void restart(bool bPlay = true);
void halt ();
void setVolume (const float f) {m_fVolume = f; if (isPlaying()) Mix_Volume(m_iChannel,MIX_MAX_VOLUME*getStdVolume()*m_fVolume);}
float getVolume () const {return m_fVolume;}
float getStdVolume();
int getChannel () const {return m_iChannel;}
bool isPlaying () const {return (m_sPath != "") ? (s_mpSoundPlaying[m_sPath]) : (false);}
//loading and deleting of sounds
static void loadSound (std::string sPath, const float fVolume = 1.0f);
static void deleteSound (std::string sPath, bool bCompleteThePath = true);
static bool isChannelPlaying (int channel);
static int getNumberOfChannelsPlaying ();
// for the static variables
static void init(const int iMaxChannels, std::string sStart, std::string sEnd);
static void setPathStart(std::string s) {s_sPathStart = s;}
static void setPathEnd (std::string s) {s_sPathEnd = s;}
static void quit();
//have effects on all channels
static void haltAll () {Mix_HaltChannel(-1);}
static void pauseAll () {Mix_Pause(-1);}
static void resumeAll() {Mix_Resume(-1);}
private:
static void channelFinished (int channel); // callback function
static std::map <std::string, S_SoundIntern > s_mpSound; //map of sound-objects
static std::map <std::string, S_SoundIntern >::iterator s_mpi; //map-iterator
static std::pair<std::string, S_SoundIntern> s_pair; //paar-object for teh map
static std::map <std::string, int > s_mpSoundChannel; //map of sound-objects channels
static std::map <std::string, bool> s_mpSoundPlaying; //map of sound-objects playing
static std::string s_sPathStart, s_sPathEnd; //standart path
static int s_iMaxChannels; //maximum number of channels
static bool *s_abChannelPlaying; // dynamic array of all channels playing or not
std::string m_sPath; //path of the instance to file
std::string m_sName; //name (path without start and end)
float m_fVolume; //factor: 1->std, 0->mute, 2->double than std
int m_iChannel; //the channel of this sound
};
} // namespace roe
#endif //ROE_COMPILE_AUDIO
#endif /*ROESOUND_H_*/
|
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/type/v3/ratelimit_unit.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg_internal.h"
#include "envoy/type/v3/ratelimit_unit.upb.h"
#include "udpa/annotations/status.upb.h"
#include "upb/port_def.inc"
const upb_msglayout_file envoy_type_v3_ratelimit_unit_proto_upb_file_layout = {
NULL,
NULL,
0,
0,
};
#include "upb/port_undef.inc"
|
#pragma once
#include "envoy/extensions/filters/http/wasm/v3/wasm.pb.h"
#include "envoy/extensions/filters/http/wasm/v3/wasm.pb.validate.h"
#include "source/extensions/filters/http/common/factory_base.h"
namespace Envoy {
namespace Extensions {
namespace HttpFilters {
namespace Wasm {
/**
* Config registration for the Wasm filter. @see NamedHttpFilterConfigFactory.
*/
class WasmFilterConfig
: public Common::FactoryBase<envoy::extensions::filters::http::wasm::v3::Wasm> {
public:
WasmFilterConfig() : FactoryBase("envoy.filters.http.wasm") {}
private:
Http::FilterFactoryCb createFilterFactoryFromProtoTyped(
const envoy::extensions::filters::http::wasm::v3::Wasm& proto_config, const std::string&,
Server::Configuration::FactoryContext& context) override;
};
} // namespace Wasm
} // namespace HttpFilters
} // namespace Extensions
} // namespace Envoy
|
//
// CCSMASlipCandleStickChart.h
// CocoaChartsSample
//
// Created by limc on 12/3/13.
// Copyright (c) 2013 limc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "CCSSlipCandleStickChart.h"
@interface CCSMASlipCandleStickChart : CCSSlipCandleStickChart {
NSArray *_linesData;
}
/*!
Data for display data
ラインを表示用データ
表示线条用的数据
*/
@property(retain, nonatomic) NSArray *linesData;
/*!
@abstract Draw lines to this graph
ラインデータを使いてラインを書く
使用数据绘制线条
@param rect the rect of the grid
グリドのrect
图表的rect
*/
- (void)drawLinesData:(CGRect)rect;
@end
|
/* limits.h -*-C-*- */
#ifndef INCLUDED_NATIVE_C_LIMITS
#define INCLUDED_NATIVE_C_LIMITS
#include <bsls_ident.h>
BSLS_IDENT("$Id: $")
/*
//@PURPOSE: Provide functionality of the corresponding C++ Standard header.
//
//@SEE_ALSO: package bos+stdhdrs
//
//@DESCRIPTION: Provide functionality of the corresponding C++ standard header.
// This file includes the compiler provided native standard header. In
// addition, in 'bde-stl' mode (used by Bloomberg managed code, see
// 'bos+stdhdrs.txt' for more information) include the corresponding header in
// 'bsl+bslhdrs' as well as 'bos_stdhdrs_prologue.h' and
// 'bos_stdhdrs_epilogue.h'. This includes the respective 'bsl' types and
// places them in the 'std' namespace.
*/
/*
// Note that 'limits.h' is meant for multiple inclusion on Linux, so only the
// ident is protected by the include guard.
*/
#endif /* INCLUDED_NATIVE_C_LIMITS */
#include <bsls_compilerfeatures.h>
#if !defined(BSL_OVERRIDES_STD) || !defined(__cplusplus)
# include <bos_stdhdrs_incpaths.h>
# if defined(BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT)
# include_next <limits.h>
# else
# include BSL_NATIVE_C_LIB_HEADER(limits.h)
# endif
#else /* defined(BSL_OVERRIDES_STD) */
# ifndef BOS_STDHDRS_PROLOGUE_IN_EFFECT
# include <bos_stdhdrs_prologue.h>
# endif
# ifndef BOS_STDHDRS_RUN_EPILOGUE
# define BOS_STDHDRS_RUN_EPILOGUE
# define BOS_STDHDRS_EPILOGUE_RUN_BY_c_limits
# endif
# include <bos_stdhdrs_incpaths.h>
# if defined(BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT)
# include_next <limits.h>
# else
# include BSL_NATIVE_C_LIB_HEADER(limits.h)
# endif
// This native header does not define any symbols in namespace 'std' to import,
// so the following include is not necessary:
// #include <bsl_c_limits.h>
# ifdef BOS_STDHDRS_EPILOGUE_RUN_BY_c_limits
# undef BOS_STDHDRS_EPILOGUE_RUN_BY_c_limits
# include <bos_stdhdrs_epilogue.h>
# endif
#endif /* BSL_OVERRIDES_STD */
/*
// ----------------------------------------------------------------------------
// Copyright 2013 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------
*/
|
//
// fileinfoModel.h
// JieXinIphone
//
// Created by lxrent02 on 14-4-2.
// Copyright (c) 2014年 sunboxsoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface fileinfoModel : NSObject
//文档信息表
/*
字段含义
name 文件名称
programaid 所属栏目
title 文件标题
filedesc 文件描述
filesize 文件大小
path 文件保存路径
ext 文件类型
pdfpath PDF保存位置
uploadtime 上传时间
updatetime 更新时间
uploaderid 上传用户ID
groupid
*/
@property(nonatomic,strong)NSString*fileid;
@property(nonatomic,strong)NSString*name;
@property(nonatomic,strong)NSString*programaid;
@property(nonatomic,strong)NSString*title;
@property(nonatomic,strong)NSString*filedesc;
@property(nonatomic,strong)NSString*filesize;
@property(nonatomic,strong)NSString*path;
@property(nonatomic,strong)NSString*ext;
@property(nonatomic,strong)NSString*pdfpath;
@property(nonatomic,strong)NSString*uploadtime;
@property(nonatomic,strong)NSString*updatetime;
@property(nonatomic,strong)NSString*uploaderid;
@property(nonatomic,strong)NSString*groupid;
@property(nonatomic,strong)NSString*jpgStr;
@property(nonatomic,strong)NSString* jpgCount;
@end
|
/* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VR_GVR_DEMOS_VIDEO_PLUGIN_JNIHELPER_H_
#define VR_GVR_DEMOS_VIDEO_PLUGIN_JNIHELPER_H_
#include <jni.h>
namespace gvrvideo {
// JNI pointer management and caching across threads.
class JNIHelper {
public:
static void Initialize(JavaVM *vm, const char *className);
static const JNIHelper &Get();
JNIEnv *Env() const;
// Custom implementation of FindClass which uses the class loader found on the
// main thread when initializing. This makes class lookups on other threads
// work as expected.
jclass FindClass(const char *className) const;
jobject CallStaticObjectMethod(jclass clz, jmethodID methodId, ...) const;
void CallStaticVoidMethod(jclass clz, jmethodID methodId, ...) const;
jobject CallObjectMethod(jobject obj, jmethodID methodId, ...) const;
jboolean CallBooleanMethod(jobject obj, jmethodID jmethodId, ...) const;
jint CallIntMethod(jobject obj, jmethodID jmethodId, ...) const;
jfloat CallFloatMethod(jobject obj, jmethodID jmethodId, ...) const;
jlong CallLongMethod(jobject obj, jmethodID jmethodId, ...) const;
jbyte* CallByteArrayMethod(jobject obj, jmethodID jmethodId, int* outSize, ...) const;
void CallVoidMethod(jobject obj, jmethodID jmethodId, ...) const;
// Returns a const char* that needs to be released by this class.
const char *CallStringMethod(jobject obj, jmethodID methodId, ...) const;
// Releases the memory used by the string passed in. This string is assumed
// to have been returned from CallStringMethod.
void ReleaseString(const char *string) const;
protected:
void InitClassloader(const char *className);
private:
JNIHelper(JavaVM *vm);
~JNIHelper();
JavaVM *vm_;
jobject classLoader_;
jmethodID findClassMethod_;
static JNIHelper *pInstance;
};
} // namespace gvrvideo
#endif // VR_GVR_DEMOS_VIDEO_PLUGIN_JNIHELPER_H_
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkGE5ImageIOFactory_h
#define itkGE5ImageIOFactory_h
#include "ITKIOGEExport.h"
#include "itkObjectFactoryBase.h"
#include "itkImageIOBase.h"
namespace itk
{
/**
*\class GE5ImageIOFactory
* \brief Create instances of GE5ImageIO objects using an object factory.
* \ingroup ITKIOGE
*/
class ITKIOGE_EXPORT GE5ImageIOFactory : public ObjectFactoryBase
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(GE5ImageIOFactory);
/** Standard class type aliases. */
using Self = GE5ImageIOFactory;
using Superclass = ObjectFactoryBase;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
/** Class methods used to interface with the registered factories. */
const char *
GetITKSourceVersion() const override;
const char *
GetDescription() const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(GE5ImageIOFactory, ObjectFactoryBase);
/** Register one factory of this type */
static void
RegisterOneFactory()
{
GE5ImageIOFactory::Pointer metaFactory = GE5ImageIOFactory::New();
ObjectFactoryBase::RegisterFactoryInternal(metaFactory);
}
protected:
GE5ImageIOFactory();
~GE5ImageIOFactory() override;
void
PrintSelf(std::ostream & os, Indent indent) const override;
};
} // end namespace itk
#endif
|
#pragma once
#include "../state.h"
template<typename _Object>
class CStateBurerAttackRunAround : public CState<_Object> {
typedef CState<_Object> inherited;
Fvector selected_point;
u32 time_started;
Fvector dest_direction;
public:
CStateBurerAttackRunAround (_Object *obj);
virtual void initialize ();
virtual void execute ();
virtual bool check_start_conditions ();
virtual bool check_completion ();
};
#include "burer_state_attack_run_around_inline.h" |
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* xds/annotations/v3/versioning.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg_internal.h"
#include "xds/annotations/v3/versioning.upb.h"
#include "google/protobuf/descriptor.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout_field xds_annotations_v3_VersioningAnnotation__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, _UPB_MODE_SCALAR | (_UPB_REP_STRVIEW << _UPB_REP_SHIFT)},
};
const upb_msglayout xds_annotations_v3_VersioningAnnotation_msginit = {
NULL,
&xds_annotations_v3_VersioningAnnotation__fields[0],
UPB_SIZE(8, 16), 1, _UPB_MSGEXT_NONE, 1, 255,
};
static const upb_msglayout *messages_layout[1] = {
&xds_annotations_v3_VersioningAnnotation_msginit,
};
extern const upb_msglayout google_protobuf_MessageOptions_msginit;
extern const upb_msglayout xds_annotations_v3_VersioningAnnotation_msginit;
const upb_msglayout_ext xds_annotations_v3_versioning_ext = {
{92389011, 0, 0, 0, 11, _UPB_MODE_SCALAR | _UPB_MODE_IS_EXTENSION | (_UPB_REP_PTR << _UPB_REP_SHIFT)},
&google_protobuf_MessageOptions_msginit,
{.submsg = &xds_annotations_v3_VersioningAnnotation_msginit},
};
static const upb_msglayout_ext *extensions_layout[1] = {
&xds_annotations_v3_versioning_ext,
};
const upb_msglayout_file xds_annotations_v3_versioning_proto_upb_file_layout = {
messages_layout,
extensions_layout,
1,
1,
};
#include "upb/port_undef.inc"
|
/*
Copyright (c) 2007 Cyrus Daboo. 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.
*/
// Header for CCopyToMenu class
#ifndef __CCOPYTOMENU__MULBERRY__
#define __CCOPYTOMENU__MULBERRY__
#include "CListener.h"
#include "templs.h"
//#include "cdstring.h"
// Consts
const ResIDT MENU_CopyTo = 154;
const ResIDT MENU_AppendTo = 159;
// Classes
class LMenu;
class CMbox;
class CMboxList;
class CMboxProtocol;
class CMboxRefList;
class CTreeNode;
class CTreeNodeList;
class cdstring;
class CCopyToMenu : public CListener
{
friend class CMailboxPopup;
friend class CMailboxToolbarPopup;
private:
typedef std::vector<LMenu*> CMenuList;
static LMenu* sCopyToMenu;
static LMenu* sAppendToMenu;
static CMenuList sCopyToMenuList;
static CMenuList sAppendToMenuList;
static MenuHandle sCopyToPopupMenu;
static ulvector sCopyToPopupServerBreaks;
static MenuHandle sAppendToPopupMenu;
static ulvector sAppendToPopupServerBreaks;
static bool sCopyToReset;
static bool sAppendToReset;
static bool sUseCopyToCabinet;
static bool sUseAppendToCabinet;
static bool sStripSubscribePrefix;
static bool sStripFavouritePrefix;
public:
static CCopyToMenu* sMailboxMainMenu;
CCopyToMenu();
virtual ~CCopyToMenu();
void ListenTo_Message(long msg, void* param); // Respond to list changes
static void SetMenuOptions(bool use_copyto_cabinet, bool use_appendto_cabinet);
static void DirtyMenuList(void)
{ sCopyToReset = true; sAppendToReset = true; }
static void ResetMenuList(void);
static bool IsCopyToMenu(short menu_id);
static bool GetMbox(short menu_id, short item_num, CMbox*& found);
static MenuHandle GetPopupMenuHandle(bool copy_to)
{ return copy_to ? sCopyToPopupMenu : sAppendToPopupMenu; }
static bool GetPopupMboxSend(bool copy_to, short item_num, CMbox*& found, bool& set_as_default);
static bool GetPopupMbox(bool copy_to, short item_num, CMbox*& found, bool do_choice = true);
static bool GetPopupMbox(bool copy_to, short item_num, bool do_choice, bool sending, CMbox*& found, bool& set_as_default);
static bool GetPopupMboxName(bool copy_to, short item_num, cdstring& found, bool do_choice = true);
static SInt16 FindPopupMboxPos(bool copy_to, const char* name);
private:
static void ChangedList(CTreeNodeList* list);
static bool TestPrefix(const CMboxList& list, const cdstring& offset);
static void ResetAll(LMenu* main_menu, MenuHandle popup_menu, ulvector& breaks, bool copy_to);
static void ResetFavourite(LMenu* main_menu, MenuHandle popup_menu, ulvector& breaks, const CMboxRefList& items, const CMboxRefList& mrus, bool copy_to);
static void AddProtocolToMenu(CMboxProtocol* proto, MenuHandle menuH, short& pos, bool acct_name, bool single = false);
static void AppendListToMenu(const CMboxList& list, MenuHandle menuH, short& pos, bool acct_name, const cdstring& offset);
static void AppendListToMenu(const CMboxRefList& list, bool dynamic, MenuHandle menuH, short& pos, bool acct_name, const cdstring& offset, bool reverse = false);
static void AppendMbox(const CTreeNode* mbox, MenuHandle menuH, short& pos, bool acct_name, const cdstring& offset, size_t offset_length);
};
#endif
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkDCMTKImageIO_h
#define itkDCMTKImageIO_h
#include "ITKIODCMTKExport.h"
#include <fstream>
#include <cstdio>
#include "itkImageIOBase.h"
class DicomImage;
namespace itk
{
/**\class DCMTKImageIOEnums
* \brief Enums used by the DCMTKImageIO class
* \ingroup IOFilters
* \ingroup ITKIODCMTK
*/
class DCMTKImageIOEnums
{
public:
/**
*\class LogLevel
* \ingroup IOFilters
* \ingroup ITKIODCMTK
* enum for DCMTK log level. These are defined here without
* reference to DCMTK library enumerations, to avoid including
* dcmtk headers in this header.
*/
enum class LogLevel : uint8_t
{
TRACE_LOG_LEVEL = 0,
DEBUG_LOG_LEVEL,
INFO_LOG_LEVEL,
WARN_LOG_LEVEL,
ERROR_LOG_LEVEL,
FATAL_LOG_LEVEL,
OFF_LOG_LEVEL,
};
};
// Define how to print enumeration
extern ITKIODCMTK_EXPORT std::ostream &
operator<<(std::ostream & out, const DCMTKImageIOEnums::LogLevel value);
/**
*\class DCMTKImageIO
*
* \brief Read DICOM image file format.
*
* \ingroup IOFilters
*
* \ingroup ITKIODCMTK
*/
class ITKIODCMTK_EXPORT DCMTKImageIO : public ImageIOBase
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(DCMTKImageIO);
/** Standard class type aliases. */
using Self = DCMTKImageIO;
using Superclass = ImageIOBase;
using Pointer = SmartPointer<Self>;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(DCMTKImageIO, ImageIOBase);
using LogLevelEnum = DCMTKImageIOEnums::LogLevel;
#if !defined(ITK_LEGACY_REMOVE)
/**Exposes enums values for backwards compatibility*/
static constexpr LogLevelEnum TRACE_LOG_LEVEL = LogLevelEnum::TRACE_LOG_LEVEL;
static constexpr LogLevelEnum DEBUG_LOG_LEVEL = LogLevelEnum::DEBUG_LOG_LEVEL;
static constexpr LogLevelEnum INFO_LOG_LEVEL = LogLevelEnum::INFO_LOG_LEVEL;
static constexpr LogLevelEnum WARN_LOG_LEVEL = LogLevelEnum::WARN_LOG_LEVEL;
static constexpr LogLevelEnum ERROR_LOG_LEVEL = LogLevelEnum::ERROR_LOG_LEVEL;
static constexpr LogLevelEnum FATAL_LOG_LEVEL = LogLevelEnum::FATAL_LOG_LEVEL;
static constexpr LogLevelEnum OFF_LOG_LEVEL = LogLevelEnum::OFF_LOG_LEVEL;
#endif
/** */
void
SetDicomImagePointer(DicomImage * UserProvided)
{
m_DImage = UserProvided;
m_DicomImageSetByUser = true;
}
/*-------- This part of the interfaces deals with reading data. ----- */
/** Determine the file type. Returns true if this ImageIO can read the
* file specified. */
bool
CanReadFile(const char *) override;
/** Set the spacing and dimension information for the set filename. */
void
ReadImageInformation() override;
/** Reads the data from disk into the memory buffer provided. */
void
Read(void * buffer) override;
/*-------- This part of the interfaces deals with writing data. ----- */
/** Determine the file type. Returns true if this ImageIO can write the
* file specified. */
bool
CanWriteFile(const char *) override;
/** Set the spacing and dimension information for the set filename. */
void
WriteImageInformation() override;
/** Writes the data to disk from the memory buffer provided. Make sure
* that the IORegions has been set properly. */
void
Write(const void * buffer) override;
/** Set the DCMTK Message Logging Level */
void
SetLogLevel(LogLevelEnum level);
/** Get the DCMTK Message Logging Level */
LogLevelEnum
GetLogLevel() const;
DCMTKImageIO();
~DCMTKImageIO() override;
void
PrintSelf(std::ostream & os, Indent indent) const override;
private:
void
OpenDicomImage();
/** Finds the correct type to call the templated function ReorderRGBValues(...) */
void
ReorderRGBValues(void * buffer, const void * data, size_t count, unsigned int voxel_size);
/** Reorders RGB values in an image from color-by-plane (R1R2R3...G1G2G3...B1B2B3...)
* to color-by-pixel (R1G1B1...R2G2B2...R3G3B3...). `voxel_size` specifies the pixel size: It should
* be 3 for RGB images, and 4 for RGBA images.
* The code in this function is based on code available in DCMTK dcmimage/include/dcmtk/dcmimage/dicoopxt.h
* in the Convert(...) function.*/
template <typename T>
void
ReorderRGBValues(void * buffer, const void * data, size_t count, unsigned int voxel_size)
{
auto * output_buffer = static_cast<T *>(buffer);
const auto ** input_buffer = static_cast<const T **>(const_cast<void *>(data));
for (size_t pos = 0; pos < count; ++pos)
{
for (unsigned int color = 0; color < voxel_size; ++color)
{
*(output_buffer++) = input_buffer[color][pos];
}
}
}
/*----- internal helpers --------------------------------------------*/
bool m_UseJPEGCodec;
bool m_UseJPLSCodec;
bool m_UseRLECodec;
DicomImage * m_DImage;
bool m_DicomImageSetByUser;
double m_RescaleSlope;
double m_RescaleIntercept;
std::string m_LastFileName;
};
// Define how to print enumeration
extern ITKCommon_EXPORT std::ostream &
operator<<(std::ostream & out, DCMTKImageIO::LogLevelEnum value);
} // end namespace itk
#endif // itkDCMTKImageIO_h
|
/****************************************************************************
Copyright (C) 2013 Henry van Merode. All rights reserved.
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_PU_PARTICLE_3D_AFFECTOR_H__
#define __CC_PU_PARTICLE_3D_AFFECTOR_H__
#include "pola/graphic/math/Math.h"
#include "pola/graphic/particle/Particle3DAffector.h"
#include <vector>
#include <string>
namespace pola {
namespace graphic {
struct PUParticle3D;
class PUParticleSystem3D;
class PUAffector : public Particle3DAffector
{
friend class PUParticleSystem3D;
public:
/**
The AffectSpecialisation enumeration is used to specialise the affector even more. This enumeration
isn't used by all affectors; in some cases it isn't even applicable.
*/
enum AffectSpecialisation
{
AFSP_DEFAULT,
AFSP_TTL_INCREASE,
AFSP_TTL_DECREASE
};
virtual void notifyStart();
virtual void notifyStop();
virtual void notifyPause();
virtual void notifyResume();
virtual void notifyRescaled(const vec3& scale);
virtual void prepare();
virtual void unPrepare();
virtual void preUpdateAffector(float deltaTime);
virtual void updatePUAffector(PUParticle3D* particle, float delta);
virtual void postUpdateAffector(float deltaTime);
virtual void firstParticleUpdate(PUParticle3D *particle, float deltaTime);
virtual void initParticleForEmission(PUParticle3D* particle);
void process(PUParticle3D* particle, float delta, bool firstParticle);
void setLocalPosition(const vec3 &pos) { _position = pos; };
const vec3 getLocalPosition() const { return _position; };
void setMass(float mass);
float getMass() const;
/** Calculate the derived position of the affector.
@remarks
Note, that in script, the position is set as localspace, while if the affector is
emitted, its position is automatically transformed. This function always returns
the derived position.
*/
const vec3& getDerivedPosition();
/** Todo
*/
const AffectSpecialisation& getAffectSpecialisation(void) const {return _affectSpecialisation;};
void setAffectSpecialisation(const AffectSpecialisation& affectSpecialisation) {_affectSpecialisation = affectSpecialisation;};
/** Todo
*/
const std::string& getAffectorType(void) const {return _affectorType;};
void setAffectorType(const std::string& affectorType) {_affectorType = affectorType;};
/** Add a ParticleEmitter name that excludes Particles emitted by this ParticleEmitter from being
affected.
*/
void addEmitterToExclude(const std::string& emitterName);
/** Remove a ParticleEmitter name that excludes Particles emitted by this ParticleEmitter.
*/
void removeEmitterToExclude(const std::string& emitterName);
/** Todo
*/
const std::string& getName(void) const {return _name;};
void setName(const std::string& name) {_name = name;};
virtual void copyAttributesTo (PUAffector* affector);
public:
PUAffector();
virtual ~PUAffector();
protected:
float calculateAffectSpecialisationFactor (const PUParticle3D* particle);
protected:
vec3 _position;
/** Although the scale is on a Particle System level, the affector can also be scaled.
*/
vec3 _affectorScale;
/** Because the public attribute position is sometimes used for both localspace and worldspace
position, the mDerivedPosition attribute is introduced.
*/
vec3 _derivedPosition;
/** The mAffectSpecialisation is used to specialise the affector. This attribute is comparable with the
mAutoDirection of the ParticleEmitter, it is an optional attribute and used in some of the Particle
Affectors.
*/
AffectSpecialisation _affectSpecialisation;
// Type of the affector
std::string _affectorType;
std::vector<std::string> _excludedEmitters;
// Name of the affector (optional)
std::string _name;
float _mass;
};
} /* namespace graphic */
} /* namespace pola */
#endif
|
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RemoteFX USB Redirection
*
* Copyright 2012 Atrust corp.
* Copyright 2012 Alfred Liu <alfred.liu@atruscorp.com>
*
* 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 FREERDP_CHANNEL_URBDRC_CLIENT_SEARCHMAN_H
#define FREERDP_CHANNEL_URBDRC_CLIENT_SEARCHMAN_H
#include "urbdrc_types.h"
typedef struct _USB_SEARCHDEV USB_SEARCHDEV;
struct _USB_SEARCHDEV
{
void* inode;
void* prev;
void* next;
UINT16 idVendor;
UINT16 idProduct;
};
typedef struct _USB_SEARCHMAN USB_SEARCHMAN;
struct _USB_SEARCHMAN
{
int usb_numbers;
UINT32 UsbDevice;
USB_SEARCHDEV* idev; /* iterator device */
USB_SEARCHDEV* head; /* head device in linked list */
USB_SEARCHDEV* tail; /* tail device in linked list */
/* for urbdrc channel call back */
void* urbdrc;
/* load service */
void (*rewind)(USB_SEARCHMAN* seachman);
/* show all device in the list */
void (*show)(USB_SEARCHMAN* self);
/* add a new usb device for search */
BOOL (*add)(USB_SEARCHMAN* seachman, UINT16 idVendor, UINT16 idProduct);
/* remove a usb device from list */
int (*remove)(USB_SEARCHMAN* searchman, UINT16 idVendor, UINT16 idProduct);
/* check list has next device*/
int (*has_next)(USB_SEARCHMAN* seachman);
/* get the device from list*/
USB_SEARCHDEV* (*get_next)(USB_SEARCHMAN* seachman);
/* free! */
void (*free)(USB_SEARCHMAN* searchman);
};
USB_SEARCHMAN* searchman_new(void* urbdrc, UINT32 UsbDevice);
#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_SEARCHMAN_H */
|
/****************************************************************************
*
* Copyright 2016 Samsung Electronics 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.
*
****************************************************************************/
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef LWIP_HDR_MEM_H
#define LWIP_HDR_MEM_H
#include <net/lwip/opt.h>
#include <net/lwip/arch.h>
#ifdef __cplusplus
extern "C" {
#endif
#if MEM_LIBC_MALLOC
#include <stddef.h> /* for size_t */
#include <stdlib.h> /* for free() */
typedef size_t mem_size_t;
#define MEM_SIZE_F SZT_F
/* aliases for C library malloc() */
#define mem_init()
/* in case C library malloc() needs extra protection,
* allow these defines to be overridden.
*/
#ifndef mem_free
#define mem_free free
#endif
#ifndef mem_malloc
#define mem_malloc malloc
#endif
#ifndef mem_calloc
#define mem_calloc calloc
#endif
/* Since there is no C library allocation function to shrink memory without
moving it, define this to nothing. */
#ifndef mem_trim
#define mem_trim(mem, size) (mem)
#endif
#else /* MEM_LIBC_MALLOC */
/* MEM_SIZE would have to be aligned, but using 64000 here instead of
* 65535 leaves some room for alignment...
*/
#if MEM_SIZE > 64000L
typedef u32_t mem_size_t;
#define MEM_SIZE_F U32_F
#else
typedef u16_t mem_size_t;
#define MEM_SIZE_F U16_F
#endif /* MEM_SIZE > 64000 */
#if MEM_USE_POOLS
/** mem_init is not used when using pools instead of a heap */
#define mem_init()
/** mem_trim is not used when using pools instead of a heap:
we can't free part of a pool element and don't want to copy the rest */
#define mem_trim(mem, size) (mem)
#else /* MEM_USE_POOLS */
/* lwIP alternative malloc */
void mem_init(void);
void *mem_trim(void *mem, mem_size_t size);
#endif /* MEM_USE_POOLS */
void *mem_malloc(mem_size_t size);
void *mem_calloc(mem_size_t count, mem_size_t size);
void mem_free(void *mem);
#endif /* MEM_LIBC_MALLOC */
/** Calculate memory size for an aligned buffer - returns the next highest
* multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and
* LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4).
*/
#ifndef LWIP_MEM_ALIGN_SIZE
#define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
#endif
/** Calculate safe memory size for an aligned buffer when using an unaligned
* type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the
* start (e.g. if buffer is u8_t[] and actual data will be u32_t*)
*/
#ifndef LWIP_MEM_ALIGN_BUFFER
#define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1))
#endif
/** Align a memory pointer to the alignment defined by MEM_ALIGNMENT
* so that ADDR % MEM_ALIGNMENT == 0
*/
#ifndef LWIP_MEM_ALIGN
#define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
#endif
void mem_init(void);
void *mem_trim(void *mem, mem_size_t size);
void *mem_malloc(mem_size_t size);
void *mem_calloc(mem_size_t count, mem_size_t size);
void mem_free(void *mem);
#ifdef __cplusplus
}
#endif
#endif /* LWIP_HDR_MEM_H */
|
/*
* Copyright 2016 Davide Pianca
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <console.h>
#include <hal/hal.h>
#include <hal/syscall.h>
#include <proc/proc.h>
#include <proc/thread.h>
#include <drivers/keyboard.h>
#define MAX_SYSCALL 11
typedef uint32_t (*syscall_call_func)(uint32_t, ...);
static void *syscalls[] = {
&console_print, // printf 0
&gets, // scanf 1
&clear, // clear 2
&start_thread, // fork 3
&stop_thread, // exit 4
&end_process, // return n 5
&vfs_file_open_user, // fopen 6
&vfs_file_close_user, // fclose 7
&console_pwd_user, // PWD 8
&umalloc_sys, // malloc 9
&ufree_sys // free 10
};
void syscall_init() {
install_ir(0x72, 0x80 | 0x0E | 0x60, 0x8, &syscall_handle);
}
void syscall_disp(struct regs *re) {
if(re->eax >= MAX_SYSCALL) {
re->eax = -1;
return;
}
syscall_call_func func = syscalls[re->eax];
re->eax = func(re->ebx, re->ecx, re->edx, re->esi, re->edi);
}
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/devicefarm/DeviceFarm_EXPORTS.h>
#include <aws/devicefarm/model/DevicePool.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace DeviceFarm
{
namespace Model
{
/**
* <p>Represents the result of a create device pool request.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/devicefarm-2015-06-23/CreateDevicePoolResult">AWS
* API Reference</a></p>
*/
class AWS_DEVICEFARM_API CreateDevicePoolResult
{
public:
CreateDevicePoolResult();
CreateDevicePoolResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
CreateDevicePoolResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The newly created device pool.</p>
*/
inline const DevicePool& GetDevicePool() const{ return m_devicePool; }
/**
* <p>The newly created device pool.</p>
*/
inline void SetDevicePool(const DevicePool& value) { m_devicePool = value; }
/**
* <p>The newly created device pool.</p>
*/
inline void SetDevicePool(DevicePool&& value) { m_devicePool = std::move(value); }
/**
* <p>The newly created device pool.</p>
*/
inline CreateDevicePoolResult& WithDevicePool(const DevicePool& value) { SetDevicePool(value); return *this;}
/**
* <p>The newly created device pool.</p>
*/
inline CreateDevicePoolResult& WithDevicePool(DevicePool&& value) { SetDevicePool(std::move(value)); return *this;}
private:
DevicePool m_devicePool;
};
} // namespace Model
} // namespace DeviceFarm
} // namespace Aws
|
/**
******************************************************************************
* @file usbh_hid_keybd.h
* @author MCD Application Team
* @version V2.1.0
* @date 19-March-2012
* @brief This file contains all the prototypes for the usbh_hid_keybd.c
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive -----------------------------------------------*/
#ifndef __USBH_HID_KEYBD_H
#define __USBH_HID_KEYBD_H
/* Includes ------------------------------------------------------------------*/
#include "usb_conf.h"
#include "usbh_hid_core.h"
/** @addtogroup USBH_LIB
* @{
*/
/** @addtogroup USBH_CLASS
* @{
*/
/** @addtogroup USBH_HID_CLASS
* @{
*/
/** @defgroup USBH_HID_KEYBD
* @brief This file is the Header file for USBH_HID_KEYBD.c
* @{
*/
/** @defgroup USBH_HID_KEYBD_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup USBH_HID_KEYBD_Exported_Defines
* @{
*/
//#define QWERTY_KEYBOARD
#define AZERTY_KEYBOARD
#define KBD_LEFT_CTRL 0x01
#define KBD_LEFT_SHIFT 0x02
#define KBD_LEFT_ALT 0x04
#define KBD_LEFT_GUI 0x08
#define KBD_RIGHT_CTRL 0x10
#define KBD_RIGHT_SHIFT 0x20
#define KBD_RIGHT_ALT 0x40
#define KBD_RIGHT_GUI 0x80
#define KBR_MAX_NBR_PRESSED 6
/**
* @}
*/
/** @defgroup USBH_HID_KEYBD_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup USBH_HID_KEYBD_Exported_Variables
* @{
*/
extern HID_cb_TypeDef HID_KEYBRD_cb;
/**
* @}
*/
/** @defgroup USBH_HID_KEYBD_Exported_FunctionsPrototype
* @{
*/
void USR_KEYBRD_Init(void);
void USR_KEYBRD_ProcessData(uint8_t pbuf);
/**
* @}
*/
#endif /* __USBH_HID_KEYBD_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
#ifndef ALI_CMS_BATCH_CREATE_METRICS_TYPESH
#define ALI_CMS_BATCH_CREATE_METRICS_TYPESH
#include <stdio.h>
#include <string>
#include <vector>
namespace aliyun {
struct CmsBatchCreateMetricsRequestType {
std::string project_name;
std::string metric_stream_name;
std::string sqls;
};
struct CmsBatchCreateMetricsResponseType {
std::string code;
std::string message;
std::string success;
std::string trace_id;
std::string result;
};
} // end namespace
#endif
|
// @@@ START COPYRIGHT @@@
//
// 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.
//
// @@@ END COPYRIGHT @@@
#ifndef TMLIB_H_
#define TMLIB_H_
#include <jni.h>
#include "dtm/tmtransaction.h"
#include "tmmap.h"
#include "tmlibmsg.h"
#include "tmlibtxn.h"
#include "tmlibglobal.h"
#include "tmseqnum.h"
#include "javaobjectinterfacetm.h"
//
// TM handle information
//
typedef struct _tmlib_h_as_0 {
TPT_DECL (iv_phandle);
int32 iv_pid;
short iv_open;
} tmlib_tmhandle;
extern __thread JNIEnv* _tlp_jenv;
extern __thread bool _tlv_jenv_set;
//
// process specific information
//
extern bool gv_tmlib_initialized;
class TMLIB : public JavaObjectInterfaceTM
{
private:
TRANSACTION_DISTRIBUTION iv_txn_distribute;
int iv_next_nid;
int iv_node_count;
uint32 iv_next_tag;
TM_MAP iv_tm_table;
tmlib_tmhandle ia_tm_phandle[MAX_NODES];
bool ia_is_enlisted[MAX_NODES];
bool iv_initialized;
CtmSeqNum *ip_seqNum;
int32 iv_seqNum_blockSize;
bool iv_localBegin;
// JNI interface
char rminterface_classname[1024];
char hbasetxclient_classname[1024];
enum JAVA_METHODS {
//
JM_CTOR= 0,
JM_INIT1,
JM_ABORT,
JM_TRYCOMMIT,
JM_LAST_HBASETXCLIENT,
//RMInterface
JM_CLEARTRANSACTIONSTATES,
JM_LAST
};
JavaMethodInit TMLibJavaMethods_[JM_LAST];
static jclass javaClass_;
jclass iv_RMInterface_class;
bool iv_enableCleanupRMInterface;
short setupJNI();
public:
TMLIB();
~TMLIB(){}
// not needed right now TM_Mutex iv_mutex_tm;
// the following members are not covered under mutex
// they are only modified a single time'
int iv_tm_pid; // Only used for non-transactional requests
int iv_my_nid;
int iv_my_pid;
// methods
short add_or_update(TM_Transid pv_transid, bool pv_can_end = false,
int pv_tag = -1);
short add_or_update(TM_Transid pv_transid, TM_Transseq_Type pv_startid,
bool pv_can_end = false, int pv_tag = -1);
bool clear_entry (TM_Transid pv_transid, bool pv_server, /*bool pv_suspend,*/
bool pv_force = true);
bool is_enlisted (int32 pv_node) {return ia_is_enlisted[pv_node];}
void enlist (int32 pv_node) {ia_is_enlisted[pv_node] = true;}
bool reinstate_tx(TM_Transid *pv_transid, bool pv_settx = false);
void initialize();
bool is_initialized() {return iv_initialized;}
void is_initialized(bool pv_init) {iv_initialized = pv_init;}
void initJNI(); // Used only when a JNI connection is needed
CtmSeqNum *seqNum() {return ip_seqNum;}
bool localBegin() {return iv_localBegin;}
void localBegin(bool pv_localBegin) {iv_localBegin=pv_localBegin;}
int32 seqNum_blockSize() {return iv_seqNum_blockSize;}
void seqNum_blockSize(int32 pv_blockSize) {iv_seqNum_blockSize=pv_blockSize;}
bool enableCleanupRMInterface() {return iv_enableCleanupRMInterface;}
void enableCleanupRMInterface(bool pv_bool) {iv_enableCleanupRMInterface=pv_bool;}
bool open_tm(int pv_node, bool pv_startup = false);
short send_tm(Tm_Req_Msg_Type *pp_req, Tm_Rsp_Msg_Type *pp_rsp,
int pv_node);
short send_tm_link(char *pp_req, int buffer_size, Tm_Rsp_Msg_Type *pp_rsp,
int pv_node);
// table get methods
bool phandle_get ( TPT_PTR (pv_phandle), int pv_node);
void phandle_set ( TPT_PTR (pa_phandle), int pv_node);
int beginner_nid();
unsigned int new_tag();
// Local transaction methods
short initConnection(short pv_nid);
short abortTransactionLocal(long transactionID);
short endTransactionLocal(long transactionID);
void cleanupTransactionLocal(long transactionID);
bool close_tm();
};
// helper methods, C style
int tmlib_init_req_hdr(short req_type, Tm_Req_Msg_Type *pp_req);
short tmlib_check_active_tx ( );
short tmlib_check_miss_param( void * pp_param);
short tmlib_send_suspend(TM_Transid pv_transid, bool pv_coord_role, int pv_pid);
short tmlib_check_outstanding_ios();
short HBasetoTxnError(short pv_HBerr);
//extern TMLIB_ThreadTxn_Object gp_trans_thr;
extern __thread TMLIB_ThreadTxn_Object *gp_trans_thr;
extern TMLIB gv_tmlib;
#endif
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2022 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Achim Brandt
/// @author Dr. Frank Celler
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <iosfwd>
#include "Basics/operating-system.h"
#ifdef _WIN32
#undef DEBUG
#endif
namespace arangodb {
enum class LogLevel {
DEFAULT = 0,
FATAL = 1,
ERR = 2,
WARN = 3,
INFO = 4,
DEBUG = 5,
TRACE = 6
};
}
std::ostream& operator<<(std::ostream&, arangodb::LogLevel);
|
#ifndef JACKUTILITY_H_
#define JACKUTILITY_H_
int endsWith(const char *str, const char *suffix);
char *filenameFromFinpath(char *finpath);
#endif // JACKUTILITY_H_ |
//
// NSObject+CRBoost.h
// ECO
//
// Created by RoundTu on 12/27/13.
// Copyright (c) 2013 Cocoa. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#pragma mark -
#pragma mark NSObject
@interface NSObject (CRBoost)
- (void)tryMethod:(SEL)sel;
- (void)tryMethod:(SEL)sel arg:(id)arg;
- (void)tryMethod:(SEL)sel arg:(id)arg1 arg:(id)arg2;
- (id)nullToNil;
@end
#pragma mark -
#pragma mark NSString
extern NSString *const kPathFlagRetina;
extern NSString *const kPathFlagBig;
extern NSString *const kPathFlagHighlighted;
extern NSString *const kPathFlagSelected;
@interface NSString (CRBoost)
+ (NSString *)stringWithNumber:(NSInteger)number padding:(int)padding;
- (NSAttributedString *)underlineAttributeString;
- (NSString *)pathByAppendingFlag:(NSString *)flag; //appending between file name and extension
- (NSString *)join:(NSString *)path;
- (NSString *)joinExt:(NSString *)ext;
- (NSString *)joinPath:(NSString *)path;
- (NSString *)joinPath:(NSString *)path1 path:(NSString *)path2;
- (NSString *)deleteLastPathComponent;
- (NSString *)deletePathExtension;
- (BOOL)beginWith:(NSString *)string;
- (BOOL)endWith:(NSString *)string;
- (BOOL)containsString:(NSString *)aString;
#pragma --mark Path
+(CGPathRef)pathRefFromText:(NSString *)text animation:(BOOL)animated;
#pragma --mark MD%
+(NSString*)getMD5WithData:(NSData*)data;
+(NSString*)getmd5WithString:(NSString*)string;
+ (NSString*)getmd5_16WithString:(NSString *)string;
+(NSString*)getFileMD5WithPath:(NSString*)path;
+(BOOL) isDBNull:(id)value;
+(NSString *) valueToString:(id)value;
+(NSDate*) valueToDate:(id)value;
+(id) dateToValue: (NSDate *) date;
- (NSString *)decodeHTMLCharacterEntities;
- (NSString *)encodeHTMLCharacterEntities;
#pragma --mark URLEncode
+ (NSString *)StringEncode:(NSString*)str;
+ (NSString *)StringDecode:(NSString*)str;
+ (NSString *)URLEncode:(NSString*)baseUrl data:(NSDictionary*)dictionary;
+ (NSArray *)URLDecode:(NSString *)url;
+ (NSString*)getTimeString:(NSDate*)date;
@end
#pragma mark -
#pragma mark NSDate
/**
* date formatter
*
* date format
* 0: no separator
* 1: use '/' as separator
* 2: use '-' as separator
*
* time format
* 0: use ':' as separator
*/
static NSString *const kDateTemplate0yyyyMMdd = @"yyyyMMdd";
static NSString *const kDateTemplate0hmma = @"h:mm a";
static NSString *const kDateTemplate1MMddyyyy = @"MM/dd/yyyy";
static NSString *const kDateTemplate1MMddyy = @"MM/dd/yy";
static NSString *const kDateTemplate1ddMMyyyy0HHmmss = @"dd/MM/yyyy HH:mm:ss";
static NSString *const kDateTemplate1ddMMyyyy0HHmm = @"dd/MM/yyyy HH:mm";
static NSString *const kDateTemplate1ddMM0HHmm = @"dd/MM HH:mm";
static NSString *const kDateTemplate2MMddyyyy = @"MM-dd-yyyy";
static NSString *const kDateTemplate2yyyyMMdd0HHmmss = @"yyyy-MM-dd HH:mm:ss";
static NSString *const kDateTemplate2yyyyMMdd0HHmm = @"yyyy-MM-dd HH:mm";
static NSString *const kDateTemplate2yyyyMMdd0HHmmssZZZ = @"yyyy-MM-dd HH:mm:ss ZZZ";
@interface NSDate (CRBoost)
+ (NSDate *)dateWithinYear;
+ (NSDate *)dateWithTimeIntervalSince1970Number:(NSNumber *)number;
+ (NSDate *)dateWithTimeIntervalSince1970String:(NSString *)string;
+ (NSDate *)dateWithString:(NSString *)date template:(NSString *)tmplate;
- (NSString *)stringWithTemplate:(NSString *)tmplate;
- (NSString *)timeIntervalSince1970String;
- (NSNumber *)timeIntervalSince1970Number;
- (BOOL)isSameDay:(NSDate *)date;
@end
#pragma mark -
#pragma mark NSMutableDictionary
@interface NSMutableDictionary (CRBoost)
- (void)safeSetObject:(id)obj forKey:(id<NSCopying>)key;
@end
#pragma mark -
#pragma mark NSMutableArray
@interface NSArray (CRBoost)
- (id)safeObjectAtIndex:(NSInteger)index;
@end
#pragma mark -
#pragma mark NSMutableArray
@interface NSMutableArray (CRBoost)
- (void)safeAddObject:(id)obj;
@end
#pragma mark -
#pragma mark NSAttributedString
@interface NSAttributedString (CRBoost)
+ (instancetype)stringWithJSON:(id)json;
+ (instancetype)stringWithJSONString:(NSString *)string;
+ (instancetype)stringWithString:(NSString *)string attribute:(NSString *)attribute;
- (id)dumpJSON;
- (id)attributeJSON; //dump only the attribte to json
- (NSString *)jsonString;
- (NSString *)attributeString; //json like
@end;
#pragma mark -
#pragma mark NSMutableAttributedString
@interface NSMutableAttributedString (CRBoost)
@end
|
/*
* Copyright (c) 2014-2015, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* output.h -- declarations of output printing related functions
*/
#include <uuid/uuid.h>
#include <time.h>
#include <stdint.h>
#include <stdio.h>
void out_set_vlevel(int vlevel);
void out_set_stream(FILE *stream);
void out_set_prefix(const char *prefix);
void out_set_col_width(unsigned int col_width);
void outv_err(const char *fmt, ...);
void out_err(const char *file, int line, const char *func,
const char *fmt, ...);
void outv_err_vargs(const char *fmt, va_list ap);
void out_indent(int i);
void outv(int vlevel, const char *fmt, ...);
void outv_nl(int vlevel);
int outv_check(int vlevel);
void outv_title(int vlevel, const char *fmt, ...);
void outv_field(int vlevel, const char *field, const char *fmt, ...);
void outv_hexdump(int vlevel, const void *addr, size_t len, size_t offset,
int sep);
const char *out_get_uuid_str(uuid_t uuid);
const char *out_get_time_str(time_t time);
const char *out_get_size_str(uint64_t size, int human);
const char *out_get_percentage(double percentage);
const char *out_get_checksum(void *addr, size_t len, uint64_t *csump);
const char *out_get_btt_map_entry(uint32_t map);
const char *out_get_pool_type_str(pmem_pool_type_t type);
const char *out_get_pool_signature(pmem_pool_type_t type);
const char *out_get_lane_section_str(enum lane_section_type type);
const char *out_get_tx_state_str(uint64_t state);
const char *out_get_chunk_type_str(enum chunk_type type);
const char *out_get_chunk_flags(uint16_t flags);
const char *out_get_zone_magic_str(uint32_t magic);
const char *out_get_pmemoid_str(PMEMoid oid, uint64_t uuid_lo);
const char *out_get_internal_type_str(enum internal_type type);
const char *out_get_ei_class_str(uint8_t ei_class);
const char *out_get_ei_data_str(uint8_t ei_class);
const char *out_get_e_machine_str(uint16_t e_machine);
const char *out_get_alignment_desc_str(uint64_t ad, uint64_t cur_ad);
|
/**
* 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 H_BSP_H
#define H_BSP_H
#include <inttypes.h>
#include <mcu/mcu.h>
#include "os/mynewt.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Define special stackos sections */
#define sec_data_core __attribute__((section(".data.core")))
#define sec_bss_core __attribute__((section(".bss.core")))
#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))
/* More convenient section placement macros. */
#define bssnz_t sec_bss_nz_core
/*
* Symbols from linker script.
*/
extern uint8_t _ram_start;
#define RAM_SIZE (16 *1024)
/* LED pins */
#define LED_BLINK_PIN MCU_GPIO_PORTA(5)
/* Button pin */
#define BUTTON_1 MCU_GPIO_PORTC(13)
/* Arduino pins */
#define ARDUINO_PIN_D0 MCU_GPIO_PORTA(3)
#define ARDUINO_PIN_D1 MCU_GPIO_PORTA(2)
#define ARDUINO_PIN_D2 MCU_GPIO_PORTA(10)
#define ARDUINO_PIN_D3 MCU_GPIO_PORTB(3)
#define ARDUINO_PIN_D4 MCU_GPIO_PORTB(5)
#define ARDUINO_PIN_D5 MCU_GPIO_PORTB(4)
#define ARDUINO_PIN_D6 MCU_GPIO_PORTB(10)
#define ARDUINO_PIN_D7 MCU_GPIO_PORTA(8)
#define ARDUINO_PIN_D8 MCU_GPIO_PORTA(9)
#define ARDUINO_PIN_D9 MCU_GPIO_PORTC(7)
#define ARDUINO_PIN_D10 MCU_GPIO_PORTB(6)
#define ARDUINO_PIN_D11 MCU_GPIO_PORTA(7)
#define ARDUINO_PIN_D12 MCU_GPIO_PORTA(6)
#define ARDUINO_PIN_D13 MCU_GPIO_PORTA(5)
#define ARDUINO_PIN_A0 MCU_GPIO_PORTA(0)
#define ARDUINO_PIN_A1 MCU_GPIO_PORTA(1)
#define ARDUINO_PIN_A2 MCU_GPIO_PORTA(4)
#define ARDUINO_PIN_A3 MCU_GPIO_PORTB(0)
#define ARDUINO_PIN_A4 MCU_GPIO_PORTC(1)
#define ARDUINO_PIN_A5 MCU_GPIO_PORTC(0)
#define ARDUINO_PIN_RX ARDUINO_PIN_D0
#define ARDUINO_PIN_TX ARDUINO_PIN_D1
#define ARDUINO_PIN_SCL MCU_GPIO_PORTB(8)
#define ARDUINO_PIN_SDA MCU_GPIO_PORTB(9)
#define ARDUINO_PIN_SCK ARDUINO_PIN_D13
#define ARDUINO_PIN_MOSI ARDUINO_PIN_D11
#define ARDUINO_PIN_MISO ARDUINO_PIN_D12
#ifdef __cplusplus
}
#endif
#endif /* H_BSP_H */
|
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. */
#pragma once
#include <string>
#include "paddle/fluid/framework/ir/fuse_pass_base.h"
#include "paddle/fluid/framework/ir/graph.h"
#include "paddle/fluid/framework/ir/graph_pattern_detector.h"
namespace paddle {
namespace framework {
namespace ir {
/**
* Fuse Repeated FC Relu
*/
class Graph;
class RepeatedFCReluFusePass : public FusePassBase {
public:
RepeatedFCReluFusePass();
protected:
void ApplyImpl(ir::Graph* graph) const override;
const std::string name_scope_{"repeated_fc_relu_fuse"};
private:
int BuildFusion(Graph* graph, const std::string& name_scope,
int num_fc) const;
};
} // namespace ir
} // namespace framework
} // namespace paddle
|
/*
* idedsk.h -- IDE disk definitions
*/
#ifndef _IDEDSK_H_
#define _IDEDSK_H_
#define SECTOR_SIZE 512
#define WPS (SECTOR_SIZE / sizeof(unsigned int))
#define DISK_BASE ((unsigned *) 0xF0400000) /* disk base address */
#define DISK_CTRL (DISK_BASE + 0) /* control/status register */
#define DISK_CNT (DISK_BASE + 1) /* sector count register */
#define DISK_SCT (DISK_BASE + 2) /* disk sector register */
#define DISK_CAP (DISK_BASE + 3) /* disk capacity register */
#define DISK_BUFFER ((unsigned *) 0xF0480000) /* address of disk buffer */
#define DISK_CTRL_STRT 0x01 /* a 1 written here starts the disk command */
#define DISK_CTRL_IEN 0x02 /* enable disk interrupt */
#define DISK_CTRL_WRT 0x04 /* command type: 0 = read, 1 = write */
#define DISK_CTRL_ERR 0x08 /* 0 = ok, 1 = error; valid when DONE = 1 */
#define DISK_CTRL_DONE 0x10 /* 1 = disk has finished the command */
#define DISK_CTRL_READY 0x20 /* 1 = capacity valid, disk accepts command */
#define DISK_IRQ 8 /* disk interrupt number */
#define READY_RETRIES 1000000 /* retries to wait for disk to get ready */
#endif /* _IDEDSK_H_ */
|
/*
* Copyright (C) 2006 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id: load_url.c,v 1.1.2.1 2006/08/25 21:13:04 darrenr Exp $
*/
#include "ipf.h"
alist_t *
load_url(char *url)
{
alist_t *hosts = NULL;
if (strncmp(url, "file://", 7) == 0) {
/*
* file:///etc/passwd
* ^------------s
*/
hosts = load_file(url);
} else if (*url == '/' || *url == '.') {
hosts = load_file(url);
} else if (strncmp(url, "http://", 7) == 0) {
hosts = load_http(url);
}
return hosts;
}
|
#pragma once
#include <cstdint>
#include <array>
#include <limits>
namespace rc {
/// Implementation of a splittable random generator as described in:
/// Claessen, K. och Palka, M. (2013) Splittable Pseudorandom Number
/// Generators using Cryptographic Hashing.
class Random {
friend bool operator==(const Random &lhs, const Random &rhs);
friend bool operator<(const Random &lhs, const Random &rhs);
friend std::ostream &operator<<(std::ostream &os, const Random &random);
public:
/// Key type
using Key = std::array<uint64_t, 4>;
/// Type of a generated random number.
using Number = uint64_t;
/// Constructs a Random engine with a `{0, 0, 0, 0}` key.
Random();
/// Constructs a Random engine from a full size 256-bit key.
Random(const Key &key);
/// Constructs a Random engine from a 64-bit seed.
Random(uint64_t seed);
/// Splits this generator into to separate independent generators. The first
/// generator will be assigned to this one and the second will be returned.
Random split();
/// Returns the next random number. Both `split` and `next` should not be
/// called on the same state.
Number next();
private:
using Block = std::array<uint64_t, 4>;
using Bits = uint64_t;
static constexpr auto kBits = std::numeric_limits<Bits>::digits;
using Counter = uint64_t;
static constexpr auto kCounterMax = std::numeric_limits<Counter>::max();
void append(bool x);
void mash(Block &output);
Block m_key;
Block m_block;
Bits m_bits;
Counter m_counter;
uint8_t m_bitsi;
};
bool operator!=(const Random &lhs, const Random &rhs);
} // namespace rc
namespace std {
template <>
struct hash<rc::Random> {
using argument_type = rc::Random;
using result_type = std::size_t;
std::size_t operator()(const rc::Random &r) const {
return static_cast<std::size_t>(rc::Random(r).next());
}
};
} // namespace std
|
/*-
* Copyright (c) 2009, Nathan Whitehorn <nwhitehorn@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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/sys/dev/ofw/ofw_iicbus.c 240371 2012-08-15 03:33:57Z gonzo $");
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <dev/fdt/fdt_common.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/openfirm.h>
#include "iicbus_if.h"
/* Methods */
static device_probe_t ofw_iicbus_probe;
static device_attach_t ofw_iicbus_attach;
static device_t ofw_iicbus_add_child(device_t dev, u_int order,
const char *name, int unit);
static const struct ofw_bus_devinfo *ofw_iicbus_get_devinfo(device_t bus,
device_t dev);
static device_method_t ofw_iicbus_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, ofw_iicbus_probe),
DEVMETHOD(device_attach, ofw_iicbus_attach),
/* Bus interface */
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
DEVMETHOD(bus_add_child, ofw_iicbus_add_child),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, ofw_iicbus_get_devinfo),
DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
DEVMETHOD_END
};
struct ofw_iicbus_devinfo {
struct iicbus_ivar opd_dinfo;
struct ofw_bus_devinfo opd_obdinfo;
};
static devclass_t ofwiicbus_devclass;
DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods,
sizeof(struct iicbus_softc), iicbus_driver);
DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0);
MODULE_VERSION(ofw_iicbus, 1);
MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1);
static int
ofw_iicbus_probe(device_t dev)
{
if (ofw_bus_get_node(dev) == -1)
return (ENXIO);
device_set_desc(dev, "OFW I2C bus");
return (0);
}
static int
ofw_iicbus_attach(device_t dev)
{
struct iicbus_softc *sc = IICBUS_SOFTC(dev);
struct ofw_iicbus_devinfo *dinfo;
phandle_t child;
pcell_t paddr;
device_t childdev;
uint32_t addr;
sc->dev = dev;
mtx_init(&sc->lock, "iicbus", NULL, MTX_DEF);
iicbus_reset(dev, IIC_FASTEST, 0, NULL);
bus_generic_probe(dev);
bus_enumerate_hinted_children(dev);
/*
* Attach those children represented in the device tree.
*/
for (child = OF_child(ofw_bus_get_node(dev)); child != 0;
child = OF_peer(child)) {
/*
* Try to get the I2C address first from the i2c-address
* property, then try the reg property. It moves around
* on different systems.
*/
if (OF_getprop(child, "i2c-address", &paddr, sizeof(paddr)) == -1)
if (OF_getprop(child, "reg", &paddr, sizeof(paddr)) == -1)
continue;
addr = fdt32_to_cpu(paddr);
/*
* Now set up the I2C and OFW bus layer devinfo and add it
* to the bus.
*/
dinfo = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (dinfo == NULL)
continue;
dinfo->opd_dinfo.addr = addr;
if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
continue;
}
childdev = device_add_child(dev, NULL, -1);
device_set_ivars(childdev, dinfo);
}
return (bus_generic_attach(dev));
}
static device_t
ofw_iicbus_add_child(device_t dev, u_int order, const char *name, int unit)
{
device_t child;
struct ofw_iicbus_devinfo *devi;
child = device_add_child_ordered(dev, order, name, unit);
if (child == NULL)
return (child);
devi = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (devi == NULL) {
device_delete_child(dev, child);
return (0);
}
/*
* NULL all the OFW-related parts of the ivars for non-OFW
* children.
*/
devi->opd_obdinfo.obd_node = -1;
devi->opd_obdinfo.obd_name = NULL;
devi->opd_obdinfo.obd_compat = NULL;
devi->opd_obdinfo.obd_type = NULL;
devi->opd_obdinfo.obd_model = NULL;
device_set_ivars(child, devi);
return (child);
}
static const struct ofw_bus_devinfo *
ofw_iicbus_get_devinfo(device_t bus, device_t dev)
{
struct ofw_iicbus_devinfo *dinfo;
dinfo = device_get_ivars(dev);
return (&dinfo->opd_obdinfo);
}
|
#ifndef _UI_FILTERS_H_
#define _UI_FILTERS_H_
#ifndef TEAM_H
#include "team.h"
#endif
#ifndef MISGROUP_H
#include "package.h"
#endif
#define _MAX_TEAMS_ (NUM_TEAMS) // (8) Kevin only has 7 defined
#define _MAX_DIRECTIONS_ (8)
#define _MIN_ZOOM_LEVEL_ (1)
#define _MAX_ZOOM_LEVEL_ (32)
#define I_NEED_TO_DRAW (0x01)
#define I_NEED_TO_DRAW_MAP (0x02)
#define _MAP_NUM_OBJ_TYPES_ (14)
#define _MAP_NUM_AIR_TYPES_ (5)
#define _MAP_NUM_GND_TYPES_ (4)
#define _MAP_NUM_GND_LEVELS_ (3)
#define _MAP_NUM_NAV_TYPES_ (2)
#define _MAP_NUM_THREAT_TYPES_ (4)
#define NUM_BE_LINES (6)
#define NUM_BE_CIRCLES (6)
enum // Objective Filter Types
{
_OBTV_AIR_DEFENSE = 0x00000001,
_OBTV_AIR_FIELDS = 0x00000002,
_OBTV_ARMY = 0x00000004,
_OBTV_CCC = 0x00000008,
_OBTV_INFRASTRUCTURE = 0x00000010,
_OBTV_LOGISTICS = 0x00000020,
_OBTV_OTHER = 0x00000040,
_OBTV_NAVIGATION = 0x00000080,
_OBTV_POLITICAL = 0x00000100,
_OBTV_WAR_PRODUCTION = 0x00000200,
_OBTV_NAVAL = 0x00000400,
_UNIT_SQUADRON = 0x00000800,
_UNIT_PACKAGE = 0x00001000,
_VC_CONDITION_ = 0x00002000,
};
enum
{
_UNIT_AIR_DEFENSE = 0x00000001,
_UNIT_COMBAT = 0x00000002,
_UNIT_SUPPORT = 0x00000004,
_UNIT_ARTILLERY = 0x00000008,
_UNIT_ATTACK = 0x00000010,
_UNIT_HELICOPTER = 0x00000020,
_UNIT_BOMBER = 0x00000040,
_UNIT_FIGHTER = 0x00000080,
_UNIT_BATTALION = 0x01000000,
_UNIT_BRIGADE = 0x02000000,
_UNIT_DIVISION = 0x04000000,
_UNIT_NAVAL = 0x08000000,
_UNIT_GROUND_MASK = 0x07000000,
_UNIT_NAVAL_MASK = 0x08000000,
};
enum
{
OOB_AIRFORCE =0x00010000,
OOB_ARMY =0x00020000,
OOB_NAVY =0x00040000,
OOB_OBJECTIVE =0x00080000,
OOB_TEAM_MASK =0xff000000,
};
enum
{
_THR_SAM_LOW =0x01,
_THR_SAM_HIGH =0x02,
_THR_RADAR_LOW =0x04,
_THR_RADAR_HIGH =0x08,
};
enum
{
_THREAT_SAM_LOW_=0,
_THREAT_SAM_HIGH_,
_THREAT_RADAR_LOW_,
_THREAT_RADAR_HIGH_,
};
enum // Ship/Air Unit Icon IDs
{
TGT_CUR =10501,
TGT_CUR_SEL =10502,
TGT_CUR_ERROR =10503,
IP_CUR =10504,
IP_CUR_SEL =10505,
IP_CUR_ERROR =10506,
STPT_CUR =10507,
STPT_CUR_SEL =10508,
STPT_CUR_ERROR =10509,
TGT_OTR =10510,
TGT_OTR_SEL =10511,
TGT_OTR_OTHER =10512,
IP_OTR =10513,
IP_OTR_SEL =10514,
IP_OTR_OTHER =10515,
STPT_OTR =10516,
STPT_OTR_SEL =10517,
STPT_OTR_OTHER =10518,
ASSIGNED_TGT_CUR =10519,
HOME_BASE_CUR =10520,
ADDLINE_CUR =10521,
ADDLINE_CUR_SEL =10522,
};
typedef struct
{
char Domain;
char Class;
char Type;
char SubType;
long UIType;
long OOBCategory;
} FILTER_TABLE;
typedef struct
{
char SubType;
long IconID[3]; // 0=Friendly,1=Enemy,2=Neutral
long UIType;
} AIR_ICONS;
extern FILTER_TABLE ObjectiveFilters[];
extern FILTER_TABLE UnitFilters[];
extern AIR_ICONS AirIcons[];
extern long OBJ_TypeList[_MAP_NUM_OBJ_TYPES_];
extern long NAV_TypeList[_MAP_NUM_NAV_TYPES_];
extern long AIR_TypeList[_MAP_NUM_AIR_TYPES_];
extern long GND_TypeList[_MAP_NUM_GND_TYPES_];
extern long GND_LevelList[_MAP_NUM_GND_LEVELS_];
extern long THR_TypeList[_MAP_NUM_THREAT_TYPES_];
extern float BullsEyeLines[NUM_BE_LINES][4];
extern float BullsEyeRadius[NUM_BE_CIRCLES];
long FindTypeIndex(long type,long TypeList[],int size);
long FindObjectiveIndex(Objective Obj);
long GetObjectiveType(CampBaseClass *ent);
long GetObjectiveCategory(Objective Obj);
long GetAirIcon(uchar STYPE);
long FindDivisionType(uchar type);
long FindUnitType(Unit unit);
long FindUnitCategory(Unit unit);
#endif
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_OWNER_IMPL_H_
#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_OWNER_IMPL_H_
#include "base/scoped_observation.h"
#include "base/token.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_view.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/widget/widget_observer.h"
// FeaturePromoBubbleOwner that creates a production FeaturePromoBubbleView.
class FeaturePromoBubbleOwnerImpl : public FeaturePromoBubbleOwner,
views::WidgetObserver {
public:
FeaturePromoBubbleOwnerImpl();
~FeaturePromoBubbleOwnerImpl() override;
static FeaturePromoBubbleOwnerImpl* GetInstance();
// Attempts to activate the bubble, if it's showing, or if it's already
// focused, attempts to focus the anchor view. Returns true if it was
// successful. Returns false if no bubble is showing or if focus cannot be
// toggled.
bool ToggleFocusForAccessibility();
// Checks if the bubble is a promo bubble.
bool IsPromoBubble(const views::DialogDelegate* bubble) const;
FeaturePromoBubbleView* bubble_for_testing() { return bubble_; }
// FeaturePromoBubbleOwner:
absl::optional<base::Token> ShowBubble(
FeaturePromoBubbleView::CreateParams params,
base::OnceClosure close_callback) override;
bool BubbleIsShowing(base::Token bubble_id) const override;
bool AnyBubbleIsShowing() const override;
void CloseBubble(base::Token bubble_id) override;
void NotifyAnchorBoundsChanged() override;
gfx::Rect GetBubbleBoundsInScreen(base::Token bubble_id) const override;
// views::WidgetObserver:
void OnWidgetClosing(views::Widget* widget) override;
void OnWidgetDestroying(views::Widget* widget) override;
private:
void HandleBubbleClosed();
// The currently showing bubble, or `nullptr`.
FeaturePromoBubbleView* bubble_ = nullptr;
// ID of the currently showing bubble. Must be nullopt if `bubble_` is null.
absl::optional<base::Token> bubble_id_;
// Called when `bubble_` closes.
base::OnceClosure close_callback_;
base::ScopedObservation<views::Widget, views::WidgetObserver>
widget_observation_{this};
};
#endif // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_OWNER_IMPL_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE369_Divide_by_Zero__int_rand_modulo_15.c
Label Definition File: CWE369_Divide_by_Zero__int.label.xml
Template File: sources-sinks-15.tmpl.c
*/
/*
* @description
* CWE: 369 Divide by Zero
* BadSource: rand Set data to result of rand(), which may be zero
* GoodSource: Non-zero
* Sinks: modulo
* GoodSink: Check for zero before modulo
* BadSink : Modulo a constant with data
* Flow Variant: 15 Control flow: switch(6) and switch(7)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE369_Divide_by_Zero__int_rand_modulo_15_bad()
{
int data;
/* Initialize data */
data = -1;
switch(6)
{
case 6:
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Possibly divide by zero */
printIntLine(100 % data);
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second switch to switch(8) */
static void goodB2G1()
{
int data;
/* Initialize data */
data = -1;
switch(6)
{
case 6:
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(8)
{
case 7:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: test for a zero denominator */
if( data != 0 )
{
printIntLine(100 % data);
}
else
{
printLine("This would result in a divide by zero");
}
break;
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second switch */
static void goodB2G2()
{
int data;
/* Initialize data */
data = -1;
switch(6)
{
case 6:
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* FIX: test for a zero denominator */
if( data != 0 )
{
printIntLine(100 % data);
}
else
{
printLine("This would result in a divide by zero");
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
/* goodG2B1() - use goodsource and badsink by changing the first switch to switch(5) */
static void goodG2B1()
{
int data;
/* Initialize data */
data = -1;
switch(5)
{
case 6:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: Use a value not equal to zero */
data = 7;
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Possibly divide by zero */
printIntLine(100 % data);
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first switch */
static void goodG2B2()
{
int data;
/* Initialize data */
data = -1;
switch(6)
{
case 6:
/* FIX: Use a value not equal to zero */
data = 7;
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Possibly divide by zero */
printIntLine(100 % data);
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
void CWE369_Divide_by_Zero__int_rand_modulo_15_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE369_Divide_by_Zero__int_rand_modulo_15_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE369_Divide_by_Zero__int_rand_modulo_15_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_fgets_multiply_65a.c
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-65a.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: fgets Read data from the console using fgets()
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: multiply
* GoodSink: Ensure there will not be an overflow before multiplying data by 2
* BadSink : If data is positive, multiply by 2, which can cause an overflow
* Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
*
* */
#include "std_testcase.h"
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
#ifndef OMITBAD
/* bad function declaration */
void CWE190_Integer_Overflow__int_fgets_multiply_65b_badSink(int data);
void CWE190_Integer_Overflow__int_fgets_multiply_65_bad()
{
int data;
/* define a function pointer */
void (*funcPtr) (int) = CWE190_Integer_Overflow__int_fgets_multiply_65b_badSink;
/* Initialize data */
data = 0;
{
char inputBuffer[CHAR_ARRAY_SIZE] = "";
/* POTENTIAL FLAW: Read data from the console using fgets() */
if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL)
{
/* Convert to int */
data = atoi(inputBuffer);
}
else
{
printLine("fgets() failed.");
}
}
/* use the function pointer */
funcPtr(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE190_Integer_Overflow__int_fgets_multiply_65b_goodG2BSink(int data);
static void goodG2B()
{
int data;
void (*funcPtr) (int) = CWE190_Integer_Overflow__int_fgets_multiply_65b_goodG2BSink;
/* Initialize data */
data = 0;
/* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
data = 2;
funcPtr(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE190_Integer_Overflow__int_fgets_multiply_65b_goodB2GSink(int data);
static void goodB2G()
{
int data;
void (*funcPtr) (int) = CWE190_Integer_Overflow__int_fgets_multiply_65b_goodB2GSink;
/* Initialize data */
data = 0;
{
char inputBuffer[CHAR_ARRAY_SIZE] = "";
/* POTENTIAL FLAW: Read data from the console using fgets() */
if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL)
{
/* Convert to int */
data = atoi(inputBuffer);
}
else
{
printLine("fgets() failed.");
}
}
funcPtr(data);
}
void CWE190_Integer_Overflow__int_fgets_multiply_65_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE190_Integer_Overflow__int_fgets_multiply_65_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE190_Integer_Overflow__int_fgets_multiply_65_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* $Id$ */
#ifndef HT_H
#define HT_H 1
struct hashtable {
int (*hash)(int i);
int (*equal)(int i1,int i2);
int tablen,used,limit;
int *table;
};
extern void ht_init(struct hashtable *ht,int len,int (*hash)(int),int (*equal)(int,int));
extern void ht_clear(struct hashtable *ht);
extern void ht_dispose(struct hashtable *ht);
extern int ht_get(struct hashtable *ht,int i);
extern void ht_put(struct hashtable *ht,int i);
extern int ht_del(struct hashtable *ht,int i);
extern int ht_deli(struct hashtable *ht,int i); /* delete only if i refers to itself */
#endif
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2017. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <list>
#include <string>
#include <vector>
#include "Commands/Command.h"
#include "Commands/CommandGroupEntry.h"
namespace frc {
/**
* A {@link CommandGroup} is a list of commands which are executed in sequence.
*
* <p>Commands in a {@link CommandGroup} are added using the {@link
* CommandGroup#AddSequential(Command) AddSequential(...)} method and are
* called sequentially. {@link CommandGroup CommandGroups} are themselves
* {@link Command Commands} and can be given to other
* {@link CommandGroup CommandGroups}.</p>
*
* <p>{@link CommandGroup CommandGroups} will carry all of the requirements of
* their {@link Command subcommands}. Additional requirements can be specified
* by calling {@link CommandGroup#Requires(Subsystem) Requires(...)} normally
* in the constructor.</P>
*
* <p>CommandGroups can also execute commands in parallel, simply by adding them
* using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.</p>
*
* @see Command
* @see Subsystem
*/
class CommandGroup : public Command {
public:
CommandGroup() = default;
explicit CommandGroup(const std::string& name);
virtual ~CommandGroup() = default;
void AddSequential(Command* command);
void AddSequential(Command* command, double timeout);
void AddParallel(Command* command);
void AddParallel(Command* command, double timeout);
bool IsInterruptible() const;
int GetSize() const;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
virtual void _Initialize();
virtual void _Interrupted();
virtual void _Execute();
virtual void _End();
private:
void CancelConflicts(Command* command);
/** The commands in this group (stored in entries) */
std::vector<CommandGroupEntry> m_commands;
/** The active children in this group (stored in entries) */
std::list<CommandGroupEntry> m_children;
/** The current command, -1 signifies that none have been run */
int m_currentCommandIndex = -1;
};
} // namespace frc
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include "jni.h"
/* Header for class com_certh_iti_haptics_NativePhantomManager */
#ifndef _Included_com_certh_iti_haptics_NativePhantomManager
#define _Included_com_certh_iti_haptics_NativePhantomManager
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: Initialize
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_Initialize
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: close
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_close
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: Update
* Signature: ()[F
*/
JNIEXPORT jfloatArray JNICALL Java_com_certh_iti_haptics_NativePhantomManager_Update
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: LoadModel
* Signature: (Ljava/lang/String;DDD)I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_LoadModel
(JNIEnv *, jclass, jstring, jdouble, jdouble, jdouble);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveModel
* Signature: (Ljava/lang/String;DDD)I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveModel
(JNIEnv *, jclass, jstring, jdouble, jdouble, jdouble);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: removeModel
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_removeModel
(JNIEnv *, jclass, jstring);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: increaseModelSize
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_increaseModelSize
(JNIEnv *, jclass, jstring);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: decreaseModelSize
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_decreaseModelSize
(JNIEnv *, jclass, jstring);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: clearModels
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_clearModels
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveMapLeft
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveMapLeft
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveMapRight
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveMapRight
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveMapUp
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveMapUp
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveMapDown
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveMapDown
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveMapForward
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveMapForward
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: moveMapBack
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_moveMapBack
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: testRotMatrix
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_testRotMatrix
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: getObjNameInCollisionWithPhantom
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_certh_iti_haptics_NativePhantomManager_getObjNameInCollisionWithPhantom
(JNIEnv *, jclass);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: resetPhantomPosition
* Signature: (DD)I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_resetPhantomPosition
(JNIEnv *, jclass, jdouble, jdouble);
/*
* Class: com_certh_iti_haptics_NativePhantomManager
* Method: createObj
* Signature: ([[DI[[IILjava/lang/String;DI[I[[I)I
*/
JNIEXPORT jint JNICALL Java_com_certh_iti_haptics_NativePhantomManager_createObj
(JNIEnv *, jclass, jobjectArray, jint, jobjectArray, jint, jstring, jdouble, jint, jintArray, jobjectArray);
#ifdef __cplusplus
}
#endif
#endif
|
#ifndef _PLOT_H_
#define _PLOT_H_
#include <qwt/qwt_plot.h>
#include <qwt/qwt_interval.h>
#include <qwt/qwt_system_clock.h>
#include <qwt/qwt_plot_curve.h>
class QwtPlotCurve;
class QwtPlotMarker;
class QwtPlotGrid;
class QwtPlotDirectPainter;
class SignalData;
class MyMagnifier;
class Plot: public QwtPlot
{
Q_OBJECT
public:
Plot(QWidget * = NULL);
virtual ~Plot();
enum AlignMode
{
RIGHT,
CENTER
};
void start();
void stop();
virtual void replot();
void addSignal(SignalData* signalData, QColor color);
void removeSignal(SignalData* signalData);
void setSignalVisible(SignalData* signalData, bool visible);
void setSignalColor(SignalData* signalData, QColor color);
double timeWindow();
void setEndTime(double endTime);
void moveCanvas(int dx, int dy);
void setBackgroundColor(QString color);
void setMarkerEnabled(bool enabled);
void setAlignMode(AlignMode mode);
bool isStopped();
void flagAxisSyncRequired();
void setPointSize(double pointSize);
void setCurveStyle(QwtPlotCurve::CurveStyle style);
signals:
void syncXAxisScale(double x0, double x1);
public Q_SLOTS:
void setTimeWindow(double);
void setYScale(double);
protected:
void updateTicks();
private:
void initBackground();
QwtPlotMarker *d_origin;
QwtPlotMarker *d_marker;
QwtPlotGrid *d_grid;
MyMagnifier *mMagnifier;
bool mStopped;
bool mAxisSyncRequired;
int mColorMode;
double mTimeWindow;
AlignMode mAlignMode;
QMap<SignalData*, QwtPlotCurve*> mSignals;
};
#endif
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CustomElementAttributeChangedCallbackReaction_h
#define CustomElementAttributeChangedCallbackReaction_h
#include "core/CoreExport.h"
#include "core/dom/QualifiedName.h"
#include "core/dom/custom/CustomElementReaction.h"
#include "platform/heap/Handle.h"
#include "wtf/Noncopyable.h"
namespace blink {
class CORE_EXPORT CustomElementAttributeChangedCallbackReaction final
: public CustomElementReaction {
WTF_MAKE_NONCOPYABLE(CustomElementAttributeChangedCallbackReaction);
public:
CustomElementAttributeChangedCallbackReaction(CustomElementDefinition*,
const QualifiedName&,
const AtomicString& oldValue, const AtomicString& newValue);
private:
void invoke(Element*) override;
QualifiedName m_name;
AtomicString m_oldValue;
AtomicString m_newValue;
};
} // namespace blink
#endif // CustomElementAttributeChangedCallbackReaction_h
|
#include "../../../../../hpc/include/platid_generated.h"
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE127_Buffer_Underread__wchar_t_alloca_cpy_54d.c
Label Definition File: CWE127_Buffer_Underread.stack.label.xml
Template File: sources-sink-54d.tmpl.c
*/
/*
* @description
* CWE: 127 Buffer Under-read
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sink: cpy
* BadSink : Copy data to string using wcscpy
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE127_Buffer_Underread__wchar_t_alloca_cpy_54e_badSink(wchar_t * data);
void CWE127_Buffer_Underread__wchar_t_alloca_cpy_54d_badSink(wchar_t * data)
{
CWE127_Buffer_Underread__wchar_t_alloca_cpy_54e_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE127_Buffer_Underread__wchar_t_alloca_cpy_54e_goodG2BSink(wchar_t * data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE127_Buffer_Underread__wchar_t_alloca_cpy_54d_goodG2BSink(wchar_t * data)
{
CWE127_Buffer_Underread__wchar_t_alloca_cpy_54e_goodG2BSink(data);
}
#endif /* OMITGOOD */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_memmove_53d.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml
Template File: sources-sink-53d.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: memmove
* BadSink : Copy int64_t array to data using memmove
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_memmove_53d_badSink(int64_t * data)
{
{
int64_t source[100] = {0}; /* fill with 0's */
/* POTENTIAL FLAW: Possible buffer overflow if data < 100 */
memmove(data, source, 100*sizeof(int64_t));
printLongLongLine(data[0]);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_memmove_53d_goodG2BSink(int64_t * data)
{
{
int64_t source[100] = {0}; /* fill with 0's */
/* POTENTIAL FLAW: Possible buffer overflow if data < 100 */
memmove(data, source, 100*sizeof(int64_t));
printLongLongLine(data[0]);
}
}
#endif /* OMITGOOD */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE617_Reachable_Assertion__connect_socket_63a.c
Label Definition File: CWE617_Reachable_Assertion.label.xml
Template File: sources-sink-63a.tmpl.c
*/
/*
* @description
* CWE: 617 Reachable Assertion
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Number greater than ASSERT_VALUE
* Sinks:
* BadSink : Assert if n is less than or equal to ASSERT_VALUE
* Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <assert.h>
#define ASSERT_VALUE 5
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
#ifndef OMITBAD
/* bad function declaration */
void CWE617_Reachable_Assertion__connect_socket_63b_badSink(int * dataPtr);
void CWE617_Reachable_Assertion__connect_socket_63_bad()
{
int data;
/* Initialize data */
data = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
data = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE617_Reachable_Assertion__connect_socket_63b_badSink(&data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE617_Reachable_Assertion__connect_socket_63b_goodG2BSink(int * data);
static void goodG2B()
{
int data;
/* Initialize data */
data = -1;
/* FIX: Use a value greater than the assert value */
data = ASSERT_VALUE+1;
CWE617_Reachable_Assertion__connect_socket_63b_goodG2BSink(&data);
}
void CWE617_Reachable_Assertion__connect_socket_63_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE617_Reachable_Assertion__connect_socket_63_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE617_Reachable_Assertion__connect_socket_63_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51a.c
Label Definition File: CWE404_Improper_Resource_Shutdown__w32CreateFile.label.xml
Template File: source-sinks-51a.tmpl.c
*/
/*
* @description
* CWE: 404 Improper Resource Shutdown or Release
* BadSource: Open a file using CreateFile()
* Sinks: close
* GoodSink: Close the file using CloseHandle()
* BadSink : Close the file using close()
* Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <windows.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51b_badSink(HANDLE data);
void CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51_bad()
{
HANDLE data;
/* Initialize data */
data = INVALID_HANDLE_VALUE;
/* POTENTIAL FLAW: Open a file - need to make sure it is closed properly in the sink */
data = CreateFile("BadSource_w32CreateFile.txt",
(GENERIC_WRITE|GENERIC_READ),
0,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51b_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declarations */
void CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51b_goodB2GSink(HANDLE data);
/* goodB2G uses the BadSource with the GoodSink */
static void goodB2G()
{
HANDLE data;
/* Initialize data */
data = INVALID_HANDLE_VALUE;
/* POTENTIAL FLAW: Open a file - need to make sure it is closed properly in the sink */
data = CreateFile("BadSource_w32CreateFile.txt",
(GENERIC_WRITE|GENERIC_READ),
0,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51b_goodB2GSink(data);
}
void CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51_good()
{
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE404_Improper_Resource_Shutdown__w32CreateFile_close_51_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81.h
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE193.label.xml
Template File: sources-sink-81.tmpl.h
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Point data to a buffer that does not have space for a NULL terminator
* GoodSource: Point data to a buffer that includes space for a NULL terminator
* Sinks: memcpy
* BadSink : Copy string to data using memcpy()
* Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* MAINTENANCE NOTE: The length of this string should equal the 10 */
#define SRC_STRING L"AAAAAAAAAA"
namespace CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81
{
class CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81_base
{
public:
/* pure virtual function */
virtual void action(wchar_t * data) const = 0;
};
#ifndef OMITBAD
class CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81_bad : public CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81_goodG2B : public CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_declare_memcpy_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITGOOD */
}
|
// 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 SANDBOX_LINUX_SECCOMP_BPF_DIE_H__
#define SANDBOX_LINUX_SECCOMP_BPF_DIE_H__
#include "base/basictypes.h"
#include "sandbox/linux/sandbox_export.h"
namespace sandbox {
// This is the main API for using this file. Prints a error message and
// exits with a fatal error. This is not async-signal safe.
#define SANDBOX_DIE(m) sandbox::Die::SandboxDie(m, __FILE__, __LINE__)
// An async signal safe version of the same API. Won't print the filename
// and line numbers.
#define RAW_SANDBOX_DIE(m) sandbox::Die::RawSandboxDie(m)
// Adds an informational message to the log file or stderr as appropriate.
#define SANDBOX_INFO(m) sandbox::Die::SandboxInfo(m, __FILE__, __LINE__)
class SANDBOX_EXPORT Die {
public:
// Terminate the program, even if the current sandbox policy prevents some
// of the more commonly used functions used for exiting.
// Most users would want to call SANDBOX_DIE() instead, as it logs extra
// information. But calling ExitGroup() is correct and in some rare cases
// preferable. So, we make it part of the public API.
static void ExitGroup() __attribute__((noreturn));
// This method gets called by SANDBOX_DIE(). There is normally no reason
// to call it directly unless you are defining your own exiting macro.
static void SandboxDie(const char* msg, const char* file, int line)
__attribute__((noreturn));
static void RawSandboxDie(const char* msg) __attribute__((noreturn));
// This method gets called by SANDBOX_INFO(). There is normally no reason
// to call it directly unless you are defining your own logging macro.
static void SandboxInfo(const char* msg, const char* file, int line);
// Writes a message to stderr. Used as a fall-back choice, if we don't have
// any other way to report an error.
static void LogToStderr(const char* msg, const char* file, int line);
// We generally want to run all exit handlers. This means, on SANDBOX_DIE()
// we should be calling LOG(FATAL). But there are some situations where
// we just need to print a message and then terminate. This would typically
// happen in cases where we consume the error message internally (e.g. in
// unit tests or in the supportsSeccompSandbox() method).
static void EnableSimpleExit() { simple_exit_ = true; }
// Sometimes we need to disable all informational messages (e.g. from within
// unittests).
static void SuppressInfoMessages(bool flag) { suppress_info_ = flag; }
private:
static bool simple_exit_;
static bool suppress_info_;
DISALLOW_IMPLICIT_CONSTRUCTORS(Die);
};
} // namespace sandbox
#endif // SANDBOX_LINUX_SECCOMP_BPF_DIE_H__
|
// Copyright 2015 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 SKY_ENGINE_CORE_TEXT_PARAGRAPHBUILDER_H_
#define SKY_ENGINE_CORE_TEXT_PARAGRAPHBUILDER_H_
#include "lib/tonic/dart_wrappable.h"
#include "lib/tonic/typed_data/int32_list.h"
#include "flutter/sky/engine/core/text/Paragraph.h"
namespace tonic {
class DartLibraryNatives;
} // namespace tonic
namespace blink {
class ParagraphBuilder : public ftl::RefCountedThreadSafe<ParagraphBuilder>,
public tonic::DartWrappable {
DEFINE_WRAPPERTYPEINFO();
FRIEND_MAKE_REF_COUNTED(ParagraphBuilder);
public:
static ftl::RefPtr<ParagraphBuilder> create() {
return ftl::MakeRefCounted<ParagraphBuilder>();
}
~ParagraphBuilder() override;
void pushStyle(tonic::Int32List& encoded,
const std::string& fontFamily,
double fontSize,
double letterSpacing,
double wordSpacing,
double height);
void pop();
void addText(const std::string& text);
ftl::RefPtr<Paragraph> build(tonic::Int32List& encoded,
const std::string& fontFamily,
double fontSize,
double lineHeight);
static void RegisterNatives(tonic::DartLibraryNatives* natives);
private:
explicit ParagraphBuilder();
void createRenderView();
OwnPtr<RenderView> m_renderView;
RenderObject* m_renderParagraph;
RenderObject* m_currentRenderObject;
};
} // namespace blink
#endif // SKY_ENGINE_CORE_TEXT_PARAGRAPHBUILDER_H_
|
/*
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FEDropShadow_h
#define FEDropShadow_h
#include "core/platform/graphics/Color.h"
#include "core/platform/graphics/filters/Filter.h"
#include "core/platform/graphics/filters/FilterEffect.h"
namespace WebCore {
class FEDropShadow : public FilterEffect {
public:
static PassRefPtr<FEDropShadow> create(Filter*, float, float, float, float, const Color&, float);
float stdDeviationX() const { return m_stdX; }
void setStdDeviationX(float stdX) { m_stdX = stdX; }
float stdDeviationY() const { return m_stdY; }
void setStdDeviationY(float stdY) { m_stdY = stdY; }
float dx() const { return m_dx; }
void setDx(float dx) { m_dx = dx; }
float dy() const { return m_dy; }
void setDy(float dy) { m_dy = dy; }
Color shadowColor() const { return m_shadowColor; }
void setShadowColor(const Color& shadowColor) { m_shadowColor = shadowColor; }
float shadowOpacity() const { return m_shadowOpacity; }
void setShadowOpacity(float shadowOpacity) { m_shadowOpacity = shadowOpacity; }
static float calculateStdDeviation(float);
virtual void determineAbsolutePaintRect();
virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
virtual TextStream& externalRepresentation(TextStream&, int indention) const;
private:
FEDropShadow(Filter*, float, float, float, float, const Color&, float);
virtual void applySoftware() OVERRIDE;
float m_stdX;
float m_stdY;
float m_dx;
float m_dy;
Color m_shadowColor;
float m_shadowOpacity;
};
} // namespace WebCore
#endif // FEDropShadow_h
|
// Copyright 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.
//
// A simple wrapper around invalidation::InvalidationClient that
// handles all the startup/shutdown details and hookups.
#ifndef SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_
#define SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "google/cacheinvalidation/include/invalidation-listener.h"
#include "jingle/notifier/listener/push_client_observer.h"
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/util/weak_handle.h"
#include "sync/notifier/invalidation_state_tracker.h"
#include "sync/notifier/invalidator_state.h"
#include "sync/notifier/object_id_invalidation_map.h"
#include "sync/notifier/state_writer.h"
#include "sync/notifier/sync_system_resources.h"
namespace buzz {
class XmppTaskParentInterface;
} // namespace buzz
namespace notifier {
class PushClient;
} // namespace notifier
namespace syncer {
class RegistrationManager;
// SyncInvalidationListener is not thread-safe and lives on the sync
// thread.
class SYNC_EXPORT_PRIVATE SyncInvalidationListener
: public NON_EXPORTED_BASE(invalidation::InvalidationListener),
public StateWriter,
public NON_EXPORTED_BASE(notifier::PushClientObserver),
public base::NonThreadSafe {
public:
typedef base::Callback<invalidation::InvalidationClient*(
invalidation::SystemResources*,
int,
const invalidation::string&,
const invalidation::string&,
invalidation::InvalidationListener*)> CreateInvalidationClientCallback;
class SYNC_EXPORT_PRIVATE Delegate {
public:
virtual ~Delegate();
virtual void OnInvalidate(
const ObjectIdInvalidationMap& invalidation_map) = 0;
virtual void OnInvalidatorStateChange(InvalidatorState state) = 0;
};
explicit SyncInvalidationListener(
scoped_ptr<notifier::PushClient> push_client);
// Calls Stop().
virtual ~SyncInvalidationListener();
// Does not take ownership of |delegate| or |state_writer|.
// |invalidation_state_tracker| must be initialized.
void Start(
const CreateInvalidationClientCallback&
create_invalidation_client_callback,
const std::string& client_id, const std::string& client_info,
const std::string& invalidation_bootstrap_data,
const InvalidationStateMap& initial_invalidation_state_map,
const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker,
Delegate* delegate);
void UpdateCredentials(const std::string& email, const std::string& token);
// Update the set of object IDs that we're interested in getting
// notifications for. May be called at any time.
void UpdateRegisteredIds(const ObjectIdSet& ids);
// invalidation::InvalidationListener implementation.
virtual void Ready(
invalidation::InvalidationClient* client) OVERRIDE;
virtual void Invalidate(
invalidation::InvalidationClient* client,
const invalidation::Invalidation& invalidation,
const invalidation::AckHandle& ack_handle) OVERRIDE;
virtual void InvalidateUnknownVersion(
invalidation::InvalidationClient* client,
const invalidation::ObjectId& object_id,
const invalidation::AckHandle& ack_handle) OVERRIDE;
virtual void InvalidateAll(
invalidation::InvalidationClient* client,
const invalidation::AckHandle& ack_handle) OVERRIDE;
virtual void InformRegistrationStatus(
invalidation::InvalidationClient* client,
const invalidation::ObjectId& object_id,
invalidation::InvalidationListener::RegistrationState reg_state) OVERRIDE;
virtual void InformRegistrationFailure(
invalidation::InvalidationClient* client,
const invalidation::ObjectId& object_id,
bool is_transient,
const std::string& error_message) OVERRIDE;
virtual void ReissueRegistrations(
invalidation::InvalidationClient* client,
const std::string& prefix,
int prefix_length) OVERRIDE;
virtual void InformError(
invalidation::InvalidationClient* client,
const invalidation::ErrorInfo& error_info) OVERRIDE;
// StateWriter implementation.
virtual void WriteState(const std::string& state) OVERRIDE;
// notifier::PushClientObserver implementation.
virtual void OnNotificationsEnabled() OVERRIDE;
virtual void OnNotificationsDisabled(
notifier::NotificationsDisabledReason reason) OVERRIDE;
virtual void OnIncomingNotification(
const notifier::Notification& notification) OVERRIDE;
void DoRegistrationUpdate();
void StopForTest();
InvalidationStateMap GetStateMapForTest() const;
private:
void Stop();
InvalidatorState GetState() const;
void EmitStateChange();
void EmitInvalidation(const ObjectIdInvalidationMap& invalidation_map);
// Owned by |sync_system_resources_|.
notifier::PushClient* const push_client_;
SyncSystemResources sync_system_resources_;
InvalidationStateMap invalidation_state_map_;
WeakHandle<InvalidationStateTracker> invalidation_state_tracker_;
Delegate* delegate_;
scoped_ptr<invalidation::InvalidationClient> invalidation_client_;
scoped_ptr<RegistrationManager> registration_manager_;
// Stored to pass to |registration_manager_| on start.
ObjectIdSet registered_ids_;
// The states of the ticl and the push client.
InvalidatorState ticl_state_;
InvalidatorState push_client_state_;
DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener);
};
} // namespace syncer
#endif // SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_
|
//
// ATConnect_Private.h
// ApptentiveConnect
//
// Created by Andrew Wooster on 1/20/13.
// Copyright (c) 2013 Apptentive, Inc. All rights reserved.
//
#import "ATConnect.h"
extern NSString *const ATConnectCustomPersonDataChangedNotification;
extern NSString *const ATConnectCustomDeviceDataChangedNotification;
@class ATAbstractMessage;
@interface ATConnect ()
- (NSDictionary *)customPersonData;
- (NSDictionary *)customDeviceData;
- (NSDictionary *)integrationConfiguration;
@property (nonatomic, strong) NSDictionary *pushUserInfo;
@property (nonatomic, strong) UIViewController *pushViewController;
#if TARGET_OS_IPHONE
// For debugging only.
- (void)resetUpgradeData;
#endif
/*!
* Returns the NSBundle corresponding to the bundle containing ATConnect's
* images, xibs, strings files, etc.
*/
+ (NSBundle *)resourceBundle;
// Debug/test interactions by invoking them directly
- (NSArray *)engagementInteractions;
- (NSString *)engagementInteractionNameAtIndex:(NSInteger)index;
- (NSString *)engagementInteractionTypeAtIndex:(NSInteger)index;
- (void)presentInteractionAtIndex:(NSInteger)index fromViewController:(UIViewController *)viewController;
- (void)showNotificationBannerForMessage:(ATAbstractMessage *)message;
@end
/*! Replacement for NSLocalizedString within ApptentiveConnect. Pulls
localized strings out of the resource bundle. */
extern NSString *ATLocalizedString(NSString *key, NSString *comment);
|
@class DB;
DB *DBSQLiteDatabaseForTesting();
|
#ifndef CMARK_REFERENCES_H
#define CMARK_REFERENCES_H
#include "chunk.h"
#ifdef __cplusplus
extern "C" {
#endif
struct cmark_reference {
struct cmark_reference *next;
unsigned char *label;
unsigned char *url;
unsigned char *title;
unsigned int age;
};
typedef struct cmark_reference cmark_reference;
struct cmark_reference_map {
cmark_mem *mem;
cmark_reference *refs;
cmark_reference **sorted;
unsigned int size;
};
typedef struct cmark_reference_map cmark_reference_map;
cmark_reference_map *cmark_reference_map_new(cmark_mem *mem);
void cmark_reference_map_free(cmark_reference_map *map);
cmark_reference *cmark_reference_lookup(cmark_reference_map *map,
cmark_chunk *label);
extern void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label,
cmark_chunk *url, cmark_chunk *title);
#ifdef __cplusplus
}
#endif
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE126_Buffer_Overread__CWE170_wchar_t_strncpy_07.c
Label Definition File: CWE126_Buffer_Overread__CWE170.label.xml
Template File: point-flaw-07.tmpl.c
*/
/*
* @description
* CWE: 126 Buffer Overread
* Sinks: strncpy
* GoodSink: Copy a string using wcsncpy() with explicit null termination
* BadSink : Copy a string using wcsncpy() without explicit null termination
* Flow Variant: 07 Control flow: if(staticFive==5) and if(staticFive!=5)
*
* */
#include "std_testcase.h"
#include <wchar.h>
/* The variable below is not declared "const", but is never assigned
any other value so a tool should be able to identify that reads of
this will always give its initialized value. */
static int staticFive = 5;
#ifndef OMITBAD
void CWE126_Buffer_Overread__CWE170_wchar_t_strncpy_07_bad()
{
if(staticFive==5)
{
{
wchar_t data[150], dest[100];
/* Initialize data */
wmemset(data, L'A', 149);
data[149] = L'\0';
/* wcsncpy() does not null terminate if the string in the src buffer is larger than
* the number of characters being copied to the dest buffer */
wcsncpy(dest, data, 99);
/* FLAW: do not explicitly null terminate dest after the use of wcsncpy() */
printWLine(dest);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(staticFive!=5) instead of if(staticFive==5) */
static void good1()
{
if(staticFive!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
wchar_t data[150], dest[100];
/* Initialize data */
wmemset(data, L'A', 149);
data[149] = L'\0';
/* wcsncpy() does not null terminate if the string in the src buffer is larger than
* the number of characters being copied to the dest buffer */
wcsncpy(dest, data, 99);
dest[99] = L'\0'; /* FIX: Explicitly null terminate dest after the use of wcsncpy() */
printWLine(dest);
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(staticFive==5)
{
{
wchar_t data[150], dest[100];
/* Initialize data */
wmemset(data, L'A', 149);
data[149] = L'\0';
/* wcsncpy() does not null terminate if the string in the src buffer is larger than
* the number of characters being copied to the dest buffer */
wcsncpy(dest, data, 99);
dest[99] = L'\0'; /* FIX: Explicitly null terminate dest after the use of wcsncpy() */
printWLine(dest);
}
}
}
void CWE126_Buffer_Overread__CWE170_wchar_t_strncpy_07_good()
{
good1();
good2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE126_Buffer_Overread__CWE170_wchar_t_strncpy_07_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE126_Buffer_Overread__CWE170_wchar_t_strncpy_07_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE457_Use_of_Uninitialized_Variable__char_pointer_11.c
Label Definition File: CWE457_Use_of_Uninitialized_Variable.c.label.xml
Template File: sources-sinks-11.tmpl.c
*/
/*
* @description
* CWE: 457 Use of Uninitialized Variable
* BadSource: no_init Don't initialize data
* GoodSource: Initialize data
* Sinks: use
* GoodSink: Initialize then use data
* BadSink : Use data
* Flow Variant: 11 Control flow: if(globalReturnsTrue()) and if(globalReturnsFalse())
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE457_Use_of_Uninitialized_Variable__char_pointer_11_bad()
{
char * data;
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
}
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Use data without initializing it */
printLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second globalReturnsTrue() to globalReturnsFalse() */
static void goodB2G1()
{
char * data;
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
}
if(globalReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Ensure data is initialized before use */
data = "string";
printLine(data);
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
char * data;
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
}
if(globalReturnsTrue())
{
/* FIX: Ensure data is initialized before use */
data = "string";
printLine(data);
}
}
/* goodG2B1() - use goodsource and badsink by changing the first globalReturnsTrue() to globalReturnsFalse() */
static void goodG2B1()
{
char * data;
if(globalReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Initialize data */
data = "string";
}
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Use data without initializing it */
printLine(data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
char * data;
if(globalReturnsTrue())
{
/* FIX: Initialize data */
data = "string";
}
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Use data without initializing it */
printLine(data);
}
}
void CWE457_Use_of_Uninitialized_Variable__char_pointer_11_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE457_Use_of_Uninitialized_Variable__char_pointer_11_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE457_Use_of_Uninitialized_Variable__char_pointer_11_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// 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 WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_
#define WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_
#include <map>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/synchronization/lock.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
#include "webkit/fileapi/local_file_util.h"
#include "webkit/quota/special_storage_policy.h"
namespace fileapi {
class FileSystemFileUtil;
}
namespace chromeos {
class FileAccessPermissions;
// An interface to provide local filesystem paths.
class CrosMountPointProvider
: public fileapi::ExternalFileSystemMountPointProvider {
public:
// Mount point file system location enum.
enum FileSystemLocation {
// File system that is locally mounted by the underlying OS.
LOCAL,
// File system that is remotely hosted on the net.
REMOTE,
};
typedef fileapi::FileSystemMountPointProvider::ValidateFileSystemCallback
ValidateFileSystemCallback;
CrosMountPointProvider(
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy);
virtual ~CrosMountPointProvider();
// fileapi::FileSystemMountPointProvider overrides.
virtual void ValidateFileSystemRoot(
const GURL& origin_url,
fileapi::FileSystemType type,
bool create,
const ValidateFileSystemCallback& callback) OVERRIDE;
virtual FilePath GetFileSystemRootPathOnFileThread(
const GURL& origin_url,
fileapi::FileSystemType type,
const FilePath& virtual_path,
bool create) OVERRIDE;
virtual bool IsAccessAllowed(
const GURL& origin_url,
fileapi::FileSystemType type,
const FilePath& virtual_path) OVERRIDE;
virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE;
virtual fileapi::FileSystemFileUtil* GetFileUtil() OVERRIDE;
virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path)
const OVERRIDE;
virtual fileapi::FileSystemOperationInterface* CreateFileSystemOperation(
const GURL& origin_url,
fileapi::FileSystemType file_system_type,
const FilePath& virtual_path,
base::MessageLoopProxy* file_proxy,
fileapi::FileSystemContext* context) const OVERRIDE;
// fileapi::ExternalFileSystemMountPointProvider overrides.
virtual void GrantFullAccessToExtension(
const std::string& extension_id) OVERRIDE;
virtual void GrantFileAccessToExtension(
const std::string& extension_id, const FilePath& virtual_path) OVERRIDE;
virtual void RevokeAccessForExtension(
const std::string& extension_id) OVERRIDE;
virtual bool HasMountPoint(const FilePath& mount_point) OVERRIDE;
virtual void AddLocalMountPoint(const FilePath& mount_point) OVERRIDE;
virtual void AddRemoteMountPoint(
const FilePath& mount_point,
fileapi::RemoteFileSystemProxyInterface* remote_proxy) OVERRIDE;
virtual void RemoveMountPoint(const FilePath& mount_point) OVERRIDE;
virtual bool GetVirtualPath(const FilePath& filesystem_path,
FilePath* virtual_path) OVERRIDE;
private:
class GetFileSystemRootPathTask;
// Representation of a mount point exposed by this external mount point
// provider.
struct MountPoint {
MountPoint(const FilePath& web_path,
const FilePath& local_path,
FileSystemLocation loc,
fileapi::RemoteFileSystemProxyInterface* proxy);
virtual ~MountPoint();
// Virtual web path, relative to external root in filesytem URLs.
// For example, in "filesystem://.../external/foo/bar/" this path would
// map to "foo/bar/".
const FilePath web_root_path;
// Parent directory for the exposed file system path. For example,
// mount point that exposes "/media/removable" would have this
// root path as "/media".
const FilePath local_root_path;
// File system location.
const FileSystemLocation location;
// Remote file system proxy for remote mount points.
scoped_refptr<fileapi::RemoteFileSystemProxyInterface> remote_proxy;
};
typedef std::map<std::string, MountPoint> MountPointMap;
// Gives the real file system's |root_path| for given |virtual_path|. Returns
// false when |virtual_path| cannot be mapped to the real file system.
bool GetRootForVirtualPath(const FilePath& virtual_path, FilePath* root_path);
// Returns mount point info for a given |virtual_path|, NULL if the path is
// not part of the mounted file systems exposed through this provider.
const MountPoint* GetMountPoint(const FilePath& virtual_path) const;
base::Lock mount_point_map_lock_;
MountPointMap mount_point_map_;
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
scoped_ptr<FileAccessPermissions> file_access_permissions_;
scoped_ptr<fileapi::LocalFileUtil> local_file_util_;
DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider);
};
} // namespace chromeos
#endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
#define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
#include <deque>
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "base/threading/non_thread_safe.h"
#include "remoting/protocol/session.h"
#include "remoting/protocol/video_writer.h"
namespace net {
class IPEndPoint;
} // namespace net
namespace remoting {
namespace protocol {
class ClientStub;
class HostStub;
class InputStub;
class HostControlDispatcher;
class HostEventDispatcher;
// This class represents a remote viewer connection to the chromoting
// host. It sets up all protocol channels and connects them to the
// stubs.
class ConnectionToClient : public base::NonThreadSafe {
public:
class EventHandler {
public:
virtual ~EventHandler() {}
// Called when the network connection is opened.
virtual void OnConnectionOpened(ConnectionToClient* connection) = 0;
// Called when the network connection is closed.
virtual void OnConnectionClosed(ConnectionToClient* connection) = 0;
// Called when the network connection has failed.
virtual void OnConnectionFailed(ConnectionToClient* connection,
Session::Error error) = 0;
// Called when sequence number is updated.
virtual void OnSequenceNumberUpdated(ConnectionToClient* connection,
int64 sequence_number) = 0;
// Called on notification of a route change event, which happens when a
// channel is connected.
virtual void OnClientIpAddress(ConnectionToClient* connection,
const std::string& channel_name,
const net::IPEndPoint& end_point) = 0;
};
// Constructs a ConnectionToClient object for the |session|. Takes
// ownership of |session|.
explicit ConnectionToClient(Session* session);
virtual ~ConnectionToClient();
// Set |event_handler| for connection events. Must be called once when this
// object is created.
void SetEventHandler(EventHandler* event_handler);
// Returns the connection in use.
virtual Session* session();
// Disconnect the client connection.
virtual void Disconnect();
// Update the sequence number when received from the client. EventHandler
// will be called.
virtual void UpdateSequenceNumber(int64 sequence_number);
// Send encoded update stream data to the viewer.
virtual VideoStub* video_stub();
// Return pointer to ClientStub.
virtual ClientStub* client_stub();
// These two setters should be called before Init().
virtual void set_host_stub(HostStub* host_stub);
virtual void set_input_stub(InputStub* input_stub);
private:
// Callback for protocol Session.
void OnSessionStateChange(Session::State state);
void OnSessionRouteChange(const std::string& channel_name,
const net::IPEndPoint& end_point);
// Callback for channel initialization.
void OnChannelInitialized(bool successful);
void NotifyIfChannelsReady();
void CloseOnError();
// Stops writing in the channels.
void CloseChannels();
// Event handler for handling events sent from this object.
EventHandler* handler_;
// Stubs that are called for incoming messages.
HostStub* host_stub_;
InputStub* input_stub_;
// The libjingle channel used to send and receive data from the remote client.
scoped_ptr<Session> session_;
scoped_ptr<HostControlDispatcher> control_dispatcher_;
scoped_ptr<HostEventDispatcher> event_dispatcher_;
scoped_ptr<VideoWriter> video_writer_;
DISALLOW_COPY_AND_ASSIGN(ConnectionToClient);
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LayoutAnnotationRenderer_H
#define LayoutAnnotationRenderer_H
#include "MitkAnnotationExports.h"
#include "mitkAbstractAnnotationRenderer.h"
namespace mitk
{
class BaseRenderer;
/** \brief The LayoutAnnotationRenderer is used for the layouted placement of mitk::Annotation Objects.
*
* An instance of this service is registered for a specific Baserenderer and is used to manage all annotations which
* are added to it.
* The static function AddAnnotation is used to register an annotation to a specific service and to create this
* service if it does not exist yet. The position of the layouted annotation can be passed as a parameter.
*
* See \ref AnnotationPage for more info.
**/
class MITKANNOTATION_EXPORT LayoutAnnotationRenderer : public AbstractAnnotationRenderer
{
public:
static const std::string PROP_LAYOUT;
static const std::string PROP_LAYOUT_PRIORITY;
static const std::string PROP_LAYOUT_ALIGNMENT;
static const std::string PROP_LAYOUT_MARGIN;
enum Alignment
{
TopLeft,
Top,
TopRight,
BottomLeft,
Bottom,
BottomRight,
Left,
Right
};
typedef std::multimap<int, mitk::Annotation *> AnnotationRankedMap;
typedef std::map<Alignment, AnnotationRankedMap> AnnotationLayouterContainerMap;
/** \brief virtual destructor in order to derive from this class */
virtual ~LayoutAnnotationRenderer();
const std::string GetID() const;
static LayoutAnnotationRenderer *GetAnnotationRenderer(const std::string &rendererID);
void OnRenderWindowModified();
static void AddAnnotation(Annotation *annotation,
const std::string &rendererID,
Alignment alignment = TopLeft,
double marginX = 5,
double marginY = 5,
int priority = -1);
static void AddAnnotation(Annotation *annotation,
BaseRenderer *renderer,
Alignment alignment = TopLeft,
double marginX = 5,
double marginY = 5,
int priority = -1);
void PrepareLayout();
private:
LayoutAnnotationRenderer(const std::string &rendererId);
static void AddAlignmentProperty(Annotation *annotation, Alignment activeAlignment, Point2D margin, int priority);
void PrepareTopLeftLayout(int *displaySize);
void PrepareTopLayout(int *displaySize);
void PrepareTopRightLayout(int *displaySize);
void PrepareBottomLeftLayout(int *displaySize);
void PrepareBottomLayout(int *displaySize);
void PrepareBottomRightLayout(int *displaySize);
void PrepareLeftLayout(int *displaySize);
void PrepareRightLayout(int *displaySize);
static double GetHeight(AnnotationRankedMap &annotations, BaseRenderer *renderer);
virtual void OnAnnotationRenderersChanged();
static const std::string ANNOTATIONRENDERER_ID;
AnnotationLayouterContainerMap m_AnnotationContainerMap;
static void SetMargin2D(Annotation *annotation, const Point2D &OffsetVector);
static Point2D GetMargin2D(Annotation *annotation);
};
} // namespace mitk
#endif // LayoutAnnotationRenderer_H
|
#ifndef GETOPT_H
#define GETOPT_H
extern int opterr; /* if error message should be printed */
extern int optind; /* index into parent argv vector */
extern int optopt; /* character checked for validity */
extern int optreset; /* reset getopt */
extern char *optarg; /* argument associated with option */
int getopt(int nargc, char * const nargv[], const char *ostr);
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54a.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml
Template File: sources-sink-54a.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: ncpy
* BadSink : Copy string to data using strncpy
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54b_badSink(char * data);
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54_bad()
{
char * data;
char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char));
char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char));
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = '\0'; /* null terminate */
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54b_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54b_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char));
char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char));
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = '\0'; /* null terminate */
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54b_goodG2BSink(data);
}
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_54_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__int_min_sub_01.c
Label Definition File: CWE191_Integer_Underflow__int.label.xml
Template File: sources-sinks-01.tmpl.c
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: min Set data to the minimum value for int
* GoodSource: Set data to a small, non-zero number (negative two)
* Sinks: sub
* GoodSink: Ensure there will not be an underflow before subtracting 1 from data
* BadSink : Subtract 1 from data, which can cause an Underflow
* Flow Variant: 01 Baseline
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE191_Integer_Underflow__int_min_sub_01_bad()
{
int data;
/* Initialize data */
data = 0;
/* POTENTIAL FLAW: Use the minimum value for this type */
data = INT_MIN;
{
/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */
int result = data - 1;
printIntLine(result);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
int data;
/* Initialize data */
data = 0;
/* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */
data = -2;
{
/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */
int result = data - 1;
printIntLine(result);
}
}
/* goodB2G uses the BadSource with the GoodSink */
static void goodB2G()
{
int data;
/* Initialize data */
data = 0;
/* POTENTIAL FLAW: Use the minimum value for this type */
data = INT_MIN;
/* FIX: Add a check to prevent an underflow from occurring */
if (data > INT_MIN)
{
int result = data - 1;
printIntLine(result);
}
else
{
printLine("data value is too large to perform subtraction.");
}
}
void CWE191_Integer_Underflow__int_min_sub_01_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE191_Integer_Underflow__int_min_sub_01_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE191_Integer_Underflow__int_min_sub_01_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#include <stdio.h>
void print_fib(int n)
{
int a = 0;
int b = 1;
while (a < n)
{
int old_a = a;
printf("%d ", a);
a = b;
b = old_a + b;
}
}
int main()
{
print_fib(500);
printf("\n");
return 0;
}
|
#ifndef VPX_SCALE_RTCD_H_
#define VPX_SCALE_RTCD_H_
#ifdef RTCD_C
#define RTCD_EXTERN
#else
#define RTCD_EXTERN extern
#endif
struct yv12_buffer_config;
void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
void vp8_yv12_extend_frame_borders_neon(struct yv12_buffer_config *ybf);
#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_neon
void vp8_yv12_copy_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
void vp8_yv12_copy_frame_neon(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
#define vp8_yv12_copy_frame vp8_yv12_copy_frame_neon
void vp8_yv12_copy_y_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
void vp8_yv12_copy_y_neon(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
#define vp8_yv12_copy_y vp8_yv12_copy_y_neon
void vpx_scale_rtcd(void);
#include "vpx_config.h"
#ifdef RTCD_C
#include "vpx_ports/arm.h"
static void setup_rtcd_internal(void)
{
int flags = arm_cpu_caps();
(void)flags;
}
#endif
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67b.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml
Template File: sources-sink-67b.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sinks: memcpy
* BadSink : Copy int64_t array to data using memcpy
* Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files
*
* */
#include "std_testcase.h"
typedef struct _CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67_structType
{
int64_t * structFirst;
} CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67_structType;
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67b_badSink(CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67_structType myStruct)
{
int64_t * data = myStruct.structFirst;
{
int64_t source[100] = {0}; /* fill with 0's */
/* POTENTIAL FLAW: Possible buffer overflow if data < 100 */
memcpy(data, source, 100*sizeof(int64_t));
printLongLongLine(data[0]);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67b_goodG2BSink(CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memcpy_67_structType myStruct)
{
int64_t * data = myStruct.structFirst;
{
int64_t source[100] = {0}; /* fill with 0's */
/* POTENTIAL FLAW: Possible buffer overflow if data < 100 */
memcpy(data, source, 100*sizeof(int64_t));
printLongLongLine(data[0]);
}
}
#endif /* OMITGOOD */
|
/* Copyright (c) 2015, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <odp.h>
#include "odp_cunit_common.h"
#include "errno.h"
void errno_test_odp_errno_sunny_day(void)
{
int my_errno;
odp_errno_zero();
my_errno = odp_errno();
CU_ASSERT_TRUE(my_errno == 0);
odp_errno_print("odp_errno");
CU_ASSERT_PTR_NOT_NULL(odp_errno_str(my_errno));
}
odp_testinfo_t errno_suite[] = {
ODP_TEST_INFO(errno_test_odp_errno_sunny_day),
ODP_TEST_INFO_NULL,
};
odp_suiteinfo_t errno_suites[] = {
{"Errno", NULL, NULL, errno_suite},
ODP_SUITE_INFO_NULL,
};
int errno_main(void)
{
int ret = odp_cunit_register(errno_suites);
if (ret == 0)
ret = odp_cunit_run();
return ret;
}
|
// 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 MOJO_SHELL_RUNNER_HOST_CHILD_PROCESS_HOST_H_
#define MOJO_SHELL_RUNNER_HOST_CHILD_PROCESS_HOST_H_
#include <stdint.h>
#include <string>
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/shell/identity.h"
#include "mojo/shell/runner/child/child_controller.mojom.h"
#include "mojo/shell/runner/host/child_process_host.h"
namespace base {
class TaskRunner;
}
namespace mojo {
namespace shell {
class Identity;
class NativeRunnerDelegate;
// This class represents a "child process host". Handles launching and
// connecting a platform-specific "pipe" to the child, and supports joining the
// child process. Currently runs a single app (loaded from the file system).
//
// This class is not thread-safe. It should be created/used/destroyed on a
// single thread.
//
// Note: Does not currently work on Windows before Vista.
// Note: After |Start()|, |StartApp| must be called and this object must
// remained alive until the |on_app_complete| callback is called.
class ChildProcessHost {
public:
using ProcessReadyCallback = base::Callback<void(base::ProcessId)>;
// |name| is just for debugging ease. We will spawn off a process so that it
// can be sandboxed if |start_sandboxed| is true. |app_path| is a path to the
// mojo application we wish to start.
ChildProcessHost(base::TaskRunner* launch_process_runner,
NativeRunnerDelegate* delegate,
bool start_sandboxed,
const Identity& target,
const base::FilePath& app_path);
// Allows a ChildProcessHost to be instantiated for an existing channel
// created by someone else (e.g. an app that launched its own process).
explicit ChildProcessHost(ScopedHandle channel);
virtual ~ChildProcessHost();
// |Start()|s the child process; calls |DidStart()| (on the thread on which
// |Start()| was called) when the child has been started (or failed to start).
void Start(const ProcessReadyCallback& callback);
// Waits for the child process to terminate, and returns its exit code.
int Join();
// See |mojom::ChildController|:
void StartApp(
InterfaceRequest<mojom::ShellClient> request,
const mojom::ChildController::StartAppCallback& on_app_complete);
void ExitNow(int32_t exit_code);
protected:
void DidStart(const ProcessReadyCallback& callback);
private:
void DoLaunch();
void AppCompleted(int32_t result);
scoped_refptr<base::TaskRunner> launch_process_runner_;
NativeRunnerDelegate* delegate_;
bool start_sandboxed_;
Identity target_;
const base::FilePath app_path_;
base::Process child_process_;
// Used for the ChildController binding.
edk::PlatformChannelPair platform_channel_pair_;
mojom::ChildControllerPtr controller_;
mojom::ChildController::StartAppCallback on_app_complete_;
edk::HandlePassingInformation handle_passing_info_;
// Used to back the NodeChannel between the parent and child node.
scoped_ptr<edk::PlatformChannelPair> node_channel_;
// Since Start() calls a method on another thread, we use an event to block
// the main thread if it tries to destruct |this| while launching the process.
base::WaitableEvent start_child_process_event_;
// A token the child can use to connect a primordial pipe to the host.
std::string primordial_pipe_token_;
base::WeakPtrFactory<ChildProcessHost> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChildProcessHost);
};
} // namespace shell
} // namespace mojo
#endif // MOJO_SHELL_RUNNER_HOST_CHILD_PROCESS_HOST_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE124_Buffer_Underwrite__char_alloca_memcpy_13.c
Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml
Template File: sources-sink-13.tmpl.c
*/
/*
* @description
* CWE: 124 Buffer Underwrite
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sink: memcpy
* BadSink : Copy string to data using memcpy
* Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=5)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE124_Buffer_Underwrite__char_alloca_memcpy_13_bad()
{
char * data;
char * dataBuffer = (char *)ALLOCA(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
if(GLOBAL_CONST_FIVE==5)
{
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
}
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(char));
/* Ensure the destination buffer is null terminated */
data[100-1] = '\0';
printLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_FIVE==5 to GLOBAL_CONST_FIVE!=5 */
static void goodG2B1()
{
char * data;
char * dataBuffer = (char *)ALLOCA(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
if(GLOBAL_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(char));
/* Ensure the destination buffer is null terminated */
data[100-1] = '\0';
printLine(data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
char * data;
char * dataBuffer = (char *)ALLOCA(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
if(GLOBAL_CONST_FIVE==5)
{
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(char));
/* Ensure the destination buffer is null terminated */
data[100-1] = '\0';
printLine(data);
}
}
void CWE124_Buffer_Underwrite__char_alloca_memcpy_13_good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE124_Buffer_Underwrite__char_alloca_memcpy_13_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE124_Buffer_Underwrite__char_alloca_memcpy_13_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml
Template File: sources-sink-41.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: memmove
* BadSink : Copy string to data using memmove
* Flow Variant: 41 Data flow: data passed as an argument from one function to another in the same source file
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_badSink(char * data)
{
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
memmove(data, source, 100*sizeof(char));
data[100-1] = '\0'; /* Ensure the destination buffer is null terminated */
printLine(data);
}
}
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_bad()
{
char * data;
char dataBadBuffer[50];
char dataGoodBuffer[100];
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = '\0'; /* null terminate */
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_goodG2BSink(char * data)
{
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
memmove(data, source, 100*sizeof(char));
data[100-1] = '\0'; /* Ensure the destination buffer is null terminated */
printLine(data);
}
}
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char dataBadBuffer[50];
char dataGoodBuffer[100];
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = '\0'; /* null terminate */
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_goodG2BSink(data);
}
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memmove_41_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81.h
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
Template File: sources-sink-81.tmpl.h
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate memory for a string, but do not allocate space for NULL terminator
* GoodSource: Allocate enough memory for a string and the NULL terminator
* Sinks: memcpy
* BadSink : Copy string to data using memcpy()
* Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* MAINTENANCE NOTE: The length of this string should equal the 10 */
#define SRC_STRING L"AAAAAAAAAA"
namespace CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81
{
class CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81_base
{
public:
/* pure virtual function */
virtual void action(wchar_t * data) const = 0;
};
#ifndef OMITBAD
class CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81_bad : public CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81_goodG2B : public CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_memcpy_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITGOOD */
}
|
/***********************************************************************/
/* */
/* Objective Caml */
/* */
/* Xavier Leroy and Damien Doligez, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../LICENSE. */
/* */
/***********************************************************************/
/* $Id: signals.h,v 1.27 2007/02/23 09:29:45 xleroy Exp $ */
#ifndef CAML_SIGNALS_H
#define CAML_SIGNALS_H
#ifndef CAML_NAME_SPACE
#include "compatibility.h"
#endif
#include "misc.h"
#include "mlvalues.h"
CAMLextern void caml_enter_blocking_section (void);
CAMLextern void caml_leave_blocking_section (void);
#endif /* CAML_SIGNALS_H */
|
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)exec.h 1.2 (2.11BSD GTE) 10/31/93
*/
/*
** This code has been pulled from the 2.11BSD source tree.
**
** The differences respect the original code are marked with
** comment blocks.
*/
#ifndef _EXEC_
#define _EXEC_
/*
* Header prepended to each a.out file.
*
* CHANGED FOR bin2load:
*
* In the original 2.11BSD version the members of the exec structure
* were declared as int. They have been changed to short to force
* 16 bit integers.
*/
struct exec {
short a_magic; /* magic number */
unsigned short a_text; /* size of text segment */
unsigned short a_data; /* size of initialized data */
unsigned short a_bss; /* size of uninitialized data */
unsigned short a_syms; /* size of symbol table */
unsigned short a_entry; /* entry point */
unsigned short a_unused; /* not used */
unsigned short a_flag; /* relocation info stripped */
};
#define NOVL 15 /* number of overlays */
struct ovlhdr {
short max_ovl; /* maximum overlay size */
unsigned short ov_siz[NOVL]; /* size of i'th overlay */
};
/*
** Code commented out for inclusion in bin2load
*/
/*
* eXtended header definition for use with the new macros in a.out.h
*/
/********************************************************************
struct xexec {
struct exec e;
struct ovlhdr o;
};
********************************************************************/
#define A_MAGIC1 0407 /* normal */
#define A_MAGIC2 0410 /* read-only text */
#define A_MAGIC3 0411 /* separated I&D */
#define A_MAGIC4 0405 /* overlay */
#define A_MAGIC5 0430 /* auto-overlay (nonseparate) */
#define A_MAGIC6 0431 /* auto-overlay (separate) */
#endif
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2012 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_NX_CAPSULE_GEOMETRY
#define PX_PHYSICS_NX_CAPSULE_GEOMETRY
/** \addtogroup geomutils
@{
*/
#include "geometry/PxGeometry.h"
#ifndef PX_DOXYGEN
namespace physx
{
#endif
/**
\brief Class representing the geometry of a capsule.
Capsules are shaped as the union of a cylinder of length 2 * halfHeight and with the
given radius centered at the origin and extending along the x axis, and two hemispherical ends.
\note The scaling of the capsule is expected to be baked into these values, there is no additional scaling parameter.
*/
class PxCapsuleGeometry : public PxGeometry
{
public:
/**
\brief Default constructor, initializes to a capsule with zero height and radius.
*/
PX_INLINE PxCapsuleGeometry() : PxGeometry(PxGeometryType::eCAPSULE), radius(0), halfHeight(0) {}
/**
\brief Constructor, initializes to a capsule with passed radius and half height.
*/
PX_INLINE PxCapsuleGeometry(PxReal radius_, PxReal halfHeight_) : PxGeometry(PxGeometryType::eCAPSULE), radius(radius_), halfHeight(halfHeight_) {}
/**
\brief Returns true if the geometry is valid.
\return True if the current settings are valid.
*/
PX_INLINE bool isValid() const;
public:
/**
\brief The radius of the capsule.
*/
PxReal radius;
/**
\brief half of the capsule's height, measured between the centers of the hemispherical ends.
/
*/
PxReal halfHeight;
};
PX_INLINE bool PxCapsuleGeometry::isValid() const
{
if (mType != PxGeometryType::eCAPSULE)
return false;
if (!PxIsFinite(radius) || !PxIsFinite(halfHeight))
return false;
if (radius <= 0.0f || halfHeight <= 0.0f)
return false;
return true;
}
/* \brief creates a transform from the endpoints of a segment, suitable for an actor transform for a PxCapsuleGeometry
\param[in] p0 one end of major axis of the capsule
\param[in] p1 the other end of the axis of the capsule
\param[out] halfHeight the halfHeight of the capsule. This parameter is optional.
\return A PxTransform which will transform the vector (1,0,0) to the capsule axis shrunk by the halfHeight
*/
PX_FOUNDATION_API PxTransform PxTransformFromSegment(const PxVec3& p0, const PxVec3& p1, PxReal* halfHeight = NULL);
#ifndef PX_DOXYGEN
} // namespace physx
#endif
/** @} */
#endif
|
/* !!!! GENERATED FILE - DO NOT EDIT !!!!
* --------------------------------------
*
* This file is part of liblcf. Copyright (c) 2021 liblcf authors.
* https://github.com/EasyRPG/liblcf - https://easyrpg.org
*
* liblcf is Free/Libre Open Source Software, released under the MIT License.
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code.
*/
#ifndef LCF_RPG_VARIABLE_H
#define LCF_RPG_VARIABLE_H
// Headers
#include "lcf/dbstring.h"
#include "lcf/context.h"
#include <ostream>
#include <type_traits>
/**
* rpg::Variable class.
*/
namespace lcf {
namespace rpg {
class Variable {
public:
int ID = 0;
DBString name;
};
inline bool operator==(const Variable& l, const Variable& r) {
return l.name == r.name;
}
inline bool operator!=(const Variable& l, const Variable& r) {
return !(l == r);
}
std::ostream& operator<<(std::ostream& os, const Variable& obj);
template <typename F, typename ParentCtx = Context<void,void>>
void ForEachString(Variable& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
const auto ctx1 = Context<Variable, ParentCtx>{ "name", -1, &obj, parent_ctx };
f(obj.name, ctx1);
(void)obj;
(void)f;
(void)parent_ctx;
}
} // namespace rpg
} // namespace lcf
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.