Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.
// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s // XFAIL: -linux- // REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64 typedef int a;
// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s // XFAIL: -linux- // REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64 typedef int a;
Add methods to apply multiple transformations
#pragma once class VolumeTransformation { public: /// <summary> /// Transforms a given volume level to a new ("virtual") level based on a /// formula or set of rules (e.g., a volume curve transformation). /// </summary> virtual float Apply(float vol) = 0; /// <summary> /// Given a transformed ("virtual") volume value, this function reverts it /// back to its original value (assuming the given value was produced /// by the ToVirtual() function). /// </summary> virtual float Revert(float vol) = 0; };
#pragma once class VolumeTransformation { public: /// <summary> /// Transforms a given volume level to a new ("virtual") level based on a /// formula or set of rules (e.g., a volume curve transformation). /// </summary> virtual float Apply(float vol) = 0; /// <summary> /// Given a transformed ("virtual") volume value, this function reverts it /// back to its original value (assuming the given value was produced /// by the ToVirtual() function). /// </summary> virtual float Revert(float vol) = 0; /// <summary> /// Applies several transformations supplied as a vector to the initial /// value provided. The transformations are applied in order of appearance /// in the vector. /// </summary> static float ApplyTransformations( std::vector<VolumeTransformation *> &transforms, float initialVal) { float newVal = initialVal; for (VolumeTransformation *trans : transforms) { newVal = trans->Apply(newVal); } return newVal; } /// <summary> /// Reverts several transformations, starting with a transformed ("virtual") /// value. This method reverts the transformations in reverse order. /// </summary> static float RevertTransformations( std::vector<VolumeTransformation *> &transforms, float virtVal) { float newVal = virtVal; for (auto it = transforms.rbegin(); it != transforms.rend(); ++it) { newVal = (*it)->Revert(newVal); } return newVal; } };
Add function ID member in MODBUSExceptionLog structure
//Declarations for master types typedef enum { Register = 0 } MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.) typedef struct { uint8_t Address; //Device address uint8_t Code; //Exception code } MODBUSExceptionLog; //Parsed exception data typedef struct { uint8_t Address; //Device address MODBUSDataType DataType; //Data type uint16_t Register; //Register, coil, input ID uint16_t Value; //Value of data } MODBUSData; typedef struct { uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready uint8_t *Frame; //Request frame content } MODBUSRequestStatus; //Type containing information about frame that is set up at master side typedef struct { MODBUSData *Data; //Data read from slave MODBUSExceptionLog Exception; //Optional exception read MODBUSRequestStatus Request; //Formatted request for slave uint8_t DataLength; //Count of data type instances read from slave uint8_t Error; //Have any error occured? } MODBUSMasterStatus; //Type containing master device configuration data
//Declarations for master types typedef enum { Register = 0 } MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.) typedef struct { uint8_t Address; //Device address uint8_t Function; //Function called, in which exception occured uint8_t Code; //Exception code } MODBUSExceptionLog; //Parsed exception data typedef struct { uint8_t Address; //Device address MODBUSDataType DataType; //Data type uint16_t Register; //Register, coil, input ID uint16_t Value; //Value of data } MODBUSData; typedef struct { uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready uint8_t *Frame; //Request frame content } MODBUSRequestStatus; //Type containing information about frame that is set up at master side typedef struct { MODBUSData *Data; //Data read from slave MODBUSExceptionLog Exception; //Optional exception read MODBUSRequestStatus Request; //Formatted request for slave uint8_t DataLength; //Count of data type instances read from slave uint8_t Error; //Have any error occured? } MODBUSMasterStatus; //Type containing master device configuration data
Add a test forgotten in r339088.
// RUN: %clang_analyze_cc1 -analyzer-checker=unix.StdCLibraryFunctions -verify %s // RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s // RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s // RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s // RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s // This test tests crashes that occur when standard functions are available // for inlining. // expected-no-diagnostics int isdigit(int _) { return !0; } void test_redefined_isdigit(int x) { int (*func)(int) = isdigit; for (; func(x);) // no-crash ; }
Update utility functions to work with pyp-topics.
#ifndef DICT_H_ #define DICT_H_ #include <cassert> #include <cstring> #include <tr1/unordered_map> #include <string> #include <vector> #include <boost/functional/hash.hpp> #include "wordid.h" class Dict { typedef std::tr1::unordered_map<std::string, WordID, boost::hash<std::string> > Map; public: Dict() : b0_("<bad0>") { words_.reserve(1000); } inline int max() const { return words_.size(); } inline WordID Convert(const std::string& word, bool frozen = false) { Map::iterator i = d_.find(word); if (i == d_.end()) { if (frozen) return 0; words_.push_back(word); d_[word] = words_.size(); return words_.size(); } else { return i->second; } } inline const std::string& Convert(const WordID& id) const { if (id == 0) return b0_; assert(id <= words_.size()); return words_[id-1]; } void clear() { words_.clear(); d_.clear(); } private: const std::string b0_; std::vector<std::string> words_; Map d_; }; #endif
#ifndef DICT_H_ #define DICT_H_ #include <cassert> #include <cstring> #include <tr1/unordered_map> #include <string> #include <vector> #include <boost/functional/hash.hpp> #include "wordid.h" class Dict { typedef std::tr1::unordered_map<std::string, WordID, boost::hash<std::string> > Map; public: Dict() : b0_("<bad0>") { words_.reserve(1000); } inline int max() const { return words_.size(); } inline WordID Convert(const std::string& word, bool frozen = false) { Map::iterator i = d_.find(word); if (i == d_.end()) { if (frozen) return 0; words_.push_back(word); d_[word] = words_.size(); return words_.size(); } else { return i->second; } } inline WordID Convert(const std::vector<std::string>& words, bool frozen = false) { std::string word= ""; for (std::vector<std::string>::const_iterator it=words.begin(); it != words.end(); ++it) { if (it != words.begin()) word += "__"; word += *it; } return Convert(word, frozen); } inline const std::string& Convert(const WordID& id) const { if (id == 0) return b0_; assert(id <= words_.size()); return words_[id-1]; } void clear() { words_.clear(); d_.clear(); } private: const std::string b0_; std::vector<std::string> words_; Map d_; }; #endif
Move variable to base class
#include "bayesian.h" namespace baysian { class bayesianNetwork : public bayesian { private: long double ***cpt; double *classCount; // this array store the total number of each // decision's class in training data int *discrete; int *classNum; // this array store the number of classes of each attribute int **parent; public: bayesianNetwork(char *); ~bayesianNetwork(); // initialize all the information we need from training data void predict(char *); // calculate the probability of each choice and choose the greatest one as our // prediction void train(char *); }; template <class Type> struct data { double key; Type value1; Type value2; }; } // namespace baysian
#include "bayesian.h" namespace baysian { class bayesianNetwork : public bayesian { private: long double ***cpt; int **parent; public: bayesianNetwork(char *); ~bayesianNetwork(); // initialize all the information we need from training data void predict(char *); // calculate the probability of each choice and choose the greatest one as our // prediction void train(char *); }; template <class Type> struct data { double key; Type value1; Type value2; }; } // namespace baysian
Update Skia milestone to 98
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 97 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 98 #endif
Tweak this test a bit further to make it easier on grep. Who knows what characters get dropped into the regular expression from %t.
// rdar://6533411 // RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // RUN: %clang -S -M -x c %s -o %t.d // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // PR8974 // XFAIL: win32 // RUN: rm -rf %t.dir // RUN: mkdir %t.dir // RUN: echo > %t.dir/x.h // RUN: %clang -include %t.dir/x.h -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep ' %t.dir/x.h' %t.d
// rdar://6533411 // RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // RUN: %clang -S -M -x c %s -o %t.d // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // PR8974 // XFAIL: win32 // RUN: rm -rf %t.dir // RUN: mkdir -p %t.dir/a/b // RUN: echo > %t.dir/a/b/x.h // RUN: cd %t.dir // RUN: %clang -include a/b/x.h -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep ' a/b/x\.h' %t.d
Update wrapper fusion header file
#ifndef HALIDE__build___wrapper_fusion_o_h #define HALIDE__build___wrapper_fusion_o_h #include <coli/utils.h> #ifdef __cplusplus extern "C" { #endif int fusion_coli(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer) HALIDE_FUNCTION_ATTRS; int fusion_coli_argv(void **args) HALIDE_FUNCTION_ATTRS; int fusion_ref(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer) HALIDE_FUNCTION_ATTRS; int fusion_ref_argv(void **args) HALIDE_FUNCTION_ATTRS; // Result is never null and points to constant static data const struct halide_filter_metadata_t *fusion_coli_metadata() HALIDE_FUNCTION_ATTRS; const struct halide_filter_metadata_t *fusion_ref_metadata() HALIDE_FUNCTION_ATTRS; #ifdef __cplusplus } // extern "C" #endif #endif
#ifndef HALIDE__build___wrapper_fusion_o_h #define HALIDE__build___wrapper_fusion_o_h #include <coli/utils.h> #ifdef __cplusplus extern "C" { #endif int fusion_coli(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer, buffer_t *_b_output_h_buffer, buffer_t *_b_output_k_buffer) HALIDE_FUNCTION_ATTRS; int fusion_coli_argv(void **args) HALIDE_FUNCTION_ATTRS; int fusion_ref(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer, buffer_t *_b_output_h_buffer, buffer_t *_b_output_k_buffer) HALIDE_FUNCTION_ATTRS; int fusion_ref_argv(void **args) HALIDE_FUNCTION_ATTRS; // Result is never null and points to constant static data const struct halide_filter_metadata_t *fusion_coli_metadata() HALIDE_FUNCTION_ATTRS; const struct halide_filter_metadata_t *fusion_ref_metadata() HALIDE_FUNCTION_ATTRS; #ifdef __cplusplus } // extern "C" #endif #endif
Enable debug option for all components
#ifndef _TSLIB_PRIVATE_H_ #define _TSLIB_PRIVATE_H_ /* * tslib/src/tslib-private.h * * Copyright (C) 2001 Russell King. * * This file is placed under the LGPL. * * * Internal touch screen library definitions. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "tslib.h" #include "tslib-filter.h" struct tsdev { int fd; struct tslib_module_info *list; struct tslib_module_info *list_raw; /* points to position in 'list' where raw reads come from. default is the position of the ts_read_raw module. */ unsigned int res_x; unsigned int res_y; int rotation; }; int __ts_attach(struct tsdev *ts, struct tslib_module_info *info); int __ts_attach_raw(struct tsdev *ts, struct tslib_module_info *info); int ts_load_module(struct tsdev *dev, const char *module, const char *params); int ts_load_module_raw(struct tsdev *dev, const char *module, const char *params); int ts_error(const char *fmt, ...); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _TSLIB_PRIVATE_H_ */
#ifndef _TSLIB_PRIVATE_H_ #define _TSLIB_PRIVATE_H_ /* * tslib/src/tslib-private.h * * Copyright (C) 2001 Russell King. * * This file is placed under the LGPL. * * * Internal touch screen library definitions. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "tslib.h" #include "tslib-filter.h" #define DEBUG struct tsdev { int fd; struct tslib_module_info *list; struct tslib_module_info *list_raw; /* points to position in 'list' where raw reads come from. default is the position of the ts_read_raw module. */ unsigned int res_x; unsigned int res_y; int rotation; }; int __ts_attach(struct tsdev *ts, struct tslib_module_info *info); int __ts_attach_raw(struct tsdev *ts, struct tslib_module_info *info); int ts_load_module(struct tsdev *dev, const char *module, const char *params); int ts_load_module_raw(struct tsdev *dev, const char *module, const char *params); int ts_error(const char *fmt, ...); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _TSLIB_PRIVATE_H_ */
Implement timeradd as an inline function
#ifndef OS_COMMON_H_ #define OS_COMMON_H_ #include <stddef.h> #include <fcntl.h> #include <io.h> #include <stdio.h> /* * MinGW lfind() and friends use `unsigned int *` where they should use a * `size_t *` according to the man page. */ typedef unsigned int lfind_size_t; // timeradd doesn't exist on MinGW #ifndef timeradd #define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ (result)->tv_sec += (result)->tv_usec / 1000000; \ (result)->tv_usec %= 1000000; \ } while (0) \ // #endif struct param_state; char *os_find_self(const char *); FILE *os_fopen(const char *, const char *); int os_get_tsimrc_path(char buf[], size_t sz); long os_getpagesize(void); int os_preamble(void); int os_set_buffering(FILE *stream, int mode); #endif /* vi: set ts=4 sw=4 et: */
#ifndef OS_COMMON_H_ #define OS_COMMON_H_ #include <stddef.h> #include <fcntl.h> #include <io.h> #include <stdio.h> #include <sys/time.h> /* * MinGW lfind() and friends use `unsigned int *` where they should use a * `size_t *` according to the man page. */ typedef unsigned int lfind_size_t; // timeradd doesn't exist on MinGW #ifndef timeradd #define timeradd timeradd static inline void timeradd(struct timeval *a, struct timeval *b, struct timeval *result) { result->tv_sec = a->tv_sec + b->tv_sec; result->tv_usec = a->tv_usec + b->tv_usec; result->tv_sec += result->tv_usec / 1000000; result->tv_usec %= 1000000; } #endif struct param_state; char *os_find_self(const char *); FILE *os_fopen(const char *, const char *); int os_get_tsimrc_path(char buf[], size_t sz); long os_getpagesize(void); int os_preamble(void); int os_set_buffering(FILE *stream, int mode); #endif /* vi: set ts=4 sw=4 et: */
Add video orientation to play ad option
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import <Foundation/Foundation.h> #import <GoogleMobileAds/GADAdNetworkExtras.h> @interface VungleAdNetworkExtras : NSObject<GADAdNetworkExtras> /*! * @brief NSString with user identifier that will be passed if the ad is incentivized. * @discussion Optional. The value passed as 'user' in the an incentivized server-to-server call. */ @property(nonatomic, copy) NSString *_Nullable userId; /*! * @brief Controls whether presented ads will start in a muted state or not. */ @property(nonatomic, assign) BOOL muted; @property(nonatomic, assign) NSUInteger ordinal; @property(nonatomic, assign) NSTimeInterval flexViewAutoDismissSeconds; @property(nonatomic, copy) NSArray<NSString *> *_Nullable allPlacements; @property(nonatomic, copy) NSString *_Nullable playingPlacement; @end
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import <Foundation/Foundation.h> #import <GoogleMobileAds/GADAdNetworkExtras.h> @interface VungleAdNetworkExtras : NSObject<GADAdNetworkExtras> /*! * @brief NSString with user identifier that will be passed if the ad is incentivized. * @discussion Optional. The value passed as 'user' in the an incentivized server-to-server call. */ @property(nonatomic, copy) NSString *_Nullable userId; /*! * @brief Controls whether presented ads will start in a muted state or not. */ @property(nonatomic, assign) BOOL muted; @property(nonatomic, assign) NSUInteger ordinal; @property(nonatomic, assign) NSTimeInterval flexViewAutoDismissSeconds; @property(nonatomic, copy) NSArray<NSString *> *_Nullable allPlacements; @property(nonatomic, copy) NSString *_Nullable playingPlacement; @property(nonatomic, copy) NSNumber *_Nullable orientations; @end
Add macros for ioctl fetching of log data.
#ifndef HELLOW_IOCTL_H #define HELLOW_IOCTL_H #define HWM_LOG_OFF 0xff00 #define HWM_LOG_ON 0xff01 #endif
#ifndef HELLOW_IOCTL_H #define HELLOW_IOCTL_H #define HWM_LOG_OFF 0xff00 #define HWM_LOG_ON 0xff01 #define HWM_GET_LOG_ENT_SIZE 0xff02 #define HWM_GET_LOG_ENT 0xff03 #endif
Make adding related works sections private.
#import "ARArtworkMasonryModule.h" #import "ARArtworkViewController.h" typedef NS_ENUM(NSInteger, ARRelatedArtworksSubviewOrder) { ARRelatedArtworksSameShow = 1, ARRelatedArtworksSameFair, ARRelatedArtworksSameAuction, ARRelatedArtworksArtistArtworks, ARRelatedArtworks, }; @class ARArtworkRelatedArtworksView; @protocol ARArtworkRelatedArtworksViewParentViewController <NSObject> @required - (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view shouldShowViewController:(UIViewController *)viewController; - (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view didAddSection:(UIView *)section; @optional - (Fair *)fair; @end @interface ARArtworkRelatedArtworksView : ORTagBasedAutoStackView <ARArtworkMasonryLayoutProvider> @property (nonatomic, weak) ARArtworkViewController<ARArtworkRelatedArtworksViewParentViewController> *parentViewController; - (void)cancelRequests; - (void)updateWithArtwork:(Artwork *)artwork; - (void)updateWithArtwork:(Artwork *)artwork withCompletion:(void(^)())completion; // TODO make all these private // Use this when showing an artwork in the context of a fair. - (void)addSectionsForFair:(Fair *)fair; // Use this when showing an artwork in the context of a show. - (void)addSectionsForShow:(PartnerShow *)show; // Use this when showing an artwork in the context of an auction. - (void)addSectionsForAuction:(Sale *)auction; // In all other cases, this should be used to simply show related artworks. - (void)addSectionWithRelatedArtworks; @end
#import "ARArtworkMasonryModule.h" #import "ARArtworkViewController.h" typedef NS_ENUM(NSInteger, ARRelatedArtworksSubviewOrder) { ARRelatedArtworksSameShow = 1, ARRelatedArtworksSameFair, ARRelatedArtworksSameAuction, ARRelatedArtworksArtistArtworks, ARRelatedArtworks, }; @class ARArtworkRelatedArtworksView; @protocol ARArtworkRelatedArtworksViewParentViewController <NSObject> @required - (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view shouldShowViewController:(UIViewController *)viewController; - (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view didAddSection:(UIView *)section; @optional - (Fair *)fair; @end @interface ARArtworkRelatedArtworksView : ORTagBasedAutoStackView <ARArtworkMasonryLayoutProvider> @property (nonatomic, weak) ARArtworkViewController<ARArtworkRelatedArtworksViewParentViewController> *parentViewController; - (void)cancelRequests; - (void)updateWithArtwork:(Artwork *)artwork; - (void)updateWithArtwork:(Artwork *)artwork withCompletion:(void(^)())completion; @end
Add an abstract bitmap class.
#ifndef OUTPUTBITMAP_H #define OUTPUTBITMAP_H #include <iostream> #include "common.h" using std::ostream; class OutputBitmap { protected: unsigned int width, height; OutputBitmap(unsigned int width, unsigned int height) : width(width), height(height) {}; public: unsigned int getWidth() const { return width; }; unsigned int getHeight() const { return height; }; void setPixel(unsigned int x, unsigned int y, const color& c) = 0; void getPixel(unsigned int x, unsigned int y, color& c) = 0; color getPixel(unsigned int x, unsigned int y) = 0; void commit() = 0; void write(ostream& output) = 0; }; operator << (ofstream& output, OutputBitmap bitmap) { bitmap.write(output); }
Fix update callback position to be grid-relative not scrollback-relative.
#include <libterm_internal.h> void term_update(term_t_i *term) { if( term->dirty.exists && term->update != NULL ) { term->update(TO_H(term), term->dirty.x, term->dirty.y, term->dirty.width, term->dirty.height); term->dirty.exists = false; } } void term_cursor_update(term_t_i *term) { if( term->dirty_cursor.exists && term->cursor_update != NULL ) { term->cursor_update(TO_H(term), term->dirty_cursor.old_ccol, term->dirty_cursor.old_crow - (term->grid.history - term->grid.height), term->ccol, term->crow - (term->grid.history - term->grid.height)); term->dirty_cursor.exists = false; term->dirty_cursor.old_ccol = term->ccol; term->dirty_cursor.old_crow = term->crow; } }
#include <libterm_internal.h> void term_update(term_t_i *term) { if( term->dirty.exists && term->update != NULL ) { term->update(TO_H(term), term->dirty.x, term->dirty.y - (term->grid.history - term->grid.height), term->dirty.width, term->dirty.height); term->dirty.exists = false; } } void term_cursor_update(term_t_i *term) { if( term->dirty_cursor.exists && term->cursor_update != NULL ) { term->cursor_update(TO_H(term), term->dirty_cursor.old_ccol, term->dirty_cursor.old_crow - (term->grid.history - term->grid.height), term->ccol, term->crow - (term->grid.history - term->grid.height)); term->dirty_cursor.exists = false; term->dirty_cursor.old_ccol = term->ccol; term->dirty_cursor.old_crow = term->crow; } }
Test whether removing a cast still hurts performance.
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" /* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, const int16_t* seq1, const int16_t* seq2, int16_t dim_seq, int16_t dim_cross_correlation, int right_shifts, int step_seq2) { int i = 0, j = 0; for (i = 0; i < dim_cross_correlation; i++) { int32_t corr = 0; /* Unrolling doesn't seem to improve performance. */ for (j = 0; j < dim_seq; j++) { // It's not clear why casting |right_shifts| here helps performance. corr += (seq1[j] * seq2[j]) >> (int16_t)right_shifts; } seq2 += step_seq2; *cross_correlation++ = corr; } }
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" /* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, const int16_t* seq1, const int16_t* seq2, int16_t dim_seq, int16_t dim_cross_correlation, int right_shifts, int step_seq2) { int i = 0, j = 0; for (i = 0; i < dim_cross_correlation; i++) { int32_t corr = 0; /* Unrolling doesn't seem to improve performance. */ for (j = 0; j < dim_seq; j++) corr += (seq1[j] * seq2[j]) >> right_shifts; seq2 += step_seq2; *cross_correlation++ = corr; } }
Make threads autostart by default
#pragma once #include "ThreadState.h" #include <atomic> #include <mutex> #include <thread> // Lightweight wrapper for std::thread to provide extensibility namespace AscEmu { namespace Threading { class AEThread { typedef std::function<void(AEThread&)> ThreadFunc; static std::atomic<unsigned int> ThreadIdCounter; const long long m_longSleepDelay = 64; // Meta std::string m_name; unsigned int m_id; ThreadFunc m_func; std::chrono::milliseconds m_interval; // State std::mutex m_mtx; std::thread m_thread; bool m_killed; bool m_done; bool m_longSleep; void threadRunner(); void killThread(); public: AEThread(std::string name, ThreadFunc func, std::chrono::milliseconds intervalMs, bool autostart = false); ~AEThread(); std::chrono::milliseconds getInterval() const; std::chrono::milliseconds setInterval(std::chrono::milliseconds val); std::chrono::milliseconds unsafeSetInterval(std::chrono::milliseconds val); std::string getName() const; unsigned int getId() const; bool isKilled() const; void requestKill(); void join(); void reboot(); void lock(); void unlock(); }; }}
#pragma once #include "ThreadState.h" #include <atomic> #include <mutex> #include <thread> // Lightweight wrapper for std::thread to provide extensibility namespace AscEmu { namespace Threading { class AEThread { typedef std::function<void(AEThread&)> ThreadFunc; static std::atomic<unsigned int> ThreadIdCounter; const long long m_longSleepDelay = 64; // Meta std::string m_name; unsigned int m_id; ThreadFunc m_func; std::chrono::milliseconds m_interval; // State std::mutex m_mtx; std::thread m_thread; bool m_killed; bool m_done; bool m_longSleep; void threadRunner(); void killThread(); public: AEThread(std::string name, ThreadFunc func, std::chrono::milliseconds intervalMs, bool autostart = true); ~AEThread(); std::chrono::milliseconds getInterval() const; std::chrono::milliseconds setInterval(std::chrono::milliseconds val); std::chrono::milliseconds unsafeSetInterval(std::chrono::milliseconds val); std::string getName() const; unsigned int getId() const; bool isKilled() const; void requestKill(); void join(); void reboot(); void lock(); void unlock(); }; }}
Revert "Indicate the location of sqlite failures."
#ifndef _PKG_ERROR_H #define _PKG_ERROR_H #ifdef DEBUG # define pkg_error_set(code, fmt, ...) \ _pkg_error_set(code, fmt " [at %s:%d]", ##__VA_ARGS__, __FILE__, __LINE__) #else # define pkg_error_set _pkg_error_set #endif #define ERROR_BAD_ARG(name) \ pkg_error_set(EPKG_FATAL, "Bad argument `%s` in %s", name, __FUNCTION__) #define ERROR_SQLITE(db) \ pkg_error_set(EPKG_FATAL, "%s (sqlite at %s:%d)", sqlite3_errmsg(db), __FILE__, __LINE__) pkg_error_t _pkg_error_set(pkg_error_t, const char *, ...); #endif
#ifndef _PKG_ERROR_H #define _PKG_ERROR_H #ifdef DEBUG # define pkg_error_set(code, fmt, ...) \ _pkg_error_set(code, fmt " [at %s:%d]", ##__VA_ARGS__, __FILE__, __LINE__) #else # define pkg_error_set _pkg_error_set #endif #define ERROR_BAD_ARG(name) \ pkg_error_set(EPKG_FATAL, "Bad argument `%s` in %s", name, __FUNCTION__) #define ERROR_SQLITE(db) \ pkg_error_set(EPKG_FATAL, "%s (sqlite)", sqlite3_errmsg(db)) pkg_error_t _pkg_error_set(pkg_error_t, const char *, ...); #endif
Correct the frame format and async mode for the UART. Add useful comments.
/** * This is used to setup the UART device on an AVR unit. */ #pragma once #include <avr/io.h> #ifndef BAUD # define BAUD 9600 # warning BAUD rate not set. Setting BAUD rate to 9600. #endif // BAUD #define BAUDRATE ((F_CPU)/(BAUD*16UL)-1) static inline void uart_enable(void) { UBRR0H = BAUDRATE >> 8; UBRR0L = BAUDRATE; UCSR0B |= _BV(TXEN0) | _BV(RXEN0); UCSR0C |= _BV(UMSEL00) | _BV(UCSZ01) | _BV(UCSZ00); } static inline void uart_transmit(unsigned char data) { while (!(UCSR0A & _BV(UDRE0))); UDR0 = data; } static inline unsigned char uart_receive(void) { while (!(UCSR0A & _BV(RXC0))); return UDR0; }
/** * This is used to setup the UART device on an AVR unit. */ #pragma once #include <avr/io.h> #ifndef BAUD # define BAUD 9600 # warning BAUD rate not set. Setting BAUD rate to 9600. #endif // BAUD #define BAUDRATE ((F_CPU)/(BAUD*16UL)-1) static inline void uart_enable(void) { UBRR0H = BAUDRATE >> 8; UBRR0L = BAUDRATE; // Set RX/TN enabled UCSR0B |= _BV(TXEN0) | _BV(RXEN0); // Set asynchronous USART // Set frame format: 8-bit data, 2-stop bit UCSR0C |= _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00); } static inline void uart_transmit(unsigned char data) { while (!(UCSR0A & _BV(UDRE0))); UDR0 = data; } static inline unsigned char uart_receive(void) { while (!(UCSR0A & _BV(RXC0))); return UDR0; }
Set 1 challenge 5 Implement repeating-key XOR
#include <stdio.h> char input[] = "Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal"; char key[] = "ICE"; char lookup[] = "0123456789abcdef"; int main() { for(unsigned int i = 0; i < (sizeof(input) - 1); ++i) { char num = input[i] ^ key[i % (sizeof(key) - 1)]; printf("%c%c", lookup[(num >> 4)], lookup[num & 0x0F]); } return 0; }
Add basic argument parsing and file reading
#include "common.h" int main(int argc, char **argv) { return 0; }
#include "common.h" #include <stdlib.h> #include <stdio.h> #include <string.h> internal void usage() { fprintf(stderr, "usage: mepa <command> [<options>] [<args>]\n" "\n" "Commands:\n" " help - show this usage text\n" " format [<file>] - reformat code\n"); } internal __attribute__((noreturn)) void die() { perror("mepa"); exit(1); } internal void *nonnull_or_die(void *ptr) { if (ptr == NULL) { die(); } return ptr; } internal int help_main(int argc, char **argv) { (void) argc; (void) argv; usage(); return 0; } internal int format_main(int argc, char **argv) { FILE *file; if (argc == 2 || strcmp(argv[2], "-") == 0) { file = stdin; } else { file = nonnull_or_die(fopen(argv[2], "r")); } u32 cap = 4096; u32 size = 0; u8 *contents = malloc(cap); while (true) { u32 wanted = cap - size; usize result = fread(contents + size, 1, wanted, file); if (result != wanted) { if (ferror(file)) { die(); } size += result; break; } size += result; cap += cap >> 1; contents = realloc(contents, cap); } contents = realloc(contents, size); fclose(file); fwrite(contents, 1, size, stdout); return 0; } typedef struct { char *command; int (*func)(int, char**); } Command; internal Command commands[] = { {"help", help_main}, {"-h", help_main}, {"--help", help_main}, {"-help", help_main}, {"format", format_main}, }; int main(int argc, char **argv) { if (argc == 1) { return help_main(argc, argv); } for (u32 i = 0; i < array_count(commands); i++) { if (strcmp(argv[1], commands[i].command) == 0) { return commands[i].func(argc, argv); } } fprintf(stderr, "Unknown command %s\n", argv[1]); usage(); return 1; }
Mend command line flag parsing
#include <stdio.h> #include "src/sea.h" int main(int argc, char* argv[]) { // parse arguments while((opt = getopt(argc, argv, "d:")) != -1) { switch(opt) { case 'd': { extern int yydebug; yydebug = 1; } default: { fprintf(stderr, "Usage: %s [-d] input_filename\n", argv[0]); exit(EXIT_FAILURE); } } } if (optind >= argc) { fprintf(stderr, "Expected argument after options\n"); exit(EXIT_FAILURE); } // use arguments char* filename = argv[optind]; FILE* input_file; int is_stdin = strcmp(filename, "-") == 0; input_file = is_stdin ? stdin : fopen(filename, "rb"); if (!input_file) { perror("An error occured whilst reading from the input file"); return -1; } // main part of program sea* s = create_sea(); int stat = execute_file(s, input_file); free_sea(s); // cleanup if (!is_stdin) { if (ferror(input_file)) { fprintf(stderr, "An error occured during reading from the file\n"); } fclose(input_file); } if (stat != 0) { fprintf(stderr, "An occured during parsing\n"); return stat; } else { return 0; } }
#include <stdlib.h> #include <stdio.h> #include "src/sea.h" int main(int argc, char* argv[]) { // parse arguments char opt; extern int optind; while((opt = getopt(argc, argv, "d")) != -1) { switch(opt) { case 'd': { extern int yydebug; yydebug = 1; break; } case '?': { fprintf(stderr, "Usage: %s [-d] input_filename\n", argv[0]); exit(EXIT_FAILURE); } } } if (optind >= argc) { fprintf(stderr, "Expected argument after options\n"); exit(EXIT_FAILURE); } // use arguments char* filename = argv[optind]; FILE* input_file; int is_stdin = strcmp(filename, "-") == 0; input_file = is_stdin ? stdin : fopen(filename, "rb"); if (!input_file) { perror("An error occured whilst reading from the input file"); return -1; } // main part of program sea* s = create_sea(); int stat = execute_file(s, input_file); free_sea(s); // cleanup if (!is_stdin) { if (ferror(input_file)) { fprintf(stderr, "An error occured during reading from the file\n"); } fclose(input_file); } if (stat != 0) { fprintf(stderr, "An occured during parsing\n"); return stat; } else { return 0; } }
Change default value to align with the original react
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include <cstddef> // for size_t namespace paddle { namespace framework { namespace details { struct ExecutionStrategy { enum ExecutorType { kDefault = 0, kExperimental = 1 }; size_t num_threads_{0}; bool use_cuda_{true}; bool allow_op_delay_{false}; size_t num_iteration_per_drop_scope_{100}; ExecutorType type_{kDefault}; bool dry_run_{false}; }; } // namespace details } // namespace framework } // namespace paddle
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include <cstddef> // for size_t namespace paddle { namespace framework { namespace details { struct ExecutionStrategy { enum ExecutorType { kDefault = 0, kExperimental = 1 }; size_t num_threads_{0}; bool use_cuda_{true}; bool allow_op_delay_{false}; size_t num_iteration_per_drop_scope_{1}; ExecutorType type_{kDefault}; bool dry_run_{false}; }; } // namespace details } // namespace framework } // namespace paddle
Add overloaded () operator to LogSingletonHelper.
#ifndef _LOG_SINGLETON_H_ #define _LOG_SINGLETON_H_ #include "log.h" #include "basedefs.h" namespace anp { class LogSingleton: public anp::Log { public: static LogSingleton &getInstance(); static void releaseInstance(); private: LogSingleton() { } ~LogSingleton() { } static uint32 m_refCount; static LogSingleton *m_instance; }; /** Makes sure that LogSingleton::releaseInstance() gets called. */ class LogSingletonHelper { public: LogSingletonHelper(): m_log(LogSingleton::getInstance()) { } ~LogSingletonHelper() { LogSingleton::releaseInstance(); } void addMessage(const anp::dstring &message) { m_log.addMessage(message); } private: LogSingleton &m_log; }; } #endif // _LOG_SINGLETON_H_
#ifndef _LOG_SINGLETON_H_ #define _LOG_SINGLETON_H_ #include "log.h" #include "basedefs.h" namespace anp { class LogSingleton: public anp::Log { public: static LogSingleton &getInstance(); static void releaseInstance(); private: LogSingleton() { } ~LogSingleton() { } static uint32 m_refCount; static LogSingleton *m_instance; }; /** Makes sure that LogSingleton::releaseInstance() gets called. */ class LogSingletonHelper { public: LogSingletonHelper(): m_log(LogSingleton::getInstance()) { } ~LogSingletonHelper() { LogSingleton::releaseInstance(); } void addMessage(const anp::dstring &message) { m_log.addMessage(message); } void operator()(const anp::dstring message) { m_log.addMessage(message); } private: LogSingleton &m_log; }; #define LOG_SINGLETON_MSG(message) LogSingleton::getInstance().addMessage(message);\ LogSingleton::releaseInstance(); } #endif // _LOG_SINGLETON_H_
Add preliminary API definition for learn cache.
/* * Copyright (c) 2015, Vsevolod Stakhov * * 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. * * THIS SOFTWARE IS PROVIDED BY AUTHOR ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef LEARN_CACHE_H_ #define LEARN_CACHE_H_ #include "config.h" #include "ucl.h" typedef enum rspamd_learn_cache_result { RSPAMD_LEARN_OK = 0, RSPAMD_LEARN_UNLEARN, RSPAMD_LEARN_INGORE } rspamd_learn_t; struct rspamd_stat_cache { const char *name; gpointer (*init)(struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg); rspamd_learn_t (*process)(GTree *input, gboolean is_spam, gpointer ctx); gpointer ctx; }; #endif /* LEARN_CACHE_H_ */
Test case for static storage blocks
extern int printf(char *, ...); void (^pb)() = ^{ return; }; int i, j; int *(^funcs[])() = { [0 ... 1] = ^{ printf("1!\n"); return &i; }, ^{ printf("2!\n"); return &j; }, }; void *f(int x) { return funcs[x](); } main() { printf("&i = %p\n", &i); printf("&j = %p\n", &j); for(int i = 0; i < 3; i++) printf("f(%d) = %p\n", i, f(i)); }
Fix an outdated comment in a test. NFC.
// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text -verify %s // Avoid the crash when finding the expression for tracking the origins // of the null pointer for path notes. Apparently, not much actual tracking // needs to be done in this example. void pr34373() { int *a = 0; // expected-note{{'a' initialized to a null pointer value}} (a + 0)[0]; // expected-warning{{Array access results in a null pointer dereference}} // expected-note@-1{{Array access results in a null pointer dereference}} }
// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text -verify %s // Avoid the crash when finding the expression for tracking the origins // of the null pointer for path notes. void pr34373() { int *a = 0; // expected-note{{'a' initialized to a null pointer value}} (a + 0)[0]; // expected-warning{{Array access results in a null pointer dereference}} // expected-note@-1{{Array access results in a null pointer dereference}} }
Fix case insensitive UTF16 string search.
#pragma once class UnicodeUtf16StringSearcher { private: const wchar_t* m_Pattern; uint32_t m_PatternLength; public: UnicodeUtf16StringSearcher() : m_Pattern(nullptr) { } void Initialize(const wchar_t* pattern, size_t patternLength) { if (patternLength > std::numeric_limits<uint32_t>::max() / 2) __fastfail(1); m_Pattern = pattern; m_PatternLength = static_cast<uint32_t>(patternLength); } template <typename TextIterator> bool HasSubstring(TextIterator textBegin, TextIterator textEnd) { while (textEnd - textBegin >= m_PatternLength) { auto comparisonResult = CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, textBegin, static_cast<int>(textEnd - textBegin), m_Pattern, static_cast<int>(m_PatternLength), nullptr, nullptr, 0); if (comparisonResult == CSTR_EQUAL) return true; textBegin++; } return false; } };
#pragma once class UnicodeUtf16StringSearcher { private: const wchar_t* m_Pattern; uint32_t m_PatternLength; public: UnicodeUtf16StringSearcher() : m_Pattern(nullptr) { } void Initialize(const wchar_t* pattern, size_t patternLength) { if (patternLength > std::numeric_limits<uint32_t>::max() / 2) __fastfail(1); m_Pattern = pattern; m_PatternLength = static_cast<uint32_t>(patternLength); } template <typename TextIterator> bool HasSubstring(TextIterator textBegin, TextIterator textEnd) { while (textEnd - textBegin >= m_PatternLength) { auto comparisonResult = CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, textBegin, static_cast<int>(m_PatternLength), m_Pattern, static_cast<int>(m_PatternLength), nullptr, nullptr, 0); if (comparisonResult == CSTR_EQUAL) return true; textBegin++; } return false; } };
Add example from traces paper
// PARAM: --enable ana.int.interval --sets exp.solver.td3.side_widen cycle_self #include <pthread.h> #include <assert.h> int g = 6; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { int x = 1; pthread_mutex_lock(&A); assert(g == 6); assert(x == 1); g = 5; assert(g == 5); assert(x == 1); pthread_mutex_lock(&B); assert(g == 5); assert(x == 1); pthread_mutex_unlock(&B); assert(g == 5); assert(x == 1); x = g; assert(x == 5); g = x + 1; assert(g == 6); pthread_mutex_unlock(&A); assert(x == 5); return NULL; } int main(void) { pthread_t id; assert(g == 6); pthread_create(&id, NULL, t_fun, NULL); assert(5 <= g); assert(g <= 6); pthread_join(id, NULL); return 0; }
Switch to Stable V2.3 Release Candidates
#ifndef QGC_CONFIGURATION_H #define QGC_CONFIGURATION_H #include <QString> /** @brief Polling interval in ms */ #define SERIAL_POLL_INTERVAL 4 /** @brief Heartbeat emission rate, in Hertz (times per second) */ #define MAVLINK_HEARTBEAT_DEFAULT_RATE 1 #define WITH_TEXT_TO_SPEECH 1 // If you need to make an incompatible changes to stored settings, bump this version number // up by 1. This will caused store settings to be cleared on next boot. #define QGC_SETTINGS_VERSION 4 #define QGC_APPLICATION_NAME "QGroundControl" #define QGC_ORG_NAME "QGroundControl.org" #define QGC_ORG_DOMAIN "org.qgroundcontrol" #define QGC_APPLICATION_VERSION_MAJOR 2 #define QGC_APPLICATION_VERSION_MINOR 3 // The following #definess can be overriden from the command line so that automated build systems can // add additional build identification. // Only comes from command line //#define QGC_APPLICATION_VERSION_COMMIT "..." #ifndef QGC_APPLICATION_VERSION_BUILDNUMBER #define QGC_APPLICATION_VERSION_BUILDNUMBER 0 #endif #ifndef QGC_APPLICATION_VERSION_BUILDTYPE #define QGC_APPLICATION_VERSION_BUILDTYPE "(Developer Build)" #endif #endif // QGC_CONFIGURATION_H
#ifndef QGC_CONFIGURATION_H #define QGC_CONFIGURATION_H #include <QString> /** @brief Polling interval in ms */ #define SERIAL_POLL_INTERVAL 4 /** @brief Heartbeat emission rate, in Hertz (times per second) */ #define MAVLINK_HEARTBEAT_DEFAULT_RATE 1 #define WITH_TEXT_TO_SPEECH 1 // If you need to make an incompatible changes to stored settings, bump this version number // up by 1. This will caused store settings to be cleared on next boot. #define QGC_SETTINGS_VERSION 4 #define QGC_APPLICATION_NAME "QGroundControl" #define QGC_ORG_NAME "QGroundControl.org" #define QGC_ORG_DOMAIN "org.qgroundcontrol" #define QGC_APPLICATION_VERSION_MAJOR 2 #define QGC_APPLICATION_VERSION_MINOR 3 // The following #definess can be overriden from the command line so that automated build systems can // add additional build identification. // Only comes from command line //#define QGC_APPLICATION_VERSION_COMMIT "..." #ifndef QGC_APPLICATION_VERSION_BUILDNUMBER #define QGC_APPLICATION_VERSION_BUILDNUMBER 0 #endif #ifndef QGC_APPLICATION_VERSION_BUILDTYPE #define QGC_APPLICATION_VERSION_BUILDTYPE "(Stable)" #endif #endif // QGC_CONFIGURATION_H
Reduce memory usage of us_syslog_redirect
#include <stdio.h> #include <stdlib.h> #include <syslog.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <US/unitscript.h> #include <US/logging.h> int us_syslog_redirect( struct us_unitscript* unit, int priority ){ int fds[2]; if( pipe(fds) ){ perror("pipe failed"); return -1; } int ret = fork(); if( ret == -1 ){ perror("fork failed\n"); close(fds[0]); close(fds[1]); return -1; } if( ret ){ close(fds[0]); return fds[1]; } close(fds[1]); const char* file = strrchr(unit->file,'/'); if(!file){ file = unit->file; }else{ file++; } openlog(file,0,LOG_DAEMON); do { char msg[1024*4]; size_t i = 0; while( i<sizeof(msg)-1 && ( ( (ret=read(fds[0],msg+i,1)) == -1 && errno == EAGAIN ) || ( ret==1 && msg[i] != '\n' ) ) ) i++; msg[i] = 0; if(i) syslog( priority, "%s", msg ); } while(ret); us_free(unit); exit(0); }
#include <stdio.h> #include <stdlib.h> #include <syslog.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <US/unitscript.h> #include <US/logging.h> int us_syslog_redirect( struct us_unitscript* unit, int priority ){ int fds[2]; if( pipe(fds) ){ perror("pipe failed"); return -1; } int ret = fork(); if( ret == -1 ){ perror("fork failed\n"); close(fds[0]); close(fds[1]); return -1; } if( ret ){ close(fds[0]); return fds[1]; } close(fds[1]); const char* file = strrchr(unit->file,'/'); if(!file){ file = unit->file; }else{ file++; } openlog(file,0,LOG_DAEMON); us_free(unit); do { char msg[1024*4]; size_t i = 0; while( i<sizeof(msg)-1 && ( ( (ret=read(fds[0],msg+i,1)) == -1 && errno == EAGAIN ) || ( ret==1 && msg[i] != '\n' ) ) ) i++; msg[i] = 0; if(i) syslog( priority, "%s", msg ); } while(ret); exit(0); }
Fix ram end for kl82z
/** * @file target.c * @brief Target information for the kl46z * * DAPLink Interface Firmware * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "target_config.h" // The file flash_blob.c must only be included in target.c #include "flash_blob.c" // target information target_cfg_t target_device = { .sector_size = 1024, .sector_cnt = (KB(96) / 1024), .flash_start = 0, .flash_end = KB(128), .ram_start = 0x1FFFA000, .ram_end = 0x2002000, .flash_algo = (program_target_t *) &flash, };
/** * @file target.c * @brief Target information for the kl46z * * DAPLink Interface Firmware * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "target_config.h" // The file flash_blob.c must only be included in target.c #include "flash_blob.c" // target information target_cfg_t target_device = { .sector_size = 1024, .sector_cnt = (KB(96) / 1024), .flash_start = 0, .flash_end = KB(128), .ram_start = 0x1FFFA000, .ram_end = 0x20012000, .flash_algo = (program_target_t *) &flash, };
Add a triple to the test.
// This uses a headermap with this entry: // someheader.h -> Product/someheader.h // RUN: %clang_cc1 -v -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H // RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H 2> %t.out // RUN: FileCheck %s -input-file %t.out // CHECK: Product/someheader.h // CHECK: system/usr/include/someheader.h // CHECK: system/usr/include/someheader.h #include "someheader.h" #include <someheader.h> #include <someheader.h>
// This uses a headermap with this entry: // someheader.h -> Product/someheader.h // RUN: %clang_cc1 -triple x86_64-apple-darwin13 -v -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H // RUN: %clang_cc1 -triple x86_64-apple-darwin13 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H 2> %t.out // RUN: FileCheck %s -input-file %t.out // CHECK: Product/someheader.h // CHECK: system/usr/include/someheader.h // CHECK: system/usr/include/someheader.h #include "someheader.h" #include <someheader.h> #include <someheader.h>
Test double -> long double
#include "src/math/reinterpret.h" #include <math.h> #include <stdint.h> #include <assert.h> double __trunctfdf2(long double); static _Bool run(double x) { return reinterpret(uint64_t, x) == reinterpret(uint64_t, __trunctfdf2(x)); } int main(void) { const uint64_t step = 0x00000034CBF126F8; assert(run(INFINITY)); assert(run(-INFINITY)); for (uint64_t i = 0; i < 0x7FF0000000000000; i += step) { double x = reinterpret(double, i); assert(run(x)); assert(run(-x)); } for (uint64_t i = 0x7FF0000000000001; i < 0x8000000000000000; i += step) { double x = reinterpret(double, i); assert(isnan(__trunctfdf2(x))); assert(isnan(__trunctfdf2(-x))); } }
Make aes-hmac-sha2 encryption methods from `MXSecretStorage` available in SDK
/* Copyright 2020 The Matrix.org Foundation C.I.C Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import "MXSecretStorage.h" @class MXSession; NS_ASSUME_NONNULL_BEGIN @interface MXSecretStorage () /** Constructor. @param mxSession the related 'MXSession' instance. */ - (instancetype)initWithMatrixSession:(MXSession *)mxSession processingQueue:(dispatch_queue_t)processingQueue; @end NS_ASSUME_NONNULL_END
/* Copyright 2020 The Matrix.org Foundation C.I.C Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import "MXSecretStorage.h" @class MXSession; @class MXEncryptedSecretContent; NS_ASSUME_NONNULL_BEGIN @interface MXSecretStorage () /** Constructor. @param mxSession the related 'MXSession' instance. */ - (instancetype)initWithMatrixSession:(MXSession *)mxSession processingQueue:(dispatch_queue_t)processingQueue; - (nullable MXEncryptedSecretContent *)encryptedZeroStringWithPrivateKey:(NSData*)privateKey iv:(nullable NSData*)iv error:(NSError**)error; - (nullable MXEncryptedSecretContent *)encryptSecret:(NSString*)unpaddedBase64Secret withSecretId:(nullable NSString*)secretId privateKey:(NSData*)privateKey iv:(nullable NSData*)iv error:(NSError**)error; - (nullable NSString *)decryptSecretWithSecretId:(NSString*)secretId secretContent:(MXEncryptedSecretContent*)secretContent withPrivateKey:(NSData*)privateKey error:(NSError**)error; @end NS_ASSUME_NONNULL_END
Add active transaction member variable to DataStore
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <memory> #include "task_typedefs.h" #include "transaction.h" namespace You { namespace DataStore { namespace UnitTests {} class DataStore { public: Transaction && begin(); static DataStore& get(); // Modifying methods void post(TaskId, SerializedTask&); void put(TaskId, SerializedTask&); void erase(TaskId); std::vector<SerializedTask> getAllTask(); private: bool isServing = false; }; } // namespace DataStore } // namespace You #endif // YOU_DATASTORE_DATASTORE_H_
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <memory> #include "task_typedefs.h" #include "transaction.h" namespace You { namespace DataStore { namespace UnitTests {} class DataStore { public: Transaction && begin(); static DataStore& get(); // Modifying methods void post(TaskId, SerializedTask&); void put(TaskId, SerializedTask&); void erase(TaskId); std::vector<SerializedTask> getAllTask(); private: bool isServing = false; std::unique_ptr<Transaction> activeTransaction; }; } // namespace DataStore } // namespace You #endif // YOU_DATASTORE_DATASTORE_H_
Fix smart quote in file template
/******************************************************************************/ /** @file @author AUTHOR NAME HERE. @brief BRIEF HERE. @copyright Copyright 2016 The University of British Columbia, IonDB Project Contributors (see @ref AUTHORS.md) @par 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 @par 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. */ /******************************************************************************/ #if !defined(CHANGE_ME_H) #define CHANGE_ME_H #if defined(__cplusplus) extern “ C ” { #endif /* Actual header file contents go in here. */ #if defined(__cplusplus) } #endif #endif
/******************************************************************************/ /** @file @author AUTHOR NAME HERE. @brief BRIEF HERE. @copyright Copyright 2016 The University of British Columbia, IonDB Project Contributors (see @ref AUTHORS.md) @par 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 @par 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. */ /******************************************************************************/ #if !defined(CHANGE_ME_H) #define CHANGE_ME_H #if defined(__cplusplus) extern "C" { #endif /* Actual header file contents go in here. */ #if defined(__cplusplus) } #endif #endif
Add clarifying comment for assertEqualCopies
#pragma once #include "rapidcheck/seq/Operations.h" namespace rc { namespace test { //! Forwards Seq a random amount and copies it to see if it is equal to the //! original. template<typename T> void assertEqualCopies(Seq<T> seq) { std::size_t len = seq::length(seq); std::size_t n = *gen::ranged<std::size_t>(0, len * 2); while (n--) seq.next(); const auto copy = seq; RC_ASSERT(copy == seq); } } // namespace test } // namespace rc
#pragma once #include "rapidcheck/seq/Operations.h" namespace rc { namespace test { //! Forwards Seq a random amount and copies it to see if it is equal to the //! original. Must not be infinite, of course. template<typename T> void assertEqualCopies(Seq<T> seq) { std::size_t len = seq::length(seq); std::size_t n = *gen::ranged<std::size_t>(0, len * 2); while (n--) seq.next(); const auto copy = seq; RC_ASSERT(copy == seq); } } // namespace test } // namespace rc
Add missing newline to usage print call.
#include <anerley/anerley-tp-feed.h> #include <libmissioncontrol/mission-control.h> #include <glib.h> #include <dbus/dbus-glib.h> int main (int argc, char **argv) { GMainLoop *main_loop; MissionControl *mc; McAccount *account; AnerleyTpFeed *feed; DBusGConnection *conn; if (argc < 2) { g_print ("Usage: ./test-tp-feed <account-name>"); return 1; } g_type_init (); main_loop = g_main_loop_new (NULL, FALSE); conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); mc = mission_control_new (conn); account = mc_account_lookup (argv[1]); feed = anerley_tp_feed_new (mc, account); g_main_loop_run (main_loop); return 0; }
#include <anerley/anerley-tp-feed.h> #include <libmissioncontrol/mission-control.h> #include <glib.h> #include <dbus/dbus-glib.h> int main (int argc, char **argv) { GMainLoop *main_loop; MissionControl *mc; McAccount *account; AnerleyTpFeed *feed; DBusGConnection *conn; if (argc < 2) { g_print ("Usage: ./test-tp-feed <account-name>\n"); return 1; } g_type_init (); main_loop = g_main_loop_new (NULL, FALSE); conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); mc = mission_control_new (conn); account = mc_account_lookup (argv[1]); feed = anerley_tp_feed_new (mc, account); g_main_loop_run (main_loop); return 0; }
Fix a build issue on Solaris
#ifndef LOCK_H #define LOCK_H enum lockstat { GET_LOCK_NOT_GOT=0, GET_LOCK_ERROR, GET_LOCK_GOT }; typedef struct lock lock_t; struct lock { int fd; enum lockstat status; char *path; lock_t *next; }; extern struct lock *lock_alloc(void); extern int lock_init(struct lock *lock, const char *path); extern struct lock *lock_alloc_and_init(const char *path); extern void lock_free(struct lock **lock); // Need to test lock->status to find out what happened when calling these. extern void lock_get_quick(struct lock *lock); extern void lock_get(struct lock *lock); extern int lock_test(const char *path); extern int lock_release(struct lock *lock); extern void lock_add_to_list(struct lock **locklist, struct lock *lock); extern void locks_release_and_free(struct lock **locklist); #endif
#ifndef LOCK_H #define LOCK_H enum lockstat { GET_LOCK_NOT_GOT=0, GET_LOCK_ERROR, GET_LOCK_GOT }; struct lock { int fd; enum lockstat status; char *path; struct lock *next; }; extern struct lock *lock_alloc(void); extern int lock_init(struct lock *lock, const char *path); extern struct lock *lock_alloc_and_init(const char *path); extern void lock_free(struct lock **lock); // Need to test lock->status to find out what happened when calling these. extern void lock_get_quick(struct lock *lock); extern void lock_get(struct lock *lock); extern int lock_test(const char *path); extern int lock_release(struct lock *lock); extern void lock_add_to_list(struct lock **locklist, struct lock *lock); extern void locks_release_and_free(struct lock **locklist); #endif
Add : navigation bar fix
// // UINavigationBar+Fix.h // LYCategory // // Created by Luo Yu on 2017/02/11. // Copyright (c) 2014 Luo Yu. All rights reserved. // #import <UIKit/UIKit.h> @interface UINavigationBar (Fix) @end
Add additional test case for handling of overflows in congruence domain.
// PARAM: --enable ana.int.congruence #include <goblint.h> // #include <assert.h> // #define __goblint_check(e) assert(e) int basic(){ unsigned int two_pow_16 = 65536; unsigned int a; unsigned int b; if (a % two_pow_16 == 3) { if (b % two_pow_16 == 5) { __goblint_check(a % two_pow_16 == 3); __goblint_check(b % two_pow_16 == 5); int e = a * b; __goblint_check(e % two_pow_16 == 15); __goblint_check(e == 15); // UNKNOWN! } } } int special(){ unsigned int two_pow_18 = 262144; unsigned int two_pow_17 = 131072; unsigned int a; unsigned int b; if (a % two_pow_18 == two_pow_17) { if (b % two_pow_18 == two_pow_17) { __goblint_check(a % two_pow_18 == two_pow_17); __goblint_check(b % two_pow_18 == two_pow_17); int e = a * b; __goblint_check(e == 0); } } // Hint why the above works: __goblint_check( two_pow_17 * two_pow_17 == 0); } int special2(){ unsigned int two_pow_30 = 1073741824; unsigned int two_pow_18 = 262144; unsigned int two_pow_17 = 131072; unsigned int two_pow_16 = 65536; unsigned int two_pow_15 = 32768; unsigned int x = two_pow_17 + two_pow_15; unsigned int a; unsigned int b; if (a % two_pow_18 == x) { if (b % two_pow_18 == x) { __goblint_check(a % two_pow_18 == x); __goblint_check(b % two_pow_18 == x); int e = a * b; __goblint_check(e == two_pow_30); } } // Hint why the above holds: __goblint_check( x * x == two_pow_30); } int main() { basic(); special(); special2(); }
Add help and binary options
// // main.c // d16-asm // // Created by Michael Nolan on 6/17/16. // Copyright © 2016 Michael Nolan. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include "parser.h" #include "assembler.h" #include <string.h> #include "instruction.h" #include <unistd.h> extern int yyparse (FILE* output_file); extern FILE* yyin; extern int yydebug; int main(int argc, char * const argv[]) { FILE *f,*o; opterr = 0; int c; while ((c=getopt(argc,argv,"o:")) != -1){ switch(c){ case 'o': o = fopen(optarg,"wb"); } } if(optind<argc) f = fopen(argv[optind],"r"); else{ fprintf(stderr,"d16: No input files specified\n"); exit(-1); } if(o==NULL){ o=fopen("a.out","wb"); } yyin = f; init_hash_table(); do { yyparse(o); } while (!feof(yyin)); fclose(f); fclose(o); return 0; }
// // main.c // d16-asm // // Created by Michael Nolan on 6/17/16. // Copyright © 2016 Michael Nolan. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include "parser.h" #include "assembler.h" #include <string.h> #include "instruction.h" #include <unistd.h> extern int yyparse (FILE* output_file); extern FILE* yyin; extern int yydebug; bool binary_mode = false; int main(int argc, char * const argv[]) { FILE *f,*o; opterr = 0; int c; while ((c=getopt(argc,argv,"o:bh")) != -1){ switch(c){ case 'o': o = fopen(optarg,"wb"); break; case 'b': binary_mode = true; break; case 'h': puts("Usage: d16 [-bh] -o [outputfile] [input]\n"); exit(0); break; } } if(optind<argc) f = fopen(argv[optind],"r"); else{ fprintf(stderr,"d16: No input files specified\n"); exit(-1); } if(o==NULL){ o=fopen("a.out","wb"); } yyin = f; init_hash_table(); do { yyparse(o); } while (!feof(yyin)); fclose(f); fclose(o); return 0; }
Use stdint.h in CAST to implement 32 bit and 8 bit unsigned integers.
/* * CAST-128 in C * Written by Steve Reid <sreid@sea-to-sky.net> * 100% Public Domain - no warranty * Released 1997.10.11 */ #ifndef _CAST_H_ #define _CAST_H_ typedef unsigned char u8; /* 8-bit unsigned */ typedef unsigned long u32; /* 32-bit unsigned */ typedef struct { u32 xkey[32]; /* Key, after expansion */ int rounds; /* Number of rounds to use, 12 or 16 */ } cast_key; void cast_setkey(cast_key* key, u8* rawkey, int keybytes); void cast_encrypt(cast_key* key, u8* inblock, u8* outblock); void cast_decrypt(cast_key* key, u8* inblock, u8* outblock); #endif /* ifndef _CAST_H_ */
/* * CAST-128 in C * Written by Steve Reid <sreid@sea-to-sky.net> * 100% Public Domain - no warranty * Released 1997.10.11 */ #ifndef _CAST_H_ #define _CAST_H_ #include <stdint.h> typedef uint8_t u8; /* 8-bit unsigned */ typedef uint32_t u32; /* 32-bit unsigned */ typedef struct { u32 xkey[32]; /* Key, after expansion */ int rounds; /* Number of rounds to use, 12 or 16 */ } cast_key; void cast_setkey(cast_key* key, u8* rawkey, int keybytes); void cast_encrypt(cast_key* key, u8* inblock, u8* outblock); void cast_decrypt(cast_key* key, u8* inblock, u8* outblock); #endif /* ifndef _CAST_H_ */
Add mathextras.h to wtf to give win32 roundf/lroundf support.
/* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <math.h> #if PLATFORM(WIN) inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); } inline long lroundf(float num) { return num > 0 ? num + 0.5f : ceilf(num - 0.5f); } #endif
Add RocksDB merge operator import to the main public header
// // ObjectiveRocks.h // ObjectiveRocks // // Created by Iska on 20/11/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import "RocksDB.h" #import "RocksDBOptions.h" #import "RocksDBReadOptions.h" #import "RocksDBWriteOptions.h" #import "RocksDBWriteBatch.h" #import "RocksDBIterator.h" #import "RocksDBSnapshot.h" #import "RocksDBComparator.h"
// // ObjectiveRocks.h // ObjectiveRocks // // Created by Iska on 20/11/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import "RocksDB.h" #import "RocksDBOptions.h" #import "RocksDBReadOptions.h" #import "RocksDBWriteOptions.h" #import "RocksDBWriteBatch.h" #import "RocksDBIterator.h" #import "RocksDBSnapshot.h" #import "RocksDBComparator.h" #import "RocksDBMergeOperator.h"
Fix external extension install (post-sideload) restriction on Windows.
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_UI_H_ #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_UI_H_ class Browser; class ExtensionService; // Only enable the external install UI on Windows and Mac, because those // are the platforms where external installs are the biggest issue. #if defined(OS_WINDOWS) || defined(OS_MACOSX) #define ENABLE_EXTERNAL_INSTALL_UI 1 #else #define ENABLE_EXTERNAL_INSTALL_UI 0 #endif namespace extensions { class Extension; // Adds/Removes a global error informing the user that an external extension // was installed. bool AddExternalInstallError(ExtensionService* service, const Extension* extension); void RemoveExternalInstallError(ExtensionService* service); // Used for testing. bool HasExternalInstallError(ExtensionService* service); } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_UI_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_UI_H_ #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_UI_H_ #include "build/build_config.h" class Browser; class ExtensionService; // Only enable the external install UI on Windows and Mac, because those // are the platforms where external installs are the biggest issue. #if defined(OS_WIN) || defined(OS_MACOSX) #define ENABLE_EXTERNAL_INSTALL_UI 1 #else #define ENABLE_EXTERNAL_INSTALL_UI 0 #endif namespace extensions { class Extension; // Adds/Removes a global error informing the user that an external extension // was installed. bool AddExternalInstallError(ExtensionService* service, const Extension* extension); void RemoveExternalInstallError(ExtensionService* service); // Used for testing. bool HasExternalInstallError(ExtensionService* service); } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_UI_H_
Remove a cast again, after it was shown to worsen Windows perf.
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" /* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, const int16_t* seq1, const int16_t* seq2, int16_t dim_seq, int16_t dim_cross_correlation, int right_shifts, int step_seq2) { int i = 0, j = 0; for (i = 0; i < dim_cross_correlation; i++) { int32_t corr = 0; // Linux 64-bit performance is improved by the int16_t cast below. // Presumably this is some sort of compiler bug, as there's no obvious // reason why that should result in better code. for (j = 0; j < dim_seq; j++) corr += (seq1[j] * seq2[j]) >> (int16_t)right_shifts; seq2 += step_seq2; *cross_correlation++ = corr; } }
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" /* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, const int16_t* seq1, const int16_t* seq2, int16_t dim_seq, int16_t dim_cross_correlation, int right_shifts, int step_seq2) { int i = 0, j = 0; for (i = 0; i < dim_cross_correlation; i++) { int32_t corr = 0; for (j = 0; j < dim_seq; j++) corr += (seq1[j] * seq2[j]) >> right_shifts; seq2 += step_seq2; *cross_correlation++ = corr; } }
Add a fence in barrier.
#ifndef UTIL_H #define UTIL_H #include "fibrile.h" /** Atomics. */ #define fence() fibrile_fence() #define fadd(ptr, n) __sync_fetch_and_add(ptr, n) #define cas(...) __sync_val_compare_and_swap(__VA_ARGS__) /** Lock. */ #define lock(ptr) fibrile_lock(ptr) #define unlock(ptr) fibrile_unlock(ptr) #define trylock(ptr) (!__sync_lock_test_and_set(ptr, 1)) /** Barrier. */ static inline void barrier(int n) { static volatile int count = 0; static volatile int sense = 0; int local_sense = !fibrile_deq.sense; if (fadd(&count, 1) == n - 1) { count = 0; sense = local_sense; } while (sense != local_sense); } /** Others. */ typedef struct _frame_t { void * rsp; void * rip; } frame_t; #define this_frame() ((frame_t *) __builtin_frame_address(0)) #define unreachable() __builtin_unreachable() #define adjust(addr, offset) ((void *) addr - offset) #endif /* end of include guard: UTIL_H */
#ifndef UTIL_H #define UTIL_H #include "fibrile.h" /** Atomics. */ #define fence() fibrile_fence() #define fadd(ptr, n) __sync_fetch_and_add(ptr, n) #define cas(...) __sync_val_compare_and_swap(__VA_ARGS__) /** Lock. */ #define lock(ptr) fibrile_lock(ptr) #define unlock(ptr) fibrile_unlock(ptr) #define trylock(ptr) (!__sync_lock_test_and_set(ptr, 1)) /** Barrier. */ static inline void barrier(int n) { static volatile int count = 0; static volatile int sense = 0; int local_sense = !fibrile_deq.sense; if (fadd(&count, 1) == n - 1) { count = 0; sense = local_sense; } while (sense != local_sense); fence(); } /** Others. */ typedef struct _frame_t { void * rsp; void * rip; } frame_t; #define this_frame() ((frame_t *) __builtin_frame_address(0)) #define unreachable() __builtin_unreachable() #define adjust(addr, offset) ((void *) addr - offset) #endif /* end of include guard: UTIL_H */
Remove ndk-build from [] flac build rules
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef INCLUDE_DATA_SOURCE_H_ #define INCLUDE_DATA_SOURCE_H_ #include <jni.h> #include <sys/types.h> class DataSource { public: // Returns the number of bytes read, or -1 on failure. It's not an error if // this returns zero; it just means the given offset is equal to, or // beyond, the end of the source. virtual ssize_t readAt(off64_t offset, void* const data, size_t size) = 0; }; #endif // INCLUDE_DATA_SOURCE_H_
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef INCLUDE_DATA_SOURCE_H_ #define INCLUDE_DATA_SOURCE_H_ #include <jni.h> #include <sys/types.h> class DataSource { public: virtual ~DataSource() {} // Returns the number of bytes read, or -1 on failure. It's not an error if // this returns zero; it just means the given offset is equal to, or // beyond, the end of the source. virtual ssize_t readAt(off64_t offset, void* const data, size_t size) = 0; }; #endif // INCLUDE_DATA_SOURCE_H_
Add explicit Foundation import to NSDate extension (for spm compatibility)
// // NSDate+RFC1123.h // MKNetworkKit // // Created by Marcus Rohrmoser // http://blog.mro.name/2009/08/nsdateformatter-http-header/ // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 // No obvious license attached /** Convert RFC1123 format dates */ @interface NSDate (RFC1123) /** * @name Convert a string to NSDate */ /** * Convert a RFC1123 'Full-Date' string * (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1) * into NSDate. * * @param value_ NSString* the string to convert * @return NSDate* */ +(NSDate*)dateFromRFC1123:(NSString*)value_; /** * @name Retrieve NSString value of the current date */ /** * Convert NSDate into a RFC1123 'Full-Date' string * (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1). * * @return NSString* */ @property (nonatomic, readonly, copy) NSString *rfc1123String; @end
// // NSDate+RFC1123.h // MKNetworkKit // // Created by Marcus Rohrmoser // http://blog.mro.name/2009/08/nsdateformatter-http-header/ // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 // No obvious license attached #import <Foundation/Foundation.h> /** Convert RFC1123 format dates */ @interface NSDate (RFC1123) /** * @name Convert a string to NSDate */ /** * Convert a RFC1123 'Full-Date' string * (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1) * into NSDate. * * @param value_ NSString* the string to convert * @return NSDate* */ +(NSDate*)dateFromRFC1123:(NSString*)value_; /** * @name Retrieve NSString value of the current date */ /** * Convert NSDate into a RFC1123 'Full-Date' string * (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1). * * @return NSString* */ @property (nonatomic, readonly, copy) NSString *rfc1123String; @end
Fix for new versions of gtksourceview provided by Oleg Chiruhin
#include "gtk2hs_macros.h" #include <gtksourceview/gtksourcebuffer.h> #if GTK_MAJOR_VERSION < 3 #include <gtksourceview/gtksourceiter.h> #endif #include <gtksourceview/gtksourcelanguage.h> #include <gtksourceview/gtksourcelanguagemanager.h> #include <gtksourceview/gtksourcestyle.h> #include <gtksourceview/gtksourcestylescheme.h> #include <gtksourceview/gtksourcestyleschememanager.h> #include <gtksourceview/gtksourceview.h> #include <gtksourceview/gtksourceview-typebuiltins.h> #include <gtksourceview/gtksourceundomanager.h> #include <gtksourceview/gtksourcecompletionitem.h>
#include "gtk2hs_macros.h" #include <gtksourceview/gtksourcebuffer.h> #if GTK_MAJOR_VERSION < 3 #include <gtksourceview/gtksourceiter.h> #endif #include <gtksourceview/gtksourcelanguage.h> #include <gtksourceview/gtksourcelanguagemanager.h> #include <gtksourceview/gtksourcestyle.h> #include <gtksourceview/gtksourcestylescheme.h> #include <gtksourceview/gtksourcestyleschememanager.h> #include <gtksourceview/gtksourceview.h> #include <gtksourceview/gtksourceview-typebuiltins.h> #include <gtksourceview/gtksourceundomanager.h> #include <gtksourceview/gtksourcecompletionitem.h> #include <gtksourceview/gtksourcegutter.h> #include <gtksourceview/gtksourcecompletionprovider.h> #include <gtksourceview/gtksourcecompletionproposal.h> #include <gtksourceview/gtksourcemark.h> #include <gtksourceview/gtksourcecompletioninfo.h>
Include NSArray category into main header
// // OMValidation.h // OMValidation // // Copyright (C) 2015 Oliver Mader // // 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 "OMValidationFailure.h" #import "NSObject+OMValidation.h" #import "NSString+OMValidation.h" #import "NSNumber+OMValidation.h" #import "OMValidate.h" #ifdef OMVALIDATION_PROMISES_AVAILABLE #import "OMValidationTask.h" #endif
// // OMValidation.h // OMValidation // // Copyright (C) 2015 Oliver Mader // // 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 "OMValidationFailure.h" #import "NSObject+OMValidation.h" #import "NSString+OMValidation.h" #import "NSNumber+OMValidation.h" #import "NSArray+OMValidation.h" #import "OMValidate.h" #ifdef OMVALIDATION_PROMISES_AVAILABLE #import "OMValidationTask.h" #endif
Add notification message which will be used to notify about voice activity.
// // Copyright (C) 2008 SIPez LLC. // Licensed to SIPfoundry under a Contributor Agreement. // // Copyright (C) 2008 SIPfoundry Inc. // Licensed by SIPfoundry under the LGPL license. // // $$ /////////////////////////////////////////////////////////////////////////////// #ifndef _MprnRtpStreamActivityMsg_h_ #define _MprnRtpStreamActivityMsg_h_ // SYSTEM INCLUDES // APPLICATION INCLUDES #include "os/OsMsg.h" #include "utl/UtlString.h" #include "MpResNotificationMsg.h" // DEFINES // MACROS // EXTERNAL FUNCTIONS // EXTERNAL VARIABLES // CONSTANTS // STRUCTS // TYPEDEFS // FORWARD DECLARATIONS /** * Notification used to communicate RTP stream activity. */ class MprnRtpStreamActivityMsg : public MpResNotificationMsg { /* //////////////////////////// PUBLIC //////////////////////////////////// */ public: /* ============================ CREATORS ================================== */ ///@name Creators //@{ enum StreamState { STREAM_START, ///< Stream have been started STREAM_STOP, ///< Stream have been stopped STREAM_CHANGE ///< Stream attributes have been changed }; /// Constructor MprnRtpStreamActivityMsg(const UtlString& namedResOriginator, StreamState state, RtpSRC ssrc, unsigned address, int port, MpConnectionID connId = MP_INVALID_CONNECTION_ID, int streamId = -1); /// Copy constructor MprnRtpStreamActivityMsg(const MprnRtpStreamActivityMsg& rMsg); /// Create a copy of this msg object (which may be of a derived type) virtual OsMsg* createCopy() const; /// Destructor virtual ~MprnRtpStreamActivityMsg(); //@} /* ============================ MANIPULATORS ============================== */ ///@name Manipulators //@{ /// Assignment operator MprnRtpStreamActivityMsg& operator=(const MprnRtpStreamActivityMsg& rhs); //@} /* ============================ ACCESSORS ================================= */ ///@name Accessors //@{ /// Get the stream state. StreamState getState() const; /// Get the stream SSRC. unsigned getSsrc() const; /// Get IP address of the stream source/destination. unsigned getAddress() const; /// Get port of the stream source/destination. int getPort() const; //@} /* ============================ INQUIRY =================================== */ ///@name Inquiry //@{ //@} /* //////////////////////////// PROTECTED ///////////////////////////////// */ protected: StreamState mState; ///< Stream state to be reported. RtpSRC mSsrc; ///< SSRC of the stream. unsigned mAddress; ///< IP of the stream source/destination. int mPort; ///< Port of the stream source/destination. /* //////////////////////////// PRIVATE /////////////////////////////////// */ private: }; /* ============================ INLINE METHODS ============================ */ #endif // _MprnRtpStreamActivityMsg_h_
Update XFAIL line after r294781.
// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s // XFAIL: amd64-, x86_64-, x86_64h-, arm, aarch64, arm64 // REQUIRES: linux typedef int a;
// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s // XFAIL: amd64-, x86_64-, x86_64h-, arm, aarch64, arm64, powerpc64le- // REQUIRES: linux typedef int a;
Fix win builder by tagging MenuButtonDelegate with VIEWS_EXPORT.
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_DELEGATE_H_ #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_DELEGATE_H_ #pragma once namespace gfx { class Point; } namespace views { class View; //////////////////////////////////////////////////////////////////////////////// // // MenuButtonDelegate // // An interface that allows a component to tell a View about a menu that it // has constructed that the view can show (e.g. for MenuButton views, or as a // context menu.) // //////////////////////////////////////////////////////////////////////////////// class MenuButtonDelegate { public: // Creates and shows a menu at the specified position. |source| is the view // the MenuButtonDelegate was set on. virtual void RunMenu(View* source, const gfx::Point& point) = 0; protected: virtual ~MenuButtonDelegate() {} }; } // namespace views #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_DELEGATE_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_DELEGATE_H_ #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_DELEGATE_H_ #pragma once #include "ui/views/views_export.h" namespace gfx { class Point; } namespace views { class View; //////////////////////////////////////////////////////////////////////////////// // // MenuButtonDelegate // // An interface that allows a component to tell a View about a menu that it // has constructed that the view can show (e.g. for MenuButton views, or as a // context menu.) // //////////////////////////////////////////////////////////////////////////////// class VIEWS_EXPORT MenuButtonDelegate { public: // Creates and shows a menu at the specified position. |source| is the view // the MenuButtonDelegate was set on. virtual void RunMenu(View* source, const gfx::Point& point) = 0; protected: virtual ~MenuButtonDelegate() {} }; } // namespace views #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_DELEGATE_H_
Extend interfaces with new parsing functions
#pragma once class IElfRelocator; enum class Endianness { Big, Little }; class CArchitecture { public: virtual void AssembleOpcode(const std::wstring& name, const std::wstring& args) = 0; virtual bool AssembleDirective(const std::wstring& name, const std::wstring& args) = 0; virtual void NextSection() = 0; virtual void Pass2() = 0; virtual void Revalidate() = 0; virtual int GetWordSize() = 0; virtual IElfRelocator* getElfRelocator() = 0; virtual Endianness getEndianness() = 0; }; class CInvalidArchitecture: public CArchitecture { public: virtual void AssembleOpcode(const std::wstring& name, const std::wstring& args); virtual bool AssembleDirective(const std::wstring& name, const std::wstring& args); virtual void NextSection(); virtual void Pass2(); virtual void Revalidate(); virtual int GetWordSize(); virtual IElfRelocator* getElfRelocator(); virtual Endianness getEndianness() { return Endianness::Little; }; }; extern CInvalidArchitecture InvalidArchitecture;
#pragma once class IElfRelocator; class CAssemblerCommand; class Tokenizer; enum class Endianness { Big, Little }; class CArchitecture { public: virtual void AssembleOpcode(const std::wstring& name, const std::wstring& args) = 0; virtual bool AssembleDirective(const std::wstring& name, const std::wstring& args) = 0; virtual CAssemblerCommand* parseDirective(Tokenizer& tokenizer) { return nullptr; }; virtual CAssemblerCommand* parseOpcode(Tokenizer& tokenizer) { return nullptr; }; virtual void NextSection() = 0; virtual void Pass2() = 0; virtual void Revalidate() = 0; virtual int GetWordSize() = 0; virtual IElfRelocator* getElfRelocator() = 0; virtual Endianness getEndianness() = 0; }; class CInvalidArchitecture: public CArchitecture { public: virtual void AssembleOpcode(const std::wstring& name, const std::wstring& args); virtual bool AssembleDirective(const std::wstring& name, const std::wstring& args); virtual void NextSection(); virtual void Pass2(); virtual void Revalidate(); virtual int GetWordSize(); virtual IElfRelocator* getElfRelocator(); virtual Endianness getEndianness() { return Endianness::Little; }; }; extern CInvalidArchitecture InvalidArchitecture;
Change to using CompactTensorV2 as default impl for sparse tensors.
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "compact/compact_tensor.h" #include "compact/compact_tensor_builder.h" namespace vespalib { namespace tensor { struct DefaultTensor { using type = CompactTensor; using builder = CompactTensorBuilder; }; } // namespace vespalib::tensor } // namespace vespalib
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "compact/compact_tensor_v2.h" #include "compact/compact_tensor_v2_builder.h" namespace vespalib { namespace tensor { struct DefaultTensor { using type = CompactTensorV2; using builder = CompactTensorV2Builder; }; } // namespace vespalib::tensor } // namespace vespalib
Fix error with char pointer
#include <stdio.h> #include <stdlib.h> #include "error.h" #include "memory.h" #define READ_SIZE 0x4000 static void usage(void) { fprintf(stderr, "usage: tmpgb <file>"); exit(EXIT_FAILURE); } static void load_rom(const char *rom) { FILE *fp; unsigned char *buffer[READ_SIZE]; size_t nread; int i = -1; fp = fopen(rom, "rb"); if (fp == NULL) { fprintf(stderr, "Could not open %s", rom); exit(EXIT_FAILURE); } while (!feof(fp)) { nread = fread(buffer, READ_SIZE, 1, fp); if (nread == 0) { if (ferror(fp)) { fprintf(stderr, "Error reading %s", rom); exit(EXIT_FAILURE); } } read_rom(buffer, i); } fclose(fp); } static void run(void) { int ret; if ((ret = init_memory()) != 0) { errnr = ret; exit_error(); } } int main(int argc, char **argv) { char *rom; if (argc != 2) usage(); rom = argv[1]; load_rom(rom); run(); return 0; }
#include <stdio.h> #include <stdlib.h> #include "error.h" #include "memory.h" #define READ_SIZE 0x4000 static void usage(void) { fprintf(stderr, "usage: tmpgb <file>"); exit(EXIT_FAILURE); } static void load_rom(const char *rom) { FILE *fp; unsigned char buffer[READ_SIZE]; size_t nread; int i = -1; fp = fopen(rom, "rb"); if (fp == NULL) { fprintf(stderr, "Could not open %s", rom); exit(EXIT_FAILURE); } while (!feof(fp)) { nread = fread(buffer, READ_SIZE, 1, fp); if (nread == 0) { if (ferror(fp)) { fprintf(stderr, "Error reading %s", rom); exit(EXIT_FAILURE); } } read_rom(buffer, i); } fclose(fp); } static void run(void) { int ret; if ((ret = init_memory()) != 0) { errnr = ret; exit_error(); } } int main(int argc, char **argv) { char *rom; if (argc != 2) usage(); rom = argv[1]; load_rom(rom); run(); return 0; }
Allow tests to override error tolerance
#pragma once #include <stdlib.h> #include <stdio.h> #include <math.h> #include <stdbool.h> #include <check.h> #include <pal.h> #include "../../src/base/pal_base_private.h" #include <common.h> /* Max allowed diff against expected value */ #define EPSILON_MAX 0.001f #define EPSILON_RELMAX 0.00001f struct gold { float ai; float bi; float res; float gold; }; extern float *ai, *bi, *res, *ref; /* Functions that can be overridden by individual tests */ /* Compare two values */ bool compare(float x, float y); /* Allow individual tests to add more test cases, e.g. against a reference * function */ void add_more_tests(TCase *tcase); /* Needs to be implemented by tests that define REF_FUNCTION */ void generate_ref(float *out, size_t n);
#pragma once #include <stdlib.h> #include <stdio.h> #include <math.h> #include <stdbool.h> #include <check.h> #include <pal.h> #include "../../src/base/pal_base_private.h" #include <common.h> /* Max allowed diff against expected value */ #ifndef EPSILON_MAX #define EPSILON_MAX 0.001f #endif #ifndef EPSILON_RELMAX #define EPSILON_RELMAX 0.00001f #endif struct gold { float ai; float bi; float res; float gold; }; extern float *ai, *bi, *res, *ref; /* Functions that can be overridden by individual tests */ /* Compare two values */ bool compare(float x, float y); /* Allow individual tests to add more test cases, e.g. against a reference * function */ void add_more_tests(TCase *tcase); /* Needs to be implemented by tests that define REF_FUNCTION */ void generate_ref(float *out, size_t n);
Fix typo in empty struct test check
// RUN: %layout_check %s // RUN: %check %s struct A { }; // CHEKC: /warning: empty struct/ struct Containter { struct A a; }; struct Pre { int i; struct A a; int j; }; struct Pre p = { 1, /* warn */ 2 }; // CHECK: /warning: missing {} initialiser for empty struct/ struct Pre q = { 1, {}, 2 }; main() { struct A a = { 5 }; // CHECK: /warning: missing {} initialiser for empty struct/ struct A b = {}; struct Containter c = {{}}; c.a = (struct A){}; }
// RUN: %layout_check %s // RUN: %check %s struct A { }; // CHECK: /warning: empty struct/ struct Container { struct A a; }; struct Pre { int i; struct A a; int j; }; struct Pre p = { 1, /* warn */ 2 }; // CHECK: /warning: missing {} initialiser for empty struct/ struct Pre q = { 1, {}, 2 }; main() { struct A a = { 5 }; // CHECK: /warning: missing {} initialiser for empty struct/ struct A b = {}; struct Container c = {{}}; c.a = (struct A){}; }
Fix compile error on gcc 6.3.0.
#ifndef LPSLCD_VALIDATOR_H #define LPSLCD_VALIDATOR_H #include "generator.h" class Validator { public: static bool Validate (const Code & code) { // | N - k | // | ____ | // | \ a + a | < L // | /___ i i + k | // | i = 1 | // // k - 0 < k < N; // N - length of sequence. // L - limit of sidelobe level. const ssize_t sideLobeLimit = code.size () < 14 ? 1 : floor (code.size () / 14.0f); for (size_t shift = 1; shift < code.size (); ++shift) { ssize_t sideLobe = 0; for (size_t i = 0; i < code.size () - shift; ++i) { sideLobe += (code [i + shift] == '+' ? 1 : -1) * (code [i ] == '+' ? 1 : -1); } if (std::abs (sideLobe) > sideLobeLimit) { return false; } } return true; }; }; #endif//LPSLCD_VALIDATOR_H
#ifndef LPSLCD_VALIDATOR_H #define LPSLCD_VALIDATOR_H #include "generator.h" #include <cmath> class Validator { public: static bool Validate (const Code & code) { // | N - k | // | ____ | // | \ a + a | < L // | /___ i i + k | // | i = 1 | // // k - 0 < k < N; // N - length of sequence. // L - limit of sidelobe level. const ssize_t sideLobeLimit = code.size () < 14 ? 1 : std::floor (code.size () / 14.0f); for (size_t shift = 1; shift < code.size (); ++shift) { ssize_t sideLobe = 0; for (size_t i = 0; i < code.size () - shift; ++i) { sideLobe += (code [i + shift] == '+' ? 1 : -1) * (code [i ] == '+' ? 1 : -1); } if (std::abs (sideLobe) > sideLobeLimit) { return false; } } return true; }; }; #endif//LPSLCD_VALIDATOR_H
Solve Fire Flowers in c
#include <math.h> #include <stdio.h> int main() { double r1, x1, y1, r2, x2, y2; double distance; while (scanf("%lf %lf %lf %lf %lf %lf", &r1, &x1, &y1, &r2, &x2, &y2) != EOF) { distance = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); if (r1 >= distance + r2) { puts("RICO"); } else { puts("MORTO"); } } return 0; }
#include <math.h> #include <stdio.h> int main() { double r1, x1, y1, r2, x2, y2; double distance; while (scanf("%lf %lf %lf %lf %lf %lf", &r1, &x1, &y1, &r2, &x2, &y2) != EOF) { distance = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); if (r1 >= distance + r2) { puts("RICO"); } else { puts("MORTO"); } } return 0; }
Add types "ushort" and "rlim_t" for AIX.
#ifndef FIX_TYPES_H #define FIX_TYPES_H #include <sys/types.h> /* The system include file defines this in terms of bzero(), but ANSI says we should use memset(). */ #if defined(OSF1) #undef FD_ZERO #define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) #endif /* Various non-POSIX conforming files which depend on sys/types.h will need these extra definitions... */ typedef unsigned int u_int; #if defined(ULTRIX42) || defined(ULTRIX43) typedef char * caddr_t; #endif #endif
#ifndef FIX_TYPES_H #define FIX_TYPES_H #include <sys/types.h> /* The system include file defines this in terms of bzero(), but ANSI says we should use memset(). */ #if defined(OSF1) #undef FD_ZERO #define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) #endif /* Various non-POSIX conforming files which depend on sys/types.h will need these extra definitions... */ typedef unsigned int u_int; #if defined(AIX32) typedef unsigned short ushort; #endif #if defined(ULTRIX42) || defined(ULTRIX43) typedef char * caddr_t; #endif #if defined(AIX32) typedef unsigned long rlim_t; #endif #endif
Implement interpretation of basic arithmetic and comparatory functions.
#include <stdlib.h> #include <stdio.h> #include <string.h> void runStep(struct stack_node node, struct stack_node *top) { switch( node.data.type ) { case 0: struct stack_node push; push.cdr = top; push.data = node.data; *top = push; break; } }
#include <stdlib.h> #include <stdio.h> #include <string.h> void runStep(struct stack_node node, struct stack_node *top) { switch( node.data.type ) { case T_INT: push(node, top); break; case T_SBRTN: push(node, top); break; case T_char 1: switch( nonde.data.numval ) { case '+': int x = pop(top); int y = pop(top); push(x + y); break; case '_': push(0); case '-': int x = pop(top); int y = pop(top); push(x - y); break; case '*': int x = pop(top); int y = pop(top); push(x * y); break; case '/': int x = pop(top); int y = pop(top); push(x / y); break; case '=': int x = pop(top); int y = pop(top); if(x == y) push(-1); else push(0); break; case '<': int x = pop(top); int y = pop(top); if(x < y) push(-1); else push(0); break; case '~': int x = pop(top); int y = pop(top); if(x == y): push(0); else push(-1); } } } struct stack_node pop(struct stack_node *top) { struct stack_node pop = *top; *top = *(pop.cdr); return pop; } void push(struct stack_node node, struct stack_node *top) { node.cdr = top; *top = node; }
Add configuration for MI libsa loadfile, to be used soon.
/* $OpenBSD: loadfile_machdep.h,v 1.1 2013/10/18 10:55:33 miod Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Christos Zoulas. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. */ #define BOOT_ELF #define LOAD_KERNEL LOAD_ALL #define COUNT_KERNEL COUNT_ALL #define LOADADDR(a) (((u_long)(a)) + offset) #define ALIGNENTRY(a) ((u_long)(a) & ~0x0fff) #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) #define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) #define WARN(a) (void)(printf a, \ printf((errno ? ": %s\n" : "\n"), \ strerror(errno))) #define PROGRESS(a) (void) printf a #define ALLOC(a) alloc(a) #define FREE(a, b) free(a, b)
Correct name of "DisplaceModules" field
#pragma once #include <spotify/json.hpp> #include <spotify/json/codec/boost.hpp> #include "noise/module/NoiseSources.h" namespace spotify { namespace json { template<> struct default_codec_t<noise::module::NoiseSources> { typedef noise::module::NoiseSources NoiseSources; static codec::object_t<NoiseSources> codec() { auto codec = codec::object<NoiseSources>(); auto single_module_codec = codec::string(); auto module_list_codec = codec::array<std::vector<std::string>>(single_module_codec); auto optional_single_module_codec = codec::optional(single_module_codec); auto optional_module_list_codec = codec::optional(module_list_codec); codec.optional("SourceModule", &NoiseSources::sourceModules, optional_module_list_codec); codec.optional("ControlModule", &NoiseSources::controlModule, optional_single_module_codec); codec.optional("DisplaceModule", &NoiseSources::displaceModules, optional_module_list_codec); return codec; } }; } }
#pragma once #include <spotify/json.hpp> #include <spotify/json/codec/boost.hpp> #include "noise/module/NoiseSources.h" namespace spotify { namespace json { template<> struct default_codec_t<noise::module::NoiseSources> { typedef noise::module::NoiseSources NoiseSources; static codec::object_t<NoiseSources> codec() { auto codec = codec::object<NoiseSources>(); auto single_module_codec = codec::string(); auto module_list_codec = codec::array<std::vector<std::string>>(single_module_codec); auto optional_single_module_codec = codec::optional(single_module_codec); auto optional_module_list_codec = codec::optional(module_list_codec); codec.optional("SourceModule", &NoiseSources::sourceModules, optional_module_list_codec); codec.optional("ControlModule", &NoiseSources::controlModule, optional_single_module_codec); codec.optional("DisplaceModules", &NoiseSources::displaceModules, optional_module_list_codec); return codec; } }; } }
Change solution name to Budget Planner
start Go to Layout [ “budget” (budget) ] Set Window Title [ Current Window; New Title: "Budget Research" ] Set Zoom Level [ 100% ] # #Report version number to Memory Switch Table. Set Field [ MemorySwitch::versionBudget; Reference::version ] # #Show regular menus if Admin logs in only. Show/Hide Text Ruler [ Hide ] If [ Get ( AccountName ) = "Admin" ] Show/Hide Status Area [ Hide ] Install Menu Set [ “[Standard FileMaker Menus]” ] Else Show/Hide Status Area [ Lock; Hide ] Install Menu Set [ “Custom Menu Set 1” ] End If January 8, 平成26 18:44:18 Budget Research.fp7 - start -1-
start Go to Layout [ “budget” (budget) ] Set Window Title [ Current Window; New Title: "Budget Planner" ] Set Zoom Level [ 100% ] # #Report version number to Memory Switch Table. Set Field [ MemorySwitch::versionBudget; Reference::version ] # #Show regular menus if Admin logs in only. Show/Hide Text Ruler [ Hide ] If [ Get ( AccountName ) = "Admin" ] Show/Hide Status Area [ Hide ] Install Menu Set [ “[Standard FileMaker Menus]” ] Else Show/Hide Status Area [ Lock; Hide ] Install Menu Set [ “Custom Menu Set 1” ] End If January 30, 平成26 22:13:52 Budget Planner.fp7 - start -1-
Add a little test driver
#include "bitboard.h" int main(int argc, char** argv) { Bitboard test = board_init(); board_print(test); return 0; }
Add a new feature, lol
/* * buffer.c * * Created on: 06.02.2015. * Author: ichiro */ /* Includes ------------------------------------------------------------------*/ #include "buffer.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ void buff_init(__IO fifo_t *buffer) { buffer->counter = 0; // 0 bytes in buffer buffer->head = 0; // Index points to start buffer->tail = 0; // Index points to start } void buff_put(__IO fifo_t *buffer, uint8_t ch) { buffer->buff[BUFF_MASK & (buffer->head++)] = ch; buffer->counter++; } uint8_t buff_get(__IO fifo_t *buffer) { uint8_t ch; ch = buffer->buff[BUFF_MASK & (buffer->tail++)]; buffer->counter--; return ch; } bool buff_empty(__IO fifo_t buffer) { return (buffer.counter == 0) ? true : false; } bool buff_full(__IO fifo_t buffer) { return (buffer.counter == BUFF_SIZE) ? true : false; }
/* * buffer.c * * Created on: 06.02.2015. * Author: ichiro */ /* Includes ------------------------------------------------------------------*/ #include "buffer.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ void buff_init(__IO fifo_t *buffer) { buffer->counter = 0; // 0 bytes in the buffer buffer->head = 0; // Index points to start buffer->tail = 0; // Index points to start } void buff_put(__IO fifo_t *buffer, uint8_t ch) { buffer->buff[BUFF_MASK & (buffer->head++)] = ch; buffer->counter++; } uint8_t buff_get(__IO fifo_t *buffer) { uint8_t ch; ch = buffer->buff[BUFF_MASK & (buffer->tail++)]; buffer->counter--; return ch; } bool buff_empty(__IO fifo_t buffer) { return (buffer.counter == 0) ? true : false; } bool buff_full(__IO fifo_t buffer) { return (buffer.counter == BUFF_SIZE) ? true : false; }
Add include to get declaration for std::mutex (staging_vespalib).
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/util/executor.h> #include <vespa/vespalib/util/time.h> #include <vector> class FNET_Transport; namespace vespalib { class TimerTask; /** * ScheduledExecutor is a class capable of running Tasks at a regular * interval. The timer can be reset to clear all tasks currently being * scheduled. */ class ScheduledExecutor { private: using TaskList = std::vector<std::unique_ptr<TimerTask>>; FNET_Transport & _transport; std::mutex _lock; TaskList _taskList; public: /** * Create a new timer, capable of scheduling tasks at fixed intervals. */ ScheduledExecutor(FNET_Transport & transport); /** * Destroys this timer, finishing the current task executing and then * finishing. */ ~ScheduledExecutor(); /** * Schedule new task to be executed at specified intervals. * * @param task The task to schedule. * @param delay The delay to wait before first execution. * @param interval The interval in seconds. */ void scheduleAtFixedRate(std::unique_ptr<Executor::Task> task, duration delay, duration interval); /** * Reset timer, clearing the list of task to execute. */ void reset(); }; }
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/util/executor.h> #include <vespa/vespalib/util/time.h> #include <mutex> #include <vector> class FNET_Transport; namespace vespalib { class TimerTask; /** * ScheduledExecutor is a class capable of running Tasks at a regular * interval. The timer can be reset to clear all tasks currently being * scheduled. */ class ScheduledExecutor { private: using TaskList = std::vector<std::unique_ptr<TimerTask>>; FNET_Transport & _transport; std::mutex _lock; TaskList _taskList; public: /** * Create a new timer, capable of scheduling tasks at fixed intervals. */ ScheduledExecutor(FNET_Transport & transport); /** * Destroys this timer, finishing the current task executing and then * finishing. */ ~ScheduledExecutor(); /** * Schedule new task to be executed at specified intervals. * * @param task The task to schedule. * @param delay The delay to wait before first execution. * @param interval The interval in seconds. */ void scheduleAtFixedRate(std::unique_ptr<Executor::Task> task, duration delay, duration interval); /** * Reset timer, clearing the list of task to execute. */ void reset(); }; }
Move some action methods into header for subclasses to support.
// // BRMenuOrderingGroupViewController.h // MenuKit // // Created by Matt on 29/07/15. // Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #import <UIKit/UIKit.h> #import "BRMenuOrderingDelegate.h" #import <BRStyle/BRUIStylish.h> @class BRMenuOrderingFlowController; extern NSString * const BRMenuOrderingItemCellIdentifier; extern NSString * const BRMenuOrderingItemWithoutComponentsCellIdentifier; extern NSString * const BRMenuOrderingItemGroupHeaderCellIdentifier; /** Present a list of menu item groups as sections of menu items. */ @interface BRMenuOrderingGroupViewController : UITableViewController <BRMenuOrderingDelegate, BRUIStylish> @property (nonatomic, assign, getter=isUsePrototypeCells) IBInspectable BOOL usePrototypeCells; @property (nonatomic, strong) BRMenuOrderingFlowController *flowController; @property (nonatomic, weak) id<BRMenuOrderingDelegate> orderingDelegate; @end
// // BRMenuOrderingGroupViewController.h // MenuKit // // Created by Matt on 29/07/15. // Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #import <UIKit/UIKit.h> #import "BRMenuOrderingDelegate.h" #import <BRStyle/BRUIStylish.h> @class BRMenuOrderingFlowController; @class BRMenuStepper; extern NSString * const BRMenuOrderingItemCellIdentifier; extern NSString * const BRMenuOrderingItemWithoutComponentsCellIdentifier; extern NSString * const BRMenuOrderingItemGroupHeaderCellIdentifier; /** Present a list of menu item groups as sections of menu items. */ @interface BRMenuOrderingGroupViewController : UITableViewController <BRMenuOrderingDelegate, BRUIStylish> @property (nonatomic, assign, getter=isUsePrototypeCells) IBInspectable BOOL usePrototypeCells; @property (nonatomic, strong) BRMenuOrderingFlowController *flowController; @property (nonatomic, weak) id<BRMenuOrderingDelegate> orderingDelegate; /** Action sent to go backwards in the navigation flow. @param sender The action sender. */ - (IBAction)goBack:(id)sender; /** Action when changes are requested to be saved into the active order. @param sender The action sender. */ - (IBAction)saveToOrder:(id)sender; /** Action sent when the quantity should be adjusted via a stepper. @param sender The stepper. */ - (IBAction)didAdjustQuantity:(BRMenuStepper *)sender; @end
Add hal watchdog for stm32f3
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include "hal/hal_watchdog.h" #include "mcu/stm32f30x.h" #include "mcu/stm32f30x_iwdg.h" struct stm_wdt_cfg { uint8_t prescaler; uint16_t reload }; struct stm_wdt_cfg g_wdt_cfg; int hal_watchdog_init(uint32_t expire_msecs) { uint32_t reload; /* Max prescaler is 256 */ reload = 32768 / 256; reload = (reload * expire_msecs) / 1000; /* Check to make sure we are not trying a reload value that is too large */ if (reload > IWDG_RLR_RL) { return -1; } g_wdt_cfg.prescaler = IWDG_Prescaler_256; g_wdt_cfg.reload = reload; return 0; } void hal_watchdog_enable(void) { FlagStatus rc; DBGMCU->APB1FZ |= DBGMCU_IWDG_STOP; IWDG_Enable(); IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_SetPrescaler(g_wdt_cfg.prescaler); IWDG_SetReload(g_wdt_cfg.reload); rc = SET; while (rc != RESET) { rc = IWDG_GetFlagStatus(); /* XXX: need to break out of this somehow. */ } IWDG_ReloadCounter(); } void hal_watchdog_tickle(void) { HAL_IWDG_Refresh(&g_wdt_cfg); }
Put all NFS-related header files (and the platform-dependent ugliness) in one place.
/***************************Copyright-DO-NOT-REMOVE-THIS-LINE** * CONDOR Copyright Notice * * See LICENSE.TXT for additional notices and disclaimers. * * Copyright (c)1990-1998 CONDOR Team, Computer Sciences Department, * University of Wisconsin-Madison, Madison, WI. All Rights Reserved. * No use of the CONDOR Software Program Source Code is authorized * without the express consent of the CONDOR Team. For more information * contact: CONDOR Team, Attention: Professor Miron Livny, * 7367 Computer Sciences, 1210 W. Dayton St., Madison, WI 53706-1685, * (608) 262-0856 or miron@cs.wisc.edu. * * U.S. Government Rights Restrictions: Use, duplication, or disclosure * by the U.S. Government is subject to restrictions as set forth in * subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer * Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and * (2) of Commercial Computer Software-Restricted Rights at 48 CFR * 52.227-19, as applicable, CONDOR Team, Attention: Professor Miron * Livny, 7367 Computer Sciences, 1210 W. Dayton St., Madison, * WI 53706-1685, (608) 262-0856 or miron@cs.wisc.edu. ****************************Copyright-DO-NOT-REMOVE-THIS-LINE**/ #ifndef _CONDOR_NFS_H #define _CONDOR_NFS_H #include <sys/mount.h> #if defined(LINUX) # include <linux/nfs.h> # include <linux/ipc.h> # include <dirent.h> typedef struct fhandle fhandle_t; #elif !defined(IRIX62) # include <rpc/rpc.h> # include <nfs/nfs.h> #if !defined(OSF1) # include <nfs/export.h> #endif #endif #endif /* _CONDOR_NFS_H */
Add Chapter 27, exercise 16
/* Chapter 27, exercise 16: "improve" (obfuscate) exercise 15 by using macros */ #include<stdio.h> #include<stdlib.h> #define GET_PTR(type,var_name) type* var_name = (type*)malloc(sizeof(type)) #define SET_FCT_PTR(pshape,pfct,fct) pshape->shape.pvtable->pfct = &fct typedef void (*Pfct0)(struct Shape*); typedef void (*Pfct1int)(struct Shape*, int); typedef struct { Pfct0 draw; Pfct1int rotate; } Vtable; typedef struct { Vtable* pvtable; int x; int y; } Shape; typedef struct { Shape shape; int radius; } Circle; void draw(Shape* this) { (this->pvtable->draw)(this); } void rotate(Shape* this, int deg) { (this->pvtable->rotate)(this,deg); } void draw_shape(Shape* this) { printf("Drawing Shape at (%d,%d)\n",this->x,this->y); } void rotate_shape(Shape* this, int deg) { printf("Rotating Shape at (%d,%d) by %d\n",this->x,this->y,deg); } void draw_circle(Shape* this) { Circle* pcircle = (Circle*)this; printf("Drawing Circle at (%d,%d) with radius %d\n", this->x,this->y,pcircle->radius); } void rotate_circle(Shape* this, int deg) { Circle* pcircle = (Circle*)this; printf("Rotating Circle at (%d,%d) with radius %d by %d\n", this->x,this->y,pcircle->radius,deg); } Shape* init_shape(int x, int y) { GET_PTR(Shape,pshape); GET_PTR(Vtable,pvtable); pvtable->draw = &draw_shape; pvtable->rotate = &rotate_shape; pshape->pvtable = pvtable; pshape->x = x; pshape->y = y; return pshape; } Circle* init_circle(int x, int y, int radius) { GET_PTR(Circle,pcircle); pcircle->shape = *init_shape(x,y); SET_FCT_PTR(pcircle,draw,draw_circle); SET_FCT_PTR(pcircle,rotate,rotate_circle); pcircle->radius = radius; return pcircle; } int main() { Shape* myshape = init_shape(10,10); Circle* mycircle = init_circle(20,20,5); draw(myshape); draw(mycircle); rotate(myshape,10); rotate(mycircle,15); }
Include math.h instead of bits headers.
#if defined (__GNUC__) || defined (__INTEL_COMPILER) || defined (__clang__) #ifdef INFINITY #undef INFINITY #endif #ifdef NAN #undef NAN #endif #define NAN __builtin_nan("") #define NANf __builtin_nanf("") #define INFINITY __builtin_inf() #define INFINITYf __builtin_inff() #else #include <bits/nan.h> #include <bits/inf.h> #endif
#if defined (__GNUC__) || defined (__INTEL_COMPILER) || defined (__clang__) #ifdef INFINITY #undef INFINITY #endif #ifdef NAN #undef NAN #endif #define NAN __builtin_nan("") #define NANf __builtin_nanf("") #define INFINITY __builtin_inf() #define INFINITYf __builtin_inff() #else #include <math.h> #endif
Reduce chance of include guard conflicts
#ifndef FLATCC_PORTABLE_H #define FLATCC_PORTABLE_H #include "flatcc/portable/portable.h" #endif /* FLATCC_PORTABLE_H */
#ifndef FLATCC_PORTABLE_H #define FLATCC_PORTABLE_H #include "flatcc/portable/portable_basic.h" #endif /* FLATCC_PORTABLE_H */
Change RemoveFileAsRoot to RemoveFile per change in FileIO.
#pragma once #include <gtest/gtest.h> #include <FileIO.h> #include <czmq.h> class NotifierTest : public ::testing::Test { public: NotifierTest() { }; ~NotifierTest() { } protected: virtual void SetUp() { }; virtual void TearDown() { FileIO::RemoveFileAsRoot(notifierIPCPath); FileIO::RemoveFileAsRoot(handshakeIPCPath); zctx_interrupted = false; }; private: const std::string notifierIPCPath = "/tmp/RestartServicesQueue.ipc"; const std::string handshakeIPCPath = "/tmp/RestartServicesHandshakeQueue.ipc"; };
#pragma once #include <gtest/gtest.h> #include <FileIO.h> #include <czmq.h> class NotifierTest : public ::testing::Test { public: NotifierTest() { }; ~NotifierTest() { } protected: virtual void SetUp() { }; virtual void TearDown() { FileIO::RemoveFile(notifierIPCPath); FileIO::RemoveFile(handshakeIPCPath); zctx_interrupted = false; }; private: const std::string notifierIPCPath = "/tmp/RestartServicesQueue.ipc"; const std::string handshakeIPCPath = "/tmp/RestartServicesHandshakeQueue.ipc"; };
Introduce inline assembly parsing test is PR30372.
// REQUIRES: x86-registered-target // RUN: %clang_cc1 %s -triple i386-pc-windows-msvc18.0.0 -disable-free -fms-volatile -fms-extensions -fms-compatibility -fms-compatibility-version=18 -std=c++11 -x c++ // Check that the parser catching an 'error' from forward declaration of "location" does not lexer out it's subsequent declation. void foo() { __asm { jl location location: ret } }
Adjust dutch connection lost message.
#include "num2words.h" // Language strings for Dutch const Language LANG_DUTCH = { .hours = { "een", "twee", "drie", "vier", "vijf", "zes", "zeven", "acht", "negen", "tien", "elf", "twaalf" }, .phrases = { "*$1 uur ", "vijf over *$1 ", "tien over *$1 ", "kwart over *$1 ", "tien voor half *$2 ", "vijf voor half *$2 ", "half *$2 ", "vijf over half *$2 ", "tien over half *$2 ", "kwart voor *$2 ", "tien voor *$2 ", "vijf voor *$2 " }, .greetings = { "Goede- morgen ", "Goede- dag ", "Goede- avond ", "Goede- nacht " }, .connection_lost = "Waar is je telefoon" };
#include "num2words.h" // Language strings for Dutch const Language LANG_DUTCH = { .hours = { "een", "twee", "drie", "vier", "vijf", "zes", "zeven", "acht", "negen", "tien", "elf", "twaalf" }, .phrases = { "*$1 uur ", "vijf over *$1 ", "tien over *$1 ", "kwart over *$1 ", "tien voor half *$2 ", "vijf voor half *$2 ", "half *$2 ", "vijf over half *$2 ", "tien over half *$2 ", "kwart voor *$2 ", "tien voor *$2 ", "vijf voor *$2 " }, .greetings = { "Goede- morgen ", "Goede- dag ", "Goede- avond ", "Goede- nacht " }, .connection_lost = "Waar is je tele- foon " };
Allow optional(nullable) parameters to register starflight-client
// // StarFlightPushClient.h // // Created by Starcut Software on 4/30/13. // Copyright (c) Starcut. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN extern NSString *const SCStarFlightClientUUIDNotification; @interface SCStarFlightPushClient : NSObject <NSURLConnectionDelegate> - (instancetype)initWithAppID:(NSString *)appID clientSecret:(NSString *)clientSecret; - (void)registerWithToken:(NSString *)token; - (void)registerWithToken:(NSString *)token clientUUID:(NSString *)clientUUID tags:(NSArray<NSString *> *)tags timePreferences:(NSDictionary *)timePreferencesDict; - (void)registerWithToken:(NSString *)token tags:(NSArray<NSString *> *)tags; - (void)unregisterWithToken:(NSString *)token tags:(nullable NSArray<NSString *> *)tags; - (void)openedMessageWithUUID:(NSString *)messageUUID deviceToken:(NSString *)deviceToken; NS_ASSUME_NONNULL_END @end
// // StarFlightPushClient.h // // Created by Starcut Software on 4/30/13. // Copyright (c) Starcut. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN extern NSString *const SCStarFlightClientUUIDNotification; @interface SCStarFlightPushClient : NSObject <NSURLConnectionDelegate> - (instancetype)initWithAppID:(NSString *)appID clientSecret:(NSString *)clientSecret; - (void)registerWithToken:(NSString *)token; - (void)registerWithToken:(NSString *)token clientUUID:(nullable NSString *)clientUUID tags:(nullable NSArray<NSString *> *)tags timePreferences:(nullable NSDictionary *)timePreferencesDict; - (void)registerWithToken:(NSString *)token tags:(NSArray<NSString *> *)tags; - (void)unregisterWithToken:(NSString *)token tags:(nullable NSArray<NSString *> *)tags; - (void)openedMessageWithUUID:(NSString *)messageUUID deviceToken:(NSString *)deviceToken; NS_ASSUME_NONNULL_END @end
Make `read` wrapper for stdio.h
#include "FILE.h" extern _Thread_local int errno; ptrdiff_t __read(int, void*, size_t); size_t __stdio_read(void* restrict buffer, size_t size, FILE stream[restrict static 1]) { ptrdiff_t count = __read(stream->fd, buffer, size); if (count < 0) { stream->state |= _errbit; errno = -count; return 0; } stream->state |= (count < size) * _eofbit; return count; }
Add first version of elf header struct
#ifndef TYPES_H #define TYPES_H struct elf_header { }; #endif
#ifndef TYPES_H #define TYPES_H #define unsigned char ubyte_t #define unsigned int uint_t #define unsigned short int uword_t #define ELF_FORM 1 #define ELF_32 0 #define ELF_64 1 #define ELF_ORG 1 #define END_BIG 0 #define END_LTL 1 struct elf_header { ubyte_t elf_format : 1; ubyte_t elf_format_bit : 1; ubyte_t elf_endianess : 1; ubyte_t elf_version : 1; ubyte_t elf_os : 5; ubyte_t elf_abi ; ubyte_t elf_pad ; ubyte_t elf_type : 2; ubyte_t elf_arch ; ubyte_t elf_ver : 1; uint_t *elf_entry ; uint_t *elf_hdr_off ; uint_t *elf_sct_off ; uint_t elf_flags ; uword_t elf_hdr_size ; uword_t elf_hdrt_entry_size ; uword_t elf_hdrt_entries ; uword_t elf_sct_entry_size ; uword_t elf_sct_entries ; uword_t elf_sct_index ; }; typedef struct elf_header elf_hdr; #endif
Mark state unused in float test
/* * Copyright 2019 Arnaud Gelas <arnaud.gelas@sensefly.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Use the unit test allocators */ #define UNIT_TESTING 1 #include <stdarg.h> #include <stddef.h> #include <setjmp.h> #include <cmocka.h> /* A test case that does check if float is equal. */ static void float_test_success(void **state) { assert_float_equal(0.5f, 1.f / 2.f, 0.000001f); assert_float_not_equal(0.5, 0.499f, 0.000001f); } int main(void) { const struct CMUnitTest tests[] = { cmocka_unit_test(float_test_success), }; return cmocka_run_group_tests(tests, NULL, NULL); }
/* * Copyright 2019 Arnaud Gelas <arnaud.gelas@sensefly.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Use the unit test allocators */ #define UNIT_TESTING 1 #include <stdarg.h> #include <stddef.h> #include <setjmp.h> #include <cmocka.h> /* A test case that does check if float is equal. */ static void float_test_success(void **state) { (void)state; /* unused */ assert_float_equal(0.5f, 1.f / 2.f, 0.000001f); assert_float_not_equal(0.5, 0.499f, 0.000001f); } int main(void) { const struct CMUnitTest tests[] = { cmocka_unit_test(float_test_success), }; return cmocka_run_group_tests(tests, NULL, NULL); }
Fix soft-reset for some platforms
/* * arch/arm/mach-orion5x/include/mach/system.h * * Tzachi Perelstein <tzachi@marvell.com> * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H #include <mach/bridge-regs.h> static inline void arch_idle(void) { cpu_do_idle(); } static inline void arch_reset(char mode, const char *cmd) { /* * Enable and issue soft reset */ orion5x_setbits(RSTOUTn_MASK, (1 << 2)); orion5x_setbits(CPU_SOFT_RESET, 1); } #endif
/* * arch/arm/mach-orion5x/include/mach/system.h * * Tzachi Perelstein <tzachi@marvell.com> * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H #include <mach/bridge-regs.h> static inline void arch_idle(void) { cpu_do_idle(); } static inline void arch_reset(char mode, const char *cmd) { /* * Enable and issue soft reset */ orion5x_setbits(RSTOUTn_MASK, (1 << 2)); orion5x_setbits(CPU_SOFT_RESET, 1); mdelay(200); orion5x_clrbits(CPU_SOFT_RESET, 1); } #endif
Make the declaration of bzero match size_t on x86-64-linux.
// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memset | count 3 void *memset(void*, int, long); void bzero(void*, int); void test(int* X, char *Y) { memset(X, 4, 1000); bzero(Y, 100); }
// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memset | count 3 void *memset(void*, int, long); void bzero(void*, long); void test(int* X, char *Y) { memset(X, 4, 1000); bzero(Y, 100); }
Modify arduino hab help menu.
#include "sim-hab.h" // // display usage // void usage(void) { fprintf(stderr, "\nsim-hab must be ran with two options. -p and -a both followed\n" "by a file location. To determine the file locations run the\n" "findPort program.\n" "\n" "usage: sim-hab [OPTIONS]\n" " -?, --help Show this information.\n" " -v, --version Show the version number.\n" " -i, --id <ID> Use ID as the HAB-ID (defaults to\n" " hostname if omitted).\n" " -p --proxr <FILE> Give the ProXR file location to open.\n" " -a --arduino <FILE> Give the Arduino file location to open.\n" ); }
#include "sim-hab.h" // // display usage // void usage(void) { fprintf(stderr, "\ncgba-sim-arduino-hab must be ran with one option. -a followed\n" "by a file location.\n" "\n" "usage: cgba-sim-arduino-hab [OPTIONS]\n" " -?, --help Show this information.\n" " -v, --version Show the version number.\n" " -i, --id <ID> Use ID as the HAB-ID (defaults to\n" " hostname if omitted).\n" " -a --arduino <FILE> Give the Arduino file location to open.\n" ); }
Add ES 3.0 support for iPhone
#ifndef _GL_COMMON_H #define _GL_COMMON_H #if defined(USING_GLES2) #ifdef IOS // I guess we can soon add ES 3.0 here too #include <OpenGLES/ES2/gl.h> #include <OpenGLES/ES2/glext.h> #else #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #ifndef MAEMO #include <EGL/egl.h> #endif // !MAEMO #endif // IOS #if defined(ANDROID) || defined(BLACKBERRY) // Support OpenGL ES 3.0 // This uses the "DYNAMIC" approach from the gles3jni NDK sample. // Should work on non-Android mobile platforms too. #include "../gfx_es2/gl3stub.h" #define MAY_HAVE_GLES3 1 #endif #else // OpenGL // Now that glew is upgraded beyond 4.3, we can define MAY_HAVE_GLES3 on GL platforms #define MAY_HAVE_GLES3 1 #include <GL/glew.h> #if defined(__APPLE__) #include <OpenGL/gl.h> #else #include <GL/gl.h> #endif #endif #if !defined(GLchar) && !defined(__APPLE__) typedef char GLchar; #endif #endif //_GL_COMMON_H
#ifndef _GL_COMMON_H #define _GL_COMMON_H #if defined(USING_GLES2) #ifdef IOS #include <OpenGLES/ES3/gl.h> #include <OpenGLES/ES3/glext.h> #include <OpenGLES/ES2/gl.h> #include <OpenGLES/ES2/glext.h> #else #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #ifndef MAEMO #include <EGL/egl.h> #endif // !MAEMO #endif // IOS #if defined(ANDROID) || defined(BLACKBERRY) // Support OpenGL ES 3.0 // This uses the "DYNAMIC" approach from the gles3jni NDK sample. // Should work on non-Android mobile platforms too. #include "../gfx_es2/gl3stub.h" #define MAY_HAVE_GLES3 1 #endif #else // OpenGL // Now that glew is upgraded beyond 4.3, we can define MAY_HAVE_GLES3 on GL platforms #define MAY_HAVE_GLES3 1 #include <GL/glew.h> #if defined(__APPLE__) #include <OpenGL/gl.h> #else #include <GL/gl.h> #endif #endif #if !defined(GLchar) && !defined(__APPLE__) typedef char GLchar; #endif #endif //_GL_COMMON_H
Add label alias for control
#pragma once #include "Control.h" class Label : public Control { public: Label() { } Label(int id, HWND parent) : Control(id, parent) { } };
ADD commented out skip menu
#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #include "GameState.h" #include "StartState.h" #include "LevelSelectState.h" #include <vector> #define START_WITHOUT_MENU class GameStateHandler { private: std::vector<GameState*> m_stateStack; std::vector<GameState*> m_statesToRemove; public: GameStateHandler(); ~GameStateHandler(); int ShutDown(); int Initialize(ComponentHandler* cHandler, Camera* cameraRef, std::string levelPath = NULL); int Update(float dt, InputHandler* inputHandler); //Push a state to the stack int PushStateToStack(GameState* state); private: }; #endif
#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #include "GameState.h" #include "StartState.h" #include "LevelSelectState.h" #include <vector> //#define START_WITHOUT_MENU class GameStateHandler { private: std::vector<GameState*> m_stateStack; std::vector<GameState*> m_statesToRemove; public: GameStateHandler(); ~GameStateHandler(); int ShutDown(); int Initialize(ComponentHandler* cHandler, Camera* cameraRef, std::string levelPath = NULL); int Update(float dt, InputHandler* inputHandler); //Push a state to the stack int PushStateToStack(GameState* state); private: }; #endif
Fix k64f stack overflow during WebUSB flashing
/** * @file tasks.h * @brief Macros for configuring the run time tasks * * DAPLink Interface Firmware * Copyright (c) 2009-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * 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 TASK_H #define TASK_H // trouble here is that reset for different targets is implemented differently so all targets // have to use the largest stack or these have to be defined in multiple places... Not ideal // may want to move away from threads for some of these behaviours to optimize mempory usage (RAM) #define MAIN_TASK_STACK (800) #define MAIN_TASK_PRIORITY (osPriorityNormal) #endif
/** * @file tasks.h * @brief Macros for configuring the run time tasks * * DAPLink Interface Firmware * Copyright (c) 2009-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * 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 TASK_H #define TASK_H // trouble here is that reset for different targets is implemented differently so all targets // have to use the largest stack or these have to be defined in multiple places... Not ideal // may want to move away from threads for some of these behaviours to optimize mempory usage (RAM) #define MAIN_TASK_STACK (864) #define MAIN_TASK_PRIORITY (osPriorityNormal) #endif
Update Skia milestone to 104
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 103 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 104 #endif
Add attribute for unused arguments
#ifndef HL7PARSER_CONFIG_H #define HL7PARSER_CONFIG_H /** * \file config.h * * Generic configuration directives and macros used by the HL7 parser. * * \internal * Copyright (c) 2003-2011 \b Erlar (http://erlar.com) */ /* ------------------------------------------------------------------------ Headers ------------------------------------------------------------------------ */ #include <hl7parser/bool.h> #include <assert.h> /* ------------------------------------------------------------------------ Macros ------------------------------------------------------------------------ */ /* Macros used when the library is included in a C++ project. */ #ifdef __cplusplus # define BEGIN_C_DECL() extern "C" { # define END_C_DECL() } #else # define BEGIN_C_DECL() # define END_C_DECL() #endif /* __cplusplus */ /** * \def HL7_ASSERT( p ) * Asserts that the predicate \a p is true; if not it aborts the program * showing the predicate, file and line number where the assertion failed. */ #define HL7_ASSERT( p ) assert( p ) #endif /* HL7PARSER_CONFIG_H */
#ifndef HL7PARSER_CONFIG_H #define HL7PARSER_CONFIG_H /** * \file config.h * * Generic configuration directives and macros used by the HL7 parser. * * \internal * Copyright (c) 2003-2011 \b Erlar (http://erlar.com) */ /* ------------------------------------------------------------------------ Headers ------------------------------------------------------------------------ */ #include <hl7parser/bool.h> #include <assert.h> /* ------------------------------------------------------------------------ Macros ------------------------------------------------------------------------ */ /* Macros used when the library is included in a C++ project. */ #ifdef __cplusplus # define BEGIN_C_DECL() extern "C" { # define END_C_DECL() } #else # define BEGIN_C_DECL() # define END_C_DECL() #endif /* __cplusplus */ /** * \def HL7_ASSERT( p ) * Asserts that the predicate \a p is true; if not it aborts the program * showing the predicate, file and line number where the assertion failed. */ #define HL7_ASSERT( p ) assert( p ) #ifdef __GNUC__ #define HL7_UNUSED __attribute__ ((__unused__)) #else #define HL7_UNUSED #endif #endif /* HL7PARSER_CONFIG_H */
Replace include stdio with include terminal
#if defined(__linux__) #include <stdio.h> #else #include "../tlibc/stdio/stdio.h" #endif void abort(void) { // TODO: Add proper kernel panic. printf("Kernel Panic! abort()\n"); while ( 1 ) { } }
#include "kputs.c" void abort(void) { // TODO: Add proper kernel panic. kputs("Kernel Panic! abort()\n"); while ( 1 ) { } }
Update method defs for v7
// // APLifecycleHooks.h // LoyaltyRtr // // Created by David Benko on 7/22/14. // Copyright (c) 2014 David Benko. All rights reserved. // #import <Foundation/Foundation.h> @interface APLifecycleHooks : NSObject +(void)setSDKLogging:(BOOL)shouldLog; +(void)synchronousConnectionFinished:(void (^)(NSData *downloadedData, NSError *error))hook; +(void)asyncConnectionStarted:(void (^)(NSURLRequest * req, NSURLConnection *conn))hook; +(void)asyncConnectionFinished:(BOOL (^)(NSMutableData *downloadedData, NSError *error))hook; @end
// // APLifecycleHooks.h // LoyaltyRtr // // Created by David Benko on 7/22/14. // Copyright (c) 2014 David Benko. All rights reserved. // #import <Foundation/Foundation.h> #define __VERBOSE @interface APLifecycleHooks : NSObject + (void)connectionWillStart:(NSURLRequest * (^)(NSURLRequest * req))connectionWillStartCallback didStart:(void (^)(NSURLRequest * req, NSURLConnection *conn))connectionDidStartCallback; + (void)connectionReceievedResponse:(void (^)(NSURLConnection *connection, NSURLResponse *response))connectionReceievedResponseCallback; + (void)checkConnectionResponse:(BOOL (^)(NSURLResponse *response, NSError **error))checkConnectionResponseCallback; + (void)connectionFinished:(BOOL (^)(NSURLResponse *response, NSMutableData *downloadedData, NSError *error))connectionDidFinishCallback; @end
Add some IB support for uiStyle.
// // BRMenuPlusMinusButton.h // Menu // // Created by Matt on 4/17/13. // Copyright (c) 2013 Pervasent Consulting, Inc. All rights reserved. // #import <UIKit/UIKit.h> @class BRMenuUIStyle; IB_DESIGNABLE @interface BRMenuPlusMinusButton : UIControl @property (nonatomic, strong) BRMenuUIStyle *uiStyle; @property (nonatomic, getter = isPlus) IBInspectable BOOL plus; @end
// // BRMenuPlusMinusButton.h // Menu // // Created by Matt on 4/17/13. // Copyright (c) 2013 Pervasent Consulting, Inc. All rights reserved. // #import <UIKit/UIKit.h> @class BRMenuUIStyle; IB_DESIGNABLE @interface BRMenuPlusMinusButton : UIControl @property (nonatomic, strong) IBOutlet BRMenuUIStyle *uiStyle; @property (nonatomic, getter = isPlus) IBInspectable BOOL plus; @end
Remove unused fields in dynamic library writer
//===- lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h -----------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H #define LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H #include "DynamicLibraryWriter.h" #include "ARMLinkingContext.h" #include "ARMTargetHandler.h" namespace lld { namespace elf { class ARMDynamicLibraryWriter : public DynamicLibraryWriter<ELF32LE> { public: ARMDynamicLibraryWriter(ARMLinkingContext &ctx, ARMTargetLayout &layout); protected: // Add any runtime files and their atoms to the output void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override; private: ARMLinkingContext &_ctx; ARMTargetLayout &_armLayout; }; ARMDynamicLibraryWriter::ARMDynamicLibraryWriter(ARMLinkingContext &ctx, ARMTargetLayout &layout) : DynamicLibraryWriter(ctx, layout), _ctx(ctx), _armLayout(layout) {} void ARMDynamicLibraryWriter::createImplicitFiles( std::vector<std::unique_ptr<File>> &result) { DynamicLibraryWriter::createImplicitFiles(result); } } // namespace elf } // namespace lld #endif // LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H
//===- lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h -----------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H #define LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H #include "DynamicLibraryWriter.h" #include "ARMLinkingContext.h" #include "ARMTargetHandler.h" namespace lld { namespace elf { class ARMDynamicLibraryWriter : public DynamicLibraryWriter<ELF32LE> { public: ARMDynamicLibraryWriter(ARMLinkingContext &ctx, ARMTargetLayout &layout); protected: // Add any runtime files and their atoms to the output void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override; }; ARMDynamicLibraryWriter::ARMDynamicLibraryWriter(ARMLinkingContext &ctx, ARMTargetLayout &layout) : DynamicLibraryWriter(ctx, layout) {} void ARMDynamicLibraryWriter::createImplicitFiles( std::vector<std::unique_ptr<File>> &result) { DynamicLibraryWriter::createImplicitFiles(result); } } // namespace elf } // namespace lld #endif // LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H
Change memory exception to MemoryError
/* * This file is part of the OpenMV project. * Copyright (c) 2013/2014 Ibrahim Abdelkader <i.abdalkader@gmail.com> * This work is licensed under the MIT license, see the file LICENSE for details. * * Memory allocation functions. * */ #include <mp.h> #include "mdefs.h" #include "xalloc.h" void *xalloc_fail() { nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Out of Memory!!")); return NULL; } void *xalloc(uint32_t size) { void *mem = gc_alloc(size, false); if (mem == NULL) { return xalloc_fail(); } return mem; } void *xalloc0(uint32_t size) { void *mem = gc_alloc(size, false); if (mem == NULL) { return xalloc_fail(); } memset(mem, 0, size); return mem; } void xfree(void *ptr) { gc_free(ptr); } void *xrealloc(void *ptr, uint32_t size) { ptr = gc_realloc(ptr, size); if (ptr == NULL) { return xalloc_fail(); } return ptr; }
/* * This file is part of the OpenMV project. * Copyright (c) 2013/2014 Ibrahim Abdelkader <i.abdalkader@gmail.com> * This work is licensed under the MIT license, see the file LICENSE for details. * * Memory allocation functions. * */ #include <mp.h> #include "mdefs.h" #include "xalloc.h" void *xalloc_fail() { nlr_raise(mp_obj_new_exception_msg(&mp_type_MemoryError, "Out of Memory!!")); return NULL; } void *xalloc(uint32_t size) { void *mem = gc_alloc(size, false); if (mem == NULL) { return xalloc_fail(); } return mem; } void *xalloc0(uint32_t size) { void *mem = gc_alloc(size, false); if (mem == NULL) { return xalloc_fail(); } memset(mem, 0, size); return mem; } void xfree(void *ptr) { gc_free(ptr); } void *xrealloc(void *ptr, uint32_t size) { ptr = gc_realloc(ptr, size); if (ptr == NULL) { return xalloc_fail(); } return ptr; }
Update include psa_defs -> psa/client
/* * Copyright (c) 2018-2019 ARM Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * * 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 __TFM_CLIENT_H__ #define __TFM_CLIENT_H__ #include "psa_defs.h" #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* __TFM_CLIENT_H__ */
/* * Copyright (c) 2018-2019 ARM Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * * 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 __TFM_CLIENT_H__ #define __TFM_CLIENT_H__ #include "psa/client.h" #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* __TFM_CLIENT_H__ */