Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Remove unneeded static member decls; mark c'tor, d'tor as deleted.
//--------------------------------------------------------------------*- C++ -*- // CLING - the C++ LLVM-based InterpreterG :) // author: Axel Naumann <axel@cern.ch> // // This file is dual-licensed: you can choose to license it under the University // of Illinois Open Source License or the GNU Lesser General Public License. See // LICENSE.TXT for details. //------------------------------------------------------------------------------ #ifndef CLING_CIFACTORY_H #define CLING_CIFACTORY_H #include "clang/Frontend/CompilerInstance.h" #include "llvm/ADT/StringRef.h" namespace llvm { class LLVMContext; class MemoryBuffer; } namespace clang { class DiagnosticsEngine; } namespace cling { class DeclCollector; class CIFactory { public: // TODO: Add overload that takes file not MemoryBuffer static clang::CompilerInstance* createCI(llvm::StringRef code, int argc, const char* const *argv, const char* llvmdir); static clang::CompilerInstance* createCI(llvm::MemoryBuffer* buffer, int argc, const char* const *argv, const char* llvmdir, DeclCollector* stateCollector); private: //--------------------------------------------------------------------- //! Constructor //--------------------------------------------------------------------- CIFactory() {} ~CIFactory() {} static void SetClingCustomLangOpts(clang::LangOptions& Opts); static void SetClingTargetLangOpts(clang::LangOptions& Opts, const clang::TargetInfo& Target); }; } // namespace cling #endif // CLING_CIFACTORY_H
//--------------------------------------------------------------------*- C++ -*- // CLING - the C++ LLVM-based InterpreterG :) // author: Axel Naumann <axel@cern.ch> // // This file is dual-licensed: you can choose to license it under the University // of Illinois Open Source License or the GNU Lesser General Public License. See // LICENSE.TXT for details. //------------------------------------------------------------------------------ #ifndef CLING_CIFACTORY_H #define CLING_CIFACTORY_H #include "clang/Frontend/CompilerInstance.h" #include "llvm/ADT/StringRef.h" namespace llvm { class LLVMContext; class MemoryBuffer; } namespace clang { class DiagnosticsEngine; } namespace cling { class DeclCollector; class CIFactory { public: // TODO: Add overload that takes file not MemoryBuffer static clang::CompilerInstance* createCI(llvm::StringRef code, int argc, const char* const *argv, const char* llvmdir); static clang::CompilerInstance* createCI(llvm::MemoryBuffer* buffer, int argc, const char* const *argv, const char* llvmdir, DeclCollector* stateCollector); private: //--------------------------------------------------------------------- //! Constructor //--------------------------------------------------------------------- CIFactory() = delete; ~CIFactory() = delete; }; } // namespace cling #endif // CLING_CIFACTORY_H
Remove duplicate members so this compiles again
// // GrowlBezelWindowView.h // Display Plugins // // Created by Jorge Salvador Caffarena on 09/09/04. // Copyright 2004 Jorge Salvador Caffarena. All rights reserved. // #import <Cocoa/Cocoa.h> #import "GrowlNotificationView.h" @interface GrowlBezelWindowView : GrowlNotificationView { NSImage *icon; NSString *title; NSString *text; SEL action; id target; NSColor *textColor; NSColor *backgroundColor; NSLayoutManager *layoutManager; } - (void) setIcon:(NSImage *)icon; - (void) setTitle:(NSString *)title; - (void) setText:(NSString *)text; - (void) setPriority:(int)priority; - (float) descriptionHeight:(NSString *)text attributes:(NSDictionary *)attributes width:(float)width; - (id) target; - (void) setTarget:(id)object; - (SEL) action; - (void) setAction:(SEL)selector; @end
// // GrowlBezelWindowView.h // Display Plugins // // Created by Jorge Salvador Caffarena on 09/09/04. // Copyright 2004 Jorge Salvador Caffarena. All rights reserved. // #import <Cocoa/Cocoa.h> #import "GrowlNotificationView.h" @interface GrowlBezelWindowView : GrowlNotificationView { NSImage *icon; NSString *title; NSString *text; NSColor *textColor; NSColor *backgroundColor; NSLayoutManager *layoutManager; } - (void) setIcon:(NSImage *)icon; - (void) setTitle:(NSString *)title; - (void) setText:(NSString *)text; - (void) setPriority:(int)priority; - (float) descriptionHeight:(NSString *)text attributes:(NSDictionary *)attributes width:(float)width; - (id) target; - (void) setTarget:(id)object; - (SEL) action; - (void) setAction:(SEL)selector; @end
Add more functions for bit manipulation
#pragma once #include <cstdint> inline uint16_t compose_bytes(const uint8_t low, const uint8_t high) { return (high << 8) + low; } inline bool check_bit(const uint8_t value, int bit) { return (value & (1 << bit)) != 0; } inline uint8_t set_bit(const uint8_t value, int bit) { return static_cast<uint8_t>(value | (1 << bit)); }
#pragma once #include "util/log.h" #include <cstdint> inline uint16_t compose_bytes(const uint8_t low, const uint8_t high) { return (high << 8) + low; } inline bool check_bit(const uint8_t value, const int bit) { return (value & (1 << bit)) != 0; } inline uint8_t set_bit(const uint8_t value, const int bit) { return value | (1 << bit); } inline uint8_t clear_bit(const uint8_t value, const int bit) { return value & ~(1 << bit); } inline uint8_t set_bit_to(const uint8_t value, const int bit, bool bit_on) { if (bit_on) { return set_bit(value, bit); } else { return clear_bit(value, bit); } }
Fix clang warning about implicit function declaration
#ifndef LEPTONICA__STDIO_H #define LEPTONICA__STDIO_H #ifndef BUILD_HOST #include <stdio.h> #include <stdint.h> typedef struct cookie_io_functions_t { ssize_t (*read)(void *cookie, char *buf, size_t n); ssize_t (*write)(void *cookie, const char *buf, size_t n); int (*seek)(void *cookie, off_t *pos, int whence); int (*close)(void *cookie); } cookie_io_functions_t; FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t functions); FILE *fmemopen(void *buf, size_t size, const char *mode); FILE *open_memstream(char **buf, size_t *size); #endif #endif /* LEPTONICA__STDIO_H */
#ifndef LEPTONICA__STDIO_H #define LEPTONICA__STDIO_H #ifndef BUILD_HOST #include <stdio.h> #include <stdint.h> typedef struct cookie_io_functions_t { ssize_t (*read)(void *cookie, char *buf, size_t n); ssize_t (*write)(void *cookie, const char *buf, size_t n); int (*seek)(void *cookie, off_t *pos, int whence); int (*close)(void *cookie); } cookie_io_functions_t; FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t functions); FILE *fmemopen(void *buf, size_t size, const char *mode); FILE *open_memstream(char **buf, size_t *size); FILE *__sfp(void); int __sflags(const char *, int *); #endif #endif /* LEPTONICA__STDIO_H */
Remove unused printf from nap
/** * signal.c * * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com> */ #include "signals.h" /** * Run cleanup on SIGHUP or SIGINT. */ void on_signal (int signal) { switch (signal) { case SIGHUP: printf("Caught SIGHUP, hanging up...\n"); break; case SIGINT: printf("Caught SIGINT, terminating...\n"); exit(EXIT_SUCCESS); default: fprintf(stderr, "Caught wrong signal: %d\n", signal); return; } } /** * Run tasks during awake period. */ void on_awake (int signal) { if (signal != SIGALRM) { fprintf(stderr, "Caught wrong signal: %d\n", signal); } } /** * Augmented sleep function for signal handling. */ void nap (int seconds) { struct sigaction action; sigset_t mask; action.sa_handler = &on_awake; action.sa_flags = SA_RESETHAND; sigfillset(&action.sa_mask); sigaction(SIGALRM, &action, NULL); sigprocmask(0, NULL, &mask); sigdelset(&mask, SIGALRM); alarm(seconds); sigsuspend(&mask); printf("nap: sigsuspend returned.\n"); }
/** * signal.c * * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com> */ #include "signals.h" /** * Run cleanup on SIGHUP or SIGINT. */ void on_signal (int signal) { switch (signal) { case SIGHUP: printf("Caught SIGHUP, hanging up...\n"); break; case SIGINT: printf("Caught SIGINT, terminating...\n"); exit(EXIT_SUCCESS); default: fprintf(stderr, "Caught wrong signal: %d\n", signal); return; } } /** * Run tasks during awake period. */ void on_awake (int signal) { if (signal != SIGALRM) { fprintf(stderr, "Caught wrong signal: %d\n", signal); } /** * @todo: Finish building this. */ } /** * Augmented sleep function with signal handling. */ void nap (int seconds) { struct sigaction action; sigset_t mask; action.sa_handler = &on_awake; action.sa_flags = SA_RESETHAND; sigfillset(&action.sa_mask); sigaction(SIGALRM, &action, NULL); sigprocmask(0, NULL, &mask); sigdelset(&mask, SIGALRM); alarm(seconds); sigsuspend(&mask); }
Revert "Silence some unreachable code warnings on MSVC"
#ifndef ALEXCPT_H #define ALEXCPT_H #include <exception> #include <string> #include "AL/alc.h" #ifdef __GNUC__ #define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) #else #define ALEXCPT_FORMAT(x, y, z) #endif namespace al { class backend_exception final : public std::exception { std::string mMessage; ALCenum mErrorCode; public: backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4); const char *what() const noexcept override { return mMessage.c_str(); } ALCenum errorCode() const noexcept { return mErrorCode; } }; } // namespace al #define START_API_FUNC try #ifndef _MSC_VER #define END_API_FUNC catch(...) { std::terminate(); } #else /* VS 2015 complains that some of these catch statements are unreachable code, * due to the function body not able to throw anything. While technically true, * it's preferable to mark API functions just in case that ever changes, so * silence that warning. */ #define END_API_FUNC __pragma(warning(push)) \ __pragma(warning(disable : 4702)) \ catch(...) { std::terminate(); } \ __pragma(warning(pop)) #endif #endif /* ALEXCPT_H */
#ifndef ALEXCPT_H #define ALEXCPT_H #include <exception> #include <string> #include "AL/alc.h" #ifdef __GNUC__ #define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) #else #define ALEXCPT_FORMAT(x, y, z) #endif namespace al { class backend_exception final : public std::exception { std::string mMessage; ALCenum mErrorCode; public: backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4); const char *what() const noexcept override { return mMessage.c_str(); } ALCenum errorCode() const noexcept { return mErrorCode; } }; } // namespace al #define START_API_FUNC try #define END_API_FUNC catch(...) { std::terminate(); } #endif /* ALEXCPT_H */
Add Task 02 for Homework 01
#include <stdio.h> #include <string.h> #define MAX_WORDS 3000 #define STOPPER "vsmisal" struct occurance_t { long hash; unsigned int count; }; long hash(char*); int index_of(char*, struct occurance_t*, int); int main() { int i = 0, temp; char word[200]; struct occurance_t most_common = { 0, 0 }; struct occurance_t words[MAX_WORDS] = { { 0, 0 } }; while (1) { fgets(word, 201, stdin); if (strcmp(word, STOPPER) != 0 && i < MAX_WORDS) { if ((temp = index_of(word, words, i)) != -1) { words[temp].count++; } else { words[i].hash = hash(word); words[i].count = 1; i++; } } else { break; } } temp = 0; for (int j = 0; j < i; j++) { if (words[j].count > temp) { temp = words[j].count; most_common.hash = words[j].hash; most_common.count = words[j].count; } } printf("%d %ld", most_common.count, most_common.hash); return 0; } long hash(char *word) { long result = 42; int length = strlen(word); for (int i = 0; i < length; i++) { result += word[i] * (i + 1); } return result; } int index_of(char *word, struct occurance_t *words, int length) { for (int i = 0; i < length; i++) { if (hash(word) == words[i].hash) { return i; } } return -1; }
Align macro definitions using spaces instead of tabs
// // BoxLog.h // BoxSDK // // Created on 2/21/13. // Copyright (c) 2013 Box. All rights reserved. // #ifndef BoxSDK_BoxLog_h #define BoxSDK_BoxLog_h #ifdef DEBUG #define BOXLogFunction() NSLog(@"%s", __FUNCTION__) #define BOXLog(...) NSLog(@"%s: %@", __FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) #else #define BOXLogFunction(...) #define BOXLog(...) #endif #ifdef DEBUG #define BOXAssert(x, ...) NSAssert(x, @"%s: %@", __FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) #define BOXCAssert(...) NSCAssert(__VA_ARGS__) #define BOXAssert1(...) NSAssert1(__VA_ARGS__) #define BOXAssertFail(...) BOXAssert(NO, __VA_ARGS__) #define BOXAbstract() BOXAssertFail(@"Must be overridden by subclass.") #else #define BOXAssert(...) #define BOXCAssert(...) #define BOXAssert1(...) #define BOXAssertFail(...) #define BOXAbstract() #endif #endif
// // BoxLog.h // BoxSDK // // Created on 2/21/13. // Copyright (c) 2013 Box. All rights reserved. // #ifndef BoxSDK_BoxLog_h #define BoxSDK_BoxLog_h #ifdef DEBUG #define BOXLogFunction() NSLog(@"%s", __FUNCTION__) #define BOXLog(...) NSLog(@"%s: %@", __FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) #else #define BOXLogFunction(...) #define BOXLog(...) #endif #ifdef DEBUG #define BOXAssert(x, ...) NSAssert(x, @"%s: %@", __FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) #define BOXCAssert(...) NSCAssert(__VA_ARGS__) #define BOXAssert1(...) NSAssert1(__VA_ARGS__) #define BOXAssertFail(...) BOXAssert(NO, __VA_ARGS__) #define BOXAbstract() BOXAssertFail(@"Must be overridden by subclass.") #else #define BOXAssert(...) #define BOXCAssert(...) #define BOXAssert1(...) #define BOXAssertFail(...) #define BOXAbstract() #endif #endif
Allow test app to recieve as many file inputs as possible. On branch master Your branch is up-to-date with 'github/master'.
/*! @file main.c @brief A simple test program for the C library code. */ #include "stdio.h" #include "verilog_parser.h" int main(int argc, char ** argv) { if(argc != 2) { printf("ERROR. Please supply exactly one file path argument.\n"); return 1; } else { // Load the file. FILE * fh = fopen(argv[1], "r"); // Instance the parser. verilog_parser parser = verilog_file_parse(fh); // Parse the file and store the result. int result = verilog_parse_buffer(parser); fclose(fh); if(result == 0) { printf("Parse successful\n"); return 0; } else { printf("Parse failed\n"); return 1; } } return 0; }
/*! @file main.c @brief A simple test program for the C library code. */ #include "stdio.h" #include "verilog_parser.h" int main(int argc, char ** argv) { if(argc < 2) { printf("ERROR. Please supply at least one file path argument.\n"); return 1; } else { int F = 0; for(F = 1; F < argc; F++) { // Load the file. FILE * fh = fopen(argv[F], "r"); // Instance the parser. verilog_parser parser = verilog_file_parse(fh); // Parse the file and store the result. int result = verilog_parse_buffer(parser); verilog_free_parser(parser); fclose(fh); if(result == 0) { printf("Parse successful for %s\n",argv[F]); } else { printf("Parse failed for %s\n",argv[F]); return 1; } } } return 0; }
Rename HEADER_H_ marco -> PROT_H_
#ifndef HEADER_H_ #define HEADER_H_ #include <stdint.h> #include <stddef.h> // * Header * // // | 1 byte | // | 2 bytes ....... | // | 4 bytes ......................... | // // |--------|--------|--------|--------| // | Flags |Version |Padding | // |--------|--------|--------|--------| // | Frame size (incl header) | // |-----------------------------------| // | CRC32 | // |-----------------------------------| // End of header // |--------|--------|--------|--------| // | Payload | // | ... | // |--------|--------|--------|--------| struct header { uint16_t flags; uint8_t version; uint8_t pad; // not used uint32_t size; uint32_t crc32; }; #define HEADER_FLAGS_EMPTY 0x00 #define HEADER_FLAGS_READY 0xbeef // marks that the header and payload // is ready to be consumed #define HEADER_VERSION 0x0 #define HEADER_PAD 0x0 struct frame { const struct header* hdr; const unsigned char* buffer; }; void header_init(struct header*); size_t frame_payload_size(const struct frame*); #endif
#ifndef PROT_H_ #define PROT_H_ #include <stdint.h> #include <stddef.h> // * Header * // // | 1 byte | // | 2 bytes ....... | // | 4 bytes ......................... | // // |--------|--------|--------|--------| // | Flags |Version |Padding | // |--------|--------|--------|--------| // | Frame size (incl header) | // |-----------------------------------| // | CRC32 | // |-----------------------------------| // End of header // |--------|--------|--------|--------| // | Payload | // | ... | // |--------|--------|--------|--------| struct header { uint16_t flags; uint8_t version; uint8_t pad; // not used uint32_t size; uint32_t crc32; }; #define HEADER_FLAGS_EMPTY 0x00 #define HEADER_FLAGS_READY 0xbeef // marks that the header and payload // is ready to be consumed #define HEADER_VERSION 0x0 #define HEADER_PAD 0x0 struct frame { const struct header* hdr; const unsigned char* buffer; }; void header_init(struct header*); size_t frame_payload_size(const struct frame*); #endif
Add battery-backed RAM constants for npcx
/* Copyright 2021 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef ZEPHYR_SHIM_INCLUDE_BBRAM_H_ #define ZEPHYR_SHIM_INCLUDE_BBRAM_H_ /** * Layout of the battery-backed RAM region. * TODO (b:178807203) Migrate these values to devicetree registers. */ enum bbram_data_index { /** General-purpose scratchpad */ BBRM_DATA_INDEX_SCRATCHPAD = 0, /** Saved reset flags */ BBRM_DATA_INDEX_SAVED_RESET_FLAGS = 4, /** Wake reasons for hibernate */ BBRM_DATA_INDEX_WAKE = 8, /** USB-PD saved port0 state */ BBRM_DATA_INDEX_PD0 = 12, /** USB-PD saved port1 state */ BBRM_DATA_INDEX_PD1 = 13, /** Vboot EC try slot */ BBRM_DATA_INDEX_TRY_SLOT = 14, /** USB-PD saved port2 state */ BBRM_DATA_INDEX_PD2 = 15, /** VbNvContext for ARM arch */ BBRM_DATA_INDEX_VBNVCNTXT = 16, /** RAM log for Booter */ BBRM_DATA_INDEX_RAMLOG = 32, /** Flag to indicate validity of panic data starting at index 36. */ BBRM_DATA_INDEX_PANIC_FLAGS = 35, /** Panic data (index 35-63)*/ BBRM_DATA_INDEX_PANIC_BKUP = 36, /** The start time of LCT(4 bytes) */ BBRM_DATA_INDEX_LCT_TIME = 64, }; #endif /* ZEPHYR_SHIM_INCLUDE_BBRAM_H_ */
Change reference from removed canvas::texture
#ifndef _SPRITE_H_ #define _SPRITE_H_ #include <memory> namespace canvas { class Texture; }; #include <glm/glm.hpp> class Sprite { public: Sprite(); virtual ~Sprite(); const std::shared_ptr<canvas::Texture> & getTexture() const { return texture; } void setTexture(const std::shared_ptr<canvas::Texture> & _texture) { texture = _texture; } const glm::vec2 & getPosition() const { return position; } float getWidth() const { return width; } float getHeight() const { return height; } void setPosition(const glm::vec2 & _position) { position = _position; } void setWidth(float _width) { width = _width; } void setHeight(float _height) { height = _height; } protected: glm::vec2 position; private: float width = 0, height = 0; std::shared_ptr<canvas::Texture> texture; }; #endif
#ifndef _SPRITE_H_ #define _SPRITE_H_ #include <memory> #include <Texture.h> #include <glm/glm.hpp> class Sprite { public: Sprite(); virtual ~Sprite(); const std::shared_ptr<Texture> & getTexture() const { return texture; } void setTexture(const std::shared_ptr<Texture> & _texture) { texture = _texture; } const glm::vec2 & getPosition() const { return position; } float getWidth() const { return width; } float getHeight() const { return height; } void setPosition(const glm::vec2 & _position) { position = _position; } void setWidth(float _width) { width = _width; } void setHeight(float _height) { height = _height; } protected: glm::vec2 position; private: float width = 0, height = 0; std::shared_ptr<Texture> texture; }; #endif
Add missing export specification for TextProgressBarCommand
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef itkTextProgressBarCommand_h #define itkTextProgressBarCommand_h #include "itkCommand.h" #include <string> namespace itk { /** \class TextProgressBarCommand * * \brief A simple command that outputs a text progress bar the associated filter. * * \ingroup Ultrasound * */ class TextProgressBarCommand: public Command { public: typedef TextProgressBarCommand Self; typedef Command Superclass; typedef SmartPointer< Self > Pointer; itkNewMacro( Self ); protected: TextProgressBarCommand(); void Execute(itk::Object *caller, const itk::EventObject & event) override; void Execute(const itk::Object * object, const itk::EventObject & event) override; std::string m_Progress; }; } // end namespace itk #endif
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef itkTextProgressBarCommand_h #define itkTextProgressBarCommand_h #include "itkCommand.h" #include "UltrasoundExport.h" #include <string> namespace itk { /** \class TextProgressBarCommand * * \brief A simple command that outputs a text progress bar the associated filter. * * \ingroup Ultrasound * */ class Ultrasound_EXPORT TextProgressBarCommand: public Command { public: typedef TextProgressBarCommand Self; typedef Command Superclass; typedef SmartPointer< Self > Pointer; itkNewMacro( Self ); protected: TextProgressBarCommand(); void Execute(itk::Object *caller, const itk::EventObject & event) override; void Execute(const itk::Object * object, const itk::EventObject & event) override; std::string m_Progress; }; } // end namespace itk #endif
Fix MPLY-8362: check watermark building id case insensitively.
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved #pragma once #include "IWatermarkDataRepository.h" #include "Watermark.h" #include <map> #include <string> namespace ExampleApp { namespace Watermark { namespace View { class WatermarkDataRepository : public IWatermarkDataRepository { public: void AddWatermarkData(const std::string& key, const WatermarkData& watermarkData); void RemoveWatermarkDataWithKey(const std::string& key); bool HasWatermarkDataForKey(const std::string& key) const; WatermarkData GetWatermarkDataWithKey(const std::string& key) const; private: typedef std::map<std::string, WatermarkData> TWatermarkDataMap; TWatermarkDataMap m_watermarkDataMap; }; } } }
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved #pragma once #include "IWatermarkDataRepository.h" #include "Watermark.h" #include <map> #include <string> namespace ExampleApp { namespace Watermark { namespace View { class WatermarkDataRepository : public IWatermarkDataRepository { public: void AddWatermarkData(const std::string& key, const WatermarkData& watermarkData); void RemoveWatermarkDataWithKey(const std::string& key); bool HasWatermarkDataForKey(const std::string& key) const; WatermarkData GetWatermarkDataWithKey(const std::string& key) const; private: struct CaseInsensitiveCompare { bool operator()(const std::string& l, const std::string& r) const { return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end(), [](const char c1, const char c2) { return std::tolower(c1) < std::tolower(c2); }); } }; typedef std::map<std::string, WatermarkData, CaseInsensitiveCompare> TWatermarkDataMap; TWatermarkDataMap m_watermarkDataMap; }; } } }
Change session length to 3 minutes
/* * Copyright 2016 Adam Chyła, adam@chyla.org * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H #define SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H namespace apache { namespace analyzer { namespace detail { constexpr int SESSION_LENGTH = 3600; } } } #endif /* SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H */
/* * Copyright 2016 Adam Chyła, adam@chyla.org * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H #define SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H namespace apache { namespace analyzer { namespace detail { constexpr int SESSION_LENGTH = 3 * 60; } } } #endif /* SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H */
Add Json schema error parse errors.
char *get_id(void)
#ifndef AINOD_METHODS_H #define AINOD_METHODS_H /** Invalid JSON was received by the server. **/ #define JSON_SCHEMA_ERROR_PARSE_ERROR -32700 /** The JSON sent is not a valid Request object. */ #define JSON_SCHEMA_ERROR_INVALID_REQUEST -32600 /** The method does not exist / is not available. **/ #define JSON_SCHEMA_ERROR_METHOD_NOT_FOUND -32601 /** Invalid method parameter(s). */ #define JSON_SCHEMA_ERROR_INVALID_PARAMS -32602 /** Internal JSON-RPC error. */ #define JSON_SCHEMA_ERROR_INTERNAL_ERROR -32603 /** Reserved for implementation-defined server-errors. */ #define JSON_SCHEMA_ERROR_SERVER_ERROR -32000 char *get_id(void); int process_buffer(char *buf); #endif /* AINOD_METHODS_H */
Add note about the order of archives returned by the archive manager.
// // RXArchiveManager.h // rivenx // // Created by Jean-Francois Roy on 02/02/2008. // Copyright 2005-2010 MacStorm. All rights reserved. // #import "Base/RXBase.h" #import <MHKKit/MHKKit.h> @interface RXArchiveManager : NSObject { NSString* patches_directory; MHKArchive* extras_archive; } + (RXArchiveManager*)sharedArchiveManager; + (NSPredicate*)anyArchiveFilenamePredicate; + (NSPredicate*)dataArchiveFilenamePredicate; + (NSPredicate*)soundsArchiveFilenamePredicate; + (NSPredicate*)extrasArchiveFilenamePredicate; - (NSArray*)dataArchivesForStackKey:(NSString*)stack_key error:(NSError**)error; - (NSArray*)soundArchivesForStackKey:(NSString*)stack_key error:(NSError**)error; - (MHKArchive*)extrasArchive:(NSError**)error; @end
// // RXArchiveManager.h // rivenx // // Created by Jean-Francois Roy on 02/02/2008. // Copyright 2005-2010 MacStorm. All rights reserved. // #import "Base/RXBase.h" #import <MHKKit/MHKKit.h> @interface RXArchiveManager : NSObject { NSString* patches_directory; MHKArchive* extras_archive; } + (RXArchiveManager*)sharedArchiveManager; + (NSPredicate*)anyArchiveFilenamePredicate; + (NSPredicate*)dataArchiveFilenamePredicate; + (NSPredicate*)soundsArchiveFilenamePredicate; + (NSPredicate*)extrasArchiveFilenamePredicate; // NOTE: these methods return the archives sorted in the order they should be searched; code should always forward-iterate the returned array - (NSArray*)dataArchivesForStackKey:(NSString*)stack_key error:(NSError**)error; - (NSArray*)soundArchivesForStackKey:(NSString*)stack_key error:(NSError**)error; - (MHKArchive*)extrasArchive:(NSError**)error; @end
Add nullability specifiers to type selector
// // CSSTypeSelector.h // HTMLKit // // Created by Iska on 13/05/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> #import "CSSSelector.h" #import "CSSSimpleSelector.h" @interface CSSTypeSelector : CSSSelector <CSSSimpleSelector> @property (nonatomic, copy) NSString *type; + (instancetype)universalSelector; - (instancetype)initWithType:(NSString *)type; @end
// // CSSTypeSelector.h // HTMLKit // // Created by Iska on 13/05/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> #import "CSSSelector.h" #import "CSSSimpleSelector.h" @interface CSSTypeSelector : CSSSelector <CSSSimpleSelector> @property (nonatomic, copy) NSString * _Nonnull type; + (nullable instancetype)universalSelector; - (nullable instancetype)initWithType:(nonnull NSString *)type; @end
Fix a couple of header issues.
#ifndef ANIMATION_H #define ANIMATION_H #include <vector> #include "Blittable.h" namespace hm { class Animation { public: Animation(); ~Animation(); void add(const Blittable& b); void remove(const Blittable& b); void removeAll(); virtual void animate() = 0; protected: std::vector<Blittable*> targets; } } #endif
#ifndef ANIMATION_H #define ANIMATION_H #include <vector> #include "Blittable.h" #include "Logger.h" namespace hm { class Animation { public: Animation(); ~Animation(); void add(Blittable& b); void remove(Blittable& b); void removeAll(); virtual void animate() = 0; protected: std::vector<Blittable*> targets; }; } #endif
Convert data source adress type to void *
#ifndef FLASH_WRITER_H #define FLASH_WRITER_H #include <stdint.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /** Unlocks the flash for programming. */ void flash_writer_unlock(void); /** Locks the flash */ void flash_writer_lock(void); /** Erases the flash page at given address. */ void flash_writer_page_erase(void *page); /** Writes data to given location in flash. */ void flash_writer_page_write(void *page, uint8_t *data, size_t len); #ifdef __cplusplus } #endif #endif /* FLASH_WRITER_H */
#ifndef FLASH_WRITER_H #define FLASH_WRITER_H #include <stdint.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /** Unlocks the flash for programming. */ void flash_writer_unlock(void); /** Locks the flash */ void flash_writer_lock(void); /** Erases the flash page at given address. */ void flash_writer_page_erase(void *page); /** Writes data to given location in flash. */ void flash_writer_page_write(void *page, void *data, size_t len); #ifdef __cplusplus } #endif #endif /* FLASH_WRITER_H */
Fix include guard to match the current filename.
// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef RIEGELI_BASE_STR_ERROR_H_ #define RIEGELI_BASE_STR_ERROR_H_ #include "absl/strings/string_view.h" #include "riegeli/base/status.h" namespace riegeli { // Converts errno value to Status. Status ErrnoToCanonicalStatus(int error_number, absl::string_view message); } // namespace riegeli #endif // RIEGELI_BASE_STR_ERROR_H_
// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef RIEGELI_BASE_ERRNO_MAPPING_H_ #define RIEGELI_BASE_ERRNO_MAPPING_H_ #include "absl/strings/string_view.h" #include "riegeli/base/status.h" namespace riegeli { // Converts errno value to Status. Status ErrnoToCanonicalStatus(int error_number, absl::string_view message); } // namespace riegeli #endif // RIEGELI_BASE_ERRNO_MAPPING_H_
Add a small comment to tell what this is.
/* chardata.h * * */ #ifndef XML_CHARDATA_H #define XML_CHARDATA_H 1 #ifndef XML_VERSION #include "expat.h" /* need XML_Char */ #endif typedef struct { int count; /* # of chars, < 0 if not set */ XML_Char data[1024]; } CharData; void CharData_Init(CharData *storage); void CharData_AppendString(CharData *storage, const char *s); void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len); int CharData_CheckString(CharData *storage, const char *s); int CharData_CheckXMLChars(CharData *storage, const XML_Char *s); #endif /* XML_CHARDATA_H */
/* chardata.h Interface to some helper routines used to accumulate and check text and attribute content. */ #ifndef XML_CHARDATA_H #define XML_CHARDATA_H 1 #ifndef XML_VERSION #include "expat.h" /* need XML_Char */ #endif typedef struct { int count; /* # of chars, < 0 if not set */ XML_Char data[1024]; } CharData; void CharData_Init(CharData *storage); void CharData_AppendString(CharData *storage, const char *s); void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len); int CharData_CheckString(CharData *storage, const char *s); int CharData_CheckXMLChars(CharData *storage, const XML_Char *s); #endif /* XML_CHARDATA_H */
Add init DIF for EDN
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #include "sw/device/lib/dif/dif_edn.h" #include "edn_regs.h" // Generated
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #include "sw/device/lib/dif/dif_edn.h" #include "edn_regs.h" // Generated dif_result_t dif_edn_init(mmio_region_t base_addr, dif_edn_t *edn) { if (edn == NULL) { return kDifBadArg; } edn->base_addr = base_addr; return kDifOk; }
Use new API in optional tests
#include "test_parser_p.h" void optional_some(void **state) { grammar_t *grammar = grammar_init( non_terminal("Option"), rule_init( "Option", optional( terminal("opt") ) ), 1 ); parse_t *result = parse("opt", grammar); assert_non_null(result); assert_int_equal(result->length, 3); assert_int_equal(result->n_children, 1); } void optional_none(void **state) { grammar_t *grammar = grammar_init( non_terminal("Option"), rule_init( "Option", optional( terminal("opt") ) ), 1 ); parse_t *result = parse("nope", grammar); assert_non_null(result); assert_int_equal(result->length, 0); assert_int_equal(result->n_children, 0); }
#include "test_parser_p.h" void optional_some(void **state) { grammar_t *grammar = grammar_init( non_terminal("Option"), rule_init( "Option", optional( terminal("opt") ) ), 1 ); parse_result_t *result = parse("opt", grammar); assert_non_null(result); assert_true(is_success(result)); parse_t *suc = result->data.result; assert_int_equal(suc->length, 3); assert_int_equal(suc->n_children, 1); } void optional_none(void **state) { grammar_t *grammar = grammar_init( non_terminal("Option"), rule_init( "Option", optional( terminal("opt") ) ), 1 ); parse_result_t *result = parse("nope", grammar); assert_non_null(result); assert_true(is_success(result)); parse_t *suc = result->data.result; assert_int_equal(suc->length, 0); assert_int_equal(suc->n_children, 0); }
Fix a minor bug in test
#include <stdint.h> #include <stdio.h> #include <stdlib.h> int __llvm_profile_runtime = 0; uint64_t __llvm_profile_get_size_for_buffer(void); int __llvm_profile_write_buffer(char *); void __llvm_profile_reset_counters(void); int __llvm_profile_check_compatibility(const char *, uint64_t); int gg = 0; void bar(char c) { if (c == '1') gg++; else gg--; } /* Returns 0 (size) when an error occurs. */ uint64_t libEntry(char *Buffer, uint64_t MaxSize) { uint64_t Size = __llvm_profile_get_size_for_buffer(); if (Size > MaxSize) return 1; __llvm_profile_reset_counters(); bar('1'); if (__llvm_profile_write_buffer(Buffer)) return 0; /* Now check compatibility. Should return 0. */ if (__llvm_profile_check_compatibility(Buffer, Size)) return 0; return Size; }
#include <stdint.h> #include <stdio.h> #include <stdlib.h> int __llvm_profile_runtime = 0; uint64_t __llvm_profile_get_size_for_buffer(void); int __llvm_profile_write_buffer(char *); void __llvm_profile_reset_counters(void); int __llvm_profile_check_compatibility(const char *, uint64_t); int gg = 0; void bar(char c) { if (c == '1') gg++; else gg--; } /* Returns 0 (size) when an error occurs. */ uint64_t libEntry(char *Buffer, uint64_t MaxSize) { uint64_t Size = __llvm_profile_get_size_for_buffer(); if (Size > MaxSize) return 0; __llvm_profile_reset_counters(); bar('1'); if (__llvm_profile_write_buffer(Buffer)) return 0; /* Now check compatibility. Should return 0. */ if (__llvm_profile_check_compatibility(Buffer, Size)) return 0; return Size; }
Add ability to specify CO2 emissions (dic_int1=4)
C $Header: /u/gcmpack/MITgcm/pkg/dic/DIC_ATMOS.h,v 1.4 2010/04/11 20:59:27 jmc Exp $ C $Name: $ COMMON /INTERACT_ATMOS_NEEDS/ & co2atmos, & total_atmos_carbon, total_ocean_carbon, & total_atmos_carbon_year, & total_ocean_carbon_year, & total_atmos_carbon_start, & total_ocean_carbon_start, & atpco2 _RL co2atmos(1000) _RL total_atmos_carbon _RL total_ocean_carbon _RL total_atmos_carbon_year _RL total_atmos_carbon_start _RL total_ocean_carbon_year _RL total_ocean_carbon_start _RL atpco2
C $Header: /u/gcmpack/MITgcm/pkg/dic/DIC_ATMOS.h,v 1.4 2010/04/11 20:59:27 jmc Exp $ C $Name: $ COMMON /INTERACT_ATMOS_NEEDS/ & co2atmos, & total_atmos_carbon, total_ocean_carbon, & total_atmos_carbon_year, & total_ocean_carbon_year, & total_atmos_carbon_start, & total_ocean_carbon_start, & atpco2,total_atmos_moles _RL co2atmos(1000) _RL total_atmos_carbon _RL total_ocean_carbon _RL total_atmos_carbon_year _RL total_atmos_carbon_start _RL total_ocean_carbon_year _RL total_ocean_carbon_start _RL atpco2 _RL total_atmos_moles
Add a test for the wrapped interval domain
// RUN: %crabllvm -O0 --crab-dom=w-int --crab-check=assert "%s" 2>&1 | OutputCheck %s // CHECK: ^1 Number of total safe checks$ // CHECK: ^0 Number of total error checks$ // CHECK: ^0 Number of total warning checks$ extern int nd(void); extern void process(char); extern void __CRAB_assert(int); int main() { char x,y; y=-10; if(nd()) x=0; else x=100; while (x >= y){ x = x-y; } __CRAB_assert(x >= -128 && x <= -119); return 0; }
Add missed on_comparison_state_set() function to ComputerListenerMock
#pragma once #include <mix/computer_listener.h> #include <gmock/gmock.h> struct ComputerListenerMock : public mix::IComputerListener { MOCK_METHOD1(on_memory_set, void (int)); MOCK_METHOD0(on_ra_set, void ()); MOCK_METHOD0(on_rx_set, void ()); MOCK_METHOD1(on_ri_set, void (std::size_t)); MOCK_METHOD0(on_overflow_flag_set, void ()); };
#pragma once #include <mix/computer_listener.h> #include <gmock/gmock.h> struct ComputerListenerMock : public mix::IComputerListener { MOCK_METHOD1(on_memory_set, void (int)); MOCK_METHOD0(on_ra_set, void ()); MOCK_METHOD0(on_rx_set, void ()); MOCK_METHOD1(on_ri_set, void (std::size_t)); MOCK_METHOD0(on_overflow_flag_set, void ()); MOCK_METHOD0(on_comparison_state_set, void ()); };
Make compression the default on writing.
//===-- llvm/Bytecode/Writer.h - Writer for VM bytecode files ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This functionality is implemented by the lib/BytecodeWriter library. // This library is used to write VM bytecode files to an iostream. First, you // have to make a BytecodeStream object, which you can then put a class into // by using operator <<. // // This library uses the Analysis library to figure out offsets for // variables in the method tables... // // Note that performance of this library is not as crucial as performance of the // bytecode reader (which is to be used in JIT type applications), so we have // designed the bytecode format to support quick reading. // //===----------------------------------------------------------------------===// #ifndef LLVM_BYTECODE_WRITER_H #define LLVM_BYTECODE_WRITER_H #include <iosfwd> namespace llvm { class Module; void WriteBytecodeToFile(const Module *M, std::ostream &Out, bool compress = false); } // End llvm namespace #endif
//===-- llvm/Bytecode/Writer.h - Writer for VM bytecode files ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This functionality is implemented by the lib/BytecodeWriter library. // This library is used to write VM bytecode files to an iostream. First, you // have to make a BytecodeStream object, which you can then put a class into // by using operator <<. // // This library uses the Analysis library to figure out offsets for // variables in the method tables... // // Note that performance of this library is not as crucial as performance of the // bytecode reader (which is to be used in JIT type applications), so we have // designed the bytecode format to support quick reading. // //===----------------------------------------------------------------------===// #ifndef LLVM_BYTECODE_WRITER_H #define LLVM_BYTECODE_WRITER_H #include <iosfwd> namespace llvm { class Module; void WriteBytecodeToFile(const Module *M, std::ostream &Out, bool compress = true); } // End llvm namespace #endif
Fix another broken sol include
#pragma once #include "3rdparty/sol2/sol/forward.hpp" namespace augs { template <class Archive, class Serialized> void write_lua(Archive&, const Serialized& from); template <class Archive, class Serialized> void read_lua(const Archive&, Serialized& into); template <class Archive, class Serialized> void write_lua_no_overload(Archive&, const Serialized& from); template <class Archive, class Serialized> void read_lua_no_overload(const Archive&, Serialized& into); template <class T, class K> void write_table_or_field(sol::table& output_table, const T& from, K&& key); template <class T> void general_from_lua_value(const sol::object& object, T& into); }
#pragma once #include <sol/forward.hpp> namespace augs { template <class Archive, class Serialized> void write_lua(Archive&, const Serialized& from); template <class Archive, class Serialized> void read_lua(const Archive&, Serialized& into); template <class Archive, class Serialized> void write_lua_no_overload(Archive&, const Serialized& from); template <class Archive, class Serialized> void read_lua_no_overload(const Archive&, Serialized& into); template <class T, class K> void write_table_or_field(sol::table& output_table, const T& from, K&& key); template <class T> void general_from_lua_value(const sol::object& object, T& into); }
Make legacy header reference old code.
#ifndef PYPOC_H #define PYPOC_H #include <Windows.h> #include "EmoStateDLL.h" #include "edk.h" #include "edkErrorCode.h" class EPOC { private: EmoEngineEventHandle eEvent; EmoStateHandle eState; DataHandle hData; int nChannels; EE_DataChannel_t *channels; unsigned int userId; double *samples; BOOL ready; BOOL closed; public: EPOC(); ~EPOC(); BOOL open(); BOOL init(const int); BOOL start(); BOOL acquire(); void getdata(int *data, int n); BOOL stop(); BOOL close(); }; #endif
#ifndef PYPOC_H #define PYPOC_H #include <Windows.h> #include "EmoStateDLL.hpp" #include "edk.hpp" #include "edkErrorCode.hpp" class EPOC { private: EmoEngineEventHandle eEvent; EmoStateHandle eState; DataHandle hData; int nChannels; EE_DataChannel_t *channels; unsigned int userId; double *samples; BOOL ready; BOOL closed; public: EPOC(); ~EPOC(); BOOL open(); BOOL init(const int); BOOL start(); BOOL acquire(); void getdata(int *data, int n); BOOL stop(); BOOL close(); }; #endif
Add header for FrameController to pch
#include <Ogre.h> #include <OgreMeshFileFormat.h> #include <OgreOptimisedUtil.h> #ifdef WIN32 #include <OgreD3D9RenderSystem.h> #include <OgreD3D9HLSLProgram.h> #endif #include <OgreGLRenderSystem.h> #include <OgreGLGpuProgram.h> #include <OgreGLSLGpuProgram.h> #include <OgreGLSLLinkProgramManager.h> #include <OgreGLSLProgram.h> #include <OgreOctreePlugin.h> #include <OgreOctreeSceneManager.h> #include <OgreCgPlugin.h> #include <OgreCgProgram.h>
#include <Ogre.h> #include <OgreMeshFileFormat.h> #include <OgreOptimisedUtil.h> #include <OgrePredefinedControllers.h> #ifdef WIN32 #include <OgreD3D9RenderSystem.h> #include <OgreD3D9HLSLProgram.h> #endif #include <OgreGLRenderSystem.h> #include <OgreGLGpuProgram.h> #include <OgreGLSLGpuProgram.h> #include <OgreGLSLLinkProgramManager.h> #include <OgreGLSLProgram.h> #include <OgreOctreePlugin.h> #include <OgreOctreeSceneManager.h> #include <OgreCgPlugin.h> #include <OgreCgProgram.h>
Read from STDIN when no filename is given
#include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <fcntl.h> /* a re-implementation of cat(1), to learn the basic Unix syscalls. by tlehman at 1383415046 */ void usage(const char *progname) { printf("%s filename\n", progname); exit(EXIT_FAILURE); } void print_file_contents(const char *filename) { int fd; ssize_t b; char buf[BUFSIZ]; fd = open(filename, O_RDONLY); while ( (b = read(fd, buf, BUFSIZ)) != 0 ) { write(STDOUT_FILENO, buf, b); } close(fd); } int main(int argc, char const *argv[]) { int i; if (argc > 1) { for(i = 1; i < argc; i++) { print_file_contents(argv[i]); } } else { usage(argv[0]); } return 0; }
#include <sys/types.h> #include <sys/select.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <fcntl.h> /* a re-implementation of cat(1), to learn the basic Unix syscalls. by tlehman at 1383415046 */ void usage(const char *progname) { printf("%s filename\n", progname); exit(EXIT_FAILURE); } void print_file_contents(int fd) { ssize_t b; char buf[BUFSIZ]; while ( (b = read(fd, buf, BUFSIZ)) != 0 ) { write(STDOUT_FILENO, buf, b); } } int stdin_non_empty() { fd_set fds; FD_SET(STDIN_FILENO, &fds); return select(1, &fds, NULL, NULL, NULL); } int main(int argc, char const *argv[]) { int i; int fd; if (argc > 1) { for(i = 1; i < argc; i++) { fd = open(argv[i], O_RDONLY); print_file_contents(fd); close(fd); } } else if (stdin_non_empty()) { print_file_contents(STDIN_FILENO); } else { usage(argv[0]); } return 0; }
Remove unnecessary include in spellcheck word trimmer
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ #define CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ #include "base/i18n/base_i18n_export.h" #include "base/string16.h" // Trims |text| to contain only the range from |start| to |end| and |keep| words // on either side of the range. The |start| and |end| parameters are character // indexes into |text|. The |keep| parameter is the number of words to keep on // either side of the |start|-|end| range. The function updates |start| in // accordance with the trimming. // // Example: // // size_t start = 14; // size_t end = 23; // string16 text = ASCIIToUTF16("one two three four five six seven eight"); // int keep = 2; // string16 trimmed = TrimWords(&start, end, text, keep); // DCHECK(trimmed == ASCIIToUTF16("two three four five six seven")); // DCHECK(start == 10); // string16 TrimWords( size_t* start, size_t end, const string16& text, size_t keep); #endif // CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ #define CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ #include "base/string16.h" // Trims |text| to contain only the range from |start| to |end| and |keep| words // on either side of the range. The |start| and |end| parameters are character // indexes into |text|. The |keep| parameter is the number of words to keep on // either side of the |start|-|end| range. The function updates |start| in // accordance with the trimming. // // Example: // // size_t start = 14; // size_t end = 23; // string16 text = ASCIIToUTF16("one two three four five six seven eight"); // int keep = 2; // string16 trimmed = TrimWords(&start, end, text, keep); // DCHECK(trimmed == ASCIIToUTF16("two three four five six seven")); // DCHECK(start == 10); // string16 TrimWords( size_t* start, size_t end, const string16& text, size_t keep); #endif // CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_
Update driver version to 5.02.00-k20
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k19"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k20"
Test parsing __attribute__ after a struct definition
// RUN: %ucc -fsyntax-only %s struct A { char i, j; } __attribute((aligned(8))); struct A a; _Static_assert(_Alignof(a) == 8, "misaligned/attr not picked up");
Fix VLA stack alignment test / path
// RUN: %ucc -o %t %s vla/check_align_asm.s // RUN: %t extern void check_align() __asm("check_align"); a() { int i = 1; short c[i]; c[0] = 0; check_align(c, i); } b() { int i = 3; char c[i]; c[0] = 0; c[1] = 0; c[2] = 0; check_align(c, i); } main() { a(); b(); return 0; }
// RUN: %ucc -o %t %s "$(dirname %s)"/check_align_asm.s // RUN: %t extern void check_align() __asm("check_align"); a() { int i = 1; short c[i]; c[0] = 0; check_align(c, i); } b() { int i = 3; char c[i]; c[0] = 0; c[1] = 0; c[2] = 0; check_align(c, i); } main() { a(); b(); return 0; }
Add code to read opcodes from file :P
#include "vm.h" int* read_from_file(FILE* file) { int *instructions, idx = 0, count = 0; while (fgetc(file) != EOF) count++; rewind(file); instructions = malloc(count * sizeof(int)); for (idx=0; idx < count; idx++) { instructions[idx] = fgetc(file); } return instructions; } int main(int argc, const char* argv[]) { if (argc != 2) { fprintf(stderr, "Invalid args\n"); return -1; } else { printf( "%d\n", evaluate( read_from_file( fopen(argv[1], "rb") ) ) ); return 0; } }
Add extra assert to 36/13
// PARAM: --sets ana.activated[+] octApron #include <pthread.h> #include <assert.h> int g = 1; int h = 1; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { int x; // rand pthread_mutex_lock(&A); g = x; h = x; assert(g == h); pthread_mutex_unlock(&A); pthread_mutex_lock(&A); pthread_mutex_unlock(&A); return NULL; } void *t2_fun(void *arg) { int x, y; // rand pthread_mutex_lock(&A); g = x; h = x; assert(g == h); pthread_mutex_unlock(&A); pthread_mutex_lock(&A); pthread_mutex_unlock(&A); pthread_mutex_lock(&A); if (y) g = x; else h = x; pthread_mutex_unlock(&A); return NULL; } int main(void) { pthread_t id, id2; pthread_create(&id, NULL, t_fun, NULL); pthread_create(&id2, NULL, t2_fun, NULL); assert(g == h); // UNKNOWN! pthread_mutex_lock(&A); assert(g == h); // UNKNOWN! pthread_mutex_unlock(&A); return 0; }
// PARAM: --sets ana.activated[+] octApron #include <pthread.h> #include <assert.h> int g = 1; int h = 1; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { int x; // rand pthread_mutex_lock(&A); g = x; h = x; assert(g == h); pthread_mutex_unlock(&A); pthread_mutex_lock(&A); pthread_mutex_unlock(&A); return NULL; } void *t2_fun(void *arg) { int x, y; // rand pthread_mutex_lock(&A); g = x; h = x; assert(g == h); pthread_mutex_unlock(&A); pthread_mutex_lock(&A); pthread_mutex_unlock(&A); pthread_mutex_lock(&A); if (y) g = x; else h = x; assert(g == h); // UNKNOWN! pthread_mutex_unlock(&A); return NULL; } int main(void) { pthread_t id, id2; pthread_create(&id, NULL, t_fun, NULL); pthread_create(&id2, NULL, t2_fun, NULL); assert(g == h); // UNKNOWN! pthread_mutex_lock(&A); assert(g == h); // UNKNOWN! pthread_mutex_unlock(&A); return 0; }
Add a simple voltage encode/decode c code
#include <stdio.h> #include <stdint.h> static inline uint8_t rev8(uint8_t d) { int i; uint8_t out = 0; /* (from left to right) */ for (i = 0; i < 8; i++) if (d & (1 << i)) out |= (1 << (7 - i)); return out; } /* http://www.onsemi.com/pub_link/Collateral/ADP3208D.PDF */ static inline uint32_t encode_voltage(uint32_t v) { return rev8((0x78 - v / 125) << 1 | 1) << 8; } static inline uint32_t decode_voltage(uint32_t v) { return (0x78 - (rev8(v >> 8) >> 1)) * 125; } int main() { int v = 0; while (v < 15000) { printf("%d --> %04x | %d\n", v, encode_voltage(v), encode_voltage(v)); v += 125; } }
Add BSD 3-clause open source header
/* * node.h - type definition for node in a table */ #ifndef _NODE_H_ #define _NODE_H_ #include "table.h" #include "timestamp.h" typedef struct node { struct node *next; /* link to next node in the table */ struct node *prev; /* link to previous node in the table */ struct node *younger; /* link to next younger node */ unsigned char *tuple; /* pointer to Tuple in circ buffer */ unsigned short alloc_len; /* bytes allocated for tuple in circ buffer */ unsigned short real_len; /* actual lengthof the tuple in bytes */ struct table *parent; /* table to which node belongs */ tstamp_t tstamp; /* timestamp when entered into database nanoseconds since epoch */ } Node; #endif /* _NODE_H_ */
/* * Copyright (c) 2013, Court of the University of Glasgow * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * - Neither the name of the University of Glasgow 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. */ /* * node.h - type definition for node in a table */ #ifndef _NODE_H_ #define _NODE_H_ #include "table.h" #include "timestamp.h" typedef struct node { struct node *next; /* link to next node in the table */ struct node *prev; /* link to previous node in the table */ struct node *younger; /* link to next younger node */ unsigned char *tuple; /* pointer to Tuple in circ buffer */ unsigned short alloc_len; /* bytes allocated for tuple in circ buffer */ unsigned short real_len; /* actual lengthof the tuple in bytes */ struct table *parent; /* table to which node belongs */ tstamp_t tstamp; /* timestamp when entered into database nanoseconds since epoch */ } Node; #endif /* _NODE_H_ */
Add check for empty matrix in constructor.
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- template<class T> matrix<T>::matrix():data_(),rows_(0),cols_(0){} template<class T> matrix<T>::matrix( std::size_t rows, std::size_t cols ): data_(rows*cols),rows_(rows),cols_(cols){} template<class T> matrix<T>::matrix( std::initializer_list<std::initializer_list<T>> init_list): data_( make_vector(init_list) ), rows_(init_list.size()),cols_( init_list.begin()->size() ){} // !!! // // Is "init_list.begin()->size()" ok if init_list = {} ? // // !!!
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- template<class T> matrix<T>::matrix(): data_(), rows_(0), cols_(0) {} template<class T> matrix<T>::matrix( std::size_t rows, std::size_t cols ): data_(rows*cols), rows_(rows), cols_(cols) {} template<class T> matrix<T>::matrix( std::initializer_list<std::initializer_list<T>> init_list): data_( make_vector(init_list) ), rows_(init_list.size()), cols_( (init_list.size() > 0) ? init_list.begin()->size() : 0 ) {}
Define x86 CPU state structure
#ifndef CPU_STATE_H #define CPU_STATE_H struct cpu_state { // Pushed by pusha uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; uint32_t eip, cs, eflags, useresp, ss; }; #endif
Fix compile for debug on Android
// // Created by Dawid Drozd aka Gelldur on 03.02.16. // #pragma once #include <android/log.h> #ifdef DEBUG #define DLOG(...) __android_log_print(ANDROID_LOG_DEBUG,"JNI",__VA_ARGS__) #define ILOG(...) __android_log_print(ANDROID_LOG_INFO,"JNI",__VA_ARGS__) #define WLOG(...) __android_log_print(ANDROID_LOG_WARN,"JNI",__VA_ARGS__) #define ELOG(...) __android_log_print(ANDROID_LOG_ERROR,"JNI",__VA_ARGS__) #define FLOG(...) __android_log_print(ANDROID_LOG_FATAL,"JNI",__VA_ARGS__) #else #define DLOG(...) #define ILOG(...) #define WLOG(...) __android_log_print(ANDROID_LOG_WARN,"JNI",__VA_ARGS__) #define ELOG(...) __android_log_print(ANDROID_LOG_ERROR,"JNI",__VA_ARGS__) #define FLOG(...) __android_log_print(ANDROID_LOG_FATAL,"JNI",__VA_ARGS__) #endif
// // Created by Dawid Drozd aka Gelldur on 03.02.16. // #pragma once #include <android/log.h> #ifndef NDEBUG #define DLOG(...) __android_log_print(ANDROID_LOG_DEBUG,"JNI",__VA_ARGS__) #define ILOG(...) __android_log_print(ANDROID_LOG_INFO,"JNI",__VA_ARGS__) #define WLOG(...) __android_log_print(ANDROID_LOG_WARN,"JNI",__VA_ARGS__) #define ELOG(...) __android_log_print(ANDROID_LOG_ERROR,"JNI",__VA_ARGS__) #define FLOG(...) __android_log_print(ANDROID_LOG_FATAL,"JNI",__VA_ARGS__) #else #define DLOG(...) #define ILOG(...) #define WLOG(...) __android_log_print(ANDROID_LOG_WARN,"JNI",__VA_ARGS__) #define ELOG(...) __android_log_print(ANDROID_LOG_ERROR,"JNI",__VA_ARGS__) #define FLOG(...) __android_log_print(ANDROID_LOG_FATAL,"JNI",__VA_ARGS__) #endif
Add battery info kernel module.
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/power_supply.h> static int __init battery_status_init(void) { char name[] = "BAT0"; int result = 0; struct power_supply *psy = power_supply_get_by_name(name); union power_supply_propval chargenow, chargefull; result = psy->get_property(psy, POWER_SUPPLY_PROP_CHARGE_NOW, &chargenow); if (!result) { printk(KERN_INFO "The charge level is %d\n", chargenow.intval); } result = psy->get_property(psy, POWER_SUPPLY_PROP_CHARGE_FULL, &chargefull); if (!result) { printk(KERN_INFO "The charge level is %d\n", chargefull.intval); } return 0; } static void __exit battery_status_exit(void) { printk(KERN_INFO "Unload battery_status module\n"); } module_init(battery_status_init); module_exit(battery_status_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Miroslav Tisma <tisma.etf@gmail.com>"); MODULE_DESCRIPTION("Battery status level module."); MODULE_VERSION("0.0.1");
Fix module loc. Add missing final newline.
// @(#)root/thread:$Id$ // Author: Philippe Canal 09/30/2011 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TThreadSlots #define ROOT_TThreadSlots namespace ROOT { enum EThreadSlotReservation { // Describe the system wide slot pre-allocation in the TThread // 'special data' storage array ; meant to be used as thread local // storage. (See TThread::Tsd) // // Slot 0 through 19 can be used for user application // Slot 20 and above are reserved for the global system kMaxUserThreadSlot = 20, // Slot reserved by ROOT's packages. kPadThreadSlot = 20, kClassThreadSlot = 21, kDirectoryThreadSlot = 22, kFileThreadSlot = 23, kMaxThreadSlot = 24 // Size of the array of thread local slots in TThread }; } #ifndef __CINT__ R__EXTERN void **(*gThreadTsd)(void*,Int_t); #endif #endif // ROOT_TThreadSlots
// @(#)root/base:$Id$ // Author: Philippe Canal 09/30/2011 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TThreadSlots #define ROOT_TThreadSlots namespace ROOT { enum EThreadSlotReservation { // Describe the system wide slot pre-allocation in the TThread // 'special data' storage array ; meant to be used as thread local // storage. (See TThread::Tsd) // // Slot 0 through 19 can be used for user application // Slot 20 and above are reserved for the global system kMaxUserThreadSlot = 20, // Slot reserved by ROOT's packages. kPadThreadSlot = 20, kClassThreadSlot = 21, kDirectoryThreadSlot = 22, kFileThreadSlot = 23, kMaxThreadSlot = 24 // Size of the array of thread local slots in TThread }; } #ifndef __CINT__ R__EXTERN void **(*gThreadTsd)(void*,Int_t); #endif #endif // ROOT_TThreadSlots
Fix module loc. Add missing final newline.
// @(#)root/thread:$Id$ // Author: Philippe Canal 09/30/2011 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TThreadSlots #define ROOT_TThreadSlots namespace ROOT { enum EThreadSlotReservation { // Describe the system wide slot pre-allocation in the TThread // 'special data' storage array ; meant to be used as thread local // storage. (See TThread::Tsd) // // Slot 0 through 19 can be used for user application // Slot 20 and above are reserved for the global system kMaxUserThreadSlot = 20, // Slot reserved by ROOT's packages. kPadThreadSlot = 20, kClassThreadSlot = 21, kDirectoryThreadSlot = 22, kFileThreadSlot = 23, kMaxThreadSlot = 24 // Size of the array of thread local slots in TThread }; } #ifndef __CINT__ R__EXTERN void **(*gThreadTsd)(void*,Int_t); #endif #endif // ROOT_TThreadSlots
// @(#)root/base:$Id$ // Author: Philippe Canal 09/30/2011 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TThreadSlots #define ROOT_TThreadSlots namespace ROOT { enum EThreadSlotReservation { // Describe the system wide slot pre-allocation in the TThread // 'special data' storage array ; meant to be used as thread local // storage. (See TThread::Tsd) // // Slot 0 through 19 can be used for user application // Slot 20 and above are reserved for the global system kMaxUserThreadSlot = 20, // Slot reserved by ROOT's packages. kPadThreadSlot = 20, kClassThreadSlot = 21, kDirectoryThreadSlot = 22, kFileThreadSlot = 23, kMaxThreadSlot = 24 // Size of the array of thread local slots in TThread }; } #ifndef __CINT__ R__EXTERN void **(*gThreadTsd)(void*,Int_t); #endif #endif // ROOT_TThreadSlots
Change to config file struct
#ifndef CONFIGREADER_H #define CONFIGREADER_H /*forward declarations*/ extern FILE *configreaderin; struct config_ssid { char ssid_name[32]; char ssid_user[32]; char ssid_pass[32]; char ssid_bssid[25]; int ssid_8021x; struct config_ssid *next; }; struct config_interfaces { char if_name[32]; struct config_ssid *ssids; struct config_interfaces *next; }; extern struct config_interfaces *config; #endif // CONFIGREADER_H
#ifndef CONFIGREADER_H #define CONFIGREADER_H /*forward declarations*/ extern FILE *configreaderin; struct config_ssid { char ssid_name[32]; char ssid_user[32]; char ssid_pass[32]; char ssid_bssid[20]; char ssid_auth[10]; struct config_ssid *next; }; struct config_interfaces { char if_name[32]; struct config_ssid *ssids; struct config_interfaces *next; }; extern struct config_interfaces *config; #endif // CONFIGREADER_H
Add test for surprising imprecision with ctx_insens base
// PARAM: --set ana.ctx_insens[+] base #include <stdlib.h> #include <assert.h> void foo(int cond) { assert(cond); // TODO to match assert } int main() { int *p = malloc(sizeof(int)); // blob is initially Bot while (1) { // blob joins Bot and 42 -> 42 // TODO: both should actually be UNKNOWN! to be sound assert(*p == 42); foo(*p == 42); // Bot -> Top, so foo has unknown and cannot narrow *p = 42; // blob becomes 42 } return 0; }
Update popt, and always use the gnome-libs version instead of any system
#ifndef __GNOME_POPT_H__ #define __GNOME_POPT_H__ 1 #include <popt.h> #include "gnome-defs.h" BEGIN_GNOME_DECLS void gnomelib_register_popt_table(const struct poptOption *options, const char *description); poptContext gnomelib_parse_args(int argc, char *argv[], int popt_flags); /* Some systems, like Red Hat 4.0, define these but don't declare them. Hopefully it is safe to always declare them here. */ extern char *program_invocation_short_name; extern char *program_invocation_name; END_GNOME_DECLS #endif /* __GNOME_HELP_H__ */
#ifndef __GNOME_POPT_H__ #define __GNOME_POPT_H__ 1 #include <popt-gnome.h> #include "gnome-defs.h" BEGIN_GNOME_DECLS void gnomelib_register_popt_table(const struct poptOption *options, const char *description); poptContext gnomelib_parse_args(int argc, char *argv[], int popt_flags); /* Some systems, like Red Hat 4.0, define these but don't declare them. Hopefully it is safe to always declare them here. */ extern char *program_invocation_short_name; extern char *program_invocation_name; END_GNOME_DECLS #endif /* __GNOME_HELP_H__ */
Include GLFW/gl3w and add base graphics context
//// // __| | | _ _| __ / __| \ | // \__ \ __ | | / _| . | // ____/ _| _| ___| ____| ___| _|\_| // // Copyright (c) 2016 Jacob Hauberg Hansen // // This library is free software; you can redistribute and modify it // under the terms of the MIT license. See LICENSE for details. // #ifndef internal_h #define internal_h #define GLFW_INCLUDE_NONE #include <GL/gl3w.h> #include <GLFW/glfw3.h> typedef struct { bool is_initialized; bool is_focused; bool should_finish; GLFWwindow *window; } SHIZGraphicsContext; #endif // internal_h
Add newline to end of file.
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_ #define VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_ namespace views { namespace internal { class NativeMenuHostDelegate { public: virtual ~NativeMenuHostDelegate() {} }; } // namespace internal } // namespace views #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_ #define VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_ namespace views { namespace internal { class NativeMenuHostDelegate { public: virtual ~NativeMenuHostDelegate() {} }; } // namespace internal } // namespace views #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
Enable ubluepy central by default if running nrf52/s132 bluetooth stack. Maturity of the module is pretty OK now.
#ifndef BLUETOOTH_CONF_H__ #define BLUETOOTH_CONF_H__ // SD specific configurations. #if (BLUETOOTH_SD == 110) #define MICROPY_PY_BLE (1) #define MICROPY_PY_BLE_NUS (0) #define BLUETOOTH_WEBBLUETOOTH_REPL (0) #define MICROPY_PY_UBLUEPY (1) #define MICROPY_PY_UBLUEPY_PERIPHERAL (1) #elif (BLUETOOTH_SD == 132) #define MICROPY_PY_BLE (1) #define MICROPY_PY_BLE_NUS (0) #define BLUETOOTH_WEBBLUETOOTH_REPL (0) #define MICROPY_PY_UBLUEPY (1) #define MICROPY_PY_UBLUEPY_PERIPHERAL (1) #define MICROPY_PY_UBLUEPY_CENTRAL (0) #else #error "SD not supported" #endif // Default defines. #ifndef MICROPY_PY_BLE #define MICROPY_PY_BLE (0) #endif #ifndef MICROPY_PY_BLE_NUS #define MICROPY_PY_BLE_NUS (0) #endif #endif
#ifndef BLUETOOTH_CONF_H__ #define BLUETOOTH_CONF_H__ // SD specific configurations. #if (BLUETOOTH_SD == 110) #define MICROPY_PY_BLE (1) #define MICROPY_PY_BLE_NUS (0) #define BLUETOOTH_WEBBLUETOOTH_REPL (0) #define MICROPY_PY_UBLUEPY (1) #define MICROPY_PY_UBLUEPY_PERIPHERAL (1) #elif (BLUETOOTH_SD == 132) #define MICROPY_PY_BLE (1) #define MICROPY_PY_BLE_NUS (0) #define BLUETOOTH_WEBBLUETOOTH_REPL (0) #define MICROPY_PY_UBLUEPY (1) #define MICROPY_PY_UBLUEPY_PERIPHERAL (1) #define MICROPY_PY_UBLUEPY_CENTRAL (1) #else #error "SD not supported" #endif // Default defines. #ifndef MICROPY_PY_BLE #define MICROPY_PY_BLE (0) #endif #ifndef MICROPY_PY_BLE_NUS #define MICROPY_PY_BLE_NUS (0) #endif #endif
Update the driver version to 8.05.00.03-k.
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.04.00.13-k" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 4 #define QLA_DRIVER_PATCH_VER 0 #define QLA_DRIVER_BETA_VER 0
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.05.00.03-k" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 5 #define QLA_DRIVER_PATCH_VER 0 #define QLA_DRIVER_BETA_VER 0
Fix host building in Linux (part 2/x).
// // Aspia Project // Copyright (C) 2016-2022 Dmitry Chapyshev <dmitry@aspia.ru> // // 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 <https://www.gnu.org/licenses/>. // #ifndef HOST_HOST_EXPORT_H #define HOST_HOST_EXPORT_H #if defined(HOST_IMPLEMENTATION) #define HOST_EXPORT __declspec(dllexport) #else #define HOST_EXPORT __declspec(dllimport) #endif // defined(HOST_IMPLEMENTATION) #endif // HOST_HOST_EXPORT_H
// // Aspia Project // Copyright (C) 2016-2022 Dmitry Chapyshev <dmitry@aspia.ru> // // 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 <https://www.gnu.org/licenses/>. // #ifndef HOST_HOST_EXPORT_H #define HOST_HOST_EXPORT_H #include "build/build_config.h" #if defined(OS_WIN) #if defined(HOST_IMPLEMENTATION) #define HOST_EXPORT __declspec(dllexport) #else #define HOST_EXPORT __declspec(dllimport) #endif // defined(HOST_IMPLEMENTATION) #else #if defined(HOST_IMPLEMENTATION) #define HOST_EXPORT __attribute__((visibility("default"))) #else #define HOST_EXPORT #endif #endif #endif // HOST_HOST_EXPORT_H
Fix keyboard.isDown check for multiple keys
/** * Copyright (c) 2017 rxi * * This library is free software; you can redistribute it and/or modify it * under the terms of the MIT license. See LICENSE for details. */ #include "keyboard.h" #include "luaobj.h" int l_keyboard_setKeyRepeat(lua_State *L) { keyboard_setKeyRepeat( lua_toboolean(L, 1) ); return 0; } int l_keyboard_isDown(lua_State *L) { int n = lua_gettop(L); int res = 0; int i; for (i = 1; i <= n; i++) { const char *key = luaL_checkstring(L, 1); res |= keyboard_isDown(key); } lua_pushboolean(L, res); return 1; } int luaopen_keyboard(lua_State *L) { luaL_Reg reg[] = { { "setKeyRepeat", l_keyboard_setKeyRepeat }, { "isDown", l_keyboard_isDown }, { 0, 0 }, }; luaL_newlib(L, reg); return 1; }
/** * Copyright (c) 2017 rxi * * This library is free software; you can redistribute it and/or modify it * under the terms of the MIT license. See LICENSE for details. */ #include "keyboard.h" #include "luaobj.h" int l_keyboard_setKeyRepeat(lua_State *L) { keyboard_setKeyRepeat( lua_toboolean(L, 1) ); return 0; } int l_keyboard_isDown(lua_State *L) { int n = lua_gettop(L); int res = 0; int i; for (i = 1; i <= n; i++) { const char *key = luaL_checkstring(L, i); res |= keyboard_isDown(key); } lua_pushboolean(L, res); return 1; } int luaopen_keyboard(lua_State *L) { luaL_Reg reg[] = { { "setKeyRepeat", l_keyboard_setKeyRepeat }, { "isDown", l_keyboard_isDown }, { 0, 0 }, }; luaL_newlib(L, reg); return 1; }
Add font name to context.
// // Copyright (c) 2013 Carson McDonald // // 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/Foundation.h> @interface OverlayContext : NSObject @property (nonatomic, copy) NSString *bannerText; @property (nonatomic, assign) CGFloat bannerHeightPadding; @property (nonatomic, assign) CGSize inputImageSize; @property (nonatomic, assign) CGSize bannerSize; @property (nonatomic, assign) CGContextRef workingContext; @property (nonatomic, assign) CGContextRef bannerContext; @property (nonatomic, copy) NSString *outputFilename; @end
// // Copyright (c) 2013 Carson McDonald // // 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/Foundation.h> @interface OverlayContext : NSObject @property (nonatomic, copy) NSString *bannerText; @property (nonatomic, assign) CGFloat bannerHeightPadding; @property (nonatomic, assign) CGSize inputImageSize; @property (nonatomic, assign) CGSize bannerSize; @property (nonatomic, assign) CGContextRef workingContext; @property (nonatomic, assign) CGContextRef bannerContext; @property (nonatomic, copy) NSString *outputFilename; @property (nonatomic, copy) NSString *fontName; @end
Fix STARTS_WITH macro comparing 1 less character than needed
#ifndef UTIL_H #define UTIL_H /*** Utility functions ***/ #define ALLOC(type) ((type*) xmalloc(sizeof(type))) void *xmalloc(size_t); #define STARTS_WITH(x, y) (strncmp((x), (y), sizeof(y) - 1) == 0) #endif /* UTIL_H */
#ifndef UTIL_H #define UTIL_H /*** Utility functions ***/ #define ALLOC(type) ((type*) xmalloc(sizeof(type))) void *xmalloc(size_t); #define STARTS_WITH(x, y) (strncmp((x), (y), strlen(y)) == 0) #endif /* UTIL_H */
Fix include path typo from merge conflicts
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef IREE_COMPILER_DIALECT_IREE_TRANSFORMS_PASSES_H_ #define IREE_COMPILER_DIALECT_IREE_TRANSFORMS_PASSES_H_ #include "third_party/llvm/llvm-project/mlir//include/mlir/IR/Module.h" #include "third_party/llvm/llvm-project/mlir//include/mlir/Pass/Pass.h" namespace mlir { namespace iree_compiler { namespace IREE { std::unique_ptr<OpPassBase<ModuleOp>> createDropCompilerHintsPass(); } // namespace IREE } // namespace iree_compiler } // namespace mlir #endif // IREE_COMPILER_DIALECT_IREE_TRANSFORMS_PASSES_H_
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef IREE_COMPILER_DIALECT_IREE_TRANSFORMS_PASSES_H_ #define IREE_COMPILER_DIALECT_IREE_TRANSFORMS_PASSES_H_ #include "mlir/IR/Module.h" #include "mlir/Pass/Pass.h" namespace mlir { namespace iree_compiler { namespace IREE { std::unique_ptr<OpPassBase<ModuleOp>> createDropCompilerHintsPass(); } // namespace IREE } // namespace iree_compiler } // namespace mlir #endif // IREE_COMPILER_DIALECT_IREE_TRANSFORMS_PASSES_H_
Add missing file from r286566
//===-- llvm/Bitcode/BitcodeWriter.h - Bitcode writers ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This header defines interfaces to write LLVM bitcode files/streams. // //===----------------------------------------------------------------------===// #ifndef LLVM_BITCODE_BITCODEWRITER_H #define LLVM_BITCODE_BITCODEWRITER_H #include "llvm/IR/ModuleSummaryIndex.h" #include <string> namespace llvm { class Module; class raw_ostream; /// \brief Write the specified module to the specified raw output stream. /// /// For streams where it matters, the given stream should be in "binary" /// mode. /// /// If \c ShouldPreserveUseListOrder, encode the use-list order for each \a /// Value in \c M. These will be reconstructed exactly when \a M is /// deserialized. /// /// If \c Index is supplied, the bitcode will contain the summary index /// (currently for use in ThinLTO optimization). /// /// \p GenerateHash enables hashing the Module and including the hash in the /// bitcode (currently for use in ThinLTO incremental build). void WriteBitcodeToFile(const Module *M, raw_ostream &Out, bool ShouldPreserveUseListOrder = false, const ModuleSummaryIndex *Index = nullptr, bool GenerateHash = false); /// Write the specified module summary index to the given raw output stream, /// where it will be written in a new bitcode block. This is used when /// writing the combined index file for ThinLTO. When writing a subset of the /// index for a distributed backend, provide the \p ModuleToSummariesForIndex /// map. void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out, const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex = nullptr); } // End llvm namespace #endif
Add missing file from r128851.
//===-- MCJITMemoryManager.h - Definition for the Memory Manager ---C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_EXECUTIONENGINE_MCJITMEMORYMANAGER_H #define LLVM_LIB_EXECUTIONENGINE_MCJITMEMORYMANAGER_H #include "llvm/Module.h" #include "llvm/ExecutionEngine/JITMemoryManager.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" #include <assert.h> namespace llvm { // The MCJIT memory manager is a layer between the standard JITMemoryManager // and the RuntimeDyld interface that maps objects, by name, onto their // matching LLVM IR counterparts in the module(s) being compiled. class MCJITMemoryManager : public RTDyldMemoryManager { JITMemoryManager *JMM; // FIXME: Multiple modules. Module *M; public: MCJITMemoryManager(JITMemoryManager *jmm) : JMM(jmm) {} // Allocate ActualSize bytes, or more, for the named function. Return // a pointer to the allocated memory and update Size to reflect how much // memory was acutally allocated. uint64_t startFunctionBody(const char *Name, uintptr_t &Size) { Function *F = M->getFunction(Name); assert(F && "No matching function in JIT IR Module!"); return (uint64_t)JMM->startFunctionBody(F, Size); } // Mark the end of the function, including how much of the allocated // memory was actually used. void endFunctionBody(const char *Name, uint64_t FunctionStart, uint64_t FunctionEnd) { Function *F = M->getFunction(Name); assert(F && "No matching function in JIT IR Module!"); // The JITMemoryManager interface makes the unfortunate assumption that // the address space/sizes we're compiling on are the same as what we're // compiling for, so it uses pointer types for its addresses. Explicit // casts between them to deal with that. return JMM->endFunctionBody(F, (uint8_t*)FunctionStart, (uint8_t*)FunctionEnd); } }; } // End llvm namespace #endif
Fix definition for bitrate tracer type
/* GstShark - A Front End for GstTracer * Copyright (C) 2016-2017 RidgeRun Engineering <michael.gruner@ridgerun.com> * * This file is part of GstShark. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __GST_BITRATE_TRACER_H__ #define __GST_BITRATE_TRACER_H__ #include "gstperiodictracer.h" G_BEGIN_DECLS typedef struct _GstBitrateTracer GstBitrateTracer; G_DECLARE_FINAL_TYPE (GstBitrateTracer, gst_bitrate_tracer, GST, BITRATE_TRACER, GstPeriodicTracer) G_END_DECLS #endif /* __GST_BITRATE_TRACER_H__ */
/* GstShark - A Front End for GstTracer * Copyright (C) 2016-2017 RidgeRun Engineering <michael.gruner@ridgerun.com> * * This file is part of GstShark. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __GST_BITRATE_TRACER_H__ #define __GST_BITRATE_TRACER_H__ #include "gstperiodictracer.h" G_BEGIN_DECLS #define GST_TYPE_BITRATE_TRACER (gst_bitrate_tracer_get_type ()) G_DECLARE_FINAL_TYPE (GstBitrateTracer, gst_bitrate_tracer, GST, BITRATE_TRACER, GstPeriodicTracer) G_END_DECLS #endif /* __GST_BITRATE_TRACER_H__ */
Fix screwup in changing copyright notices
#ifdef XML_UNICODE #ifndef XML_UNICODE_WCHAR_T #error xmlwf requires a 16-bit Unicode-compatible wchar_t #endif #define T(x) L ## x #define ftprintf fwprintf #define tfopen _wfopen #define fputts fputws #define puttc putwc #define tcscmp wcscmp #define tcscpy wcscpy #define tcscat wcscat #define tcschr wcschr #define tcsrchr wcsrchr #define tcslen wcslen #define tperror _wperror #define topen _wopen #define tmain wmain #define tremove _wremove #else /* not XML_UNICODE */ #define T(x) x #define ftprintf fprintf #define tfopen fopen #define fputts fputs #define puttc putc #define tcscmp strcmp #define tcscpy strcpy #define tcscat strcat #define tcschr strchr #define tcsrchr strrchr #define tcslen strlen #define tperror perror #define topen open #define tmain main #define tremove remove #endif /* not XML_UNICODE */
Add a missing taint tester warning.
// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.taint,debug.TaintTest -verify %s int scanf(const char *restrict format, ...); int getchar(void); #define BUFSIZE 10 int Buffer[BUFSIZE]; void bufferScanfAssignment(int x) { int n; int *addr = &Buffer[0]; scanf("%d", &n); addr += n;// expected-warning {{tainted}} *addr = n; // expected-warning {{tainted}} }
// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.taint,debug.TaintTest -verify %s int scanf(const char *restrict format, ...); int getchar(void); #define BUFSIZE 10 int Buffer[BUFSIZE]; void bufferScanfAssignment(int x) { int n; int *addr = &Buffer[0]; scanf("%d", &n); addr += n;// expected-warning {{tainted}} *addr = n; // expected-warning {{tainted}} expected-warning {{tainted}} }
Make the clang-cl test less restrictive.
// Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. // RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=BUILTIN // BUILTIN: "-internal-isystem" "{{.*lib.*clang.*[0-9]\.[0-9].*include}}" // RUN: %clang_cl -nobuiltininc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOBUILTIN // NOBUILTIN-NOT: "-internal-isystem" "{{.*lib.*clang.*[0-9]\.[0-9].*include}}" // RUN: env INCLUDE=/my/system/inc %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=STDINC // STDINC: "-internal-isystem" "/my/system/inc" // RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc"
// Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. // RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=BUILTIN // BUILTIN: "-internal-isystem" "{{.*lib.*clang.*include}}" // RUN: %clang_cl -nobuiltininc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOBUILTIN // NOBUILTIN-NOT: "-internal-isystem" "{{.*lib.*clang.*include}}" // RUN: env INCLUDE=/my/system/inc %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=STDINC // STDINC: "-internal-isystem" "/my/system/inc" // RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc"
Fix build break from bad merge
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Multiply-included file, hence no include guard. // Inclusion of all message files present in the system. Keep this file // up-to-date when adding a new value to enum IPCMessageStart in // ipc/ipc_message_utils.h to include the corresponding message file. #include "chrome/browser/importer/profile_import_process_messages.h" #include "chrome/common/automation_messages.h" #include "chrome/common/common_message_generator.h" #include "chrome/common/nacl_messages.h" #include "content/common/content_message_generator.h" #include "ppapi/proxy/ppapi_messages.h"
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Multiply-included file, hence no include guard. // Inclusion of all message files present in the system. Keep this file // up-to-date when adding a new value to enum IPCMessageStart in // ipc/ipc_message_utils.h to include the corresponding message file. #include "chrome/browser/importer/profile_import_process_messages.h" #include "chrome/common/common_message_generator.h" #include "chrome/common/nacl_messages.h" #include "content/common/content_message_generator.h" #include "content/common/pepper_messages.h" #include "ppapi/proxy/ppapi_messages.h"
Make Body an opaque typedef of std::string
#ifndef CPR_BODY_H #define CPR_BODY_H #include <string> #include "defines.h" namespace cpr { class Body { public: template <typename TextType> Body(TextType&& p_text) : text{CPR_FWD(p_text)} {} std::string text; }; } // namespace cpr #endif
#ifndef CPR_BODY_H #define CPR_BODY_H #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
Add calcFitted and calcResid definitions.
int wls(double* X, int n, int p, double* y, double* w, double* XTX, double *sqw, double* sqwX, double* sqwy, double* coef);
int wls(double* X, int n, int p, double* y, double* w, double* XTX, double *sqw, double* sqwX, double* sqwy, double* coef); int calcFitted(double* X, int n, int p, double* y, double* coef, double* fitted); int calcResid(double* X, int n, int p, double* y, double* coef, double* resid);
Add test case for mingw -fuse-ld= support introduced in r242121.
// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_LD_32 %s // CHECK_LD_32: {{ld|ld.exe}}" // CHECK_LD_32: "i386pe" // CHECK_LD_32_NOT: "-flavor" "gnu" // RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_32 %s // CHECK_LLD_32: "lld" "-flavor" "gnu" // CHECK_LLD_32: "i386pe" // RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=link.exe 2>&1 | FileCheck -check-prefix=CHECK_LINK_32 %s // CHECK_LINK_32: link.exe" // CHECK_LINK_32: "i386pe" // RUN: %clang -### -target x86_64-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_64 %s // CHECK_LLD_64: "lld" "-flavor" "gnu" // CHECK_LLD_64: "i386pep" // RUN: %clang -### -target arm-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_ARM %s // CHECK_LLD_ARM: "lld" "-flavor" "gnu" // CHECK_LLD_ARM: "thumb2pe"
Add comments to confusing test
// PARAM: --enable ana.int.congruence void unsignedCase() { unsigned int top; unsigned int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { assert(top%17 == 3); //UNKNOWN! } } int main() { int top; int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { assert(top%17 == 3); //UNKNOWN! } unsignedCase(); }
// PARAM: --enable ana.int.congruence void unsignedCase() { unsigned int top; unsigned int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { // This is unreachable in the concrete! assert(top%17 == 3); //UNKNOWN! } } int main() { int top; int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { // This is unreachable in the concrete! assert(top%17 == 3); //UNKNOWN! } unsignedCase(); }
Fix build error when importing debug controller header
/* * Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #import <Foundation/Foundation.h> #import <ComponentKit/CKComponentInternal.h> #import <ComponentKit/CKComponentViewConfiguration.h> @class CKComponent; @class UIView; /** CKComponentDebugController exposes the functionality needed by the lldb helpers to control the debug behavior for components. */ @interface CKComponentDebugController : NSObject + (BOOL)debugMode; /** Setting the debug mode enables the injection of debug configuration into the component. */ + (void)setDebugMode:(BOOL)debugMode; /** Components are an immutable construct. Whenever we make changes to the parameters on which the components depended, the changes won't be reflected in the component hierarchy until we explicitly cause a reflow/update. A reflow essentially rebuilds the component hierarchy and mounts it back on the view. This is particularly used in reflowing the component hierarchy when we set the debug mode. */ + (void)reflowComponents; @end /** Returns an adjusted mount context that inserts a debug view if the viewConfiguration doesn't have a view. */ CK::Component::MountContext CKDebugMountContext(Class componentClass, const CK::Component::MountContext &context, const CKComponentViewConfiguration &viewConfiguration, const CGSize size);
/* * Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #import <Foundation/Foundation.h> #import <ComponentKit/CKComponentViewConfiguration.h> @class CKComponent; @class UIView; /** CKComponentDebugController exposes the functionality needed by the lldb helpers to control the debug behavior for components. */ @interface CKComponentDebugController : NSObject + (BOOL)debugMode; /** Setting the debug mode enables the injection of debug configuration into the component. */ + (void)setDebugMode:(BOOL)debugMode; /** Components are an immutable construct. Whenever we make changes to the parameters on which the components depended, the changes won't be reflected in the component hierarchy until we explicitly cause a reflow/update. A reflow essentially rebuilds the component hierarchy and mounts it back on the view. This is particularly used in reflowing the component hierarchy when we set the debug mode. */ + (void)reflowComponents; @end /** Returns an adjusted mount context that inserts a debug view if the viewConfiguration doesn't have a view. */ CK::Component::MountContext CKDebugMountContext(Class componentClass, const CK::Component::MountContext &context, const CKComponentViewConfiguration &viewConfiguration, const CGSize size);
Use static_cast in void* casting
// // Created by dar on 12/22/15. // #ifndef C003_CONTACTFILTER_H #define C003_CONTACTFILTER_H #include <Box2D/Dynamics/b2WorldCallbacks.h> #include <Box2D/Dynamics/b2Fixture.h> #include "../map/entity/Entity.h" class ContactFilter : public b2ContactFilter { bool doesCollide(void *a, void *b) { bool collisionAwithB = true, collisionBwithA = true; if (Entity *entity = reinterpret_cast<Entity *>(a)) { collisionAwithB = entity->doesCollide(reinterpret_cast<IPositionable *>(b)); } if (Entity *entity = reinterpret_cast<Entity *>(b)) { collisionBwithA = entity->doesCollide(reinterpret_cast<IPositionable *>(a)); } return collisionAwithB && collisionBwithA; } virtual bool ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB) override { void *bodyDataA = fixtureA->GetBody()->GetUserData(); void *bodyDataB = fixtureB->GetBody()->GetUserData(); return doesCollide(bodyDataA, bodyDataB); } }; #endif //C003_CONTACTFILTER_H
// // Created by dar on 12/22/15. // #ifndef C003_CONTACTFILTER_H #define C003_CONTACTFILTER_H #include <Box2D/Dynamics/b2WorldCallbacks.h> #include <Box2D/Dynamics/b2Fixture.h> #include "../map/entity/Entity.h" class ContactFilter : public b2ContactFilter { bool doesCollide(void *a, void *b) { bool collisionAwithB = true, collisionBwithA = true; if (Entity *entity = reinterpret_cast<Entity *>(a)) { collisionAwithB = entity->doesCollide(static_cast<IPositionable *>(b)); } if (Entity *entity = reinterpret_cast<Entity *>(b)) { collisionBwithA = entity->doesCollide(static_cast<IPositionable *>(a)); } return collisionAwithB && collisionBwithA; } virtual bool ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB) override { void *bodyDataA = fixtureA->GetBody()->GetUserData(); void *bodyDataB = fixtureB->GetBody()->GetUserData(); return doesCollide(bodyDataA, bodyDataB); } }; #endif //C003_CONTACTFILTER_H
Update docs on cdz_availableString NSFileHandle category method
// // NSFileHandle+CDZCLIStringReading.h // CDZCLIApplication // // Created by Chris Dzombak on 1/13/14. // Copyright (c) 2014 Chris Dzombak. All rights reserved. // @import Foundation; @interface NSFileHandle (CDZCLIStringReading) /// Read this handle's `-availableData` as a string, stripping any trailing newline. - (NSString *)cdz_availableString; @end
// // NSFileHandle+CDZCLIStringReading.h // CDZCLIApplication // // Created by Chris Dzombak on 1/13/14. // Copyright (c) 2014 Chris Dzombak. All rights reserved. // @import Foundation; @interface NSFileHandle (CDZCLIStringReading) /// Read this handle's `-availableData` as a string, stripping a single trailing newline. /// Useful with +[NSFileHandle fileHandleWithStandardInput]. - (NSString *)cdz_availableString; @end
Increase stack array size from 48 to 64
#ifndef BUFFER_H_ #define BUFFER_H_ #define BUFFER_SIZEOF_DESIRED 48 typedef struct Buffer { unsigned int pos; unsigned int size; char* data; char fixed[BUFFER_SIZEOF_DESIRED - 2*sizeof(unsigned int) - 1*sizeof(char*)]; } Buffer; Buffer* buffer_init(Buffer* buffer, unsigned int size); Buffer* buffer_fini(Buffer* buffer); Buffer* buffer_wrap(Buffer* buffer, const char* data, unsigned int length); Buffer* buffer_ensure_total(Buffer* buffer, unsigned int size); Buffer* buffer_ensure_unused(Buffer* buffer, unsigned int size); Buffer* buffer_reset(Buffer* buffer); Buffer* buffer_rewind(Buffer* buffer); Buffer* buffer_terminate(Buffer* buffer); Buffer* buffer_append(Buffer* buffer, const char* source, unsigned int length); #endif
#ifndef BUFFER_H_ #define BUFFER_H_ #define BUFFER_SIZEOF_DESIRED 64 typedef struct Buffer { unsigned int pos; unsigned int size; char* data; char fixed[BUFFER_SIZEOF_DESIRED - 2*sizeof(unsigned int) - 1*sizeof(char*)]; } Buffer; Buffer* buffer_init(Buffer* buffer, unsigned int size); Buffer* buffer_fini(Buffer* buffer); Buffer* buffer_wrap(Buffer* buffer, const char* data, unsigned int length); Buffer* buffer_ensure_total(Buffer* buffer, unsigned int size); Buffer* buffer_ensure_unused(Buffer* buffer, unsigned int size); Buffer* buffer_reset(Buffer* buffer); Buffer* buffer_rewind(Buffer* buffer); Buffer* buffer_terminate(Buffer* buffer); Buffer* buffer_append(Buffer* buffer, const char* source, unsigned int length); #endif
Add instance variables, remove callbacks
#pragma once #define WIN32_LEAN_AND_MEAN #include <Windows.h> #include <malloc.h> #include <memory.h> #include <prsht.h> #include <stdlib.h> #include <tchar.h> #include "../3RVX/3RVX.h" #include "resource.h" class SettingsUI : public Window { public: SettingsUI(HINSTANCE hInstance); INT_PTR LaunchPropertySheet(); virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); private: }; /* Forward Declarations */ LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam); BOOL CALLBACK GeneralTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK DisplayTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK OSDTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK HotkeyTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK AboutTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
#pragma once #define WIN32_LEAN_AND_MEAN #include <Windows.h> #include <malloc.h> #include <memory.h> #include <prsht.h> #include <stdlib.h> #include <tchar.h> #include <vector> #include "../3RVX/3RVX.h" #include "resource.h" class About; class Display; class General; class Hotkeys; class OSD; class TabPage; class SettingsUI : public Window { public: SettingsUI(HINSTANCE hInstance); INT_PTR LaunchPropertySheet(); virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); private: std::vector<TabPage *> _tabs; General *_general; Display *_display; OSD *_osd; Hotkeys *_hotkeys; About *_about; private: /* Startup x/y location offsets */ static const int XOFFSET = 70; static const int YOFFSET = 20; }; /* Forward Declarations */ LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam);
Add compile option for sqlite db upgrades.
/* Uncomment to compile with tcpd/libwrap support. */ //#define WITH_WRAP /* Compile with database upgrading support? If disabled, mosquitto won't * automatically upgrade old database versions. */ //#define WITH_DB_UPGRADE /* Compile with memory tracking support? If disabled, mosquitto won't track * heap memory usage nor export '$SYS/broker/heap/current size', but will use * slightly less memory and CPU time. */ #define WITH_MEMORY_TRACKING
/* Uncomment to compile with tcpd/libwrap support. */ //#define WITH_WRAP /* Compile with database upgrading support? If disabled, mosquitto won't * automatically upgrade old database versions. */ //#define WITH_DB_UPGRADE /* Compile with memory tracking support? If disabled, mosquitto won't track * heap memory usage nor export '$SYS/broker/heap/current size', but will use * slightly less memory and CPU time. */ #define WITH_MEMORY_TRACKING /* Compile with the ability to upgrade from old style sqlite persistent * databases to the new mosquitto format. This means a dependency on sqlite. It * isn't needed for new installations. */ #define WITH_SQLITE_UPGRADE
Add newline between comments and includes
/** * @file * * @date Nov 12, 2013 * @author: Anton Bondarev */ #include <stddef.h> #include <kernel/task.h> #include <kernel/thread/thread_stack.h> #include <kernel/panic.h> struct task *task_alloc(struct task *task, size_t task_size) { void *addr; assert(task); assert(task->main_thread); addr = thread_stack_get(task->main_thread); if (thread_stack_reserved(task->main_thread, task_size) < 0) { panic("Too small thread stack size"); } return addr; }
/** * @file * * @date Nov 12, 2013 * @author: Anton Bondarev */ #include <stddef.h> #include <kernel/task.h> #include <kernel/thread/thread_stack.h> #include <kernel/panic.h> struct task *task_alloc(struct task *task, size_t task_size) { void *addr; assert(task); assert(task->main_thread); addr = thread_stack_get(task->main_thread); if (thread_stack_reserved(task->main_thread, task_size) < 0) { panic("Too small thread stack size"); } return addr; }
Update return datatype function 'createRandomPopulation'.
#ifndef POPULATION_H #define POPULATION_H class POPULATION { public: int **initializePopulation(int individuals, int genes, bool FILL_ZERO = false); int **createRandomPopulation(int **population, int individuals, int genes); }; #endif
#ifndef POPULATION_H #define POPULATION_H class POPULATION { public: int **initializePopulation(int individuals, int genes, bool FILL_ZERO = false); int createRandomPopulation(int **population, int individuals, int genes); }; #endif
Add missing DLL export for log::SinkManager
#ifndef SINKMANAGER_H #define SINKMANAGER_H #include <dsnutil/singleton.h> #include <dsnutil/log/base.h> #include <map> #include <string> #include <boost/shared_ptr.hpp> #include <boost/log/sinks.hpp> namespace dsn { namespace log { class SinkManager : public dsn::Singleton<SinkManager>, public Base<SinkManager> { friend class dsn::Singleton<SinkManager>; SinkManager(); ~SinkManager(); public: /// \brief Pointer to a managed log sink typedef boost::shared_ptr<boost::log::sinks::sink> sink_ptr; bool exists(const std::string& name) const; bool add(const std::string& name, const sink_ptr& sink); bool remove(const std::string& name); std::vector<std::string> sinks() const; sink_ptr sink(const std::string& name); private: /// \brief Storage container type for managed log sinks typedef std::map<std::string, sink_ptr> sink_storage; /// \brief Storage container for managed log sinks sink_storage m_sinks; }; } } #endif // SINKMANAGER_H
#ifndef SINKMANAGER_H #define SINKMANAGER_H #include <dsnutil/dsnutil_cpp_Export.h> #include <dsnutil/singleton.h> #include <dsnutil/log/base.h> #include <map> #include <string> #include <boost/shared_ptr.hpp> #include <boost/log/sinks.hpp> namespace dsn { namespace log { class dsnutil_cpp_EXPORT SinkManager : public dsn::Singleton<SinkManager>, public Base<SinkManager> { friend class dsn::Singleton<SinkManager>; SinkManager(); ~SinkManager(); public: /// \brief Pointer to a managed log sink typedef boost::shared_ptr<boost::log::sinks::sink> sink_ptr; bool exists(const std::string& name) const; bool add(const std::string& name, const sink_ptr& sink); bool remove(const std::string& name); std::vector<std::string> sinks() const; sink_ptr sink(const std::string& name); private: /// \brief Storage container type for managed log sinks typedef std::map<std::string, sink_ptr> sink_storage; /// \brief Storage container for managed log sinks sink_storage m_sinks; }; } } #endif // SINKMANAGER_H
Add new functions described in TODO comment
// CommonFunc.h -- header file /* * * Author: septimomend (Ivan Chapkailo) * * 30.06.2017 * */ #pragma once #include "stdafx.h" #include "AllControllers.h" #include "AdditionalBuffer.h" class Common : public AllControllers { public: Common(AllControllers* all); // cstr /* * draws */ void drawRows(Adbfr* abfr); void drawStatusBar(Adbfr* abfr); void drawMessageBar(Adbfr* abfr); /* * operations */ void statusMsg(const char *fmt, ...); void updateScreen(); char *callPrompt(char *prompt, void (*callback)(char *, int)); void scrolling(); private: ConfigurationController* m_cnfg; Adbfr m_abfr; };
// CommonFunc.h -- header file /* * * Author: septimomend (Ivan Chapkailo) * * 30.06.2017 * */ #pragma once #include "stdafx.h" #include "AllControllers.h" #include "AdditionalBuffer.h" class Common : public AllControllers { public: Common(AllControllers* all); // cstr /* * draws */ void drawRows(Adbfr* abfr); void drawStatusBar(Adbfr* abfr); void drawMessageBar(Adbfr* abfr); /* * operations */ void statusMsg(const char *fmt, ...); void updateScreen(); char *callPrompt(char *prompt, void (*callback)(char *, int)); void scrolling(); /* * TODO * * void moveCursor(int key); * void processKeypress(); */ private: ConfigurationController* m_cnfg; Adbfr m_abfr; };
Remove a lingering ref to mapping.c
/* Include this file in your project * if you don't want to build libmypaint as a separate library * Note that still need to do -I./path/to/libmypaint/sources * for the includes here to succeed. */ #include "mapping.c" #include "helpers.c" #include "brushmodes.c" #include "fifo.c" #include "operationqueue.c" #include "rng-double.c" #include "utils.c" #include "tilemap.c" #include "mypaint.c" #include "mypaint-brush.c" #include "mypaint-brush-settings.c" #include "mypaint-fixed-tiled-surface.c" #include "mypaint-surface.c" #include "mypaint-tiled-surface.c" #include "mypaint-rectangle.c"
/* Include this file in your project * if you don't want to build libmypaint as a separate library * Note that still need to do -I./path/to/libmypaint/sources * for the includes here to succeed. */ #include "helpers.c" #include "brushmodes.c" #include "fifo.c" #include "operationqueue.c" #include "rng-double.c" #include "utils.c" #include "tilemap.c" #include "mypaint.c" #include "mypaint-brush.c" #include "mypaint-brush-settings.c" #include "mypaint-fixed-tiled-surface.c" #include "mypaint-surface.c" #include "mypaint-tiled-surface.c" #include "mypaint-rectangle.c" #include "mypaint-mapping.c"
Add test case for out-of-bound memory access checking.
// RUN: clang -checker-simple -analyzer-store-region -verify %s char f1() { char* s = "abcd"; return s[4]; // expected-warning{{Load or store into an out-of-bound memory position.}} }
Create the main program with print the coordinates of the first point of a newly generated polygon
#include <polygon.h> int main(int argc, char* argv[]) { Polygon lol; lol=createPolygon(); printf("\n\nx premier point : %f", lol->value.x); printf("\ny premier point : %f\n\n", lol->value.y); return EXIT_SUCCESS; }
Bump version to 1.13, matching blender 2.90 release cycle
/* * Copyright 2011-2016 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __UTIL_VERSION_H__ #define __UTIL_VERSION_H__ /* Cycles version number */ CCL_NAMESPACE_BEGIN #define CYCLES_VERSION_MAJOR 1 #define CYCLES_VERSION_MINOR 12 #define CYCLES_VERSION_PATCH 0 #define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c #define CYCLES_MAKE_VERSION_STRING(a, b, c) CYCLES_MAKE_VERSION_STRING2(a, b, c) #define CYCLES_VERSION_STRING \ CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, CYCLES_VERSION_MINOR, CYCLES_VERSION_PATCH) CCL_NAMESPACE_END #endif /* __UTIL_VERSION_H__ */
/* * Copyright 2011-2016 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __UTIL_VERSION_H__ #define __UTIL_VERSION_H__ /* Cycles version number */ CCL_NAMESPACE_BEGIN #define CYCLES_VERSION_MAJOR 1 #define CYCLES_VERSION_MINOR 13 #define CYCLES_VERSION_PATCH 0 #define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c #define CYCLES_MAKE_VERSION_STRING(a, b, c) CYCLES_MAKE_VERSION_STRING2(a, b, c) #define CYCLES_VERSION_STRING \ CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, CYCLES_VERSION_MINOR, CYCLES_VERSION_PATCH) CCL_NAMESPACE_END #endif /* __UTIL_VERSION_H__ */
Check _MSC_VER is defined and less than 1900
#pragma once #if _MSC_VER < 1900 #define round(x) (x >= 0 ? (x + 0.5) : (x - 0.5)) #endif class WindowFeature { public: WindowFeature(); virtual ~WindowFeature(); virtual void apply(double *windowImage, double *descriptorVector) = 0; unsigned int descriptorLengthPerWindow; };
#pragma once #if defined(_MSC_VER) && _MSC_VER < 1900 #define round(x) (x >= 0 ? (x + 0.5) : (x - 0.5)) #endif class WindowFeature { public: WindowFeature(); virtual ~WindowFeature(); virtual void apply(double *windowImage, double *descriptorVector) = 0; unsigned int descriptorLengthPerWindow; };
Make C example more C, less asm
typedef union { unsigned char* ptr; unsigned short word[2]; } word_extract_t; void PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned offset, unsigned numBitplanes, unsigned screenWidthBytes) { int i; copper += offset; for (i = 0; i < numBitplanes; i++) { word_extract_t extract; extract.ptr = bitplanes; *(copper+1) = extract.word[1]; *(copper+3) = extract.word[0]; bitplanes += screenWidthBytes; copper += 4; } } static unsigned short _copperData; static unsigned char _bitplaneData; void TestCall() { PokeBitplanePointers(&_copperData, &_bitplaneData, 3, 4, 5); }
typedef union { unsigned char* ptr; struct { unsigned short hi; unsigned short lo; } words; } word_extract_t; void PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned offset, unsigned numBitplanes, unsigned screenWidthBytes) { int i; copper += offset; for (i = 0; i < numBitplanes; i++) { word_extract_t extract; extract.ptr = bitplanes; *(copper+1) = extract.words.lo; *(copper+3) = extract.words.hi; bitplanes += screenWidthBytes; copper += 4; } } static unsigned short _copperData; static unsigned char _bitplaneData; void TestCall() { PokeBitplanePointers(&_copperData, &_bitplaneData, 3, 4, 5); }
Add mfspr/mtspr inline macros to 4xx bootwrapper
#ifndef _PPC_BOOT_REG_H #define _PPC_BOOT_REG_H /* * Copyright 2007 Davud Gibson, IBM Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ static inline u32 mfpvr(void) { u32 pvr; asm volatile ("mfpvr %0" : "=r"(pvr)); return pvr; } register void *__stack_pointer asm("r1"); #define get_sp() (__stack_pointer) #endif /* _PPC_BOOT_REG_H */
#ifndef _PPC_BOOT_REG_H #define _PPC_BOOT_REG_H /* * Copyright 2007 Davud Gibson, IBM Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ static inline u32 mfpvr(void) { u32 pvr; asm volatile ("mfpvr %0" : "=r"(pvr)); return pvr; } #define __stringify_1(x) #x #define __stringify(x) __stringify_1(x) #define mfspr(rn) ({unsigned long rval; \ asm volatile("mfspr %0," __stringify(rn) \ : "=r" (rval)); rval; }) #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) register void *__stack_pointer asm("r1"); #define get_sp() (__stack_pointer) #endif /* _PPC_BOOT_REG_H */
Raise keyboard event stack size to 256
#ifndef H_KBD #define H_KBD #include <stddef.h> #include <stdbool.h> struct keyevent { int keycode; char character; bool release; bool shift; bool ctrl; } keybuffer[128]; void kbdinit(); bool kbdavail(); struct keyevent* kbdpoll(); void kbdregsig(bool* b); void kbdunregsig(bool* b); #endif
#ifndef H_KBD #define H_KBD #include <stddef.h> #include <stdbool.h> struct keyevent { int keycode; char character; bool release; bool shift; bool ctrl; } keybuffer[256]; void kbdinit(); bool kbdavail(); struct keyevent* kbdpoll(); void kbdregsig(bool* b); void kbdunregsig(bool* b); #endif
Make it easier to change stty constant if needed
#include <stdio.h> #include <stdlib.h> int main() { system("/bin/stty raw"); int i = 0; char str[] = "I AM AN IDIOT "; while(1){ for(i = 0; i<14; i++) { getchar(); printf("\b%c", str[i]); } system("/bin/stty cooked"); printf("\n"); system("/bin/stty raw"); } return 0; }
#include <stdio.h> #include <stdlib.h> #define STTY "/bin/stty " const char RAW[] = STTY "raw"; const char COOKED[] = STTY "cooked"; int main() { system(RAW); int i = 0; char str[] = "I AM AN IDIOT "; while(1){ for(i = 0; i<14; i++) { getchar(); printf("\b%c", str[i]); } system(COOKED); printf("\n"); system(RAW); } return 0; }
Add BSD 3-clause open source header
/* * mb.h - publicly accessible entry points for the memory buffer */ #ifndef _MB_H_ #define _MB_H_ #include "tuple.h" #include "table.h" #include "timestamp.h" void mb_init(); int mb_insert(unsigned char *buf, long len, Table *table); tstamp_t mb_insert_tuple(int ncols, char *vals[], Table *table); tstamp_t heap_insert_tuple(int ncols, char *vals[], Table *table, Node *n); Node *heap_alloc_node(int ncols, char *vals[], Table *table); void heap_remove_node(Node *n, Table *tn); void mb_dump(); #endif /* _MB_H_ */
/* * Copyright (c) 2013, Court of the University of Glasgow * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * - Neither the name of the University of Glasgow 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. */ /* * mb.h - publicly accessible entry points for the memory buffer */ #ifndef _MB_H_ #define _MB_H_ #include "tuple.h" #include "table.h" #include "timestamp.h" void mb_init(); int mb_insert(unsigned char *buf, long len, Table *table); tstamp_t mb_insert_tuple(int ncols, char *vals[], Table *table); tstamp_t heap_insert_tuple(int ncols, char *vals[], Table *table, Node *n); Node *heap_alloc_node(int ncols, char *vals[], Table *table); void heap_remove_node(Node *n, Table *tn); void mb_dump(); #endif /* _MB_H_ */
Add some basic test for message handling.
#include <arpa/inet.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <unistd.h> int main() { struct sockaddr_in serv_addr; memset(&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); serv_addr.sin_port = htons(7899); int fd = socket(AF_INET, SOCK_STREAM, 0); if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { fprintf(stderr, "Failed to connect with server\n"); return EXIT_FAILURE; } char buffer[1000]; char *write_ptr = buffer; const char *msg = "Hello World!"; uint32_t len = strlen(msg); len = htobe32(len); memcpy(write_ptr, &len, sizeof(len)); write_ptr += sizeof(len); memcpy(write_ptr, msg, strlen(msg)); write_ptr += strlen(msg); memcpy(write_ptr, &len, sizeof(len)); write_ptr += sizeof(len); memcpy(write_ptr, msg, strlen(msg)); write_ptr += strlen(msg); write(fd, buffer, write_ptr - buffer); close(fd); return EXIT_SUCCESS; }
Add BeIDE header required for building
//================================================================== // MTextAddOn.h // Copyright 1996 Metrowerks Corporation, All Rights Reserved. //================================================================== // This is a proxy class used by Editor add_ons. It does not inherit from BView // but provides an abstract interface to a text engine. #ifndef _MTEXTADDON_H #define _MTEXTADDON_H #include <SupportKit.h> class MIDETextView; class BWindow; struct entry_ref; class MTextAddOn { public: MTextAddOn( MIDETextView& inTextView); virtual ~MTextAddOn(); virtual const char* Text(); virtual int32 TextLength() const; virtual void GetSelection( int32 *start, int32 *end) const; virtual void Select( int32 newStart, int32 newEnd); virtual void Delete(); virtual void Insert( const char* inText); virtual void Insert( const char* text, int32 length); virtual BWindow* Window(); virtual status_t GetRef( entry_ref& outRef); virtual bool IsEditable(); private: MIDETextView& fText; }; #endif
Split up VersionString, will be useful for WebUI
/* * Super Entity Game Server * http://segs.sf.net/ * Copyright (c) 2006 Super Entity Game Server Team (see AUTHORS.md) * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details. * */ #define VersionString "segs v0.5.0 (The Unsilencer)"; #define CopyrightString "Super Entity Game Server\nhttp://github.com/Segs/\nCopyright (c) 2006-2018 Super Entity Game Server Team (see AUTHORS.md)\nThis software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.\n"; //const char *AdminVersionString="Undefined"; //const char *AuthVersionString="Undefined"; //const char *GameVersionString="Undefined"; //const char *MapVersionString="Undefined"; // Contains version information for the various server modules class VersionInfo { public: static const char *getAdminVersion(void); static const char *getAuthVersion(void) { return VersionString; } static const char *getGameVersion(void); static const char *getMapVersion(void); static const char *getCopyright(void) { return CopyrightString; } }; #undef VersionString #undef CopyrightString
/* * Super Entity Game Server * http://segs.sf.net/ * Copyright (c) 2006 Super Entity Game Server Team (see AUTHORS.md) * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details. * */ #define ProjectName "SEGS" #define VersionNumber "0.5.0" #define VersionName "The Unsilencer" #define VersionString ProjectName " v" VersionNumber " (" VersionName ")" #define CopyrightString "Super Entity Game Server\nhttp://github.com/Segs/\nCopyright (c) 2006-2018 Super Entity Game Server Team (see AUTHORS.md)\nThis software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.\n"; //const char *AdminVersionString="Undefined"; //const char *AuthVersionString="Undefined"; //const char *GameVersionString="Undefined"; //const char *MapVersionString="Undefined"; // Contains version information for the various server modules class VersionInfo { public: static const char *getAdminVersion(void); static const char *getAuthVersion(void) { return VersionString; } static const char *getAuthVersionNumber(void) { return VersionNumber; } static const char *getGameVersion(void); static const char *getMapVersion(void); static const char *getCopyright(void) { return CopyrightString; } }; #undef ProjectName #undef VersionName #undef VersionNumber #undef VersionString #undef CopyrightString
Correct c++ exit status values
#ifndef BIOTOOL_EXIT_STATUS_H #define BIOTOOL_EXIT_STATUS_H typedef enum {Success=0, Error_command_line=1, Error_open_file=2, Error_parse_file=3} exit_status; #endif
#ifndef BIOTOOL_EXIT_STATUS_H #define BIOTOOL_EXIT_STATUS_H typedef enum {Success=0, Error_open_file=1, Error_command_line=2, Error_parse_file=3} exit_status; #endif
Make this test emit llvm IR rather than assembly.
// FIXME: Check IR rather than asm, then triple is not needed. // RUN: %clang_cc1 -mllvm -asm-verbose -triple %itanium_abi_triple -S -O2 -g %s -o - | FileCheck %s // Radar 8122864 // Code is not generated for function foo, but preserve type information of // local variable xyz. static void foo() { // CHECK: DW_TAG_structure_type struct X { int a; int b; } xyz; } int bar() { foo(); return 1; }
// FIXME: Check IR rather than asm, then triple is not needed. // RUN: %clang_cc1 -triple %itanium_abi_triple -O2 -g -emit-llvm %s -o - | FileCheck %s // Radar 8122864 // Code is not generated for function foo, but preserve type information of // local variable xyz. static void foo() { // CHECK: DW_TAG_structure_type struct X { int a; int b; } xyz; } int bar() { foo(); return 1; }
Make the single argument constructor to CompositorOptions explicit
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ #define SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ #include "base/macros.h" #include <vector> namespace sky { namespace compositor { class CompositorOptions { public: using OptionType = unsigned int; enum class Option : OptionType { DisplayFrameStatistics, TerminationSentinel, }; CompositorOptions(); CompositorOptions(uint64_t mask); ~CompositorOptions(); bool isEnabled(Option option) const; void setEnabled(Option option, bool enabled); private: std::vector<bool> options_; DISALLOW_COPY_AND_ASSIGN(CompositorOptions); }; } // namespace compositor } // namespace sky #endif // SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ #define SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ #include "base/macros.h" #include <vector> namespace sky { namespace compositor { class CompositorOptions { public: using OptionType = unsigned int; enum class Option : OptionType { DisplayFrameStatistics, TerminationSentinel, }; CompositorOptions(); explicit CompositorOptions(uint64_t mask); ~CompositorOptions(); bool isEnabled(Option option) const; void setEnabled(Option option, bool enabled); private: std::vector<bool> options_; DISALLOW_COPY_AND_ASSIGN(CompositorOptions); }; } // namespace compositor } // namespace sky #endif // SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_
Change this so it works. This may be tricky to work through when a lot of modules depend on a lot of other modules.
class AdminHook : public Module { public: virtual ~AdminHook(); virtual std::vector<std::vector<std::string> > adminCommands(); virtual void onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master); }; class AdminMod : public Module { public: virtual ~AdminMod(); virtual void sendVerbose(int verboseLevel, std::string message); }; AdminHook::~AdminHook() {} std::vector<std::vector<std::string> > AdminHook::adminCommands() { return std::vector<std::vector<std::string> > (); } void AdminHook::onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master) {} AdminMod::~AdminMod() {} void AdminMod::sendVerbose(int verboseLevel, std::string message) {}
class AdminHook : public Module { public: virtual ~AdminHook(); virtual std::vector<std::vector<std::string> > adminCommands(); virtual void onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master); }; class AdminMod { public: virtual ~AdminMod(); virtual void sendVerbose(int verboseLevel, std::string message); }; AdminHook::~AdminHook() {} std::vector<std::vector<std::string> > AdminHook::adminCommands() { return std::vector<std::vector<std::string> > (); } void AdminHook::onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master) {} AdminMod::~AdminMod() {} void AdminMod::sendVerbose(int verboseLevel, std::string message) {}
Use a bitfield to make the index 2/3 the size, to save some disk churn
#define VT_POINT 1 #define VT_LINE 2 #define VT_POLYGON 3 #define VT_END 0 #define VT_MOVETO 1 #define VT_LINETO 2 #define VT_CLOSEPATH 7 #define VT_STRING 1 #define VT_NUMBER 2 #define VT_BOOLEAN 7 struct pool; void deserialize_int(char **f, int *n); struct pool_val *deserialize_string(char **f, struct pool *p, int type); struct index { unsigned long long index; long long fpos; int maxzoom; }; long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);
#define VT_POINT 1 #define VT_LINE 2 #define VT_POLYGON 3 #define VT_END 0 #define VT_MOVETO 1 #define VT_LINETO 2 #define VT_CLOSEPATH 7 #define VT_STRING 1 #define VT_NUMBER 2 #define VT_BOOLEAN 7 struct pool; void deserialize_int(char **f, int *n); struct pool_val *deserialize_string(char **f, struct pool *p, int type); struct index { unsigned long long index; long long fpos : 56; int maxzoom : 8; }; long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);
Change headers from *.hpp to *.h, and add LeafBuilder.
#pragma once #include "BehaviorTree.hpp" #include "Blackboard.hpp" #include "Composite.hpp" #include "Decorator.hpp" #include "Leaf.hpp" #include "Node.hpp" // CompositeS #include "Composites/MemSelector.hpp" #include "Composites/MemSequence.hpp" #include "Composites/ParallelSequence.hpp" #include "Composites/Selector.hpp" #include "Composites/Sequence.hpp" // Decorators #include "Decorators/Failer.hpp" #include "Decorators/Inverter.hpp" #include "Decorators/Repeater.hpp" #include "Decorators/Succeeder.hpp" #include "Decorators/UntilFail.hpp" #include "Decorators/UntilSuccess.hpp"
#pragma once #include "BehaviorTree.h" #include "Blackboard.h" #include "Composite.h" #include "Decorator.h" #include "Leaf.h" #include "Node.h" // Composites #include "composites/MemSelector.h" #include "composites/MemSequence.h" #include "composites/ParallelSequence.h" #include "composites/Selector.h" #include "composites/Sequence.h" // Decorators #include "decorators/Failer.h" #include "decorators/Inverter.h" #include "decorators/Repeater.h" #include "decorators/Succeeder.h" #include "decorators/UntilFail.h" #include "decorators/UntilSuccess.h" // Builders #include "builders/LeafBuilder.h"
Define TSEARCH_INLINE as static inline
// // GNETextSearchPrivate.h // GNETextSearch // // Created by Anthony Drendel on 11/14/15. // Copyright © 2015 Gone East LLC. All rights reserved. // #ifndef GNETextSearchPrivate_h #define GNETextSearchPrivate_h #ifdef __cplusplus extern "C" { #endif #ifndef TSEARCH_INLINE #if defined(_MSC_VER) && !defined(__cplusplus) #define TSEARCH_INLINE __inline #else #define TSEARCH_INLINE inline #endif #endif TSEARCH_INLINE size_t _tsearch_next_buf_len(size_t *capacity, const size_t size) { if (capacity == NULL) { return 0; } size_t count = *capacity; size_t nextCount = (count * 3) / 2; size_t validCount = (nextCount > count && ((SIZE_MAX / size) > nextCount)) ? nextCount : count; *capacity = validCount; return validCount * size; } #ifdef __cplusplus } #endif #endif /* GNETextSearchPrivate_h */
// // GNETextSearchPrivate.h // GNETextSearch // // Created by Anthony Drendel on 11/14/15. // Copyright © 2015 Gone East LLC. All rights reserved. // #ifndef GNETextSearchPrivate_h #define GNETextSearchPrivate_h #ifdef __cplusplus extern "C" { #endif #ifndef TSEARCH_INLINE #if defined(_MSC_VER) && !defined(__cplusplus) #define TSEARCH_INLINE __inline #else #define TSEARCH_INLINE static inline #endif #endif TSEARCH_INLINE size_t _tsearch_next_buf_len(size_t *capacity, const size_t size) { if (capacity == NULL) { return 0; } size_t count = *capacity; size_t nextCount = (count * 3) / 2; size_t validCount = (nextCount > count && ((SIZE_MAX / size) > nextCount)) ? nextCount : count; *capacity = validCount; return validCount * size; } #ifdef __cplusplus } #endif #endif /* GNETextSearchPrivate_h */