text
stringlengths
4
6.14k
#ifndef SUBCLASSS2CTIMAP_H #define SUBCLASSS2CTIMAP_H #include "SubClassS2.h" #include "Mappings/ClassTableInheritanceMap.h" class SubClassS2CtiMap : public QtOrm::Mapping::ClassTableInheritanceMap<SuperClassS, SubClassS2> { public: SubClassS2CtiMap() { setDiscrimanitorValue(2); setTable("sub_class_s2"); mapId("id", "idS2"); map("strVal", "str_val"); } }; #endif // SUBCLASSS2CTIMAP_H
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2013-2018 The Version developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus # error This header can only be compiled as C++. #endif #ifndef __INCLUDED_PROTOCOL_H__ #define __INCLUDED_PROTOCOL_H__ #include "serialize.h" #include "netbase.h" #include <string> #include "uint256.h" extern bool fTestNet; static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { return testnet ? 9989 : 9988; } extern unsigned char pchMessageStart[4]; /** Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */ class CMessageHeader { public: CMessageHeader(); CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn); std::string GetCommand() const; bool IsValid() const; IMPLEMENT_SERIALIZE ( READWRITE(FLATDATA(pchMessageStart)); READWRITE(FLATDATA(pchCommand)); READWRITE(nMessageSize); READWRITE(nChecksum); ) // TODO: make private (improves encapsulation) public: enum { MESSAGE_START_SIZE=sizeof(::pchMessageStart), COMMAND_SIZE=12, MESSAGE_SIZE_SIZE=sizeof(int), CHECKSUM_SIZE=sizeof(int), MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE, CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE, HEADER_SIZE=MESSAGE_START_SIZE+COMMAND_SIZE+MESSAGE_SIZE_SIZE+CHECKSUM_SIZE }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; unsigned int nMessageSize; unsigned int nChecksum; }; /** nServices flags */ enum { NODE_NETWORK = (1 << 0), }; /** A CService with information about it as peer */ class CAddress : public CService { public: CAddress(); explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK); void Init(); IMPLEMENT_SERIALIZE ( CAddress* pthis = const_cast<CAddress*>(this); CService* pip = (CService*)pthis; if (fRead) pthis->Init(); if (nType & SER_DISK) READWRITE(nVersion); if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); READWRITE(nServices); READWRITE(*pip); ) void print() const; // TODO: make private (improves encapsulation) public: uint64 nServices; // disk and network only unsigned int nTime; // memory only int64 nLastTry; }; /** inv message data */ class CInv { public: CInv(); CInv(int typeIn, const uint256& hashIn); CInv(const std::string& strType, const uint256& hashIn); IMPLEMENT_SERIALIZE ( READWRITE(type); READWRITE(hash); ) friend bool operator<(const CInv& a, const CInv& b); bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; void print() const; // TODO: make private (improves encapsulation) public: int type; uint256 hash; }; #endif // __INCLUDED_PROTOCOL_H__
/* * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef HEADER_COMP_H # define HEADER_COMP_H # include BLIK_OPENSSL_V_openssl__opensslconf_h //original-code:<openssl/opensslconf.h> # ifndef OPENSSL_NO_COMP # include BLIK_OPENSSL_V_openssl__crypto_h //original-code:<openssl/crypto.h> # ifdef __cplusplus extern "C" { # endif COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); int COMP_CTX_get_type(const COMP_CTX* comp); int COMP_get_type(const COMP_METHOD *meth); const char *COMP_get_name(const COMP_METHOD *meth); void COMP_CTX_free(COMP_CTX *ctx); int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen); int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen); COMP_METHOD *COMP_zlib(void); #if OPENSSL_API_COMPAT < 0x10100000L #define COMP_zlib_cleanup() while(0) continue #endif # ifdef HEADER_BIO_H # ifdef ZLIB const BIO_METHOD *BIO_f_zlib(void); # endif # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ int ERR_load_COMP_strings(void); /* Error codes for the COMP functions. */ /* Function codes. */ # define COMP_F_BIO_ZLIB_FLUSH 99 # define COMP_F_BIO_ZLIB_NEW 100 # define COMP_F_BIO_ZLIB_READ 101 # define COMP_F_BIO_ZLIB_WRITE 102 /* Reason codes. */ # define COMP_R_ZLIB_DEFLATE_ERROR 99 # define COMP_R_ZLIB_INFLATE_ERROR 100 # define COMP_R_ZLIB_NOT_SUPPORTED 101 # ifdef __cplusplus } # endif # endif #endif
#define SF_R32G32_FLOAT DXGI_FORMAT_R32G32_FLOAT #define SF_R32G32B32_FLOAT DXGI_FORMAT_R32G32B32_FLOAT #define SF_R8G8B8A8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM #define SF_R32_UINT DXGI_FORMAT_R32_UINT #define SF_R8G8B8A8_UINT DXGI_FORMAT_R8G8B8A8_UINT typedef D3D11_INPUT_ELEMENT_DESC InputElement; class CInputElement : public InputElement { public: CInputElement(const char* name, DXGI_FORMAT format, int offset, int inputSlot = 0) { SemanticName = name; SemanticIndex = 0; Format = format; InputSlot = inputSlot; AlignedByteOffset = offset; InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA; InstanceDataStepRate = 0; } }; typedef unsigned short AFIndex; #define AFIndexTypeToDevice DXGI_FORMAT_R16_UINT typedef ComPtr<ID3D11Buffer> IBOID; typedef ComPtr<ID3D11Buffer> VBOID; typedef ComPtr<ID3D11Buffer> UBOID; typedef ComPtr<ID3D11SamplerState> SAMPLERID; typedef ComPtr<ID3D11ShaderResourceView> SRVID; inline void afSafeDeleteBuffer(ComPtr<ID3D11Buffer>& p) { p.Reset(); } inline void afSafeDeleteSampler(SAMPLERID& p) { p.Reset(); } inline void afSafeDeleteTexture(SRVID& p) { p.Reset(); } #define afSafeDeleteVAO SAFE_DELETE void afWriteBuffer(const IBOID p, const void* buf, int size); void afWriteTexture(SRVID srv, const struct TexDesc& desc, const void* buf); IBOID afCreateIndexBuffer(const AFIndex* indi, int numIndi); IBOID afCreateQuadListIndexBuffer(int numQuads); VBOID afCreateVertexBuffer(int size, const void* buf); VBOID afCreateDynamicVertexBuffer(int size); UBOID afCreateUBO(int size); #define SamplerWrap D3D11_TEXTURE_ADDRESS_MODE #define SW_REPEAT D3D11_TEXTURE_ADDRESS_WRAP #define SW_CLAMP D3D11_TEXTURE_ADDRESS_CLAMP #define SamplerFilter D3D11_FILTER #define SF_POINT D3D11_FILTER_MIN_MAG_MIP_POINT #define SF_LINEAR D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT #define SF_MIPMAP D3D11_FILTER_MIN_MAG_MIP_LINEAR SAMPLERID afCreateSampler(SamplerFilter samplerFilter, SamplerWrap wrap); void afBindBufferToBindingPoint(UBOID ubo, UINT uniformBlockBinding); void afBindTextureToBindingPoint(SRVID srv, UINT textureBindingPoint); #define afBindCubeMapToBindingPoint afBindTextureToBindingPoint void afBindSamplerToBindingPoint(SAMPLERID sampler, UINT textureBindingPoint); void afDrawIndexedTriangleStrip(int numIndices, int start = 0); void afDrawIndexedTriangleList(int numIndices, int start = 0); void afDrawTriangleStrip(int numVertices, int start = 0); void afDrawLineList(int numVertices, int start = 0); void afDrawIndexedInstancedTriangleList(int instanceCount, int numIndices, int start = 0); enum CullMode { CM_DISABLE, CM_CW, CM_CCW, }; void afCullMode(CullMode cullMode); enum BlendMode { BM_NONE, BM_ALPHA, }; void afBlendMode(BlendMode mode); enum DepthStencilMode { DSM_DISABLE, DSM_DEPTH_ENABLE, DSM_DEPTH_CLOSEREQUAL_READONLY, }; void afDepthStencilMode(DepthStencilMode mode); typedef D3D11_SUBRESOURCE_DATA AFTexSubresourceData; typedef DXGI_FORMAT AFDTFormat; #define AFDT_INVALID DXGI_FORMAT_UNKNOWN #define AFDT_R8G8B8A8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM #define AFDT_R5G6B5_UINT DXGI_FORMAT_B5G6R5_UNORM #define AFDT_R32G32B32A32_FLOAT DXGI_FORMAT_R32G32B32A32_FLOAT #define AFDT_R16G16B16A16_FLOAT DXGI_FORMAT_R16G16B16A16_FLOAT #define AFDT_DEPTH DXGI_FORMAT_D24_UNORM_S8_UINT #define AFDT_DEPTH_STENCIL DXGI_FORMAT_D24_UNORM_S8_UINT #define AFDT_BC1_UNORM DXGI_FORMAT_BC1_UNORM #define AFDT_BC2_UNORM DXGI_FORMAT_BC2_UNORM #define AFDT_BC3_UNORM DXGI_FORMAT_BC3_UNORM SRVID afCreateTexture2D(AFDTFormat format, const IVec2& size, void *image); SRVID afCreateTexture2D(AFDTFormat format, const struct TexDesc& desc, int mipCount, const AFTexSubresourceData datas[]); SRVID afCreateDynamicTexture(AFDTFormat format, const IVec2& size); IVec2 afGetTextureSize(SRVID tex); class AFRenderTarget { IVec2 texSize; ID3D11RenderTargetView* renderTargetView = nullptr; ID3D11ShaderResourceView* shaderResourceView = nullptr; ID3D11UnorderedAccessView* unorderedAccessView = nullptr; ID3D11DepthStencilView* depthStencilView = nullptr; public: ~AFRenderTarget() { Destroy(); } void InitForDefaultRenderTarget(); void Init(IVec2 size, AFDTFormat colorFormat, AFDTFormat depthStencilFormat = AFDT_INVALID); void Destroy(); void BeginRenderToThis(); ID3D11ShaderResourceView* GetTexture() { return shaderResourceView; } ID3D11UnorderedAccessView* GetUnorderedAccessView() { return unorderedAccessView; } };
// The MIT License (MIT) // Copyright (c) 2013 lailongwei<lailongwei@126.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __PYLLBC_COM_PACK_LEMMA_TOP_H__ #define __PYLLBC_COM_PACK_LEMMA_TOP_H__ #include "pyllbc/common/LibHeader.h" #include "pyllbc/common/PackLemma.h" /** * \brief The top type pack-lemma class encapsulation. */ class LLBC_HIDDEN pyllbc_PackLemma_Top : public pyllbc_PackLemma { typedef pyllbc_PackLemma Base; public: /** * Constructor & Destructor. */ pyllbc_PackLemma_Top(PyObject *compileEnv = nullptr); virtual ~pyllbc_PackLemma_Top(); public: /** * Get lemma type, see Type enumeration. * @return Type - the lemma type enumeration. */ virtual Type GetType() const; /** * Get lemma current state, see State enumeration. * @return State - the lemma state enumeration. */ virtual State GetState() const; /** * Check lemma is serializable(Readable & Writable) or not. * @return bool - return true f serializable, otherwise return false. */ virtual bool IsSerializable() const; /** * Check lemma is parse done or not. * @return bool - return - true if done, otherwise not done or maybe error occurred. */ virtual bool IsDone() const; /** * Process character sequence. * @param[in] ch - the character symbol. * @param[in] nextCh - the next character symbol(can use it to reference). * @return int - return 0 if success, otherwise return -1. */ virtual int Process(Symbol ch, Symbol nextCh = Base::InvalidSymbol); /** * Process lemma. * @param[in] lemma - the lemma. * @return int - return 0 if success, otherwise return -1. */ virtual int Process(Base *lemma); /** * Read data from pystream according lemma format. * @param[in] stream - the pystream. * @return PyObject * - the readed python layer object, new reference, if error occurred return nullptr. */ virtual PyObject *Read(pyllbc_Stream *stream); /** * rite python layer data to given string according lemma format. * @param[in] stream - the pystream. * @param[in] values - the python layer values, must be tuple or None, if error occurred return nullptr. */ virtual int Write(pyllbc_Stream *stream, PyObject *values); private: std::vector<Base *> _lemmas; }; #endif // !__PYLLBC_COM_PACK_LEMMA_TOP_H__
// // ProxyViewController.h // NSLockTest // // Created by yixiaoluo on 15/3/3. // Copyright (c) 2015年 cn.gikoo. All rights reserved. // #import <UIKit/UIKit.h> @interface ProxyTest : UIViewController @end @interface TestProxy : NSProxy - (instancetype)init; - (void)method1; @end
// // ViewController.h // MMAllInPaySDK // // Created by LongXiTechhnology on 15/11/10. // Copyright © 2015年 LongXiTechhnology. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
/* LUFA Library Copyright (C) Dean Camera, 2012. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim 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, 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. */ /** \file * * \brief LUFA library version constants. * * Version constants for informational purposes and version-specific macro creation. This header file contains the * current LUFA version number in several forms, for use in the user-application (for example, for printing out * whilst debugging, or for testing for version compatibility). */ #ifndef __LUFA_VERSION_H__ #define __LUFA_VERSION_H__ /* Public Interface - May be used in end-application: */ /* Macros: */ /** Indicates the version number of the library, as an integer. */ #define LUFA_VERSION_INTEGER 0x000000 /** Indicates the version number of the library, as a string. */ #define LUFA_VERSION_STRING "000000" #endif
#ifndef BOMBA_H #define BOMBA_H #include "inimigo.h" class Bomba : public Inimigo { protected: int lvl; public: Bomba(int lvl, Sprite* textura); }; #endif
// // SearchTableCell.h // Listen // // Created by Dai Hovey on 12/09/2013. // Copyright (c) 2013 14lox. All rights reserved. // #import <UIKit/UIKit.h> typedef enum { TrackCellType = 0, AlbumHeaderCellType = 1, AlbumAllCellType = 2, AlbumTrackCellType = 3, } CellType; @class SearchTableCell; @protocol SearchCellAddSongProtocol <NSObject> -(void) songAddedWithCell:(SearchTableCell*)cell; @end @interface SearchTableCell : UITableViewCell @property (nonatomic, strong) UIScrollView *textScrollView; @property (nonatomic, strong) UILabel *songLabel; @property (nonatomic, strong) UILabel *artistAlbumLabel; @property (nonatomic, strong) NSString *albumNumberString; @property (nonatomic) BOOL isAdded; @property (nonatomic) BOOL isCloud; @property (nonatomic, weak) id <SearchCellAddSongProtocol> delegate; @property (nonatomic) CellType cellType; @property (nonatomic, strong) UILabel *albumNumberLabel; -(void) cellTapped; @end
#include <stdio.h> #include "test_file.h" int main(int argc, const char * argv[]) { int status = test_file() ? 0 : 1; fprintf(stdout, "File Test: %s\n", ( status ? "failed" : "passed" ) ); return status; }
#ifndef __CC_PLATFORM_CONFIG_H__ #define __CC_PLATFORM_CONFIG_H__ /** Config of CrossApp project, per target platform. */ ////////////////////////////////////////////////////////////////////////// // pre configure ////////////////////////////////////////////////////////////////////////// // define supported target platform macro which CC uses. #define CC_PLATFORM_UNKNOWN 0 #define CC_PLATFORM_IOS 1 #define CC_PLATFORM_ANDROID 2 #define CC_PLATFORM_WIN32 3 #define CC_PLATFORM_LINUX 5 #define CC_PLATFORM_BADA 6 #define CC_PLATFORM_MAC 8 #define CC_PLATFORM_EMSCRIPTEN 10 #define CC_PLATFORM_WINRT 12 #define CC_PLATFORM_WP8 13 // Determine target platform by compile environment macro. #define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN // mac #if defined(CC_TARGET_OS_MAC) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_MAC #endif // iphone #if defined(CC_TARGET_OS_IPHONE) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_IOS #endif // android #if defined(ANDROID) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_ANDROID #endif // WinRT (Windows Store App) #if defined(WINRT) && defined(_WINRT) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_WINRT #endif // WP8 (Windows Phone 8 App) #if defined(WP8) && defined(_WP8) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_WP8 #endif // win32 #if defined(WIN32) && defined(_WINDOWS) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_WIN32 #endif // linux #if defined(LINUX) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_LINUX #endif // marmalade #if defined(MARMALADE) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_MARMALADE #endif // bada #if defined(SHP) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_BADA #endif // qnx #if defined(__QNX__) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_BLACKBERRY #endif // native client #if defined(__native_client__) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_NACL #endif // Emscripten #if defined(EMSCRIPTEN) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_EMSCRIPTEN #endif // tizen #if defined(TIZEN) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_TIZEN #endif ////////////////////////////////////////////////////////////////////////// // post configure ////////////////////////////////////////////////////////////////////////// // check user set platform #if ! CC_TARGET_PLATFORM #error "Cannot recognize the target platform; are you targeting an unsupported platform?" #endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #pragma warning (disable:4127) #endif // CC_PLATFORM_WIN32 #endif // __CC_PLATFORM_CONFIG_H__
#include <stdio.h> #include <stdlib.h> int main() { int numa, numb, numc, num1, num2, num3; printf("Ingrese un numero: "); scanf("%d", &num1); printf("Ingrese otro numero: "); scanf("%d", &num2); printf("Ingrese un ultimo numero: "); scanf("%d", &num3); if(num1 < num2){ if(num2 < num3) numa = num1; else if(num3 < num1) numa = num3; else numa = num1; } else{ if(num1 < num3) numa = num2; else{ if(num2 < num3) numa = num2; else numa = num3; } } if(numa == num1){ if(num2 < num3) numb = num2; else numb = num3; } else if(numa == num2){ if(num1 < num3) numb = num1; else numb == num3; } else if(numa == num3){ if(num1 < num2) numb = num1; else numb = num2; } if(numa == num1){ if(numb == num2) numc = num3; else numc = num2; } else if(numa == num2){ if(numb == num1) numc = num3; else numc = num1; } else if(numa == num3){ if(numb == num1) numc = num2; else numc = num1; } printf("Los numeros ingresados en orden creciente son: %d, %d y %d", numa, numb, numc); return 0; }
/** * This header is generated by class-dump-z 0.2a. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. * * Source: (null) */ #import "NSObject.h" @protocol AWSMobileAnalyticsEventStore <NSObject> - (id)iterator; - (BOOL)put:(id)put withError:(id*)error; @end
// // NSMutableDictionary+OGCollectionExtensions.h // // Created by Jesper <jesper@orangegroove.net> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. // @import Foundation; #import "OGCollectionExtensionsCommon.h" #import "OGCollectionExtensionsSafeMutation.h" @interface NSMutableDictionary (OGCollectionExtensions) <OGCollectionExtensionsKeyedSafeMutation> @end
#pragma once #include <unordered_map> #include <glm/glm.hpp> namespace Bengine { // Input manager stores a key map that maps SDL_Keys to booleans. // If the value in the key map is true, then the key is pressed. // Otherwise, it is released. class InputManager { public: InputManager(); ~InputManager(); void update(); void pressKey(unsigned int keyID); void releaseKey(unsigned int keyID); void setMouseCoords(float x, float y); // Returns true if the key is held down bool isKeyDown(unsigned int keyID); // Returns true if the key was just pressed bool isKeyPressed(unsigned int keyID); //getters glm::vec2 getMouseCoords() const { return _mouseCoords; } private: // Returns true if the key is held down bool wasKeyDown(unsigned int keyID); std::unordered_map<unsigned int, bool> _keyMap; std::unordered_map<unsigned int, bool> _previousKeyMap; glm::vec2 _mouseCoords; }; }
// // NSString+CZBase64.h // // Created by itcast on 16/6/7. // Copyright © 2016年 itcast. All rights reserved. // #import <Foundation/Foundation.h> @interface NSString (CZBase64) /// 对当前字符串进行 BASE 64 编码,并且返回结果 - (NSString *)cz_base64Encode; /// 对当前字符串进行 BASE 64 解码,并且返回结果 - (NSString *)cz_base64Decode; @end
// // ItemsModel.h // 108tian // // Created by SUN on 15-7-13. // Copyright (c) 2015年 www.sun.com. All rights reserved. // #import <Foundation/Foundation.h> @interface ItemsModel : NSObject @property (nonatomic,strong) NSString *desc; @property (nonatomic,strong) NSString *img; @property (nonatomic,strong) NSString *label; @property (nonatomic,strong) NSString *name; @property (nonatomic,strong) NSString *been; @property (nonatomic,strong) NSString *fav; @property (nonatomic,strong) NSString *idd; @property (nonatomic,strong) NSString *type; @end
// // BRAOpenXmlElement.h // BRAXlsxReaderWriter // // Created by René BIGOT on 05/10/2014. // Copyright (c) 2014 René Bigot. All rights reserved. // #import <Foundation/Foundation.h> @interface BRAOpenXmlElement : NSObject { NSString *_xmlRepresentation; NSData *_dataRepresentation; } @property (nonatomic, strong) NSString *target; @property (nonatomic, strong) NSString *parentDirectory; @property (nonatomic, strong) NSString *xmlRepresentation; @property (nonatomic, strong) NSData *dataRepresentation; - (instancetype)initWithContentsOfTarget:(NSString *)target inParentDirectory:(NSString *)parentDirectory; - (instancetype)initWithTarget:(NSString *)target inParentDirectory:(NSString *)parentDirectory; - (void)loadXmlContents; - (void)save; @end
#pragma once #include <Windows.h> #include <Shobjidl.h> #include <Commdlg.h> #include <memory> #include "OpenFileDlg.h" /** * Datei-Öffnen Dialog im Windows XP Style */ class XpOpenFileDlg : public OpenFileDlg { public: XpOpenFileDlg(void); virtual ~XpOpenFileDlg(void); HRESULT SetAllowMultiSelect(bool bAllow); HRESULT SetPathAndFileMustExist(bool bMustExist); HRESULT SetFileTypes(const std::vector<COMDLG_FILTERSPEC>& filterSpec); HRESULT SetTitle(const std::wstring& title); HRESULT Show(HWND hwndOwner); virtual std::vector<std::wstring> GetResults() override; HRESULT SetDefaultExtension(const std::wstring& extension) { return E_NOTIMPL; } private: OPENFILENAME options; std::unique_ptr<wchar_t[]> filterBuf; std::unique_ptr<wchar_t[]> filenameBuf; std::wstring dlgTitle; private: XpOpenFileDlg(const XpOpenFileDlg&); XpOpenFileDlg& operator=(const XpOpenFileDlg&); };
// // Copyright (c) 2014-2015 Lyst Engineering. Some rights reserved. MIT Licence. // #import <UIKit/UIKit.h> @interface UILabel (LYAttributedLabel) @property (nonatomic, assign, readwrite) NSLineBreakMode LYLineBreakMode UI_APPEARANCE_SELECTOR; @property (nonatomic, assign, readwrite) NSTextAlignment LYTextAlignment UI_APPEARANCE_SELECTOR; // The distance in points between the bottom of one line fragment and the top of the next. //This value is always nonnegative. This value is included in the line fragment heights in the layout manager. @property (nonatomic, assign, readwrite) CGFloat LYLineSpacing UI_APPEARANCE_SELECTOR; -(void)setAttributedTextUsingString:(NSString *)string; -(void)setAttributedTextUsingString:(NSString *)string apparance:(id)appearance; @property (nonatomic, assign, readwrite) BOOL LYStrikeOut UI_APPEARANCE_SELECTOR; @end
//----------------------------------------------------------------------------------- // The confidential and proprietary information contained in this file may // only be used by a person authorised under and to the extent permitted // by a subsisting licensing agreement from ARM Limited or its affiliates // or between you and a party authorised by ARM // // (C) COPYRIGHT [2016] ARM Limited or its affiliates // ALL RIGHT RESERVED // // This entire notice must be reproduced on all copies of this file // and copies of this files may only be made by a person if such person is // permitted to do so under the terms of a subsisting license agreement // from ARM Limited or its affiliates or between you and a party authorised by ARM //----------------------------------------------------------------------------------- #ifndef _SSI_PAL_INIT_H #define _SSI_PAL_INIT_H #include "ssi_pal_types.h" #ifdef __cplusplus extern "C" { #endif /*! @file @brief This file contains the PAL layer entry point, it includes the definitions and APIs for PAL initialization and termination. */ /** * @brief This function Performs all initializations that may be required by the customer's PAL implementation, specifically by the DMA-able buffer * scheme. The existing implementation allocates a contiguous memory pool that is later used by the ARM TrustZone CryptoCell TEE implementation. * In case no initializations are needed in the customer's environment, the function can be minimized to return OK. * It is called by ::SaSi_LibInit. * * @return A non-zero value in case of failure. */ int SaSi_PalInit(void); /** * @brief This function is used to terminate the PAL implementation and free the resources that were taken by ::SaSi_PalInit. * * @return Void. */ void SaSi_PalTerminate(void); #ifdef __cplusplus } #endif #endif
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #ifndef IOTHUB_TRANSPORT_LL_H #define IOTHUB_TRANSPORT_LL_H #include "doublylinkedlist.h" #include "iothub_message.h" #include "iothub_client_ll.h" #ifdef __cplusplus extern "C" { #endif typedef void* TRANSPORT_LL_HANDLE; typedef void* IOTHUB_DEVICE_HANDLE; typedef IOTHUB_CLIENT_RESULT(*pfIoTHubTransport_SetOption)(TRANSPORT_LL_HANDLE handle, const char *optionName, const void* value); typedef TRANSPORT_LL_HANDLE(*pfIoTHubTransport_Create)(const IOTHUBTRANSPORT_CONFIG* config); typedef void (*pfIoTHubTransport_Destroy)(TRANSPORT_LL_HANDLE handle); typedef IOTHUB_DEVICE_HANDLE(*pfIotHubTransport_Register)(TRANSPORT_LL_HANDLE handle, const char* deviceId, const char* deviceKey, IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, PDLIST_ENTRY waitingToSend); typedef void(*pfIotHubTransport_Unregister)(IOTHUB_DEVICE_HANDLE deviceHandle); typedef int (*pfIoTHubTransport_Subscribe)(IOTHUB_DEVICE_HANDLE handle); typedef void (*pfIoTHubTransport_Unsubscribe)(IOTHUB_DEVICE_HANDLE handle); typedef void (*pfIoTHubTransport_DoWork)(TRANSPORT_LL_HANDLE handle, IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle); typedef IOTHUB_CLIENT_RESULT(*pfIoTHubTransport_GetSendStatus)(IOTHUB_DEVICE_HANDLE handle, IOTHUB_CLIENT_STATUS *iotHubClientStatus); #define TRANSPORT_PROVIDER_FIELDS \ pfIoTHubTransport_SetOption IoTHubTransport_SetOption; \ pfIoTHubTransport_Create IoTHubTransport_Create; \ pfIoTHubTransport_Destroy IoTHubTransport_Destroy; \ pfIotHubTransport_Register IoTHubTransport_Register; \ pfIotHubTransport_Unregister IoTHubTransport_Unregister; \ pfIoTHubTransport_Subscribe IoTHubTransport_Subscribe; \ pfIoTHubTransport_Unsubscribe IoTHubTransport_Unsubscribe; \ pfIoTHubTransport_DoWork IoTHubTransport_DoWork; \ pfIoTHubTransport_GetSendStatus IoTHubTransport_GetSendStatus /*there's an intentional missing ; on this line*/ \ typedef struct TRANSPORT_PROVIDER_TAG { TRANSPORT_PROVIDER_FIELDS; }TRANSPORT_PROVIDER; #ifdef __cplusplus } #endif #endif /* IOTHUB_TRANSPORT_LL_H */
#import <Foundation/Foundation.h> @interface NSObject (Swizzling) - (void)nc_instanceSwizzleSelector:(SEL)swizzledSelector originalSelector:(SEL)originalSelector; + (void)nc_classSwizzleSelector:(SEL)swizzledSelector originalSelector:(SEL)originalSelector; @end
//.............................................................................. // // This file is part of the AXL library. // // AXL is distributed under the MIT license. // For details see accompanying license.txt file, // the public copy of which is also available at: // http://tibbo.com/downloads/archive/axl/license.txt // //.............................................................................. #pragma once namespace axl { namespace dox { class Block; //.............................................................................. struct Host { virtual Block* findItemBlock(handle_t item) = 0; virtual Block* getItemBlock(handle_t item) = 0; virtual void setItemBlock( handle_t item, Block* block ) = 0; virtual sl::String createItemRefId(handle_t item) = 0; virtual sl::StringRef getItemCompoundElementName(handle_t item) = 0; // empty / innerclass / innernamespace virtual handle_t findItem( const sl::StringRef& name, size_t overloadIdx ) = 0; virtual handle_t getCurrentNamespace() = 0; virtual bool generateGlobalNamespaceDocumentation( const sl::StringRef& outputDir, sl::String* itemXml, sl::String* indexXml ) = 0; // return true if param was used virtual bool processCustomCommand( const sl::StringRef& command, const sl::StringRef& param, BlockData* block ) { return false; } }; //.............................................................................. } // namespace dox } // namespace axl
// // PTLCompositeDatasource+CollectionView.h // PTLDatasource // // Created by Brian Partridge on 8/25/13. // // #import "PTLCompositeDatasource.h" #import "PTLDatasource+CollectionView.h" @interface PTLCompositeDatasource (CollectionView) @end
// // SendInviteCell.h // MackNotas // // Created by Caio Remedio on 12/05/15. // Copyright (c) 2015 Caio Remedio. All rights reserved. // #import <UIKit/UIKit.h> @interface SendInviteCell : UITableViewCell @property (strong, nonatomic) IBOutlet UILabel *lblTitle; - (void)loadWithTitle:(NSString *)title; - (void)enableCell:(BOOL)shouldEnable; @end
#include <stdio.h> #include <stdlib.h> #include "pid.h" float pid_update (pid_controler_t *pid, float error) { float pTerm, iTerm, dTerm; //proportional term pTerm = pid->pGain * error; //integral term pid->iState += error; if (pid->iState > pid->iMax) pid->iState = pid->iMax; else if (pid->iState < pid->iMin) pid->iState = pid->iMin; iTerm = pid->iGain*pid->iState; //differential term dTerm = pid->dGain*(error - pid->dState); pid->dState = error; return pTerm + iTerm - dTerm; } void pid_init (pid_controler_t* pid, float pGain, float iGain, float dGain, float iMax, float iMin) { pid->pGain = pGain; pid->iGain = iGain; pid->dGain = dGain; pid->iMax = iMax; pid->iMin = iMin; pid->dState = 0; pid->iState = 0; }
/* rsa_asn1.c */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 2000. */ /* ==================================================================== * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/rsa.h> #include <openssl/x509.h> #include <openssl/asn1t.h> /* Override the default free and new methods */ static int rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { if (operation == ASN1_OP_NEW_PRE) { *pval = (ASN1_VALUE *)RSA_new(); if (*pval) return 2; return 0; } else if (operation == ASN1_OP_FREE_PRE) { RSA_free((RSA *)*pval); *pval = NULL; return 2; } return 1; } ASN1_SEQUENCE_cb(RSAPrivateKey, rsa_cb) = { ASN1_SIMPLE(RSA, version, LONG), ASN1_SIMPLE(RSA, n, BIGNUM), ASN1_SIMPLE(RSA, e, BIGNUM), ASN1_SIMPLE(RSA, d, CBIGNUM), ASN1_SIMPLE(RSA, p, CBIGNUM), ASN1_SIMPLE(RSA, q, CBIGNUM), ASN1_SIMPLE(RSA, dmp1, CBIGNUM), ASN1_SIMPLE(RSA, dmq1, CBIGNUM), ASN1_SIMPLE(RSA, iqmp, CBIGNUM) } ASN1_SEQUENCE_END_cb(RSA, RSAPrivateKey) ASN1_SEQUENCE_cb(RSAPublicKey, rsa_cb) = { ASN1_SIMPLE(RSA, n, BIGNUM), ASN1_SIMPLE(RSA, e, BIGNUM), } ASN1_SEQUENCE_END_cb(RSA, RSAPublicKey) ASN1_SEQUENCE(RSA_PSS_PARAMS) = { ASN1_EXP_OPT(RSA_PSS_PARAMS, hashAlgorithm, X509_ALGOR,0), ASN1_EXP_OPT(RSA_PSS_PARAMS, maskGenAlgorithm, X509_ALGOR,1), ASN1_EXP_OPT(RSA_PSS_PARAMS, saltLength, ASN1_INTEGER,2), ASN1_EXP_OPT(RSA_PSS_PARAMS, trailerField, ASN1_INTEGER,3) } ASN1_SEQUENCE_END(RSA_PSS_PARAMS) IMPLEMENT_ASN1_FUNCTIONS(RSA_PSS_PARAMS) ASN1_SEQUENCE(RSA_OAEP_PARAMS) = { ASN1_EXP_OPT(RSA_OAEP_PARAMS, hashFunc, X509_ALGOR, 0), ASN1_EXP_OPT(RSA_OAEP_PARAMS, maskGenFunc, X509_ALGOR, 1), ASN1_EXP_OPT(RSA_OAEP_PARAMS, pSourceFunc, X509_ALGOR, 2), } ASN1_SEQUENCE_END(RSA_OAEP_PARAMS) IMPLEMENT_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(RSA, RSAPrivateKey, RSAPrivateKey) IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(RSA, RSAPublicKey, RSAPublicKey) RSA *RSAPublicKey_dup(RSA *rsa) { return ASN1_item_dup(ASN1_ITEM_rptr(RSAPublicKey), rsa); } RSA *RSAPrivateKey_dup(RSA *rsa) { return ASN1_item_dup(ASN1_ITEM_rptr(RSAPrivateKey), rsa); }
/* Generated from rtt_rosnode/src/msg_Types.hpp.in */ #ifndef __OROCOS_ROS_GENERATED_motion_control_msgs_JointVelocities_TYPES_HPP #define __OROCOS_ROS_GENERATED_motion_control_msgs_JointVelocities_TYPES_HPP // note: we preferably would include the message header instead of the boost stuff. #include <motion_control_msgs/boost/JointVelocities.h> // All these classes were generated in the typekit library: #ifdef CORELIB_DATASOURCE_HPP extern template class RTT::internal::DataSourceTypeInfo< motion_control_msgs::JointVelocities >; extern template class RTT::internal::DataSource< motion_control_msgs::JointVelocities >; extern template class RTT::internal::AssignableDataSource< motion_control_msgs::JointVelocities >; extern template class RTT::internal::AssignCommand< motion_control_msgs::JointVelocities >; #endif #ifdef ORO_CORELIB_DATASOURCES_HPP extern template class RTT::internal::ValueDataSource< motion_control_msgs::JointVelocities >; extern template class RTT::internal::ConstantDataSource< motion_control_msgs::JointVelocities >; extern template class RTT::internal::ReferenceDataSource< motion_control_msgs::JointVelocities >; #endif #ifdef ORO_OUTPUT_PORT_HPP extern template class RTT::OutputPort< motion_control_msgs::JointVelocities >; #endif #ifdef ORO_INPUT_PORT_HPP extern template class RTT::InputPort< motion_control_msgs::JointVelocities >; #endif #ifdef ORO_PROPERTY_HPP extern template class RTT::Property< motion_control_msgs::JointVelocities >; #endif #ifdef ORO_CORELIB_ATTRIBUTE_HPP extern template class RTT::Attribute< motion_control_msgs::JointVelocities >; extern template class RTT::Constant< motion_control_msgs::JointVelocities >; #endif #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 ELECTRON_SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_ #define ELECTRON_SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_ #include <string> #include "base/compiler_specific.h" #include "extensions/common/extensions_client.h" #include "url/gurl.h" namespace extensions { class APIPermissionSet; class Extension; class PermissionMessageProvider; class PermissionIDSet; class URLPatternSet; } // namespace extensions namespace electron { // The app_shell implementation of ExtensionsClient. class ElectronExtensionsClient : public extensions::ExtensionsClient { public: using ScriptingAllowlist = extensions::ExtensionsClient::ScriptingAllowlist; ElectronExtensionsClient(); ~ElectronExtensionsClient() override; // disable copy ElectronExtensionsClient(const ElectronExtensionsClient&) = delete; ElectronExtensionsClient& operator=(const ElectronExtensionsClient&) = delete; // ExtensionsClient overrides: void Initialize() override; void InitializeWebStoreUrls(base::CommandLine* command_line) override; const extensions::PermissionMessageProvider& GetPermissionMessageProvider() const override; const std::string GetProductName() override; void FilterHostPermissions( const extensions::URLPatternSet& hosts, extensions::URLPatternSet* new_hosts, extensions::PermissionIDSet* permissions) const override; void SetScriptingAllowlist(const ScriptingAllowlist& allowlist) override; const ScriptingAllowlist& GetScriptingAllowlist() const override; extensions::URLPatternSet GetPermittedChromeSchemeHosts( const extensions::Extension* extension, const extensions::APIPermissionSet& api_permissions) const override; bool IsScriptableURL(const GURL& url, std::string* error) const override; const GURL& GetWebstoreBaseURL() const override; const GURL& GetWebstoreUpdateURL() const override; bool IsBlocklistUpdateURL(const GURL& url) const override; private: ScriptingAllowlist scripting_allowlist_; const GURL webstore_base_url_; const GURL webstore_update_url_; }; } // namespace electron #endif // ELECTRON_SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
#include "module.h" #include "lauxlib.h" #include "platform.h" #include <stdlib.h> #include <string.h> static const uint32_t bmp085_i2c_id = 0; static const uint8_t bmp085_i2c_addr = 0x77; static struct { int16_t AC1; int16_t AC2; int16_t AC3; uint16_t AC4; uint16_t AC5; uint16_t AC6; int16_t B1; int16_t B2; int16_t MB; int16_t MC; int16_t MD; } bmp085_data; static uint8_t r8u(uint32_t id, uint8_t reg) { uint8_t ret; platform_i2c_send_start(id); platform_i2c_send_address(id, bmp085_i2c_addr, PLATFORM_I2C_DIRECTION_TRANSMITTER); platform_i2c_send_byte(id, reg); platform_i2c_send_stop(id); platform_i2c_send_start(id); platform_i2c_send_address(id, bmp085_i2c_addr, PLATFORM_I2C_DIRECTION_RECEIVER); ret = platform_i2c_recv_byte(id, 0); platform_i2c_send_stop(id); return ret; } static uint16_t r16u(uint32_t id, uint8_t reg) { uint8_t high = r8u(id, reg); uint8_t low = r8u(id, reg + 1); return (high << 8) | low; } static int16_t r16(uint32_t id, uint8_t reg) { return (int16_t) r16u(id, reg); } static int bmp085_setup(lua_State* L) { (void)L; bmp085_data.AC1 = r16(bmp085_i2c_id, 0xAA); bmp085_data.AC2 = r16(bmp085_i2c_id, 0xAC); bmp085_data.AC3 = r16(bmp085_i2c_id, 0xAE); bmp085_data.AC4 = r16u(bmp085_i2c_id, 0xB0); bmp085_data.AC5 = r16u(bmp085_i2c_id, 0xB2); bmp085_data.AC6 = r16u(bmp085_i2c_id, 0xB4); bmp085_data.B1 = r16(bmp085_i2c_id, 0xB6); bmp085_data.B2 = r16(bmp085_i2c_id, 0xB8); bmp085_data.MB = r16(bmp085_i2c_id, 0xBA); bmp085_data.MC = r16(bmp085_i2c_id, 0xBC); bmp085_data.MD = r16(bmp085_i2c_id, 0xBE); return 0; } static uint32_t bmp085_temperature_raw_b5(void) { int16_t t, X1, X2; platform_i2c_send_start(bmp085_i2c_id); platform_i2c_send_address(bmp085_i2c_id, bmp085_i2c_addr, PLATFORM_I2C_DIRECTION_TRANSMITTER); platform_i2c_send_byte(bmp085_i2c_id, 0xF4); platform_i2c_send_byte(bmp085_i2c_id, 0x2E); platform_i2c_send_stop(bmp085_i2c_id); // Wait for device to complete sampling os_delay_us(4500); t = r16(bmp085_i2c_id, 0xF6); X1 = ((t - bmp085_data.AC6) * bmp085_data.AC5) >> 15; X2 = (bmp085_data.MC << 11)/ (X1 + bmp085_data.MD); return X1 + X2; } static int16_t bmp085_temperature(void) { return (bmp085_temperature_raw_b5() + 8) >> 4; } static int bmp085_lua_temperature(lua_State* L) { lua_pushinteger(L, bmp085_temperature()); return 1; } static int32_t bmp085_pressure_raw(int oss) { int32_t p; int32_t p1, p2, p3; platform_i2c_send_start(bmp085_i2c_id); platform_i2c_send_address(bmp085_i2c_id, bmp085_i2c_addr, PLATFORM_I2C_DIRECTION_TRANSMITTER); platform_i2c_send_byte(bmp085_i2c_id, 0xF4); platform_i2c_send_byte(bmp085_i2c_id, 0x34 + 64 * oss); platform_i2c_send_stop(bmp085_i2c_id); // Wait for device to complete sampling switch (oss) { case 0: os_delay_us( 4500); break; case 1: os_delay_us( 7500); break; case 2: os_delay_us(13500); break; case 3: os_delay_us(25500); break; } p1 = r8u(bmp085_i2c_id, 0xF6); p2 = r8u(bmp085_i2c_id, 0xF7); p3 = r8u(bmp085_i2c_id, 0xF8); p = (p1 << 16) | (p2 << 8) | p3; p = p >> (8 - oss); return p; } static int bmp085_lua_pressure_raw(lua_State* L) { uint8_t oss = 0; int32_t p; if (lua_isnumber(L, 1)) { oss = luaL_checkinteger(L, 1); if (oss > 3) { oss = 3; } } p = bmp085_pressure_raw(oss); lua_pushinteger(L, p); return 1; } static int bmp085_lua_pressure(lua_State* L) { uint8_t oss = 0; int32_t p; int32_t X1, X2, X3, B3, B4, B5, B6, B7; if (lua_isnumber(L, 1)) { oss = luaL_checkinteger(L, 1); if (oss > 3) { oss = 3; } } p = bmp085_pressure_raw(oss); B5 = bmp085_temperature_raw_b5(); B6 = B5 - 4000; X1 = ((int32_t)bmp085_data.B2 * ((B6 * B6) >> 12)) >> 11; X2 = ((int32_t)bmp085_data.AC2 * B6) >> 11; X3 = X1 + X2; B3 = ((((int32_t)bmp085_data.AC1 << 2) + X3) * (1 << oss) + 2) >> 2; X1 = ((int32_t)bmp085_data.AC3 * B6) >> 13; X2 = ((int32_t)bmp085_data.B1 * ((B6 * B6) >> 12)) >> 16; X3 = (X1 + X2 + 2) >> 2; B4 = ((int32_t)bmp085_data.AC4 * (X3 + 32768)) >> 15; B7 = (p - B3) * (50000 / (1 << oss)); p = (B7 / B4) << 1; X1 = (p >> 8) * (p >> 8); X1 = (X1 * 3038) >> 16; X2 = (-7357 * p) >> 16; p = p + ((X1 + X2 + 3791) >> 4); lua_pushinteger(L, p); return 1; } LROT_BEGIN(bmp085) LROT_FUNCENTRY( temperature, bmp085_lua_temperature ) LROT_FUNCENTRY( pressure, bmp085_lua_pressure ) LROT_FUNCENTRY( pressure_raw, bmp085_lua_pressure_raw ) LROT_FUNCENTRY( setup, bmp085_setup ) LROT_END( bmp085, NULL, 0 ) NODEMCU_MODULE(BMP085, "bmp085", bmp085, NULL);
#ifndef COMPILER_H #define COMPILER_H #ifdef __cplusplus #include <cstdio> #include <cstdlib> #include <cstring> #define RESTRICT __restrict__ #else #include <stdio.h> #include <stdlib.h> #include <string.h> #define RESTRICT restrict #endif #if (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) #ifdef _OPENMP #define PRAGMA(x) _Pragma(#x) #endif #else #warning Your compiler does not support C99/C++11 _Pragma. #define PRAGMA(x) #endif #if defined(__INTEL_COMPILER) #define ASSUME(a) __assume(a) #define UNROLL_AND_JAM(n) PRAGMA(unroll_and_jam(n)) #else #define ASSUME(a) #define UNROLL_AND_JAM(n) #endif #if defined(__x86_64__) && defined(__GNUC__) && !defined(__INTEL_COMPILER) typedef int64_t __int64; #endif #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define HAS_GNU_EXTENDED_ASM 1 #else #define HAS_GNU_EXTENDED_ASM 0 #endif #ifdef __x86_64__ #include "immintrin.h" #if !(defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1700)) #ifndef _MM_UPCONV_PD_NONE #define _MM_UPCONV_PD_NONE 0 #endif #ifndef _MM_DOWNCONV_PD_NONE #define _MM_DOWNCONV_PD_NONE 0 #endif #ifndef _MM_HINT_NONE #define _MM_HINT_NONE 0 #endif #endif // ICC #endif // __x86_64__ #ifdef __aarch64__ #include <arm_neon.h> #endif // __aarch64__ #ifdef _OPENMP #include <omp.h> #define OMP_PARALLEL_FOR PRAGMA(omp parallel for) #else #define OMP_PARALLEL_FOR static inline int omp_get_thread_num() { return 0; } static inline int omp_get_num_threads() { return 1; } static inline int omp_get_max_threads() { return 1; } static inline double omp_get_wtime() { return 0.0; } #endif #endif /* COMPILER_H */
#include <sstream> #include <string> namespace cods { /// Convert value into a string. template <typename T> std::string convert(const T &val) { std::ostringstream ss; ss << val; return ss.str(); } } // namespace cods
#include <avr/io.h> #include <avr/interrupt.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <util/delay.h> #define F_CPU 1000000UL #define TEMP_NUM 98 #define HIGH_CUT 178 #define LOW_CUT 176 #define MAX_COUNT 16 int serial_putchar(char, FILE *); int serial_getchar(FILE *); static FILE serial_stream = FDEV_SETUP_STREAM (serial_putchar, serial_getchar, _FDEV_SETUP_RW); void init_serial(void); void do_program(void); void init_temp(void); void init_pwm(void); void init_freq(void); void init_interrupts(); void adjust_pwm(unsigned int, unsigned int); unsigned int get_temp(unsigned int); unsigned long get_freq(unsigned int*, unsigned long*); volatile unsigned int global_Counter; /* This is the frequency tracker code running on an AVR */ /* Communicates serially to a computer for displaying information */ /* Handles temperature control and freqency measurement */ int main(void) { init_serial(); init_temp(); init_pwm(); init_freq(); _delay_ms(2000); while(1) { do_program(); } return 0; } ISR(TIMER1_OVF_vect) { global_Counter++; } /* Initializes AVR USART for 1200 baud (assuming 1MHz clock) */ /* 1MHz/(16*(51+1)) = 1202 about 0.2% error */ void init_serial(void) { UBRR0H=0; UBRR0L=12; // 1200 BAUD FOR 1MHZ SYSTEM CLOCK UCSR0A= 1<<U2X0; UCSR0C= (1<<USBS0)|(3<<UCSZ00) ; // 8 BIT NO PARITY 2 STOP UCSR0B=(1<<RXEN0)|(1<<TXEN0) ; //ENABLE TX AND RX ALSO 8 BIT stdin=&serial_stream; stdout=&serial_stream; } /* Program to do */ void do_program(void) { unsigned long freq, periods; //Long for holding the value unsigned int time, temp1, temp2; //Only have two temp sensors fprintf(stdout,"Welcome to the Quartz-Crystal Frequency Tracker \r\n"); _delay_ms(200); while(1) { //fprintf(fp,"Getting temps \r\n"); temp1 = get_temp(1); temp2 = get_temp(2); adjust_pwm((temp1+temp2)/2, 0); freq = get_freq(&time, &periods); fprintf(stdout,"Freq = %ld, temp = %d \r\n", freq, (temp1+temp2)/2 - 30); _delay_ms(500); // For stability } } void init_temp(void) { // All Port C pins to inputs. DDRC = 0; // Make sure the power register lets the ADC run. PRR = 0x00; // Set reference and clock. ADMUX |= (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (0<<MUX2) | (0<<MUX1) | (0<<MUX0); // Free running mode ADCSRA |= (1<<ADEN) | (0<<ADSC) | (0<<ADATE) | (0<<ADIF) | (0<<ADIE) | (1<<ADPS2) | (0<<ADPS1) | (1<<ADPS0); ADCSRB = 0; TIMSK1 |= (1 << TOIE1); TCCR1B |= (1 << CS12) | (1 << CS11) | (1 << CS10); } void init_pwm(void) { // Set all Port D pins to outputs DDRD = 0xFF; // Set pins of 3, 5 and 6 of Port B to output DDRB |= (1 << 3) | (1 << 5) | (1 << 6); // Timer/Counter Zero Init OCR0B = 0xFA; OCR0A = 0xF9; // Timer/Counter Two Init OCR2B = 0xFA; OCR2A = 0xF9; // Inits TCCR0A = 0xB3; TCCR0B = 0x05; TCCR2A = 0xB3; TCCR2B = 0x05; } unsigned int get_temp(unsigned int channel) { unsigned char i = 8; unsigned int temp = 0; // Selecting ADC channel to look at. switch (channel) { case 1: ADMUX = 0x40; break; case 2: ADMUX = 0x41; break; } // Start ADC and wait for it to get 8 values ADCSRA |= (1<<ADSC); while (i--) { while ((ADCSRA & (1 << ADSC)) != 0); temp += ADC; _delay_ms(50); } // Calculate temp temp = temp / 8; return temp; } void adjust_pwm(unsigned int temp, unsigned int channel) { // Stop counters TCCR2B = 0x00; TCCR0B = 0x00; unsigned int temp_temp = (2*temp - TEMP_NUM); if (temp_temp <= LOW_CUT) { // Heat it up OCR2B = 0xFF; OCR2A = 0xFF; OCR0B = 0xFF; OCR0A = 0xFF; } else if (temp_temp >= HIGH_CUT) { // Cool it down OCR2B = 0x00; OCR2A = 0x00; OCR0B = 0x00; OCR0A = 0x00; } else { // Half way, half cold, half hot. OCR2B = 0x7F; OCR2A = 0x7F; OCR0B = 0x7F; OCR0A = 0x7F; } // Start counters TCCR2B = 0x05; TCCR0B = 0x05; } // Initialize frequency counter void init_freq(void) { DDRB &= 0xFE; TCCR1A = 0x00; TCCR1B = 0xC1; TIMSK1 = 0x01; } void init_interrupts(void) { sei(); global_Counter = 0; } void turn_off_interrupts(void) { cli(); } // Counting frequency unsigned long get_freq(unsigned int* period_time, unsigned long* periods) { unsigned long freq; unsigned int time, count; unsigned long period_count = 0; char lock = 0; init_interrupts(); TIFR1 = 0xFF; while((!((TIFR1 >> ICF1) & 0x01))&&(global_Counter < 16)); // Start at zero count TCCR1B = 0xC0; // Timer off global_Counter = 0; TCNT1 = 0x00; TIFR1 = 0xff; // Note: Clears all flags TCCR1B = 0xC1; // Timer on // Stays here until unlocked while (!lock) { // Checks for input capture if ((TIFR1 >> ICF1) & 0x01) { TIFR1 = 0xff; count = global_Counter; // Grab the time time = ICR1L; time = ((ICR1H << 8) & 0xff00) | (time & 0x00ff); period_count++; // If the timer has past a time (after we have an input capture) // Calculate frequency and unlock if ((time >= 32000) || (count != 0)) { // Note: The divide by 52 is a calibration freq = (period_count * 1000000l)/(count*65536 + time + (period_count / 52)); lock = 1; } } // If we've gone too long without an input capture frequency must be zero. if (global_Counter >= 16) { freq = 0; lock = 1; } } turn_off_interrupts(); // Purely for debugging purposes. *period_time = time; *periods = period_count; return freq; } //simplest possible putchar, waits until UDR is empty and puts character int serial_putchar(char val, FILE * fp) { while((UCSR0A&(1<<UDRE0)) == 0); //wait until empty UDR0 = val; return 0; } //simplest possible getchar, waits until a char is available and reads it //note:1) it is a blocking read (will wait forever for a char) //note:2) if multiple characters come in and are not read, they will be lost int serial_getchar(FILE * fp) { while((UCSR0A&(1<<RXC0)) == 0); //WAIT FOR CHAR return UDR0; }
// // MCBorderedButton.h // MCAdditions // // Created by Matthew Cheok on 6/2/14. // Copyright (c) 2014 Matthew Cheok. All rights reserved. // #import <UIKit/UIKit.h> @interface MCBorderedButton : UIButton @property (strong, nonatomic) UIColor *selectedTintColor UI_APPEARANCE_SELECTOR; @end
// // TLTweet.h // Chirp // // Created by Mark Gage on 2017-06-21. // Copyright © 2017 Mark Gage. All rights reserved. // #import <Foundation/Foundation.h> #import "TLUser.h" @interface TLTweet : NSObject<NSCoding> @property (copy, nonatomic) NSString *tweetID; @property (copy, nonatomic) NSString *tweetText; @property (copy, nonatomic) NSString *tweetPostedAt; @property (copy, nonatomic) NSString *retweetCount; @property (copy, nonatomic) NSString *likeCount; @property (strong, nonatomic) NSMutableArray *entityArray; @property (strong, nonatomic) TLUser *postedByUser; @property (assign, nonatomic, getter=isRetweet) BOOL retweet; @property (assign, nonatomic, getter=isFavourited) BOOL favourite; - (void)setDataWith:(NSDictionary *)dictionary; @end
// // BankCardAddDefaultCell.h // TianJiCloud // // Created by 朱鹏 on 2017/8/18. // Copyright © 2017年 TianJiMoney. All rights reserved. // #import "BankCardAddBaseTableCell.h" @interface BankCardAddDefaultCell : BankCardAddBaseTableCell @property (nonatomic,copy) void (^valueChangedBlock)(id sender); @end
// // JSCPrint.h // JSCoreBridge // // Created by iPhuan on 2016/12/5. // Copyright © 2016年 iPhuan. All rights reserved. // #import <Foundation/Foundation.h> @interface JSCPrint : NSObject + (void)print; @end
// // LUConsoleLogEntry.h // // Lunar Unity Mobile Console // https://github.com/SpaceMadness/lunar-unity-console // // Copyright 2015-2021 Alex Lementuev, SpaceMadness. // // 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 <UIKit/UIKit.h> typedef enum : uint8_t { LUConsoleLogTypeError, LUConsoleLogTypeAssert, LUConsoleLogTypeWarning, LUConsoleLogTypeLog, LUConsoleLogTypeException } LUConsoleLogType; typedef uint8_t LUConsoleLogTypeMask; #define LU_CONSOLE_LOG_TYPE_COUNT 5 #define LU_CONSOLE_LOG_TYPE_MASK(TYPE) (1 << (TYPE)) #define LU_IS_CONSOLE_LOG_TYPE_VALID(TYPE) ((TYPE) >= 0 && (TYPE) < LU_CONSOLE_LOG_TYPE_COUNT) #define LU_IS_CONSOLE_LOG_TYPE_ERROR(TYPE) ((TYPE) == LUConsoleLogTypeException || \ (TYPE) == LUConsoleLogTypeError || \ (TYPE) == LUConsoleLogTypeAssert) @class LULogMessage; @interface LUConsoleLogEntry : NSObject @property (nonatomic, readonly) LUConsoleLogType type; @property (nonatomic, readonly) LULogMessage * message; @property (nonatomic, readonly) NSString * stackTrace; @property (nonatomic, readonly) UIImage * icon; @property (nonatomic, readonly) BOOL hasStackTrace; + (instancetype)entryWithType:(LUConsoleLogType)type message:(LULogMessage *)message stackTrace:(NSString *)stackTrace; - (instancetype)initWithType:(LUConsoleLogType)type message:(LULogMessage *)message stackTrace:(NSString *)stackTrace; - (UITableViewCell *)tableView:(UITableView *)tableView cellAtIndex:(NSUInteger)index; - (CGSize)cellSizeForTableView:(UITableView *)tableView; @end /// Console entry for holding collapsed items @interface LUConsoleCollapsedLogEntry : LUConsoleLogEntry /// Index in the entry list @property (nonatomic, assign) NSInteger index; /// Total amount of encounters @property (nonatomic, assign) NSInteger count; + (instancetype)entryWithEntry:(LUConsoleLogEntry *)entry; - (instancetype)initWithEntry:(LUConsoleLogEntry *)entry; - (void)increaseCount; @end /// Console entry for displaying in overlay view @interface LUConsoleOverlayLogEntry : LUConsoleLogEntry /// Scheduled removal date (after becoming visible) @property (nonatomic, strong) NSDate *removalDate; - (instancetype)initWithEntry:(LUConsoleLogEntry *)entry; @end
// // UIImage+CDCrop.h // CrutchKitExample // // Created by Smal Vadim on 06/06/15. // Copyright (c) 2015 cognitivedisson. All rights reserved. // #import <UIKit/UIKit.h> @interface UIImage (CDCrop) - (UIImage *)cd_imageCropped:(CGRect)rect; - (UIImage *)cd_imagedCroppedToCircle; - (UIImage *)squareImage; @end
// // NewfratureController.h // BaMinTicket // // Created by ganfuchuan on 16/2/29. // Copyright © 2016年 ganfuchuan. All rights reserved. // #import <UIKit/UIKit.h> @interface NewfratureController : UIViewController @end
/******************************************************************************/ /*! \file M5Gfx.h \author Matt Casanova \par email: lazersquad\@gmail.com \par Mach5 Game Engine \date 2016/08/8 Singleton class to draw and modify the view of the screen */ /******************************************************************************/ #ifndef M5_GRAPHICS_H #define M5_GRAPHICS_H /*! Used to exclude rarely-used stuff from Windows */ #define WIN32_LEAN_AND_MEAN #include <windows.h> //Forward declarations struct M5Vec2; struct M5Mtx44; class GfxComponent; //! Singleton class to draw and modify the view of the screen class M5Gfx { public: friend class M5App; friend class M5StageManager; /*Use this to load a texture from file*/ static int LoadTexture(const char* fileName); /*Use this to load a texture from file*/ static void UpdateTextureCount(int textureID); /*You must unload every texture that you load*/ static void UnloadTexture(int textureID); /*Sets the position of the camera in perspective mode. There is no camera in ortho mode.*/ static void SetCamera(float cameraX = 0, float cameraY = 0, float cameraZ = 0, float cameraRot = 0); /*Changes the background color*/ static void SetBackgroundColor(float red = 0, float green = 0, float blue = 0); /*Draws the selected texture based on the matrix*/ static void Draw(const M5Mtx44& worldMatrix); /*Writes text on the screen*/ static void WriteText(const char* text, float x, float y); /*Use this to select the texture that you want to draw*/ static void SetTexture(int textureID); /*This is used to scale, rotate, or translate a texture. It is best used for frame animation*/ static void SetTextureCoords(float scaleX = 1, float scaleY = 1, float radians = 0, float transX = 0, float transY = 0); /*Blends the given color with the texture*/ static void SetTextureColor(unsigned color); /*Blends the given color with the texture*/ static void SetTextureColor(unsigned char red = 255, unsigned char green = 255, unsigned char blue = 255, unsigned char alpha = 255); /*Converts a point in screen space (mouse click) to the correct position in the world*/ static void ConvertScreenToWorld(float& x, float& y); /*Converts a position in the world into screen space*/ static void ConvertWorldToScreen(float& x, float& y); /*Set where on the the window to draw*/ static void SetViewport(int xStart, int yStart, int width, int height); /*Gets the Top Left corner of the world*/ static void GetWorldTopLeft(M5Vec2& outParam); /*Gets the Top right corner of the world*/ static void GetWorldTopRight(M5Vec2& outParam); /*Gets the Bottom left corner of the world*/ static void GetWorldBotLeft(M5Vec2& outParam); /*Gets the Bottom Right corner of the world*/ static void GetWorldBotRight(M5Vec2& outParam); static void RegisterWorldComponent(GfxComponent* pGfxComp); static void RegisterHudComponent(GfxComponent* pGfxComp); static void UnregisterComponent(GfxComponent* pGfxComp); private: //Private functions /*This should be called once before drawing all objects*/ static void StartScene(void); /*This should be called once after drawing all objects*/ static void EndScene(void); static void Update(void); static void Pause(bool drawPaused = false); static void Resume(void); static void SetResolution(int width, int height); static void CalulateWorldExtents(void); static void FontInit(void); static void VertexBufferInit(void); static void Init(HWND window, int width, int height); static void Shutdown(void); static void RenderContextInit(void); //Possibly depricated functions /*Use this to draw game objects. Z order and distance from the camera effects the size*/ static void SetToPerspective(void); /*Use this to draw HUD objects. Distance from the camara doesn't effect the object*/ static void SetToOrtho(void); };//end M5Gfx #endif
#pragma once #include "Window.h" namespace gui { class GuiDialog : public Window { public: void Close(); }; }
#ifndef Random_h #define Random_h class Random { private: int value, mix, twist; unsigned int seed; void CalculateNext(); public: Random(); Random(int seed); void SetSeed(int seed); int Next1(); int Next2(); }; #endif
#include <stdlib.h> #include <assert.h> int main() { int *x = malloc(sizeof(int)); int *y = malloc(sizeof(int)); int *p; *x = 0; *y = 1; assert(*x == 0); assert(*y == 1); p = x; x = y; y = p; assert(*x == 1); assert(*y == 0); return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> const int inf = (1 << 31) - 1; struct Edge { int u; int v; int w; int next; }; struct Edge edge[10010]; int head[510]; int visit[510]; int tot, RES, Min_road, Max_road, S, T, N_city, M_road; void init() { tot = 0; memset(head, -1, sizeof(head)); } void addedge(int u, int v, int w) { edge[tot].u = u; edge[tot].v = v; edge[tot].w = w; edge[tot].next = head[u]; head[u] = tot++; } void dfs(int n, int max, int min) { if (n == T) { if (RES > max - min) RES = max - min; return; } int i, j, k, u, v, w, tempmax, tempmin; tempmax = max; tempmin = min; for (i = head[n]; i != -1; i = edge[i].next) { v = edge[i].v; w = edge[i].w; if (!visit[v]) { if (tempmax < w) tempmax = w; if (tempmin > w) tempmin = w; visit[v] = 1; dfs(v, tempmax, tempmin); visit[v] = 0; tempmax = max; tempmin = min; } } return; } int main() { int i, j, u, v, w, n, m; printf("Please input number of test case:\n"); scanf("%d", &n); for (m = 1; m <= n; m++) { init(); printf("Please input the number of cities and roads:\n"); scanf("%d %d", &N_city, &M_road); printf("Please input the details:\n"); for (i = 1; i <= M_road; i++) { scanf("%d %d %d", &u, &v, &w); addedge(u, v, w); addedge(v, u, w); } printf("Please input the start city and end city:\n"); scanf("%d %d", &S, &T); memset(visit, 0, sizeof(visit)); RES = inf; visit[S] = 1; dfs(S, -inf, inf); printf("Case #%d Result:%d\n", m, RES); } return 0; }
#pragma once #include "common.h" struct UnionFind { int size, count; vector<int> P, R; UnionFind(int n) { build(n); } void build(int n) { size = count = n; P.resize(n); R.resize(n); for(int i = 0; i < n; ++i) { P[i] = i; } } int sets() { return count; } int sizeofset(int i) { return R[i]; } int find(int x) { return P[x] == x ? x : P[x] = find(P[x]); } bool check(int x, int y) { return find(x) == find(y); } bool unite(int x, int y) { x = find(x); y = find(y); if(x == y) { return false; } if(R[x] < R[y]) { P[x] = y; R[y] += R[x]; } else { P[y] = x; R[x] += R[y]; } count--; return true; } };
/** * @file erlcmd.c * @author Frank Hunleth * @brief Erlang interface * @description * * @section LICENSE * Copyright (C) 2014 Frank Hunleth */ #ifndef ERLCMD_H #define ERLCMD_H #include <erl_interface.h> #include <ei.h> /* * Erlang request/response processing */ #define ERLCMD_BUF_SIZE 1024 struct erlcmd { unsigned char buffer[ERLCMD_BUF_SIZE]; ssize_t index; void (*request_handler)(ETERM *emsg, void *cookie); void *cookie; }; void erlcmd_init(struct erlcmd *handler, void (*request_handler)(ETERM *emsg, void *cookie), void *cookie); void erlcmd_send(ETERM *response); void erlcmd_process(struct erlcmd *handler); #endif
/* * uartserial.h - USART hardware Serial UART template for lpc1114 * * Created: Nov-12-2012 * Author: rick@kimballsoftware.com * Date: 03-08-2013 * Version: 1.0.3 * * 11-12-2012: 0.0.001 rick@kimballsoftware.com - initial version * 02-05-2013: 0.0.002 rick@kimballsoftware.com - tweaks to remove TX RX instances * * Acknowledgments: * Serial API inspired by Arduino. * * ========================================================================= * Copyright © 2013 Rick Kimball * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef UARTSERIAL_H #define UARTSERIAL_H #include <LPC11xx.h> template <const uint32_t BAUD, uint32_t MCLK_HZ, typename TXPIN, typename RXPIN> struct serial_base_uart_t { static const uint32_t bit_cycles = MCLK_HZ/(BAUD*16); // cycles/bit static const uint32_t divh = bit_cycles >> 8; // div / 256; static const uint32_t divl = bit_cycles & 0xff; // div - (divh * 256); /** * begin(bps) - initialize TX/RX pins */ void begin(const uint32_t bps = BAUD) { //SET UP UART (sec. 13.2 in datasheet "BASIC CONFIGURATION") if ( TXPIN::_portno != DUMMY_PORT ) { LPC_IOCON->PIO1_7 &= ~0x07; // clear all functions LPC_IOCON->PIO1_7 |= 0x01; // enable as UART pin } if ( RXPIN::_portno != DUMMY_PORT ) { LPC_IOCON->PIO1_6 &= ~0x07; // clear all functions LPC_IOCON->PIO1_6 |= 0x01; // enable as UART pin } LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 12); //enable clock to UART (sec. 3.5.14) LPC_SYSCON->UARTCLKDIV = 1; // divided by 1 /* TODO: figure out fractional dividers */ LPC_UART->LCR = 0x83; //DLB=1, 8 bits, no Parity, 1 Stop bit // setup baud rate if ( BAUD == 115200 ) { LPC_UART->DLL = 4; LPC_UART->DLM = 0; LPC_UART->FDR = 0x05 | (0x08 << 4 ) | 0; } else { LPC_UART->FDR = 0x00 | (1 << 4) | 0; LPC_UART->DLL = divl; LPC_UART->DLM = divh; } LPC_UART->FCR = 0x07; // Enable and reset TX and RX FIFO. (sec. 13.5.6) LPC_UART->LCR = 0x03; // DLAB = 0 ,Disable access to divisor latches unsigned int temp = LPC_UART->LSR; // Read to clear the line status. (sec. 13.5.9) (void)bps; (void)temp; delay(200); /* TODO: figure out why I need a delay */ } /* * end() - set TX/RX pin back to default */ void end() { } /* * read() - blocking read */ int read(void) { #define LSR_RDR (1<<0) /* 0x01 */ while ( !(LPC_UART->LSR & LSR_RDR) ); // wait for if Receiver Data Ready bit set (sec 13.5.9) return LPC_UART->RBR & 0xff; // return byte received } /* * write_impl() - blocking write CRTP function used by print<> template * * this template implements enough code to be considered a Writer pattern * for use with the print_t<Writer> * */ int write_impl(uint8_t c) { #define LSR_TEMT (1 << 6) /* 0x40 */ LPC_UART->THR |= c; // insert into FIFO (sec. 13.5.2) while ( !(LPC_UART->LSR & LSR_TEMT) ); // wait until Transmitter Empty return 1; } }; // typical usage template <uint32_t BAUD, uint32_t MCLK_HZ, typename TXPIN, typename RXPIN> struct uart_serial_t: serial_base_uart_t<BAUD, MCLK_HZ, TXPIN, RXPIN>, print_t<uart_serial_t<BAUD, MCLK_HZ, TXPIN, RXPIN> > { // make it easier to instance in user code }; #endif /* UARTSERIAL_H */
// // GIServiceRecordParser.h // Xbox Live Friends // // Created by Wil Gieseler on 11/22/07. // Copyright 2007 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> @interface GIHalo3RecentGamesParser : NSObject { } + (NSArray *)fetchWithTag:(NSString *)tag; + (NSArray *)fetchWithURL:(NSURL *)URL; @end
// // Copyright (c) 2008-2011, Mark Lussier // http://github.com/intabulas/ipivotal // All rights reserved. // // This software is released under the terms of the BSD License. // http://www.opensource.org/licenses/bsd-license.php // // 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 iPivotal 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. // #import <UIKit/UIKit.h> @interface LabelInputCell : UITableViewCell { @private UILabel* cellLabel; UILabel* cellValue; } @property (nonatomic,readonly) UILabel* cellLabel; @property (nonatomic,readonly) UILabel* cellValue; @end
#pragma once #include <type_traits> // Tests to see whether every predicate in a parameter pack is true namespace mtt { inline namespace v1 { template <class... Conditions> struct and_ : std::true_type { }; template <class Condition, class... Conditions> struct and_<Condition, Conditions...> : std::conditional_t<Condition::value, and_<Conditions...>, std::false_type> { }; } }
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Drawing.Polygons\0.11.3\Sweep\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #ifndef __APP_FUSE_DRAWING_TESSELATION_GEOM_H__ #define __APP_FUSE_DRAWING_TESSELATION_GEOM_H__ #include <Uno.h> namespace app { namespace Fuse { namespace Drawing { namespace Tesselation { struct Vertex; } } } } namespace app { namespace Fuse { namespace Drawing { namespace Tesselation { struct Geom__uType : ::uClassType { }; Geom__uType* Geom__typeof(); float Geom__EdgeEval(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v, ::app::Fuse::Drawing::Tesselation::Vertex* w); float Geom__EdgeSign(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v, ::app::Fuse::Drawing::Tesselation::Vertex* w); double Geom__Interpolate(::uStatic* __this, double ai, double x, double bi, double y); ::app::Fuse::Drawing::Tesselation::Vertex* Geom__Intersect(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* o1p, ::app::Fuse::Drawing::Tesselation::Vertex* d1p, ::app::Fuse::Drawing::Tesselation::Vertex* o2p, ::app::Fuse::Drawing::Tesselation::Vertex* d2p); void Geom__Swap(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex** a, ::app::Fuse::Drawing::Tesselation::Vertex** b); float Geom__TransEval(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v, ::app::Fuse::Drawing::Tesselation::Vertex* w); bool Geom__TransLeq(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v); float Geom__TransSign(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v, ::app::Fuse::Drawing::Tesselation::Vertex* w); bool Geom__VertCCW(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v, ::app::Fuse::Drawing::Tesselation::Vertex* w); double Geom__VertL1dist(::uStatic* __this, ::app::Fuse::Drawing::Tesselation::Vertex* u, ::app::Fuse::Drawing::Tesselation::Vertex* v); }}}} #endif
// Copyright (c) 2016 dacci.org #ifndef JUNO_MISC_SCHANNEL_SCHANNEL_CREDENTIAL_H_ #define JUNO_MISC_SCHANNEL_SCHANNEL_CREDENTIAL_H_ #if !defined(SECURITY_WIN32) && !defined(SECURITY_KERNEL) #define SECURITY_WIN32 #endif #include <windows.h> #include <schnlsp.h> #include <security.h> #include <vector> namespace juno { namespace misc { namespace schannel { class SchannelCredential { public: SchannelCredential() : auth_data_(), expiry_() { SecInvalidateHandle(&handle_); auth_data_.dwVersion = SCHANNEL_CRED_VERSION; } ~SchannelCredential() { for (auto& certificate : certificates_) CertFreeCertificateContext(certificate); if (SecIsValidHandle(&handle_)) { FreeCredentialsHandle(&handle_); SecInvalidateHandle(&handle_); } } HRESULT AcquireHandle(ULONG usage) { if (SecIsValidHandle(&handle_)) return SEC_E_INTERNAL_ERROR; return AcquireCredentialsHandle(nullptr, UNISP_NAME, usage, nullptr, &auth_data_, nullptr, nullptr, &handle_, &expiry_); } void AddCertificate(const CERT_CONTEXT* certificate) { certificates_.push_back(CertDuplicateCertificateContext(certificate)); auth_data_.cCreds = static_cast<DWORD>(certificates_.size()); auth_data_.paCred = certificates_.data(); } void AddSupportedAlgorithm(ALG_ID algorithm) { algorithms_.push_back(algorithm); auth_data_.cSupportedAlgs = static_cast<DWORD>(algorithms_.size()); auth_data_.palgSupportedAlgs = algorithms_.data(); } void SetEnabledProtocols(DWORD protocols) { auth_data_.grbitEnabledProtocols = protocols; } void SetMinimumCipherStrength(DWORD strength) { auth_data_.dwMinimumCipherStrength = strength; } void SetMaximumCipherStrength(DWORD strength) { auth_data_.dwMaximumCipherStrength = strength; } void SetFlags(DWORD flags) { auth_data_.dwFlags = flags; } private: friend class SchannelContext; SCHANNEL_CRED auth_data_; CredHandle handle_; TimeStamp expiry_; std::vector<const CERT_CONTEXT*> certificates_; std::vector<ALG_ID> algorithms_; SchannelCredential(const SchannelCredential&) = delete; SchannelCredential& operator=(const SchannelCredential&) = delete; }; } // namespace schannel } // namespace misc } // namespace juno #endif // JUNO_MISC_SCHANNEL_SCHANNEL_CREDENTIAL_H_
// // XSAudioView.h // XSStreamPlayerDemo // // Created by faterman on 17/1/10. // Copyright © 2017年 faterman. All rights reserved. // #import <UIKit/UIKit.h> @interface XSAudioView : UIView @property (nonatomic, weak) IBOutlet UIView *view; @end
// // QDViewTheme.h // QDKit // // Created by song on 15/12/1. // Copyright © 2017年 Personal. All rights reserved. // #import <Foundation/Foundation.h> // Parent theme extern NSString * const QDThemeKeywordAttributeSuper; // Selector extern NSString * const QDThemeKeywordAttributeSelector; // UIEdgeInset extern NSString * const QDThemeKeywordAttributeTop; extern NSString * const QDThemeKeywordAttributeLeft; extern NSString * const QDThemeKeywordAttributeBottom; extern NSString * const QDThemeKeywordAttributeRight; // UIColor extern NSString * const QDThemeKeywordPathBackgroundColor; extern NSString * const QThemeKeywrodPathTextColorNormal; extern NSString * const QDThemeKeywordPathTextColorShadow; extern NSString * const QDThemeKeywordPathTextColorSelected; extern NSString * const QDThemeKeywordPathTextColorHighlighted; extern NSString * const QDThemeKeywordPathTextColorDisabled; extern NSString * const QDThemeKeywordPathTextColorDisabledShadow; // UIFont extern NSString * const QDThemeKeywordAttributeFontBold; extern NSString * const QDThemeKeywordAttributeSize; extern NSString * const QDThemeKeywordPathTextFont; // UIButton extern NSString * const QDThemeKeywordPathButton; extern NSString * const QDThemeKeywordPathTitleEdgeInsets; extern NSString * const QDThemeKeywordPathImageEdgeInsets; extern NSString * const QDThemeKeywordAttributeUseImage; extern NSString * const QDThemeKeywordSwapImageAndTitle; // Frame extern NSString * const QDThemeKeywordAttributeWidth; extern NSString * const QDThemeKeywordAttributeHeight; extern NSString * const QDThemeKeywordPathTextShadowOffset; // Image extern NSString * const QDThemeKeywordAttributeImageName; extern NSString * const QDThemeKeywordAttributeLeftCapWidth; extern NSString * const QDThemeKeywordAttributeTopCapWidth; extern NSString * const QDThemeKeywordPathCapEdgeInsets; extern NSString * const QDThemeKeywordPathImageNormal; extern NSString * const QDThemeKeywordPathImageDisabled; extern NSString * const QDThemeKeywordPathImageHighlighted; extern NSString * const QDThemeKeywordPathImageSelected; extern NSString * const QDThemeKeywordPathIconNormal; extern NSString * const QDThemeKeywordPathIconHighlighted; extern NSString * const QDThemeKeywordClipsToBounds; // Text extern NSString * const QDThemeKeywordAttributeTextLineNumber; extern NSString * const QDThemeKeywordAttributeTextLineBreakMode; extern NSString * const QDThemeKeywordAttributeTextAlignment; // View extern NSString * const QDThemeKeywordAttributeContentModel; extern NSString * const QDThemeKeywordAttributeSizeToFit; @interface QDViewTheme : NSObject @end
#include <stdlib.h> #include <stdio.h> #ifdef OS_WINDOWS #define HARBOL_LIB #endif #include "harbol.h" HARBOL_EXPORT struct HarbolTree *harbol_tree_new(const union HarbolValue val) { struct HarbolTree *tn = calloc(1, sizeof *tn); harbol_tree_init_val(tn, val); return tn; } HARBOL_EXPORT void harbol_tree_init(struct HarbolTree *const tn) { if( !tn ) return; memset(tn, 0, sizeof *tn); } HARBOL_EXPORT void harbol_tree_init_val(struct HarbolTree *const tn, const union HarbolValue val) { if( !tn ) return; memset(tn, 0, sizeof *tn); tn->Data = val; } HARBOL_EXPORT void harbol_tree_del(struct HarbolTree *const tn, fnDestructor *const dtor) { if( !tn ) return; if( dtor ) (*dtor)(&tn->Data.Ptr); struct HarbolVector *vec = &tn->Children; for( size_t i=0 ; i<vec->Count ; i++ ) { struct HarbolTree *node = vec->Table[i].Ptr; harbol_tree_free(&node, dtor); } harbol_vector_del(vec, NULL); memset(tn, 0, sizeof *tn); } HARBOL_EXPORT void harbol_tree_free(struct HarbolTree **tnref, fnDestructor *const dtor) { if( !*tnref ) return; harbol_tree_del(*tnref, dtor); free(*tnref); *tnref=NULL; } HARBOL_EXPORT bool harbol_tree_insert_child_node(struct HarbolTree *const restrict tn, struct HarbolTree *const restrict node) { if( !tn || !node ) return false; harbol_vector_insert(&tn->Children, (union HarbolValue){.Ptr=node}); return true; } HARBOL_EXPORT bool harbol_tree_insert_child_val(struct HarbolTree *const restrict tn, const union HarbolValue val) { if( !tn ) return false; struct HarbolTree *restrict node = harbol_tree_new(val); if( !node ) return false; harbol_vector_insert(&tn->Children, (union HarbolValue){.Ptr=node}); return true; } HARBOL_EXPORT bool harbol_tree_delete_child_by_ref(struct HarbolTree *const restrict tn, struct HarbolTree **noderef, fnDestructor *const dtor) { if( !tn || !tn->Children.Table || !*noderef ) return false; struct HarbolTree *restrict node = *noderef; struct HarbolVector *vec = &tn->Children; for( size_t i=0 ; i<vec->Count ; i++ ) { if( vec->Table[i].Ptr==node ) { struct HarbolTree *child = vec->Table[i].Ptr; harbol_tree_free(&child, dtor); harbol_vector_delete(vec, i, NULL); return true; } } return false; } HARBOL_EXPORT bool harbol_tree_delete_child_by_index(struct HarbolTree *const restrict tn, const size_t index, fnDestructor *const dtor) { if( !tn || index >= tn->Children.Count ) return false; struct HarbolVector *restrict vec = &tn->Children; struct HarbolTree *child = vec->Table[index].Ptr; harbol_tree_free(&child, dtor); harbol_vector_delete(vec, index, NULL); harbol_vector_truncate(vec); return true; } HARBOL_EXPORT bool harbol_tree_delete_child_by_val(struct HarbolTree *const restrict tn, const union HarbolValue val, fnDestructor *const dtor) { if( !tn || !tn->Children.Table ) return false; struct HarbolVector *vec = &tn->Children; for( size_t i=0 ; i<vec->Count ; i++ ) { struct HarbolTree *node = vec->Table[i].Ptr; if( node->Data.Int64==val.Int64 ) { harbol_tree_free(&node, dtor); harbol_vector_delete(vec, i, NULL); return true; } } harbol_vector_truncate(vec); return false; } HARBOL_EXPORT struct HarbolTree *harbol_tree_get_child_by_index(const struct HarbolTree *const tn, const size_t index) { if( !tn || !tn->Children.Table || index >= tn->Children.Count ) return NULL; return tn->Children.Table[index].Ptr; } HARBOL_EXPORT struct HarbolTree *harbol_tree_get_child_by_val(const struct HarbolTree *const restrict tn, const union HarbolValue val) { if( !tn || !tn->Children.Table ) return NULL; for( size_t i=0 ; i<tn->Children.Count ; i++ ) { struct HarbolTree *restrict node = tn->Children.Table[i].Ptr; if( node->Data.Int64==val.Int64 ) return node; } return NULL; } HARBOL_EXPORT union HarbolValue harbol_tree_get_val(const struct HarbolTree *const tn) { return tn ? tn->Data : (union HarbolValue){0}; } HARBOL_EXPORT void harbol_tree_set_val(struct HarbolTree *const tn, const union HarbolValue val) { if( !tn ) return; tn->Data = val; } HARBOL_EXPORT struct HarbolVector *harbol_tree_get_children_vector(struct HarbolTree *const tn) { return tn ? &tn->Children : NULL; } HARBOL_EXPORT size_t harbol_tree_get_children_len(const struct HarbolTree *const tn) { return tn ? tn->Children.Len : 0; } HARBOL_EXPORT size_t harbol_tree_get_children_count(const struct HarbolTree *const tn) { return tn ? tn->Children.Count : 0; }
// // MXChatAudioPlayer.h // // Created by eric on 15/6/9. // Copyright (c) 2015年 eric. All rights reserved. // #import <Foundation/Foundation.h> @interface MXChatAudioPlayer : NSObject + (instancetype)instance; - (void)playAudioWithPath:(NSString *)path completion:(void (^)(void))completion; - (void)playAudioWithData:(NSData *)data completion:(void (^)(void))completion; - (void)stopPlaying; @end
/** * This header is generated by class-dump-z 0.2a. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. * * Source: (null) */ #import <XXUnknownSuperclass.h> // Unknown library @class NSString, AWSMobileAnalyticsConfiguration; @protocol AWSMobileAnalyticsContext, AWSMobileAnalyticsDeliveryClient, AWSMobileAnalyticsSessionClient, AWSMobileAnalyticsEventClient; @interface AWSMobileAnalytics : XXUnknownSuperclass { id<AWSMobileAnalyticsEventClient> _eventClient; id<AWSMobileAnalyticsContext> _mobileAnalyticsContext; id<AWSMobileAnalyticsSessionClient> _sessionClient; id<AWSMobileAnalyticsDeliveryClient> _deliveryClient; AWSMobileAnalyticsConfiguration* _configuration; NSString* _insightsPrivateKey; } @property(retain, nonatomic) AWSMobileAnalyticsConfiguration* configuration; @property(readonly, assign, nonatomic) id<AWSMobileAnalyticsDeliveryClient> deliveryClient; @property(readonly, assign, nonatomic) id<AWSMobileAnalyticsEventClient> eventClient; @property(retain, nonatomic) NSString* insightsPrivateKey; @property(readonly, assign, nonatomic) id<AWSMobileAnalyticsContext> mobileAnalyticsContext; @property(readonly, assign, nonatomic) id<AWSMobileAnalyticsSessionClient> sessionClient; + (id)mobileAnalyticsForAppId:(id)appId; + (id)mobileAnalyticsForAppId:(id)appId configuration:(id)configuration completionBlock:(id)block; + (id)mobileAnalyticsForAppId:(id)appId insightsPrivateKey:(id)key; + (id)mobileAnalyticsForAppId:(id)appId insightsPrivateKey:(id)key configuration:(id)configuration completionBlock:(id)block; + (void)removeCachedInstances; - (id)initWithAppId:(id)appId insightsPrivateKey:(id)key configuration:(id)configuration settings:(id)settings completionBlock:(id)block; - (void).cxx_destruct; @end
// // lampardViewController.h // podspec_test // // Created by tao.hong on 02/02/2016. // Copyright (c) 2016 tao.hong. All rights reserved. // @import UIKit; @interface lampardViewController : UIViewController @end
// // UIView+RSMToolKit.h // RSMToolkit // // Created by Robert S Mozayeni on 8/10/13. // Copyright (c) 2013 Robert Mozayeni. All rights reserved. // #import <UIKit/UIKit.h> @interface UIView (RSMToolKit) - (void)addSubviewsInArray: (NSArray *)subviews; - (void)addSubviews:(id)view, ...; @end
#ifndef che_alignment_h #define che_alignment_h #include "che/structure.h" namespace biosim { namespace che { // alignment of structures, consensus/profile; // design: unified alignment class for sequence and structure alignment, cleaner than replicating everything. class alignment { public: // ctor from a structure (takes begin and end from given structure) explicit alignment(structure __s); // ctor from a list of structures, begins, and ends alignment(std::vector<structure> __structures, std::vector<size_t> __begins, std::vector<size_t> __ends); // get alignment length size_t get_length() const; // get alignment depth, i.e. number of structures size_t get_depth() const; // get aligned structures std::vector<structure> const &get_structures() const; // get begins (1-based) of the alignment in the complete structures std::vector<size_t> const &get_begins() const; // get ends (1-based) of the alignment in the complete structures std::vector<size_t> const &get_ends() const; // get cc at specific position and depth cc const &get_cc(size_t __position, size_t __depth) const; private: std::vector<structure> _structures; // vector of aligned structures std::vector<size_t> _begins; // vector of begins std::vector<size_t> _ends; // vector of ends }; // class alignment // output operator for alignment inline std::ostream &operator<<(std::ostream &__out, alignment const &__a) { __out << "Alignment (depth=" << __a.get_depth() << ", size=" << __a.get_length() << ")\n"; for(size_t pos(0); pos < __a.get_depth(); ++pos) { // use pos to access structures, begins, and ends che::structure const &p(__a.get_structures()[pos]); std::string id(p.get_identifier()); id.erase(std::remove(id.begin(), id.end(), '\n'), id.end()); __out << p.get_storage() << ": " << id << " length=" << p.get_length() << " subsequence=" << __a.get_begins()[pos] << ".." << __a.get_ends()[pos] << "\n" << p.get_ps() << "\n"; if(p.get_ss().defined()) { __out << p.get_ss(); } // if } // for return __out; } // operator<<() // container scoring an alignment together with its score; design: simple container class scored_alignment { public: // ctor from alignment and score scored_alignment(alignment __alignment, double __score); // get the alignment alignment const &get_alignment() const; // get the score double get_score() const; private: alignment _alignment; // alignment double _score; // score }; // class scored_alignment // output operator for scored_alignment inline std::ostream &operator<<(std::ostream &__out, scored_alignment const &__a) { __out << "Alignment (depth=" << __a.get_alignment().get_depth() << ", size=" << __a.get_alignment().get_length() << ", score=" << __a.get_score() << ", normalized_score=" << (__a.get_score() / __a.get_alignment().get_length()) << ")\n"; for(size_t pos(0); pos < __a.get_alignment().get_depth(); ++pos) { che::structure const &p(__a.get_alignment().get_structures()[pos]); std::string id(p.get_identifier()); id.erase(std::remove(id.begin(), id.end(), '\n'), id.end()); __out << p.get_storage() << ": " << id << " length=" << p.get_length() << " subsequence=" << __a.get_alignment().get_begins()[pos] << ".." << __a.get_alignment().get_ends()[pos] << "\n" << p.get_ps() << "\n"; if(p.get_ss().defined()) { __out << p.get_ss(); } // if } // for return __out; } // operator<<() } // namespace che } // namespace #endif // che_alignment_h
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class NSArray; @protocol GoogleContactAPIFetchImplDelegate <NSObject> @optional - (void)onNetWorkError; - (void)onGetGoogleContact:(NSArray *)arg1 isDecodeOK:(_Bool)arg2; @end
/* * servo.h * * Created: 11/4/2016 1:29:53 PM * Author: charlie */ #ifndef SERVO_H_ #define SERVO_H_ #define LockerOFF 0 #define LockerOn 1 void InitialiseTimer3_FastPWM_Single(); void SetServoPosition(unsigned char sw); #endif /* SERVO_H_ */
//© Francois Belair 2012+ //Author: Francois Belair, http://www.iced-fire.com/ //Border is a component and holds pertinent information to determine orientation, facing and position #ifndef ENTITYSYSTEMPONG_BORDER_H_ #define ENTITYSYSTEMPONG_BORDER_H_ #include "IComponent.h" #include "../Types.h" //See above for description. //Sample usage: // { Border* border = new Border(); // entity_manager->addComponent( entity, border ); } // Border* border = entity_manager->GetComponent( entity, COMP_BORDER ); class Border : public IComponent { public: //Constructor that initializes the object with given data right away. Border( Vector2 position, const bool &horizontal, const int &facing ); //Empty constructor that uses default data. Border(); //returns COMP_BORDER ComponentTypes type(); //Uses any pertinent XML data from the xml_node. void Deserialize( const pugi::xml_node &node ); bool horizontal_; //True for horizontal border (bounces ball), false for vertical (scores) int facing_; //1 for up/right, 2 for down/left Vector2 position_; //x,y floating point position. //Uses only one value from it depending on type, x for vertical and y for horizontal. implied to be infinte length/height }; //Factory method that creates a border and returns its pointer. IComponent* CreateBorder(); #endif//ENTITYSYSTEMPONG_BORDER_H_
/* Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4 Copyright (C) 2021 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com> */ /* DO NOT EDIT THIS FILE - the content was created using a source code generator */ #ifndef QSQLDRIVERSLOTS_H #define QSQLDRIVERSLOTS_H #include <QtCore/QObject> #include <QtCore/QCoreApplication> #include <QtCore/QString> #include <QtSql/QSqlDriver> #include "qt4xhb_common.h" #include "qt4xhb_macros.h" #include "qt4xhb_utils.h" #include "qt4xhb_signals.h" class QSqlDriverSlots: public QObject { Q_OBJECT public: QSqlDriverSlots( QObject * parent = 0 ); ~QSqlDriverSlots(); public slots: void notification( const QString & name ); }; #endif /* QSQLDRIVERSLOTS_H */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE401_Memory_Leak__int64_t_realloc_45.c Label Definition File: CWE401_Memory_Leak.c.label.xml Template File: sources-sinks-45.tmpl.c */ /* * @description * CWE: 401 Memory Leak * BadSource: realloc Allocate data using realloc() * GoodSource: Allocate data on the stack * Sinks: * GoodSink: call free() on data * BadSink : no deallocation of data * Flow Variant: 45 Data flow: data passed as a static global variable from one function to another in the same source file * * */ #include "std_testcase.h" #include <wchar.h> static int64_t * CWE401_Memory_Leak__int64_t_realloc_45_badData; static int64_t * CWE401_Memory_Leak__int64_t_realloc_45_goodG2BData; static int64_t * CWE401_Memory_Leak__int64_t_realloc_45_goodB2GData; #ifndef OMITBAD static void badSink() { int64_t * data = CWE401_Memory_Leak__int64_t_realloc_45_badData; /* POTENTIAL FLAW: No deallocation */ ; /* empty statement needed for some flow variants */ } void CWE401_Memory_Leak__int64_t_realloc_45_bad() { int64_t * data; data = NULL; /* POTENTIAL FLAW: Allocate memory on the heap */ data = (int64_t *)realloc(data, 100*sizeof(int64_t)); /* Initialize and make use of data */ data[0] = 5LL; printLongLongLine(data[0]); CWE401_Memory_Leak__int64_t_realloc_45_badData = data; badSink(); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2BSink() { int64_t * data = CWE401_Memory_Leak__int64_t_realloc_45_goodG2BData; /* POTENTIAL FLAW: No deallocation */ ; /* empty statement needed for some flow variants */ } static void goodG2B() { int64_t * data; data = NULL; /* FIX: Use memory allocated on the stack with ALLOCA */ data = (int64_t *)ALLOCA(100*sizeof(int64_t)); /* Initialize and make use of data */ data[0] = 5LL; printLongLongLine(data[0]); CWE401_Memory_Leak__int64_t_realloc_45_goodG2BData = data; goodG2BSink(); } /* goodB2G() uses the BadSource with the GoodSink */ static void goodB2GSink() { int64_t * data = CWE401_Memory_Leak__int64_t_realloc_45_goodB2GData; /* FIX: Deallocate memory */ free(data); } static void goodB2G() { int64_t * data; data = NULL; /* POTENTIAL FLAW: Allocate memory on the heap */ data = (int64_t *)realloc(data, 100*sizeof(int64_t)); /* Initialize and make use of data */ data[0] = 5LL; printLongLongLine(data[0]); CWE401_Memory_Leak__int64_t_realloc_45_goodB2GData = data; goodB2GSink(); } void CWE401_Memory_Leak__int64_t_realloc_45_good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE401_Memory_Leak__int64_t_realloc_45_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE401_Memory_Leak__int64_t_realloc_45_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#include <stdio.h> int main(int argc, char *argv[]) { printf("Hello World!\n"); printf("I am not matching\n"); printf("Any strings\n"); printf("But it is OK\n"); return 0; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52a.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-52a.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Fixed string * Sink: execlp * BadSink : execute command with wexeclp * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"ls" #define COMMAND_ARG2 L"-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 #ifdef _WIN32 #include <process.h> #define EXECLP _wexeclp #else /* NOT _WIN32 */ #define EXECLP execlp #endif #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52b_badSink(wchar_t * data); void CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52_bad() { wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; wchar_t *replace; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; size_t dataLen = wcslen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(wchar_t) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(wchar_t)] = L'\0'; /* Eliminate CRLF */ replace = wcschr(data, L'\r'); if (replace) { *replace = L'\0'; } replace = wcschr(data, L'\n'); if (replace) { *replace = L'\0'; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52b_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; /* FIX: Append a fixed string to data (not user / external input) */ wcscat(data, L"*.*"); CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52b_goodG2BSink(data); } void CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52_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()..."); CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__wchar_t_listen_socket_execlp_52_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#ifndef SENDCOINSDIALOG_H #define SENDCOINSDIALOG_H #include <QDialog> #include <QString> namespace Ui { class SendCoinsDialog; } class WalletModel; class SendCoinsEntry; class SendCoinsRecipient; QT_BEGIN_NAMESPACE class QUrl; QT_END_NAMESPACE /** Dialog for sending mistcoins */ class SendCoinsDialog : public QDialog { Q_OBJECT public: explicit SendCoinsDialog(QWidget *parent = 0); ~SendCoinsDialog(); void setModel(WalletModel *model); /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). */ QWidget *setupTabChain(QWidget *prev); void pasteEntry(const SendCoinsRecipient &rv); bool handleURI(const QString &uri); public slots: void clear(); void reject(); void accept(); SendCoinsEntry *addEntry(); void updateRemoveEnabled(); void setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance); private: Ui::SendCoinsDialog *ui; WalletModel *model; bool fNewRecipientAllowed; private slots: void on_sendButton_clicked(); void removeEntry(SendCoinsEntry* entry); void updateDisplayUnit(); void coinControlFeatureChanged(bool); void coinControlButtonClicked(); void coinControlChangeChecked(int); void coinControlChangeEdited(const QString &); void coinControlUpdateLabels(); void coinControlClipboardQuantity(); void coinControlClipboardAmount(); void coinControlClipboardFee(); void coinControlClipboardAfterFee(); void coinControlClipboardBytes(); void coinControlClipboardPriority(); void coinControlClipboardLowOutput(); void coinControlClipboardChange(); }; #endif // SENDCOINSDIALOG_H
// // SKTestCase.h // ScrapeKitWorkbench // // Created by Craig Edwards on 27/12/12. // Copyright (c) 2012 BlackDog Foundry. All rights reserved. // #import <GHUnit/GHUnit.h> #import <ScrapeKit/ScrapeKit.h> @interface XXAddress : NSObject @property (nonatomic,strong) NSString *street; @property (nonatomic,strong) NSString *suburb; @property (nonatomic,strong) NSString *state; @property (nonatomic,strong) NSString *postcode; @end @interface XXPhoto : NSObject @property (nonatomic,strong) NSString *title; @property (nonatomic,strong) NSString *url; @end @interface XXHouse : NSObject @property (nonatomic,strong) XXAddress *address; @property (nonatomic) NSInteger bedrooms; @property (nonatomic) NSInteger bathrooms; @property (nonatomic,strong) NSMutableArray *photos; @end @interface SKTestCase : GHTestCase -(void)confirmValid:(NSString *)script; -(void)confirmInvalid:(NSString *)script expectedError:(NSString *)expectedError; -(SKEngine *)runScript:(NSString *)script usingData:(NSString *)data; @end
// // ViewController.h // Lock synchronized // // Created by 许毓方 on 2017/11/27. // Copyright © 2017年 许毓方. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
#pragma once #include <set> #include "Unit.h" #include "Grid.h" class Map { public: Map(/*std::string mapFilePath*/); ~Map() {} unsigned int getIndex(glm::vec2 worldPosition) { return m_grid.getIndex(getPosition(worldPosition)); } glm::uvec2 getPosition(glm::vec2 worldPosition) { glm::uvec2 mapSize = m_grid.getMapSize(); return glm::uvec2((worldPosition.x + 0.5f * m_tileSize * mapSize.x/* - 0.5f * m_tileSize*/) / m_tileSize, (worldPosition.y + 0.5f * m_tileSize * mapSize.y/* - 0.5f * m_tileSize*/) / m_tileSize); } glm::uvec2 getPosition(Unit *unit) { return getPosition(unit->getPosition()); } glm::vec2 getWorldPosition(glm::uvec2 position) { return glm::vec2(position) * m_tileSize - 0.5f * glm::vec2(m_grid.getMapSize()) * m_tileSize + 0.5f * glm::vec2(m_tileSize); } glm::vec2 getWorldPosition(unsigned int index) { return getWorldPosition(m_grid.getPosition(index)); } bool getBlocked(glm::vec2 worldPosition) { return m_grid.getBlocked(getPosition(worldPosition)); } bool getBlocked(glm::vec2 worldPosition, unsigned int size) { return m_grid.getBlocked(getPosition(worldPosition), size); } void setBlocked(glm::vec2 worldPosition, bool blocked) { m_grid.setBlocked(getPosition(worldPosition), blocked); } void setBlocked(glm::vec2 worldPosition, unsigned int size, bool blocked) { m_grid.setBlocked(getPosition(worldPosition), size, blocked); } void init(); void update(float dt); void drawMap(Engine::SpriteBatch &spriteBatch); void draw(Engine::SpriteBatch &spriteBatch); glm::vec4 getBounds(); std::set<Unit*> getUnitsWithin(glm::vec4 rect); void spawn(Unit *unit); void updatePath(Unit *unit); void setPath(Unit *unit, glm::vec2 finalDestination); void setAllNeedsPathUpdate(Unit *currentUnit); private: Grid m_grid; float m_tileSize; /* unsigned int m_playerCapacity; glm::vec2 *m_playerSpawns; */ std::set<Unit*> m_units; };
double getVarianceOfAllR();
//%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. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////////// #ifndef Pegasus_Platform_HPUX_PARISC_ACC_h #define Pegasus_Platform_HPUX_PARISC_ACC_h #ifdef __cplusplus # include <cstddef> #endif #define PEGASUS_OS_TYPE_UNIX #define PEGASUS_OS_HPUX #define PEGASUS_COMPILER_ACC #define PEGASUS_UINT64 unsigned long long #define PEGASUS_SINT64 long long #define PEGASUS_ARCHITECTURE_PARISC #define PEGASUS_HAVE_TEMPLATE_SPECIALIZATION #define PEGASUS_MAXHOSTNAMELEN 256 #ifdef PEGASUS_INTERNALONLY typedef int streamsize; #endif #define PEGASUS_HAVE_PTHREADS #define PEGASUS_HAVE_NANOSLEEP #define PEGASUS_HAS_SIGNALS #define PEGASUS_INTEGERS_BOUNDARY_ALIGNED /* use POSIX read-write locks on this platform */ #define PEGASUS_USE_POSIX_RWLOCK #endif /* Pegasus_Platform_HPUX_PARISC_ACC_h */
#ifndef _WIN_S_STARTUP_ #define _WIN_S_STARTUP_ #include <_type/type.h> #include <_type/type.screen.gadget.h> class _startupScreen : public _gadgetScreen { private: _gadget* winLogoGadget; static _constBitmap winLogo; static _callbackReturn refreshHandler( _event ); public: //! Ctor _startupScreen( _u8 bgId , _style&& style = _style() ); //! Dtor virtual ~_startupScreen(){ delete this->winLogoGadget; } }; #endif
// // Copyright (c) 2008-2019 the Urho3D project. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once #ifdef URHO3D_IS_BUILDING #include "Urho3D.h" #else #include <Urho3D/Urho3D.h> #endif #include "../Container/Allocator.h" #include "../Container/Swap.h" namespace Urho3D { /// Doubly-linked list node base class. struct ListNodeBase { /// Construct. ListNodeBase() : prev_(nullptr), next_(nullptr) { } /// Previous node. ListNodeBase* prev_; /// Next node. ListNodeBase* next_; }; /// Doubly-linked list iterator base class. struct ListIteratorBase { /// Construct. ListIteratorBase() : ptr_(nullptr) { } /// Construct with a node pointer. explicit ListIteratorBase(ListNodeBase* ptr) : ptr_(ptr) { } /// Test for equality with another iterator. bool operator ==(const ListIteratorBase& rhs) const { return ptr_ == rhs.ptr_; } /// Test for inequality with another iterator. bool operator !=(const ListIteratorBase& rhs) const { return ptr_ != rhs.ptr_; } /// Go to the next node. void GotoNext() { if (ptr_) ptr_ = ptr_->next_; } /// Go to the previous node. void GotoPrev() { if (ptr_) ptr_ = ptr_->prev_; } /// Node pointer. ListNodeBase* ptr_; }; /// Doubly-linked list base class. class URHO3D_API ListBase { public: /// Construct. ListBase() : head_(nullptr), tail_(nullptr), allocator_(nullptr), size_(0) { } /// Swap with another linked list. void Swap(ListBase& rhs) { Urho3D::Swap(head_, rhs.head_); Urho3D::Swap(tail_, rhs.tail_); Urho3D::Swap(allocator_, rhs.allocator_); Urho3D::Swap(size_, rhs.size_); } protected: /// Head node pointer. ListNodeBase* head_; /// Tail node pointer. ListNodeBase* tail_; /// Node allocator. AllocatorBlock* allocator_; /// Number of nodes. unsigned size_; }; }
#pragma once #include <sys/user.h> #include "ProgRuntimeHandler.h" #include "DeviceHandlerFactory.h" #include "Log.h" #include <map> using namespace std; class ProgRuntimeDispatcher { public: ProgRuntimeDispatcher(DeviceHandlerFactory &deviceHandlerFactory); bool Init(pid_t pid, bool isExec); bool Spin(); private: map<pid_t, ProgRuntimeHandler*> _runtimeInfo; int _numberOfProcesses; DeviceHandlerFactory &_deviceHandlerFactory; const Log _log; ProgRuntimeHandler *GetOrAdd(pid_t pid, int status); void Drop(pid_t pid); bool Step(); };
#ifndef __MEX_CLASS_HANDLE_H__ #define __MEX_CLASS_HANDLE_H__ #include <typeinfo> #include <string> #include <cstring> #include <stdint.h> #include "mex.h" #define MEX_OBJECT_HANDLE_SIGNATURE 0x434d544d namespace MEX { template<class BaseClass> class ObjectHandle { public: static mxArray* share(BaseClass* ptr) { return toMxArray(ptr, false); } static mxArray* wrap(BaseClass* ptr) { return toMxArray(ptr, true); } static BaseClass* unwrap(const mxArray *in) { ObjectHandle* handle = fromValidMxArray(in); return handle->getPointer(); } static bool validate(const mxArray *in) { ObjectHandle* handle = fromMxArray(in); if(!handle) return false; return handle->isValid(); } static void free(const mxArray *in) { delete fromValidMxArray(in); } private: ObjectHandle(BaseClass* pointer, bool owner) : mPointer(pointer), mName(typeid(BaseClass).name()), mSignature(MEX_OBJECT_HANDLE_SIGNATURE), mOwner(owner) { if(mOwner) mexLock(); } ~ObjectHandle() { mSignature = 0; if(mOwner) { delete mPointer; mexUnlock(); } } bool isValid() { if(mSignature != MEX_OBJECT_HANDLE_SIGNATURE) { mexWarnMsgIdAndTxt("mexWrapper:ObjectHandle:signature", "Invalid signature."); } if(strcmp(mName.c_str(), typeid(BaseClass).name())){ mexWarnMsgIdAndTxt("mexWrapper:ObjectHandle:classMissmatch", "Class mismatch '%s' should be '%s'.", typeid(BaseClass).name(), mName.c_str()); } return ((mSignature == MEX_OBJECT_HANDLE_SIGNATURE) && !strcmp(mName.c_str(), typeid(BaseClass).name())); } BaseClass* getPointer() { return mPointer; } static mxArray* toMxArray(BaseClass* ptr, bool owner) { mxArray *out = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL); *((uint64_t *)mxGetData(out)) = reinterpret_cast<uint64_t>(new ObjectHandle<BaseClass>(ptr, owner)); return out; } static ObjectHandle* fromValidMxArray(const mxArray * in) { ObjectHandle* handle = fromMxArray(in); if(!handle) mexErrMsgIdAndTxt("MEX:ObjectHandle:notAHandle", "Handle must be a real uint64 scalar."); if (!handle->isValid()) mexErrMsgIdAndTxt("MEX:ObjectHandle:invalidHandle", "Handle is not valid."); return handle; } static ObjectHandle* fromMxArray(const mxArray *in) { if (mxGetNumberOfElements(in) != 1 || !mxIsUint64(in) || mxIsComplex(in)) return NULL; return reinterpret_cast<ObjectHandle<BaseClass> *>(*((uint64_t*) mxGetData(in))); } uint32_t mSignature; const std::string mName; BaseClass* const mPointer; const bool mOwner; }; } #endif
#import <UIKit/UIKit.h> #import "RouteObject.h" #import <CoreLocation/CoreLocation.h> #import "LKBadgeView.h" #import <Parse/Parse.h> #import "FBfriend.h" #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) @class ParseStarterProjectViewController; @interface ParseStarterProjectAppDelegate : NSObject <UIApplicationDelegate,CLLocationManagerDelegate,PF_FBRequestDelegate,UIAlertViewDelegate> { UIBackgroundTaskIdentifier bgTask; } //@property (nonatomic,retain) PFObject* nearbyGymObject; @property (nonatomic,retain) NSMutableArray* pushedNotifications; @property (retain, nonatomic) CLLocationManager* locationManager; @property (retain, nonatomic) CLLocation* currentLocation; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic,retain) LKBadgeView* badgeView; //@property (nonatomic, retain) NSString* fbphotoid; //@property (nonatomic, retain) NSString* uploadDescription; //@property (nonatomic, retain) NSString* uploadLocation; //@property (nonatomic, retain) NSString* uploadDifficultydesc; //@property (nonatomic,retain)PFGeoPoint* uploadGeopoint; //@property (nonatomic) BOOL wasUploading; //@property (nonatomic) BOOL isPage; //@property (nonatomic) BOOL isFacebookUpload; //@property (nonatomic, retain) NSData* imageData; //@property (nonatomic, retain) NSData* thumbImageData; //@property (nonatomic, retain) NSMutableArray* usersrecommended; //@property (nonatomic) int difficultyint; //@property (nonatomic, retain) NSArray* recommendArray; //currentusers - //email //name //profilepicture //@property (nonatomic, retain) NSString* uploadDescription; - (void)subscribeFinished:(NSNumber *)result error:(NSError *)error; @end
// Copyright (C) 2002-2011 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __E_DEBUG_SCENE_TYPES_H_INCLUDED__ #define __E_DEBUG_SCENE_TYPES_H_INCLUDED__ namespace irr { namespace scene { //! An enumeration for all types of debug data for built-in scene nodes (flags) enum E_DEBUG_SCENE_TYPE { //! No Debug Data ( Default ) EDS_OFF = 0, //! Show Bounding Boxes of SceneNode EDS_BBOX = 1, //! Show Vertex Normals EDS_NORMALS = 2, //! Shows Skeleton/Tags EDS_SKELETON = 4, //! Overlays Mesh Wireframe EDS_MESH_WIRE_OVERLAY = 8, //! Temporary use transparency Material Type EDS_HALF_TRANSPARENCY = 16, //! Show Bounding Boxes of all MeshBuffers EDS_BBOX_BUFFERS = 32, //! EDS_BBOX | EDS_BBOX_BUFFERS EDS_BBOX_ALL = EDS_BBOX | EDS_BBOX_BUFFERS, //! Show all debug infos EDS_FULL = 0xffffffff }; } // end namespace scene } // end namespace irr #endif // __E_DEBUG_SCENE_TYPES_H_INCLUDED__
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_environment_w32_execv_10.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-10.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: environment Read input from an environment variable * GoodSource: Fixed string * Sink: w32_execv * BadSink : execute command with execv * Flow Variant: 10 Control flow: if(globalTrue) and if(globalFalse) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #include <process.h> #define EXECV _execv #ifndef OMITBAD void CWE78_OS_Command_Injection__char_environment_w32_execv_10_bad() { char * data; char dataBuffer[100] = ""; data = dataBuffer; if(globalTrue) { { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 100-dataLen-1); } } } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the globalTrue to globalFalse */ static void goodG2B1() { char * data; char dataBuffer[100] = ""; data = dataBuffer; if(globalFalse) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBuffer[100] = ""; data = dataBuffer; if(globalTrue) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } void CWE78_OS_Command_Injection__char_environment_w32_execv_10_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_environment_w32_execv_10_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_environment_w32_execv_10_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#pragma once #include <memory> class EXPOSE_API MainThreadFence { public: MainThreadFence(std::weak_ptr<class MainThreadActionGroupInfo> inGroupInfo); MainThreadFence(); public: /* Call to lock the main thread controlled by this fence */ void LockThread(); /* Call to release the main thread controlled by this fence */ void ReleaseThread(); /* Check whether this fence is valid */ FORCEINLINE bool IsValid(); private: // the ptr to the main thread action group info std::weak_ptr<class MainThreadActionGroupInfo> r_groupInfoRelatived; // the death flag of the fence bool c_deathFlag; };
#pragma once #include "ViewportRenderer.h" #include <EtCore/Content/AssetPointer.h> #include <Engine/Graphics/Shader.h> //--------------------------------- // TestRenderer // // Renders a Scene to the viewport - #todo: fully merge with render pipeline // class TestRenderer final : public I_ViewportRenderer { // construct destruct //-------------------- private: TestRenderer() : I_ViewportRenderer() {} virtual ~TestRenderer() = default; // Viewport Renderer Interface //----------------------------- protected: std::type_info const& GetType() const override { return typeid(TestRenderer); } void OnInit() override; void OnDeinit() override; void OnResize(ivec2 const dim) override {} void OnRender(T_FbLoc const targetFb) override; // Data /////// private: vec3 m_ClearColor; T_ArrayLoc m_Vao; T_BufferLoc m_Vbo; AssetPtr<ShaderData> m_Shader; };
// // FLTimeoutTests.h // FishLampCoreTests // // Created by Mike Fullerton on 11/14/12. // Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton. // The FishLamp Framework is released under the MIT License: http://fishlamp.com/license // #import "FLTestable.h" #import "FLTimer.h" @interface FLTimeoutTests : FLTestable<FLTimerDelegate> { @private BOOL _didTimeout; } @end
//! Exemple : STORE R00, #2 Instruction text[] = { // type cop imm ind regcond operand //------------------------------------------------------------- {.instr_immediate = {STORE, true, false, 0, 2 }}, // 2 }; //! Taille utile du programme const unsigned textsize = sizeof(text) / sizeof(Instruction); //! Premier exemple de segment de données initial Word data[20] = { 10, // 0: premier opérande 5, // 1: second opérande 20, // 2: résultat 0, // 3 }; //! Fin de la zone de données utiles const unsigned dataend = 5; //! Taille utile du segment de données const unsigned datasize = sizeof(data) / sizeof(Word);
// // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** Implements a wrapper for a single Vulkan fence. Implemented in order to: * * - simplify life-time management of fences. * - simplify fence usage. * - let ObjectTracker detect leaking fence instances. * * The wrapper is NOT thread-safe. **/ #ifndef WRAPPERS_FENCE_H #define WRAPPERS_FENCE_H #include "misc/debug_marker.h" #include "misc/types.h" namespace Anvil { /* Wrapper class for Vulkan fences */ class Fence : public DebugMarkerSupportProvider<Fence> { public: /* Public functions */ /** Destructor. * * Destroys the Vulkan counterpart and unregister the wrapper instance from the object tracker. **/ virtual ~Fence(); /** Creates a new Fence instance. * * Creates a single Vulkan fence instance and registers the object in Object Tracker. * * @param in_device_ptr Device to use. * @param in_create_signalled true if the fence should be created as a signalled entity. * False to make it unsignalled at creation time. */ static std::shared_ptr<Fence> create(std::weak_ptr<Anvil::BaseDevice> in_device_ptr, bool in_create_signalled); /** Retrieves a raw handle to the underlying Vulkan fence instance */ VkFence get_fence() const { return m_fence; } /** Retrieves a pointer to the raw handle to the underlying Vulkan fence instance */ const VkFence* get_fence_ptr() { m_possibly_set = true; return &m_fence; } /** Tells whether the fence is signalled at the time of the call. * * @return true if the fence is set, false otherwise. **/ bool is_set() const; /** Resets the specified Vulkan Fence, if set. If the fence is not set, this function is a nop. * * @return true if the function executed successfully, false otherwise. **/ bool reset(); /** Resets the specified number of Vulkan fences. * * This function is expected to be more efficient than calling reset() for @param in_n_fences * times, assuming @param in_n_fences is larger than 1. * * @param in_n_fences Number of Fence instances accessible under @param in_fences. * @param in_fences An array of @param in_n_fences Fence instances to reset. Must not be nullptr, * unless @param in_n_fences is 0. * * @return true if the function executed successfully, false otherwise. **/ static bool reset_fences(const uint32_t in_n_fences, Fence* in_fences); private: /* Private functions */ /** Constructor. * * Please see documentation of create() for specification */ Fence(std::weak_ptr<Anvil::BaseDevice> in_device_ptr, bool in_create_signalled); Fence (const Fence&); Fence& operator=(const Fence&); void release_fence(); /* Private variables */ std::weak_ptr<Anvil::BaseDevice> m_device_ptr; VkFence m_fence; bool m_possibly_set; }; }; /* namespace Anvil */ #endif /* WRAPPERS_FENCE_H */
// // GMKeyboardHandler.h // MobileWorkbenchPhone // // Created by Mike Bobiney on 2/2/13. // Copyright (c) 2013 General Motors. All rights reserved. // #import <Foundation/Foundation.h> @protocol TTAKeyboardHandlerDelegate - (void)keyboardSizeChanged:(CGSize)delta; @end @interface TTAKeyboardHandler : NSObject @property(nonatomic, weak) id<TTAKeyboardHandlerDelegate> delegate; @property(nonatomic) CGRect frame; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53c.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-53c.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sink: w32_spawnv * BadSink : execute command with spawnv * 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> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #include <process.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53d_badSink(char * data); void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53c_badSink(char * data) { CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53d_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53d_goodG2BSink(char * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53c_goodG2BSink(char * data) { CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_53d_goodG2BSink(data); } #endif /* OMITGOOD */
// intel_tsx.h // #pragma once #include "annotations.h" #define _XBEGIN_STARTED (~0u) #define _XABORT_EXPLICIT (1 << 0) #define _XABORT_RETRY (1 << 1) #define _XABORT_CONFLICT (1 << 2) #define _XABORT_CAPACITY (1 << 3) #define _XABORT_DEBUG (1 << 4) #define _XABORT_NESTED (1 << 5) #define _XABORT_CODE(x) (((x) >> 24) & 0xff) static THREE_ATTR_INLINE_ALWAYS unsigned int _xbegin(void) { unsigned int ret = _XBEGIN_STARTED; __asm__ volatile (".byte 0xc7, 0xf8; .long 0" : "+a" (ret) :: "memory"); return ret; } static THREE_ATTR_INLINE_ALWAYS void _xend(void) { __asm__ volatile (".byte 0x0f, 0x01, 0xd5" ::: "memory"); } #define _xabort(status) __asm__ volatile (".byte 0xc6, 0xf8, %P0" :: "i" (status) : "memory") static THREE_ATTR_INLINE_ALWAYS unsigned char _xtest(void) { unsigned char out; __asm__ volatile (".byte 0x0f, 0x01, 0xd6; setnz %0" : "=r" (out) :: "memory"); return out; }
// // LMTextFieldCell.h // LMTextView // // Created by Micha Mazaheri on 4/11/13. // Copyright (c) 2013 Lucky Marmot. All rights reserved. // #import <Cocoa/Cocoa.h> @interface LMTextFieldCell : NSTextFieldCell @end
#include "nv.h" // // NV_ID // NV_ID NV_ID_generateRandom() { NV_ID id; id.d[0] = rand(); id.d[1] = rand(); id.d[2] = rand(); id.d[3] = rand(); return id; } /* //int idnum = 1; //NV_ID NV_ID_generateRandom() { NV_ID id; id.d[0] = idnum++; id.d[1] = 0; id.d[2] = 0; id.d[3] = 0; return id; } */ int NV_ID_setFromString(NV_ID *id, const char *s) { int i, k, c; uint32_t buf[4]; if(!s || !id) return 1; for(i = 0; i < 4; i++){ buf[i] = 0; for(k = 0; k < 8; k++){ buf[i] <<= 4; c = toupper(s[i * 8 + k]); if('0' <= c && c <= '9'){ c -= '0'; } else if('A' <= c && c <= 'F'){ c -= 'A' - 0x0A; } else{ return 1; } buf[i] |= c; } } for(i = 0; i < 4; i++){ id->d[i] = buf[i]; } return 0; } void NV_ID_dumpIDToFile(const NV_ID *id, FILE *fp) { int i; for(i = 0; i < 4; i++){ fprintf(fp, "%08X", id->d[i]); } }
// // IMOStyledCellKeys.h // IMOStyledTableViewControllerDemo // // Created by Frederic Cormier on 21/03/13. // Copyright (c) 2013 Frederic Cormier. All rights reserved. // #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) #define IMOStyledCellDisclosureImageName @"disclosure" #define IMOStyledCellCheckmarkImageName @"checkmark" //#define IMOStyledCellRoundedGroupedCellIOS6Style NO #define IPAD_SCREEN_SIZE(r) (r.size.width == 768 || r.size.width == 1024) #import <Foundation/Foundation.h> typedef enum { IMOStyledCellPositionTop, IMOStyledCellPositionMiddle, IMOStyledCellPositionBottom, IMOStyledCellPositionSingle, IMOStyledCellPositionPlain } IMOStyledCellPosition; typedef enum { IMOStyledCellStyleDefault, IMOStyledCellStyleValue1, IMOStyledCellStyleValue2, IMOStyledCellStyleSubtitle, IMOStyledCellStyleNeverMind = IMOStyledCellStyleDefault } IMOStyledCellStyle; typedef enum { IMOStyledCellTypeUnknown, IMOStyledCellTypeColor, IMOStyledCellTypeFont, IMOStyledCellTypeSize, IMOStyledCellTypeBool, IMOStyledCellTypeImage } IMOStyledParserDataType; //Keys extern NSString * const IMOStyledCellRoundedGroupedCellIOS6StyleKey; extern NSString * const IMOStyledCellNavBarTintColorKey; extern NSString * const IMOStyledCellTopSeparatorColorKey; extern NSString * const IMOStyledCellBottomSeparatorColorKey; extern NSString * const IMOStyledCellBackgroundImageKey; extern NSString * const IMOStyledCellBackgroundColorKey; extern NSString * const IMOStyledCellTopGradientColorKey; extern NSString * const IMOStyledCellBottomGradientColorKey; extern NSString * const IMOStyledCellSelectedTopGradientColorKey; extern NSString * const IMOStyledCellSelectedBottomGradientColorKey; extern NSString * const IMOStyledCellTextLabelTextColorKey; extern NSString * const IMOStyledCellDetailTextLabelTextColorKey; extern NSString * const IMOStyledCellTextLabelFontKey; extern NSString * const IMOStyledCellDetailTextLabelFontKey; extern NSString * const IMOStyledCellUseCustomHeaderKey; extern NSString * const IMOStyledCellHeaderFontKey; extern NSString * const IMOStyledCellHeaderTextColorKey; extern NSString * const IMOStyledCellUseCustomFooterKey; extern NSString * const IMOStyledCellFooterFontKey; extern NSString * const IMOStyledCellFooterTextColorKey; extern NSString * const IMOStyledCellTextFieldFontKey; extern NSString * const IMOStyledCellTextFieldTextColorKey; extern NSString * const IMOStyledCellTextCaptionFontKey; extern NSString * const IMOStyledCellTextCaptionTextColorKey; extern NSString * const IMOStyledCellNoteViewFontKey; extern NSString * const IMOStyledCellNoteViewTextColorKey; extern NSString * const IMOStyledCellNoteViewLineColorKey; extern NSString * const IMOStyledCellPlaceHolderFontKey; extern NSString * const IMOStyledCellPlaceHolderTextColorKey; @interface IMOStyledCellKeys : NSObject + (IMOStyledCellKeys *)sharedManager; - (BOOL)isValidKey:(NSString *)aKey; - (NSInteger)arityForKey:(NSString *)key; - (IMOStyledParserDataType)argumentTypeAtPosition:(NSInteger)position forKey:(NSString *)key; @end
// // CKInternalAppInstallDownloadingTableViewCell.h // Pods // // Created by mac on 15/9/11. // // #import <UIKit/UIKit.h> #import "CKBaseDownloadingTableViewCellProtocol.h" #import "CKInternalAppInstallBaseTableViewCell.h" @interface CKInternalAppInstallDownloadingTableViewCell : CKInternalAppInstallBaseTableViewCell<CKBaseDownloadingTableViewCellProtocol> //task download progress @property(nonatomic,weak) IBOutlet id<CKDownloadProgressViewProtocol> downloadProgress; //task status , downloading , pasue , wait and so on @property(nonatomic,weak) IBOutlet UILabel * lblDownloadStatus; //download rest time @property(nonatomic,weak) IBOutlet UILabel * lblRestTime; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__CWE131.label.xml Template File: sources-sink-34.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate memory without using sizeof(int) * GoodSource: Allocate memory using sizeof(int) * Sinks: memcpy * BadSink : Copy array to data using memcpy() * 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" typedef union { int * unionFirst; int * unionSecond; } CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34_unionType; #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34_bad() { int * data; CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34_unionType myUnion; data = NULL; /* FLAW: Allocate memory without using sizeof(int) */ data = (int *)malloc(10); myUnion.unionFirst = data; { int * data = myUnion.unionSecond; { int source[10] = {0}; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ memcpy(data, source, 10*sizeof(int)); printIntLine(data[0]); free(data); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { int * data; CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34_unionType myUnion; data = NULL; /* FIX: Allocate memory using sizeof(int) */ data = (int *)malloc(10*sizeof(int)); myUnion.unionFirst = data; { int * data = myUnion.unionSecond; { int source[10] = {0}; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ memcpy(data, source, 10*sizeof(int)); printIntLine(data[0]); free(data); } } } void CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_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()..."); CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_34_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/***************************************************************************** * mod_vhosts.h: Simple HTTP module ***************************************************************************** * Copyright (C) 2016-2017 * * Authors: Marc Chalain <marc.chalain@gmail.com * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject * to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef __MOD_VHOST_H__ #define __MOD_VHOST_H__ typedef struct mod_vhost_s mod_vhost_t; #include "ouistiti.h" #ifdef __cplusplus extern "C" { #endif extern const module_t mod_vhost; #ifdef __cplusplus } #endif #endif
// Copyright (c) 2018 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef SHELL_BROWSER_COOKIE_CHANGE_NOTIFIER_H_ #define SHELL_BROWSER_COOKIE_CHANGE_NOTIFIER_H_ #include <memory> #include "base/callback_list.h" #include "base/macros.h" #include "mojo/public/cpp/bindings/receiver.h" #include "net/cookies/cookie_change_dispatcher.h" #include "services/network/public/mojom/cookie_manager.mojom.h" namespace electron { class ElectronBrowserContext; // Sends cookie-change notifications on the UI thread. class CookieChangeNotifier : public network::mojom::CookieChangeListener { public: explicit CookieChangeNotifier(ElectronBrowserContext* browser_context); ~CookieChangeNotifier() override; // Register callbacks that needs to notified on any cookie store changes. base::CallbackListSubscription RegisterCookieChangeCallback( const base::RepeatingCallback<void(const net::CookieChangeInfo& change)>& cb); private: void StartListening(); void OnConnectionError(); // network::mojom::CookieChangeListener implementation. void OnCookieChange(const net::CookieChangeInfo& change) override; ElectronBrowserContext* browser_context_; base::RepeatingCallbackList<void(const net::CookieChangeInfo& change)> cookie_change_sub_list_; mojo::Receiver<network::mojom::CookieChangeListener> receiver_; DISALLOW_COPY_AND_ASSIGN(CookieChangeNotifier); }; } // namespace electron #endif // SHELL_BROWSER_COOKIE_CHANGE_NOTIFIER_H_
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: ./core/src/java/org/apache/lucene/index/SegmentMerger.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_OrgApacheLuceneIndexSegmentMerger") #ifdef RESTRICT_OrgApacheLuceneIndexSegmentMerger #define INCLUDE_ALL_OrgApacheLuceneIndexSegmentMerger 0 #else #define INCLUDE_ALL_OrgApacheLuceneIndexSegmentMerger 1 #endif #undef RESTRICT_OrgApacheLuceneIndexSegmentMerger #if __has_feature(nullability) #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wnullability" #pragma GCC diagnostic ignored "-Wnullability-completeness" #endif #if !defined (OrgApacheLuceneIndexSegmentMerger_) && (INCLUDE_ALL_OrgApacheLuceneIndexSegmentMerger || defined(INCLUDE_OrgApacheLuceneIndexSegmentMerger)) #define OrgApacheLuceneIndexSegmentMerger_ @class OrgApacheLuceneIndexFieldInfos_FieldNumbers; @class OrgApacheLuceneIndexMergeState; @class OrgApacheLuceneIndexSegmentInfo; @class OrgApacheLuceneStoreDirectory; @class OrgApacheLuceneStoreIOContext; @class OrgApacheLuceneUtilInfoStream; @protocol JavaUtilList; /*! @brief The SegmentMerger class combines two or more Segments, represented by an IndexReader, into a single Segment.Call the merge method to combine the segments. - seealso: #merge */ @interface OrgApacheLuceneIndexSegmentMerger : NSObject { @public OrgApacheLuceneIndexMergeState *mergeState_; } #pragma mark Public - (void)mergeFieldInfos; #pragma mark Package-Private - (instancetype __nonnull)initPackagePrivateWithJavaUtilList:(id<JavaUtilList>)readers withOrgApacheLuceneIndexSegmentInfo:(OrgApacheLuceneIndexSegmentInfo *)segmentInfo withOrgApacheLuceneUtilInfoStream:(OrgApacheLuceneUtilInfoStream *)infoStream withOrgApacheLuceneStoreDirectory:(OrgApacheLuceneStoreDirectory *)dir withOrgApacheLuceneIndexFieldInfos_FieldNumbers:(OrgApacheLuceneIndexFieldInfos_FieldNumbers *)fieldNumbers withOrgApacheLuceneStoreIOContext:(OrgApacheLuceneStoreIOContext *)context; /*! @brief Merges the readers into the directory passed to the constructor @return The number of documents that were merged @throw CorruptIndexExceptionif the index is corrupt @throw IOExceptionif there is a low-level IO error */ - (OrgApacheLuceneIndexMergeState *)merge; /*! @brief True if any merging should happen */ - (jboolean)shouldMerge; // Disallowed inherited constructors, do not use. - (instancetype __nonnull)init NS_UNAVAILABLE; @end J2OBJC_EMPTY_STATIC_INIT(OrgApacheLuceneIndexSegmentMerger) J2OBJC_FIELD_SETTER(OrgApacheLuceneIndexSegmentMerger, mergeState_, OrgApacheLuceneIndexMergeState *) FOUNDATION_EXPORT void OrgApacheLuceneIndexSegmentMerger_initPackagePrivateWithJavaUtilList_withOrgApacheLuceneIndexSegmentInfo_withOrgApacheLuceneUtilInfoStream_withOrgApacheLuceneStoreDirectory_withOrgApacheLuceneIndexFieldInfos_FieldNumbers_withOrgApacheLuceneStoreIOContext_(OrgApacheLuceneIndexSegmentMerger *self, id<JavaUtilList> readers, OrgApacheLuceneIndexSegmentInfo *segmentInfo, OrgApacheLuceneUtilInfoStream *infoStream, OrgApacheLuceneStoreDirectory *dir, OrgApacheLuceneIndexFieldInfos_FieldNumbers *fieldNumbers, OrgApacheLuceneStoreIOContext *context); FOUNDATION_EXPORT OrgApacheLuceneIndexSegmentMerger *new_OrgApacheLuceneIndexSegmentMerger_initPackagePrivateWithJavaUtilList_withOrgApacheLuceneIndexSegmentInfo_withOrgApacheLuceneUtilInfoStream_withOrgApacheLuceneStoreDirectory_withOrgApacheLuceneIndexFieldInfos_FieldNumbers_withOrgApacheLuceneStoreIOContext_(id<JavaUtilList> readers, OrgApacheLuceneIndexSegmentInfo *segmentInfo, OrgApacheLuceneUtilInfoStream *infoStream, OrgApacheLuceneStoreDirectory *dir, OrgApacheLuceneIndexFieldInfos_FieldNumbers *fieldNumbers, OrgApacheLuceneStoreIOContext *context) NS_RETURNS_RETAINED; FOUNDATION_EXPORT OrgApacheLuceneIndexSegmentMerger *create_OrgApacheLuceneIndexSegmentMerger_initPackagePrivateWithJavaUtilList_withOrgApacheLuceneIndexSegmentInfo_withOrgApacheLuceneUtilInfoStream_withOrgApacheLuceneStoreDirectory_withOrgApacheLuceneIndexFieldInfos_FieldNumbers_withOrgApacheLuceneStoreIOContext_(id<JavaUtilList> readers, OrgApacheLuceneIndexSegmentInfo *segmentInfo, OrgApacheLuceneUtilInfoStream *infoStream, OrgApacheLuceneStoreDirectory *dir, OrgApacheLuceneIndexFieldInfos_FieldNumbers *fieldNumbers, OrgApacheLuceneStoreIOContext *context); J2OBJC_TYPE_LITERAL_HEADER(OrgApacheLuceneIndexSegmentMerger) #endif #if __has_feature(nullability) #pragma clang diagnostic pop #endif #pragma pop_macro("INCLUDE_ALL_OrgApacheLuceneIndexSegmentMerger")
// // ViewController.h // WYScreenshotCatcherDemo // // Created by William on 2014/1/6. // Copyright (c) 2014年 William. All rights reserved. // #import <UIKit/UIKit.h> #import "WYScreenshotCatcher.h" @interface ViewController : UIViewController <WYScreenshotCatcherDelegate> @property (strong, nonatomic) IBOutlet UIImageView *ssImgView; @end