text
stringlengths
4
6.14k
/** * * SDLP SDK * Cross Platform Application Communication Stack for In-Vehicle Applications * * Copyright (C) 2013, Luxoft Professional Corp., member of IBS group * * 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. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * */ /** * @author Elena Bratanova <ebratanova@luxoft.com> */ #ifndef __APPMAN_HMI_IPC_ADDRESS_H__ #define __APPMAN_HMI_IPC_ADDRESS_H__ static const char * TO_APPMAN = "ipc:///tmp/ivilinkzmq/ApplicationMgrRequestSocket"; static const char * FROM_APPMAN = "ipc:///tmp/ivilinkzmq/ApplicationMrgReplySocket"; #endif //__APPMAN_HMI_IPC_ADDRESS_H__
/* * This file is part of Cockpit. * * Copyright (C) 2020 Red Hat, Inc. * * Cockpit 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. * * Cockpit 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 Cockpit; If not, see <http://www.gnu.org/licenses/>. */ #include "config.h" #include <fcntl.h> #include <unistd.h> #include "cockpitwebcertificate.h" #include "cockpittest.h" static void do_locate_test (int dirfd, const char *certname, const char *expected_path, const char *expected_error) { char *error = NULL; gchar *path; if (certname) { int fd = openat (dirfd, certname, O_CREAT | O_WRONLY, 0666); g_assert_cmpint (fd, >=, 0); close (fd); } path = cockpit_certificate_locate (false, &error); if (expected_path) cockpit_assert_strmatch (path, expected_path); else g_assert_cmpstr (path, ==, NULL); if (expected_error) cockpit_assert_strmatch (error, expected_error); else g_assert_cmpstr (error, ==, NULL); g_free (error); g_free (path); if (certname) g_assert_cmpint (unlinkat (dirfd, certname, 0), ==, 0); } static void test_locate (void) { g_autofree gchar *workdir = g_strdup ("/tmp/test-cockpit-webcertificate.XXXXXX"); g_autofree gchar *cert_dir = NULL; int cert_dir_fd; g_assert (g_mkdtemp (workdir) == workdir); g_setenv ("XDG_CONFIG_DIRS", workdir, TRUE); /* nonexisting dir, nothing found */ do_locate_test (-1, NULL, NULL, "No certificate found in dir: */ws-certs.d"); /* empty dir, nothing found */ cert_dir = g_build_filename (workdir, "cockpit", "ws-certs.d", NULL); g_assert_cmpint (g_mkdir_with_parents (cert_dir, 0777), ==, 0); do_locate_test (-1, NULL, NULL, "No certificate found in dir: */ws-certs.d"); /* one unrelated file */ cert_dir_fd = open (cert_dir, O_PATH); g_assert_cmpint (cert_dir_fd, >=, 0); do_locate_test (cert_dir_fd, "noise.zrt", NULL, "No certificate found in dir: */ws-certs.d"); /* one good file */ do_locate_test (cert_dir_fd, "01-first.cert", "*/cockpit/ws-certs.d/01-first.cert", NULL); /* asciibetically last one wins */ do_locate_test (cert_dir_fd, "50-better.cert", "*/cockpit/ws-certs.d/50-better.cert", NULL); /* *.crt works, too */ do_locate_test (cert_dir_fd, "60-best.crt", "*/cockpit/ws-certs.d/60-best.crt", NULL); close (cert_dir_fd); g_unsetenv ("XDG_CONFIG_DIRS"); rmdir (cert_dir); rmdir (workdir); } static void test_keypath (void) { char *path; path = cockpit_certificate_key_path ("/etc/cockpit/ws-certs.d/50-good.cert"); g_assert_cmpstr (path, ==, "/etc/cockpit/ws-certs.d/50-good.key"); g_free (path); path = cockpit_certificate_key_path ("a.cert"); g_assert_cmpstr (path, ==, "a.key"); g_free (path); path = cockpit_certificate_key_path ("a.crt"); g_assert_cmpstr (path, ==, "a.key"); g_free (path); } int main (int argc, char *argv[]) { cockpit_test_init (&argc, &argv); g_test_add_func ("/webcertificate/locate", test_locate); g_test_add_func ("/webcertificate/keypath", test_keypath); return g_test_run (); }
/*********************************************************************************************************************** * * * ANTIKERNEL v0.1 * * * * Copyright (c) 2012-2016 Andrew D. Zonenberg * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * * following conditions are met: * * * * * Redistributions of source code must retain the above copyright notice, this list of conditions, and the * * following disclaimer. * * * * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the * * following disclaimer in the documentation and/or other materials provided with the distribution. * * * * * Neither the name of the author nor the names of any contributors may be used to endorse or promote products * * derived from this software without specific prior written permission. * * * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE AUTHORS BE HELD 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. * * * ***********************************************************************************************************************/ /** @file @author Andrew D. Zonenberg @brief Declaration of FCIOB */ #ifndef FCIOB_h #define FCIOB_h class FCIOBank; #include <string> /** @brief A generic I/O buffer */ class FCIOB { public: FCIOB(); virtual ~FCIOB(); void SetBank(FCIOBank* bank); FCIOBank* GetBank(); void SetPin(std::string name); std::string GetPin(); bool IsBonded() { return m_bonded; } protected: ///The I/O bank we're associated with FCIOBank* m_bank; ///True if this IOB is bonded out in the current device package bool m_bonded; ///Pin number/name on the package (only valid if m_bonded is asserted) std::string m_pin; }; #endif
#pragma once #include "include/IAwardPoints.h" #include "include/IAwardPointsFactory.h" namespace Tennis { namespace Logic { class AwardPointsFactory : public IAwardPointsFactory { public: AwardPointsFactory () { } std::unique_ptr<IAwardPoints> create () const override; }; } }
#ifndef ELM_WIDGET_FILESELECTOR_BUTTON_H #define ELM_WIDGET_FILESELECTOR_BUTTON_H #include "Elementary.h" #include <Eio.h> /** * @addtogroup Widget * @{ * * @section elm-fileselector-button-class The Elementary Fileselector Button Class * * Elementary, besides having the @ref Fileselector_Button widget, * exposes its foundation -- the Elementary Fileselector Button Class * -- in order to create other widgets which are a fileselector_button * with some more logic on top. */ /** * Base button smart data extended with fileselector_button instance data. */ typedef struct _Elm_Fileselector_Button_Smart_Data \ Elm_Fileselector_Button_Smart_Data; struct _Elm_Fileselector_Button_Smart_Data { Evas_Object *obj; // the object itself Evas_Object *fs, *fsw; const char *window_title; Evas_Coord w, h; struct { const char *path; Eina_Bool expandable : 1; Eina_Bool folder_only : 1; Eina_Bool is_save : 1; } fsd; Eina_Bool inwin_mode : 1; }; /** * @} */ #define ELM_FILESELECTOR_BUTTON_DATA_GET(o, sd) \ Elm_Fileselector_Button_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_FILESELECTOR_BUTTON_CLASS) #define ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(o, ptr) \ ELM_FILESELECTOR_BUTTON_DATA_GET(o, ptr); \ if (EINA_UNLIKELY(!ptr)) \ { \ CRI("No widget data for object %p (%s)", \ o, evas_object_type_get(o)); \ return; \ } #define ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ ELM_FILESELECTOR_BUTTON_DATA_GET(o, ptr); \ if (EINA_UNLIKELY(!ptr)) \ { \ CRI("No widget data for object %p (%s)", \ o, evas_object_type_get(o)); \ return val; \ } #define ELM_FILESELECTOR_BUTTON_CHECK(obj) \ if (EINA_UNLIKELY(!eo_isa((obj), ELM_OBJ_FILESELECTOR_BUTTON_CLASS))) \ return #endif
/* * 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/core/client/CoreErrors.h> #include <aws/autoscaling/AutoScaling_EXPORTS.h> namespace Aws { namespace AutoScaling { enum class AutoScalingErrors { //From Core// ////////////////////////////////////////////////////////////////////////////////////////// INCOMPLETE_SIGNATURE = 0, INTERNAL_FAILURE = 1, INVALID_ACTION = 2, INVALID_CLIENT_TOKEN_ID = 3, INVALID_PARAMETER_COMBINATION = 4, INVALID_QUERY_PARAMETER = 5, INVALID_PARAMETER_VALUE = 6, MISSING_ACTION = 7, // SDK should never allow MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow MISSING_PARAMETER = 9, // SDK should never allow OPT_IN_REQUIRED = 10, REQUEST_EXPIRED = 11, SERVICE_UNAVAILABLE = 12, THROTTLING = 13, VALIDATION = 14, ACCESS_DENIED = 15, RESOURCE_NOT_FOUND = 16, UNRECOGNIZED_CLIENT = 17, MALFORMED_QUERY_STRING = 18, SLOW_DOWN = 19, REQUEST_TIME_TOO_SKEWED = 20, INVALID_SIGNATURE = 21, SIGNATURE_DOES_NOT_MATCH = 22, INVALID_ACCESS_KEY_ID = 23, NETWORK_CONNECTION = 99, UNKNOWN = 100, /////////////////////////////////////////////////////////////////////////////////////////// ALREADY_EXISTS_FAULT= static_cast<int>(Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1, INVALID_NEXT_TOKEN, LIMIT_EXCEEDED_FAULT, RESOURCE_CONTENTION_FAULT, RESOURCE_IN_USE_FAULT, SCALING_ACTIVITY_IN_PROGRESS_FAULT }; namespace AutoScalingErrorMapper { AWS_AUTOSCALING_API Client::AWSError<Client::CoreErrors> GetErrorForName(const char* errorName); } } // namespace AutoScaling } // namespace Aws
#pragma once #include <iostream> std::wstring get_message();
#ifndef __IMAGE_CODEC_JPEG_CODEC_H__ #define __IMAGE_CODEC_JPEG_CODEC_H__ #include "stream.h" #include "jpeg_utils.h" class JpegEncoder { public: JpegEncoder() {} virtual ~JpegEncoder() {} bool onEncode(Stream* stream, int type, unsigned char* imageBuf, int width, int height, int stride, int depth, int quality); }; class JpegDecoder { public: JpegDecoder() {} virtual ~JpegDecoder() {} bool onDecode(Stream* stream, int type, unsigned char** imageBuf, int* width, int* height, int* stride, int* depth); }; #endif /* __IMAGE_CODEC_JPEG_CODEC_H__ */
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QCFSOCKETNOTIFIER_P_H #define QCFSOCKETNOTIFIER_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include <QtCore/qabstracteventdispatcher.h> #include <QtCore/qhash.h> #include <CoreFoundation/CoreFoundation.h> QT_BEGIN_NAMESPACE struct MacSocketInfo { MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0), readEnabled(false), writeEnabled(false) {} CFSocketRef socket; CFRunLoopSourceRef runloop; QObject *readNotifier; QObject *writeNotifier; bool readEnabled; bool writeEnabled; }; typedef QHash<int, MacSocketInfo *> MacSocketHash; typedef void (*MaybeCancelWaitForMoreEventsFn)(QAbstractEventDispatcher *hostEventDispacher); // The CoreFoundationSocketNotifier class implements socket notifiers support using // CFSocket for event dispatchers running on top of the Core Foundation run loop system. // (currently Mac and iOS) // // The principal functions are registerSocketNotifier() and unregisterSocketNotifier(). // // setHostEventDispatcher() should be called at startup. // removeSocketNotifiers() should be called at shutdown. // class QCFSocketNotifier { public: QCFSocketNotifier(); ~QCFSocketNotifier(); void setHostEventDispatcher(QAbstractEventDispatcher *hostEventDispacher); void setMaybeCancelWaitForMoreEventsCallback(MaybeCancelWaitForMoreEventsFn callBack); void registerSocketNotifier(QSocketNotifier *notifier); void unregisterSocketNotifier(QSocketNotifier *notifier); void removeSocketNotifiers(); private: void destroyRunLoopObserver(); static void unregisterSocketInfo(MacSocketInfo *socketInfo); static void enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info); MacSocketHash macSockets; QAbstractEventDispatcher *eventDispatcher; MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents; CFRunLoopObserverRef enableNotifiersObserver; friend void qt_mac_socket_callback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *); }; QT_END_NAMESPACE #endif
/* * Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /* * File: LeaveMeshPacket.h * Author: rmartins * * Created on September 1, 2010, 11:11 AM */ #ifndef LEAVEMESHPACKET_H #define LEAVEMESHPACKET_H #include <stheno/core/p2p/net/packet/SthenoPacket.h> #include <stheno/core/p2p/p3/superpeer/cell/CellID.h> #include <stheno/core/p2p/p3/superpeer/cell/net/packet/CellPacketTypes.h> #include <euryale/net/endpoint/Endpoint.h> class LeaveMeshPacket : public SthenoPacket { public: LeaveMeshPacket(UUIDPtr& srcPID, UUIDPtr& srcFID, UUIDPtr& dstPID, UUIDPtr& dstFID, ULong requestID, UUIDPtr& uuid, CellIDPtr& cellID ) : SthenoPacket(srcPID, srcFID, dstPID, dstFID, LEAVE_MESH_PACKET, requestID), m_uuid(uuid), m_cellID(cellID){} LeaveMeshPacket() : SthenoPacket() { } virtual ~LeaveMeshPacket(); virtual void serialize(OutputStream& outputStream) THROW(SerializationException&) { UInt bodySize = getBodySerializationSize(); ((SthenoHeader*) m_packetHeader)->m_messageSize = bodySize; serializeHeader(outputStream); serializeBody(outputStream); } UUIDPtr& getUUID(){ return m_uuid; } CellIDPtr& getCellID(){ return m_cellID; } protected: UUIDPtr m_uuid; CellIDPtr m_cellID; virtual void serializeBody(OutputStream& outputStream) THROW(SerializationException&) { m_uuid->serialize(outputStream); m_cellID->serialize(outputStream); } virtual void deserializeBody(InputStream& inputStream) THROW(SerializationException&) { UUID* uuid = new UUID(inputStream); m_uuid.reset(uuid); CellID* cellID = new CellID(inputStream); m_cellID.reset(cellID); } }; #endif /* LEAVEMESHPACKET_H */
/* $NetBSD: bf_cbc.c,v 1.12 2005/12/11 12:20:48 christos Exp $ */ /* crypto/bf/bf_cbc.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * 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 copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include <sys/cdefs.h> __KERNEL_RCSID(0, "$NetBSD: bf_cbc.c,v 1.12 2005/12/11 12:20:48 christos Exp $"); #include <sys/types.h> #include <crypto/blowfish/blowfish.h> #include "bf_locl.h" void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int encrypt) { register BF_LONG tin0,tin1; register BF_LONG tout0,tout1,xor0,xor1; register long l=length; BF_LONG tin[2]; if (encrypt) { n2l(ivec,tout0); n2l(ivec,tout1); ivec-=8; for (l-=8; l>=0; l-=8) { n2l(in,tin0); n2l(in,tin1); tin0^=tout0; tin1^=tout1; tin[0]=tin0; tin[1]=tin1; BF_encrypt(tin,(const BF_KEY *)schedule); tout0=tin[0]; tout1=tin[1]; l2n(tout0,out); l2n(tout1,out); } if (l != -8) { n2ln(in,tin0,tin1,l+8); tin0^=tout0; tin1^=tout1; tin[0]=tin0; tin[1]=tin1; BF_encrypt(tin,(const BF_KEY *)schedule); tout0=tin[0]; tout1=tin[1]; l2n(tout0,out); l2n(tout1,out); } l2n(tout0,ivec); l2n(tout1,ivec); } else { n2l(ivec,xor0); n2l(ivec,xor1); ivec-=8; for (l-=8; l>=0; l-=8) { n2l(in,tin0); n2l(in,tin1); tin[0]=tin0; tin[1]=tin1; BF_decrypt(tin,(const BF_KEY *)schedule); tout0=tin[0]^xor0; tout1=tin[1]^xor1; l2n(tout0,out); l2n(tout1,out); xor0=tin0; xor1=tin1; } if (l != -8) { n2l(in,tin0); n2l(in,tin1); tin[0]=tin0; tin[1]=tin1; BF_decrypt(tin,(const BF_KEY *)schedule); tout0=tin[0]^xor0; tout1=tin[1]^xor1; l2nn(tout0,tout1,out,l+8); xor0=tin0; xor1=tin1; } l2n(xor0,ivec); l2n(xor1,ivec); } tin0=tin1=tout0=tout1=xor0=xor1=0; tin[0]=tin[1]=0; }
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ #define CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ #include "base/android/jni_helper.h" #include "base/android/scoped_java_ref.h" #include "components/autofill/browser/personal_data_manager.h" #include "components/autofill/browser/personal_data_manager_observer.h" namespace autofill { // Android wrapper of the PersonalDataManager which provides access from the // Java layer. Note that on Android, there's only a single profile, and // therefore a single instance of this wrapper. class PersonalDataManagerAndroid : public PersonalDataManagerObserver { public: PersonalDataManagerAndroid(JNIEnv* env, jobject obj); // Regular Autofill Profiles // ------------------------- // Returns the number of web and auxiliary profiles. jint GetProfileCount(JNIEnv* unused_env, jobject unused_obj); // Returns the profile as indexed by |index| in the PersonalDataManager's // |GetProfiles()| collection. base::android::ScopedJavaLocalRef<jobject> GetProfileByIndex( JNIEnv* env, jobject unused_obj, jint index); // Returns the profile with the specified |jguid|, or NULL if there is no // profile with the specified |jguid|. Both web and auxiliary profiles may // be returned. base::android::ScopedJavaLocalRef<jobject> GetProfileByGUID( JNIEnv* env, jobject unused_obj, jstring jguid); // Adds or modifies a profile. If |jguid| is an empty string, we are creating // a new profile. Else we are updating an existing profile. Always returns // the GUID for this profile; the GUID it may have just been created. base::android::ScopedJavaLocalRef<jstring> SetProfile(JNIEnv* env, jobject unused_obj, jobject jprofile); // Credit Card Profiles // -------------------- // Returns the number of credit cards. jint GetCreditCardCount(JNIEnv* unused_env, jobject unused_obj); // Returns the credit card as indexed by |index| in the PersonalDataManager's // |credit_cards()| collection. base::android::ScopedJavaLocalRef<jobject> GetCreditCardByIndex( JNIEnv* env, jobject unused_obj, jint index); // Returns the credit card with the specified |jguid|, or NULL if there is // no credit card with the specified |jguid|. base::android::ScopedJavaLocalRef<jobject> GetCreditCardByGUID( JNIEnv* env, jobject unused_obj, jstring jguid); // Adds or modifies a credit card. If |jguid| is an empty string, we are // creating a new profile. Else we are updating an existing profile. Always // returns the GUID for this profile; the GUID it may have just been created. base::android::ScopedJavaLocalRef<jstring> SetCreditCard( JNIEnv* env, jobject unused_obj, jobject jcard); // Removes the profile or credit card represented by |jguid|. void RemoveByGUID(JNIEnv* env, jobject unused_obj, jstring jguid); // PersonalDataManagerObserver: virtual void OnPersonalDataChanged() OVERRIDE; // Registers the JNI bindings for this class. static bool Register(JNIEnv* env); private: virtual ~PersonalDataManagerAndroid(); // Pointer to the java counterpart. JavaObjectWeakGlobalRef weak_java_obj_; // Pointer to the PersonalDataManager for the main profile. PersonalDataManager* personal_data_manager_; DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); }; } // namespace autofill #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_
#import <UIKit/UIKit.h> enum { MobFoxInterstitialViewErrorUnknown = 0, MobFoxInterstitialViewErrorServerFailure = 1, MobFoxInterstitialViewErrorInventoryUnavailable = 2, }; typedef enum { MobFoxAdTypeNoAdInventory = 0, MobFoxAdTypeVideo = 1, MobFoxAdTypeError = 2, MobFoxAdTypeUnknown = 3, MobFoxAdTypeText = 4, MobFoxAdTypeImage = 5, MobFoxAdTypeMraid = 6 } MobFoxAdType; typedef enum { MobFoxAdGroupVideo = 0, MobFoxAdGroupInterstitial = 1 } MobFoxAdGroupType; @class MobFoxVideoInterstitialViewController; @class MobFoxAdBrowserViewController; @protocol MobFoxVideoInterstitialViewControllerDelegate <NSObject> - (NSString *)publisherIdForMobFoxVideoInterstitialView:(MobFoxVideoInterstitialViewController *)videoInterstitial; @optional - (void)mobfoxVideoInterstitialViewDidLoadMobFoxAd:(MobFoxVideoInterstitialViewController *)videoInterstitial advertTypeLoaded:(MobFoxAdType)advertType; - (void)mobfoxVideoInterstitialView:(MobFoxVideoInterstitialViewController *)videoInterstitial didFailToReceiveAdWithError:(NSError *)error; - (void)mobfoxVideoInterstitialViewActionWillPresentScreen:(MobFoxVideoInterstitialViewController *)videoInterstitial; - (void)mobfoxVideoInterstitialViewWillDismissScreen:(MobFoxVideoInterstitialViewController *)videoInterstitial; - (void)mobfoxVideoInterstitialViewDidDismissScreen:(MobFoxVideoInterstitialViewController *)videoInterstitial; - (void)mobfoxVideoInterstitialViewActionWillLeaveApplication:(MobFoxVideoInterstitialViewController *)videoInterstitial; - (void)mobfoxVideoInterstitialViewWasClicked:(MobFoxVideoInterstitialViewController *)videoInterstitial; @end @interface MobFoxVideoInterstitialViewController : UIViewController { BOOL advertLoaded; BOOL advertViewActionInProgress; __unsafe_unretained id <MobFoxVideoInterstitialViewControllerDelegate> delegate; MobFoxAdBrowserViewController *_browser; NSString *requestURL; NSString *videoRequestURL; UIImage *_bannerImage; } @property (nonatomic, assign) IBOutlet __unsafe_unretained id <MobFoxVideoInterstitialViewControllerDelegate> delegate; @property (nonatomic, readonly, getter=isAdvertLoaded) BOOL advertLoaded; @property (nonatomic, readonly, getter=isAdvertViewActionInProgress) BOOL advertViewActionInProgress; @property (nonatomic, assign) BOOL locationAwareAdverts; @property (nonatomic, assign) BOOL enableInterstitialAds; @property (nonatomic, assign) BOOL enableVideoAds; @property (nonatomic, assign) BOOL prioritizeVideoAds; @property (nonatomic, assign) NSInteger video_min_duration; @property (nonatomic, assign) NSInteger video_max_duration; @property (nonatomic, assign) NSInteger userAge; @property (nonatomic, assign) NSString* userGender; @property (nonatomic, retain) NSArray* keywords; @property (nonatomic, strong) NSString *requestURL; - (void)requestAd; - (void)presentAd:(MobFoxAdType)advertType; - (void)setLocationWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; @end extern NSString * const MobFoxVideoInterstitialErrorDomain;
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is the Cisco Systems SIP Stack. * * The Initial Developer of the Original Code is * Cisco Systems (CSCO). * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Enda Mannion <emannion@cisco.com> * Suhas Nandakumar <snandaku@cisco.com> * Ethan Hugg <ehugg@cisco.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef _CCAPI_DEVICE_LISTENER_H_ #define _CCAPI_DEVICE_LISTENER_H_ #include "cc_constants.h" /** * Generates Device event * @param [in] type - event type for device * @param [in] device_id - device id * @param [in] dev_info - reference to device info * @returns * NOTE: The memory associated with deviceInfo will be freed immediately upon * return from this method. If the application wishes to retain a copy it should * invoke CCAPI_Device_retainDeviceInfo() API. once the info is retained it can be * released by invoking CCAPI_Device_releaseDeviceInfo() API */ void CCAPI_DeviceListener_onDeviceEvent(ccapi_device_event_e type, cc_device_handle_t device_id, cc_deviceinfo_ref_t dev_info); /** * Generates Feature event * @param [in] type - event type for device * @param [in] device_id - device id * @param [in] feature_info - reference to feature info * @returns * NOTE: The memory associated with featureInfo will be freed immediately upon * return from this method. If the application wishes to retain a copy it should * invoke CCAPI_Device_retainFeatureInfo() API. once the info is retained it can be * released by invoking CCAPI_Device_releaseFeatureInfo() API */ void CCAPI_DeviceListener_onFeatureEvent(ccapi_device_event_e type, cc_deviceinfo_ref_t device_info, cc_featureinfo_ref_t feature_info); #endif /* _CCAPIAPI_DEVICE_LISTENER_H_ */
/* Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available. You may not use this file except in compliance with the License. obtain a copy of the License at http://www.imagemagick.org/script/license.php 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. MagickCore Windows NT private methods. */ #ifndef MAGICKCORE_NT_BASE_PRIVATE_H #define MAGICKCORE_NT_BASE_PRIVATE_H #include "MagickCore/delegate.h" #include "MagickCore/delegate-private.h" #include "MagickCore/exception.h" #include "MagickCore/splay-tree.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif #if defined(MAGICKCORE_WINDOWS_SUPPORT) #if !defined(XS_VERSION) struct dirent { char d_name[2048]; int d_namlen; }; typedef struct _DIR { HANDLE hSearch; WIN32_FIND_DATAW Win32FindData; BOOL firsttime; struct dirent file_info; } DIR; typedef struct _NTMEMORYSTATUSEX { DWORD dwLength, dwMemoryLoad; DWORDLONG ullTotalPhys, ullAvailPhys, ullTotalPageFile, ullAvailPageFile, ullTotalVirtual, ullAvailVirtual, ullAvailExtendedVirtual; } NTMEMORYSTATUSEX; #if !defined(__MINGW32__) && !defined(__MINGW64__) struct timezone { int tz_minuteswest, tz_dsttime; }; #endif typedef UINT (CALLBACK *LPFNDLLFUNC1)(DWORD,UINT); typedef UINT (CALLBACK *LPFNDLLFUNC2)(NTMEMORYSTATUSEX *); #endif #if defined(MAGICKCORE_BZLIB_DELEGATE) # if defined(_WIN32) # define BZ_IMPORT 1 # endif #endif extern MagickPrivate char *NTGetLastError(void); #if !defined(MAGICKCORE_LTDL_DELEGATE) extern MagickPrivate const char *NTGetLibraryError(void); #endif #if !defined(XS_VERSION) extern MagickPrivate const char *NTGetLibraryError(void); extern MagickPrivate DIR *NTOpenDirectory(const char *); extern MagickPrivate double NTElapsedTime(void), NTErf(double), NTUserTime(void); extern MagickPrivate int Exit(int), #if !defined(__MINGW32__) && !defined(__MINGW64__) gettimeofday(struct timeval *,struct timezone *), #endif IsWindows95(void), NTCloseDirectory(DIR *), NTCloseLibrary(void *), NTControlHandler(void), NTExitLibrary(void), NTTruncateFile(int,off_t), NTGhostscriptDLL(char *,int), NTGhostscriptEXE(char *,int), NTGhostscriptFonts(char *,int), NTGhostscriptLoadDLL(void), NTInitializeLibrary(void), NTSetSearchPath(const char *), NTSyncMemory(void *,size_t,int), NTUnmapMemory(void *,size_t), NTSystemCommand(const char *,char *); extern MagickPrivate ssize_t NTSystemConfiguration(int), NTTellDirectory(DIR *); extern MagickPrivate MagickBooleanType NTGatherRandomData(const size_t,unsigned char *), NTGetExecutionPath(char *,const size_t), NTGetModulePath(const char *,char *), NTReportEvent(const char *,const MagickBooleanType), NTReportException(const char *,const MagickBooleanType); extern MagickPrivate struct dirent *NTReadDirectory(DIR *); extern MagickPrivate unsigned char *NTRegistryKeyLookup(const char *), *NTResourceToBlob(const char *); extern MagickPrivate void *NTGetLibrarySymbol(void *,const char *), NTInitializeWinsock(MagickBooleanType), *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType), *NTOpenLibrary(const char *), NTSeekDirectory(DIR *,ssize_t), NTWindowsGenesis(void), NTWindowsTerminus(void); #endif /* !XS_VERSION */ #endif /* MAGICKCORE_WINDOWS_SUPPORT */ #if defined(__cplusplus) || defined(c_plusplus) } #endif /* !C++ */ #endif /* !MAGICKCORE_NT_BASE_H */
/* Copyright (c) 2008-2014, Avian Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. There is NO WARRANTY for this software. See license.txt for details. */ #ifndef AVIAN_CODEGEN_COMPILER_CONTEXT_H #define AVIAN_CODEGEN_COMPILER_CONTEXT_H #include <avian/codegen/assembler.h> #include <avian/codegen/compiler.h> #include <avian/util/list.h> #include "regalloc.h" using namespace avian::util; namespace avian { namespace codegen { namespace compiler { class Stack; class Local; class Event; class LogicalInstruction; class Resource; class RegisterResource; class FrameResource; class ConstantPoolNode; class ForkState; class MySubroutine; class Block; template<class T> List<T>* reverseDestroy(List<T>* cell) { List<T>* previous = 0; while (cell) { List<T>* next = cell->next; cell->next = previous; previous = cell; cell = next; } return previous; } class Context { public: Context(vm::System* system, Assembler* assembler, vm::Zone* zone, Compiler::Client* client); vm::System* system; Assembler* assembler; Architecture* arch; vm::Zone* zone; Compiler::Client* client; Stack* stack; Local* locals; List<Value*>* saved; Event* predecessor; LogicalInstruction** logicalCode; const RegisterFile* regFile; RegisterAllocator regAlloc; RegisterResource* registerResources; FrameResource* frameResources; Resource* acquiredResources; ConstantPoolNode* firstConstant; ConstantPoolNode* lastConstant; uint8_t* machineCode; Event* firstEvent; Event* lastEvent; ForkState* forkState; MySubroutine* subroutine; Block* firstBlock; int logicalIp; unsigned constantCount; unsigned logicalCodeLength; unsigned parameterFootprint; unsigned localFootprint; unsigned machineCodeSize; unsigned alignedFrameSize; unsigned availableGeneralRegisterCount; }; inline Aborter* getAborter(Context* c) { return c->system; } template<class T> List<T>* cons(Context* c, const T& value, List<T>* next) { return new (c->zone) List<T>(value, next); } } // namespace compiler } // namespace codegen } // namespace avian #endif // AVIAN_CODEGEN_COMPILER_CONTEXT_H
#ifndef SH_RT_H #define SH_RT_H #pragma once ////////////////////////////////////////////////////////////////////////// class ENGINE_API CRT : public xr_resource_named { public: IDirect3DTexture9* pSurface; IDirect3DSurface9* pRT; ref_texture pTexture; u32 dwWidth; u32 dwHeight; D3DFORMAT fmt; u64 _order; CRT (); ~CRT (); void create (LPCSTR Name, u32 w, u32 h, D3DFORMAT f); void destroy (); void reset_begin (); void reset_end (); IC BOOL valid () { return !!pTexture; } }; struct ENGINE_API resptrcode_crt : public resptr_base<CRT> { void create (LPCSTR Name, u32 w, u32 h, D3DFORMAT f); void destroy () { _set(NULL); } }; typedef resptr_core<CRT,resptrcode_crt> ref_rt; ////////////////////////////////////////////////////////////////////////// class ENGINE_API CRTC : public xr_resource_named { public: IDirect3DCubeTexture9* pSurface; IDirect3DSurface9* pRT[6]; ref_texture pTexture; u32 dwSize; D3DFORMAT fmt; u64 _order; CRTC (); ~CRTC (); void create (LPCSTR name, u32 size, D3DFORMAT f); void destroy (); void reset_begin (); void reset_end (); IC BOOL valid () { return !pTexture; } }; struct ENGINE_API resptrcode_crtc : public resptr_base<CRTC> { void create (LPCSTR Name, u32 size, D3DFORMAT f); void destroy () { _set(NULL); } }; typedef resptr_core<CRTC,resptrcode_crtc> ref_rtc; #endif // SH_RT_H
/********************************************************************** Copyright(c) 2011-2014 Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of 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. **********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> // for memset, memcmp #include "erasure-code.h" #include "erasure/tests.h" #ifndef FUNCTION_UNDER_TEST # define FUNCTION_UNDER_TEST gf_vect_dot_prod_sse #endif #define str(s) #s #define xstr(s) str(s) //#define CACHED_TEST #ifdef CACHED_TEST // Cached test, loop many times over small dataset # define TEST_SOURCES 10 # define TEST_LEN 8*1024 # define TEST_LOOPS 40000 # define TEST_TYPE_STR "_warm" #else # ifndef TEST_CUSTOM // Uncached test. Pull from large mem base. # define TEST_SOURCES 10 # define GT_L3_CACHE 32*1024*1024 /* some number > last level cache */ # define TEST_LEN ((GT_L3_CACHE / TEST_SOURCES) & ~(64-1)) # define TEST_LOOPS 100 # define TEST_TYPE_STR "_cold" # else # define TEST_TYPE_STR "_cus" # ifndef TEST_LOOPS # define TEST_LOOPS 1000 # endif # endif #endif typedef unsigned char u8; void dump(unsigned char *buf, int len) { int i; for (i = 0; i < len;) { printf(" %2x", 0xff & buf[i++]); if (i % 32 == 0) printf("\n"); } printf("\n"); } void dump_matrix(unsigned char **s, int k, int m) { int i, j; for (i = 0; i < k; i++) { for (j = 0; j < m; j++) { printf(" %2x", s[i][j]); } printf("\n"); } printf("\n"); } int main(int argc, char *argv[]) { int i, j; void *buf; u8 g[TEST_SOURCES], g_tbls[TEST_SOURCES * 32], *dest, *dest_ref; u8 *temp_buff, *buffs[TEST_SOURCES]; struct perf start, stop; printf(xstr(FUNCTION_UNDER_TEST) ": %dx%d\n", TEST_SOURCES, TEST_LEN); // Allocate the arrays for (i = 0; i < TEST_SOURCES; i++) { if (posix_memalign(&buf, 64, TEST_LEN)) { printf("alloc error: Fail"); return -1; } buffs[i] = buf; } if (posix_memalign(&buf, 64, TEST_LEN)) { printf("alloc error: Fail"); return -1; } dest = buf; if (posix_memalign(&buf, 64, TEST_LEN)) { printf("alloc error: Fail"); return -1; } dest_ref = buf; if (posix_memalign(&buf, 64, TEST_LEN)) { printf("alloc error: Fail"); return -1; } temp_buff = buf; // Performance test for (i = 0; i < TEST_SOURCES; i++) for (j = 0; j < TEST_LEN; j++) buffs[i][j] = rand(); memset(dest, 0, TEST_LEN); memset(temp_buff, 0, TEST_LEN); memset(dest_ref, 0, TEST_LEN); memset(g, 0, TEST_SOURCES); for (i = 0; i < TEST_SOURCES; i++) g[i] = rand(); for (j = 0; j < TEST_SOURCES; j++) gf_vect_mul_init(g[j], &g_tbls[j * 32]); gf_vect_dot_prod_base(TEST_LEN, TEST_SOURCES, &g_tbls[0], buffs, dest_ref); #ifdef DO_REF_PERF perf_start(&start); for (i = 0; i < TEST_LOOPS; i++) { for (j = 0; j < TEST_SOURCES; j++) gf_vect_mul_init(g[j], &g_tbls[j * 32]); gf_vect_dot_prod_base(TEST_LEN, TEST_SOURCES, &g_tbls[0], buffs, dest_ref); } perf_stop(&stop); printf("gf_vect_dot_prod_base" TEST_TYPE_STR ": "); perf_print(stop, start, (long long)TEST_LEN * (TEST_SOURCES + 1) * i); #endif FUNCTION_UNDER_TEST(TEST_LEN, TEST_SOURCES, g_tbls, buffs, dest); perf_start(&start); for (i = 0; i < TEST_LOOPS; i++) { for (j = 0; j < TEST_SOURCES; j++) gf_vect_mul_init(g[j], &g_tbls[j * 32]); FUNCTION_UNDER_TEST(TEST_LEN, TEST_SOURCES, g_tbls, buffs, dest); } perf_stop(&stop); printf(xstr(FUNCTION_UNDER_TEST) TEST_TYPE_STR ": "); perf_print(stop, start, (long long)TEST_LEN * (TEST_SOURCES + 1) * i); if (0 != memcmp(dest_ref, dest, TEST_LEN)) { printf("Fail zero " xstr(FUNCTION_UNDER_TEST) " test\n"); dump_matrix(buffs, 5, TEST_SOURCES); printf("dprod_base:"); dump(dest_ref, 25); printf("dprod:"); dump(dest, 25); return -1; } printf("pass perf check\n"); return 0; }
// RUN: rm -rf %t // RUN: mkdir %t // RUN: env CINDEXTEST_INVOCATION_EMISSION_PATH=%t not c-index-test -code-completion-at=%s:10:1 "-remap-file=%s,%S/Inputs/record-parsing-invocation-remap.c" %s // RUN: cat %t/libclang-* | FileCheck %s // RUN: rm -rf %t // RUN: mkdir %t // RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 CINDEXTEST_INVOCATION_EMISSION_PATH=%t not --crash c-index-test -code-completion-at=%s:10:1 "-remap-file=%s,%S/Inputs/record-parsing-invocation-remap.c" %s // RUN: cat %t/libclang-* | FileCheck %s // CHECK: {"toolchain":"{{.*}}","signature":"{{.*}}","libclang.operation":"complete","libclang.opts":1,"args":["clang","-fno-spell-checking","{{.*}}record-completion-invocation.c","-Xclang","-detailed-preprocessing-record","-fallow-editor-placeholders"],"invocation-args":["-code-completion-at={{.*}}record-completion-invocation.c:10:1"],"unsaved_file_hashes":[{"name":"{{.*}}record-completion-invocation.c","md5":"aee23773de90e665992b48209351d70e"}]}
/**************************************************************************** ** ** Trolltech hereby grants a license to use the Qt/Eclipse Integration ** plug-in (the software contained herein), in binary form, solely for the ** purpose of creating code to be used with Trolltech's Qt software. ** ** Qt Designer is licensed under the terms of the GNU General Public ** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the ** right to use certain no GPL licensed software under the terms of its GPL ** Exception version 1.2 (http://trolltech.com/products/qt/gplexception). ** ** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "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." ** ** Since we now have the GPL exception I think that the "special exception ** is no longer needed. The license text proposed above (other than the ** special exception portion of it) is the BSD license and we have added ** the BSD license as a permissible license under the exception. ** ****************************************************************************/ #ifndef QQRDECODER_H #define QQRDECODER_H #include <QtGui/QMainWindow> #include <QPixmap> #include "ui_QQrDecoder.h" #include <qzxing.h> class QQrDecoder : public QMainWindow { Q_OBJECT public: QQrDecoder(QWidget *parent = 0); ~QQrDecoder(); protected slots: void decodeImage(QImage originalImage); void reportTagFound(QString tag); private: Ui::QQrDecoder ui; QZXing decoder; }; #endif // QQRDECODER_H
/* * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. */ #ifndef SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVS_PEER_H_ #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVS_PEER_H_ #include <cmn/agent_cmn.h> #include <oper/peer.h> class OvsPeerManager; // Peer for routes added by OVS class OvsPeer : public Peer { public: OvsPeer(const IpAddress &peer_ip, uint64_t gen_id, OvsPeerManager *manager); virtual ~OvsPeer(); bool Compare(const Peer *rhs) const; const Ip4Address *NexthopIp(Agent *agent, const AgentPath *path) const; bool AddOvsRoute(const VnEntry *vn, const MacAddress &mac, Ip4Address &tor_ip); void DeleteOvsRoute(VrfEntry *vrf, uint32_t vxlan, const MacAddress &mac); private: IpAddress peer_ip_; uint64_t gen_id_; OvsPeerManager *peer_manager_; DISALLOW_COPY_AND_ASSIGN(OvsPeer); }; class OvsPeerManager { public: struct cmp { bool operator()(const OvsPeer *lhs, const OvsPeer *rhs) { return lhs->Compare(rhs); } }; typedef std::set<OvsPeer *, cmp> OvsPeerTable; OvsPeerManager(Agent *agent); virtual ~OvsPeerManager(); OvsPeer *Allocate(const IpAddress &peer_ip); void Free(OvsPeer *peer); uint32_t Size() const; Agent *agent() const; private: uint64_t gen_id_; Agent *agent_; OvsPeerTable table_; DISALLOW_COPY_AND_ASSIGN(OvsPeerManager); }; #endif // SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVS_PEER_H_
// Copyright 2013-2016 Stanford University // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an AS IS BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef STOKE_SRC_VALIDATOR_INVARIANT_TRUE_H #define STOKE_SRC_VALIDATOR_INVARIANT_TRUE_H #include "src/validator/invariant.h" namespace stoke { class TrueInvariant : public Invariant { public: using Invariant::check; TrueInvariant() {} SymBool operator()(SymState& left, SymState& right, size_t& tln, size_t& rln) const { return SymBool::_true(); } std::ostream& write(std::ostream& os) const { os << "true"; return os; } bool check(const CpuState& target, const CpuState& rewrite) const { return true; } }; } // namespace stoke #endif
/* ------------------------------------------------------------------ * Copyright (C) 1998-2009 PacketVideo * * 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. * ------------------------------------------------------------------- */ /* Filename: pvmp3_tables.h Date: 09/21/2007 ------------------------------------------------------------------------------ REVISION HISTORY Description: ------------------------------------------------------------------------------ INCLUDE DESCRIPTION ------------------------------------------------------------------------------ */ #ifndef PVMP3_TABLES_H #define PVMP3_TABLES_H /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ #include "pvmp3_dec_defs.h" #include "pv_mp3_huffman.h" /*---------------------------------------------------------------------------- ; MACROS ; Define module specific macros here ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; EXTERNAL VARIABLES REFERENCES ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; DEFINES AND SIMPLE TYPEDEF'S ----------------------------------------------------------------------------*/ #define Qfmt_28(a) (int32(double(0x10000000)*(a))) /*---------------------------------------------------------------------------- ; SIMPLE TYPEDEF'S ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; ENUMERATED TYPEDEF'S ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; STRUCTURES TYPEDEF'S ----------------------------------------------------------------------------*/ typedef struct { int16 l[23]; int16 s[14]; } mp3_scaleFactorBandIndex; /*---------------------------------------------------------------------------- ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif extern const int32 mp3_s_freq[4][4]; extern const int32 inv_sfreq[4]; extern const int16 mp3_bitrate[3][15]; extern const int32 power_one_third[513]; extern const mp3_scaleFactorBandIndex mp3_sfBandIndex[9]; extern const int32 mp3_shortwindBandWidths[9][13]; extern const int32 pqmfSynthWin[(HAN_SIZE/2) + 8]; extern const uint16 huffTable_1[]; extern const uint16 huffTable_2[]; extern const uint16 huffTable_3[]; extern const uint16 huffTable_5[]; extern const uint16 huffTable_6[]; extern const uint16 huffTable_7[]; extern const uint16 huffTable_8[]; extern const uint16 huffTable_9[]; extern const uint16 huffTable_10[]; extern const uint16 huffTable_11[]; extern const uint16 huffTable_12[]; extern const uint16 huffTable_13[]; extern const uint16 huffTable_15[]; extern const uint16 huffTable_16[]; extern const uint16 huffTable_24[]; extern const uint16 huffTable_32[]; extern const uint16 huffTable_33[]; #ifdef __cplusplus } #endif /*---------------------------------------------------------------------------- ; END ----------------------------------------------------------------------------*/ #endif
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Vladimir Vukicevic <vladimir@pobox.com> * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsICanvasElementExternal_h___ #define nsICanvasElementExternal_h___ #include "nsISupports.h" #include "gfxPattern.h" class gfxContext; class nsIFrame; struct gfxRect; #define NS_ICANVASELEMENTEXTERNAL_IID \ { 0x51870f54, 0x6c4c, 0x469a, {0xad, 0x46, 0xf0, 0xa9, 0x8e, 0x32, 0xa7, 0xe2 } } class nsRenderingContext; class nsICanvasRenderingContextInternal; struct _cairo_surface; /* * This interface contains methods that are needed outside of the content/layout * modules, specifically widget. It should eventually go away when we support * libxul builds, and nsHTMLCanvasElement be used directly. * * Code internal to content/layout should /never/ use this interface; if the * same functionality is needed in both places, two separate methods should be * used. */ class nsICanvasElementExternal : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANVASELEMENTEXTERNAL_IID) /** * Get the size in pixels of this canvas element */ NS_IMETHOD_(nsIntSize) GetSizeExternal() = 0; /* * Ask the canvas element to tell the contexts to render themselves * to the given gfxContext at the origin of its coordinate space. */ NS_IMETHOD RenderContextsExternal(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasElementExternal, NS_ICANVASELEMENTEXTERNAL_IID) #endif /* nsICanvasElementExternal_h___ */
// // DiscountViewController.h // meituan // // Created by jinzelu on 15/7/2. // Copyright (c) 2015年 jinzelu. All rights reserved. // #import <UIKit/UIKit.h> @interface DiscountViewController : UIViewController /** * webview加载的url */ @property(nonatomic, strong) NSString *urlStr; @property(nonatomic, strong) UIWebView *webView; @end
/* * 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/cognito-idp/CognitoIdentityProvider_EXPORTS.h> #include <aws/cognito-idp/model/UICustomizationType.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace CognitoIdentityProvider { namespace Model { class AWS_COGNITOIDENTITYPROVIDER_API GetUICustomizationResult { public: GetUICustomizationResult(); GetUICustomizationResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); GetUICustomizationResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The UI customization information.</p> */ inline const UICustomizationType& GetUICustomization() const{ return m_uICustomization; } /** * <p>The UI customization information.</p> */ inline void SetUICustomization(const UICustomizationType& value) { m_uICustomization = value; } /** * <p>The UI customization information.</p> */ inline void SetUICustomization(UICustomizationType&& value) { m_uICustomization = std::move(value); } /** * <p>The UI customization information.</p> */ inline GetUICustomizationResult& WithUICustomization(const UICustomizationType& value) { SetUICustomization(value); return *this;} /** * <p>The UI customization information.</p> */ inline GetUICustomizationResult& WithUICustomization(UICustomizationType&& value) { SetUICustomization(std::move(value)); return *this;} private: UICustomizationType m_uICustomization; }; } // namespace Model } // namespace CognitoIdentityProvider } // namespace Aws
/*========================================================================= * * 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. * *=========================================================================*/ /*========================================================================= * * Portions of this file are subject to the VTK Toolkit Version 3 copyright. * * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen * * For complete copyright, license and disclaimer of warranty information * please refer to the NOTICE file at the top of the ITK source tree. * *=========================================================================*/ #ifndef itkGEImageHeader_h #define itkGEImageHeader_h #include "ITKIOIPLExport.h" #include "itkIOCommon.h" enum GE_PANE_STRUCT { GE_AXIAL = 2, GE_SAGITTAL = 4, GE_CORONAL = 8 }; struct GEImageHeader { short int examNumber; short int seriesNumber; short int numberOfEchoes; short int echoNumber; short int imageNumber; float sliceLocation; float sliceThickness; float sliceGap; float TI; float TE; float TE2; float TR; short int flipAngle; int NEX; float xFOV; float yFOV; float centerR; float centerA; float centerS; float normR; float normA; float normS; float tlhcR; float tlhcA; float tlhcS; float trhcR; float trhcA; float trhcS; float brhcR; float brhcA; float brhcS; short int acqXsize; short int acqYsize; short int frequencyDir; char scanner[16]; char pulseSequence[128]; // Needs to be at least 65 for seimens vision char patientId[32]; char scanId[32]; char name[64]; char date[32]; short int imageXsize; short int imageYsize; float imageXres; float imageYres; itk::SpatialOrientation::ValidCoordinateOrientationFlags coordinateOrientation; short int numberOfSlices; short int offset; char filename[itk::IOCommon::ITK_MAXPATHLEN + 1]; char hospital[35]; char modality[4]; short int imagesPerSlice; short int turboFactor; // This is only relevant for the geADW image format, but // is put here for convenience }; #endif
////////////////////////////////////////////////////////////////// // // BTSlider.h // // Created by Dalton Cherry on 8/21/13. // Copyright (c) 2013 basement Krew. All rights reserved. // ////////////////////////////////////////////////////////////////// #import "BaseSlider.h" @interface BTSlider : BaseSlider -(void)setColor:(UIColor*)color; +(BTSlider*)sliderWithColor:(UIColor*)color; @end
// // Copyright 2019 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import <Foundation/Foundation.h> @class EDOObject; NS_ASSUME_NONNULL_BEGIN /** The data object that holds an exception being thrown in remote invocation. */ @interface EDORemoteException : NSException <NSSecureCoding> /** The merged call stack traces of both client process and host process. */ @property(readonly, copy) NSArray<NSString *> *callStackSymbols; /** EDORemoteException cannot be initialized with default data members. */ - (instancetype)init NS_UNAVAILABLE; /** EDORemoteException doesn't support transporting @c NSException::userInfo over processes. */ - (instancetype)initWithName:(NSExceptionName)name reason:(nullable NSString *)reason userInfo:(nullable NSDictionary<id, id> *)userInfo NS_UNAVAILABLE; /** Creates an exception with host-side only information. */ - (instancetype)initWithName:(NSExceptionName)name reason:(nullable NSString *)reason callStackSymbols:(NSArray<NSString *> *)callStackSymbols NS_DESIGNATED_INITIALIZER; /** @see -[NSCoding initWithCoder:]. */ - (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; @end NS_ASSUME_NONNULL_END
/** ****************************************************************************** * File Name : freertos.c * Description : Code for freertos applications ****************************************************************************** * * Copyright (c) 2017 STMicroelectronics International N.V. * 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. Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for STMicroelectronics. * 5. Redistribution and use of this software other than as permitted under * this license is void and will automatically terminate your rights under * this license. * * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL STMICROELECTRONICS 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. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "FreeRTOS.h" #include "task.h" /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ /* Variables -----------------------------------------------------------------*/ /* USER CODE BEGIN Variables */ /* USER CODE END Variables */ /* Function prototypes -------------------------------------------------------*/ /* USER CODE BEGIN FunctionPrototypes */ /* USER CODE END FunctionPrototypes */ /* Hook prototypes */ /* USER CODE BEGIN Application */ /* USER CODE END Application */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/*========================================================================= * * Copyright Insight Software Consortium * * 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 sitkExplicitITKImportImageContainer_h__ #define sitkExplicitITKImportImageContainer_h__ #include "sitkExplicit.h" #include "itkImportImageContainer.h" #ifndef SITK_TEMPLATE_EXPLICIT_EXPLICITITK extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, bool>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, char>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, double>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, float>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, int>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::CovariantVector<double, 2u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::CovariantVector<double, 3u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::CovariantVector<float, 2u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::CovariantVector<float, 3u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::FixedArray<float, 2u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::FixedArray<float, 3u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Offset<2u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Offset<3u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Vector<double, 1u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Vector<double, 2u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Vector<double, 3u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Vector<float, 1u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Vector<float, 2u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, itk::Vector<float, 3u> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, long>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, long long>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, short>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, signed char>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, std::complex<double> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, std::complex<float> >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, std::deque<itk::LabelObjectLine<2u>, std::allocator<itk::LabelObjectLine<2u> > > >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, std::deque<itk::LabelObjectLine<3u>, std::allocator<itk::LabelObjectLine<3u> > > >; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, unsigned char>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, unsigned int>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, unsigned long>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, unsigned long long>; extern template class SITKExplicit_EXPORT_EXPLICIT itk::ImportImageContainer<itk::SizeValueType, unsigned short>; #endif // SITK_TEMPLATE_EXPLICIT_EXPLICITITK #endif // sitkExplicitITKImportImageContainer_h__
/**************************************************************************** * libnx/nx/nx_fillcircle.c * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <sys/types.h> #include <debug.h> #include <errno.h> #include <nuttx/nx/nxglib.h> #include <nuttx/nx/nx.h> /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ #define NCIRCLE_TRAPS 8 /**************************************************************************** * Private Types ****************************************************************************/ /**************************************************************************** * Private Data ****************************************************************************/ /**************************************************************************** * Public Data ****************************************************************************/ /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: nx_fillcircle * * Description: * Fill a circular region using the specified color. * * Input Parameters: * hwnd - The window handle * center - A pointer to the point that is the center of the circle * radius - The radius of the circle in pixels. * color - The color to use to fill the circle. * * Return: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center, nxgl_coord_t radius, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) { FAR struct nxgl_trapezoid_s traps[NCIRCLE_TRAPS]; int i; int ret; /* Describe the circular region as a sequence of 8 trapezoids */ nxgl_circletraps(center, radius, traps); /* Then rend those trapezoids */ for (i = 0; i < NCIRCLE_TRAPS; i++) { ret = nx_filltrapezoid(hwnd, NULL, &traps[i], color); if (ret != OK) { return ret; } } return OK; }
/*- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/sys/boot/i386/libi386/i386_copy.c 153632 2005-12-21 02:17:58Z sobomax $"); /* * MD primitives supporting placement of module data * * XXX should check load address/size against memory top. */ #include <stand.h> #include "libi386.h" #include "btxv86.h" ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len) { if (dest + len >= memtop) { errno = EFBIG; return(-1); } bcopy(src, PTOV(dest), len); return(len); } ssize_t i386_copyout(const vm_offset_t src, void *dest, const size_t len) { if (src + len >= memtop) { errno = EFBIG; return(-1); } bcopy(PTOV(src), dest, len); return(len); } ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len) { if (dest + len >= memtop_copyin) { errno = EFBIG; return(-1); } return (read(fd, PTOV(dest), len)); }
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #include "CIMFixtureBase.h" class UNIX_PlatformWatchdogServiceFixture : public CIMFixtureBase { public: UNIX_PlatformWatchdogServiceFixture(); ~UNIX_PlatformWatchdogServiceFixture(); virtual void Run(); };
/* * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: soc2013/dpl/head/lib/libkse/thread/thr_mattr_kind_np.c 174732 2007-12-16 23:29:57Z deischen $ */ #include "namespace.h" #include <errno.h> #include <pthread.h> #include "un-namespace.h" #include "thr_private.h" int _pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind); int _pthread_mutexattr_getkind_np(pthread_mutexattr_t attr); __weak_reference(_pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np); __weak_reference(_pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np); __weak_reference(_pthread_mutexattr_gettype, pthread_mutexattr_gettype); __weak_reference(_pthread_mutexattr_settype, pthread_mutexattr_settype); int _pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind) { int ret; if (attr == NULL || *attr == NULL) { errno = EINVAL; ret = -1; } else { (*attr)->m_type = kind; ret = 0; } return(ret); } int _pthread_mutexattr_getkind_np(pthread_mutexattr_t attr) { int ret; if (attr == NULL) { errno = EINVAL; ret = -1; } else { ret = attr->m_type; } return(ret); } int _pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) { int ret; if (attr == NULL || *attr == NULL || type >= PTHREAD_MUTEX_TYPE_MAX) { errno = EINVAL; ret = -1; } else { (*attr)->m_type = type; ret = 0; } return(ret); } int _pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type) { int ret; if (attr == NULL || *attr == NULL || (*attr)->m_type >= PTHREAD_MUTEX_TYPE_MAX) { ret = EINVAL; } else { *type = (*attr)->m_type; ret = 0; } return ret; }
/* pbrt source code is Copyright(c) 1998-2016 Matt Pharr, Greg Humphreys, and Wenzel Jakob. This file is part of pbrt. 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. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if defined(_MSC_VER) #define NOMINMAX #pragma once #endif #ifndef PBRT_CORE_FLOATFILE_H #define PBRT_CORE_FLOATFILE_H // core/floatfile.h* #include "pbrt.h" bool ReadFloatFile(const char *filename, std::vector<Float> *values); #endif // PBRT_CORE_FLOATFILE_H
/*- * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: soc2013/dpl/head/contrib/libarchive/libarchive/archive_write_private.h 249817 2013-03-22 13:36:03Z mm $ */ #ifndef __LIBARCHIVE_BUILD #error This header is only to be used internally to libarchive. #endif #ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED #define ARCHIVE_WRITE_PRIVATE_H_INCLUDED #include "archive.h" #include "archive_string.h" #include "archive_private.h" struct archive_write; struct archive_write_filter { int64_t bytes_written; struct archive *archive; /* Associated archive. */ struct archive_write_filter *next_filter; /* Who I write to. */ int (*options)(struct archive_write_filter *, const char *key, const char *value); int (*open)(struct archive_write_filter *); int (*write)(struct archive_write_filter *, const void *, size_t); int (*close)(struct archive_write_filter *); int (*free)(struct archive_write_filter *); void *data; const char *name; int code; int bytes_per_block; int bytes_in_last_block; }; #if ARCHIVE_VERSION < 4000000 void __archive_write_filters_free(struct archive *); #endif struct archive_write_filter *__archive_write_allocate_filter(struct archive *); int __archive_write_output(struct archive_write *, const void *, size_t); int __archive_write_nulls(struct archive_write *, size_t); int __archive_write_filter(struct archive_write_filter *, const void *, size_t); int __archive_write_open_filter(struct archive_write_filter *); int __archive_write_close_filter(struct archive_write_filter *); struct archive_write { struct archive archive; /* Dev/ino of the archive being written. */ int skip_file_set; int64_t skip_file_dev; int64_t skip_file_ino; /* Utility: Pointer to a block of nulls. */ const unsigned char *nulls; size_t null_length; /* Callbacks to open/read/write/close archive stream. */ archive_open_callback *client_opener; archive_write_callback *client_writer; archive_close_callback *client_closer; void *client_data; /* * Blocking information. Note that bytes_in_last_block is * misleadingly named; I should find a better name. These * control the final output from all compressors, including * compression_none. */ int bytes_per_block; int bytes_in_last_block; /* * First and last write filters in the pipeline. */ struct archive_write_filter *filter_first; struct archive_write_filter *filter_last; /* * Pointers to format-specific functions for writing. They're * initialized by archive_write_set_format_XXX() calls. */ void *format_data; const char *format_name; int (*format_init)(struct archive_write *); int (*format_options)(struct archive_write *, const char *key, const char *value); int (*format_finish_entry)(struct archive_write *); int (*format_write_header)(struct archive_write *, struct archive_entry *); ssize_t (*format_write_data)(struct archive_write *, const void *buff, size_t); int (*format_close)(struct archive_write *); int (*format_free)(struct archive_write *); }; /* * Utility function to format a USTAR header into a buffer. If * "strict" is set, this tries to create the absolutely most portable * version of a ustar header. If "strict" is set to 0, then it will * relax certain requirements. * * Generally, format-specific declarations don't belong in this * header; this is a rare example of a function that is shared by * two very similar formats (ustar and pax). */ int __archive_write_format_header_ustar(struct archive_write *, char buff[512], struct archive_entry *, int tartype, int strict, struct archive_string_conv *); struct archive_write_program_data; struct archive_write_program_data * __archive_write_program_allocate(void); int __archive_write_program_free(struct archive_write_program_data *); int __archive_write_program_open(struct archive_write_filter *, struct archive_write_program_data *, const char *); int __archive_write_program_close(struct archive_write_filter *, struct archive_write_program_data *); int __archive_write_program_write(struct archive_write_filter *, struct archive_write_program_data *, const void *, size_t); #endif
/* * Copyright (C) 2000 Jason Evans <jasone@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(s), this list of conditions and the following disclaimer as * the first lines of this file unmodified other than the possible * addition of one or more copyright notices. * 2. Redistributions in binary form must reproduce the above copyright * notice(s), this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: soc2013/dpl/head/lib/libkse/thread/thr_tcdrain.c 174732 2007-12-16 23:29:57Z deischen $ */ #include "namespace.h" #include <termios.h> #include <pthread.h> #include "un-namespace.h" #include "thr_private.h" int _tcdrain(int fd); extern int __tcdrain(int); __weak_reference(_tcdrain, tcdrain); int _tcdrain(int fd) { struct pthread *curthread = _get_curthread(); int ret; _thr_cancel_enter(curthread); ret = __tcdrain(fd); _thr_cancel_leave(curthread, 1); return (ret); }
/* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/lib/msun/src/k_logf.h 226656 2011-10-15 05:23:28Z das $"); /* * Float version of k_log.h. See the latter for most comments. */ static const float /* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */ Lg1 = 0xaaaaaa.0p-24, /* 0.66666662693 */ Lg2 = 0xccce13.0p-25, /* 0.40000972152 */ Lg3 = 0x91e9ee.0p-25, /* 0.28498786688 */ Lg4 = 0xf89e26.0p-26; /* 0.24279078841 */ static inline float k_log1pf(float f) { float hfsq,s,z,R,w,t1,t2; s = f/((float)2.0+f); z = s*s; w = z*z; t1= w*(Lg2+w*Lg4); t2= z*(Lg1+w*Lg3); R = t2+t1; hfsq=(float)0.5*f*f; return s*(hfsq+R); }
/* $FreeBSD: soc2013/dpl/head/sys/net80211/ieee80211_rssadapt.h 206401 2010-04-07 15:29:13Z rpaulo $ */ /* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */ /*- * Copyright (c) 2003, 2004 David Young. 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 David Young may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY David Young ``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 David * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef _NET80211_IEEE80211_RSSADAPT_H_ #define _NET80211_IEEE80211_RSSADAPT_H_ /* Data-rate adaptation loosely based on "Link Adaptation Strategy * for IEEE 802.11 WLAN via Received Signal Strength Measurement" * by Javier del Prado Pavon and Sunghyun Choi. */ /* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */ #define IEEE80211_RSSADAPT_BKTS 3 #define IEEE80211_RSSADAPT_BKT0 128 #define IEEE80211_RSSADAPT_BKTPOWER 3 /* 2**_BKTPOWER */ struct ieee80211_rssadapt { const struct ieee80211vap *vap; int interval; /* update interval (ticks) */ }; struct ieee80211_rssadapt_node { struct ieee80211_rssadapt *ra_rs; /* backpointer */ struct ieee80211_rateset ra_rates; /* negotiated rates */ int ra_rix; /* current rate index */ int ra_ticks; /* time of last update */ int ra_last_raise; /* time of last rate raise */ int ra_raise_interval; /* rate raise time threshold */ /* Tx failures in this update interval */ uint32_t ra_nfail; /* Tx successes in this update interval */ uint32_t ra_nok; /* exponential average packets/second */ uint32_t ra_pktrate; /* RSSI threshold for each Tx rate */ uint16_t ra_rate_thresh[IEEE80211_RSSADAPT_BKTS] [IEEE80211_RATE_SIZE]; }; #define IEEE80211_RSSADAPT_SUCCESS 1 #define IEEE80211_RSSADAPT_FAILURE 0 #endif /* _NET80211_IEEE80211_RSSADAPT_H_ */
/* This file is a part of libcds - Concurrent Data Structures library See http://libcds.sourceforge.net/ (C) Copyright Maxim Khiszinsky (libcds.sf.com) 2006-2013 Distributed under the BSD license (see accompanying file license.txt) Version 1.4.0 */ #ifndef __CDSUNIT_STD_HASH_SET_H #define __CDSUNIT_STD_HASH_SET_H #if CDS_COMPILER == CDS_COMPILER_MSVC && CDS_COMPILER_VERSION == 1500 # include "set2/std_hash_set_vc9.h" #else # include "set2/std_hash_set_std.h" #endif #endif // #ifndef __CDSUNIT_STD_HASH_SET_H
// // Main aggregate header for 'DTFoundation' // // Global System Headers // this prevents problems if you include DTFoundation.h in your PCH file but are missing these other system frameworks #if TARGET_OS_IPHONE #import <UIKit/UIKit.h> #else #import <AppKit/AppKit.h> #import <Cocoa/Cocoa.h> #endif // Constants #import "DTFoundationConstants.h" // Classes #import "DTASN1Parser.h" #import "DTExtendedFileAttributes.h" #import "DTHTMLParser.h" #import "DTVersion.h" #import "DTZipArchive.h" #if TARGET_OS_IPHONE #import "DTActionSheet.h" #import "DTAsyncFileDeleter.h" #import "DTCustomColoredAccessory.h" #import "DTPieProgressIndicator.h" #endif // Categories #import "NSArray+DTError.h" #import "NSData+Base64.h" #import "NSData+DTCrypto.h" #import "NSDictionary+DTError.h" #import "NSMutableArray+DTMoving.h" #import "NSObject+DTRuntime.h" #import "NSString+DTFormatNumbers.h" #import "NSString+DTPaths.h" #import "NSString+DTURLEncoding.h" #import "NSString+DTUTI.h" #import "NSURL+DTComparing.h" #import "NSURL+DTUnshorten.h" #if TARGET_OS_IPHONE #import "NSURL+DTAppLinks.h" #import "UIApplication+DTNetworkActivity.h" #import "UIImage+DTFoundation.h" #import "UIView+DTFoundation.h" #import "UIWebView+DTFoundation.h" #import "UIView+DTActionHandlers.h" #else #import "NSImage+DTUtilities.h" #import "NSDocument+DTFoundation.h" #import "NSValue+DTConversion.h" #import "NSView+DTAutoLayout.h" #import "NSWindowController+DTPanelControllerPresenting.h" #endif // Utility Functions #import "DTUtils.h"
/**************************************************************************** * config/dk-tm4c129x/src/tm4c_timer.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <debug.h> #include "tiva_timer.h" #include "dk-tm4c129x.h" #ifdef CONFIG_DK_TM4C129X_TIMER /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ #ifndef CONFIG_TIMER # error CONFIG_TIMER is not defined #endif #ifndef CONFIG_TIVA_TIMER32_PERIODIC # error CONFIG_TIVA_TIMER32_PERIODIC is not defined #endif #if defined(CONFIG_DK_TM4C129X_TIMER0) # define GPTM 0 #elif defined(CONFIG_DK_TM4C129X_TIMER1) # define GPTM 1 #elif defined(CONFIG_DK_TM4C129X_TIMER2) # define GPTM 2 #elif defined(CONFIG_DK_TM4C129X_TIMER3) # define GPTM 3 #elif defined(CONFIG_DK_TM4C129X_TIMER4) # define GPTM 4 #elif defined(CONFIG_DK_TM4C129X_TIMER5) # define GPTM 5 #elif defined(CONFIG_DK_TM4C129X_TIMER6) # define GPTM 6 #elif defined(CONFIG_DK_TM4C129X_TIMER7) # define GPTM 7 #else # error No CONFIG_DK_TM4C129X_TIMERn definition #endif #ifndef CONFIG_DK_TM4C129X_TIMER_DEVNAME # define CONFIG_DK_TM4C129X_TIMER_DEVNAME "/dev/timer0" #endif #undef CONFIG_DK_TM4C129X_TIMER_ALTCLK #define ALTCLK false /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: tiva_timer_initialize * * Description: * Configure the timer driver * ****************************************************************************/ int tiva_timer_initialize(void) { int ret; timvdbg("Registering TIMER%d at %s\n", GPTM, CONFIG_DK_TM4C129X_TIMER_DEVNAME); ret = tiva_timer_register(CONFIG_DK_TM4C129X_TIMER_DEVNAME, GPTM, ALTCLK); if (ret < 0) { timdbg("ERROR: Failed to register timer driver: %d\n", ret); } return ret; } #endif /* CONFIG_DK_TM4C129X_TIMER */
// // RFTestAttribute.h // libObjCAttr // // Copyright (c) 2014 EPAM Systems, Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // Redistributions in binary form must reproduce the above copyright notice, this // list of conditions and the following disclaimer in the documentation and/or // other materials provided with the distribution. // Neither the name of the EPAM Systems, Inc. nor the names of its contributors // may be used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // See the NOTICE file and the LICENSE file distributed with this work // for additional information regarding copyright ownership and licensing #import "ROADAttribute.h" @interface RFTestAttribute : NSObject @end
#ifndef _PAPI_SOLARIS_ULTRA_H #define _PAPI_SOLARIS_ULTRA_H #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <assert.h> #include <string.h> #include <libgen.h> #include <limits.h> #include <synch.h> #include <procfs.h> #include <libcpc.h> #include <libgen.h> #include <ctype.h> #include <errno.h> #include <sys/times.h> #include <sys/time.h> #include <sys/types.h> #include <sys/processor.h> #include <sys/procset.h> #include <sys/ucontext.h> #include <syms.h> #include <dlfcn.h> #include <sys/stat.h> #include "papi_defines.h" #define MAX_COUNTERS 2 #define MAX_COUNTER_TERMS MAX_COUNTERS #define PAPI_MAX_NATIVE_EVENTS 71 #define MAX_NATIVE_EVENT PAPI_MAX_NATIVE_EVENTS #define MAX_NATIVE_EVENT_USII 22 /* Defines in papi_internal.h cause compile warnings on solaris because typedefs are done here */ #undef hwd_context_t #undef hwd_control_state_t #undef hwd_reg_alloc_t #undef hwd_register_t #undef hwd_siginfo_t #undef hwd_ucontext_t typedef int hwd_reg_alloc_t; typedef struct US_register { int event[MAX_COUNTERS]; } hwd_register_t; typedef struct papi_cpc_event { /* Structure to libcpc */ cpc_event_t cmd; /* Flags to kernel */ int flags; } papi_cpc_event_t; typedef struct hwd_control_state { /* Buffer to pass to the kernel to control the counters */ papi_cpc_event_t counter_cmd; /* overflow event counter */ int overflow_num; } hwd_control_state_t; typedef int hwd_register_map_t; typedef struct _native_info { /* native name */ char name[40]; /* Buffer to pass to the kernel to control the counters */ int encoding[MAX_COUNTERS]; } native_info_t; typedef siginfo_t hwd_siginfo_t; typedef ucontext_t hwd_ucontext_t; #define GET_OVERFLOW_ADDRESS(ctx) (void*)(ctx.ucontext->uc_mcontext.gregs[REG_PC]) typedef int hwd_context_t; /* Assembler prototypes */ extern void cpu_sync( void ); extern unsigned long long get_tick( void ); extern caddr_t _start, _end, _etext, _edata; extern rwlock_t lock[PAPI_MAX_LOCK]; #define _papi_hwd_lock(lck) rw_wrlock(&lock[lck]); #define _papi_hwd_unlock(lck) rw_unlock(&lock[lck]); #endif
/* Copyright (c) 2011 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef PPAPI_C_PPB_VAR_H_ #define PPAPI_C_PPB_VAR_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" #define PPB_VAR_INTERFACE "PPB_Var;0.5" /** * @file * This file defines the PPB_Var struct. */ /** * @addtogroup Interfaces * @{ */ /** * PPB_Var API */ struct PPB_Var { /** * Adds a reference to the given var. If this is not a refcounted object, * this function will do nothing so you can always call it no matter what the * type. */ void (*AddRef)(struct PP_Var var); /** * Removes a reference to given var, deleting it if the internal refcount * becomes 0. If the given var is not a refcounted object, this function will * do nothing so you can always call it no matter what the type. */ void (*Release)(struct PP_Var var); /** * Creates a string var from a string. The string must be encoded in valid * UTF-8 and is NOT NULL-terminated, the length must be specified in |len|. * It is an error if the string is not valid UTF-8. * * If the length is 0, the |data| pointer will not be dereferenced and may * be NULL. Note, however, that if you do this, the "NULL-ness" will not be * preserved, as VarToUtf8 will never return NULL on success, even for empty * strings. * * The resulting object will be a refcounted string object. It will be * AddRef()ed for the caller. When the caller is done with it, it should be * Release()d. * * On error (basically out of memory to allocate the string, or input that * is not valid UTF-8), this function will return a Null var. */ struct PP_Var (*VarFromUtf8)(PP_Module module, const char* data, uint32_t len); /** * Converts a string-type var to a char* encoded in UTF-8. This string is NOT * NULL-terminated. The length will be placed in |*len|. If the string is * valid but empty the return value will be non-NULL, but |*len| will still * be 0. * * If the var is not a string, this function will return NULL and |*len| will * be 0. * * The returned buffer will be valid as long as the underlying var is alive. * If the plugin frees its reference, the string will be freed and the pointer * will be to random memory. */ const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); }; /** * @} */ #endif /* PPAPI_C_PPB_VAR_H_ */
/* $NetBSD: test_crypto.c,v 1.1.1.1 2011/04/13 18:15:38 elric Exp $ */ /* * Copyright (c) 2003-2005 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of KTH 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 KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "krb5_locl.h" #include <err.h> #include <krb5/getarg.h> static void time_encryption(krb5_context context, size_t size, krb5_enctype etype, int iterations) { struct timeval tv1, tv2; krb5_error_code ret; krb5_keyblock key; krb5_crypto crypto; krb5_data data; char *etype_name; void *buf; int i; ret = krb5_generate_random_keyblock(context, etype, &key); if (ret) krb5_err(context, 1, ret, "krb5_generate_random_keyblock"); ret = krb5_enctype_to_string(context, etype, &etype_name); if (ret) krb5_err(context, 1, ret, "krb5_enctype_to_string"); buf = malloc(size); if (buf == NULL) krb5_errx(context, 1, "out of memory"); memset(buf, 0, size); ret = krb5_crypto_init(context, &key, 0, &crypto); if (ret) krb5_err(context, 1, ret, "krb5_crypto_init"); gettimeofday(&tv1, NULL); for (i = 0; i < iterations; i++) { ret = krb5_encrypt(context, crypto, 0, buf, size, &data); if (ret) krb5_err(context, 1, ret, "encrypt: %d", i); krb5_data_free(&data); } gettimeofday(&tv2, NULL); timevalsub(&tv2, &tv1); printf("%s size: %7lu iterations: %d time: %3ld.%06ld\n", etype_name, (unsigned long)size, iterations, (long)tv2.tv_sec, (long)tv2.tv_usec); free(buf); free(etype_name); krb5_crypto_destroy(context, crypto); krb5_free_keyblock_contents(context, &key); } static void time_s2k(krb5_context context, krb5_enctype etype, const char *password, krb5_salt salt, int iterations) { struct timeval tv1, tv2; krb5_error_code ret; krb5_keyblock key; krb5_data opaque; char *etype_name; int i; ret = krb5_enctype_to_string(context, etype, &etype_name); if (ret) krb5_err(context, 1, ret, "krb5_enctype_to_string"); opaque.data = NULL; opaque.length = 0; gettimeofday(&tv1, NULL); for (i = 0; i < iterations; i++) { ret = krb5_string_to_key_salt_opaque(context, etype, password, salt, opaque, &key); if (ret) krb5_err(context, 1, ret, "krb5_string_to_key_data_salt_opaque"); krb5_free_keyblock_contents(context, &key); } gettimeofday(&tv2, NULL); timevalsub(&tv2, &tv1); printf("%s string2key %d iterations time: %3ld.%06ld\n", etype_name, iterations, (long)tv2.tv_sec, (long)tv2.tv_usec); free(etype_name); } static int version_flag = 0; static int help_flag = 0; static struct getargs args[] = { {"version", 0, arg_flag, &version_flag, "print version", NULL }, {"help", 0, arg_flag, &help_flag, NULL, NULL } }; static void usage (int ret) { arg_printusage (args, sizeof(args)/sizeof(*args), NULL, ""); exit (ret); } int main(int argc, char **argv) { krb5_context context; krb5_error_code ret; int i, enciter, s2kiter; int optidx = 0; krb5_salt salt; krb5_enctype enctypes[] = { ETYPE_DES_CBC_CRC, ETYPE_DES3_CBC_SHA1, ETYPE_ARCFOUR_HMAC_MD5, ETYPE_AES128_CTS_HMAC_SHA1_96, ETYPE_AES256_CTS_HMAC_SHA1_96 }; setprogname(argv[0]); if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optidx)) usage(1); if (help_flag) usage (0); if(version_flag){ print_version(NULL); exit(0); } salt.salttype = KRB5_PW_SALT; salt.saltvalue.data = NULL; salt.saltvalue.length = 0; ret = krb5_init_context(&context); if (ret) errx (1, "krb5_init_context failed: %d", ret); enciter = 1000; s2kiter = 100; for (i = 0; i < sizeof(enctypes)/sizeof(enctypes[0]); i++) { krb5_enctype_enable(context, enctypes[i]); time_encryption(context, 16, enctypes[i], enciter); time_encryption(context, 32, enctypes[i], enciter); time_encryption(context, 512, enctypes[i], enciter); time_encryption(context, 1024, enctypes[i], enciter); time_encryption(context, 2048, enctypes[i], enciter); time_encryption(context, 4096, enctypes[i], enciter); time_encryption(context, 8192, enctypes[i], enciter); time_encryption(context, 16384, enctypes[i], enciter); time_encryption(context, 32768, enctypes[i], enciter); time_s2k(context, enctypes[i], "mYsecreitPassword", salt, s2kiter); } krb5_free_context(context); return 0; }
// Copyright 2018 The Flutter 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 FLUTTER_FML_PLATFORM_WIN_WSTRING_CONVERSION_H_ #define FLUTTER_FML_PLATFORM_WIN_WSTRING_CONVERSION_H_ #include <codecvt> #include <locale> #include <string> namespace fml { using WideStringConvertor = std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>; inline std::wstring ConvertToWString(const char* path) { if (path == nullptr) { return {}; } std::string path8(path); std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> wchar_conv; return wchar_conv.from_bytes(path8); } inline std::wstring StringToWideString(const std::string& str) { WideStringConvertor converter; return converter.from_bytes(str); } inline std::string WideStringToString(const std::wstring& wstr) { WideStringConvertor converter; return converter.to_bytes(wstr); } } // namespace fml #endif // FLUTTER_FML_PLATFORM_WIN_WSTRING_CONVERSION_H_
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ void bli_subv_check( obj_t* x, obj_t* y );
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE127_Buffer_Underread__wchar_t_declare_memmove_63b.c Label Definition File: CWE127_Buffer_Underread.stack.label.xml Template File: sources-sink-63b.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 * Sinks: memmove * BadSink : Copy data to string using memmove * Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE127_Buffer_Underread__wchar_t_declare_memmove_63b_badSink(wchar_t * * dataPtr) { wchar_t * data = *dataPtr; { wchar_t dest[100]; wmemset(dest, L'C', 100-1); /* fill with 'C's */ dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */ memmove(dest, data, 100*sizeof(wchar_t)); /* Ensure null termination */ dest[100-1] = L'\0'; printWLine(dest); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE127_Buffer_Underread__wchar_t_declare_memmove_63b_goodG2BSink(wchar_t * * dataPtr) { wchar_t * data = *dataPtr; { wchar_t dest[100]; wmemset(dest, L'C', 100-1); /* fill with 'C's */ dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */ memmove(dest, data, 100*sizeof(wchar_t)); /* Ensure null termination */ dest[100-1] = L'\0'; printWLine(dest); } } #endif /* OMITGOOD */
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_REMOTING_METRICS_H_ #define MEDIA_REMOTING_METRICS_H_ #include "base/macros.h" #include "base/time/time.h" #include "media/base/pipeline_metadata.h" #include "media/remoting/triggers.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/gfx/geometry/size.h" namespace media { namespace remoting { // The compatibility of a media content with remoting, and the reasons for // incompatibilities. // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class RemotingCompatibility { kCompatible = 0, kNoAudioNorVideo = 1, kEncryptedVideo = 2, kIncompatibleVideoCodec = 3, kEncryptedAudio = 4, kIncompatibleAudioCodec = 5, kDisabledByPage = 6, kDurationBelowThreshold = 7, // Add new values here. Don't re-number existing values. kMaxValue = kDurationBelowThreshold, }; // The rate of pixels in a video and whether the receiver supports its playback. // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class PixelRateSupport { // Pixels per second is at most the equivalent of 1080p 30fps. k2kSupported = 0, // More than 1080p 30fps and at most 2160p 30fps. k4kSupported = 1, k4kNotSupported = 2, kOver4kNotSupported = 3, // Add new values here. Don't re-number existing values. kMaxValue = kOver4kNotSupported, }; class SessionMetricsRecorder { public: SessionMetricsRecorder(); SessionMetricsRecorder(const SessionMetricsRecorder&) = delete; SessionMetricsRecorder& operator=(const SessionMetricsRecorder&) = delete; ~SessionMetricsRecorder(); // When attempting to start a remoting session, WillStartSession() is called, // followed by either OnSessionStartSucceeded() or OnSessionStop() to indicate // whether the start succeeded. Later, OnSessionStop() is called when the // session ends. void WillStartSession(StartTrigger trigger); void DidStartSession(); void WillStopSession(StopTrigger trigger); // These may be called before, during, or after a remoting session. void OnPipelineMetadataChanged(const PipelineMetadata& metadata); void OnRemotePlaybackDisabled(bool disabled); // Records the rate of pixels in a video (bucketed into FHD, 4K, etc.) and // whether the receiver supports its playback. Records only on the first call // for the recorder instance. void RecordVideoPixelRateSupport(PixelRateSupport support); // Records the compatibility of a media content with remoting. Records only on // the first call for the recorder instance. void RecordCompatibility(RemotingCompatibility compatibility); private: // Whether audio only, video only, or both were played during the session. // // NOTE: Never re-number or re-use numbers here. These are used in UMA // histograms, and must remain backwards-compatible for all time. However, // *do* change TRACK_CONFIGURATION_MAX to one after the greatest value when // adding new ones. Also, don't forget to update histograms.xml! enum TrackConfiguration { NEITHER_AUDIO_NOR_VIDEO = 0, AUDIO_ONLY = 1, VIDEO_ONLY = 2, AUDIO_AND_VIDEO = 3, TRACK_CONFIGURATION_MAX = 3, }; // Helper methods to record media configuration at relevant times. void RecordAudioConfiguration(); void RecordVideoConfiguration(); void RecordTrackConfiguration(); // |start_trigger_| is set while a remoting session is active. absl::optional<StartTrigger> start_trigger_; // When the current (or last) remoting session started. base::TimeTicks start_time_; // Last known audio and video configuration. These can change before/after a // remoting session as well as during one. AudioCodec last_audio_codec_; ChannelLayout last_channel_layout_; int last_sample_rate_; VideoCodec last_video_codec_; VideoCodecProfile last_video_profile_; gfx::Size last_natural_size_; // Last known disabled playback state. This can change before/after a remoting // session as well as during one. bool remote_playback_is_disabled_ = false; bool did_record_pixel_rate_support_ = false; bool did_record_compatibility_ = false; }; class RendererMetricsRecorder { public: RendererMetricsRecorder(); RendererMetricsRecorder(const RendererMetricsRecorder&) = delete; RendererMetricsRecorder& operator=(const RendererMetricsRecorder&) = delete; ~RendererMetricsRecorder(); // Called when an "initialize success" message is received from the remote. void OnRendererInitialized(); // Called whenever there is direct (or indirect, but close-in-time) evidence // that playout has occurred. void OnEvidenceOfPlayoutAtReceiver(); // These are called at regular intervals throughout the session to provide // estimated data flow rates. void OnAudioRateEstimate(int kilobits_per_second); void OnVideoRateEstimate(int kilobits_per_second); private: const base::TimeTicks start_time_; bool did_record_first_playout_ = false; }; } // namespace remoting } // namespace media #endif // MEDIA_REMOTING_METRICS_H_
#ifndef _ARNOLD_ALEMBIC_UNIQUENESS_H_ #define _ARNOLD_ALEMBIC_UNIQUENESS_H_ #include "utility.h" // uvsIdx is rewritten! // returns a UVs array! AtArray *removeUvsDuplicate(Alembic::AbcGeom::IV2fGeomParam &uvParam, SampleInfo &sampleInfo, AtArray *uvsIdx, AtArray *faceIndices); // nIdx is rewritten! // returns a Ns array! void removeNormalsDuplicate(AtArray *nor, AtULong &norOffset, Alembic::Abc::N3fArraySamplePtr &nParam, SampleInfo &sampleInfo, AtArray *nIdx, AtArray *faceIndices); // nIdx is rewritten! // returns a Ns array! void removeNormalsDuplicateDynTopology(AtArray *nor, AtULong &norOffset, Alembic::Abc::N3fArraySamplePtr &nParam, Alembic::Abc::N3fArraySamplePtr &nParam2, const float alpha, SampleInfo &sampleInfo, AtArray *nIdx, AtArray *faceIndices); #endif
// Copyright 2013 The Flutter 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 FLUTTER_SHELL_COMMON_ANIMATOR_H_ #define FLUTTER_SHELL_COMMON_ANIMATOR_H_ #include <deque> #include "flutter/common/task_runners.h" #include "flutter/flow/frame_timings.h" #include "flutter/fml/memory/ref_ptr.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/fml/synchronization/semaphore.h" #include "flutter/fml/time/time_point.h" #include "flutter/shell/common/pipeline.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/vsync_waiter.h" namespace flutter { namespace testing { class ShellTest; } /// Executor of animations. /// /// In conjunction with the |VsyncWaiter| it allows callers (typically Dart /// code) to schedule work that ends up generating a |LayerTree|. class Animator final { public: class Delegate { public: virtual void OnAnimatorBeginFrame(fml::TimePoint frame_target_time) = 0; virtual void OnAnimatorNotifyIdle(int64_t deadline) = 0; virtual void OnAnimatorDraw( fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline, std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder) = 0; virtual void OnAnimatorDrawLastLayerTree( std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder) = 0; }; Animator(Delegate& delegate, TaskRunners task_runners, std::unique_ptr<VsyncWaiter> waiter); ~Animator(); void RequestFrame(bool regenerate_layer_tree = true); void Render(std::unique_ptr<flutter::LayerTree> layer_tree); //-------------------------------------------------------------------------- /// @brief Schedule a secondary callback to be executed right after the /// main `VsyncWaiter::AsyncWaitForVsync` callback (which is added /// by `Animator::RequestFrame`). /// /// Like the callback in `AsyncWaitForVsync`, this callback is /// only scheduled to be called once, and it's supposed to be /// called in the UI thread. If there is no AsyncWaitForVsync /// callback (`Animator::RequestFrame` is not called), this /// secondary callback will still be executed at vsync. /// /// This callback is used to provide the vsync signal needed by /// `SmoothPointerDataDispatcher`, and for our own flow events. /// /// @see `PointerDataDispatcher::ScheduleSecondaryVsyncCallback`. void ScheduleSecondaryVsyncCallback(uintptr_t id, const fml::closure& callback); void Start(); void Stop(); void SetDimensionChangePending(); // Enqueue |trace_flow_id| into |trace_flow_ids_|. The flow event will be // ended at either the next frame, or the next vsync interval with no active // active rendering. void EnqueueTraceFlowId(uint64_t trace_flow_id); private: using LayerTreePipeline = Pipeline<flutter::LayerTree>; void BeginFrame(std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder); bool CanReuseLastLayerTree(); void DrawLastLayerTree( std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder); void AwaitVSync(); const char* FrameParity(); // Clear |trace_flow_ids_| if |frame_scheduled_| is false. void ScheduleMaybeClearTraceFlowIds(); Delegate& delegate_; TaskRunners task_runners_; std::shared_ptr<VsyncWaiter> waiter_; std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder_; int64_t dart_frame_deadline_; fml::RefPtr<LayerTreePipeline> layer_tree_pipeline_; fml::Semaphore pending_frame_semaphore_; LayerTreePipeline::ProducerContinuation producer_continuation_; int64_t frame_number_; bool paused_; bool regenerate_layer_tree_; bool frame_scheduled_; int notify_idle_task_id_; bool dimension_change_pending_; SkISize last_layer_tree_size_ = {0, 0}; std::deque<uint64_t> trace_flow_ids_; fml::WeakPtrFactory<Animator> weak_factory_; friend class testing::ShellTest; FML_DISALLOW_COPY_AND_ASSIGN(Animator); }; } // namespace flutter #endif // FLUTTER_SHELL_COMMON_ANIMATOR_H_
//********************************************************* // Information_Panel_Implementation.h - Information and Plotting //********************************************************* #pragma once #include "Information_Panel.h" //--------------------------------------------------------- // Information_Panel_Implementation - information panel class definition //--------------------------------------------------------- implementation class Information_Panel_Implementation : public Polaris_Component<MasterType,INHERIT(Information_Panel_Implementation),NULLTYPE>,public wxPanel { public: Information_Panel_Implementation(wxFrame* parent); virtual ~Information_Panel_Implementation(void){}; typedef Antares_Layer<typename MasterType::antares_layer_type> Antares_Layer_Interface; template<typename TargetType> Antares_Layer_Interface* Allocate_New_Layer(string& name) { Antares_Layer_Interface* new_layer=nullptr; std::list< Information_Page<typename MasterType::information_page_type>* >::iterator itr; bool blank_page_skipped=false; for(itr=_2D_layers.begin();itr!=_2D_layers.end();itr++) { if((*itr)->layer<Antares_Layer_Interface*>()==nullptr && blank_page_skipped) { new_layer=(Antares_Layer_Interface*)Allocate<typename MasterType::antares_layer_type>(); (*itr)->layer<Antares_Layer_Interface*>(new_layer); new_layer->list_index<int>(_2D_layers.size() - 1); new_layer->name<string&>(name); int idx=_information_book->GetPageIndex((wxWindow*)(*itr)); _information_book->SetPageText(idx,name); break; } blank_page_skipped=true; } return new_layer; } template<typename TargetType> void Render(); void OnSelect(wxAuiNotebookEvent& event); //void OnResize(wxSizeEvent& event); m_data(wxAuiNotebook*,information_book, NONE, NONE); m_data(wxBoxSizer*,sizer, NONE, NONE); m_data(int,cached_iteration, NONE, NONE); std::list< Information_Page<typename MasterType::information_page_type>* > _2D_layers; m_data(bool,initialized, NONE, NONE); }; static _lock _plot_lock; //--------------------------------------------------------- // Information_Panel - information initialization //--------------------------------------------------------- template<typename MasterType,typename InheritanceList> Information_Panel_Implementation<MasterType,InheritanceList>::Information_Panel_Implementation(wxFrame* parent) : wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN ) { UNLOCK(_plot_lock); SetBackgroundColour(wxColor(255,255,255)); //---- initialize the sizer and container notebook ---- _sizer=new wxBoxSizer(wxVERTICAL); _information_book=new wxAuiNotebook(this,-1,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_SCROLL_BUTTONS); //RLW%%% for(int i=0;i<25;i++) { Information_Page<typename MasterType::information_page_type>* layer = (Information_Page<typename MasterType::information_page_type>*) new typename MasterType::information_page_type(_information_book); _2D_layers.push_back(layer); _information_book->AddPage((wxWindow*)layer,""); } _sizer->Add(_information_book,1,wxEXPAND); //---- set the sizer ---- SetSizerAndFit(_sizer); Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(Information_Panel_Implementation::OnSelect)); _initialized = false; } template<typename MasterType,typename InheritanceList> void Information_Panel_Implementation<MasterType,InheritanceList>::OnSelect(wxAuiNotebookEvent& event) { Render<NT>(); } //template<typename MasterType,typename ParentType,typename InheritanceList> //void Information_Panel_Implementation<MasterType,ParentType,InheritanceList>::OnResize(wxSizeEvent& event) //{ // _box->SetDimension(wxPoint(0,0),GetSize()); //}
/* * getinfo.c * Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of the nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "wmfs.h" /* Global variables for each XGetWindowProperty * of each getinfo functions. */ Atom rt; int rf; ulong ir, il; uchar *ret; /** Get information about tag (current, list, names) */ static void getinfo_tag(void) { int tag = 0; char *tag_name = NULL; char *tag_list = NULL; if(XGetWindowProperty(dpy, ROOT, ATOM("_NET_CURRENT_DESKTOP"), 0L, 4096, False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret) { tag = (int)*ret + 1; XFree(ret); } if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_CURRENT_TAG"), 0L, 4096, False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, &ret) == Success && ret) { tag_name = xstrdup((char*)ret); XFree(ret); } if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_TAG_LIST"), 0L, 4096, False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, &ret) == Success && ret) { tag_list = xstrdup((char*)ret); XFree(ret); } printf("Current tag: %d - %s\n", tag, tag_name); printf("Tag list: %s\n", tag_list); free(tag_name); free(tag_list); return; } /** Get information about screens */ static void getinfo_screen(void) { int screen = 1; int screen_num = 1; if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_CURRENT_SCREEN"), 0L, 4096, False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret) { screen = (int)*ret + 1; XFree(ret); } if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_SCREEN_COUNT"), 0L, 4096, False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret) { screen_num = (int)*ret; XFree(ret); } printf("Current screen: %d\nScreen number: %d\n", screen, screen_num); return; } /** Get current layout name */ static void getinfo_layout(void) { char *layout = NULL; if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_CURRENT_LAYOUT"), 0L, 4096, False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, &ret) == Success && ret) { layout = xstrdup((char*)ret); XFree(ret); } printf("Current layout: %s\n", layout); free(layout); return; } /** Get information about current mwfact */ static void getinfo_mwfact(void) { char *mwfact = NULL; if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_MWFACT"), 0L, 4096, False, XA_STRING, &rt, &rf, &ir, &il, &ret) == Success && ret) { mwfact = xstrdup((char*)ret); XFree(ret); } printf("Current mwfact: %s\n", mwfact); free(mwfact); return; } /** Get information about current nmaster */ static void getinfo_nmaster(void) { int nmaster = 1; if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_NMASTER"), 0L, 4096, False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret) { nmaster = (int)*ret; XFree(ret); } printf("Current nmaster: %d\n", nmaster); return; } /** Get information about wmfs *\param info Type of information in a string */ void getinfo(char *info) { if(!check_wmfs_running()) return; ewmh_send_message(ROOT, ROOT, "_WMFS_UPDATE_HINTS", 0, 0, 0, 0, True); if(!strcmp(info, "tag")) getinfo_tag(); else if(!strcmp(info, "screen")) getinfo_screen(); else if(!strcmp(info, "layout")) getinfo_layout(); else if(!strcmp(info, "mwfact")) getinfo_mwfact(); else if(!strcmp(info, "nmaster")) getinfo_nmaster(); else if(!strcmp(info, "help")) printf("Argument list for wmfs -g options:\n" " tag Show current tag number and name, and tag list.\n" " screen Show current screen and screens number.\n" " layout Show current layout name.\n" " mwfact Show mwfact of current tag.\n" " nmaster Show nmaster of current tag.\n"); else warnx("Unknow info argument '%s'\nTry 'wmfs -g help'", info); return; }
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/threading/non_thread_safe.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" #include "ui/gfx/native_widget_types.h" namespace base { class SingleThreadTaskRunner; class WaitableEvent; } namespace IPC { class Message; } namespace win8 { // Abstract base class for various Metro viewer process host implementations. class MetroViewerProcessHost : public IPC::Listener, public IPC::Sender, public base::NonThreadSafe { public: // Initializes a viewer process host to connect to the Metro viewer process // over IPC. The given task runner correspond to a thread on which // IPC::Channel is created and used (e.g. IO thread). Instantly connects to // the viewer process if one is already connected to |ipc_channel_name|; a // viewer can otherwise be launched synchronously via // LaunchViewerAndWaitForConnection(). explicit MetroViewerProcessHost( base::SingleThreadTaskRunner* ipc_task_runner); virtual ~MetroViewerProcessHost(); // Returns the process id of the viewer process if one is connected to this // host, returns base::kNullProcessId otherwise. base::ProcessId GetViewerProcessId(); // Launches the viewer process associated with the given |app_user_model_id| // and blocks until that viewer process connects or until a timeout is // reached. Returns true if the viewer process connects before the timeout is // reached. NOTE: this assumes that the app referred to by |app_user_model_id| // is registered as the default browser. bool LaunchViewerAndWaitForConnection( const base::string16& app_user_model_id); private: // IPC::Sender implementation: virtual bool Send(IPC::Message* msg) OVERRIDE; // IPC::Listener implementation: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void OnChannelError() OVERRIDE = 0; // Called over IPC by the viewer process to tell this host that it should be // drawing to |target_surface|. virtual void OnSetTargetSurface(gfx::NativeViewId target_surface) = 0; // Called over IPC by the viewer process to request that the url passed in be // opened. virtual void OnOpenURL(const base::string16& url) = 0; // Called over IPC by the viewer process to request that the search string // passed in is passed to the default search provider and a URL navigation be // performed. virtual void OnHandleSearchRequest(const base::string16& search_string) = 0; // Called over IPC by the viewer process when the window size has changed. virtual void OnWindowSizeChanged(uint32 width, uint32 height) = 0; void NotifyChannelConnected(); // Inner message filter used to handle connection event on the IPC channel // proxy's background thread. This prevents consumers of // MetroViewerProcessHost from having to pump messages on their own message // loop. class InternalMessageFilter : public IPC::ChannelProxy::MessageFilter { public: InternalMessageFilter(MetroViewerProcessHost* owner); // IPC::ChannelProxy::MessageFilter implementation. virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; private: MetroViewerProcessHost* owner_; DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); }; scoped_ptr<IPC::ChannelProxy> channel_; scoped_ptr<base::WaitableEvent> channel_connected_event_; DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); }; } // namespace win8 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_
/* Copyright 2020 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* * USB4 mode support * Refer USB Type-C Cable and Connector Specification Release 2.0 Section 5 and * USB Power Delivery Specification Revision 3.0, Version 2.0 Section 6.4.8 */ #ifndef __CROS_EC_USB_MODE_H #define __CROS_EC_USB_MODE_H #include <stdint.h> #include "tcpm/tcpm.h" #include "usb_pd_tcpm.h" /* * Initialize USB4 state for the specified port. * * @param port USB-C port number */ void enter_usb_init(int port); /* * Checks whether the mode entry sequence for USB4 is done for a port. * * @param port USB-C port number * @return True if entry sequence for USB4 is completed * False otherwise */ bool enter_usb_entry_is_done(int port); /* * Requests the retimer and mux to exit USB4 mode and re-initalizes the USB4 * state machine. * * @param port USB-C port number */ void usb4_exit_mode_request(int port); /* * Resets USB4 state and mux state. * * @param port USB-C port number */ void enter_usb_failed(int port); /* * Returns True if port partner supports USB4 mode * * @param port USB-C port number * @return True if USB4 mode is supported by the port partner, * False otherwise */ bool enter_usb_port_partner_is_capable(int port); /* * Returns True if cable supports USB4 mode * * @param port USB-C port number * @return True if USB4 mode is supported by the cable, * False otherwise */ bool enter_usb_cable_is_capable(int port); /* * Handles accepted USB4 response * * @param port USB-C port number * @param type Transmit type (SOP, SOP', SOP'') for request */ void enter_usb_accepted(int port, enum tcpci_msg_type type); /* * Handles rejected USB4 response * * @param port USB-C port number * @param type Transmit type (SOP, SOP', SOP'') for request */ void enter_usb_rejected(int port, enum tcpci_msg_type type); /* * Constructs the next USB4 EUDO that should be sent. * * @param port USB-C port number * @param type Transmit type (SOP, SOP', SOP'') for request */ uint32_t enter_usb_setup_next_msg(int port, enum tcpci_msg_type *type); #endif
#ifndef WP_ENTRY_H_ #define WP_ENTRY_H_ // whistlepig entry // (c) 2011 William Morgan. See COPYING for license terms. // // an entry is a document before being added to the index. it's nothig more // than a map of (field,term) pairs to a (sorted) list of positions. you can // use this to incrementally build up a document in memory before adding it to // the index. #include "defaults.h" #include "error.h" #include "segment.h" #include "khash.h" #include "rarray.h" typedef struct fielded_term { char* field; char* term; } fielded_term; khint_t fielded_term_hash(fielded_term ft); khint_t fielded_term_equals(fielded_term a, fielded_term b); RARRAY_DECLARE(pos_t); KHASH_INIT(entries, fielded_term, RARRAY(pos_t), 1, fielded_term_hash, fielded_term_equals); typedef struct wp_entry { khash_t(entries)* entries; pos_t next_offset; } wp_entry; struct wp_segment; // API methods // public: make a new entry wp_entry* wp_entry_new(); // public: return the number of tokens occurrences in the entry uint32_t wp_entry_size(wp_entry* entry); // public: add an individual token wp_error* wp_entry_add_token(wp_entry* entry, const char* field, const char* term) RAISES_ERROR; // public: add a string, which will be tokenized at spaces only wp_error* wp_entry_add_string(wp_entry* entry, const char* field, const char* string) RAISES_ERROR; // public: add a file, which will be tokenized at spaces only wp_error* wp_entry_add_file(wp_entry* entry, const char* field, FILE* f) RAISES_ERROR; // public: free an entry. wp_error* wp_entry_free(wp_entry* entry) RAISES_ERROR; // private: write to a segment wp_error* wp_entry_write_to_segment(wp_entry* entry, struct wp_segment* seg, docid_t doc_id) RAISES_ERROR; // private: calculate the size needed for a postings region wp_error* wp_entry_sizeof_postings_region(wp_entry* entry, struct wp_segment* seg, uint32_t* size) RAISES_ERROR; #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__wchar_t_declare_memmove_34.c Label Definition File: CWE126_Buffer_Overread.stack.label.xml Template File: sources-sink-34.tmpl.c */ /* * @description * CWE: 126 Buffer Over-read * BadSource: Set data pointer to a small buffer * GoodSource: Set data pointer to a large buffer * Sinks: memmove * BadSink : Copy data to string using memmove * Flow Variant: 34 Data flow: use of a union containing two methods of accessing the same data (within the same function) * * */ #include "std_testcase.h" #include <wchar.h> typedef union { wchar_t * unionFirst; wchar_t * unionSecond; } CWE126_Buffer_Overread__wchar_t_declare_memmove_34_unionType; #ifndef OMITBAD void CWE126_Buffer_Overread__wchar_t_declare_memmove_34_bad() { wchar_t * data; CWE126_Buffer_Overread__wchar_t_declare_memmove_34_unionType myUnion; wchar_t dataBadBuffer[50]; wchar_t dataGoodBuffer[100]; wmemset(dataBadBuffer, L'A', 50-1); /* fill with 'A's */ dataBadBuffer[50-1] = L'\0'; /* null terminate */ wmemset(dataGoodBuffer, L'A', 100-1); /* fill with 'A's */ dataGoodBuffer[100-1] = L'\0'; /* null terminate */ /* FLAW: Set data pointer to a small buffer */ data = dataBadBuffer; myUnion.unionFirst = data; { wchar_t * data = myUnion.unionSecond; { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: using memmove with the length of the dest where data * could be smaller than dest causing buffer overread */ memmove(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; printWLine(dest); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { wchar_t * data; CWE126_Buffer_Overread__wchar_t_declare_memmove_34_unionType myUnion; wchar_t dataBadBuffer[50]; wchar_t dataGoodBuffer[100]; wmemset(dataBadBuffer, L'A', 50-1); /* fill with 'A's */ dataBadBuffer[50-1] = L'\0'; /* null terminate */ wmemset(dataGoodBuffer, L'A', 100-1); /* fill with 'A's */ dataGoodBuffer[100-1] = L'\0'; /* null terminate */ /* FIX: Set data pointer to a large buffer */ data = dataGoodBuffer; myUnion.unionFirst = data; { wchar_t * data = myUnion.unionSecond; { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: using memmove with the length of the dest where data * could be smaller than dest causing buffer overread */ memmove(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; printWLine(dest); } } } void CWE126_Buffer_Overread__wchar_t_declare_memmove_34_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()..."); CWE126_Buffer_Overread__wchar_t_declare_memmove_34_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE126_Buffer_Overread__wchar_t_declare_memmove_34_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/tinderbox/XR-Trunk/WINNT_5.2_Depend/mozilla/netwerk/base/public/nsIStreamListenerTee.idl */ #ifndef __gen_nsIStreamListenerTee_h__ #define __gen_nsIStreamListenerTee_h__ #ifndef __gen_nsIStreamListener_h__ #include "nsIStreamListener.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif class nsIOutputStream; /* forward declaration */ /* starting interface: nsIStreamListenerTee */ #define NS_ISTREAMLISTENERTEE_IID_STR "fb683e76-d42b-41a4-8ae6-65a6c2b146e5" #define NS_ISTREAMLISTENERTEE_IID \ {0xfb683e76, 0xd42b, 0x41a4, \ { 0x8a, 0xe6, 0x65, 0xa6, 0xc2, 0xb1, 0x46, 0xe5 }} /** * As data "flows" into a stream listener tee, it is copied to the output stream * and then forwarded to the real listener. */ class NS_NO_VTABLE NS_SCRIPTABLE nsIStreamListenerTee : public nsIStreamListener { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTREAMLISTENERTEE_IID) /* void init (in nsIStreamListener listener, in nsIOutputStream sink); */ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIStreamListenerTee, NS_ISTREAMLISTENERTEE_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSISTREAMLISTENERTEE \ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSISTREAMLISTENERTEE(_to) \ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink) { return _to Init(listener, sink); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSISTREAMLISTENERTEE(_to) \ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(listener, sink); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsStreamListenerTee : public nsIStreamListenerTee { public: NS_DECL_ISUPPORTS NS_DECL_NSISTREAMLISTENERTEE nsStreamListenerTee(); private: ~nsStreamListenerTee(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsStreamListenerTee, nsIStreamListenerTee) nsStreamListenerTee::nsStreamListenerTee() { /* member initializers and constructor code */ } nsStreamListenerTee::~nsStreamListenerTee() { /* destructor code */ } /* void init (in nsIStreamListener listener, in nsIOutputStream sink); */ NS_IMETHODIMP nsStreamListenerTee::Init(nsIStreamListener *listener, nsIOutputStream *sink) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIStreamListenerTee_h__ */
// // File: DKPixelFormat.h // Author: Hongtae Kim (tiff2766@gmail.com) // // Copyright (c) 2015-2017 Hongtae Kim. All rights reserved. // #pragma once #include "../DKFoundation.h" namespace DKFramework { enum class DKPixelFormat { Invalid = 0, // 8 bit formats R8Unorm, R8Snorm, R8Uint, R8Sint, // 16 bit formats R16Unorm, R16Snorm, R16Uint, R16Sint, R16Float, RG8Unorm, RG8Snorm, RG8Uint, RG8Sint, // 32 bit formats R32Uint, R32Sint, R32Float, RG16Unorm, RG16Snorm, RG16Uint, RG16Sint, RG16Float, RGBA8Unorm, RGBA8Unorm_sRGB, RGBA8Snorm, RGBA8Uint, RGBA8Sint, BGRA8Unorm, BGRA8Unorm_sRGB, // packed 32 bit formats RGB10A2Unorm, RGB10A2Uint, RG11B10Float, RGB9E5Float, // 64 bit formats RG32Uint, RG32Sint, RG32Float, RGBA16Unorm, RGBA16Snorm, RGBA16Uint, RGBA16Sint, RGBA16Float, // 128 bit formats RGBA32Uint, RGBA32Sint, RGBA32Float, // Depth D32Float, // Stencil (Uint) S8, // Depth Stencil D32FloatS8, // 32-depth, 8-stencil, 24-unused. }; constexpr bool DKPixelFormatIsColorFormat(DKPixelFormat pf) { return pf > DKPixelFormat::Invalid && pf < DKPixelFormat::D32Float; } constexpr bool DKPixelFormatIsDepthFormat(DKPixelFormat pf) { switch (pf) { case DKPixelFormat::D32Float: case DKPixelFormat::D32FloatS8: return true; } return false; } constexpr bool DKPixelFormatIsStencilFormat(DKPixelFormat pf) { switch (pf) { case DKPixelFormat::S8: case DKPixelFormat::D32FloatS8: return false; } return false; } constexpr int32_t DKPixelFormatBytesPerPixel(DKPixelFormat pf) { switch (pf) { // 8 bit formats case DKPixelFormat::R8Unorm: case DKPixelFormat::R8Snorm: case DKPixelFormat::R8Uint: case DKPixelFormat::R8Sint: return 1; break; // 16 bit formats case DKPixelFormat::R16Unorm: case DKPixelFormat::R16Snorm: case DKPixelFormat::R16Uint: case DKPixelFormat::R16Sint: case DKPixelFormat::R16Float: case DKPixelFormat::RG8Unorm: case DKPixelFormat::RG8Snorm: case DKPixelFormat::RG8Uint: case DKPixelFormat::RG8Sint: return 2; break; // 32 bit formats case DKPixelFormat::R32Uint: case DKPixelFormat::R32Sint: case DKPixelFormat::R32Float: case DKPixelFormat::RG16Unorm: case DKPixelFormat::RG16Snorm: case DKPixelFormat::RG16Uint: case DKPixelFormat::RG16Sint: case DKPixelFormat::RG16Float: case DKPixelFormat::RGBA8Unorm: case DKPixelFormat::RGBA8Unorm_sRGB: case DKPixelFormat::RGBA8Snorm: case DKPixelFormat::RGBA8Uint: case DKPixelFormat::RGBA8Sint: case DKPixelFormat::BGRA8Unorm: case DKPixelFormat::BGRA8Unorm_sRGB: // packed 32 bit formats case DKPixelFormat::RGB10A2Unorm: case DKPixelFormat::RGB10A2Uint: case DKPixelFormat::RG11B10Float: case DKPixelFormat::RGB9E5Float: return 4; break; // 64 bit formats case DKPixelFormat::RG32Uint: case DKPixelFormat::RG32Sint: case DKPixelFormat::RG32Float: case DKPixelFormat::RGBA16Unorm: case DKPixelFormat::RGBA16Snorm: case DKPixelFormat::RGBA16Uint: case DKPixelFormat::RGBA16Sint: case DKPixelFormat::RGBA16Float: return 8; break; // 128 bit formats case DKPixelFormat::RGBA32Uint: case DKPixelFormat::RGBA32Sint: case DKPixelFormat::RGBA32Float: return 16; break; // Depth case DKPixelFormat::D32Float: return 4; break; // Stencil (Uint) case DKPixelFormat::S8: return 1; break; // Depth Stencil case DKPixelFormat::D32FloatS8: // 32-depth: 8-stencil: 24-unused. return 8; break; } return 0; // unsupported pixel format! } }
/*++ Copyright (c) 2004, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: ConsoleOutDevice.h Abstract: --*/ #ifndef _CONSOLE_OUT_DEVICE_H_ #define _CONSOLE_OUT_DEVICE_H_ #define EFI_CONSOLE_OUT_DEVICE_GUID \ { 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } extern EFI_GUID gEfiConsoleOutDeviceGuid; #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 CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ #include <string> #include <vector> #include "base/compiler_specific.h" #include "chrome/browser/chromeos/login/login_display.h" #include "chrome/browser/chromeos/login/user.h" #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "ui/views/widget/widget.h" namespace chromeos { // WebUI-based login UI implementation. class WebUILoginDisplay : public LoginDisplay, public NativeWindowDelegate, public SigninScreenHandlerDelegate { public: explicit WebUILoginDisplay(LoginDisplay::Delegate* delegate); virtual ~WebUILoginDisplay(); // LoginDisplay implementation: virtual void Init(const UserList& users, bool show_guest, bool show_users, bool show_new_user) OVERRIDE; virtual void OnPreferencesChanged() OVERRIDE; virtual void OnBeforeUserRemoved(const std::string& username) OVERRIDE; virtual void OnUserImageChanged(const User& user) OVERRIDE; virtual void OnUserRemoved(const std::string& username) OVERRIDE; virtual void OnFadeOut() OVERRIDE; virtual void OnLoginSuccess(const std::string& username) OVERRIDE; virtual void SetUIEnabled(bool is_enabled) OVERRIDE; virtual void SelectPod(int index) OVERRIDE; virtual void ShowError(int error_msg_id, int login_attempts, HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; // NativeWindowDelegate implementation: virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; // SigninScreenHandlerDelegate implementation: virtual void CancelPasswordChangedFlow() OVERRIDE; virtual void CreateAccount() OVERRIDE; virtual void CompleteLogin(const std::string& username, const std::string& password) OVERRIDE; virtual void Login(const std::string& username, const std::string& password) OVERRIDE; virtual void LoginAsRetailModeUser() OVERRIDE; virtual void LoginAsGuest() OVERRIDE; virtual void MigrateUserData(const std::string& old_password) OVERRIDE; virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; virtual void LoadWallpaper(const std::string& username) OVERRIDE; virtual void LoadSigninWallpaper() OVERRIDE; virtual void RemoveUser(const std::string& username) OVERRIDE; virtual void ResyncUserData() OVERRIDE; virtual void ShowEnterpriseEnrollmentScreen() OVERRIDE; virtual void ShowResetScreen() OVERRIDE; virtual void SetWebUIHandler( LoginDisplayWebUIHandler* webui_handler) OVERRIDE; virtual void ShowSigninScreenForCreds(const std::string& username, const std::string& password); virtual const UserList& GetUsers() const OVERRIDE; virtual bool IsShowGuest() const OVERRIDE; virtual bool IsShowUsers() const OVERRIDE; virtual bool IsShowNewUser() const OVERRIDE; virtual void SetDisplayEmail(const std::string& email) OVERRIDE; virtual void Signout() OVERRIDE; private: // Set of Users that are visible. UserList users_; // Whether to show guest login. bool show_guest_; // Weather to show the user pads or a plain credentials dialogue. bool show_users_; // Whether to show add new user. bool show_new_user_; // Reference to the WebUI handling layer for the login screen LoginDisplayWebUIHandler* webui_handler_; DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay); }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE690_NULL_Deref_From_Return__long_realloc_53b.c Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml Template File: source-sinks-53b.tmpl.c */ /* * @description * CWE: 690 Unchecked Return Value To NULL Pointer * BadSource: realloc Allocate data using realloc() * Sinks: * GoodSink: Check to see if the data allocation failed and if not, use data * BadSink : Don't check for NULL and use data * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE690_NULL_Deref_From_Return__long_realloc_53c_badSink(long * data); void CWE690_NULL_Deref_From_Return__long_realloc_53b_badSink(long * data) { CWE690_NULL_Deref_From_Return__long_realloc_53c_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G uses the BadSource with the GoodSink */ void CWE690_NULL_Deref_From_Return__long_realloc_53c_goodB2GSink(long * data); void CWE690_NULL_Deref_From_Return__long_realloc_53b_goodB2GSink(long * data) { CWE690_NULL_Deref_From_Return__long_realloc_53c_goodB2GSink(data); } #endif /* OMITGOOD */
#ifndef QMCPLUSPLUS_TOOLS_GAUSSIAN_FCHK_H #define QMCPLUSPLUS_TOOLS_GAUSSIAN_FCHK_H #include "QMCTools/QMCGaussianParserBase.h" #include <iostream> #include <sstream> #include <iomanip> #include <vector> #include "OhmmsPETE/TinyVector.h" #include "OhmmsData/OhmmsElementBase.h" class GaussianFCHKParser: public QMCGaussianParserBase, public OhmmsAsciiParser { public: GaussianFCHKParser(); GaussianFCHKParser(int argc, char** argv); void parse(const std::string& fname); void getGeometry(std::istream& is); void getGaussianCenters(std::istream& is); }; #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ #include <set> #include "base/callback.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "components/devtools_service/public/interfaces/devtools_service.mojom.h" #include "components/html_viewer/ax_provider_impl.h" #include "components/html_viewer/html_frame_delegate.h" #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" #include "components/mus/public/cpp/view_tree_delegate.h" #include "components/web_view/public/interfaces/frame_tree.mojom.h" #include "mojo/application/public/cpp/app_lifetime_helper.h" #include "mojo/application/public/cpp/interface_factory.h" #include "mojo/application/public/cpp/service_provider_impl.h" #include "mojo/application/public/interfaces/application.mojom.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" namespace base { class SingleThreadTaskRunner; } namespace mus { class View; class ViewTreeConnection; } namespace html_viewer { class AxProviderImpl; class DocumentResourceWaiter; class GlobalState; class HTMLFactory; class HTMLFrame; class TestHTMLViewerImpl; class ViewTreeDelegateImpl; class WebLayerTreeViewImpl; // A view for a single HTML document. // // HTMLDocument is deleted in one of two ways: // . When the View the HTMLDocument is embedded in is destroyed. // . Explicitly by way of Destroy(). class HTMLDocument : public mus::ViewTreeDelegate, public HTMLFrameDelegate, public mojo::InterfaceFactory<mojo::AxProvider>, public mojo::InterfaceFactory<web_view::FrameTreeClient>, public mojo::InterfaceFactory<TestHTMLViewer>, public mojo::InterfaceFactory<devtools_service::DevToolsAgent>, public mojo::InterfaceFactory<mojo::ViewTreeClient> { public: using DeleteCallback = base::Callback<void(HTMLDocument*)>; // Load a new HTMLDocument with |response|. // |html_document_app| is the application this app was created in, and // |connection| the specific connection triggering this new instance. // |setup| is used to obtain init type state (such as resources). HTMLDocument(mojo::ApplicationImpl* html_document_app, mojo::ApplicationConnection* connection, mojo::URLResponsePtr response, GlobalState* setup, const DeleteCallback& delete_callback, HTMLFactory* factory); // Deletes this object. void Destroy(); private: friend class DocumentResourceWaiter; // So it can call Load(). // Requests for interfaces before the document is loaded go here. Once // loaded the requests are bound and BeforeLoadCache is deleted. struct BeforeLoadCache { BeforeLoadCache(); ~BeforeLoadCache(); std::set<mojo::InterfaceRequest<mojo::AxProvider>*> ax_provider_requests; std::set<mojo::InterfaceRequest<TestHTMLViewer>*> test_interface_requests; }; // Any state that needs to be moved when rendering transfers from one frame // to another is stored here. struct TransferableState { TransferableState(); ~TransferableState(); // Takes the state from |other|. void Move(TransferableState* other); bool owns_view_tree_connection; mus::View* root; scoped_ptr<ViewTreeDelegateImpl> view_tree_delegate_impl; }; ~HTMLDocument() override; void Load(); BeforeLoadCache* GetBeforeLoadCache(); // ViewTreeDelegate: void OnEmbed(mus::View* root) override; void OnConnectionLost(mus::ViewTreeConnection* connection) override; // HTMLFrameDelegate: mojo::ApplicationImpl* GetApp() override; HTMLFactory* GetHTMLFactory() override; void OnFrameDidFinishLoad() override; void OnFrameSwappedToRemote() override; void OnSwap(HTMLFrame* frame, HTMLFrameDelegate* old_delegate) override; void OnFrameDestroyed() override; // mojo::InterfaceFactory<mojo::AxProvider>: void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::AxProvider> request) override; // mojo::InterfaceFactory<web_view::FrameTreeClient>: void Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<web_view::FrameTreeClient> request) override; // mojo::InterfaceFactory<TestHTMLViewer>: void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<TestHTMLViewer> request) override; // mojo::InterfaceFactory<devtools_service::DevToolsAgent>: void Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) override; // mojo::InterfaceFactory<mus::ViewTreeClient>: void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; scoped_ptr<mojo::AppRefCount> app_refcount_; mojo::ApplicationImpl* html_document_app_; mojo::ApplicationConnection* connection_; // HTMLDocument owns these pointers; binding requests after document load. std::set<AxProviderImpl*> ax_providers_; ScopedVector<TestHTMLViewerImpl> test_html_viewers_; // Set to true when the local frame has finished loading. bool did_finish_local_frame_load_ = false; GlobalState* global_state_; HTMLFrame* frame_; scoped_ptr<DocumentResourceWaiter> resource_waiter_; scoped_ptr<BeforeLoadCache> before_load_cache_; DeleteCallback delete_callback_; HTMLFactory* factory_; TransferableState transferable_state_; // Cache interface request of DevToolsAgent if |frame_| hasn't been // initialized. mojo::InterfaceRequest<devtools_service::DevToolsAgent> devtools_agent_request_; DISALLOW_COPY_AND_ASSIGN(HTMLDocument); }; } // namespace html_viewer #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_
/* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_option.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ #include "private.h" #include "gsm.h" #include "proto.h" int gsm_option P3((r, opt, val), gsm r, int opt, int * val) { int result = -1; switch (opt) { case GSM_OPT_VERBOSE: #ifndef NDEBUG result = r->verbose; if (val) r->verbose = *val; #endif break; case GSM_OPT_FAST: #if defined(FAST) && defined(USE_FLOAT_MUL) result = r->fast; if (val) r->fast = !!*val; #endif break; default: break; } return result; }
/*========================================================================= Program: Visualization Toolkit Module: vtkPolygonalSurfaceContourLineInterpolator.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkPolygonalSurfaceContourLineInterpolator - Contour interpolator for to place points on polygonal surfaces. // // .SECTION Description // vtkPolygonalSurfaceContourLineInterpolator interpolates and places // contour points on polygonal surfaces. The class interpolates nodes by // computing a \em graph \em geodesic laying on the polygonal data. By \em // graph \em Geodesic, we mean that the line interpolating the two end // points traverses along on the mesh edges so as to form the shortest // path. A Dijkstra algorithm is used to compute the path. See // vtkDijkstraGraphGeodesicPath. // // The class is mean to be used in conjunction with // vtkPolygonalSurfacePointPlacer. The reason for this weak coupling is a // performance issue, both classes need to perform a cell pick, and // coupling avoids multiple cell picks (cell picks are slow). // // .SECTION Caveats // You should have computed cell normals for the input polydata. // // .SECTION See Also // vtkDijkstraGraphGeodesicPath, vtkPolyDataNormals #ifndef vtkPolygonalSurfaceContourLineInterpolator_h #define vtkPolygonalSurfaceContourLineInterpolator_h #include "vtkInteractionWidgetsModule.h" // For export macro #include "vtkPolyDataContourLineInterpolator.h" class vtkDijkstraGraphGeodesicPath; class vtkIdList; class VTKINTERACTIONWIDGETS_EXPORT vtkPolygonalSurfaceContourLineInterpolator : public vtkPolyDataContourLineInterpolator { public: // Description: // Standard methods for instances of this class. vtkTypeMacro(vtkPolygonalSurfaceContourLineInterpolator, vtkPolyDataContourLineInterpolator); void PrintSelf(ostream& os, vtkIndent indent); static vtkPolygonalSurfaceContourLineInterpolator *New(); // Description: // Subclasses that wish to interpolate a line segment must implement this. // For instance vtkBezierContourLineInterpolator adds nodes between idx1 // and idx2, that allow the contour to adhere to a bezier curve. virtual int InterpolateLine( vtkRenderer *ren, vtkContourRepresentation *rep, int idx1, int idx2 ); // Description: // The interpolator is given a chance to update the node. // vtkImageContourLineInterpolator updates the idx'th node in the contour, // so it automatically sticks to edges in the vicinity as the user // constructs the contour. // Returns 0 if the node (world position) is unchanged. virtual int UpdateNode( vtkRenderer *, vtkContourRepresentation *, double * vtkNotUsed(node), int vtkNotUsed(idx) ); // Description: // Height offset at which points may be placed on the polygonal surface. // If you specify a non-zero value here, be sure to have computed vertex // normals on your input polygonal data. (easily done with // vtkPolyDataNormals). vtkSetMacro( DistanceOffset, double ); vtkGetMacro( DistanceOffset, double ); // Description: // Get the contour point ids. These point ids correspond to those on the // polygonal surface void GetContourPointIds( vtkContourRepresentation *rep, vtkIdList *idList ); protected: vtkPolygonalSurfaceContourLineInterpolator(); ~vtkPolygonalSurfaceContourLineInterpolator(); // Description: // Draw the polyline at a certain height (in the direction of the vertex // normal) above the polydata. double DistanceOffset; private: vtkPolygonalSurfaceContourLineInterpolator(const vtkPolygonalSurfaceContourLineInterpolator&); //Not implemented void operator=(const vtkPolygonalSurfaceContourLineInterpolator&); //Not implemented // Cache the last used vertex id's (start and end). // If they are the same, don't recompute. vtkIdType LastInterpolatedVertexIds[2]; vtkDijkstraGraphGeodesicPath* DijkstraGraphGeodesicPath; }; #endif
../intel/intel_screen.c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__int64_t_rand_sub_67b.c Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-67b.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: rand Set data to result of rand() * 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: 67 Data flow: data passed in a struct from one function to another in different source files * * */ #include "std_testcase.h" typedef struct _CWE191_Integer_Underflow__int64_t_rand_sub_67_structType { int64_t structFirst; } CWE191_Integer_Underflow__int64_t_rand_sub_67_structType; #ifndef OMITBAD void CWE191_Integer_Underflow__int64_t_rand_sub_67b_badSink(CWE191_Integer_Underflow__int64_t_rand_sub_67_structType myStruct) { int64_t data = myStruct.structFirst; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int64_t result = data - 1; printLongLongLine(result); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE191_Integer_Underflow__int64_t_rand_sub_67b_goodG2BSink(CWE191_Integer_Underflow__int64_t_rand_sub_67_structType myStruct) { int64_t data = myStruct.structFirst; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int64_t result = data - 1; printLongLongLine(result); } } /* goodB2G uses the BadSource with the GoodSink */ void CWE191_Integer_Underflow__int64_t_rand_sub_67b_goodB2GSink(CWE191_Integer_Underflow__int64_t_rand_sub_67_structType myStruct) { int64_t data = myStruct.structFirst; /* FIX: Add a check to prevent an underflow from occurring */ if (data > LLONG_MIN) { int64_t result = data - 1; printLongLongLine(result); } else { printLine("data value is too large to perform subtraction."); } } #endif /* OMITGOOD */
/* * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef GCTaskRunner_h #define GCTaskRunner_h #include "platform/ThreadSafeFunctional.h" #include "platform/heap/ThreadState.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" namespace blink { class MessageLoopInterruptor final : public BlinkGCInterruptor { public: explicit MessageLoopInterruptor(WebTaskRunner* taskRunner) : m_taskRunner(taskRunner) { } void requestInterrupt() override { // GCTask has an empty run() method. Its only purpose is to guarantee // that MessageLoop will have a task to process which will result // in GCTaskRunner::didProcessTask being executed. m_taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&runGCTask)); } private: static void runGCTask() { // Don't do anything here because we don't know if this is // a nested event loop or not. GCTaskRunner::didProcessTask // will enter correct safepoint for us. // We are not calling onInterrupted() because that always // conservatively enters safepoint with pointers on stack. } WebTaskRunner* m_taskRunner; }; class GCTaskObserver final : public WebThread::TaskObserver { USING_FAST_MALLOC(GCTaskObserver); public: GCTaskObserver() : m_nesting(0) { } ~GCTaskObserver() { // m_nesting can be 1 if this was unregistered in a task and // didProcessTask was not called. ASSERT(!m_nesting || m_nesting == 1); } virtual void willProcessTask() { m_nesting++; } virtual void didProcessTask() { // In the production code WebKit::initialize is called from inside the // message loop so we can get didProcessTask() without corresponding // willProcessTask once. This is benign. if (m_nesting) m_nesting--; ThreadState::current()->safePoint(m_nesting ? BlinkGC::HeapPointersOnStack : BlinkGC::NoHeapPointersOnStack); } private: int m_nesting; }; class GCTaskRunner final { USING_FAST_MALLOC(GCTaskRunner); public: explicit GCTaskRunner(WebThread* thread) : m_gcTaskObserver(adoptPtr(new GCTaskObserver)) , m_thread(thread) { m_thread->addTaskObserver(m_gcTaskObserver.get()); ThreadState::current()->addInterruptor(adoptPtr(new MessageLoopInterruptor(thread->taskRunner()))); } ~GCTaskRunner() { m_thread->removeTaskObserver(m_gcTaskObserver.get()); } private: OwnPtr<GCTaskObserver> m_gcTaskObserver; WebThread* m_thread; }; } // namespace blink #endif
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SharedWorkerThread_h #define SharedWorkerThread_h #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/workers/WorkerThread.h" namespace blink { class WorkerThreadStartupData; class SharedWorkerThread : public WorkerThread { public: static PassRefPtr<SharedWorkerThread> create(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>); virtual ~SharedWorkerThread(); protected: virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>) override; private: SharedWorkerThread(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>); String m_name; }; } // namespace blink #endif // SharedWorkerThread_h
/* * Order-1, 3D 7 point stencil with variable coefficients * Adapted from PLUTO and Pochoir test bench * * Tareq Malas */ #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #ifdef LIKWID_PERFMON #include <likwid.h> #endif #include "print_utils.h" #define TESTS 2 #define MAX(a,b) ((a) > (b) ? a : b) #define MIN(a,b) ((a) < (b) ? a : b) /* Subtract the `struct timeval' values X and Y, * storing the result in RESULT. * * Return 1 if the difference is negative, otherwise 0. */ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } if (x->tv_usec - y->tv_usec > 1000000) { int nsec = (x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; } /* Compute the time remaining to wait. * tv_usec is certainly positive. */ result->tv_sec = x->tv_sec - y->tv_sec; result->tv_usec = x->tv_usec - y->tv_usec; /* Return 1 if result is negative. */ return x->tv_sec < y->tv_sec; } int main(int argc, char *argv[]) { int t, i, j, k, m, test; int Nx, Ny, Nz, Nt; if (argc > 3) { Nx = atoi(argv[1])+2; Ny = atoi(argv[2])+2; Nz = atoi(argv[3])+2; } if (argc > 4) Nt = atoi(argv[4]); // allocate the arrays double ****A = (double ****) malloc(sizeof(double***)*2); for(m=0; m<2;m++){ A[m] = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ A[m][i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ A[m][i][j] = (double*) malloc(sizeof(double)*Nx); } } } double ****coef = (double ****) malloc(sizeof(double***)*7); for(m=0; m<7;m++){ coef[m] = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ coef[m][i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ coef[m][i][j] = (double*) malloc(sizeof(double)*Nx); } } } // tile size information, including extra element to decide the list length int *tile_size = (int*) malloc(sizeof(int)); tile_size[0] = -1; // The list is modified here before source-to-source transformations tile_size = (int*) realloc((void *)tile_size, sizeof(int)*5); tile_size[0] = 4; tile_size[1] = 4; tile_size[2] = 4; tile_size[3] = 512; tile_size[4] = -1; // for timekeeping int ts_return = -1; struct timeval start, end, result; double tdiff = 0.0, min_tdiff=1.e100; const int BASE = 1024; // initialize variables // srand(42); for (i = 1; i < Nz; i++) { for (j = 1; j < Ny; j++) { for (k = 1; k < Nx; k++) { A[0][i][j][k] = 1.0 * (rand() % BASE); } } } for (m=0; m<7; m++) { for (i=1; i<Nz; i++) { for (j=1; j<Ny; j++) { for (k=1; k<Nx; k++) { coef[m][i][j][k] = 1.0 * (rand() % BASE); } } } } #ifdef LIKWID_PERFMON LIKWID_MARKER_INIT; #pragma omp parallel { LIKWID_MARKER_THREADINIT; #pragma omp barrier LIKWID_MARKER_START("calc"); } #endif int num_threads = 1; #if defined(_OPENMP) num_threads = omp_get_max_threads(); #endif for(test=0; test<TESTS; test++){ gettimeofday(&start, 0); // serial execution - Addition: 6 && Multiplication: 2 #pragma scop for (t = 0; t < Nt-1; t++) { for (i = 1; i < Nz-1; i++) { for (j = 1; j < Ny-1; j++) { for (k = 1; k < Nx-1; k++) { A[(t+1)%2][i][j][k] = coef[0][i][j][k] * A[t%2][i ][j ][k ] + coef[1][i][j][k] * A[t%2][i-1][j ][k ] + coef[2][i][j][k] * A[t%2][i ][j-1][k ] + coef[3][i][j][k] * A[t%2][i ][j ][k-1] + coef[4][i][j][k] * A[t%2][i+1][j ][k ] + coef[5][i][j][k] * A[t%2][i ][j+1][k ] + coef[6][i][j][k] * A[t%2][i ][j ][k+1]; } } } } #pragma endscop gettimeofday(&end, 0); ts_return = timeval_subtract(&result, &end, &start); tdiff = (double) (result.tv_sec + result.tv_usec * 1.0e-6); min_tdiff = min(min_tdiff, tdiff); printf("Rank 0 TEST# %d time: %f\n", test, tdiff); } PRINT_RESULTS(1, "variable no-symmetry") #ifdef LIKWID_PERFMON #pragma omp parallel { LIKWID_MARKER_STOP("calc"); } LIKWID_MARKER_CLOSE; #endif // Free allocated arrays for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(A[0][i][j]); free(A[1][i][j]); } free(A[0][i]); free(A[1][i]); } free(A[0]); free(A[1]); for(m=0; m<7;m++){ for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(coef[m][i][j]); } free(coef[m][i]); } free(coef[m]); } return 0; }
/* * linux/fs/hfsplus/ioctl.c * * Copyright (C) 2003 * Ethan Benson <erbenson@alaska.net> * partially derived from linux/fs/ext2/ioctl.c * Copyright (C) 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * hfsplus ioctls */ #include <linux/capability.h> #include <linux/fs.h> #include <linux/mount.h> #include <linux/sched.h> #include <asm/uaccess.h> #include "hfsplus_fs.h" /* * "Blessing" an HFS+ filesystem writes metadata to the superblock informing * the platform firmware which file to boot from */ static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags) { struct dentry *dentry = file->f_path.dentry; struct inode *inode = d_inode(dentry); struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); struct hfsplus_vh *vh = sbi->s_vhdr; struct hfsplus_vh *bvh = sbi->s_backup_vhdr; u32 cnid = (unsigned long)dentry->d_fsdata; if (!capable(CAP_SYS_ADMIN)) return -EPERM; mutex_lock(&sbi->vh_mutex); /* Directory containing the bootable system */ vh->finder_info[0] = bvh->finder_info[0] = cpu_to_be32(parent_ino(dentry)); /* * Bootloader. Just using the inode here breaks in the case of * hard links - the firmware wants the ID of the hard link file, * but the inode points at the indirect inode */ vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(cnid); /* Per spec, the OS X system folder - same as finder_info[0] here */ vh->finder_info[5] = bvh->finder_info[5] = cpu_to_be32(parent_ino(dentry)); mutex_unlock(&sbi->vh_mutex); return 0; } static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags) { struct inode *inode = file_inode(file); struct hfsplus_inode_info *hip = HFSPLUS_I(inode); unsigned int flags = 0; if (inode->i_flags & S_IMMUTABLE) flags |= FS_IMMUTABLE_FL; if (inode->i_flags & S_APPEND) flags |= FS_APPEND_FL; if (hip->userflags & HFSPLUS_FLG_NODUMP) flags |= FS_NODUMP_FL; return put_user(flags, user_flags); } static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) { struct inode *inode = file_inode(file); struct hfsplus_inode_info *hip = HFSPLUS_I(inode); unsigned int flags, new_fl = 0; int err = 0; err = mnt_want_write_file(file); if (err) goto out; if (!inode_owner_or_capable(inode)) { err = -EACCES; goto out_drop_write; } if (get_user(flags, user_flags)) { err = -EFAULT; goto out_drop_write; } mutex_lock(&inode->i_mutex); if ((flags & (FS_IMMUTABLE_FL|FS_APPEND_FL)) || inode->i_flags & (S_IMMUTABLE|S_APPEND)) { if (!capable(CAP_LINUX_IMMUTABLE)) { err = -EPERM; goto out_unlock_inode; } } /* don't silently ignore unsupported ext2 flags */ if (flags & ~(FS_IMMUTABLE_FL|FS_APPEND_FL|FS_NODUMP_FL)) { err = -EOPNOTSUPP; goto out_unlock_inode; } if (flags & FS_IMMUTABLE_FL) new_fl |= S_IMMUTABLE; if (flags & FS_APPEND_FL) new_fl |= S_APPEND; inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND); if (flags & FS_NODUMP_FL) hip->userflags |= HFSPLUS_FLG_NODUMP; else hip->userflags &= ~HFSPLUS_FLG_NODUMP; inode->i_ctime = CURRENT_TIME_SEC; mark_inode_dirty(inode); out_unlock_inode: mutex_unlock(&inode->i_mutex); out_drop_write: mnt_drop_write_file(file); out: return err; } long hfsplus_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; switch (cmd) { case HFSPLUS_IOC_EXT2_GETFLAGS: return hfsplus_ioctl_getflags(file, argp); case HFSPLUS_IOC_EXT2_SETFLAGS: return hfsplus_ioctl_setflags(file, argp); case HFSPLUS_IOC_BLESS: return hfsplus_ioctl_bless(file, argp); default: return -ENOTTY; } }
/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /** * This class is experimental, and as such has not been tested. * Please help make it more robust by contributing fixes if you find issues **/ #import <Foundation/Foundation.h> #import "alljoyn/Status.h" #import "alljoyn/time/TimeServiceDate.h" @interface AJTMTimeServiceDate : NSObject /* Constructor * @param handle A handle to a cpp object */ - (id)initWithHandle:(ajn::services::TimeServiceDate*)handle; /** * Initialize the object with its data. * * @param year Expected: four digit format * @param month Expected range: 1-12 * @param day Expected range: 1-31 * @return ER_OK if the object was initialized successfully and valid arguments have been passed to this method, * otherwise ER_BAD_ARGUMENT status of the appropriate argument is returned */ -(QStatus)populateWithYear:(uint16_t) year month:(uint8_t) month day:(uint8_t) day; /** * Checks whether data of the object is valid, the object variables have a correct values. * * - year Expected: four digit format * - month Expected range: 1-12 * - day Expected range: 1-31 * @return TRUE of the object is valid */ -(bool)isValid; /** * Returns year * * @return Returns year */ -(uint16_t)year; /** * Returns month * * @return Returns month */ -(uint8_t)month; /** * Returns day * * @return Returns day */ -(uint8_t)day; -(const ajn::services::TimeServiceDate&)getHandle; @end
typedef struct { sp_ftbl *ft; uint32_t index; int record; } sp_tblrec; int sp_tblrec_create(sp_tblrec **p); int sp_tblrec_destroy(sp_tblrec **p); int sp_tblrec_init(sp_data *sp, sp_tblrec *p, sp_ftbl *ft); int sp_tblrec_compute(sp_data *sp, sp_tblrec *p, SPFLOAT *in, SPFLOAT *trig, SPFLOAT *out);
// // Created by CocoaPods on TODAYS_DATE. // Copyright (c) 2014 PROJECT_OWNER. All rights reserved. // #import <UIKit/UIKit.h> @interface UIImage (AASymbolFont) + (instancetype)aa_imageWithSymbolName:(NSString *)symbolName size:(CGFloat)size color:(UIColor *)color; + (instancetype)aa_templateImageWithSymbolName:(NSString *)symbolName size:(CGFloat)size; @end
/* * Copyright (c) 2012, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. */ #include "caplock.h" #include <barrelfish/waitset.h> #include <barrelfish/event_queue.h> #include <barrelfish/debug.h> #include <monitor_invocations.h> #include "capqueue.h" #include "monitor_debug.h" static struct capqueue_queue global_queue; void caplock_wait(struct domcapref cap, struct event_queue_node *qn, struct event_closure cont) { DEBUG_CAPOPS("caplock_wait\n"); capqueue_wait(&global_queue, qn, cont); } void caplock_unlock(struct domcapref cap) { errval_t err = monitor_unlock_cap(cap.croot, cap.cptr, cap.bits); if (err_no(err) == SYS_ERR_CAP_NOT_FOUND || err == err_push(SYS_ERR_CAP_NOT_FOUND, SYS_ERR_IDENTIFY_LOOKUP)) { DEBUG_ERR(err, "unlocking cap"); } else if (err_is_fail(err)) { USER_PANIC_ERR(err, "unlocking cap"); } capqueue_notify(&global_queue); } void caplock_init(struct waitset *ws) { capqueue_init(&global_queue, ws); }
/** @file imopv.h ** @brief Vectorized image operations ** @author Andrea Vedaldi **/ /* Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. All rights reserved. This file is part of the VLFeat library and is made available under the terms of the BSD license (see the COPYING file). */ #ifndef VL_IMOPV_H #define VL_IMPOV_H #include "generic.h" /** @name Image convolution flags ** @{ */ #define VL_PAD_BY_ZERO (0x0 << 0) /**< @brief Pad with zeroes. */ #define VL_PAD_BY_CONTINUITY (0x1 << 0) /**< @brief Pad by continuity. */ #define VL_PAD_MASK (0x3) /**< @brief Padding field selector. */ #define VL_TRANSPOSE (0x1 << 2) /**< @brief Transpose result. */ /** @} */ /** @name Image convolution ** @{ */ VL_EXPORT void vl_imconvcol_vf (float* dst, int dst_stride, float const* src, int src_width, int src_height, int src_stride, float const* filt, int filt_begin, int filt_end, int step, unsigned int flags) ; VL_EXPORT void vl_imconvcol_vd (double* dst, int dst_stride, double const* src, int src_width, int src_height, int src_stride, double const* filt, int filt_begin, int filt_end, int step, unsigned int flags) ; VL_EXPORT void vl_imconvcoltri_f (float * dest, vl_size destStride, float const * image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride, vl_size filterSize, vl_size step, int unsigned flags) ; VL_EXPORT void vl_imconvcoltri_d (double * dest, vl_size destStride, double const * image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride, vl_size filterSize, vl_size step, int unsigned flags) ; /** @} */ /** @name Integral image ** @{ */ VL_EXPORT void vl_imintegral_f (float * integral, vl_size integralStride, float const * image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride) ; VL_EXPORT void vl_imintegral_d (double * integral, vl_size integralStride, double const * image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride) ; VL_EXPORT void vl_imintegral_i32 (vl_int32 * integral, vl_size integralStride, vl_int32 const * image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride) ; VL_EXPORT void vl_imintegral_ui32 (vl_uint32 * integral, vl_size integralStride, vl_uint32 const * image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride) ; /** @} */ /** @name Distance transform */ /** @{ */ VL_EXPORT void vl_image_distance_transform_d (double const * image, vl_size numColumns, vl_size numRows, vl_size columnStride, vl_size rowStride, double * distanceTransform, vl_uindex * indexes, double coeff, double offset) ; VL_EXPORT void vl_image_distance_transform_f (float const * image, vl_size numColumns, vl_size numRows, vl_size columnStride, vl_size rowStride, float * distanceTransform, vl_uindex * indexes, float coeff, float offset) ; /** @} */ /* VL_IMOPV_H */ #endif
#include "buffer.h" #include <stdlib.h> #include <assert.h> #include "surface.h" void wlc_buffer_dispose(struct wlc_buffer *buffer) { if (!buffer) return; if (buffer->references && --buffer->references > 0) return; wlc_resource_release(convert_to_wlc_resource(buffer)); } wlc_resource wlc_buffer_use(struct wlc_buffer *buffer) { if (!buffer) return 0; buffer->references++; return convert_to_wlc_resource(buffer); } void wlc_buffer_release(struct wlc_buffer *buffer) { struct wlc_surface *surface; if ((surface = convert_from_wlc_resource(buffer->surface, "surface"))) { if (surface->commit.buffer == convert_to_wlc_resource(buffer)) surface->commit.buffer = 0; if (surface->pending.buffer == convert_to_wlc_resource(buffer)) surface->pending.buffer = 0; } struct wl_resource *resource; if ((resource = convert_to_wl_resource(buffer, "buffer"))) { wlc_resource_invalidate(convert_to_wlc_resource(buffer)); wl_resource_queue_event(resource, WL_BUFFER_RELEASE); } } bool wlc_buffer(struct wlc_buffer *buffer) { assert(buffer); buffer->y_inverted = true; return true; }
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Drawing.Primitives\0.18.8\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Object.h> namespace g{namespace Fuse{namespace Drawing{namespace Primitives{struct LimitCoverage;}}}} namespace g{ namespace Fuse{ namespace Drawing{ namespace Primitives{ // internal abstract class LimitCoverage :12 // { uType* LimitCoverage_typeof(); void LimitCoverage__ctor__fn(LimitCoverage* __this); struct LimitCoverage : uObject { void ctor_(); }; // } }}}} // ::g::Fuse::Drawing::Primitives
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.BasicTheme\0.18.8\.cache\GeneratedCode\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Float.h> #include <Uno.UX.Property-1.h> namespace g{namespace Fuse{namespace BasicTheme{struct BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property;}}} namespace g{namespace Fuse{namespace Controls{struct TextControl;}}} namespace g{ namespace Fuse{ namespace BasicTheme{ // public sealed class BasicStyle.Fuse_Controls_TextControl_float_LineSpacing_Property :86 // { ::g::Uno::UX::Property_type* BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property_typeof(); void BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property__ctor_1_fn(BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property* __this, ::g::Fuse::Controls::TextControl* obj); void BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property__New1_fn(::g::Fuse::Controls::TextControl* obj, BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property** __retval); void BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property__OnGet_fn(BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property* __this, float* __retval); void BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property__OnSet_fn(BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property* __this, float* v, uObject* origin); struct BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property : ::g::Uno::UX::Property { uStrong< ::g::Fuse::Controls::TextControl*> _obj; void ctor_1(::g::Fuse::Controls::TextControl* obj); static BasicStyle__Fuse_Controls_TextControl_float_LineSpacing_Property* New1(::g::Fuse::Controls::TextControl* obj); }; // } }}} // ::g::Fuse::BasicTheme
/* Required Header Files */ #include "MSPd.h" /* The class pointer */ static t_class *windowvec_class; /* The object structure */ typedef struct _windowvec { t_object obj; t_float x_f; float *envelope; long vecsize; long oldbytes; } t_windowvec; #define OBJECT_NAME "windowvec~" /* Function prototypes */ void *windowvec_new(void); void windowvec_dsp(t_windowvec *x, t_signal **sp, short *count); t_int *windowvec_perform(t_int *w); /* The object setup function */ void windowvec_tilde_setup(void) { windowvec_class = class_new(gensym("windowvec~"), (t_newmethod)windowvec_new, 0, sizeof(t_windowvec), 0,0); CLASS_MAINSIGNALIN(windowvec_class, t_windowvec, x_f); class_addmethod(windowvec_class, (t_method)windowvec_dsp, gensym("dsp"), A_CANT, 0); potpourri_announce(OBJECT_NAME); } /* The new instance routine */ void *windowvec_new(void) { t_windowvec *x = (t_windowvec *)pd_new(windowvec_class); outlet_new(&x->obj, gensym("signal")); x->vecsize = 0; x->envelope = NULL; return x; } /* The free memory function*/ void windowvec_free(t_windowvec *x, t_signal **sp, short *count) { freebytes(x->envelope, x->oldbytes); } /* The perform routine */ t_int *windowvec_perform(t_int *w) { t_windowvec *x = (t_windowvec *) (w[1]); t_float *input = (t_float *) (w[2]); t_float *output = (t_float *) (w[3]); t_int n = w[4]; int i; float *envelope = x->envelope; /* Apply a Hann window to the input vector */ for(i=0; i < n; i++){ output[i] = input[i] * envelope[i]; } return w + 5; } void windowvec_dsp(t_windowvec *x, t_signal **sp, short *count) { int i; float twopi = 8. * atan(1); if(x->vecsize != sp[0]->s_n){ x->vecsize = sp[0]->s_n; /* Allocate memory */ if(x->envelope == NULL){ x->envelope = (float *) getbytes(x->vecsize * sizeof(float)); } else { x->envelope = (float *) resizebytes(x->envelope, x->oldbytes, x->vecsize * sizeof(float)); } x->oldbytes = x->vecsize * sizeof(float); /* Generate a Hann window */ for(i = 0 ; i < x->vecsize; i++){ x->envelope[i] = - 0.5 * cos(twopi * (i / (float)x->vecsize)) + 0.5; } } dsp_add(windowvec_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); }
/* aes192_dec.c */ /* This file is part of the AVR-Crypto-Lib. Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file aes192_dec.c * \email bg@nerilex.org * \author Daniel Otte * \date 2008-12-31 * \license GPLv3 or later * */ #include "aes.h" #include "aes_dec.h" void aes192_dec(void *buffer, aes192_ctx_t *ctx){ aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 12); }
/* * soundmovie.h - Interface of the audio stream for movie encoding * * Written by * Christian Vogelgsang <chris@vogelgsang.org> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #ifndef VICE_SOUNDMOVIE_H #define VICE_SOUNDMOVIE_H #include "vice.h" typedef struct soundmovie_buffer_s { SWORD *buffer; int size; int used; } soundmovie_buffer_t; typedef struct soundmovie_funcs_t { int (*init)(int speed,int channels,soundmovie_buffer_t **buffer); int (*encode)(soundmovie_buffer_t *buffer); void (*close)(void); } soundmovie_funcs_t; extern int soundmovie_start(soundmovie_funcs_t *funcs); extern int soundmovie_stop(void); #endif
#include "c.h" static void printtoken(void); int errcnt = 0; int errlimit = 20; char kind[] = { #define xx(a,b,c,d,e,f,g) f, #define yy(a,b,c,d,e,f,g) f, #include "token.h" }; int wflag; /* != 0 to suppress warning messages */ void test(int tok, char set[]) { if (t == tok) t = gettok(); else { expect(tok); skipto(tok, set); if (t == tok) t = gettok(); } } void expect(int tok) { if (t == tok) t = gettok(); else { error("syntax error; found"); printtoken(); fprint(stderr, " expecting `%k'\n", tok); } } void error(const char *fmt, ...) { va_list ap; if (errcnt++ >= errlimit) { errcnt = -1; error("too many errors\n"); exit(1); } va_start(ap, fmt); if (firstfile != file && firstfile && *firstfile) fprint(stderr, "%s: ", firstfile); fprint(stderr, "%w: ", &src); vfprint(stderr, NULL, fmt, ap); va_end(ap); } void skipto(int tok, char set[]) { int n; char *s; assert(set); for (n = 0; t != EOI && t != tok; t = gettok()) { for (s = set; *s && kind[t] != *s; s++) ; if (kind[t] == *s) break; if (n++ == 0) error("skipping"); if (n <= 8) printtoken(); else if (n == 9) fprint(stderr, " ..."); } if (n > 8) { fprint(stderr, " up to"); printtoken(); } if (n > 0) fprint(stderr, "\n"); } /* fatal - issue fatal error message and exit */ int fatal(const char *name, const char *fmt, int n) { print("\n"); errcnt = -1; error("compiler error in %s--", name); fprint(stderr, fmt, n); exit(EXIT_FAILURE); return 0; } /* printtoken - print current token preceeded by a space */ static void printtoken(void) { switch (t) { case ID: fprint(stderr, " `%s'", token); break; case ICON: fprint(stderr, " `%s'", vtoa(tsym->type, tsym->u.c.v)); break; case SCON: { int i, n; if (ischar(tsym->type->type)) { char *s = tsym->u.c.v.p; n = tsym->type->size; fprint(stderr, " \""); for (i = 0; i < 20 && i < n && *s; s++, i++) if (*s < ' ' || *s >= 0177) fprint(stderr, "\\%o", *s); else fprint(stderr, "%c", *s); } else { /* wchar_t string */ unsigned int *s = tsym->u.c.v.p; assert(tsym->type->type->size == widechar->size); n = tsym->type->size/widechar->size; fprint(stderr, " L\""); for (i = 0; i < 20 && i < n && *s; s++, i++) if (*s < ' ' || *s >= 0177) fprint(stderr, "\\x%x", *s); else fprint(stderr, "%c", *s); } if (i < n) fprint(stderr, " ..."); else fprint(stderr, "\""); break; } case FCON: fprint(stderr, " `%S'", token, (char*)cp - token); break; case '`': case '\'': fprint(stderr, " \"%k\"", t); break; default: fprint(stderr, " `%k'", t); } } /* warning - issue warning error message */ void warning(const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (wflag == 0) { errcnt--; error("warning: "); vfprint(stderr, NULL, fmt, ap); } va_end(ap); }
// // PAPPhotoDetailsFooterView.h // Anypic // // Created by Mattieu Gamache-Asselin on 5/16/12. // @interface PAPPhotoDetailsFooterView : UIView @property (nonatomic, strong) UITextField *commentField; @property (nonatomic) BOOL hideDropShadow; + (CGRect)rectForView; @end
/* * This file is part of the coreboot project. * * Copyright (C) 2008-2010 Joseph Smith <joe@settoplinux.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <console/console.h> #include <arch/io.h> #include <stdint.h> #include <device/device.h> #include <device/pci.h> #include <device/pci_ids.h> #include <cbmem.h> #include <cpu/cpu.h> #include <stdlib.h> #include <string.h> #include "i82830.h" static void northbridge_init(device_t dev) { printk(BIOS_SPEW, "Northbridge init\n"); } static struct device_operations northbridge_operations = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, .init = northbridge_init, .enable = 0, .ops_pci = 0, }; static const struct pci_driver northbridge_driver __pci_driver = { .ops = &northbridge_operations, .vendor = PCI_VENDOR_ID_INTEL, .device = 0x3575, }; static void pci_domain_set_resources(device_t dev) { device_t mc_dev; int igd_memory = 0; uint64_t uma_memory_base = 0, uma_memory_size = 0; mc_dev = dev->link_list->children; if (!mc_dev) return; unsigned long tomk, tomk_stolen; int idx; if (CONFIG_VIDEO_MB == 512) { igd_memory = (CONFIG_VIDEO_MB); printk(BIOS_DEBUG, "%dKB IGD UMA\n", igd_memory >> 10); } else { igd_memory = (CONFIG_VIDEO_MB * 1024); printk(BIOS_DEBUG, "%dMB IGD UMA\n", igd_memory >> 10); } /* Get the value of the highest DRB. This tells the end of * the physical memory. The units are ticks of 32MB * i.e. 1 means 32MB. */ tomk = ((unsigned long)pci_read_config8(mc_dev, DRB + 3)) << 15; tomk_stolen = tomk - igd_memory; /* For reserving UMA memory in the memory map */ uma_memory_base = tomk_stolen * 1024ULL; uma_memory_size = igd_memory * 1024ULL; printk(BIOS_DEBUG, "Available memory: %ldKB\n", tomk_stolen); /* Report the memory regions. */ idx = 10; ram_resource(dev, idx++, 0, 640); ram_resource(dev, idx++, 768, tomk - 768); uma_resource(dev, idx++, uma_memory_base >> 10, uma_memory_size >> 10); assign_resources(dev->link_list); set_top_of_ram(tomk_stolen * 1024); } static struct device_operations pci_domain_ops = { .read_resources = pci_domain_read_resources, .set_resources = pci_domain_set_resources, .enable_resources = NULL, .init = NULL, .scan_bus = pci_domain_scan_bus, .ops_pci_bus = pci_bus_default_ops, }; static void cpu_bus_init(device_t dev) { initialize_cpus(dev->link_list); } static struct device_operations cpu_bus_ops = { .read_resources = DEVICE_NOOP, .set_resources = DEVICE_NOOP, .enable_resources = DEVICE_NOOP, .init = cpu_bus_init, .scan_bus = 0, }; static void enable_dev(struct device *dev) { struct device_path; /* Set the operations if it is a special bus type. */ if (dev->path.type == DEVICE_PATH_DOMAIN) { dev->ops = &pci_domain_ops; } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { dev->ops = &cpu_bus_ops; } } struct chip_operations northbridge_intel_i82830_ops = { CHIP_NAME("Intel 82830 Northbridge") .enable_dev = enable_dev, };
// // JBBarChartView.h // JBChartView // // Created by Terry Worona on 9/3/13. // Copyright (c) 2013 Jawbone. All rights reserved. // // Views #import "JBChartView.h" @protocol JBBarChartViewDelegate; @protocol JBBarChartViewDataSource; @interface JBBarChartView : JBChartView @property (nonatomic, weak) id<JBBarChartViewDelegate> delegate; @property (nonatomic, weak) id<JBBarChartViewDataSource> dataSource; /** * If showsSelection is YES, a vertical highlight will overlayed on a bar during touch events. * * Default: YES */ @property (nonatomic, assign) BOOL showsSelection; @end @protocol JBBarChartViewDelegate <NSObject> @required /** * Height for a bar at a given index (left to right). There is no ceiling on the the height; * the chart will automatically normalize all values between the overal min and max heights. * * @param barChartView The origin chart * @param index The 0-based index of a given bar (left to right, x-axis) * * @return The y-axis height of the supplied bar index (x-axis) */ - (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSInteger)index; @optional /** * Occurs when a touch gesture event occurs on a given bar. The chart must be expanded, showsSelection must be YES, * and the selection must occur within the bounds of the chart. * * @param barChartView The origin chart * @param index The 0-based index of a given bar (left to right, x-axis) */ - (void)barChartView:(JBBarChartView *)barChartView didSelectBarAtIndex:(NSInteger)index; /** * Occurs when selection ends by either ending a touch event or selecting an area that is outside the view's bounds. * For selection start events, see: didSelectBarAtIndex... * * @param barChartView The origin chart * @param index The 0-based index of a given bar. Index will be -1 if the touch ends outside of the view's bounds. */ - (void)barChartView:(JBBarChartView *)barChartView didUnselectBarAtIndex:(NSInteger)index; @end @protocol JBBarChartViewDataSource <NSObject> @required /** * The number of bars in a given bar chart is the number of vertical views shown along the x-axis. * * @param barChartView The origin chart * * @return Number of bars in the given chart, displayed horizontally along the chart's x-axis. */ - (NSInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView; @optional /** * Horizontal padding between bars. * * Default: 'best-guess' algorithm based on the the total number of bars and width of the chart. * * @param barChartView The origin chart * * @return Horizontal width (in pixels) between each bar. */ - (NSInteger)barPaddingForBarChartView:(JBBarChartView *)barChartView; /** * A UIView subclass representing the bar at a particular index. * * Default: solid black UIView * * @param barChartView The origin chart * @param index The 0-based index of a given bar (left to right, x-axis) * * @return A UIView subclass. The view will automatically be resized by the chart during creation (ie. no need to set the frame). */ - (UIView *)barViewForBarChartView:(JBBarChartView *)barChartView atIndex:(NSInteger)index; /** * The selection color to be overlayed on a bar during touch events. * The color is automically faded to transparent (vertically). * * Default: white color (faded to transparent) * * @param barChartView The origin chart * * @return The color to be used on each bar selection. */ - (UIColor *)selectionBarColorForBarChartView:(JBBarChartView *)barChartView; @end
#undef CONFIG_SCx200_I2C
/* * linux/arch/arm/mm/pgd.c * * Copyright (C) 1998-2005 Russell King * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/mm.h> #include <linux/gfp.h> #include <linux/highmem.h> #include <linux/slab.h> #include <asm/cp15.h> #include <asm/pgalloc.h> #include <asm/page.h> #include <asm/tlbflush.h> #ifdef CONFIG_TIMA_TEST_INFRA_MODULE #include <linux/export.h> #endif #include "mm.h" #ifdef CONFIG_ARM_LPAE #define __pgd_alloc() kmalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL) #define __pgd_free(pgd) kfree(pgd) #else #define __pgd_alloc() (pgd_t *)__get_free_pages(GFP_KERNEL, 2) #define __pgd_free(pgd) free_pages((unsigned long)pgd, 2) #endif /* * need to get a 16k page for level 1 */ pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd, *init_pgd; pud_t *new_pud, *init_pud; pmd_t *new_pmd, *init_pmd; pte_t *new_pte, *init_pte; new_pgd = __pgd_alloc(); if (!new_pgd) goto no_pgd; memset(new_pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); /* * Copy over the kernel and IO PGD entries */ init_pgd = pgd_offset_k(0); memcpy(new_pgd + USER_PTRS_PER_PGD, init_pgd + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); clean_dcache_area(new_pgd, PTRS_PER_PGD * sizeof(pgd_t)); #ifdef CONFIG_ARM_LPAE /* * Allocate PMD table for modules and pkmap mappings. */ new_pud = pud_alloc(mm, new_pgd + pgd_index(MODULES_VADDR), MODULES_VADDR); if (!new_pud) goto no_pud; new_pmd = pmd_alloc(mm, new_pud, 0); if (!new_pmd) goto no_pmd; #endif if (!vectors_high()) { /* * On ARM, first page must always be allocated since it * contains the machine vectors. The vectors are always high * with LPAE. */ new_pud = pud_alloc(mm, new_pgd, 0); if (!new_pud) goto no_pud; new_pmd = pmd_alloc(mm, new_pud, 0); if (!new_pmd) goto no_pmd; new_pte = pte_alloc_map(mm, NULL, new_pmd, 0); if (!new_pte) goto no_pte; init_pud = pud_offset(init_pgd, 0); init_pmd = pmd_offset(init_pud, 0); init_pte = pte_offset_map(init_pmd, 0); set_pte_ext(new_pte, *init_pte, 0); pte_unmap(init_pte); pte_unmap(new_pte); } return new_pgd; no_pte: pmd_free(mm, new_pmd); no_pmd: pud_free(mm, new_pud); no_pud: __pgd_free(new_pgd); no_pgd: return NULL; } void pgd_free(struct mm_struct *mm, pgd_t *pgd_base) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pgtable_t pte; #ifdef CONFIG_TIMA_RKP_L1_TABLES unsigned long cmd_id = 0x3f80b221; unsigned long pmd_base; #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 __asm__ __volatile__(".arch_extension sec\n"); #endif #endif if (!pgd_base) return; pgd = pgd_base + pgd_index(0); if (pgd_none_or_clear_bad(pgd)) goto no_pgd; pud = pud_offset(pgd, 0); if (pud_none_or_clear_bad(pud)) goto no_pud; pmd = pmd_offset(pud, 0); if (pmd_none_or_clear_bad(pmd)) goto no_pmd; pte = pmd_pgtable(*pmd); pmd_clear(pmd); pte_free(mm, pte); no_pmd: pud_clear(pud); pmd_free(mm, pmd); no_pud: pgd_clear(pgd); pud_free(mm, pud); no_pgd: #ifdef CONFIG_ARM_LPAE /* * Free modules/pkmap or identity pmd tables. */ for (pgd = pgd_base; pgd < pgd_base + PTRS_PER_PGD; pgd++) { if (pgd_none_or_clear_bad(pgd)) continue; if (pgd_val(*pgd) & L_PGD_SWAPPER) continue; pud = pud_offset(pgd, 0); if (pud_none_or_clear_bad(pud)) continue; pmd = pmd_offset(pud, 0); pud_clear(pud); pmd_free(mm, pmd); pgd_clear(pgd); pud_free(mm, pud); } #endif #ifdef CONFIG_TIMA_RKP_L1_TABLES if (tima_is_pg_protected((unsigned long) pgd) != 0) { __asm__ __volatile__ ( "stmfd sp!,{r0-r1, r11}\n" "mov r11, r0\n" "mov r0, %0\n" "mov r1, %1\n" "smc #11\n" "mov r0, #0\n" "mcr p15, 0, r0, c8, c3, 0\n" "dsb\n" "isb\n" "pop {r0-r1, r11}\n" ::"r"(cmd_id),"r"(pgd):"r0","r1","r11","cc"); pmd_base = ((unsigned long)pgd) & (~0x3fff); tima_verify_state(pmd_base, 0, 0, 3); tima_verify_state(pmd_base + 0x1000, 0, 0, 3); tima_verify_state(pmd_base + 0x2000, 0, 0, 3); tima_verify_state(pmd_base + 0x3000, 0, 0, 3); } #endif __pgd_free(pgd_base); } #ifdef CONFIG_TIMA_TEST_INFRA_MODULE EXPORT_SYMBOL(pgd_free); #endif/*CONFIG_TIMA_TEST_INFRA_MODULE*/
/* Definitions for DEC Alpha/AXP running FreeBSD using the ELF format Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } /* Provide a FBSD_TARGET_CPU_CPP_BUILTINS and CPP_SPEC appropriate for FreeBSD/alpha. Besides the dealing with the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must deal with the Alpha's FP issues. */ #undef FBSD_TARGET_CPU_CPP_BUILTINS #define FBSD_TARGET_CPU_CPP_BUILTINS() \ do \ { \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ builtin_define ("__pic__"); \ } \ } \ while (0) #undef CPP_SPEC #define CPP_SPEC "%(cpp_subtarget) %{posix:-D_POSIX_SOURCE}" #define LINK_SPEC "%{G*} %{relax:-relax} \ %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ %{Wl,*:%*} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ %{shared:-Bshareable %{h*} %{soname*}} \ %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ %{symbolic:-Bsymbolic}" /************************[ Target stuff ]***********************************/ /* Define the actual types of some ANSI-mandated types. Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, c-common.c, and config/<arch>/<arch>.h. */ /* alpha.h gets this wrong for FreeBSD. We use the GCC defaults instead. */ #undef WCHAR_TYPE #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (FreeBSD/alpha ELF)"); #define TARGET_ELF 1 #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_FP | MASK_FPREGS | MASK_GAS) #undef HAS_INIT_SECTION /* Show that we need a GP when profiling. */ #undef TARGET_PROFILING_NEEDS_GP #define TARGET_PROFILING_NEEDS_GP 1 /* This is the char to use for continuation (in case we need to turn continuation back on). */ #undef DBX_CONTIN_CHAR #define DBX_CONTIN_CHAR '?' /* Don't default to pcc-struct-return, we want to retain compatibility with older FreeBSD releases AND pcc-struct-return may not be reentrant. */ #undef DEFAULT_PCC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 0
#ifndef GVBINARYFUNCTIONS_H #define GVBINARYFUNCTIONS_H #include <iostream> #include <math.h> #include <algorithm> using namespace std; int numberHighBits(unsigned char ucNumber); int numberHighBits(int ucNumber); bool isBase2(int iNumber); int firstHighBit(int iNumber); bool isBitHigh(unsigned char iNumber, unsigned char iBit); void sort(double dUnsortedArray[8], unsigned char uc_IndexSorted[8]); #endif // GVBINARYFUNCTIONS_H
/* * passhash.h * Perform password to key hash algorithm as defined in WPA and 802.11i * specifications. * * $Copyright Open Broadcom Corporation$ * * $Id: passhash.h,v 1.8 2007-01-12 21:56:16 jqliu Exp $ */ #ifndef _PASSHASH_H_ #define _PASSHASH_H_ #include <typedefs.h> /* passhash: perform passwork to key hash algorithm as defined in WPA and 802.11i * specifications. * * password is an ascii string of 8 to 63 characters in length * ssid is up to 32 bytes * ssidlen is the length of ssid in bytes * output must be at lest 40 bytes long, and returns a 256 bit key * returns 0 on success, non-zero on failure */ extern int BCMROMFN(passhash)(char *password, int passlen, unsigned char *ssid, int ssidlen, unsigned char *output); /* init_passhash/do_passhash/get_passhash: perform passwork to key hash algorithm * as defined in WPA and 802.11i specifications, and break lengthy calculation into * smaller pieces. * * password is an ascii string of 8 to 63 characters in length * ssid is up to 32 bytes * ssidlen is the length of ssid in bytes * output must be at lest 40 bytes long, and returns a 256 bit key * returns 0 on success, negative on failure. * * Allocate passhash_t and call init_passhash() to initialize it before * calling do_passhash(), and don't release password and ssid until passhash * is done. * Call do_passhash() to request and perform # iterations. do_passhash() * returns positive value to indicate it is in progress, so continue to * call it until it returns 0 which indicates a success. * Call get_passhash() to get the hash value when do_passhash() is done. */ #include <bcmcrypto/sha1.h> typedef struct { unsigned char digest[SHA1HashSize]; /* Un-1 */ int count; /* Count */ unsigned char output[2*SHA1HashSize]; /* output */ char *password; int passlen; unsigned char *ssid; int ssidlen; int iters; } passhash_t; extern int init_passhash(passhash_t *passhash, char *password, int passlen, unsigned char *ssid, int ssidlen); extern int do_passhash(passhash_t *passhash, int iterations); extern int get_passhash(passhash_t *passhash, unsigned char *output, int outlen); #endif /* _PASSHASH_H_ */
/* * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #include <config.h> #include <h_proto.h> #include <sched.h> #include <hype.h> /* * h_set_sched_params(per_cpu_os *pcop, uval lpid, * uval cpu, uval required, uval desired) * * Temporary interface for setting scheduling parameters. * * required/desired are bitmaps that specify which slots the calling * OS wants. Bits in "required" represent scheduling slots that must * be assignable to this OS (and locked down). The desired bit-map * represents scheduling slots that may be set/unset, without guarantees at * any time by HV. Thus fullfilling "desired" requests has no bearing * on the success/failure of this call. * * On return, r4 contains a bitmap identifying the locked-down slots * (which cannot be yielded to satisfy set_sched_params() calls of * other partitions). r5 contains a bitmap representing all in-use * scheduling slots. The caller can use this information to try again * if an error has occurred. r6 contains the bitmask actually assigned * (a rotation of "required"). * * The return value, if positive (-> success) identifies the left-wise * rotation required of the input parameters to have fulfilled the request. * * FIXME: Should have a mechanism to restrict rights to calls this function * to the controlling OS only. * * FIXME: Re-implement using standard LPAR interfaces, if appropriate. * * Examples of usage in "test_sched.c". */ sval h_set_sched_params(struct cpu_thread *thread, uval lpid, uval phys_cpu_num, uval required, uval desired) { /* The real per_cpu_os to operate on is specified by the cpu arg */ uval err = H_Success; struct os *target_os = os_lookup(lpid); struct cpu *target_cpu; struct hype_per_cpu_s *hpc = &hype_per_cpu[phys_cpu_num]; /* Bounds/validity checks on lpid and cpu */ if ((!target_os && (lpid != (uval)H_SELF_LPID)) || (phys_cpu_num > MAX_CPU && phys_cpu_num != THIS_CPU)) { err = H_Parameter; goto bad_os; } if (!target_os) { target_os = thread->cpu->os; } write_lock_acquire(&target_os->po_mutex); if (phys_cpu_num == THIS_CPU) { /* TODO - fixme WHAT? */ phys_cpu_num = thread->cpu->logical_cpu_num; /* update our place holder */ hpc = &hype_per_cpu[phys_cpu_num]; } /* TODO - fixme WHAT? */ target_cpu = target_os->cpu[phys_cpu_num]; if (!target_cpu) { err = H_Parameter; goto bad_cpu; } lock_acquire(&hpc->hpc_mutex); err = locked_set_sched_params(target_cpu, phys_cpu_num, required, desired); /* Provide current setting to OS, so it can compensate */ return_arg(thread, 1, hpc->hpc_sched.locked_slots); return_arg(thread, 2, hpc->hpc_sched.used_slots); return_arg(thread, 3, target_cpu->sched.required); lock_release(&hpc->hpc_mutex); /* *INDENT-OFF* */ bad_cpu: /* *INDENT-ON* */ write_lock_release(&target_os->po_mutex); /* *INDENT-OFF* */ bad_os: /* *INDENT-ON* */ return err; }
/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif #include "thr_lock.h" /* THR_LOCK */ #include "handler.h" /* handler */ #include "table.h" /* TABLE_SHARE */ #include "sql_const.h" /* MAX_KEY */ /* Shared structure for correct LOCK operation */ struct st_blackhole_share { THR_LOCK lock; uint use_count; uint table_name_length; char table_name[1]; }; /* Class definition for the blackhole storage engine "Dumbest named feature ever" */ class ha_blackhole final : public handler { THR_LOCK_DATA lock; /* MySQL lock */ st_blackhole_share *share; public: ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg); ~ha_blackhole() { } /* The name of the index type that will be used for display don't implement this method unless you really have indexes */ const char *index_type(uint key_number); ulonglong table_flags() const { return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_CAN_ONLINE_BACKUPS | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED); } ulong index_flags(uint inx, uint part, bool all_parts) const { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY); } /* The following defines can be increased if necessary */ #define BLACKHOLE_MAX_KEY MAX_KEY /* Max allowed keys */ #define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */ #define BLACKHOLE_MAX_KEY_LENGTH 3500 /* Like in InnoDB */ uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; } uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } int open(const char *name, int mode, uint test_if_locked); int close(void); int truncate(); int rnd_init(bool scan); int rnd_next(uchar *buf); int rnd_pos(uchar * buf, uchar *pos); int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); int index_read_idx_map(uchar * buf, uint idx, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); int index_read_last_map(uchar * buf, const uchar * key, key_part_map keypart_map); int index_next(uchar * buf); int index_prev(uchar * buf); int index_first(uchar * buf); int index_last(uchar * buf); void position(const uchar *record); int info(uint flag); int external_lock(THD *thd, int lock_type); int create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); int delete_table(const char *name) { return 0; } private: virtual int write_row(const uchar *buf); virtual int update_row(const uchar *old_data, const uchar *new_data); virtual int delete_row(const uchar *buf); };
/* Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. Governed by the TrueCrypt License 3.0 the full text of which is contained in the file License.txt included in TrueCrypt binary and source code distribution packages. */ #ifndef TC_HEADER_Platform_FilesystemPath #define TC_HEADER_Platform_FilesystemPath #include "PlatformBase.h" #include "Platform/User.h" #include "SharedPtr.h" #include "StringConverter.h" namespace TrueCrypt { struct FilesystemPathType { enum Enum { Unknown, File, Directory, SymbolickLink, BlockDevice, CharacterDevice }; }; class FilesystemPath { public: FilesystemPath () { } FilesystemPath (const char *path) : Path (StringConverter::ToWide (path)) { } FilesystemPath (string path) : Path (StringConverter::ToWide (path)) { } FilesystemPath (const wchar_t *path) : Path (path) { } FilesystemPath (wstring path) : Path (path) { } virtual ~FilesystemPath () { } bool operator== (const FilesystemPath &other) const { return Path == other.Path; } bool operator!= (const FilesystemPath &other) const { return Path != other.Path; } operator string () const { return StringConverter::ToSingle (Path); } operator wstring () const { return Path; } void Delete () const; UserId GetOwner () const; FilesystemPathType::Enum GetType () const; bool IsBlockDevice () const throw () { try { return GetType() == FilesystemPathType::BlockDevice; } catch (...) { return false; }; } bool IsCharacterDevice () const throw () { try { return GetType() == FilesystemPathType::CharacterDevice; } catch (...) { return false; }; } bool IsDevice () const throw () { return IsBlockDevice() || IsCharacterDevice(); } bool IsDirectory () const throw () { try { return GetType() == FilesystemPathType::Directory; } catch (...) { return false; } } bool IsEmpty () const throw () { try { return Path.empty(); } catch (...) { return false; } } bool IsFile () const throw () { try { return GetType() == FilesystemPathType::File; } catch (...) { return false; } } FilesystemPath ToBaseName () const; FilesystemPath ToHostDriveOfPartition () const; static const int MaxSize = 260; protected: wstring Path; }; typedef FilesystemPath DevicePath; typedef FilesystemPath DirectoryPath; typedef FilesystemPath FilePath; typedef list < shared_ptr <DirectoryPath> > DirectoryPathList; typedef list < shared_ptr <FilePath> > FilePathList; } #endif // TC_HEADER_Platform_FilesystemPath
#pragma once /* * Copyright (C) 2010-2015 Team Kodi * http://kodi.tv * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kodi; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include <string> // We forward declare CFStringRef in order to avoid // pulling in tons of Objective-C headers. struct __CFString; typedef const struct __CFString * CFStringRef; class CDarwinUtils { public: static const char *getIosPlatformString(void); static bool IsMavericks(void); static bool IsSnowLeopard(void); static bool DeviceHasRetina(double &scale); static bool DeviceHasLeakyVDA(void); static const char *GetOSReleaseString(void); static const char *GetOSVersionString(void); static float GetIOSVersion(void); static const char *GetIOSVersionString(void); static const char *GetOSXVersionString(void); static int GetFrameworkPath(bool forPython, char* path, uint32_t *pathsize); static int GetExecutablePath(char* path, uint32_t *pathsize); static const char *GetAppRootFolder(void); static bool IsIosSandboxed(void); static bool HasVideoToolboxDecoder(void); static int BatteryLevel(void); static void SetScheduling(int message); static void PrintDebugString(std::string debugString); static bool CFStringRefToString(CFStringRef source, std::string& destination); static bool CFStringRefToUTF8String(CFStringRef source, std::string& destination); static const std::string& GetManufacturer(void); static bool IsAliasShortcut(const std::string& path); static void TranslateAliasShortcut(std::string& path); static bool CreateAliasShortcut(const std::string& fromPath, const std::string& toPath); };
/* Copyright 2012 Jun Wako <wakojun@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CONFIG_H #define CONFIG_H #include "config_common.h" #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 #define MANUFACTURER LFKeyboards #define PRODUCT LFK87 #define DIODE_DIRECTION COL2ROW #ifdef LFK_TKL_REV_A /* RevB Matrix config */ #define MATRIX_ROWS 6 #define MATRIX_COLS 17 #define MATRIX_ROW_PINS {D2, D3, D4, D5, D6, D7 } #define MATRIX_COL_PINS {A0, A1, A2, A3, A4, A5, A6, A7, E6, E7,\ F0, F1, F2, F3, C0, C1, C2 } #define UNUSED_PINS {B0, B1, B2, B3, B4, B4, B5, B6, B7, C4, C5, C6, C7,\ D0, D1, E0, E1, E2, E3, E4, F4, F5, F6, F7} #define RGBLED_NUM 25 // Number of LEDs #else /* RevC/D Matrix config */ #define MATRIX_ROWS 7 #define MATRIX_COLS 16 #define MATRIX_ROW_PINS {F2, D7, D6, D5, D4, D3, F3} #define MATRIX_COL_PINS {A0, A1, A2, A3, A4, A5, A6, A7, C7, C1, C0, E1, E0, C2, C3, C4} #define UNUSED_PINS {B0, B1, B2, B3, B4, B4, B5, B6, B7, C5, C6, D2, E3, E4, E5, E6, E7, \ F0, F1, F4, F5, F6, F7} #define RGBLED_NUM 24 // Number of LEDs #endif #define AUDIO_VOICES #define C6_AUDIO #define BACKLIGHT_LEVELS 10 #define BACKLIGHT_PWM_MAP {2, 4, 8, 16, 40, 55, 70, 128, 200, 255} #define RGB_DI_PIN F4 // Have to set it to something to get the ws2812 code to compile #define RGBLIGHT_ANIMATIONS #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_VAL_STEP 17 #define TAPPING_TERM 200 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST /* number of backlight levels */ /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE /* * Force NKRO * * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the * makefile for this to work.) * * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) * until the next keyboard reset. * * NKRO may prevent your keystrokes from being detected in the BIOS, but it is * fully operational during normal computer usage. * * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by * bootmagic, NKRO mode will always be enabled until it is toggled again during a * power-up. * */ //#define FORCE_NKRO /* * Magic Key Options * * Magic keys are hotkey commands that allow control over firmware functions of * the keyboard. They are best used in combination with the HID Listen program, * found here: https://www.pjrc.com/teensy/hid_listen.html * * The options below allow the magic key functionality to be changed. This is * useful if your keyboard/keypad is missing keys and you want magic key support. * */ /* control how magic key switches layers */ //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false /* override magic key keymap */ //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM //#define MAGIC_KEY_HELP1 H //#define MAGIC_KEY_HELP2 SLASH //#define MAGIC_KEY_DEBUG D //#define MAGIC_KEY_DEBUG_MATRIX X //#define MAGIC_KEY_DEBUG_KBD K //#define MAGIC_KEY_DEBUG_MOUSE M //#define MAGIC_KEY_VERSION V //#define MAGIC_KEY_STATUS S //#define MAGIC_KEY_CONSOLE C //#define MAGIC_KEY_LAYER0_ALT1 ESC //#define MAGIC_KEY_LAYER0_ALT2 GRAVE //#define MAGIC_KEY_LAYER0 0 //#define MAGIC_KEY_LAYER1 1 //#define MAGIC_KEY_LAYER2 2 //#define MAGIC_KEY_LAYER3 3 //#define MAGIC_KEY_LAYER4 4 //#define MAGIC_KEY_LAYER5 5 //#define MAGIC_KEY_LAYER6 6 //#define MAGIC_KEY_LAYER7 7 //#define MAGIC_KEY_LAYER8 8 //#define MAGIC_KEY_LAYER9 9 //#define MAGIC_KEY_BOOTLOADER PAUSE //#define MAGIC_KEY_LOCK CAPS //#define MAGIC_KEY_EEPROM E //#define MAGIC_KEY_NKRO N //#define MAGIC_KEY_SLEEP_LED Z /* * Feature disable options * These options are also useful to firmware size reduction. */ /* disable debug print */ //#define NO_DEBUG /* disable print */ //#define NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION #endif
#ifndef _ISERIES_IRQ_H #define _ISERIES_IRQ_H extern void iSeries_init_IRQ(void); extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); extern void iSeries_activate_IRQs(void); extern int iSeries_get_irq(struct pt_regs *); #endif /* _ISERIES_IRQ_H */