Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Reduce the number of windows specific includes in AVFS
#include "assertive.h" #include <VSScript.h> #include <VapourSynth.h> #include <VSHelper.h> #include <climits> #include <cstdint> #include <cstdarg> #include <cstring> #include <cstdlib> #include <wchar.h> #include <cstdio> #include <algorithm> #include <new> #include <codecvt> #include <string> #include <fstream> #include <vector> #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX #include <windows.h> #include <vfw.h> #include <aviriff.h> #include "ss.h" #pragma warning(disable: 4244) // size conversion warning #pragma warning(disable: 4245) // sign conversion warning #include "avisynth.h" #pragma warning(default: 4244) #pragma warning(default: 4245) #include "avfspfm.h" #include "xxfs.h" #include "avfs.h" #include "vsfs.h" #include "videoinfoadapter.h" #include "../common/p2p_api.h" #include "../common/fourcc.h"
#include "assertive.h" #include <VSScript.h> #include <VapourSynth.h> #include <VSHelper.h> #include <climits> #include <cstdint> #include <cstdarg> #include <cstring> #include <cstdlib> #include <wchar.h> #include <cstdio> #include <algorithm> #include <new> #include <codecvt> #include <string> #include <fstream> #include <vector> #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX #include <windows.h> #include "ss.h" #pragma warning(disable: 4244) // size conversion warning #pragma warning(disable: 4245) // sign conversion warning #include "avisynth.h" #pragma warning(default: 4244) #pragma warning(default: 4245) #include "avfspfm.h" #include "xxfs.h" #include "avfs.h" #include "vsfs.h" #include "videoinfoadapter.h" #include "../common/p2p_api.h" #include "../common/fourcc.h" // Common vfw defines #define WAVE_FORMAT_PCM 1 #define WAVE_FORMAT_IEEE_FLOAT 0x0003
Allow run_command to be accessed from other files
#ifndef UTIL_H #define UTIL_H void set_verbose_on(); void set_debug_on(); void error(const char * fmt, ...); void verbose(const char * fmt, ...); void debug(const char * fmt, ...); #endif
#ifndef UTIL_H #define UTIL_H void set_verbose_on(); void set_debug_on(); void error(const char * fmt, ...); void verbose(const char * fmt, ...); void debug(const char * fmt, ...); void run_command(char * const argv[]); #endif
Merge two sorted lists - recursive
#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { int data; struct node *next; }; struct node *createNode (int value) { struct node *newNode = (struct node *) malloc (sizeof (struct node)); newNode -> data = value; newNode -> next = NULL; return newNode; } void insertNode (struct node **head_ref, struct node **tail_ref, int value) { struct node *newNode = createNode (value); if (*head_ref == NULL) { *head_ref = newNode; *tail_ref = newNode; } else { (*tail_ref) -> next = newNode; *tail_ref = newNode; } } void printList (struct node *head) { while (head != NULL) { printf ("%d -> ", head->data); head = head->next; } printf ("NULL\n"); } void destroyList (struct node *head) { struct node *nextNode = head; while (head != NULL) { nextNode = head -> next; free (head); head = nextNode; } printf("Killed off all her feelings\n" ); } struct node *mergeTwoSortedRecursive (struct node *head1, struct node *head2) { if (head1 == NULL) { return head2; } if (head2 == NULL) { return head1; } if (head1->data < head2->data) { head1->next = mergeTwoSortedRecursive (head1->next, head2); return head1; } else { head2->next = mergeTwoSortedRecursive (head1, head2->next); return head2; } } int main (int argc, char *argv[]) { int value; struct node *head1 = NULL; struct node *tail1 = NULL; struct node *head2 = NULL; struct node *tail2 = NULL; struct node *resultHead = NULL; char buffer[2048]; char *p = NULL; fgets (buffer, 2048, stdin); p = strtok (buffer, "NULL > | \n"); while (p != NULL) { sscanf (p, "%d", &value); insertNode (&head1, &tail1, value); p = strtok (NULL, "NULL null | > \n"); } fgets (buffer, 2048, stdin); p = strtok (buffer, "NULL > | \n"); while (p != NULL) { sscanf (p, "%d", &value); insertNode (&head2, &tail2, value); p = strtok (NULL, "NULL null | > \n"); } printList (head1); printList (head2); resultHead = mergeTwoSortedRecursive (head1, head2); printList (resultHead); destroyList (resultHead); head1 = NULL; tail1 = NULL; head2 = NULL; tail2 = NULL; return 0; }
Add specific headers for used symbols in Body
#ifndef CPR_BODY_H #define CPR_BODY_H #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
#ifndef CPR_BODY_H #define CPR_BODY_H #include <cstring> #include <initializer_list> #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
Add description to QSJsonListModel in source file.
#pragma once #include <QObject> #include <QQmlParserStatus> #include "qslistmodel.h" class QSJsonListModel : public QSListModel, public QQmlParserStatus { Q_OBJECT Q_PROPERTY(QString keyField READ keyField WRITE setKeyField NOTIFY keyFieldChanged) Q_PROPERTY(QVariantList source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QStringList fields READ fields WRITE setFields NOTIFY fieldsChanged) Q_INTERFACES(QQmlParserStatus) public: explicit QSJsonListModel(QObject *parent = 0); QString keyField() const; void setKeyField(const QString &keyField); QVariantList source() const; void setSource(const QVariantList &source); QStringList fields() const; void setFields(const QStringList &roleNames); signals: void keyFieldChanged(); void sourceChanged(); void fieldsChanged(); public slots: protected: virtual void classBegin(); virtual void componentComplete(); private: void sync(); QString m_keyField; QVariantList m_source; QStringList m_fields; bool componentCompleted; };
#pragma once #include <QObject> #include <QQmlParserStatus> #include "qslistmodel.h" /* QSJsonListModel is a data model that combine QSListModel and QSDiffRunner * into a single class. It may take a Javascript array object as source input, * it will compare with previous input then update the model according to * the diff. */ class QSJsonListModel : public QSListModel, public QQmlParserStatus { Q_OBJECT Q_PROPERTY(QString keyField READ keyField WRITE setKeyField NOTIFY keyFieldChanged) Q_PROPERTY(QVariantList source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QStringList fields READ fields WRITE setFields NOTIFY fieldsChanged) Q_INTERFACES(QQmlParserStatus) public: explicit QSJsonListModel(QObject *parent = 0); QString keyField() const; void setKeyField(const QString &keyField); QVariantList source() const; void setSource(const QVariantList &source); QStringList fields() const; void setFields(const QStringList &roleNames); signals: void keyFieldChanged(); void sourceChanged(); void fieldsChanged(); public slots: protected: virtual void classBegin(); virtual void componentComplete(); private: void sync(); QString m_keyField; QVariantList m_source; QStringList m_fields; bool componentCompleted; };
Add missing header (for SCSP)
/* * Copyright (c) 2012-2014 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #ifndef _LIBYAUL_H_ #define _LIBYAUL_H_ /* CPU */ #include <cpu.h> /* SCU */ #include <scu.h> /* CS0 */ #include <arp.h> #include <dram-cartridge.h> #include <usb-cartridge.h> /* CS2 */ #include <cd-block.h> /* VDP1 */ #include <vdp1.h> /* VDP2 */ #include <vdp2.h> /* SMPC */ #include <smpc.h> /* Kernel */ #include <common.h> #include <irq-mux.h> #include <cons.h> #include <fs/iso9660/iso9660.h> #include <fs/romdisk/romdisk.h> #include <gdb.h> #endif /* !_LIBYAUL_H_ */
/* * Copyright (c) 2012-2014 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #ifndef _LIBYAUL_H_ #define _LIBYAUL_H_ /* CPU-bus CPU */ #include <cpu.h> /* CPU-bus SMPC */ #include <smpc.h> /* SCU */ #include <scu.h> /* CS0 */ #include <arp.h> #include <dram-cartridge.h> #include <usb-cartridge.h> /* CS2 */ #include <cd-block.h> /* B-bus VDP1 */ #include <vdp1.h> /* B-bus VDP2 */ #include <vdp2.h> /* B-bus SCSP */ #include <scsp.h> /* Kernel */ #include <common.h> #include <irq-mux.h> #include <cons.h> #include <fs/iso9660/iso9660.h> #include <fs/romdisk/romdisk.h> #include <gdb.h> #endif /* !_LIBYAUL_H_ */
Add header guard to prevent multiple inclusion errors
#include <iostream> // An IPv4 address has the following form: // "A.B.C.D", where A, B, C and D are bytes class IPAddress { public: IPAddress (unsigned char a = 0, unsigned char b = 0, unsigned char c = 0, unsigned char d = 0); IPAddress operator& (const IPAddress& addr) const; IPAddress operator| (const IPAddress& addr) const; IPAddress operator~ () const; bool operator== (const IPAddress& addr) const; bool operator!= (const IPAddress& addr) const; friend std::ostream& operator<< (std::ostream& os, const IPAddress& addr); friend std::istream& operator>> (std::istream& is, IPAddress& addr); void setAddress (unsigned char a, unsigned char b, unsigned char c, unsigned char d); private: unsigned char m_a; unsigned char m_b; unsigned char m_c; unsigned char m_d; };
#ifndef _IP_ADDRESS_H_ #define _IP_ADDRESS_H_ #include <iostream> // An IPv4 address has the following form: // "A.B.C.D", where A, B, C and D are bytes class IPAddress { public: IPAddress (unsigned char a = 0, unsigned char b = 0, unsigned char c = 0, unsigned char d = 0); IPAddress operator& (const IPAddress& addr) const; IPAddress operator| (const IPAddress& addr) const; IPAddress operator~ () const; bool operator== (const IPAddress& addr) const; bool operator!= (const IPAddress& addr) const; friend std::ostream& operator<< (std::ostream& os, const IPAddress& addr); friend std::istream& operator>> (std::istream& is, IPAddress& addr); void setAddress (unsigned char a, unsigned char b, unsigned char c, unsigned char d); private: unsigned char m_a; unsigned char m_b; unsigned char m_c; unsigned char m_d; }; #endif // _IPADDRESS_H_
Use of linear probing and the same hash function as other libraries
#include "../common.c" #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) { return k == (unsigned int)n; } static inline void oor_set(unsigned int *k, unsigned char n) { *k = (unsigned int)n; } DICT_OA_DEF2(dict_oa_uint, unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) uint32_t test_int(uint32_t n, uint32_t x0) { uint32_t i, x, z = 0; dict_oa_uint_t h; dict_oa_uint_init(h); for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); unsigned int *ptr = dict_oa_uint_get_at(h, key); (*ptr)++; z += *ptr; } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); z = dict_oa_uint_size(h); dict_oa_uint_clear(h); return z; }
#include "../common.c" #define DICTI_OA_PROBING(s) 1 #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) { return k == (unsigned int)n; } static inline void oor_set(unsigned int *k, unsigned char n) { *k = (unsigned int)n; } DICT_OA_DEF2(dict_oa_uint, unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, HASH(hash_fn), OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) uint32_t test_int(uint32_t n, uint32_t x0) { uint32_t i, x, z = 0; dict_oa_uint_t h; dict_oa_uint_init(h); for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); unsigned int *ptr = dict_oa_uint_get_at(h, key); (*ptr)++; z += *ptr; } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); z = dict_oa_uint_size(h); dict_oa_uint_clear(h); return z; }
Fix formatting. (Really ??? 3 lines for something that can fit on one ?)
#include "e.h" /* local subsystem functions */ /* local subsystem globals */ /* externally accessible functions */ EAPI void e_error_message_show_internal(char *txt) { /* FIXME: maybe log these to a file and display them at some point */ printf("<<<< Enlightenment Error >>>>\n" "%s\n", txt); } /* local subsystem functions */
#include "e.h" /* local subsystem functions */ /* local subsystem globals */ /* externally accessible functions */ EAPI void e_error_message_show_internal(char *txt) { /* FIXME: maybe log these to a file and display them at some point */ printf("<<<< Enlightenment Error >>>>\n%s\n", txt); } /* local subsystem functions */
Change BOOL to BOOL_T to avoid confilct with "condor_expr.h".
#ifndef CONSTANTS_H #define CONSTANTS_H #if !defined(__STDC__) && !defined(__cplusplus) #define const #endif /* Set up a boolean variable type. Since this definition could conflict with other reasonable definition of BOOLEAN, i.e. using an enumeration, it is conditional. */ #ifndef BOOLEAN_TYPE_DEFINED typedef int BOOLEAN; typedef int BOOL; #endif #if defined(TRUE) # undef TRUE # undef FALSE #endif static const int TRUE = 1; static const int FALSE = 0; /* Useful constants for turning seconds into larger units of time. Since these constants may have already been defined elsewhere, they are conditional. */ #ifndef TIME_CONSTANTS_DEFINED static const int MINUTE = 60; static const int HOUR = 60 * 60; static const int DAY = 24 * 60 * 60; #endif /* This is for use with strcmp() and related functions which will return 0 upon a match. */ #ifndef MATCH static const int MATCH = 0; #endif #endif
#ifndef CONSTANTS_H #define CONSTANTS_H #if !defined(__STDC__) && !defined(__cplusplus) #define const #endif /* Set up a boolean variable type. Since this definition could conflict with other reasonable definition of BOOLEAN, i.e. using an enumeration, it is conditional. */ #ifndef BOOLEAN_TYPE_DEFINED typedef int BOOLEAN; typedef int BOOL_T; #endif #if defined(TRUE) # undef TRUE # undef FALSE #endif static const int TRUE = 1; static const int FALSE = 0; /* Useful constants for turning seconds into larger units of time. Since these constants may have already been defined elsewhere, they are conditional. */ #ifndef TIME_CONSTANTS_DEFINED static const int MINUTE = 60; static const int HOUR = 60 * 60; static const int DAY = 24 * 60 * 60; #endif /* This is for use with strcmp() and related functions which will return 0 upon a match. */ #ifndef MATCH static const int MATCH = 0; #endif #endif
Fix build error with old kernel headers
#include <alsa/sound/uapi/asound.h>
/* workaround for building with old glibc / kernel headers */ #ifdef __linux__ #include <linux/types.h> #else #include <sys/types.h> #endif #ifndef __kernel_long_t #define __kernel_long_t long #endif #include <alsa/sound/uapi/asound.h>
UPDATE default start without 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); 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); int Update(float dt, InputHandler* inputHandler); //Push a state to the stack int PushStateToStack(GameState* state); private: }; #endif
Change our PATH_START to 11000
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BROWSER_BRIGHTRAY_PATHS_H_ #define BROWSER_BRIGHTRAY_PATHS_H_ #include "base/compiler_specific.h" #if defined(OS_WIN) #include "base/base_paths_win.h" #elif defined(OS_MACOSX) #include "base/base_paths_mac.h" #endif #if defined(OS_POSIX) #include "base/base_paths_posix.h" #endif namespace brightray { enum { PATH_START = 1000, DIR_USER_DATA = PATH_START, // Directory where user data can be written. DIR_USER_CACHE, // Directory where user cache can be written. #if defined(OS_LINUX) DIR_APP_DATA, // Application Data directory under the user profile. #else DIR_APP_DATA = base::DIR_APP_DATA, #endif #if defined(OS_POSIX) DIR_CACHE = base::DIR_CACHE, // Directory where to put cache data. #else DIR_CACHE = base::DIR_APP_DATA, #endif PATH_END }; } // namespace brightray #endif // BROWSER_BRIGHTRAY_PATHS_H_
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BROWSER_BRIGHTRAY_PATHS_H_ #define BROWSER_BRIGHTRAY_PATHS_H_ #include "base/compiler_specific.h" #if defined(OS_WIN) #include "base/base_paths_win.h" #elif defined(OS_MACOSX) #include "base/base_paths_mac.h" #endif #if defined(OS_POSIX) #include "base/base_paths_posix.h" #endif namespace brightray { enum { PATH_START = 11000, DIR_USER_DATA = PATH_START, // Directory where user data can be written. DIR_USER_CACHE, // Directory where user cache can be written. #if defined(OS_LINUX) DIR_APP_DATA, // Application Data directory under the user profile. #else DIR_APP_DATA = base::DIR_APP_DATA, #endif #if defined(OS_POSIX) DIR_CACHE = base::DIR_CACHE, // Directory where to put cache data. #else DIR_CACHE = base::DIR_APP_DATA, #endif PATH_END }; } // namespace brightray #endif // BROWSER_BRIGHTRAY_PATHS_H_
Add todo because comment is wrong.
/* * A sphere which can be added * Author: Dino Wernli */ #ifndef SPHERE_H_ #define SPHERE_H_ #include "scene/element.h" #include "util/point3.h" #include "util/random.h" class Material; class Sphere : public Element { public: // Does not take ownership of material. Sphere(const Point3& center, Scalar radius, const Material& material); virtual ~Sphere(); virtual bool Intersect(const Ray& ray, IntersectionData* data = NULL) const; // Returns a uniformly distributed random point on the surface of the sphere. // This guarantees that "point" is visible from the returned point. Point3 Sample(const Point3& point) const; private: Point3 center_; Scalar radius_; static Random random_; }; #endif /* SPHERE_H_ */
/* * A sphere which can be added * Author: Dino Wernli */ #ifndef SPHERE_H_ #define SPHERE_H_ #include "scene/element.h" #include "util/point3.h" #include "util/random.h" class Material; class Sphere : public Element { public: // Does not take ownership of material. Sphere(const Point3& center, Scalar radius, const Material& material); virtual ~Sphere(); virtual bool Intersect(const Ray& ray, IntersectionData* data = NULL) const; // Returns a uniformly distributed random point on the surface of the sphere. // This guarantees that "point" is visible from the returned point. // TODO(dinow): This is not true, replace this my a method taking a normal. Point3 Sample(const Point3& point) const; private: Point3 center_; Scalar radius_; static Random random_; }; #endif /* SPHERE_H_ */
Add binary sample (add missing file)
#include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) { unsigned int i; unsigned int a; unsigned int l; if (argc != 2) { printf("Usage: %s <iterations>\n", argv[0]); exit(-1); } l = (unsigned int) atoi(argv[1]); for (i = 0; i < l; i++) { a++; } printf("Finished!\n"); return 0; }
Add macros for page aligning
/* * Copyright (c) 2012 Rob Hoelz <rob at hoelz.ro> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef ROSE_MEMORY_H #define ROSE_MEMORY_H void memory_init_gdt(void); void memory_init_paging(void *kernel_start, void *kernel_end); #endif
/* * Copyright (c) 2012 Rob Hoelz <rob at hoelz.ro> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef ROSE_MEMORY_H #define ROSE_MEMORY_H void memory_init_gdt(void); void memory_init_paging(void *kernel_start, void *kernel_end); #define MEMORY_PAGE_ALIGN(addr)\ ((void *) (((long)addr) & ~0xFFF)) #define MEMORY_IS_PAGE_ALIGNED(addr)\ ((((long)addr) & 0xFFF) == 0) #endif
Add PipePairSimple which allows a user to simply construct a single object which implements a PipePair.
#ifndef IO_PIPE_PAIR_SIMPLE_H #define IO_PIPE_PAIR_SIMPLE_H #include <io/pipe_simple.h> #include <io/pipe_simple_wrapper.h> class PipePairSimple : public PipePair { PipeSimpleWrapper<PipePairSimple> *incoming_pipe_; PipeSimpleWrapper<PipePairSimple> *outgoing_pipe_; protected: PipePairSimple(void) : incoming_pipe_(NULL), outgoing_pipe_(NULL) { } public: virtual ~PipePairSimple() { if (incoming_pipe_ != NULL) { delete incoming_pipe_; incoming_pipe_ = NULL; } if (outgoing_pipe_ != NULL) { delete outgoing_pipe_; outgoing_pipe_ = NULL; } } protected: virtual bool incoming_process(Buffer *, Buffer *) = 0; virtual bool outgoing_process(Buffer *, Buffer *) = 0; public: Pipe *get_incoming(void) { ASSERT(incoming_pipe_ == NULL); incoming_pipe_ = new PipeSimpleWrapper<PipePairSimple>(this, &PipePairSimple::incoming_process); return (incoming_pipe_); } Pipe *get_outgoing(void) { ASSERT(outgoing_pipe_ == NULL); outgoing_pipe_ = new PipeSimpleWrapper<PipePairSimple>(this, &PipePairSimple::outgoing_process); return (outgoing_pipe_); } }; #endif /* !IO_PIPE_PAIR_SIMPLE_H */
Fix the new buffer macros by ensuring macro arguments are evaluated first.
// // RXBufferMacros.h // rivenx // #if !defined(RX_BUFFER_MACROS_H) #define RX_BUFFER_MACROS_H #define BUFFER_OFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)buffer + (bytes)) #define BUFFER_NOFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)buffer - (bytes)) #define BUFFER_ADD_OFFSET(buffer, bytes) (buffer) = BUFFER_OFFSET((buffer), (bytes)) #define BUFFER_DELTA(head_ptr, read_ptr) ((size_t)(((uintptr_t)read_ptr) - ((uintptr_t)head_ptr))) #define BUFFER_ALIGN(buffer, a) (__typeof__(buffer))(((uintptr_t)(buffer) + (a-1ul)) & ~(a-1ul)) #define BUFFER_ALIGN_SIZE(buffer, a) (size_t)((uintptr_t)BUFFER_ALIGN((buffer), a) - (uintptr_t)(buffer)) #define BUFFER_ALIGN2(buffer) BUFFER_ALIGN(buffer, 2ul) #define BUFFER_ALIGN4(buffer) BUFFER_ALIGN(buffer, 4ul) #define BUFFER_ALIGN8(buffer) BUFFER_ALIGN(buffer, 8ul) #define BUFFER_ALIGN16(buffer) BUFFER_ALIGN(buffer, 16ul) #endif // RX_BUFFER_MACROS_H
// // RXBufferMacros.h // rivenx // #if !defined(RX_BUFFER_MACROS_H) #define RX_BUFFER_MACROS_H #define BUFFER_OFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)(buffer) + (bytes)) #define BUFFER_NOFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)(buffer) - (bytes)) #define BUFFER_ADD_OFFSET(buffer, bytes) (buffer) = BUFFER_OFFSET((buffer), (bytes)) #define BUFFER_DELTA(head_ptr, read_ptr) ((size_t)(((uintptr_t)(read_ptr)) - ((uintptr_t)(head_ptr)))) #define BUFFER_ALIGN(buffer, a) (__typeof__(buffer))(((uintptr_t)(buffer) + (a-1ul)) & ~(a-1ul)) #define BUFFER_ALIGN_SIZE(buffer, a) (size_t)((uintptr_t)BUFFER_ALIGN((buffer), (a)) - (uintptr_t)(buffer)) #define BUFFER_ALIGN2(buffer) BUFFER_ALIGN(buffer, 2ul) #define BUFFER_ALIGN4(buffer) BUFFER_ALIGN(buffer, 4ul) #define BUFFER_ALIGN8(buffer) BUFFER_ALIGN(buffer, 8ul) #define BUFFER_ALIGN16(buffer) BUFFER_ALIGN(buffer, 16ul) #endif // RX_BUFFER_MACROS_H
Add command to reload property configuration
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2012 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <kotaka/paths.h> #include <text/paths.h> inherit LIB_RAWVERB; void main(object actor, string args) { object user; object *users; int i, sz; user = query_user(); if (user->query_class() < 3) { send_out("You do not have sufficient access rights to reload properties.\n"); return; } "~Game/initd"->configure_properties(); }
Fix build break on WIN32
//----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. #ifndef _MURMURHASH3_H_ #define _MURMURHASH3_H_ //----------------------------------------------------------------------------- // Platform-specific functions and macros // Microsoft Visual Studio #if defined(_MSC_VER) typedef unsigned char uint8_t; typedef unsigned long uint32_t; typedef unsigned __int64 uint64_t; // Other compilers #else // defined(_MSC_VER) #include <stdint.h> #endif // !defined(_MSC_VER) //----------------------------------------------------------------------------- void MurmurHash3_x86_32 (const void * key, int len, uint32_t seed, void * out); /** * The following 2 functions have been altered to just return the * 64 most significant bits. */ void MurmurHash3_x86_128 (const void * key, int len, uint32_t seed, void * out); void MurmurHash3_x64_128 (const void * key, int len, uint32_t seed, void * out); //----------------------------------------------------------------------------- #endif // _MURMURHASH3_H_
//----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. #ifndef _MURMURHASH3_H_ #define _MURMURHASH3_H_ //----------------------------------------------------------------------------- // Platform-specific functions and macros #include <stdint.h> //----------------------------------------------------------------------------- void MurmurHash3_x86_32 (const void * key, int len, uint32_t seed, void * out); /** * The following 2 functions have been altered to just return the * 64 most significant bits. */ void MurmurHash3_x86_128 (const void * key, int len, uint32_t seed, void * out); void MurmurHash3_x64_128 (const void * key, int len, uint32_t seed, void * out); //----------------------------------------------------------------------------- #endif // _MURMURHASH3_H_
Add alignment for 'vfork' task resource
/** * @file res_vfork.c * @brief Task resource for vfork * @date May 16, 2014 * @author Anton Bondarev */ #include <stddef.h> #include <setjmp.h> #include <kernel/task.h> #include <kernel/task/resource.h> #include <kernel/task/resource/task_vfork.h> TASK_RESOURCE_DEF(task_vfork_desc, struct task_vfork); static void task_vfork_init(const struct task *task, void *vfork_buff) { task_vfork_end((struct task *)task); } static int task_vfork_inherit(const struct task *task, const struct task *parent) { return 0; } static size_t task_vfork_offset; static const struct task_resource_desc task_vfork_desc = { .init = task_vfork_init, .inherit = task_vfork_inherit, .resource_size = sizeof(struct task_vfork), .resource_offset = &task_vfork_offset }; struct task_vfork *task_resource_vfork(const struct task *task) { assert(task != NULL); return (void *)task->resources + task_vfork_offset; }
/** * @file res_vfork.c * @brief Task resource for vfork * @date May 16, 2014 * @author Anton Bondarev */ #include <stddef.h> #include <setjmp.h> #include <util/binalign.h> #include <kernel/task.h> #include <kernel/task/resource.h> #include <kernel/task/resource/task_vfork.h> TASK_RESOURCE_DEF(task_vfork_desc, struct task_vfork); static void task_vfork_init(const struct task *task, void *vfork_buff) { task_vfork_end((struct task *)task); } static int task_vfork_inherit(const struct task *task, const struct task *parent) { return 0; } static size_t task_vfork_offset; static const struct task_resource_desc task_vfork_desc = { .init = task_vfork_init, .inherit = task_vfork_inherit, .resource_size = sizeof(struct task_vfork), .resource_offset = &task_vfork_offset, }; struct task_vfork *task_resource_vfork(const struct task *task) { size_t offset; assert(task != NULL); offset = (size_t)((void *)task->resources + task_vfork_offset); #ifdef PT_REGS_ALIGN return (void *)binalign_bound(offset, PT_REGS_ALIGN); #else return (void *)offset; #endif }
Fix expected warning after r313945.
// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only #if !__has_attribute(noescape) # error "missing noescape attribute" #endif int *global_var __attribute((noescape)); // expected-warning{{'noescape' attribute only applies to parameters}} void foo(__attribute__((noescape)) int *int_ptr, __attribute__((noescape)) int (^block)(int), __attribute((noescape)) int integer) { // expected-warning{{'noescape' attribute ignored on parameter of non-pointer type 'int'}} }
// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only #if !__has_attribute(noescape) # error "missing noescape attribute" #endif int *global_var __attribute((noescape)); // expected-warning{{'noescape' attribute only applies to parameters}} void foo(__attribute__((noescape)) int *int_ptr, __attribute__((noescape)) int (^block)(int), __attribute((noescape)) int integer) { // expected-warning{{'noescape' attribute only applies to pointer arguments}} }
Remove unused imports from the swift bridging header
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "UIViewController+FullScreenLoading.h" #import "ArtsyAPI+Sales.h" #import "ARScrollNavigationChief.h" #import "ARWhitespaceGobbler.h" #import "ARCountdownView.h" #import "UIView+HitTestExpansion.h" #import "ARSeparatorViews.h" #import "ArtsyAPI+CurrentUserFunctions.h" // Perhaps in the future we could use https://github.com/orta/ar_dispatch/ for now though eigen does more than this lib #import "ARDispatchManager.h" // Models. #import "Sale.h" #import "Artwork.h" #import "AREmbeddedModelsViewController.h" #import "ARArtworkMasonryModule.h" #import "UIViewController+SimpleChildren.h" #import "UIViewController+ARUserActivity.h" // For building out Auction Information VC #import "ARNavigationButtonsViewController.h" #import "ARNavigationButton.h" #import "ARSerifNavigationViewController.h" #import "ARTextView.h" #import "ARThemedFactory.h" #import "ARFonts.h" // Temporary for building out auctionVC #import "ARArtistNetworkModel.h" #import "ARGeneArtworksNetworkModel.h" // Libraries #import <Aerodramus/Aerodramus.h>
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "UIViewController+FullScreenLoading.h" #import "ArtsyAPI+Sales.h" #import "ARScrollNavigationChief.h" #import "ARWhitespaceGobbler.h" #import "ARCountdownView.h" #import "UIView+HitTestExpansion.h" #import "ARSeparatorViews.h" #import "ArtsyAPI+CurrentUserFunctions.h" // Perhaps in the future we could use https://github.com/orta/ar_dispatch/ for now though eigen does more than this lib #import "ARDispatchManager.h" // Models. #import "Sale.h" #import "Artwork.h" #import "AREmbeddedModelsViewController.h" #import "ARArtworkMasonryModule.h" #import "UIViewController+SimpleChildren.h" #import "UIViewController+ARUserActivity.h" // For building out Auction Information VC #import "ARNavigationButtonsViewController.h" #import "ARNavigationButton.h" #import "ARSerifNavigationViewController.h" #import "ARTextView.h" #import "ARFonts.h" // Temporary for building out auctionVC #import "ARArtistNetworkModel.h" #import "ARGeneArtworksNetworkModel.h"
Remove selection of preprocessor macros as globals in the linkdef
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class TLDAPServer; #pragma link C++ class TLDAPResult; #pragma link C++ class TLDAPEntry; #pragma link C++ class TLDAPAttribute; #pragma link C++ global LDAP_PORT; #pragma link C++ global LDAP_SCOPE_DEFAULT; #pragma link C++ global LDAP_SCOPE_BASE; #pragma link C++ global LDAP_SCOPE_ONELEVEL; #pragma link C++ global LDAP_SCOPE_SUBTREE; #pragma link C++ global LDAP_MOD_ADD; #pragma link C++ global LDAP_MOD_DELETE; #pragma link C++ global LDAP_MOD_REPLACE; #pragma link C++ global LDAP_MOD_BVALUES; #pragma link C++ global LDAP_SERVER_DOWN; #endif
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class TLDAPServer; #pragma link C++ class TLDAPResult; #pragma link C++ class TLDAPEntry; #pragma link C++ class TLDAPAttribute; // These constants are preprocessor statements // in ldap.h and not variables // #pragma link C++ global LDAP_PORT; // #pragma link C++ global LDAP_SCOPE_DEFAULT; // #pragma link C++ global LDAP_SCOPE_BASE; // #pragma link C++ global LDAP_SCOPE_ONELEVEL; // #pragma link C++ global LDAP_SCOPE_SUBTREE; // #pragma link C++ global LDAP_MOD_ADD; // #pragma link C++ global LDAP_MOD_DELETE; // #pragma link C++ global LDAP_MOD_REPLACE; // #pragma link C++ global LDAP_MOD_BVALUES; // #pragma link C++ global LDAP_SERVER_DOWN; #endif
Make version string work with CONFIG_NEWLIB_LIBC
/* * Copyright (c) 2018-2021 mcumgr authors * * SPDX-License-Identifier: Apache-2.0 */ #include <stdio.h> #include <string.h> #include "img_mgmt/image.h" #include "img_mgmt/img_mgmt.h" int img_mgmt_ver_str(const struct image_version *ver, char *dst) { int rc = 0; int rc1 = 0; rc = snprintf(dst, IMG_MGMT_VER_MAX_STR_LEN, "%hhu.%hhu.%hu", ver->iv_major, ver->iv_minor, ver->iv_revision); if (rc >= 0 && ver->iv_build_num != 0) { rc1 = snprintf(&dst[rc], IMG_MGMT_VER_MAX_STR_LEN - rc, ".%u", ver->iv_build_num); } if (rc1 >= 0 && rc >= 0) { rc = rc + rc1; } else { /* If any failed then all failed */ rc = -1; } return rc; }
/* * Copyright (c) 2018-2021 mcumgr authors * * SPDX-License-Identifier: Apache-2.0 */ #include <stdio.h> #include <string.h> #include "img_mgmt/image.h" #include "img_mgmt/img_mgmt.h" int img_mgmt_ver_str(const struct image_version *ver, char *dst) { int rc = 0; int rc1 = 0; rc = snprintf(dst, IMG_MGMT_VER_MAX_STR_LEN, "%hu.%hu.%hu", (uint16_t)ver->iv_major, (uint16_t)ver->iv_minor, ver->iv_revision); if (rc >= 0 && ver->iv_build_num != 0) { rc1 = snprintf(&dst[rc], IMG_MGMT_VER_MAX_STR_LEN - rc, ".%u", ver->iv_build_num); } if (rc1 >= 0 && rc >= 0) { rc = rc + rc1; } else { /* If any failed then all failed */ rc = -1; } return rc; }
Define M_PI instead of CAL_PI
#ifndef G_EBKLRON9896QUFJSD3FNA40IITV3F #define G_EBKLRON9896QUFJSD3FNA40IITV3F #ifdef __cplusplus extern "C" { #endif /*@self.public()*/ static const double CAL_PI = 3.141592653589793238462643383279502884197169399375; #ifdef __cplusplus } #endif #endif
#ifndef G_EBKLRON9896QUFJSD3FNA40IITV3F #define G_EBKLRON9896QUFJSD3FNA40IITV3F #ifdef __cplusplus extern "C" { #endif /*@self.public()*/ #ifndef M_PI #define M_PI 3.141592653589793238462643383279502884197169399375 #endif #ifdef __cplusplus } #endif #endif
Add basic riot_run function definition
#include "riot_arduino_uno.h" #include "utils.h" riot_arduino_uno_sinks* riot_arduino_uno_sinks_create() { riot_arduino_uno_sinks *sinks = xmalloc(sizeof(riot_arduino_uno_sinks)); return sinks; } riot_arduino_uno_sources* riot_arduino_uno_sources_create() { riot_arduino_uno_sources *sources = xmalloc(sizeof(riot_arduino_uno_sources)); return sources; };
#include "riot_arduino_uno.h" #include "utils.h" riot_arduino_uno_sinks* riot_arduino_uno_sinks_create() { riot_arduino_uno_sinks *sinks = xmalloc(sizeof(riot_arduino_uno_sinks)); return sinks; } riot_arduino_uno_sources* riot_arduino_uno_sources_create() { riot_arduino_uno_sources *sources = xmalloc(sizeof(riot_arduino_uno_sources)); return sources; }; int riot_arduino_uno_run(riot_arduino_uno_main main) { if(main == NULL) { return -1; } riot_arduino_uno_sources *sources = riot_arduino_uno_sources_create(); if(sources == NULL) { return -2; } riot_arduino_uno_sinks *sinks = main(sources); if(sinks == NULL) { return -3; } while(true) { // TODO: Read all inputs and map to sources // TODO: If all sinks/outputs have completed, break } return 0; }
Fix for references with more than 32k sequences.
#ifndef __SEQUENCELOCATION_H__ #define __SEQUENCELOCATION_H__ #include "Types.h" #include "IRefProvider.h" //#pragma pack(push) //#pragma pack(2) struct SequenceLocation { uint m_Location; short m_RefId; bool used() { return m_Location != 0; } bool operator< (SequenceLocation const & rhs) const { if (m_Location < rhs.m_Location) return true; else if (m_Location == rhs.m_Location) return (m_RefId < rhs.m_RefId); return false; } SequenceLocation() { } SequenceLocation(uint const loc, short const refid) { m_Location = loc; m_RefId = refid; } SequenceLocation(Location const & other) { m_Location = other.m_Location; } }; //#pragma pack(pop) #endif
#ifndef __SEQUENCELOCATION_H__ #define __SEQUENCELOCATION_H__ #include "Types.h" #include "IRefProvider.h" //#pragma pack(push) //#pragma pack(2) struct SequenceLocation { uint m_Location; int m_RefId; bool used() { return m_Location != 0; } bool operator< (SequenceLocation const & rhs) const { if (m_Location < rhs.m_Location) return true; else if (m_Location == rhs.m_Location) return (m_RefId < rhs.m_RefId); return false; } SequenceLocation() { } SequenceLocation(uint const loc, short const refid) { m_Location = loc; m_RefId = refid; } SequenceLocation(Location const & other) { m_Location = other.m_Location; } }; //#pragma pack(pop) #endif
Use a single call only (warning x86 only) Move the y assignment to another point in code
/* 1 4 5 2 6 7 3 */ #include <stdio.h> void line(char** a, int u, int v) { char *c = a[1]; while(*c) { int y = ("|O6VYNnX~^")[*c++-48]+1; printf("%c%c%c%c", y & u ? '|' : 32, y & v ? '_' : 32, y & u*2 ? '|' : 32, c[0] ? ' ' : '\n'); } } int main(int y, char **a) { line(a, 0, 1); line(a, 8, 2); line(a, 32, 4); return 0; }
/* 1 4 5 2 6 7 3 */ #include <stdio.h> #define L(u,v) \ for(char *c = a[1];*c;) { \ printf("%c%c%c%c", \ y & u ? '|' : 32, \ y & v ? '_' : 32, \ (y = ("|O6VYNnX~^")[*c++-48]+1) & u*2 ? '|' : 32, \ c[1] ? ' ' : '\n'); \ }; int main(int y, char **a) { L(0, 1); L(8, 2); L(32, 4); return 0; }
Add error output for crash()
// // Created by admarkov on 22.04.17. // #ifndef FUNC_COMPOSER_FRAME_H #define FUNC_COMPOSER_FRAME_H #include <string> typedef unsigned int index; void crash(char info[]="") { puts("Fatal error."); exit(0); } #endif //FUNC_COMPOSER_FRAME_H
// // Created by admarkov on 22.04.17. // #ifndef FUNC_COMPOSER_FRAME_H #define FUNC_COMPOSER_FRAME_H #include <string> using namespace std; typedef unsigned int index; void crash(string info="No information.") { puts("Fatal error: "+info); exit(0); } #endif //FUNC_COMPOSER_FRAME_H
Update Skia milestone to 110
/* * 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 109 #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 110 #endif
Add listing disks and partitions program
/* * disklist - List of disk and partitions using parted library * * Written in 2013 by Prashant P Shah <pshah.mumbai@gmail.com> * * To the extent possible under law, the author(s) have dedicated * all copyright and related and neighboring rights to this software * to the public domain worldwide. This software is distributed * without any warranty. * * You should have received a copy of the CC0 Public Domain Dedication * along with this software. * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. * * Usage : * $sudo apt-get install libparted0-dev * $gcc disklist.c -o disklist -lparted * $sudo ./disklist */ #include <stdio.h> #include <parted/parted.h> typedef struct { unsigned char system; } DosPartitionData; int main() { PedDevice *dev = NULL; PedDisk *disk = NULL; PedPartition *part = NULL; DosPartitionData *dos = NULL; char *type_name; ped_device_probe_all(); /* Loop through each physical disk */ while ((dev = ped_device_get_next (dev))) { printf("%s\n", dev->path); if (!ped_device_open(dev)) continue; disk = ped_disk_new(dev); if (disk) { /* Loop through each disk partition */ for (part = ped_disk_next_partition(disk, NULL); part; part = ped_disk_next_partition(disk, part)) { type_name = (char *)ped_partition_type_get_name(part->type); /* Check if its a primary or logical partition */ if (part->type == 0 || part->type == 1) { dos = (DosPartitionData *)part->disk_specific; printf("num=%d type=%x fs_type=%s system=%x\n", part->num, part->type, type_name, dos->system); } else { printf("num=%d type=%x fs_type=%s\n", part->num, part->type, type_name); } } ped_disk_destroy(disk); } } exit(0); }
Make the macro play nice with clang
///////////////////////////////////////////////////////////////////////////////////////// /// /// \file CudaLE.h /// /// __Description__: Main include file for the CudaLE lib /// /// __Version__: 1.0\n /// __Author__: Alex Chen, fizban007@gmail.com\n /// __Organization__: Columbia University /// ///////////////////////////////////////////////////////////////////////////////////////// #ifndef _CUDALE_H_ #define _CUDALE_H_ #include "cudaControl.h" #include "Operators.h" #include "Variable.h" #include "Functions.h" #include "Derivative.h" #ifndef DEFINE_FUNCTOR #define DEFINE_FUNCTOR(NAME, FUNCTOR) \ private: \ typedef typeof(FUNCTOR) NAME ## _type; \ NAME ## _type defaultValue_ ## NAME () { \ return FUNCTOR; \ } \ public: \ NAME ## _type NAME #endif #endif // ----- #ifndef _CUDALE_H_ -----
///////////////////////////////////////////////////////////////////////////////////////// /// /// \file CudaLE.h /// /// __Description__: Main include file for the CudaLE lib /// /// __Version__: 1.0\n /// __Author__: Alex Chen, fizban007@gmail.com\n /// __Organization__: Columbia University /// ///////////////////////////////////////////////////////////////////////////////////////// #ifndef _CUDALE_H_ #define _CUDALE_H_ #include "cudaControl.h" #include "Operators.h" #include "Variable.h" #include "Functions.h" #include "Derivative.h" #ifndef DEFINE_FUNCTOR #define DEFINE_FUNCTOR(NAME, FUNCTOR) \ private: \ typedef __typeof__(FUNCTOR) NAME ## _type; \ NAME ## _type defaultValue_ ## NAME () { \ return FUNCTOR; \ } \ public: \ NAME ## _type NAME #endif #endif // ----- #ifndef _CUDALE_H_ -----
Remove useless interface of toreprtab
/* * Copyright 2020 Andrey Terekhov, Maxim Menshikov * * 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 "context.h" #ifdef __cplusplus extern "C" { #endif /** * Save up a string array to reprtab * * @param context RuC context * @param str Target string * * @return FIXME */ int toreprtab(compiler_context *context, char str[]); /** * Mode table initialization * * @param context RuC context */ void init_modetab(compiler_context *context); #ifdef __cplusplus } /* extern "C" */ #endif
/* * Copyright 2020 Andrey Terekhov, Maxim Menshikov * * 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 "context.h" #ifdef __cplusplus extern "C" { #endif /** * Mode table initialization * * @param context RuC context */ void init_modetab(compiler_context *context); #ifdef __cplusplus } /* extern "C" */ #endif
Define NS_EXTENSIBLE_STRING_ENUM if not defined
#import <Foundation/Foundation.h> /// Macro that marks an initializer as designated, and also makes the default Foundation initializers unavailable #define HUB_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER; \ /** Unavailable. Use the designated initializer instead */ \ + (instancetype)new NS_UNAVAILABLE; \ /** Unavailable. Use the designated initializer instead */ \ - (instancetype)init NS_UNAVAILABLE; \ /** Unavailable. Use the designated initializer instead */ \ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
#import <Foundation/Foundation.h> /// Macro that marks an initializer as designated, and also makes the default Foundation initializers unavailable #define HUB_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER; \ /** Unavailable. Use the designated initializer instead */ \ + (instancetype)new NS_UNAVAILABLE; \ /** Unavailable. Use the designated initializer instead */ \ - (instancetype)init NS_UNAVAILABLE; \ /** Unavailable. Use the designated initializer instead */ \ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; /// This macro was introduced in Xcode 8, so adding this here for now (if not defined) to support Xcode 7 as well #ifndef NS_EXTENSIBLE_STRING_ENUM #define NS_EXTENSIBLE_STRING_ENUM #endif
Add header file for cross-gateway subscription data store
#ifndef SUBSCRIPTION_DATA_STORE_H #define SUBSCRIPTION_DATA_STORE_H #include <list> #include <string> class SubscriptionDataStore { public: SubscriptionDataStore(); std::list<std::string> getHandlersForType(const std::string &typeName); void subscribe(const std::string &typeName, const std::string &handlerName); void unsubscribe(const std::string &typeName, const std::string &handlerName); private: struct HandlerInfo { std::string handlerName; unsigned int referenceCount; }; struct SubscriptionItem { std::string typeName; std::vector<HandlerInfo> handlers; std::map<std::string typeName, SubscriptionItem *> subtypes; SubscriptionItem *parent; }; }; #endif
Remove TMPDIR from glibc's commented list
/* * Environment variable to be removed for SUID programs. The names are all * stuffed in a single string which means they have to be terminated with a * '\0' explicitly. */ #define UNSECURE_ENVVARS \ "LD_PRELOAD\0" \ "LD_LIBRARY_PATH\0" \ "LD_DEBUG\0" \ "LD_DEBUG_OUTPUT\0" \ "LD_TRACE_LOADED_OBJECTS\0" \ "TMPDIR\0" /* * LD_TRACE_LOADED_OBJECTS is not in glibc-2.3.5's unsecvars.h * though used by ldd * * These environment variables are defined by glibc but ignored in * uClibc, but may very well have an equivalent in uClibc. * * LD_ORIGIN_PATH, LD_PROFILE, LD_USE_LOAD_BIAS, LD_DYNAMIC_WEAK, LD_SHOW_AUXV, * GCONV_PATH, GETCONF_DIR, HOSTALIASES, LOCALDOMAIN, LOCPATH, MALLOC_TRACE, * NLSPATH, RESOLV_HOST_CONF, RES_OPTIONS, TMPDIR, TZDIR */
/* * Environment variable to be removed for SUID programs. The names are all * stuffed in a single string which means they have to be terminated with a * '\0' explicitly. */ #define UNSECURE_ENVVARS \ "LD_PRELOAD\0" \ "LD_LIBRARY_PATH\0" \ "LD_DEBUG\0" \ "LD_DEBUG_OUTPUT\0" \ "LD_TRACE_LOADED_OBJECTS\0" \ "TMPDIR\0" /* * LD_TRACE_LOADED_OBJECTS is not in glibc-2.3.5's unsecvars.h * though used by ldd * * These environment variables are defined by glibc but ignored in * uClibc, but may very well have an equivalent in uClibc. * * LD_ORIGIN_PATH, LD_PROFILE, LD_USE_LOAD_BIAS, LD_DYNAMIC_WEAK, LD_SHOW_AUXV, * GCONV_PATH, GETCONF_DIR, HOSTALIASES, LOCALDOMAIN, LOCPATH, MALLOC_TRACE, * NLSPATH, RESOLV_HOST_CONF, RES_OPTIONS, TZDIR */
Set log limit back to 3.5 megabytes
#include "logging.h" void error_log(const char *format, ...){ FILE *flog; //If the log file is over 3.5 megabytes, empty it and start again struct stat st; if (!stat(log_filename, &st) && st.st_size >= 36700160) //1048576 per megabyte flog = fopen(log_filename, "w+"); else flog = fopen(log_filename, "a+"); //Write to the log file if (!flog) fprintf(stderr, "Error! Could not open log file for writing!\n"); else{ //Get time of error time_t raw; struct tm *t; time(&raw); t = localtime(&raw); fprintf(flog, "[%d/%d %d:%d:%d] ", t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); //Write error va_list args; va_start(args, format); vfprintf(flog, format, args); va_end(args); fclose(flog); } }
#include "logging.h" void error_log(const char *format, ...){ FILE *flog; //If the log file is over 3.5 megabytes, empty it and start again struct stat st; if (!stat(log_filename, &st) && st.st_size >= 3670016) //1048576 per megabyte flog = fopen(log_filename, "w+"); else flog = fopen(log_filename, "a+"); //Write to the log file if (!flog) fprintf(stderr, "Error! Could not open log file for writing!\n"); else{ //Get time of error time_t raw; struct tm *t; time(&raw); t = localtime(&raw); fprintf(flog, "[%d/%d %d:%d:%d] ", t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); //Write error va_list args; va_start(args, format); vfprintf(flog, format, args); va_end(args); fclose(flog); } }
Fix a regression for EMR devices
/* * Copyright (C) 2018-2019 Richard Hughes <richard@hughsie.com> * * SPDX-License-Identifier: LGPL-2.1+ */ #pragma once #include "fu-wacom-device.h" #define FU_TYPE_WACOM_EMR_DEVICE (fu_wacom_emr_device_get_type ()) G_DECLARE_FINAL_TYPE (FuWacomEmrDevice, fu_wacom_emr_device, FU, WACOM_EMR_DEVICE, FuUdevDevice) FuWacomEmrDevice *fu_wacom_emr_device_new (FuUdevDevice *device);
/* * Copyright (C) 2018-2019 Richard Hughes <richard@hughsie.com> * * SPDX-License-Identifier: LGPL-2.1+ */ #pragma once #include "fu-wacom-device.h" #define FU_TYPE_WACOM_EMR_DEVICE (fu_wacom_emr_device_get_type ()) G_DECLARE_FINAL_TYPE (FuWacomEmrDevice, fu_wacom_emr_device, FU, WACOM_EMR_DEVICE, FuWacomDevice) FuWacomEmrDevice *fu_wacom_emr_device_new (FuUdevDevice *device);
Add a test program: sending AT command to the drone
/*Lien du tuto d'où provient le code http://www.upsilonaudio.com/ar-drone-envoyer-des-commandes-at-paquets-udp/ lien vers un listing des commandes AT http://www.upsilonaudio.com/ar-drone-recapitulatif-des-commandes-at/ */ #include <arpa/inet.h> #include <netinet/in.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <time.h> #define BUFLEN 512 #define ADRESSEIP "127.0.0.1" #define PORT 5556 #define MESSAGE1 "AT*REF=101,290718208\r" #define MESSAGE2 "AT*REF=102,290717696\r" void delai ( int delaiSecondes ); void err(char *s); int main(int argc, char** argv) { struct sockaddr_in serv_addr; int sockfd, slen=sizeof(serv_addr); if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) { err("socket"); } bzero(&serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(PORT); if (inet_aton(ADRESSEIP, &serv_addr.sin_addr)==0) { fprintf(stderr, "inet_aton() failed\n"); exit(1); } if (sendto(sockfd, MESSAGE1, BUFLEN, 0, (struct sockaddr*)&serv_addr, slen)==-1) { err("sendto()"); } /*delai(5); if (sendto(sockfd, MESSAGE2, BUFLEN, 0, (struct sockaddr*)&serv_addr, slen)==-1) { err("sendto()"); }*/ close(sockfd); return 0; } void err(char *s) { perror(s); exit(1); } void delai ( int delaiSecondes ) { while ( clock()/CLOCKS_PER_SEC < delaiSecondes) { } }
Fix the previous, remarkable error.
#include <stdio.h> int main(void) { printf("hello, world\n") return 0; }
#include <stdio.h> int main(void) { printf("hello, world\n"); return 0; }
Add test where memory is not invalidated correctly.
#include <stdlib.h> #include <stdio.h> typedef struct list { int val; struct list *next; } list_t; // void mutate_list(list_t n){ // list_t *next = n.next; // next->val = 42; // } int main(){ list_t first; list_t second; first.next = &second; first.val = 1; second.next = NULL; second.val = 2; // When passing a struct to an unknown function, reachable memory should be invalidated mutate_list(first); assert(second.val == 2); //UNKNOWN! // Passing a pointer to the struct here. mutate_list2(&first); assert(second.val == 2); //UNKNOWN! }
Update hat-trie C library. Fix GH-11.
/* * This file is part of hat-trie. * * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu> * * * Common typedefs, etc. * */ #ifndef HATTRIE_COMMON_H #define HATTRIE_COMMON_H typedef unsigned long value_t; #endif
/* * This file is part of hat-trie. * * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu> * * * Common typedefs, etc. * */ #ifndef HATTRIE_COMMON_H #define HATTRIE_COMMON_H #include "pstdint.h" typedef uintptr_t value_t; #endif
Implement PID, fix forking in C
#include <stdlib.h> #include <stdio.h> #include <dirent.h> #include <sys/time.h> int main(int argc, char ** argv){ printf("Test %d\n", argc); int i; for(i = 0; i < argc; i++){ printf("%d: %s\n", i, argv[i]); } struct timeval tv; if(gettimeofday(&tv, NULL) == 0){ printf("Gettimeofday %d %d\n", tv.tv_sec, tv.tv_usec); void* test = malloc(1024*1024); if(test > 0){ printf("Malloc %x\n", test); free(test); printf("Free\n"); DIR * dir = opendir("file:///"); if (dir != NULL) { struct dirent * ent; while ((ent = readdir(dir)) != NULL) { printf("%s\n", ent->d_name); } closedir(dir); pid_t pid = fork(); if(pid == 0){ printf("Fork Parent\n"); }else if(pid > 0){ printf("Fork Child %d\n", pid); } else { printf("Fork Failed\n"); } }else{ printf("Opendir Failed\n"); } } else { printf("Malloc Failed\n"); } } else { printf("Gettimeofday Failed\n"); } return 0; }
#include <stdlib.h> #include <stdio.h> #include <dirent.h> #include <sys/time.h> int main(int argc, char ** argv){ printf("Test %d\n", argc); int i; for(i = 0; i < argc; i++){ printf("%d: %s\n", i, argv[i]); } struct timespec tp; if(clock_gettime(CLOCK_REALTIME, &tp) == 0){ printf("clock_gettime %d %d\n", tp.tv_sec, tp.tv_nsec); void* test = malloc(1024*1024); if(test > 0){ printf("Malloc %x\n", test); free(test); printf("Free\n"); DIR * dir = opendir("file:///"); if (dir != NULL) { struct dirent * ent; while ((ent = readdir(dir)) != NULL) { printf("%s\n", ent->d_name); } closedir(dir); pid_t pid = fork(); if(pid > 0){ printf("Fork Parent %d = %d\n", getpid(), pid); }else if(pid == 0){ printf("Fork Child %d = %d\n", getpid(), pid); } else { printf("Fork Failed %d = %d\n", getpid(), pid); } }else{ printf("Opendir Failed\n"); } } else { printf("Malloc Failed\n"); } } else { printf("clock_gettime Failed\n"); } return 0; }
Increase initial buffer to 8192 bytes
/* * Copyright 2016 Chris Marshall * * 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 __QUICKAVRO_H #define __QUICKAVRO_H #ifdef __cplusplus extern "C" { #endif // Used when reading 'zig-zag' encoded values #define MAX_VARINT_SIZE 10 // Initial write buffer #define INITIAL_BUFFER_SIZE 1024 #ifdef __cplusplus } #endif #endif
/* * Copyright 2016 Chris Marshall * * 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 __QUICKAVRO_H #define __QUICKAVRO_H #ifdef __cplusplus extern "C" { #endif // Used when reading 'zig-zag' encoded values #define MAX_VARINT_SIZE 10 // Initial write buffer #define INITIAL_BUFFER_SIZE 1024 * 8 #ifdef __cplusplus } #endif #endif
Correct the comment (the existing text was referring to a different file).
/* KindlePDFViewer: buffer for blitting muPDF data to framebuffer (blitbuffer) Copyright (C) 2011 Hans-Werner Hilse <hilse@web.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTIL_H #define _UTIL_H #include <lua.h> #include <lualib.h> #include <lauxlib.h> int luaopen_util(lua_State *L); #endif
/* KindlePDFViewer: miscellaneous utility functions for Lua Copyright (C) 2011 Hans-Werner Hilse <hilse@web.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTIL_H #define _UTIL_H #include <lua.h> #include <lualib.h> #include <lauxlib.h> int luaopen_util(lua_State *L); #endif
Add explicit header for size_t
#ifndef STUD_String_H #define STUD_String_H #include <initializer_list> #include <string> namespace stud { class string : public std::string { public: string() = default; string(const string& rhs) = default; string(string&& rhs) = default; string& operator=(const string& rhs) = default; string& operator=(string&& rhs) = default; explicit string(const char* raw_string) : std::string(raw_string) {} explicit string(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit string(size_t to_fill, char character) : std::string(to_fill, character) {} explicit string(const std::string& std_string) : std::string(std_string) {} explicit string(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit string(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit string(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace stud #endif // STUD_String_H
#ifndef STUD_String_H #define STUD_String_H #include <cstring> #include <initializer_list> #include <string> namespace stud { class string : public std::string { public: string() = default; string(const string& rhs) = default; string(string&& rhs) = default; string& operator=(const string& rhs) = default; string& operator=(string&& rhs) = default; explicit string(const char* raw_string) : std::string(raw_string) {} explicit string(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit string(size_t to_fill, char character) : std::string(to_fill, character) {} explicit string(const std::string& std_string) : std::string(std_string) {} explicit string(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit string(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit string(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace stud #endif // STUD_String_H
Fix test in -Asserts build.
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s #define FASTCALL __attribute__((regparm(2))) typedef struct { int aaa; double bbbb; int ccc[200]; } foo; typedef void (*FType)(int, int) __attribute ((regparm (3), stdcall)); FType bar; static void FASTCALL reduced(char b, double c, foo* d, double e, int f); int main(void) { // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.anon* inreg null reduced(0, 0.0, 0, 0.0, 0); // CHECK: call x86_stdcallcc void %tmp(i32 inreg 1, i32 inreg 2) bar(1,2); }
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s #define FASTCALL __attribute__((regparm(2))) typedef struct { int aaa; double bbbb; int ccc[200]; } foo; typedef void (*FType)(int, int) __attribute ((regparm (3), stdcall)); FType bar; static void FASTCALL reduced(char b, double c, foo* d, double e, int f); int main(void) { // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.anon* inreg null reduced(0, 0.0, 0, 0.0, 0); // CHECK: call x86_stdcallcc void {{.*}}(i32 inreg 1, i32 inreg 2) bar(1,2); }
Use arc4random() in tests if available.
#ifndef __CMPTEST_H__ #define __CMPTEST_H__ #include <stdio.h> #include "sodium.h" #define TEST_NAME_RES TEST_NAME ".res" #define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp" FILE *fp_res; int xmain(void); int main(void) { FILE *fp_out; int c; if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) { perror("fopen(" TEST_NAME_RES ")"); return 99; } if (sodium_init() != 0) { return 99; } xmain(); rewind(fp_res); if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) { perror("fopen(" TEST_NAME_OUT ")"); return 99; } do { if ((c = fgetc(fp_res)) != fgetc(fp_out)) { return 99; } } while (c != EOF); return 0; } #undef printf #define printf(...) fprintf(fp_res, __VA_ARGS__) #define main xmain #endif
#ifndef __CMPTEST_H__ #define __CMPTEST_H__ #include <stdio.h> #include "sodium.h" #define TEST_NAME_RES TEST_NAME ".res" #define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp" #ifdef HAVE_ARC4RANDOM # undef rand # define rand(X) arc4random(X) #endif FILE *fp_res; int xmain(void); int main(void) { FILE *fp_out; int c; if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) { perror("fopen(" TEST_NAME_RES ")"); return 99; } if (sodium_init() != 0) { return 99; } xmain(); rewind(fp_res); if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) { perror("fopen(" TEST_NAME_OUT ")"); return 99; } do { if ((c = fgetc(fp_res)) != fgetc(fp_out)) { return 99; } } while (c != EOF); return 0; } #undef printf #define printf(...) fprintf(fp_res, __VA_ARGS__) #define main xmain #endif
Add virtual destructor to base class.
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * Base class for decoders. */ #ifndef DECODER_H_ #define DECODER_H_ #include <memory> #include <stdint.h> #include <vector> #include "dsp.h" using namespace std; namespace radioreceiver { /** * Base class for decoders. */ class Decoder { public: /** * Demodulates a block of floating-point samples, producing a block of * stereo audio. * @param samples The samples to decode. * @param inStereo Whether to try decoding a stereo signal. * @return The generated stereo audio block. */ virtual StereoAudio decode(const Samples& samples, bool inStereo) = 0; }; } // namespace radioreceiver #endif // DECODER_BASE_H_
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * Base class for decoders. */ #ifndef DECODER_H_ #define DECODER_H_ #include <memory> #include <stdint.h> #include <vector> #include "dsp.h" using namespace std; namespace radioreceiver { /** * Base class for decoders. */ class Decoder { public: virtual ~Decoder() {} /** * Demodulates a block of floating-point samples, producing a block of * stereo audio. * @param samples The samples to decode. * @param inStereo Whether to try decoding a stereo signal. * @return The generated stereo audio block. */ virtual StereoAudio decode(const Samples& samples, bool inStereo) = 0; }; } // namespace radioreceiver #endif // DECODER_BASE_H_
Introduce the explicit Shell reader which makes polydata from moab.
#ifndef __smoab_ExtractShell_h #define __smoab_ExtractShell_h #include "SimpleMoab.h" #include "detail/LoadGeometry.h" #include "detail/ReadMaterialTag.h" #include <vtkUnstructuredGrid.h> #include <vtkPolyData.h> #include <algorithm> namespace smoab{ //we presume that we are extract the shell of a 3d volume, where the 2d //surface elements that constructed the 3d volume are contained //in the input parents class ExtractShell { const smoab::Interface& Interface; const smoab::Range& Parents; std::string MaterialName; smoab::Range SCells; public: ExtractShell(const smoab::Interface& interface, const smoab::Range& parents): Interface(interface), Parents(parents), MaterialName("Material") { const smoab::GeomTag geom2Tag(2); //append all the entities cells together into a single range typedef smoab::Range::const_iterator iterator; for(iterator i=this->Parents.begin(); i!= this->Parents.end(); ++i) { //find all 2d cells smoab::Range entitiesCells = this->Interface.findEntitiesWithDimension(*i,geom2Tag); this->SCells.insert(entitiesCells.begin(),entitiesCells.end()); } std::cout << "SCells size" << this->SCells.size() << std::endl; } //---------------------------------------------------------------------------- template<typename T> bool fill(T* grid) { //we have all the volume cells, what we need is to compare these //volume cells to a collection of surface cells const smoab::GeomTag geom2Tag(2); //save the results into the grid detail::LoadGeometry loadGeom(this->SCells,this->Interface); loadGeom.fill(grid); vtkNew<vtkIntArray> materials; materials->SetName(this->MaterialName.c_str()); detail::ReadMaterialTag materialReader(this->MaterialName, this->Parents, this->SCells, this->Interface); //fill the material array using geom2tag to determine how cells //maps back to the parents. materialReader.fill(materials.GetPointer(),&geom2Tag); grid->GetCellData()->AddArray(materials.GetPointer()); //to properly label the model face / side information we need to query //for all the volume elements and find the 2d adjacencies of the 2d element //and 3 elements return true; } void materialIdName(const std::string& name) { this->MaterialName = name; } }; } #endif // EXTRACTSHELL_H
Use escape sequence to clear screen
#include <stdio.h> #include <stdlib.h> #include "system.h" void SystemPause() { puts("\nPress Enter to continue..."); while (getchar() != '\n') {} } void SystemClear() { system("clear"); }
#include <stdio.h> #include <stdlib.h> #include "system.h" void SystemPause() { puts("\nPress Enter to continue..."); while (getchar() != '\n') {} } void SystemClear() { fputs("\033[2J\033[H", stdout); }
Mark +[RLMSchema sharedSchema] as nullable.
//////////////////////////////////////////////////////////////////////////// // // Copyright 2014 Realm Inc. // // 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. // //////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif #import <Realm/RLMSchema.h> #import <Realm/RLMDefines.h> RLM_ASSUME_NONNULL_BEGIN @class RLMRealm; // // RLMSchema private interface // @class RLMRealm; @interface RLMSchema () @property (nonatomic, readwrite, copy) NSArray *objectSchema; // schema based on runtime objects + (instancetype)sharedSchema; // schema based on tables in a Realm + (instancetype)dynamicSchemaFromRealm:(RLMRealm *)realm; // class for string + (nullable Class)classForString:(NSString *)className; // shallow copy for reusing schema properties accross the same Realm on multiple threads - (instancetype)shallowCopy; @end RLM_ASSUME_NONNULL_END #ifdef __cplusplus } #endif
//////////////////////////////////////////////////////////////////////////// // // Copyright 2014 Realm Inc. // // 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. // //////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif #import <Realm/RLMSchema.h> #import <Realm/RLMDefines.h> RLM_ASSUME_NONNULL_BEGIN @class RLMRealm; // // RLMSchema private interface // @class RLMRealm; @interface RLMSchema () @property (nonatomic, readwrite, copy) NSArray *objectSchema; // schema based on runtime objects + (nullable instancetype)sharedSchema; // schema based on tables in a Realm + (instancetype)dynamicSchemaFromRealm:(RLMRealm *)realm; // class for string + (nullable Class)classForString:(NSString *)className; // shallow copy for reusing schema properties accross the same Realm on multiple threads - (instancetype)shallowCopy; @end RLM_ASSUME_NONNULL_END #ifdef __cplusplus } #endif
Add file missed from r244409.
#ifndef STRESS1_MERGE_NO_REEXPORT_H #define STRESS1_MERGE_NO_REEXPORT_H #include "m00.h" #include "m01.h" #include "m02.h" #include "m03.h" #endif
Use of base::StringPairs appropriately in server
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ #define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ #include <string> #include <utility> #include <vector> #include "net/http/http_status_code.h" namespace net { class HttpServerResponseInfo { public: // Creates a 200 OK HttpServerResponseInfo. HttpServerResponseInfo(); explicit HttpServerResponseInfo(HttpStatusCode status_code); ~HttpServerResponseInfo(); static HttpServerResponseInfo CreateFor404(); static HttpServerResponseInfo CreateFor500(const std::string& body); void AddHeader(const std::string& name, const std::string& value); // This also adds an appropriate Content-Length header. void SetBody(const std::string& body, const std::string& content_type); // Sets content-length and content-type. Body should be sent separately. void SetContentHeaders(size_t content_length, const std::string& content_type); std::string Serialize() const; HttpStatusCode status_code() const; const std::string& body() const; private: typedef std::vector<std::pair<std::string, std::string> > Headers; HttpStatusCode status_code_; Headers headers_; std::string body_; }; } // namespace net #endif // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ #define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ #include <string> #include <utility> #include "base/strings/string_split.h" #include "net/http/http_status_code.h" namespace net { class HttpServerResponseInfo { public: // Creates a 200 OK HttpServerResponseInfo. HttpServerResponseInfo(); explicit HttpServerResponseInfo(HttpStatusCode status_code); ~HttpServerResponseInfo(); static HttpServerResponseInfo CreateFor404(); static HttpServerResponseInfo CreateFor500(const std::string& body); void AddHeader(const std::string& name, const std::string& value); // This also adds an appropriate Content-Length header. void SetBody(const std::string& body, const std::string& content_type); // Sets content-length and content-type. Body should be sent separately. void SetContentHeaders(size_t content_length, const std::string& content_type); std::string Serialize() const; HttpStatusCode status_code() const; const std::string& body() const; private: using Headers = base::StringPairs; HttpStatusCode status_code_; Headers headers_; std::string body_; }; } // namespace net #endif // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
Clean up some inconsistencies in the section helper header
#import <Foundation/Foundation.h> @class MITCollectionViewNewsGridLayout; @interface MITCollectionViewGridLayoutSection : NSObject @property (nonatomic,readonly,weak) MITCollectionViewNewsGridLayout *layout; @property (nonatomic,readonly) NSInteger section; @property (nonatomic) CGPoint origin; @property (nonatomic) UIEdgeInsets contentInsets; @property (nonatomic, readonly) CGSize bounds; @property (nonatomic,readonly) CGRect frame; @property (nonatomic,readonly,strong) UICollectionViewLayoutAttributes *headerLayoutAttributes; @property (nonatomic,readonly,strong) UICollectionViewLayout *featuredItemLayoutAttributes; @property (nonatomic,readonly,strong) NSArray *itemLayoutAttributes; + (instancetype)sectionWithLayout:(MITCollectionViewNewsGridLayout*)layout section:(NSInteger)section; - (NSArray*)layoutAttributesInRect:(CGRect)rect; - (UICollectionViewLayoutAttributes*)layoutAttributesForItemAtIndexPath:(NSIndexPath*)indexPath; @end
#import <Foundation/Foundation.h> @class MITCollectionViewNewsGridLayout; @interface MITCollectionViewGridLayoutSection : NSObject @property (nonatomic,readonly,weak) MITCollectionViewNewsGridLayout *layout; @property (nonatomic,readonly) NSInteger section; @property (nonatomic) CGPoint origin; @property (nonatomic) UIEdgeInsets contentInsets; @property (nonatomic,readonly) CGRect bounds; @property (nonatomic,readonly) CGRect frame; @property (nonatomic,readonly,strong) UICollectionViewLayoutAttributes *headerLayoutAttributes; @property (nonatomic,readonly,strong) UICollectionViewLayoutAttributes *featuredItemLayoutAttributes; @property (nonatomic,readonly,strong) NSArray *itemLayoutAttributes; + (instancetype)sectionWithLayout:(MITCollectionViewNewsGridLayout*)layout forSection:(NSInteger)section numberOfColumns:(NSInteger)numberOfColumns; - (NSArray*)layoutAttributesInRect:(CGRect)rect; - (UICollectionViewLayoutAttributes*)layoutAttributesForItemAtIndexPath:(NSIndexPath*)indexPath; @end
Use a proper Out parameter.
// Copyright 2010-2013 The CefSharp Project. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #pragma once #include "Stdafx.h" #include "IRequestResponse.h" using namespace System; using namespace System::Net; namespace CefSharp { public enum class NavigationType { LinkClicked = NAVIGATION_LINK_CLICKED, FormSubmitted = NAVIGATION_FORM_SUBMITTED, BackForward = NAVIGATION_BACK_FORWARD, Reload = NAVIGATION_RELOAD, FormResubmitted = NAVIGATION_FORM_RESUBMITTED, Other = NAVIGATION_OTHER }; public interface class IRequestHandler { public: bool OnBeforeBrowse(IWebBrowser^ browser, IRequest^ request, NavigationType navigationType, bool isRedirect); bool OnBeforeResourceLoad(IWebBrowser^ browser, IRequestResponse^ requestResponse); void OnResourceResponse(IWebBrowser^ browser, String^ url, int status, String^ statusText, String^ mimeType, WebHeaderCollection^ headers); bool GetDownloadHandler(IWebBrowser^ browser, String^ mimeType, String^ fileName, Int64 contentLength, IDownloadHandler ^% handler); bool GetAuthCredentials(IWebBrowser^ browser, bool isProxy, String^ host ,int port, String^ realm, String^ scheme, String^% username, String^% password); }; }
// Copyright 2010-2013 The CefSharp Project. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #pragma once #include "Stdafx.h" #include "IRequestResponse.h" using namespace System; using namespace System::Net; using namespace System::Runtime::InteropServices; namespace CefSharp { public enum class NavigationType { LinkClicked = NAVIGATION_LINK_CLICKED, FormSubmitted = NAVIGATION_FORM_SUBMITTED, BackForward = NAVIGATION_BACK_FORWARD, Reload = NAVIGATION_RELOAD, FormResubmitted = NAVIGATION_FORM_RESUBMITTED, Other = NAVIGATION_OTHER }; public interface class IRequestHandler { bool OnBeforeBrowse(IWebBrowser^ browser, IRequest^ request, NavigationType navigationType, bool isRedirect); bool OnBeforeResourceLoad(IWebBrowser^ browser, IRequestResponse^ requestResponse); void OnResourceResponse(IWebBrowser^ browser, String^ url, int status, String^ statusText, String^ mimeType, WebHeaderCollection^ headers); bool GetDownloadHandler(IWebBrowser^ browser, [Out] IDownloadHandler ^% handler); bool GetAuthCredentials(IWebBrowser^ browser, bool isProxy, String^ host ,int port, String^ realm, String^ scheme, String^% username, String^% password); }; }
Fix type bool for C
#ifndef _MY_EDATA #define _MY_EDATA #ifdef __cplusplus #define EXTERNC extern "C" #else #define EXTERNC #endif /** @brief struct that carries all information about experimental data */ typedef struct edata { /** observed data */ double *am_my; /** standard deviation of observed data */ double *am_ysigma; /** observed events */ double *am_mz; /** standard deviation of observed events */ double *am_zsigma; /** boolean indicating whether experimental data was provided */ bool am_bexpdata; } ExpData; EXTERNC void freeExpData(ExpData *edata); #endif /* _MY_EDATA */
#ifndef _MY_EDATA #define _MY_EDATA #ifdef __cplusplus #define EXTERNC extern "C" #else #define EXTERNC #include <stdbool.h> #endif /** @brief struct that carries all information about experimental data */ typedef struct edata { /** observed data */ double *am_my; /** standard deviation of observed data */ double *am_ysigma; /** observed events */ double *am_mz; /** standard deviation of observed events */ double *am_zsigma; /** boolean indicating whether experimental data was provided */ bool am_bexpdata; } ExpData; EXTERNC void freeExpData(ExpData *edata); #endif /* _MY_EDATA */
Remove explicit instantiation of empty message
#ifndef CPR_ERROR_H #define CPR_ERROR_H #include <string> #include "cprtypes.h" #include "defines.h" namespace cpr { enum class ErrorCode { OK = 0, CONNECTION_FAILURE, EMPTY_RESPONSE, HOST_RESOLUTION_FAILURE, INTERNAL_ERROR, INVALID_URL_FORMAT, NETWORK_RECEIVE_ERROR, NETWORK_SEND_FAILURE, OPERATION_TIMEDOUT, PROXY_RESOLUTION_FAILURE, SSL_CONNECT_ERROR, SSL_LOCAL_CERTIFICATE_ERROR, SSL_REMOTE_CERTIFICATE_ERROR, SSL_CACERT_ERROR, GENERIC_SSL_ERROR, UNSUPPORTED_PROTOCOL, UNKNOWN_ERROR = 1000, }; ErrorCode getErrorCodeForCurlError(int curl_code); class Error { public: Error() : code{ErrorCode::OK}, message{""} {} template <typename TextType> Error(const ErrorCode& p_error_code, TextType&& p_error_message) : code{p_error_code}, message{CPR_FWD(p_error_message)} {} explicit operator bool() const { return code != ErrorCode::OK; } ErrorCode code; std::string message; }; } // namespace cpr #endif
#ifndef CPR_ERROR_H #define CPR_ERROR_H #include <string> #include "cprtypes.h" #include "defines.h" namespace cpr { enum class ErrorCode { OK = 0, CONNECTION_FAILURE, EMPTY_RESPONSE, HOST_RESOLUTION_FAILURE, INTERNAL_ERROR, INVALID_URL_FORMAT, NETWORK_RECEIVE_ERROR, NETWORK_SEND_FAILURE, OPERATION_TIMEDOUT, PROXY_RESOLUTION_FAILURE, SSL_CONNECT_ERROR, SSL_LOCAL_CERTIFICATE_ERROR, SSL_REMOTE_CERTIFICATE_ERROR, SSL_CACERT_ERROR, GENERIC_SSL_ERROR, UNSUPPORTED_PROTOCOL, UNKNOWN_ERROR = 1000, }; ErrorCode getErrorCodeForCurlError(int curl_code); class Error { public: Error() : code{ErrorCode::OK} {} template <typename TextType> Error(const ErrorCode& p_error_code, TextType&& p_error_message) : code{p_error_code}, message{CPR_FWD(p_error_message)} {} explicit operator bool() const { return code != ErrorCode::OK; } ErrorCode code; std::string message; }; } // namespace cpr #endif
Remove prototype for deleted function qemu_handle_int
#include <linux/init.h> #include <linux/linkage.h> #include <asm/i8259.h> #include <asm/mipsregs.h> #include <asm/qemu.h> #include <asm/system.h> #include <asm/time.h> extern asmlinkage void qemu_handle_int(void); asmlinkage void plat_irq_dispatch(void) { unsigned int pending = read_c0_status() & read_c0_cause(); if (pending & 0x8000) { ll_timer_interrupt(Q_COUNT_COMPARE_IRQ); return; } if (pending & 0x0400) { int irq = i8259_irq(); if (likely(irq >= 0)) do_IRQ(irq); return; } } void __init arch_init_irq(void) { mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK; /* 100MHz */ init_i8259_irqs(); set_c0_status(0x8400); }
#include <linux/init.h> #include <linux/linkage.h> #include <asm/i8259.h> #include <asm/mipsregs.h> #include <asm/qemu.h> #include <asm/system.h> #include <asm/time.h> asmlinkage void plat_irq_dispatch(void) { unsigned int pending = read_c0_status() & read_c0_cause(); if (pending & 0x8000) { ll_timer_interrupt(Q_COUNT_COMPARE_IRQ); return; } if (pending & 0x0400) { int irq = i8259_irq(); if (likely(irq >= 0)) do_IRQ(irq); return; } } void __init arch_init_irq(void) { mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK; /* 100MHz */ init_i8259_irqs(); set_c0_status(0x8400); }
Test error reporting by writing to a temp directory
// RUN: %clang_profgen -o %t -O3 %s // RUN: env LLVM_PROFILE_FILE="/" LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s int main(int argc, const char *argv[]) { if (argc < 2) return 1; return 0; } // CHECK: LLVM Profile: Failed to write file
// RUN: %clang_profgen -o %t -O3 %s // RUN: env LLVM_PROFILE_FILE="%t/" LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s int main(int argc, const char *argv[]) { if (argc < 2) return 1; return 0; } // CHECK: LLVM Profile: Failed to write file
Add capstone dissasembly C example.
#include <stdio.h> #include <inttypes.h> #include <capstone/capstone.h> #define X86_CODE \ "\x55\x48\x8b\x05\xb8\x13\x00\x00\xe9\x14\x9e\x08\x00\x45\x31\xe4" int main(int argc, char* argv[]) { csh handle; cs_insn *insn; size_t count; int rc = 0; if (cs_open(CS_ARCH_X86, CS_MODE_64, &handle) != CS_ERR_OK) { return 1; } cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); count = cs_disasm(handle, (const uint8_t*) X86_CODE, sizeof(X86_CODE) - 1, 0x1000, 0, &insn); if (count > 0) { printf("count = %zu\n", count); for (size_t i = 0; i < count; i++) { printf("0x%"PRIx64": % - 6s %s\n", insn[i].address, insn[i].mnemonic, insn[i].op_str); } cs_free(insn, count); } else { puts("ERROR: Failed to dissasemble given code!\n"); rc = 1; } cs_close(&handle); return rc; }
Add missing TClass creation for vector<Long64_t> and vector<ULong64_t>
#include <string> #include <vector> #ifndef __hpux using namespace std; #endif #pragma create TClass vector<bool>; #pragma create TClass vector<char>; #pragma create TClass vector<short>; #pragma create TClass vector<long>; #pragma create TClass vector<unsigned char>; #pragma create TClass vector<unsigned short>; #pragma create TClass vector<unsigned int>; #pragma create TClass vector<unsigned long>; #pragma create TClass vector<float>; #pragma create TClass vector<double>; #pragma create TClass vector<char*>; #pragma create TClass vector<const char*>; #pragma create TClass vector<string>; #if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300) // gcc3.1,3.2 has a problem with iterator<void*,...,void&> #pragma create TClass vector<void*>; #endif
#include <string> #include <vector> #ifndef __hpux using namespace std; #endif #pragma create TClass vector<bool>; #pragma create TClass vector<char>; #pragma create TClass vector<short>; #pragma create TClass vector<long>; #pragma create TClass vector<unsigned char>; #pragma create TClass vector<unsigned short>; #pragma create TClass vector<unsigned int>; #pragma create TClass vector<unsigned long>; #pragma create TClass vector<float>; #pragma create TClass vector<double>; #pragma create TClass vector<char*>; #pragma create TClass vector<const char*>; #pragma create TClass vector<string>; #pragma create TClass vector<Long64_t>; #pragma create TClass vector<ULong64_t>; #if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300) // gcc3.1,3.2 has a problem with iterator<void*,...,void&> #pragma create TClass vector<void*>; #endif
Make the XFAIL line actually match x86-32 targets.
// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - > %t // RUN: not grep subq %t // RUN: not grep addq %t // RUN: grep {\\-4(%%rsp)} %t | count 2 // RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - -mno-red-zone > %t // RUN: grep subq %t | count 1 // RUN: grep addq %t | count 1 // This is a test for x86-64, add your target below if it FAILs. // XFAIL: alpha|ia64|arm|powerpc|sparc|x86 long double f0(float f) { return f; }
// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - > %t // RUN: not grep subq %t // RUN: not grep addq %t // RUN: grep {\\-4(%%rsp)} %t | count 2 // RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - -mno-red-zone > %t // RUN: grep subq %t | count 1 // RUN: grep addq %t | count 1 // This is a test for x86-64, add your target below if it FAILs. // XFAIL: alpha|ia64|arm|powerpc|sparc|i.86 long double f0(float f) { return f; }
Add subroutine daemon for Game
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2012 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */
Add a macro UNREFED_VAR to silence unused variables warning.
/* @ 0xCCCCCCCC */ #if defined(_MSC_VER) #pragma once #endif #ifndef KBASE_BASIC_MACROS_H_ #define KBASE_BASIC_MACROS_H_ #define DISALLOW_COPY(CLASSNAME) \ CLASSNAME(const CLASSNAME&) = delete; \ CLASSNAME& operator=(const CLASSNAME&) = delete #define DISALLOW_MOVE(CLASSNAME) \ CLASSNAME(CLASSNAME&&) = delete; \ CLASSNAME& operator=(CLASSNAME&&) = delete #endif // KBASE_BASIC_MACROS_H_
/* @ 0xCCCCCCCC */ #if defined(_MSC_VER) #pragma once #endif #ifndef KBASE_BASIC_MACROS_H_ #define KBASE_BASIC_MACROS_H_ #define DISALLOW_COPY(CLASSNAME) \ CLASSNAME(const CLASSNAME&) = delete; \ CLASSNAME& operator=(const CLASSNAME&) = delete #define DISALLOW_MOVE(CLASSNAME) \ CLASSNAME(CLASSNAME&&) = delete; \ CLASSNAME& operator=(CLASSNAME&&) = delete #define UNREFED_VAR(x) \ ::kbase::internal::SilenceUnusedVariableWarning(x) // Put complicated implementation below. namespace kbase { namespace internal { template<typename T> void SilenceUnusedVariableWarning(T&&) {} } // namespace internal } // namespace kbase #endif // KBASE_BASIC_MACROS_H_
Make token notifier method instance method
#import <Foundation/Foundation.h> @protocol TGSessionTokenNotifier <NSObject> +(void)sessionTokenSet:(NSString*)token; @end
#import <Foundation/Foundation.h> @protocol TGSessionTokenNotifier <NSObject> -(void)sessionTokenSet:(NSString*)token; @end
Revert "for each input path.2"
/* * SearchCubePruning.h * * Created on: 16 Nov 2015 * Author: hieu */ #pragma once #include <vector> #include <boost/unordered_map.hpp> #include "Search.h" class Bitmap; class SearchCubePruning : public Search { public: SearchCubePruning(Manager &mgr, Stacks &stacks); virtual ~SearchCubePruning(); void Decode(size_t stackInd); const Hypothesis *GetBestHypothesis() const; protected: boost::unordered_map<Bitmap*, std::vector<const Hypothesis*> > m_hyposPerBM; };
/* * SearchCubePruning.h * * Created on: 16 Nov 2015 * Author: hieu */ #ifndef SEARCH_SEARCHCUBEPRUNING_H_ #define SEARCH_SEARCHCUBEPRUNING_H_ #include "Search.h" class SearchCubePruning : public Search { public: SearchCubePruning(Manager &mgr, Stacks &stacks); virtual ~SearchCubePruning(); void Decode(size_t stackInd); const Hypothesis *GetBestHypothesis() const; }; #endif /* SEARCH_SEARCHCUBEPRUNING_H_ */
Stop the headers of debugging perls to generate gcc brace groups.
#ifndef PERL_MONGO #define PERL_MONGO #include <mongo/client/dbclient.h> extern "C" { #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #define PERL_MONGO_CALL_BOOT(name) perl_mongo_call_xs (aTHX_ name, cv, mark) void perl_mongo_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *cv), CV *cv, SV **mark); SV *perl_mongo_call_reader (SV *self, const char *reader); void perl_mongo_attach_ptr_to_instance (SV *self, void *ptr); void *perl_mongo_get_ptr_from_instance (SV *self); SV *perl_mongo_construct_instance (const char *klass, ...); SV *perl_mongo_construct_instance_va (const char *klass, va_list ap); SV *perl_mongo_construct_instance_with_magic (const char *klass, void *ptr, ...); SV *perl_mongo_bson_to_sv (const char *oid_class, mongo::BSONObj obj); mongo::BSONObj perl_mongo_sv_to_bson (SV *sv, const char *oid_class); } #endif
#ifndef PERL_MONGO #define PERL_MONGO #include <mongo/client/dbclient.h> extern "C" { #define PERL_GCC_BRACE_GROUPS_FORBIDDEN #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #define PERL_MONGO_CALL_BOOT(name) perl_mongo_call_xs (aTHX_ name, cv, mark) void perl_mongo_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *cv), CV *cv, SV **mark); SV *perl_mongo_call_reader (SV *self, const char *reader); void perl_mongo_attach_ptr_to_instance (SV *self, void *ptr); void *perl_mongo_get_ptr_from_instance (SV *self); SV *perl_mongo_construct_instance (const char *klass, ...); SV *perl_mongo_construct_instance_va (const char *klass, va_list ap); SV *perl_mongo_construct_instance_with_magic (const char *klass, void *ptr, ...); SV *perl_mongo_bson_to_sv (const char *oid_class, mongo::BSONObj obj); mongo::BSONObj perl_mongo_sv_to_bson (SV *sv, const char *oid_class); } #endif
Add high-level write and read functions
// Derived from blog post at http://www.ermicro.com/blog/?p=1239 #ifndef __I2C_UTILS_H__ #define __I2C_UTILS_H__ #define I2C_MAX_TRIES 50 // Connection attempts (0 < tries < 255) #define I2C_START 0 #define I2C_DATA 1 #define I2C_DATA_ACK 2 #define I2C_STOP 3 void i2c_init(void); unsigned char i2c_transmit(unsigned char type); char i2c_start(unsigned int dev_id, unsigned int dev_addr, unsigned char rw_type); void i2c_stop(void); char i2c_write(char data); char i2c_read(char *data, char ack_type); #endif /*__I2C_UTILS_H__*/
// Derived from blog post at http://www.ermicro.com/blog/?p=1239 #ifndef __I2C_UTILS_H__ #define __I2C_UTILS_H__ #include <compat/twi.h> #define I2C_MAX_TRIES 50 // Connection attempts (0 < tries < 255) #define I2C_START 0 #define I2C_DATA 1 #define I2C_DATA_ACK 2 #define I2C_STOP 3 #define I2C_SCL 100000L // Set I2C clock to 100 kHz void i2c_init(void); uint8_t i2c_transmit(uint8_t type); char i2c_start(uint8_t dev_addr, uint8_t rw_type); void i2c_stop(void); char i2c_write(char data); char i2c_read(char *data, char ack_type); // Higher-level convenience functions composed from functions above. void i2c_write_byte(uint8_t dev_addr, char data); void i2c_write_byte_to_register(uint8_t dev_addr, uint8_t reg, char data); uint8_t i2c_read_byte_from_register(uint8_t dev_addr, uint8_t reg_addr); #endif /*__I2C_UTILS_H__*/
Fix standard-nonconst vla test commands
// RUN: %ocheck 1 '-DNULL=(void *)0' // RUN: %ocheck 0 '-DNULL=0' int null_is_ptr_type() { char s[1][1+(int)NULL]; int i = 0; sizeof s[i++]; return i; } main() { return null_is_ptr_type(); }
// RUN: %ocheck 1 %s '-DNULL=(void *)0' // RUN: %ocheck 0 %s '-DNULL=0' int null_is_ptr_type() { char s[1][1+(int)NULL]; int i = 0; sizeof s[i++]; return i; } main() { return null_is_ptr_type(); }
Fix a linking issue found by lint
// // Messages.h // Pods // // Created by Tyler Clemens on 6/2/16. // // #import <Foundation/Foundation.h> #import "STMMessage.h" @protocol MessagesDelegate <NSObject> @optional - (void)MessagesResults:(NSArray *_Nullable)arrayMessages; - (void)UnreadMessageResults:(NSNumber *_Nullable)count; @end @interface Messages : NSObject <STMHTTPResponseHandlerDelegate> + (void)initAll; + (void)freeAll; + (Messages *_Nonnull)controller; - (void)requestForMessagesWithDelegate:(id<MessagesDelegate> _Nullable)delegate; - (void)requestForUnreadMessageCountWithDelegate:(id<MessagesDelegate> _Nullable)delegate; - (void)requestForMessage:(NSString * _Nonnull)messageId completionHandler:(void (^_Nullable)(NSError *_Nullable, id _Nullable))completionHandler; - (void)cancelAllRequests; @end
// // Messages.h // Pods // // Created by Tyler Clemens on 6/2/16. // // #import <Foundation/Foundation.h> #import "STMMessage.h" #import "STMNetworking.h" @protocol MessagesDelegate <NSObject> @optional - (void)MessagesResults:(NSArray *_Nullable)arrayMessages; - (void)UnreadMessageResults:(NSNumber *_Nullable)count; @end @interface Messages : NSObject <STMHTTPResponseHandlerDelegate> + (void)initAll; + (void)freeAll; + (Messages *_Nonnull)controller; - (void)requestForMessagesWithDelegate:(id<MessagesDelegate> _Nullable)delegate; - (void)requestForUnreadMessageCountWithDelegate:(id<MessagesDelegate> _Nullable)delegate; - (void)requestForMessage:(NSString * _Nonnull)messageId completionHandler:(void (^_Nullable)(NSError *_Nullable, id _Nullable))completionHandler; - (void)cancelAllRequests; @end
Change this comment to helpfully explain why it's there.
#include <Sub/Types.h> // Private
#include <Sub/Types.h> // This comment ensures that this file is not identical to // HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h
Prepare RELAP-7 for MooseVariable::sln() const update.
#ifndef ONEDMASSFLUX_H #define ONEDMASSFLUX_H #include "Kernel.h" class OneDMassFlux; template<> InputParameters validParams<OneDMassFlux>(); /** * Mass flux */ class OneDMassFlux : public Kernel { public: OneDMassFlux(const InputParameters & parameters); virtual ~OneDMassFlux(); protected: virtual Real computeQpResidual(); virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int jvar); VariableValue & _rhouA; unsigned int _rhouA_var_number; }; #endif /* ONEDMASSFLUX_H */
#ifndef ONEDMASSFLUX_H #define ONEDMASSFLUX_H #include "Kernel.h" class OneDMassFlux; template<> InputParameters validParams<OneDMassFlux>(); /** * Mass flux */ class OneDMassFlux : public Kernel { public: OneDMassFlux(const InputParameters & parameters); virtual ~OneDMassFlux(); protected: virtual Real computeQpResidual(); virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int jvar); const VariableValue & _rhouA; unsigned int _rhouA_var_number; }; #endif /* ONEDMASSFLUX_H */
Remove use of using-directive for std
#include <string> using namespace std; /* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */ void tokenizeString(const string& str, vector<string>& tokens, const string& delimiters) { // Skip delimiters at beginning. string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". string::size_type pos = str.find_first_of(delimiters, lastPos); while (string::npos != pos || string::npos != lastPos) { // Found a token, add it to the vector. tokens.push_back(str.substr(lastPos, pos - lastPos)); // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } }
#include <string> /* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */ void tokenizeString(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters) { // Skip delimiters at beginning. std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". std::string::size_type pos = str.find_first_of(delimiters, lastPos); while (std::string::npos != pos || std::string::npos != lastPos) { // Found a token, add it to the vector. tokens.push_back(str.substr(lastPos, pos - lastPos)); // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } }
Test defexc with large integers
//PARAM: --enable ana.int.interval --disable exp.lower-constants #include <assert.h> int main(){ int a = 0; // maximum value for ulonglong unsigned long long x = 18446744073709551615ull; if(x > 18446744073709551612ull){ a = 1; } assert(a); unsigned long long y = x + 4; // Unsigned overflow -- The following assertion should succeed assert(y == 3); // maximum value for long long signed long long s = 9223372036854775807; assert(s > 9223372036854775806); signed long long t = s + 2; // Signed overflow -- The following assertion must be UNKNOWN! assert(t == 1); // UNKNOWN! return 0; }
//PARAM: --disable ana.int.interval #include <assert.h> int main(){ int a = 0; // maximum value for ulonglong unsigned long long x = 18446744073709551615ull; if(x > 18446744073709551612ull){ a = 1; } assert(a); unsigned long long y = x + 4; // Unsigned overflow -- The following assertion should succeed assert(y == 3); // maximum value for long long signed long long s = 9223372036854775807; assert(s > 9223372036854775806); signed long long t = s + 2; // Signed overflow -- The following assertion must be UNKNOWN! assert(t == 1); // UNKNOWN! return 0; }
Reduce size of neighbour and interface table.
#define BUF_SIZE 4096 #define MAXINTERFACES 10 #define MAXNEIGHBOURS 20 #define MESSAGE_PAD1 0 #define MESSAGE_PADN 1 #define MESSAGE_ACK_REQ 2 #define MESSAGE_ACK 3 #define MESSAGE_HELLO 4 #define MESSAGE_IHU 5 #define MESSAGE_ROUTER_ID 6 #define MESSAGE_NH 7 #define MESSAGE_UPDATE 8 #define MESSAGE_REQUEST 9 #define MESSAGE_MH_REQUEST 10 #define AE_WILDCARD 0 #define AE_IPV4 1 #define AE_IPV6 2 #define AE_LL 3 #define INFINITY 0xFFFF
#define BUF_SIZE 4096 #define MAXINTERFACES 5 #define MAXNEIGHBOURS 10 #define MESSAGE_PAD1 0 #define MESSAGE_PADN 1 #define MESSAGE_ACK_REQ 2 #define MESSAGE_ACK 3 #define MESSAGE_HELLO 4 #define MESSAGE_IHU 5 #define MESSAGE_ROUTER_ID 6 #define MESSAGE_NH 7 #define MESSAGE_UPDATE 8 #define MESSAGE_REQUEST 9 #define MESSAGE_MH_REQUEST 10 #define AE_WILDCARD 0 #define AE_IPV4 1 #define AE_IPV6 2 #define AE_LL 3 #define INFINITY 0xFFFF
FIx build of G.726 codec wrapper with older versions of SpanDSP.
// // Copyright (C) 2007 SIPez LLC. // Licensed to SIPfoundry under a Contributor Agreement. // // Copyright (C) 2007 SIPfoundry Inc. // Licensed by SIPfoundry under the LGPL license. // // $$ /////////////////////////////////////////////////////////////////////////////// // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com> #ifndef _plgg726_h_ #define _plgg726_h_ #include <mp/codecs/PlgDefsV1.h> #include <spandsp/bitstream.h> #include <spandsp/g726.h> int internal_decode_g726(void* handle, const void* pCodedData, unsigned cbCodedPacketSize, void* pAudioBuffer, unsigned cbBufferSize, unsigned *pcbCodedSize, const struct RtpHeader* pRtpHeader); int internal_encode_g726(void* handle, const void* pAudioBuffer, unsigned cbAudioSamples, int* rSamplesConsumed, void* pCodedData, unsigned cbMaxCodedData, int* pcbCodedSize, unsigned* pbSendNow); #endif
// // Copyright (C) 2007 SIPez LLC. // Licensed to SIPfoundry under a Contributor Agreement. // // Copyright (C) 2007 SIPfoundry Inc. // Licensed by SIPfoundry under the LGPL license. // // $$ /////////////////////////////////////////////////////////////////////////////// // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com> #ifndef _plgg726_h_ #define _plgg726_h_ #include <mp/codecs/PlgDefsV1.h> #include <spandsp/bitstream.h> #include <spandsp/g726.h> #ifndef G726_PACKING_NONE #define G726_PACKING_NONE 0 #endif #ifndef G726_ENCODING_LINEAR #define G726_ENCODING_LINEAR 0 #endif int internal_decode_g726(void* handle, const void* pCodedData, unsigned cbCodedPacketSize, void* pAudioBuffer, unsigned cbBufferSize, unsigned *pcbCodedSize, const struct RtpHeader* pRtpHeader); int internal_encode_g726(void* handle, const void* pAudioBuffer, unsigned cbAudioSamples, int* rSamplesConsumed, void* pCodedData, unsigned cbMaxCodedData, int* pcbCodedSize, unsigned* pbSendNow); #endif
Remove use of reserved keyboard in public header
//////////////////////////////////////////////////////////////////////////////// // // TYPHOON FRAMEWORK // Copyright 2013, Typhoon Framework Contributors // All Rights Reserved. // // NOTICE: The authors permit you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// #import <Foundation/Foundation.h> #import "TyphoonMethodSwizzler.h" @class TyphoonAssembly; @interface TyphoonAssemblyAdviser : NSObject + (BOOL)assemblyClassIsAdvised:(Class)class; - (id)initWithAssembly:(TyphoonAssembly *)assembly; - (void)adviseAssembly; - (NSSet *)definitionSelectors; - (NSDictionary *)assemblyClassPerDefinitionKey; @property(readonly, weak) TyphoonAssembly *assembly; @property(nonatomic, strong) id <TyphoonMethodSwizzler> swizzler; @end
//////////////////////////////////////////////////////////////////////////////// // // TYPHOON FRAMEWORK // Copyright 2013, Typhoon Framework Contributors // All Rights Reserved. // // NOTICE: The authors permit you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// #import <Foundation/Foundation.h> #import "TyphoonMethodSwizzler.h" @class TyphoonAssembly; @interface TyphoonAssemblyAdviser : NSObject + (BOOL)assemblyClassIsAdvised:(Class)klass; - (id)initWithAssembly:(TyphoonAssembly *)assembly; - (void)adviseAssembly; - (NSSet *)definitionSelectors; - (NSDictionary *)assemblyClassPerDefinitionKey; @property(readonly, weak) TyphoonAssembly *assembly; @property(nonatomic, strong) id <TyphoonMethodSwizzler> swizzler; @end
Add function that checks if a given number is multiple of three.
#include <stdio.h> #include <stdlib.h> int is_multiple_of_three(int n) { int odd_bits_cnt = 0; int even_bits_cnt = 0; if (n < 0) n = -n; if (n == 0) return 1; if (n == 1) return 0; while (n) { if (n & 0x1) { odd_bits_cnt++; } n >>= 1; if (n & 0x1) { even_bits_cnt++; } n >>= 1; } return is_multiple_of_three(abs(odd_bits_cnt - even_bits_cnt)); } int main(int argc, char** argv) { printf("Enter a number to test is it multiple of 3: "); int n = 0; scanf("%d", &n); printf(is_multiple_of_three(n) ? "true\n" : "false\n"); return 0; }
Remove rb_thread_blocking_region when SDL_Delay is called.
/* Ruby/SDL Ruby extension library for SDL Copyright (C) 2001-2007 Ohbayashi Ippei This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "rubysdl.h" static VALUE sdl_getTicks(VALUE mod) { return UINT2NUM(SDL_GetTicks()); } static VALUE delay(void* t) { SDL_Delay(*((Uint32*)t)); return Qnil; } static VALUE sdl_delay(VALUE mod,VALUE ms) { Uint32 t = NUM2UINT(ms); #ifdef HAVE_RB_THREAD_BLOCKING_REGION rb_thread_blocking_region(delay, &t, RUBY_UBF_IO, NULL); #else SDL_Delay(t); #endif return Qnil; } void rubysdl_init_time(VALUE mSDL) { rb_define_module_function(mSDL,"getTicks",sdl_getTicks,0); rb_define_module_function(mSDL,"delay",sdl_delay,1); }
/* Ruby/SDL Ruby extension library for SDL Copyright (C) 2001-2007 Ohbayashi Ippei This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "rubysdl.h" static VALUE sdl_getTicks(VALUE mod) { return UINT2NUM(SDL_GetTicks()); } static VALUE sdl_delay(VALUE mod,VALUE ms) { Uint32 t = NUM2UINT(ms); SDL_Delay(t); return Qnil; } void rubysdl_init_time(VALUE mSDL) { rb_define_module_function(mSDL,"getTicks",sdl_getTicks,0); rb_define_module_function(mSDL,"delay",sdl_delay,1); }
Revise test and see if it passes with a release-built clang.
// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s // rdar://10033986 typedef void (^BLOCK)(void); int main () { _Complex double c; BLOCK b = ^() { _Complex double z; z = z + c; }; b(); } // CHECK: define internal void @__main_block_invoke_0 // CHECK: [[C1:%.*]] = alloca { double, double }, align 8 // CHECK: [[C1]].realp = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 0 // CHECK-NEXT: [[C1]].real = load double* [[C1]].realp // CHECK-NEXT: [[C1]].imagp = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 1 // CHECK-NEXT: [[C1]].imag = load double* [[C1]].imagp
// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s // rdar://10033986 typedef void (^BLOCK)(void); int main () { _Complex double c; BLOCK b = ^() { _Complex double z; z = z + c; }; b(); } // CHECK: define internal void @__main_block_invoke_0 // CHECK: [[C1:%.*]] = alloca { double, double }, align 8 // CHECK: [[RP:%.*]] = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 0 // CHECK-NEXT: [[R:%.*]] = load double* [[RP]] // CHECK-NEXT: [[IP:%.*]] = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 1 // CHECK-NEXT: [[I:%.*]] = load double* [[IP]]
Update skia milestone to next
/* * 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 53 #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 54 #endif
Add a very simple finalizer implementation
// Written by Arthur O'Dwyer #pragma once template <class Lambda> class AtScopeExit { Lambda& m_lambda; public: AtScopeExit(Lambda& action) : m_lambda(action) {} ~AtScopeExit() { m_lambda(); } }; #define Auto_INTERNAL2(lname, aname, ...) \ auto lname = [&]() { __VA_ARGS__; }; \ AtScopeExit<decltype(lname)> aname(lname); #define Auto_TOKENPASTE(x, y) Auto_##x##y #define Auto_INTERNAL1(ctr, ...) \ Auto_INTERNAL2(Auto_TOKENPASTE(func_, ctr), Auto_TOKENPASTE(instance_, ctr), \ __VA_ARGS__) #define Auto(...) Auto_INTERNAL1(__COUNTER__, __VA_ARGS__)
Fix build - remove relative import path
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <UIKit/UIKit.h> #import "../../ReactKit/Base/RCTBridgeModule.h" @interface RCTPushNotificationManager : NSObject <RCTBridgeModule> - (instancetype)initWithInitialNotification:(NSDictionary *)initialNotification NS_DESIGNATED_INITIALIZER; + (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; + (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification; + (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation; @end
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <UIKit/UIKit.h> #import "RCTBridgeModule.h" @interface RCTPushNotificationManager : NSObject <RCTBridgeModule> - (instancetype)initWithInitialNotification:(NSDictionary *)initialNotification NS_DESIGNATED_INITIALIZER; + (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; + (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification; + (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation; @end
Add macros for defining event fields & formats
#ifndef LINUX_POWERPC_PERF_HV_COMMON_H_ #define LINUX_POWERPC_PERF_HV_COMMON_H_ #include <linux/types.h> struct hv_perf_caps { u16 version; u16 collect_privileged:1, ga:1, expanded:1, lab:1, unused:12; }; unsigned long hv_perf_caps_get(struct hv_perf_caps *caps); #endif
#ifndef LINUX_POWERPC_PERF_HV_COMMON_H_ #define LINUX_POWERPC_PERF_HV_COMMON_H_ #include <linux/perf_event.h> #include <linux/types.h> struct hv_perf_caps { u16 version; u16 collect_privileged:1, ga:1, expanded:1, lab:1, unused:12; }; unsigned long hv_perf_caps_get(struct hv_perf_caps *caps); #define EVENT_DEFINE_RANGE_FORMAT(name, attr_var, bit_start, bit_end) \ PMU_FORMAT_ATTR(name, #attr_var ":" #bit_start "-" #bit_end); \ EVENT_DEFINE_RANGE(name, attr_var, bit_start, bit_end) #define EVENT_DEFINE_RANGE(name, attr_var, bit_start, bit_end) \ static u64 event_get_##name##_max(void) \ { \ BUILD_BUG_ON((bit_start > bit_end) \ || (bit_end >= (sizeof(1ull) * 8))); \ return (((1ull << (bit_end - bit_start)) - 1) << 1) + 1; \ } \ static u64 event_get_##name(struct perf_event *event) \ { \ return (event->attr.attr_var >> (bit_start)) & \ event_get_##name##_max(); \ } #endif
Print the size of the polygon
#include <polygon.h> int main(int argc, char* argv[]) { Polygon lol; lol=createPolygon(); lol=addPoint(lol, createPoint(12.6,-5.3)); lol=addPoint(lol, createPoint(-4.1,456.123)); printf("\n\nx premier point : %f", lol->value.x); printf("\ny premier point : %f\n\n", lol->value.y); printf("\n\nx 2eme point : %f", lol->next->value.x); printf("\ny 2eme point : %f\n\n", lol->next->value.y); printf("\n\nx 3eme point : %f", lol->next->next->value.x); printf("\ny 3eme point : %f\n\n", lol->next->next->value.y); return EXIT_SUCCESS; }
#include <polygon.h> int main(int argc, char* argv[]) { Polygon lol; lol=createPolygon(); lol=addPoint(lol, createPoint(12.6,-5.3)); lol=addPoint(lol, createPoint(-4.1,456.123)); printf("\n\ntaille : %d", lol.size); printf("\n\nx premier point : %f", lol.head->value.x); printf("\ny premier point : %f\n\n", lol.head->value.y); printf("\n\nx 2eme point : %f", lol.head->next->value.x); printf("\ny 2eme point : %f\n\n", lol.head->next->value.y); printf("\n\nx 3eme point : %f", lol.head->next->next->value.x); printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y); return EXIT_SUCCESS; }
Use Apple recommended format for error domain string
#import <Foundation/Foundation.h> #ifndef CMHErrors_h #define CMHErrors_h static NSString *const CMHErrorDomain = @"CMHErrorDomain"; typedef NS_ENUM(NSUInteger, CMHError) { CMHErrorUserMissingConsent = 700, CMHErrorUserMissingSignature = 701, CMHErrorUserDidNotConsent = 702, CMHErrorUserDidNotProvideName = 703, CMHErrorUserDidNotSign = 704 }; #endif
#import <Foundation/Foundation.h> #ifndef CMHErrors_h #define CMHErrors_h static NSString *const CMHErrorDomain = @"me.cloudmine.CMHealth.ErrorDomain"; typedef NS_ENUM(NSUInteger, CMHError) { CMHErrorUserMissingConsent = 700, CMHErrorUserMissingSignature = 701, CMHErrorUserDidNotConsent = 702, CMHErrorUserDidNotProvideName = 703, CMHErrorUserDidNotSign = 704 }; #endif
Fix interrogate understanding of PY_VERSION_HEX
// Filename: Python.h // Created by: drose (12May00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// // This file, and all the other files in this directory, aren't // intended to be compiled--they're just parsed by CPPParser (and // interrogate) in lieu of the actual system headers, to generate the // interrogate database. #ifndef PYTHON_H #define PYTHON_H class PyObject; class PyThreadState; typedef int Py_ssize_t; struct Py_buffer; #endif // PYTHON_H
// Filename: Python.h // Created by: drose (12May00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// // This file, and all the other files in this directory, aren't // intended to be compiled--they're just parsed by CPPParser (and // interrogate) in lieu of the actual system headers, to generate the // interrogate database. #ifndef PYTHON_H #define PYTHON_H class PyObject; class PyThreadState; typedef int Py_ssize_t; struct Py_buffer; // This file defines PY_VERSION_HEX, which is used in some places. #include "patchlevel.h" #endif // PYTHON_H
Change example_iwdg to use printf instead of usb_transmit
#include <stdint.h> #include <stdbool.h> #include <stdio.h> #include <stm32f4xx_hal.h> #include <board_driver/usb/usb.h> #include <board_driver/iwdg.h> int main(void) { usb_init(); HAL_Delay(1000); setup_IWDG(); init_IWDG(); char start[] = "Starting\r\n"; usb_transmit(start, sizeof(start)/sizeof(start[0])); while (1) { char str[] = "Hello usb\r\n"; usb_transmit(str, sizeof(str)/sizeof(str[0])); HAL_Delay(500); } }
#include <stdint.h> #include <stdbool.h> #include <stdio.h> #include <stm32f4xx_hal.h> #include <board_driver/usb/usb.h> #include <board_driver/iwdg.h> int main(void) { usb_init(); HAL_Delay(1000); setup_IWDG(); init_IWDG(); printf("Starting\r\n"); while (1) { printf("Hello usb\r\n"); HAL_Delay(500); } }
Add a function to remove whole directorys on fatal signal. Doxygenify function comments.
//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines some helpful functions for dealing with the possibility of // unix signals occuring while your program is running. // //===----------------------------------------------------------------------===// #ifndef LLVM_SYSTEM_SIGNALS_H #define LLVM_SYSTEM_SIGNALS_H #include <string> namespace llvm { /// RemoveFileOnSignal - This function registers signal handlers to ensure /// that if a signal gets delivered that the named file is removed. /// void RemoveFileOnSignal(const std::string &Filename); /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or /// SIGSEGV) is delivered to the process, print a stack trace and then exit. void PrintStackTraceOnErrorSignal(); } // End llvm namespace #endif
//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines some helpful functions for dealing with the possibility of // unix signals occuring while your program is running. // //===----------------------------------------------------------------------===// #ifndef LLVM_SYSTEM_SIGNALS_H #define LLVM_SYSTEM_SIGNALS_H #include "llvm/System/Path.h" namespace llvm { /// This function registers signal handlers to ensure that if a signal gets /// delivered that the named file is removed. /// @brief Remove a file if a fatal signal occurs. void RemoveFileOnSignal(const std::string &Filename); /// This function registers a signal handler to ensure that if a fatal signal /// gets delivered to the process that the named directory and all its /// contents are removed. /// @brief Remove a directory if a fatal signal occurs. void RemoveDirectoryOnSignal(const llvm::sys::Path& path); /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the /// process, print a stack trace and then exit. /// @brief Print a stack trace if a fatal signal occurs. void PrintStackTraceOnErrorSignal(); } // End llvm namespace #endif
Fix outdated function reference in Cairo documentation
/* Copyright 2012-2020 David Robillard <d@drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** @file pugl_cairo.h @brief Declaration of Cairo backend accessor. */ #ifndef PUGL_PUGL_CAIRO_H #define PUGL_PUGL_CAIRO_H #include "pugl/pugl.h" PUGL_BEGIN_DECLS /** @defgroup cairo Cairo Cairo graphics support. @ingroup pugl_c @{ */ /** Cairo graphics backend accessor. Pass the return value to puglInitBackend() to draw to a view with Cairo. */ PUGL_API PUGL_CONST_FUNC const PuglBackend* puglCairoBackend(void); /** @} */ PUGL_END_DECLS #endif // PUGL_PUGL_CAIRO_H
/* Copyright 2012-2020 David Robillard <d@drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** @file pugl_cairo.h @brief Declaration of Cairo backend accessor. */ #ifndef PUGL_PUGL_CAIRO_H #define PUGL_PUGL_CAIRO_H #include "pugl/pugl.h" PUGL_BEGIN_DECLS /** @defgroup cairo Cairo Cairo graphics support. @ingroup pugl_c @{ */ /** Cairo graphics backend accessor. Pass the return value to puglSetBackend() to draw to a view with Cairo. */ PUGL_API PUGL_CONST_FUNC const PuglBackend* puglCairoBackend(void); /** @} */ PUGL_END_DECLS #endif // PUGL_PUGL_CAIRO_H
Add jack types to dt-bindings
#ifndef __AUDIO_JACK_EVENTS_H #define __AUDIO_JACK_EVENTS_H #define JACK_HEADPHONE 1 #define JACK_MICROPHONE 2 #define JACK_LINEOUT 3 #define JACK_LINEIN 4 #endif /* __AUDIO_JACK_EVENTS_H */
Send simulated keystrokes as a single atomic event
#pragma once #include <Windows.h> class FakeKeyboard { public: static void SimulateKeypress(unsigned short vk) { INPUT input = { 0 }; input.type = INPUT_KEYBOARD; input.ki.wVk = vk; input.ki.wScan = 0; input.ki.dwFlags = 0; input.ki.time = 0; input.ki.dwExtraInfo = GetMessageExtraInfo(); /* key down: */ SendInput(1, &input, sizeof(INPUT)); /* key up: */ input.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, &input, sizeof(INPUT)); } };
#pragma once #include <Windows.h> class FakeKeyboard { public: static void SimulateKeypress(unsigned short vk) { unsigned int scan = MapVirtualKey(vk, MAPVK_VK_TO_VSC); INPUT input[2]; input[0] = { 0 }; input[0].type = INPUT_KEYBOARD; input[0].ki.wVk = vk; input[0].ki.wScan = scan; input[0].ki.dwFlags = KEYEVENTF_SCANCODE; input[0].ki.time = 0; input[0].ki.dwExtraInfo = GetMessageExtraInfo(); input[1] = { 0 }; input[1].type = INPUT_KEYBOARD; input[1].ki.wVk = vk; input[1].ki.wScan = scan; input[1].ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP; input[1].ki.time = 0; input[1].ki.dwExtraInfo = GetMessageExtraInfo(); UINT result = SendInput(2, input, sizeof(INPUT)); } };
Rework idle thread a little
/** * @file * * @date Jul 18, 2013 * @author: Anton Bondarev */ #include <kernel/task.h> #include <kernel/thread.h> #include <kernel/thread/thread_alloc.h> #include <hal/arch.h> /*only for arch_idle */ #include <hal/cpu.h> #include <kernel/cpu/cpu.h> /* * Function, which does nothing. For idle_thread. */ static void *idle_run(void *arg) { while (true) { arch_idle(); } return NULL; } struct thread *idle_thread_create(void) { struct thread *t; sched_priority_t prior; if (!(t = thread_alloc())) { return NULL; } thread_init(t, THREAD_FLAG_NOTASK | THREAD_FLAG_SUSPENDED, idle_run, NULL); t->task = task_kernel_task(); t->task->main_thread = t; prior = sched_priority_full(t->task->priority, THREAD_PRIORITY_MIN); thread_priority_set(t, prior); cpu_init(cpu_get_id(), t); return t; }
/** * @file * * @date Jul 18, 2013 * @author: Anton Bondarev */ #include <kernel/task.h> #include <kernel/thread.h> #include <err.h> #include <kernel/thread/thread_alloc.h> #include <hal/arch.h> /*only for arch_idle */ #include <hal/cpu.h> #include <kernel/cpu/cpu.h> /* * Function, which does nothing. For idle_thread. */ static void *idle_run(void *arg) { while (true) { arch_idle(); } return NULL; } struct thread *idle_thread_create(void) { struct thread *t; t = thread_create(THREAD_FLAG_NOTASK | THREAD_FLAG_SUSPENDED, idle_run, NULL); if(err(t)) { return NULL; } t->task = task_kernel_task(); t->task->main_thread = t; thread_priority_init(t, SCHED_PRIORITY_MIN); cpu_init(cpu_get_id(), t); return t; }
Allow for loop delays up to 2^4 ms. Allow for baud rates up to 2^32.
#include "ArduinoHeader.h" #include <EEPROMex.h> #include <Logging.h> // Configuration version to determine data integrity. #define CONFIG_VERSION "000" // Size of the configuration block memory pool. #define CONFIG_MEMORY_SIZE 32 // EEPROM size. Bad things will happen if this isn't set correctly. #define CONFIG_EEPROM_SIZE EEPROMSizeATmega328 class ConfigurationManager { private: // Config memory address, used to determine where to read and write data. int configuration_address = 0; struct Configuration { char version[4]; bool debug; uint8_t loop_delay; struct { uint8_t input_buffer_size; uint16_t baud_rate; } serial; } DEFAULT_CONFIGURATION = { CONFIG_VERSION, true, 50, { 50, 9600 } }; public: Configuration data = DEFAULT_CONFIGURATION; ConfigurationManager(); void load(char* = 0); void save(char* = 0); };
#include "ArduinoHeader.h" #include <EEPROMex.h> #include <Logging.h> // Configuration version to determine data integrity. #define CONFIG_VERSION "001" // Size of the configuration block memory pool. #define CONFIG_MEMORY_SIZE 32 // EEPROM size. Bad things will happen if this isn't set correctly. #define CONFIG_EEPROM_SIZE EEPROMSizeATmega328 class ConfigurationManager { private: // Config memory address, used to determine where to read and write data. int configuration_address = 0; struct Configuration { char version[4]; bool debug; uint16_t loop_delay; struct { uint8_t input_buffer_size; uint32_t baud_rate; } serial; } DEFAULT_CONFIGURATION = { CONFIG_VERSION, true, 50, { 50, 9600 } }; public: Configuration data = DEFAULT_CONFIGURATION; ConfigurationManager(); void load(char* = 0); void save(char* = 0); };
Build structure for contribified Linux-PAM, plus some home-grown modules for FreeBSD's standard authentication methods. Although the Linux-PAM modules are present in the contrib tree, we don't use any of them.
/*- * Copyright 1998 Juniper Networks, 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 THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef PAM_MOD_MISC_H #define PAM_MOD_MISC_H #include <sys/cdefs.h> /* Options */ #define PAM_OPT_DEBUG 0x01 #define PAM_OPT_NO_WARN 0x02 #define PAM_OPT_USE_FIRST_PASS 0x04 #define PAM_OPT_TRY_FIRST_PASS 0x08 #define PAM_OPT_USE_MAPPED_PASS 0x10 #define PAM_OPT_ECHO_PASS 0x20 __BEGIN_DECLS int pam_get_pass(pam_handle_t *, const char **, const char *, int); int pam_prompt(pam_handle_t *, int, const char *, char **); int pam_std_option(int *, const char *); __END_DECLS #endif
Set default database to i1
#ifndef CONFIG_H_INCLUDED #define CONFIG_H_INCLUDED #define DBVERSION "0.0.5" #define IDXVERSION "0.0.5" #endif // CONFIG_H_INCLUDED
#ifndef CONFIG_H_INCLUDED #define CONFIG_H_INCLUDED #define DBVERSION "0.0.5" #define IDXVERSION "0.0.5" #define INITDB "i1" #endif // CONFIG_H_INCLUDED
Correct signedness to prevent some warnings.
static inline uint32_t hash_func_string(const char* key) { uint32_t hash = 0; int c; while ((c = *key++) != 0) hash = c + (hash << 6) + (hash << 16) - hash; return hash; }
static inline uint32_t hash_func_string(const char* key) { uint32_t hash = 0; uint32_t c; while ((c = (uint32_t)*key++) != 0) hash = c + (hash << 6u) + (hash << 16u) - hash; return hash; }
Fix typo in a comment: it's base58, not base48.
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base48 entry widget validator. Corrects near-miss characters and refuses characters that are no part of base48. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressValidator(QObject *parent = 0); State validate(QString &input, int &pos) const; static const int MaxAddressLength = 35; }; #endif // BITCOINADDRESSVALIDATOR_H
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base58 entry widget validator. Corrects near-miss characters and refuses characters that are not part of base58. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressValidator(QObject *parent = 0); State validate(QString &input, int &pos) const; static const int MaxAddressLength = 35; }; #endif // BITCOINADDRESSVALIDATOR_H