Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add test for assign as rval
int main() { int x; int y; x = 1; y = 1; x = y = 0; if(x != 0) return 1; if(y != 0) return 1; return 0; }
Read and print command line options in 5-3
// for exit, strtol, EXIT_SUCCESS, EXIT_FAILURE #include <stdlib.h> // for fprintf, stderr #include <stdio.h> // for bool, true, false #include <stdbool.h> /** * Options from the command line. */ struct opts { /** The filename. */ char * filename; /** The number of bytes to write. */ int num_bytes; /** Whether O_APPEND should be used. */ bool append; }; /** * Prints usage. */ static void usage(void) { fprintf(stderr, "Usage: atomic_append filename num-bytes [x]\n"); } /** * Reads command line options. */ static bool read_opts(struct opts * options, int argc, char * argv[]) { char * end; if (argc < 3 || argc > 4) { // to few or many options supplied return false; } options->filename = argv[1]; options->num_bytes = strtol(argv[2], &end, 10); if (*end != '\0') { // 2nd argument not a number return false; } // use 3rd argument to ommit O_APPEND options->append = argc != 4; // success return true; } int main(int argc, char * argv[]) { struct opts options; if (!read_opts(&options, argc, argv)) { usage(); exit(EXIT_FAILURE); } printf("filename: %s\n", options.filename); printf("num-bytes: %i\n", options.num_bytes); printf("append: %s\n", options.append ? "yes" : "no"); return 0; }
Make kernel_execve() suitable for stack unwinding
/* * This file contains various random system calls that * have a non-standard calling sequence on the Linux/i386 * platform. */ #include <linux/errno.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/smp.h> #include <linux/sem.h> #include <linux/msg.h> #include <linux/shm.h> #include <linux/stat.h> #include <linux/syscalls.h> #include <linux/mman.h> #include <linux/file.h> #include <linux/utsname.h> #include <linux/ipc.h> #include <linux/uaccess.h> #include <linux/unistd.h> #include <asm/syscalls.h> /* * Do a system call from kernel instead of calling sys_execve so we * end up with proper pt_regs. */ int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]) { long __res; asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" : "=a" (__res) : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory"); return __res; }
/* * This file contains various random system calls that * have a non-standard calling sequence on the Linux/i386 * platform. */ #include <linux/errno.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/smp.h> #include <linux/sem.h> #include <linux/msg.h> #include <linux/shm.h> #include <linux/stat.h> #include <linux/syscalls.h> #include <linux/mman.h> #include <linux/file.h> #include <linux/utsname.h> #include <linux/ipc.h> #include <linux/uaccess.h> #include <linux/unistd.h> #include <asm/syscalls.h> /* * Do a system call from kernel instead of calling sys_execve so we * end up with proper pt_regs. */ int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]) { long __res; asm volatile ("int $0x80" : "=a" (__res) : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory"); return __res; }
Fix Valgrind variable initialization issue.
/* This file is part of VoltDB. * Copyright (C) 2008-2019 VoltDB Inc. * * 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 VoltDB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNDOQUANTUM_RELEASE_INTEREST_H_ #define UNDOQUANTUM_RELEASE_INTEREST_H_ namespace voltdb { class UndoQuantumReleaseInterest { public: virtual void notifyQuantumRelease() = 0; virtual ~UndoQuantumReleaseInterest() {} inline bool isNewReleaseInterest(int64_t currentUndoToken) { if (m_lastSeenUndoToken == currentUndoToken) { return false; } else { m_lastSeenUndoToken = currentUndoToken; return true; } } private: int64_t m_lastSeenUndoToken; }; } #endif /* UNDOQUANTUM_H_ */
/* This file is part of VoltDB. * Copyright (C) 2008-2019 VoltDB Inc. * * 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 VoltDB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNDOQUANTUM_RELEASE_INTEREST_H_ #define UNDOQUANTUM_RELEASE_INTEREST_H_ namespace voltdb { class UndoQuantumReleaseInterest { public: UndoQuantumReleaseInterest() : m_lastSeenUndoToken(-1); virtual void notifyQuantumRelease() = 0; virtual ~UndoQuantumReleaseInterest() {} inline bool isNewReleaseInterest(int64_t currentUndoToken) { if (m_lastSeenUndoToken == currentUndoToken) { return false; } else { m_lastSeenUndoToken = currentUndoToken; return true; } } private: int64_t m_lastSeenUndoToken; }; } #endif /* UNDOQUANTUM_H_ */
Add basic implementation of progress bar methods
#pragma once #include "Control.h" #include "StatusCallback.h" class ProgressBar : public Control, public StatusCallback { public: ProgressBar(int id, Dialog &parent, bool translate = true) : Control(id, parent, translate) { } protected: virtual IFACEMETHODIMP OnProgress( unsigned long ulProgress, unsigned long ulProgressMax, unsigned long ulStatusCode, LPCWSTR szStatusText ); };
#pragma once #include "Control.h" #include "StatusCallback.h" #include <CommCtrl.h> class ProgressBar : public Control, public StatusCallback { public: ProgressBar(int id, Dialog &parent, bool translate = true) : Control(id, parent, translate) { } void Range(int min, int max) { SendMessage(_hWnd, PBM_SETRANGE32, min, max); } void Position(int pos) { SendMessage(_hWnd, PBM_SETPOS, pos, 0); } void Marquee(bool enabled, int refresh = 30) { SendMessage(_hWnd, PBM_SETMARQUEE, enabled, refresh); } protected: virtual IFACEMETHODIMP OnProgress( unsigned long ulProgress, unsigned long ulProgressMax, unsigned long ulStatusCode, LPCWSTR szStatusText ); };
CREATE mailbox<hierarchy separator> failed always.
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "commands.h" int cmd_create(Client *client) { const char *mailbox; /* <mailbox> */ if (!client_read_string_args(client, 1, &mailbox)) return FALSE; if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE)) return TRUE; if (mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep) { /* name ends with hierarchy separator - client is just informing us that it wants to create a mailbox under this name. we don't need that information. */ } else if (!client->storage->create_mailbox(client->storage, mailbox)) { client_send_storage_error(client); return TRUE; } client_send_tagline(client, "OK Create completed."); return TRUE; }
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "commands.h" int cmd_create(Client *client) { const char *mailbox; int ignore; /* <mailbox> */ if (!client_read_string_args(client, 1, &mailbox)) return FALSE; ignore = mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep; if (ignore) { /* name ends with hierarchy separator - client is just informing us that it wants to create a mailbox under this name. we don't need that information, but verify that the mailbox name is valid */ mailbox = t_strndup(mailbox, strlen(mailbox)-1); } if (!client_verify_mailbox_name(client, mailbox, FALSE, !ignore)) return TRUE; if (!ignore && !client->storage->create_mailbox(client->storage, mailbox)) { client_send_storage_error(client); return TRUE; } client_send_tagline(client, "OK Create completed."); return TRUE; }
Convert also 0x80..0x9f characters to '?'
/* Copyright (c) 2004 Timo Sirainen */ #include "lib.h" #include "str.h" #include "str-sanitize.h" void str_sanitize_append(string_t *dest, const char *src, size_t max_len) { const char *p; for (p = src; *p != '\0'; p++) { if ((unsigned char)*p < 32) break; } str_append_n(dest, src, (size_t)(p - src)); for (; *p != '\0' && max_len > 0; p++, max_len--) { if ((unsigned char)*p < 32) str_append_c(dest, '?'); else str_append_c(dest, *p); } if (*p != '\0') { str_truncate(dest, str_len(dest)-3); str_append(dest, "..."); } } const char *str_sanitize(const char *src, size_t max_len) { string_t *str; str = t_str_new(I_MIN(max_len, 256)); str_sanitize_append(str, src, max_len); return str_c(str); }
/* Copyright (c) 2004 Timo Sirainen */ #include "lib.h" #include "str.h" #include "str-sanitize.h" void str_sanitize_append(string_t *dest, const char *src, size_t max_len) { const char *p; for (p = src; *p != '\0'; p++) { if (((unsigned char)*p & 0x7f) < 32) break; } str_append_n(dest, src, (size_t)(p - src)); for (; *p != '\0' && max_len > 0; p++, max_len--) { if (((unsigned char)*p & 0x7f) < 32) str_append_c(dest, '?'); else str_append_c(dest, *p); } if (*p != '\0') { str_truncate(dest, str_len(dest)-3); str_append(dest, "..."); } } const char *str_sanitize(const char *src, size_t max_len) { string_t *str; str = t_str_new(I_MIN(max_len, 256)); str_sanitize_append(str, src, max_len); return str_c(str); }
Fix 2f21735 to actually distinguish phases.
//===--- Timer.h - Shared timers for compilation phases ---------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_TIMER_H #define SWIFT_BASIC_TIMER_H #include "swift/Basic/LLVM.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/Timer.h" namespace swift { /// A convenience class for declaring a timer that's part of the Swift /// compilation timers group. class SharedTimer { enum class State { Initial, Skipped, Enabled }; static State CompilationTimersEnabled; Optional<llvm::NamedRegionTimer> Timer; public: explicit SharedTimer(StringRef name) { if (CompilationTimersEnabled == State::Enabled) Timer.emplace(name, StringRef("Swift compilation"), StringRef("swift"), StringRef("swift related timers")); else CompilationTimersEnabled = State::Skipped; } /// Must be called before any SharedTimers have been created. static void enableCompilationTimers() { assert(CompilationTimersEnabled != State::Skipped && "a timer has already been created"); CompilationTimersEnabled = State::Enabled; } }; } // end namespace swift #endif // SWIFT_BASIC_TIMER_H
//===--- Timer.h - Shared timers for compilation phases ---------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_TIMER_H #define SWIFT_BASIC_TIMER_H #include "swift/Basic/LLVM.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/Timer.h" namespace swift { /// A convenience class for declaring a timer that's part of the Swift /// compilation timers group. class SharedTimer { enum class State { Initial, Skipped, Enabled }; static State CompilationTimersEnabled; Optional<llvm::NamedRegionTimer> Timer; public: explicit SharedTimer(StringRef name) { if (CompilationTimersEnabled == State::Enabled) Timer.emplace(name, name, "swift", "Swift compilation"); else CompilationTimersEnabled = State::Skipped; } /// Must be called before any SharedTimers have been created. static void enableCompilationTimers() { assert(CompilationTimersEnabled != State::Skipped && "a timer has already been created"); CompilationTimersEnabled = State::Enabled; } }; } // end namespace swift #endif // SWIFT_BASIC_TIMER_H
Revert "Add support for the Python Stdout Log"
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. #pragma once #include "ModuleManager.h" DECLARE_LOG_CATEGORY_EXTERN(LogPython, Log, All); class UNREALENGINEPYTHON_API FUnrealEnginePythonModule : public IModuleInterface { public: bool PythonGILAcquire(); void PythonGILRelease(); virtual void StartupModule() override; virtual void ShutdownModule() override; void RunString(char *); void RunFile(char *); void RunFileSandboxed(char *); private: void *ue_python_gil; // used by console void *main_dict; void *local_dict; void *main_module; }; struct FScopePythonGIL { FScopePythonGIL() { #if defined(UEPY_THREADING) UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython"); safeForRelease = UnrealEnginePythonModule.PythonGILAcquire(); #endif } ~FScopePythonGIL() { #if defined(UEPY_THREADING) if (safeForRelease) { UnrealEnginePythonModule.PythonGILRelease(); } #endif } FUnrealEnginePythonModule UnrealEnginePythonModule; bool safeForRelease; };
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. #pragma once #include "ModuleManager.h" DECLARE_LOG_CATEGORY_EXTERN(LogPython, Log, All); class UNREALENGINEPYTHON_API FUnrealEnginePythonModule : public IModuleInterface { public: bool PythonGILAcquire(); void PythonGILRelease(); virtual void StartupModule() override; virtual void ShutdownModule() override; void RunString(char *); void RunFile(char *); void RunFileSandboxed(char *); private: void *ue_python_gil; // used by console void *main_dict; void *local_dict; }; struct FScopePythonGIL { FScopePythonGIL() { #if defined(UEPY_THREADING) UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython"); safeForRelease = UnrealEnginePythonModule.PythonGILAcquire(); #endif } ~FScopePythonGIL() { #if defined(UEPY_THREADING) if (safeForRelease) { UnrealEnginePythonModule.PythonGILRelease(); } #endif } FUnrealEnginePythonModule UnrealEnginePythonModule; bool safeForRelease; };
Use GCC builtins instead of inline asm
#include <stdlib.h> #include "HsFFI.h" StgInt* hs_counter_new(void) { StgInt* counter = malloc(sizeof(StgInt)); *counter = 0; return counter; } void hs_counter_add(volatile StgInt* counter, StgInt n) { StgInt temp = n; #if SIZEOF_VOID_P == 8 __asm__ __volatile__("lock; xaddq %0,%1" #elif SIZEOF_VOID_P == 4 __asm__ __volatile__("lock; xaddl %0,%1" #else # error GHC untested on this architecture: sizeof(void *) != 4 or 8 #endif : "+r" (temp), "+m" (*counter) : : "cc", "memory"); } StgInt hs_counter_read(volatile const StgInt* counter) { return *counter; }
#include <stdlib.h> #include "HsFFI.h" StgInt* hs_counter_new(void) { StgInt* counter = malloc(sizeof(StgInt)); *counter = 0; return counter; } void hs_counter_add(volatile StgInt* counter, StgInt n) { __sync_fetch_and_add(counter, n); } StgInt hs_counter_read(volatile const StgInt* counter) { return *counter; }
Revert "tests: Call ssh_init() and ssh_finalize() before we run the tests."
#include <stdio.h> #include <libssh/libssh.h> #include "torture.h" static int verbosity = 0; int torture_libssh_verbosity(void){ return verbosity; } int main(int argc, char **argv) { int rc; (void) argc; (void) argv; ssh_init(); rc = torture_run_tests(); ssh_finalize(); return rc; }
#include "torture.h" #include <stdio.h> static int verbosity = 0; int torture_libssh_verbosity(void){ return verbosity; } int main(int argc, char **argv) { (void) argc; (void) argv; return torture_run_tests(); }
Improve test output on failure
#include <mongoc.h> #include <mongoc-openssl-private.h> #include "TestSuite.h" static void test_extract_subject (void) { char *subject; subject = _mongoc_openssl_extract_subject (BINARY_DIR"/../certificates/client.pem"); ASSERT (0 == strcmp (subject, "CN=client,OU=kerneluser,O=10Gen,L=New York City,ST=New York,C=US")); bson_free (subject); } void test_x509_install (TestSuite *suite) { TestSuite_Add (suite, "/SSL/extract_subject", test_extract_subject); }
#include <mongoc.h> #include <mongoc-openssl-private.h> #include "TestSuite.h" static void test_extract_subject (void) { char *subject; subject = mongoc_ssl_extract_subject (BINARY_DIR"/../certificates/client.pem"); ASSERT_CMPSTR (subject, "CN=client,OU=kerneluser,O=10Gen,L=New York City,ST=New York,C=US"); bson_free (subject); } void test_x509_install (TestSuite *suite) { TestSuite_Add (suite, "/SSL/extract_subject", test_extract_subject); }
Fix for reporting specta/expecta failures on the main thread.
#import <Foundation/Foundation.h> extern NSString * const spt_kCurrentTestSuiteKey; extern NSString * const spt_kCurrentSpecKey; #define SPTCurrentTestSuite [[NSThread currentThread] threadDictionary][spt_kCurrentTestSuiteKey] #define SPTCurrentSpec [[NSThread currentThread] threadDictionary][spt_kCurrentSpecKey] #define SPTCurrentGroup [SPTCurrentTestSuite currentGroup] #define SPTGroupStack [SPTCurrentTestSuite groupStack] #define SPTReturnUnlessBlockOrNil(block) if ((block) && !SPTIsBlock((block))) return; #define SPTIsBlock(obj) [(obj) isKindOfClass:NSClassFromString(@"NSBlock")] BOOL spt_isSpecClass(Class aClass); NSString *spt_underscorize(NSString *string); NSArray *spt_map(NSArray *array, id (^block)(id obj, NSUInteger idx)); NSArray *spt_shuffle(NSArray *array); unsigned int spt_seed();
#import <Foundation/Foundation.h> extern NSString * const spt_kCurrentTestSuiteKey; extern NSString * const spt_kCurrentSpecKey; #define SPTCurrentTestSuite [[NSThread mainThread] threadDictionary][spt_kCurrentTestSuiteKey] #define SPTCurrentSpec [[NSThread mainThread] threadDictionary][spt_kCurrentSpecKey] #define SPTCurrentGroup [SPTCurrentTestSuite currentGroup] #define SPTGroupStack [SPTCurrentTestSuite groupStack] #define SPTReturnUnlessBlockOrNil(block) if ((block) && !SPTIsBlock((block))) return; #define SPTIsBlock(obj) [(obj) isKindOfClass:NSClassFromString(@"NSBlock")] BOOL spt_isSpecClass(Class aClass); NSString *spt_underscorize(NSString *string); NSArray *spt_map(NSArray *array, id (^block)(id obj, NSUInteger idx)); NSArray *spt_shuffle(NSArray *array); unsigned int spt_seed();
Remove + fix erroneous comments
// Dispatches asyncronously unless ARPerformWorkSynchronously is set on the shared dispatch manager extern void ar_dispatch_async(dispatch_block_t block); // Dispatches to the main queue unless ARPerformWorkSynchronously is set on the shared dispatch manager extern void ar_dispatch_main_queue(dispatch_block_t block); // Dispatches to a queue unless ARPerformWorkSynchronously is set on the shared dispatch manager extern void ar_dispatch_on_queue(dispatch_queue_t queue, dispatch_block_t block); extern void ar_dispatch_after_on_queue(float seconds, dispatch_queue_t queue, dispatch_block_t block); extern void ar_dispatch_after(float seconds, dispatch_block_t block); @interface ARDispatchManager : NSObject + (instancetype)sharedManager; @end
extern void ar_dispatch_async(dispatch_block_t block); extern void ar_dispatch_main_queue(dispatch_block_t block); // Dispatches to a queue unless ARPerformWorkAsynchronously is set to false extern void ar_dispatch_on_queue(dispatch_queue_t queue, dispatch_block_t block); extern void ar_dispatch_after_on_queue(float seconds, dispatch_queue_t queue, dispatch_block_t block); extern void ar_dispatch_after(float seconds, dispatch_block_t block); @interface ARDispatchManager : NSObject + (instancetype)sharedManager; @end
Add SK_API to null canvas create method
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkNullCanvas_DEFINED #define SkNullCanvas_DEFINED #include "SkBitmap.h" class SkCanvas; /** * Creates a canvas that draws nothing. This is useful for performance testing. */ SkCanvas* SkCreateNullCanvas(); #endif
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkNullCanvas_DEFINED #define SkNullCanvas_DEFINED #include "SkBitmap.h" class SkCanvas; /** * Creates a canvas that draws nothing. This is useful for performance testing. */ SK_API SkCanvas* SkCreateNullCanvas(); #endif
Add missing new files for revision 32092
#include <complex> #ifndef __hpux using namespace std; #endif #pragma create TClass std::complex<int>+; #pragma create TClass std::complex<long>+; #pragma create TClass std::complex<float>+; #pragma create TClass std::complex<double>+; #ifdef G__NATIVELONGLONG #pragma create TClass std::complex<long long>+; // #pragma create TClass std::complex<long double>+; #endif
Add a default value for TEST_SRCDIR
#ifndef __CMPTEST_H__ #define __CMPTEST_H__ #include <stdio.h> #include "sodium.h" #ifndef TEST_SRCDIR #define TEST_SRCDIR "./" #endif #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; } if (xmain() != 0) { return 99; } 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" #ifndef TEST_SRCDIR # define TEST_SRCDIR "." #endif #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; } if (xmain() != 0) { return 99; } 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
Define WSAPOLLFD only on mingw 4.x
#ifndef _FIX_WINSOCK2_H #define _FIX_WINSOCK2_H 1 #include_next <winsock2.h> typedef struct pollfd { SOCKET fd; short events; short revents; } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; #endif
#ifndef _FIX_WINSOCK2_H #define _FIX_WINSOCK2_H 1 #include_next <winsock2.h> // mingw 4.0.x has broken headers (#9246) but mingw-w64 does not. #if defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION == 4 typedef struct pollfd { SOCKET fd; short events; short revents; } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; #endif #endif // _FIX_WINSOCK2_H
Add action predicate block typedef
/* Copyright 2009-2013 Urban Airship 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 binaryform must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided withthe distribution. THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Foundation/Foundation.h> @interface UAAction : NSObject @end
/* Copyright 2009-2013 Urban Airship 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 binaryform must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided withthe distribution. THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Foundation/Foundation.h> #import "UAActionArguments.h" typedef BOOL (^UAActionPredicate)(UAActionArguments *); @interface UAAction : NSObject @end
Fix compile warning for struct/class mismatch
// Copyright 2016 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // // blaze_abrupt_exit.h: Deals with abrupt exits of the Blaze server. // #ifndef THIRD_PARTY_BAZEL_SRC_MAIN_CPP_BLAZE_ABRUPT_EXIT_H_ #define THIRD_PARTY_BAZEL_SRC_MAIN_CPP_BLAZE_ABRUPT_EXIT_H_ namespace blaze { class GlobalVariables; // Returns the exit code to use for when the Blaze server exits abruptly. int GetExitCodeForAbruptExit(const GlobalVariables& globals); } // namespace blaze #endif // THIRD_PARTY_BAZEL_SRC_MAIN_CPP_BLAZE_ABRUPT_EXIT_H_
// Copyright 2016 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // // blaze_abrupt_exit.h: Deals with abrupt exits of the Blaze server. // #ifndef THIRD_PARTY_BAZEL_SRC_MAIN_CPP_BLAZE_ABRUPT_EXIT_H_ #define THIRD_PARTY_BAZEL_SRC_MAIN_CPP_BLAZE_ABRUPT_EXIT_H_ namespace blaze { struct GlobalVariables; // Returns the exit code to use for when the Blaze server exits abruptly. int GetExitCodeForAbruptExit(const GlobalVariables& globals); } // namespace blaze #endif // THIRD_PARTY_BAZEL_SRC_MAIN_CPP_BLAZE_ABRUPT_EXIT_H_
Include header where for_each is defined
#ifndef _CPR_TYPES_H_ #define _CPR_TYPES_H_ #include <map> #include <string> #include <curl/curl.h> struct case_insensitive_compare { case_insensitive_compare() {} bool operator()(const std::string& a, const std::string& b) const { return to_lower(a) < to_lower(b); } static void char_to_lower(char& c) { if (c >= 'A' && c <= 'Z') c += ('a' - 'A'); } static std::string to_lower(const std::string& a) { std::string s(a); std::for_each(s.begin(), s.end(), char_to_lower); return s; } }; typedef std::map<std::string, std::string> Parameters; typedef std::map<std::string, std::string, case_insensitive_compare> Header; typedef std::string Url; typedef std::map<std::string, std::string> Payload; typedef long Timeout; typedef struct { CURL* handle; struct curl_slist* chunk; } CurlHolder; #endif
#ifndef _CPR_TYPES_H_ #define _CPR_TYPES_H_ #include <algorithm> #include <map> #include <string> #include <curl/curl.h> struct case_insensitive_compare { case_insensitive_compare() {} bool operator()(const std::string& a, const std::string& b) const { return to_lower(a) < to_lower(b); } static void char_to_lower(char& c) { if (c >= 'A' && c <= 'Z') c += ('a' - 'A'); } static std::string to_lower(const std::string& a) { std::string s(a); std::for_each(s.begin(), s.end(), char_to_lower); return s; } }; typedef std::map<std::string, std::string> Parameters; typedef std::map<std::string, std::string, case_insensitive_compare> Header; typedef std::string Url; typedef std::map<std::string, std::string> Payload; typedef long Timeout; typedef struct { CURL* handle; struct curl_slist* chunk; } CurlHolder; #endif
Enable Cord in NVCC build.
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_CORD_H_ #define TENSORFLOW_CORE_PLATFORM_DEFAULT_CORD_H_ #if !defined(__CUDACC__) // TODO(frankchn): Resolve compilation errors when building absl::Cord with CUDA #include "absl/strings/cord.h" #define TF_CORD_SUPPORT 1 #endif // __CUDACC__ #endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_CORD_H_
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_CORD_H_ #define TENSORFLOW_CORE_PLATFORM_DEFAULT_CORD_H_ #include "absl/strings/cord.h" #define TF_CORD_SUPPORT 1 #endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_CORD_H_
Fix assignment in concrete case for example benchmark so that bug should be deterministic.
#ifdef KLEE #include "klee/klee.h" #endif #include <assert.h> #include <stdio.h> int main() { int a; #ifdef KLEE klee_make_symbolic(&a, sizeof(a), "a"); #endif if (a == 0) { printf("a is zero\n"); #ifdef BUG assert(0); #endif } else { printf("a is non-zero\n"); } return 0; }
#ifdef KLEE #include "klee/klee.h" #endif #include <assert.h> #include <stdio.h> int main() { int a = 0; #ifdef KLEE klee_make_symbolic(&a, sizeof(a), "a"); #endif if (a == 0) { printf("a is zero\n"); #ifdef BUG assert(0); #endif } else { printf("a is non-zero\n"); } return 0; }
Include ASEditableTextNode in framework header.
/* Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <AsyncDisplayKit/ASDisplayNode.h> #import <AsyncDisplayKit/ASDisplayNodeExtras.h> #import <AsyncDisplayKit/ASControlNode.h> #import <AsyncDisplayKit/ASImageNode.h> #import <AsyncDisplayKit/ASTextNode.h> #import <AsyncDisplayKit/ASBasicImageDownloader.h> #import <AsyncDisplayKit/ASMultiplexImageNode.h> #import <AsyncDisplayKit/ASNetworkImageNode.h> #import <AsyncDisplayKit/ASTableView.h> #import <AsyncDisplayKit/ASCollectionView.h> #import <AsyncDisplayKit/ASCellNode.h>
/* Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <AsyncDisplayKit/ASDisplayNode.h> #import <AsyncDisplayKit/ASDisplayNodeExtras.h> #import <AsyncDisplayKit/ASControlNode.h> #import <AsyncDisplayKit/ASImageNode.h> #import <AsyncDisplayKit/ASTextNode.h> #import <AsyncDisplayKit/ASEditableTextNode.h> #import <AsyncDisplayKit/ASBasicImageDownloader.h> #import <AsyncDisplayKit/ASMultiplexImageNode.h> #import <AsyncDisplayKit/ASNetworkImageNode.h> #import <AsyncDisplayKit/ASTableView.h> #import <AsyncDisplayKit/ASCollectionView.h> #import <AsyncDisplayKit/ASCellNode.h>
Add datatypes for swift to represent source locations and ranges, which are distinct from the SMXXX types. This is important because SMRange and SourceRange have subtly different semantics, and is also nice to isolate SMLoc from swift.
//===- SourceLoc.h - Source Locations and Ranges ----------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines types used to reason about source locations and ranges. // //===----------------------------------------------------------------------===// #ifndef SWIFT_SOURCELOC_H #define SWIFT_SOURCELOC_H #include "swift/AST/LLVM.h" #include "llvm/Support/SMLoc.h" namespace swift { /// SourceLoc in swift is just an SMLoc. We define it as a different type /// (instead of as a typedef) just to remove the "getFromPointer" methods and /// enforce purity in the Swift codebase. class SourceLoc { public: llvm::SMLoc Value; SourceLoc() {} explicit SourceLoc(llvm::SMLoc Value) : Value(Value) {} bool isValid() const { return Value.isValid(); } bool operator==(const SourceLoc &RHS) const { return RHS.Value == Value; } bool operator!=(const SourceLoc &RHS) const { return RHS.Value != Value; } /// getAdvanced - Return a source location advanced a specified number of /// characters. SourceLoc getAdvancedLoc(unsigned NumCharacters) const { assert(isValid() && "Can't advance an invalid location"); return SourceLoc(llvm::SMLoc::getFromPointer(Value.getPointer() + NumCharacters)); } }; /// SourceRange in swift is a pair of locations. However, note that the end /// location is the start of the last token in the range, not the last character /// in the range. This is unlike SMRange, so we use a distinct type to make /// sure that proper conversions happen where important. class SourceRange { public: SourceLoc Start, End; SourceRange() {} SourceRange(SourceLoc Start, SourceLoc End) : Start(Start), End(End) { assert(Start.isValid() == End.isValid() && "Start and end should either both be valid or both be invalid!"); } bool isValid() const { return Start.isValid(); } }; } // end namespace swift #endif
Introduce USB target raw device accessor
#pragma once #include "ntddk.h" #include "wdf.h" #include "usb.h" #include "UsbSpec.h" #include "wdfusb.h" #include "Alloc.h" class CWdfUsbInterface; class CWdfUsbTarget { public: CWdfUsbTarget(); ~CWdfUsbTarget(); NTSTATUS Create(WDFDEVICE Device); void DeviceDescriptor(USB_DEVICE_DESCRIPTOR &Descriptor); NTSTATUS ConfigurationDescriptor(UCHAR Index, PUSB_CONFIGURATION_DESCRIPTOR Descriptor, PULONG TotalLength); NTSTATUS SetInterfaceAltSetting(UCHAR InterfaceIdx, UCHAR AltSettingIdx); private: WDFDEVICE m_Device = WDF_NO_HANDLE; WDFUSBDEVICE m_UsbDevice = WDF_NO_HANDLE; CObjHolder<CWdfUsbInterface> m_Interfaces; UCHAR m_NumInterfaces = 0; CWdfUsbTarget(const CWdfUsbTarget&) = delete; CWdfUsbTarget& operator= (const CWdfUsbTarget&) = delete; };
#pragma once #include "ntddk.h" #include "wdf.h" #include "usb.h" #include "UsbSpec.h" #include "wdfusb.h" #include "Alloc.h" class CWdfUsbInterface; class CWdfUsbTarget { public: CWdfUsbTarget(); ~CWdfUsbTarget(); NTSTATUS Create(WDFDEVICE Device); void DeviceDescriptor(USB_DEVICE_DESCRIPTOR &Descriptor); NTSTATUS ConfigurationDescriptor(UCHAR Index, PUSB_CONFIGURATION_DESCRIPTOR Descriptor, PULONG TotalLength); NTSTATUS SetInterfaceAltSetting(UCHAR InterfaceIdx, UCHAR AltSettingIdx); operator WDFUSBDEVICE () const { return m_UsbDevice; } private: WDFDEVICE m_Device = WDF_NO_HANDLE; WDFUSBDEVICE m_UsbDevice = WDF_NO_HANDLE; CObjHolder<CWdfUsbInterface> m_Interfaces; UCHAR m_NumInterfaces = 0; CWdfUsbTarget(const CWdfUsbTarget&) = delete; CWdfUsbTarget& operator= (const CWdfUsbTarget&) = delete; };
Add 2 missing public methods to .h, including new onStationary method
// // CDVBackgroundGeoLocation.h // // Created by Chris Scott <chris@transistorsoft.com> // #import <Cordova/CDVPlugin.h> #import "CDVLocation.h" #import <AudioToolbox/AudioToolbox.h> @interface CDVBackgroundGeoLocation : CDVPlugin <CLLocationManagerDelegate> @property (nonatomic, strong) NSString* syncCallbackId; @property (nonatomic, strong) NSMutableArray* stationaryRegionListeners; - (void) configure:(CDVInvokedUrlCommand*)command; - (void) start:(CDVInvokedUrlCommand*)command; - (void) stop:(CDVInvokedUrlCommand*)command; - (void) finish:(CDVInvokedUrlCommand*)command; - (void) onPaceChange:(CDVInvokedUrlCommand*)command; - (void) setConfig:(CDVInvokedUrlCommand*)command; - (void) onSuspend:(NSNotification *)notification; - (void) onResume:(NSNotification *)notification; @end
// // CDVBackgroundGeoLocation.h // // Created by Chris Scott <chris@transistorsoft.com> // #import <Cordova/CDVPlugin.h> #import "CDVLocation.h" #import <AudioToolbox/AudioToolbox.h> @interface CDVBackgroundGeoLocation : CDVPlugin <CLLocationManagerDelegate> @property (nonatomic, strong) NSString* syncCallbackId; @property (nonatomic, strong) NSMutableArray* stationaryRegionListeners; - (void) configure:(CDVInvokedUrlCommand*)command; - (void) start:(CDVInvokedUrlCommand*)command; - (void) stop:(CDVInvokedUrlCommand*)command; - (void) finish:(CDVInvokedUrlCommand*)command; - (void) onPaceChange:(CDVInvokedUrlCommand*)command; - (void) setConfig:(CDVInvokedUrlCommand*)command; - (void) onStationary:(CDVInvokedUrlCommand*)command; - (void) getStationaryLocation:(CDVInvokedUrlCommand *)command; - (void) onSuspend:(NSNotification *)notification; - (void) onResume:(NSNotification *)notification; @end
Include <stdlib.h> for malloc related functions.
#include <nan.h> #include <condition_variable> #include "libsass/sass_context.h" #ifdef __cplusplus extern "C" { #endif using namespace v8; void compile_data(struct Sass_Data_Context* dctx); void compile_file(struct Sass_File_Context* fctx); void compile_it(uv_work_t* req); struct sass_context_wrapper { // binding related bool is_sync; void* cookie; const char* prev; const char* file; std::mutex* importer_mutex; std::condition_variable* importer_condition_variable; // libsass related Sass_Import** imports; Sass_Data_Context* dctx; Sass_File_Context* fctx; // libuv related uv_async_t async; uv_work_t request; // v8 and nan related Persistent<Object> result; NanCallback* error_callback; NanCallback* success_callback; NanCallback* importer_callback; }; struct sass_context_wrapper* sass_make_context_wrapper(void); void sass_wrapper_dispose(struct sass_context_wrapper*, char*); void sass_free_context_wrapper(struct sass_context_wrapper*); #ifdef __cplusplus } #endif
#include <stdlib.h> #include <nan.h> #include <condition_variable> #include "libsass/sass_context.h" #ifdef __cplusplus extern "C" { #endif using namespace v8; void compile_data(struct Sass_Data_Context* dctx); void compile_file(struct Sass_File_Context* fctx); void compile_it(uv_work_t* req); struct sass_context_wrapper { // binding related bool is_sync; void* cookie; const char* prev; const char* file; std::mutex* importer_mutex; std::condition_variable* importer_condition_variable; // libsass related Sass_Import** imports; Sass_Data_Context* dctx; Sass_File_Context* fctx; // libuv related uv_async_t async; uv_work_t request; // v8 and nan related Persistent<Object> result; NanCallback* error_callback; NanCallback* success_callback; NanCallback* importer_callback; }; struct sass_context_wrapper* sass_make_context_wrapper(void); void sass_wrapper_dispose(struct sass_context_wrapper*, char*); void sass_free_context_wrapper(struct sass_context_wrapper*); #ifdef __cplusplus } #endif
Add a note to update varnishlog(1) whenever this list changes.
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(Error) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(BackendOpen) SLTM(BackendXID) SLTM(BackendReuse) SLTM(BackendClose) SLTM(HttpError) SLTM(ClientAddr) SLTM(Backend) SLTM(Request) SLTM(Response) SLTM(Length) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(Header) SLTM(BldHdr) SLTM(LostHeader) SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) SLTM(XID) SLTM(Hit) SLTM(ExpBan) SLTM(ExpPick) SLTM(ExpKill) SLTM(WorkThread)
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * * REMEMBER to update the documentation (especially the varnishlog(1) man * page) whenever this list changes. */ SLTM(Debug) SLTM(Error) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(BackendOpen) SLTM(BackendXID) SLTM(BackendReuse) SLTM(BackendClose) SLTM(HttpError) SLTM(ClientAddr) SLTM(Backend) SLTM(Request) SLTM(Response) SLTM(Length) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(Header) SLTM(BldHdr) SLTM(LostHeader) SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) SLTM(XID) SLTM(Hit) SLTM(ExpBan) SLTM(ExpPick) SLTM(ExpKill) SLTM(WorkThread)
Revert "Conditionally include CLIColor in umbrella header"
// // CocoaLumberjack.h // CocoaLumberjack // // Created by Andrew Mackenzie-Ross on 3/02/2015. // // #import <Foundation/Foundation.h> //! Project version number for CocoaLumberjack. FOUNDATION_EXPORT double CocoaLumberjackVersionNumber; //! Project version string for CocoaLumberjack. FOUNDATION_EXPORT const unsigned char CocoaLumberjackVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <CocoaLumberjack/PublicHeader.h> // Disable legacy macros #ifndef DD_LEGACY_MACROS #define DD_LEGACY_MACROS 0 #endif // Core #import <CocoaLumberjack/DDLog.h> // Main macros #import <CocoaLumberjack/DDLogMacros.h> #import <CocoaLumberjack/DDAssertMacros.h> // Capture ASL #import <CocoaLumberjack/DDASLLogCapture.h> // Loggers #import <CocoaLumberjack/DDTTYLogger.h> #import <CocoaLumberjack/DDASLLogger.h> #import <CocoaLumberjack/DDFileLogger.h> // CLI #if defined(DD_CLI) || !__has_include(<AppKit/NSColor.h>) #import <CocoaLumberjack/CLIColor.h> #endif
// // CocoaLumberjack.h // CocoaLumberjack // // Created by Andrew Mackenzie-Ross on 3/02/2015. // // #import <Foundation/Foundation.h> //! Project version number for CocoaLumberjack. FOUNDATION_EXPORT double CocoaLumberjackVersionNumber; //! Project version string for CocoaLumberjack. FOUNDATION_EXPORT const unsigned char CocoaLumberjackVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <CocoaLumberjack/PublicHeader.h> // Disable legacy macros #ifndef DD_LEGACY_MACROS #define DD_LEGACY_MACROS 0 #endif // Core #import <CocoaLumberjack/DDLog.h> // Main macros #import <CocoaLumberjack/DDLogMacros.h> #import <CocoaLumberjack/DDAssertMacros.h> // Capture ASL #import <CocoaLumberjack/DDASLLogCapture.h> // Loggers #import <CocoaLumberjack/DDTTYLogger.h> #import <CocoaLumberjack/DDASLLogger.h> #import <CocoaLumberjack/DDFileLogger.h> // CLI #import <CocoaLumberjack/CLIColor.h>
Introduce realloc_or_free(), which does what realloc() does but will free the argument if the reallocation fails. This is useful in some, but not all, use cases of realloc().
/***************************************************************************** * vlc_memory.h: Memory functions ***************************************************************************** * Copyright (C) 2009 the VideoLAN team * * Authors: JP Dinger <jpd at videolan dot org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef VLC_MEMORY_H #define VLC_MEMORY_H 1 /** * \file * This file deals with memory fixups */ /** * \defgroup memory Memory * @{ */ /** * This wrapper around realloc() will free the input pointer when * realloc() returns NULL. The use case ptr = realloc(ptr, newsize) will * cause a memory leak when ptr pointed to a heap allocation before, * leaving the buffer allocated but unreferenced. vlc_realloc() is a * drop-in replacement for that use case (and only that use case). */ static inline void *realloc_or_free( void *p, size_t sz ) { void *n = realloc(p,sz); if( !n ) free(p); return n; } /** * @} */ #endif
Fix iOS nightly release. Exports the actual c api header instead of the shim header in the TensorflowLiteC framework
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_ #define TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_ #include "tensorflow/lite/builtin_ops.h" #include "tensorflow/lite/c/c_api.h" #include "tensorflow/lite/c/c_api_experimental.h" #include "tensorflow/lite/c/c_api_types.h" #include "tensorflow/lite/c/common.h" #include "tensorflow/lite/core/c/c_api.h" #include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h" #endif // TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_ #define TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_ #include "tensorflow/lite/builtin_ops.h" #include "tensorflow/lite/c/c_api.h" #include "tensorflow/lite/c/c_api_experimental.h" #include "tensorflow/lite/c/c_api_types.h" #include "tensorflow/lite/c/common.h" #include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h" #endif // TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_
Add the missing namespace bits
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * WindowsInterfacePicker.h * Choose an interface to listen on * Copyright (C) 2005-2010 Simon Newton */ #ifndef COMMON_NETWORK_WINDOWSINTERFACEPICKER_H_ #define COMMON_NETWORK_WINDOWSINTERFACEPICKER_H_ #include <vector> #include "ola/network/InterfacePicker.h" /* * The InterfacePicker for windows */ class WindowsInterfacePicker: public InterfacePicker { public: std::vector<Interface> GetInterfaces() const; }; } // network } // ola #endif // COMMON_NETWORK_WINDOWSINTERFACEPICKER_H_
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * WindowsInterfacePicker.h * Choose an interface to listen on * Copyright (C) 2005-2010 Simon Newton */ #ifndef COMMON_NETWORK_WINDOWSINTERFACEPICKER_H_ #define COMMON_NETWORK_WINDOWSINTERFACEPICKER_H_ #include <vector> #include "ola/network/InterfacePicker.h" namespace ola { namespace network { /* * The InterfacePicker for windows */ class WindowsInterfacePicker: public InterfacePicker { public: std::vector<Interface> GetInterfaces() const; }; } // network } // ola #endif // COMMON_NETWORK_WINDOWSINTERFACEPICKER_H_
Add comment on `GetTfrtPluginDeviceClient` to explain where to put the implementation.
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_XLA_PJRT_PLUGIN_DEVICE_CLIENT_H_ #define TENSORFLOW_COMPILER_XLA_PJRT_PLUGIN_DEVICE_CLIENT_H_ namespace xla { // Not implemented by default. It is the responsibility of the plugin device // author to provide an implementation of this function. StatusOr<std::unique_ptr<PjRtClient>> GetTfrtPluginDeviceClient(); } #endif // TENSORFLOW_COMPILER_XLA_PJRT_PLUGIN_DEVICE_CLIENT_H_
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_XLA_PJRT_PLUGIN_DEVICE_CLIENT_H_ #define TENSORFLOW_COMPILER_XLA_PJRT_PLUGIN_DEVICE_CLIENT_H_ namespace xla { // Not implemented by default. It is the responsibility of the plugin device // author to provide an implementation of this function. It is recommended to // implement this in //tensorflow/compiler/plugin:plugin StatusOr<std::unique_ptr<PjRtClient>> GetTfrtPluginDeviceClient(); } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_PJRT_PLUGIN_DEVICE_CLIENT_H_
Add file that was missing from the last change
/* * Copyright (C) 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FontSmoothingMode_h #define FontSmoothingMode_h namespace WebCore { enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased }; } // namespace WebCore #endif // FontSmoothingMode_h
Include information for armv4l from Mark Knox <segfault@hardline.org>.
/* __USE_POSIX, __USE_BSD, and __USE_BSD_SIGNAL used to be defined either here or with -D compile options, but __ macros should be set and used by C library macros, not Postgres code. __USE_POSIX is set by features.h, __USE_BSD is set by bsd/signal.h, and __USE_BSD_SIGNAL appears not to be used. */ #define JMP_BUF #define USE_POSIX_TIME #if defined(__i386__) typedef unsigned char slock_t; #define HAS_TEST_AND_SET #elif defined(__sparc__) typedef unsigned char slock_t; #define HAS_TEST_AND_SET #elif defined(__powerpc__) typedef unsigned int slock_t; #define HAS_TEST_AND_SET #elif defined(__alpha__) typedef long int slock_t; #define HAS_TEST_AND_SET #elif defined(__mips__) typedef unsigned int slock_t; #define HAS_TEST_AND_SET #endif #if defined(__GLIBC__) && (__GLIBC__ >= 2) #ifdef HAVE_INT_TIMEZONE #undef HAVE_INT_TIMEZONE #endif #endif #if defined(__powerpc__) #undef HAVE_INT_TIMEZONE #endif
/* __USE_POSIX, __USE_BSD, and __USE_BSD_SIGNAL used to be defined either here or with -D compile options, but __ macros should be set and used by C library macros, not Postgres code. __USE_POSIX is set by features.h, __USE_BSD is set by bsd/signal.h, and __USE_BSD_SIGNAL appears not to be used. */ #define JMP_BUF #define USE_POSIX_TIME #if defined(__i386__) typedef unsigned char slock_t; #define HAS_TEST_AND_SET #elif defined(__sparc__) typedef unsigned char slock_t; #define HAS_TEST_AND_SET #elif defined(__powerpc__) typedef unsigned int slock_t; #define HAS_TEST_AND_SET #elif defined(__alpha__) typedef long int slock_t; #define HAS_TEST_AND_SET #elif defined(__mips__) typedef unsigned int slock_t; #define HAS_TEST_AND_SET #elif defined(__arm__) typedef unsigned char slock_t #define HAS_TEST_AND_SET #endif #if defined(__GLIBC__) && (__GLIBC__ >= 2) #ifdef HAVE_INT_TIMEZONE #undef HAVE_INT_TIMEZONE #endif #endif #if defined(__powerpc__) #undef HAVE_INT_TIMEZONE #endif
Add the missing Parser header file.
/* * 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 * * JsonParser.h * A class for Parsing Json data. * See http://www.json.org/ * Copyright (C) 2013 Simon Newton */ /** * @addtogroup json * @{ * @file JsonParser.h * @brief Header file for the JSON parser. * The implementation does it's best to conform to * http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf * @} */ #ifndef INCLUDE_OLA_WEB_JSONPARSER_H_ #define INCLUDE_OLA_WEB_JSONPARSER_H_ #include <string> namespace ola { namespace web { class JsonValue; /** * @addtogroup json * @{ */ /** * @brief Parse a string containing Json data. */ class JsonParser { public: /** * @brief Parse a string with json data * @param input the input string * @param error set to an error message if parsing fails. * @return a JsonValue or NULL if parsing failed. */ static JsonValue* Parse(const std::string &input, std::string *error); private: static JsonValue* ParseRaw(const char *input, std::string *error); }; /**@}*/ } // namespace web } // namespace ola #endif // INCLUDE_OLA_WEB_JSONPARSER_H_
Fix typo in header guard.
#ifndef _WLC_COMPOSITOR_H_ #define _WLC_COMPOSTIOR_H_ #include "visibility.h" #include <stdbool.h> #include <wayland-util.h> struct wl_display; struct wl_event_loop; struct wl_event_source; struct wlc_shell; struct wlc_xdg_shell; struct wlc_backend; struct wlc_context; struct wlc_render; struct wlc_compositor { struct wl_global *global; struct wl_display *display; struct wl_event_loop *event_loop; struct wl_event_source *event_source; struct wlc_seat *seat; struct wlc_shell *shell; struct wlc_xdg_shell *xdg_shell; struct wlc_backend *backend; struct wlc_context *context; struct wlc_render *render; struct wl_list surfaces; struct wl_event_source *repaint_timer; bool repaint_scheduled; struct { void (*schedule_repaint)(struct wlc_compositor *compositor); uint32_t (*get_time)(void); } api; }; WLC_API void wlc_compositor_run(struct wlc_compositor *compositor); WLC_API void wlc_compositor_free(struct wlc_compositor *compositor); WLC_API struct wlc_compositor* wlc_compositor_new(void); #endif /* _WLC_COMPOSITOR_H_ */
#ifndef _WLC_COMPOSITOR_H_ #define _WLC_COMPOSITOR_H_ #include "visibility.h" #include <stdbool.h> #include <wayland-util.h> struct wl_display; struct wl_event_loop; struct wl_event_source; struct wlc_shell; struct wlc_xdg_shell; struct wlc_backend; struct wlc_context; struct wlc_render; struct wlc_compositor { struct wl_global *global; struct wl_display *display; struct wl_event_loop *event_loop; struct wl_event_source *event_source; struct wlc_seat *seat; struct wlc_shell *shell; struct wlc_xdg_shell *xdg_shell; struct wlc_backend *backend; struct wlc_context *context; struct wlc_render *render; struct wl_list surfaces; struct wl_event_source *repaint_timer; bool repaint_scheduled; struct { void (*schedule_repaint)(struct wlc_compositor *compositor); uint32_t (*get_time)(void); } api; }; WLC_API void wlc_compositor_run(struct wlc_compositor *compositor); WLC_API void wlc_compositor_free(struct wlc_compositor *compositor); WLC_API struct wlc_compositor* wlc_compositor_new(void); #endif /* _WLC_COMPOSITOR_H_ */
Update the year of the Copyright
// // OCChunkInputStream.h // Owncloud iOs Client // // Copyright (C) 2014 ownCloud Inc. (http://www.owncloud.org/) // // 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. // #define k_redirected_code_1 301 #define k_redirected_code_2 302 #define k_redirected_code_3 307
// // OCChunkInputStream.h // Owncloud iOs Client // // Copyright (C) 2015 ownCloud Inc. (http://www.owncloud.org/) // // 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. // #define k_redirected_code_1 301 #define k_redirected_code_2 302 #define k_redirected_code_3 307
Move the import controls into a formal protocol
// // NSManagedObject+JSONHelpers.h // // Created by Saul Mora on 6/28/11. // Copyright 2011 Magical Panda Software LLC. All rights reserved. // #import <CoreData/CoreData.h> extern NSString * const kMagicalRecordImportCustomDateFormatKey; extern NSString * const kMagicalRecordImportDefaultDateFormatString; extern NSString * const kMagicalRecordImportUnixTimeString; extern NSString * const kMagicalRecordImportAttributeKeyMapKey; extern NSString * const kMagicalRecordImportAttributeValueClassNameKey; extern NSString * const kMagicalRecordImportRelationshipMapKey; extern NSString * const kMagicalRecordImportRelationshipLinkedByKey; extern NSString * const kMagicalRecordImportRelationshipTypeKey; @interface NSManagedObject (MagicalRecord_DataImport) + (instancetype) MR_importFromObject:(id)data; + (instancetype) MR_importFromObject:(id)data inContext:(NSManagedObjectContext *)context; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context; @end @interface NSManagedObject (MagicalRecord_DataImportControls) - (BOOL) shouldImport:(id)data; - (void) willImport:(id)data; - (void) didImport:(id)data; @end
// // NSManagedObject+JSONHelpers.h // // Created by Saul Mora on 6/28/11. // Copyright 2011 Magical Panda Software LLC. All rights reserved. // #import <CoreData/CoreData.h> extern NSString * const kMagicalRecordImportCustomDateFormatKey; extern NSString * const kMagicalRecordImportDefaultDateFormatString; extern NSString * const kMagicalRecordImportUnixTimeString; extern NSString * const kMagicalRecordImportAttributeKeyMapKey; extern NSString * const kMagicalRecordImportAttributeValueClassNameKey; extern NSString * const kMagicalRecordImportRelationshipMapKey; extern NSString * const kMagicalRecordImportRelationshipLinkedByKey; extern NSString * const kMagicalRecordImportRelationshipTypeKey; @protocol MagicalRecordDataImportProtocol <NSObject> @optional - (BOOL) shouldImport:(id)data; - (void) willImport:(id)data; - (void) didImport:(id)data; @end @interface NSManagedObject (MagicalRecord_DataImport) <MagicalRecordDataImportProtocol> + (instancetype) MR_importFromObject:(id)data; + (instancetype) MR_importFromObject:(id)data inContext:(NSManagedObjectContext *)context; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context; @end
Split assert into "static check" and "missing code" variants.
/* * $Id$ */ #include <errno.h> #include <time.h> /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); /* from libvarnish/version.c */ void varnish_version(const char *); /* from libvarnish/assert.c */ #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0)
/* * $Id$ */ #include <errno.h> #include <time.h> #ifndef NULL #define NULL ((void*)0) #endif /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); /* from libvarnish/version.c */ void varnish_version(const char *); /* from libvarnish/assert.c */ /* * assert(), AN() and AZ() are static checks that should not happen. * xxxassert(), XXXAN() and XXXAZ() are markers for missing code. */ #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif #define xxxassert(e) \ do { \ if (!(e)) \ lbv_assert("XXX:" __func__, __FILE__, __LINE__, #e, errno); \ } while (0) void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) #define AN(foo) do { assert((foo) != NULL); } while (0) #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != NULL); } while (0)
Add comment explaining why there is no PrimitiveTypeToDataType function.
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ #define TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ #include "tensorflow/compiler/xla/xla_data.pb.h" #include "tensorflow/core/framework/types.pb.h" #include "tensorflow/core/lib/core/status.h" namespace tensorflow { // Converts a Tensorflow DataType to an XLA PrimitiveType. Status DataTypeToPrimitiveType(DataType data_type, xla::PrimitiveType* type); } // namespace tensorflow #endif // TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ #define TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ #include "tensorflow/compiler/xla/xla_data.pb.h" #include "tensorflow/core/framework/types.pb.h" #include "tensorflow/core/lib/core/status.h" namespace tensorflow { // Converts a Tensorflow DataType to an XLA PrimitiveType. Status DataTypeToPrimitiveType(DataType data_type, xla::PrimitiveType* type); // N.B.: there is intentionally no function to convert an XLA PrimitiveType to // a TensorFlow DataType. The mapping from TF types to XLA types is not // one-to-one: for example, both DT_INT8 and DT_QINT8 map to xla::S8. So the // inverse would not be a well-defined function. If you find that you want the // inverse mapping, then most likely you should be preserving the original // TensorFlow type, rather than trying to convert an XLA type into a TensorFlow // type. } // namespace tensorflow #endif // TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_
Split assert into "static check" and "missing code" variants.
/* * $Id$ */ #include <errno.h> #include <time.h> /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); /* from libvarnish/version.c */ void varnish_version(const char *); /* from libvarnish/assert.c */ #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0)
/* * $Id$ */ #include <errno.h> #include <time.h> #ifndef NULL #define NULL ((void*)0) #endif /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); /* from libvarnish/version.c */ void varnish_version(const char *); /* from libvarnish/assert.c */ /* * assert(), AN() and AZ() are static checks that should not happen. * xxxassert(), XXXAN() and XXXAZ() are markers for missing code. */ #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif #define xxxassert(e) \ do { \ if (!(e)) \ lbv_assert("XXX:" __func__, __FILE__, __LINE__, #e, errno); \ } while (0) void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) #define AN(foo) do { assert((foo) != NULL); } while (0) #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != NULL); } while (0)
Add a test for '0B' prefix.
// Copyright 2012 Rui Ueyama <rui314@gmail.com> // This program is free software licensed under the MIT license. #include "test.h" void testmain(void) { print("numeric constants"); expect(1, 0x1); expect(17, 0x11); expect(511, 0777); expect(11, 0b1011); // GNU extension expect(3, 3L); expect(3, 3LL); expect(3, 3UL); expect(3, 3LU); expect(3, 3ULL); expect(3, 3LU); expect(3, 3LLU); expectd(55.3, 55.3); expectd(200, 2e2); expectd(0x0.DE488631p8, 0xDE.488631); expect(4, sizeof(5)); expect(8, sizeof(5L)); expect(4, sizeof(3.0f)); expect(8, sizeof(3.0)); }
// Copyright 2012 Rui Ueyama <rui314@gmail.com> // This program is free software licensed under the MIT license. #include "test.h" void testmain(void) { print("numeric constants"); expect(1, 0x1); expect(17, 0x11); expect(511, 0777); expect(11, 0b1011); // GNU extension expect(11, 0B1011); // GNU extension expect(3, 3L); expect(3, 3LL); expect(3, 3UL); expect(3, 3LU); expect(3, 3ULL); expect(3, 3LU); expect(3, 3LLU); expectd(55.3, 55.3); expectd(200, 2e2); expectd(0x0.DE488631p8, 0xDE.488631); expect(4, sizeof(5)); expect(8, sizeof(5L)); expect(4, sizeof(3.0f)); expect(8, sizeof(3.0)); }
Add a native mate converter for command lines
// Copyright (c) 2014 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_COMMAND_LINE_CONVERTER_H_ #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_COMMAND_LINE_CONVERTER_H_ #include <string> #include "atom/common/native_mate_converters/string16_converter.h" #include "base/command_line.h" namespace mate { template<> struct Converter<base::CommandLine> { static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const base::CommandLine& val) { return Converter<base::CommandLine::StringType>::ToV8(isolate, val.GetCommandLineString()); } static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, base::CommandLine* out) { base::FilePath::StringType path; if (Converter<base::FilePath::StringType>::FromV8(isolate, val, &path)) { *out = base::CommandLine(base::FilePath(path)); return true; } else { return false; } } }; } // namespace mate #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_FILE_PATH_CONVERTER_H_
Add the test code itself
/* * * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "src/core/transport/connectivity_state.h" #include <string.h> #include <grpc/support/log.h> #include "test/core/util/test_config.h" #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) static void test_connectivity_state_name(void) { GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_IDLE), "IDLE")); GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_CONNECTING), "CONNECTING")); GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_READY), "READY")); GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_TRANSIENT_FAILURE), "TRANSIENT_FAILURE")); GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_FATAL_FAILURE), "FATAL_FAILURE")); } int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_connectivity_state_trace = 1; test_connectivity_state_name(); return 0; }
Change DB prefix string to comply with Android's
// // Blueprint.h // SoomlaiOSProfile // // Created by Gur Dotan on 6/9/14. // Copyright (c) 2014 Soomla. All rights reserved. // #define BP_DB_KEY_PREFIX @"soomla.blueprint"
// // Blueprint.h // SoomlaiOSProfile // // Created by Gur Dotan on 6/9/14. // Copyright (c) 2014 Soomla. All rights reserved. // #define BP_DB_KEY_PREFIX @"soomla.levelup"
Remove broken (and unnecessary) definition of DEF_PGPORT.
#include <winsock.h> /* * strcasecmp() is not in Windows, stricmp is, though */ #define strcasecmp(a,b) stricmp(a,b) #define strncasecmp(a,b,c) _strnicmp(a,b,c) #define ACCEPT_TYPE_ARG3 int /* * Some compat functions */ #define open(a,b,c) _open(a,b,c) #define close(a) _close(a) #define read(a,b,c) _read(a,b,c) #define write(a,b,c) _write(a,b,c) #define popen(a,b) _popen(a,b) #define pclose(a) _pclose(a) #define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d) /* * crypt not available (yet) */ #define crypt(a,b) a /* * Parts of config.h that you get with autoconf on other systems */ #define DEF_PGPORT "5432" #define MAXIMUM_ALIGNOF 4
#include <winsock.h> /* * strcasecmp() is not in Windows, stricmp is, though */ #define strcasecmp(a,b) stricmp(a,b) #define strncasecmp(a,b,c) _strnicmp(a,b,c) /* * Some compat functions */ #define open(a,b,c) _open(a,b,c) #define close(a) _close(a) #define read(a,b,c) _read(a,b,c) #define write(a,b,c) _write(a,b,c) #define popen(a,b) _popen(a,b) #define pclose(a) _pclose(a) #define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d) /* * crypt not available (yet) */ #define crypt(a,b) a /* * Parts of config.h that you get with autoconf on other systems */ #define MAXIMUM_ALIGNOF 4 #define ACCEPT_TYPE_ARG3 int
Implement stubs for trirvial cache
/** * @file * @brief Handle cache lookup just by iterating vfs tree * @author Denis Deryugin <deryugin.denis@gmail.com> * @version 0.1 * @date 2015-06-09 */
/** * @file * @brief Handle cache lookup just by iterating vfs tree * @author Denis Deryugin <deryugin.denis@gmail.com> * @version 0.1 * @date 2015-06-09 */ #include <fs/dvfs.h> struct dentry *dvfs_cache_lookup(const char *path, struct dentry *base) { return NULL; } struct dentry *dvfs_cache_get(char *path) { return NULL; } int dvfs_cache_del(struct dentry *dentry) { return 0; } int dvfs_cache_add(struct dentry *dentry) { return 0; }
Add two classes [as yet unused] needed for upcoming IDB Blob support.
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WebBlobInfo_h #define WebBlobInfo_h #include "WebCommon.h" #include "WebString.h" namespace blink { class WebBlobInfo { public: WebBlobInfo() : m_isFile(false) , m_size(-1) , m_lastModified(0) { } WebBlobInfo(const WebString& uuid, const WebString& type, long long size) : m_isFile(false) , m_uuid(uuid) , m_type(type) , m_size(size) , m_lastModified(0) { } WebBlobInfo(const WebString& uuid, const WebString& filePath, const WebString& fileName, const WebString& type) : m_isFile(true) , m_uuid(uuid) , m_type(type) , m_size(-1) , m_filePath(filePath) , m_fileName(fileName) , m_lastModified(0) { } WebBlobInfo(const WebString& uuid, const WebString& filePath, const WebString& fileName, const WebString& type, double lastModified, long long size) : m_isFile(true) , m_uuid(uuid) , m_type(type) , m_size(size) , m_filePath(filePath) , m_fileName(fileName) , m_lastModified(lastModified) { } bool isFile() const { return m_isFile; } const WebString& uuid() const { return m_uuid; } const WebString& type() const { return m_type; } long long size() const { return m_size; } const WebString& filePath() const { return m_filePath; } const WebString& fileName() const { return m_fileName; } double lastModified() const { return m_lastModified; } private: bool m_isFile; WebString m_uuid; WebString m_type; // MIME type long long m_size; WebString m_filePath; // Only for File WebString m_fileName; // Only for File double m_lastModified; // Only for File }; } // namespace blink #endif
Add shmem tag for Hits
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(Error) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(BackendOpen) SLTM(BackendXID) SLTM(BackendReuse) SLTM(BackendClose) SLTM(HttpError) SLTM(ClientAddr) SLTM(Backend) SLTM(Request) SLTM(Response) SLTM(Length) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(Header) SLTM(BldHdr) SLTM(LostHeader) SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) SLTM(XID) SLTM(ExpBan) SLTM(ExpPick) SLTM(ExpKill)
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(Error) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(BackendOpen) SLTM(BackendXID) SLTM(BackendReuse) SLTM(BackendClose) SLTM(HttpError) SLTM(ClientAddr) SLTM(Backend) SLTM(Request) SLTM(Response) SLTM(Length) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(Header) SLTM(BldHdr) SLTM(LostHeader) SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) SLTM(XID) SLTM(Hit) SLTM(ExpBan) SLTM(ExpPick) SLTM(ExpKill)
Reset default settings to stock kit configuration
#ifndef __SETTINGS_H_ #define __SETTINGS_H_ #include <Arduino.h> #include "Device.h" // This section is for devices and their configuration //Kit: #define HAS_STD_LIGHTS (1) #define LIGHTS_PIN 5 #define HAS_STD_CAPE (1) #define HAS_STD_2X1_THRUSTERS (1) #define HAS_STD_PILOT (1) #define HAS_STD_CAMERAMOUNT (1) #define CAMERAMOUNT_PIN 3 #define CAPE_VOLTAGE_PIN 0 #define CAPE_CURRENT_PIN 3 //After Market: #define HAS_STD_CALIBRATIONLASERS (0) #define CALIBRATIONLASERS_PIN 6 #define HAS_POLOLU_MINIMUV (1) #define HAS_MS5803_14BA (0) #define MS5803_14BA_I2C_ADDRESS 0x76 #define MIDPOINT 1500 #define LOGGING (1) class Settings : public Device { public: static int smoothingIncriment; //How aggressive the throttle changes static int deadZone_min; static int deadZone_max; static int capability_bitarray; Settings():Device(){}; void device_setup(); void device_loop(Command cmd); }; #endif
#ifndef __SETTINGS_H_ #define __SETTINGS_H_ #include <Arduino.h> #include "Device.h" // This section is for devices and their configuration //Kit: #define HAS_STD_LIGHTS (1) #define LIGHTS_PIN 5 #define HAS_STD_CAPE (1) #define HAS_STD_2X1_THRUSTERS (1) #define HAS_STD_PILOT (1) #define HAS_STD_CAMERAMOUNT (1) #define CAMERAMOUNT_PIN 3 #define CAPE_VOLTAGE_PIN 0 #define CAPE_CURRENT_PIN 3 //After Market: #define HAS_STD_CALIBRATIONLASERS (0) #define CALIBRATIONLASERS_PIN 6 #define HAS_POLOLU_MINIMUV (0) #define HAS_MS5803_14BA (0) #define MS5803_14BA_I2C_ADDRESS 0x76 #define MIDPOINT 1500 #define LOGGING (1) class Settings : public Device { public: static int smoothingIncriment; //How aggressive the throttle changes static int deadZone_min; static int deadZone_max; static int capability_bitarray; Settings():Device(){}; void device_setup(); void device_loop(Command cmd); }; #endif
Fix compiler warning in release
#ifndef __MORDOR_VERSION_H__ #define __MORDOR_VERSION_H__ // OS #ifdef _WIN32 # define WINDOWS #else # define POSIX #endif #ifdef __CYGWIN__ # define WINDOWS # define CYGWIN #endif #if defined(linux) || defined(__linux__) # define LINUX #endif #ifdef __APPLE__ # define OSX # ifndef BSD # define BSD # endif #endif #ifdef __FreeBSD__ # define FREEBSD # define BSD #endif #ifdef WINDOWS #define MORDOR_NATIVE(win32, posix) win32 #else #define MORDOR_NATIVE(win32, posix) posix #endif // Architecture #ifdef _MSC_VER # define MSVC # ifdef _M_X64 # define X86_64 # elif defined(_M_IX86) # define X86 # endif #endif #ifdef __GNUC__ # define GCC # ifdef __x86_64 # define X86_64 # elif defined(i386) # define X86 # elif defined(__ppc__) # define PPC # elif defined(__arm__) # define ARM # endif #endif #ifdef MSVC #ifndef _DEBUG #define NDEBUG #endif #endif #endif
#ifndef __MORDOR_VERSION_H__ #define __MORDOR_VERSION_H__ // OS #ifdef _WIN32 # define WINDOWS #else # define POSIX #endif #ifdef __CYGWIN__ # define WINDOWS # define CYGWIN #endif #if defined(linux) || defined(__linux__) # define LINUX #endif #ifdef __APPLE__ # define OSX # ifndef BSD # define BSD # endif #endif #ifdef __FreeBSD__ # define FREEBSD # define BSD #endif #ifdef WINDOWS #define MORDOR_NATIVE(win32, posix) win32 #else #define MORDOR_NATIVE(win32, posix) posix #endif // Architecture #ifdef _MSC_VER # define MSVC # ifdef _M_X64 # define X86_64 # elif defined(_M_IX86) # define X86 # endif #endif #ifdef __GNUC__ # define GCC # ifdef __x86_64 # define X86_64 # elif defined(i386) # define X86 # elif defined(__ppc__) # define PPC # elif defined(__arm__) # define ARM # endif #endif #ifdef MSVC # ifndef _DEBUG # ifndef NDEBUG # define NDEBUG # endif # endif #endif #endif
Mark string functions unused, in case the header is included in files that only use one of them.
#include <string.h> #include <stdint.h> /** * Efficient string hash function. */ static uint32_t string_hash(const char *str) { uint32_t hash = 0; int32_t c; while ((c = *str++)) { hash = c + (hash << 6) + (hash << 16) - hash; } return hash; } /** * Test two strings for equality. */ static int string_compare(const char *str1, const char *str2) { if (str1 == str2) { return 1; } if (str2 == NULL) { return 0; } return strcmp(str1, str2) == 0; }
#include <string.h> #include <stdint.h> /** * Efficient string hash function. */ __attribute__((unused)) static uint32_t string_hash(const char *str) { uint32_t hash = 0; int32_t c; while ((c = *str++)) { hash = c + (hash << 6) + (hash << 16) - hash; } return hash; } /** * Test two strings for equality. */ __attribute__((unused)) static int string_compare(const char *str1, const char *str2) { if (str1 == str2) { return 1; } if (str2 == NULL) { return 0; } return strcmp(str1, str2) == 0; }
Add another sample file for C
/*A C calculator...of sorts*/ /* An attempt at a C calculator from stuff read so far */ #include<stdio.h> /* function for addition */ int add(int input1, int input2) { int result; result = input1 + input2; return result; } /* function for multiplication */ int multi(int input1, int input2) { int result; result = input1 * input2; return result; } /* function for subtraction */ int sub(int input1, int input2) { int result; result = input1 - input2; return result; } /* division function */ float div(float input1, float input2) { float result; result = input1 / input2; return result; } int main() { int a, b, output; float output2; char myinput; printf("Please enter a number\n"); scanf("%d", &a); printf("Enter another number\n"); scanf("%d", &b); printf("What calculation would you like to perform?\n"); printf("a) addition\n"); printf("b) mulitplication\n"); printf("c) subtraction\n"); printf("d) division\n"); scanf(" %c", &myinput); /* switch statement to run certain calculations */ switch(myinput) { case 'a': { printf("Adding the numbers entered...\n"); output = add(a, b); printf("The sum of %d and %d is: %d\n", a, b, output); break; } case 'b': { printf("Multiplication chosen\n"); output = multi(a, b); printf("Multiplying %d and %d equals %d\n", a, b , output); break; } case 'c': { printf("Subtracting %d from %d\n", a, b); output = sub(a, b); printf("%d minus %d is: %d\n", a, b, output); break; } case 'd': { printf("Divison program running...\n"); output2 = div(a, b); printf("Division of %d by %d equals %f\n", a, b, output2); break; } default: { printf("Invalid entry\n"); printf("Please run again\n"); } } return 0; }
Fix compile warning when selftests disabled
/* * Selftest code */ #ifndef DUK_SELFTEST_H_INCLUDED #define DUK_SELFTEST_H_INCLUDED DUK_INTERNAL_DECL void duk_selftest_run_tests(void); #endif /* DUK_SELFTEST_H_INCLUDED */
/* * Selftest code */ #ifndef DUK_SELFTEST_H_INCLUDED #define DUK_SELFTEST_H_INCLUDED #if defined(DUK_USE_SELF_TESTS) DUK_INTERNAL_DECL void duk_selftest_run_tests(void); #endif #endif /* DUK_SELFTEST_H_INCLUDED */
Modify test 57/12 to actually trigger the issue
// PARAM: --enable ana.float.interval #include <assert.h> // previously failed in line 7 with "exception Invalid_argument("Cilfacade.get_ikind: non-integer type double ")" //(same error as in sv-comp: float-newlib/float_req_bl_0220a.c) // similar error also occured in the additional examples when branching on a float argument int main() { double z; z = 1 - 1.0; assert(z == 0.); // SUCCESS if (0.) ; if (0 == (0. + 1.)) ; assert(0); // FAIL }
// PARAM: --enable ana.float.interval #include <assert.h> // previously failed in line 7 with "exception Invalid_argument("Cilfacade.get_ikind: non-integer type double ")" //(same error as in sv-comp: float-newlib/float_req_bl_0220a.c) // similar error also occurred in the additional examples when branching on a float argument int main() { double z; int x; z = 1 - 1.0; assert(z == 0.); // SUCCESS if (0.) { x = z;} if (0 == (0. + 1.)) { x = z;} assert(0); // FAIL }
Fix the DYNAMIC_GHC_PROGRAMS=NO build on Mac/Windows
/* ----------------------------------------------------------------------------- * * (c) The GHC Team, 2000-2015 * * RTS Symbols * * ---------------------------------------------------------------------------*/ #ifndef RTS_SYMBOLS_H #define RTS_SYMBOLS_H #ifdef LEADING_UNDERSCORE #define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s) #else #define MAYBE_LEADING_UNDERSCORE_STR(s) (s) #endif typedef struct _RtsSymbolVal { const char *lbl; void *addr; } RtsSymbolVal; extern RtsSymbolVal rtsSyms[]; #endif /* RTS_SYMBOLS_H */
/* ----------------------------------------------------------------------------- * * (c) The GHC Team, 2000-2015 * * RTS Symbols * * ---------------------------------------------------------------------------*/ #ifndef RTS_SYMBOLS_H #define RTS_SYMBOLS_H #include "ghcautoconf.h" #ifdef LEADING_UNDERSCORE #define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s) #else #define MAYBE_LEADING_UNDERSCORE_STR(s) (s) #endif typedef struct _RtsSymbolVal { const char *lbl; void *addr; } RtsSymbolVal; extern RtsSymbolVal rtsSyms[]; #endif /* RTS_SYMBOLS_H */
Add new classes to umbrella header
// // TWTValidation.h // TWTValidation // // Created by Prachi Gauriar on 3/28/2014. // Copyright (c) 2014 Two Toasters, LLC. All rights reserved. // @import Foundation; #import <TWTValidation/TWTValidator.h> #import <TWTValidation/TWTBlockValidator.h> #import <TWTValidation/TWTCompoundValidator.h> #import <TWTValidation/TWTValueValidator.h> #import <TWTValidation/TWTNumberValidator.h> #import <TWTValidation/TWTStringValidator.h> #import <TWTValidation/TWTValidationErrors.h>
// // TWTValidation.h // TWTValidation // // Created by Prachi Gauriar on 3/28/2014. // Copyright (c) 2014 Two Toasters, LLC. All rights reserved. // @import Foundation; #import <TWTValidation/TWTValidator.h> #import <TWTValidation/TWTValidationErrors.h> #import <TWTValidation/TWTBlockValidator.h> #import <TWTValidation/TWTCompoundValidator.h> #import <TWTValidation/TWTValueValidator.h> #import <TWTValidation/TWTNumberValidator.h> #import <TWTValidation/TWTStringValidator.h> #import <TWTValidation/TWTCollectionValidator.h> #import <TWTValidation/TWTKeyedCollectionValidator.h> #import <TWTValidation/TWTKeyValuePairValidator.h> #import <TWTValidation/TWTValidatingObject.h>
Remove encoding conditionals that are no longer required
#ifndef REDCARPET_H__ #define REDCARPET_H__ #define RSTRING_NOT_MODIFIED #include "ruby.h" #include <stdio.h> #ifdef HAVE_RUBY_ENCODING_H # include <ruby/encoding.h> # define redcarpet_str_new(data, size, enc) rb_enc_str_new(data, size, enc) #else # define redcarpet_str_new(data, size, enc) rb_str_new(data, size) #endif #include "markdown.h" #include "html.h" #define CSTR2SYM(s) (ID2SYM(rb_intern((s)))) void Init_redcarpet_rndr(); struct redcarpet_renderopt { struct html_renderopt html; VALUE link_attributes; VALUE self; VALUE base_class; #ifdef HAVE_RUBY_ENCODING_H rb_encoding *active_enc; #endif }; struct rb_redcarpet_rndr { struct sd_callbacks callbacks; struct redcarpet_renderopt options; }; #endif
#ifndef REDCARPET_H__ #define REDCARPET_H__ #define RSTRING_NOT_MODIFIED #include "ruby.h" #include <stdio.h> #include <ruby/encoding.h> #define redcarpet_str_new(data, size, enc) rb_enc_str_new(data, size, enc) #include "markdown.h" #include "html.h" #define CSTR2SYM(s) (ID2SYM(rb_intern((s)))) void Init_redcarpet_rndr(); struct redcarpet_renderopt { struct html_renderopt html; VALUE link_attributes; VALUE self; VALUE base_class; rb_encoding *active_enc; }; struct rb_redcarpet_rndr { struct sd_callbacks callbacks; struct redcarpet_renderopt options; }; #endif
Put TextTube to line buffer mode
#include "common.h" #include "tube.h" int FdTube; FILE *TextTube; void InitTubes(int textTube, int fdTube) { SetCloexec(textTube); SetCloexec(fdTube); TextTube = fdopen(textTube, "a+"); DieIf(TextTube == 0, "fdopen"); FdTube = fdTube; }
#include "common.h" #include "tube.h" int FdTube; FILE *TextTube; void InitTubes(int textTube, int fdTube) { SetCloexec(textTube); SetCloexec(fdTube); TextTube = fdopen(textTube, "a+"); setlinebuf(TextTube); DieIf(TextTube == 0, "fdopen"); FdTube = fdTube; }
Add shmlog tags for pipe and pass handling
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(ClientAddr) SLTM(Request) SLTM(Response) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(HD_Unknown) SLTM(HD_Lost) #define HTTPH(a, b, c, d, e, f, g) SLTM(b) #include "http_headers.h" #undef HTTPH
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(ClientAddr) SLTM(HandlingPass) SLTM(HandlingPipe) SLTM(Request) SLTM(Response) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(HD_Unknown) SLTM(HD_Lost) #define HTTPH(a, b, c, d, e, f, g) SLTM(b) #include "http_headers.h" #undef HTTPH
Change a "inline" to "__inline__"
/* This file should provide inline versions of string functions. Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. This file should define __STRING_INLINES if functions are actually defined as inlines. */ #ifndef _BITS_STRING_H #define _BITS_STRING_H 1 #define _STRING_ARCH_unaligned 0 #if defined(__GNUC__) && !defined(__cplusplus) static inline unsigned long __libc_detect_null(unsigned long w) { unsigned long mask = 0x7f7f7f7f; if (sizeof(long) == 8) mask = ((mask << 16) << 16) | mask; return ~(((w & mask) + mask) | w | mask); } #endif /* __GNUC__ && !__cplusplus */ #endif /* bits/string.h */
/* This file should provide inline versions of string functions. Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. This file should define __STRING_INLINES if functions are actually defined as inlines. */ #ifndef _BITS_STRING_H #define _BITS_STRING_H 1 #define _STRING_ARCH_unaligned 0 #if defined(__GNUC__) && !defined(__cplusplus) static __inline__ unsigned long __libc_detect_null(unsigned long w) { unsigned long mask = 0x7f7f7f7f; if (sizeof(long) == 8) mask = ((mask << 16) << 16) | mask; return ~(((w & mask) + mask) | w | mask); } #endif /* __GNUC__ && !__cplusplus */ #endif /* bits/string.h */
Update for renamed struct in runtime.h (WinCall to LibCall)
#include <runtime.h> #include <cgocall.h> void runtime·asmstdcall(void *c); void ·cSyscall(WinCall *c) { runtime·cgocall(runtime·asmstdcall, c); }
#include <runtime.h> #include <cgocall.h> void runtime·asmstdcall(void *c); void ·cSyscall(LibCall *c) { runtime·cgocall(runtime·asmstdcall, c); }
Define INFINITY and NAN when missing
#ifndef __math_compat_h #define __math_compat_h /* Define isnan and isinf on Windows/MSVC */ #ifndef HAVE_DECL_ISNAN # ifdef HAVE_DECL__ISNAN #include <float.h> #define isnan(x) _isnan(x) # endif #endif #ifndef HAVE_DECL_ISINF # ifdef HAVE_DECL__FINITE #include <float.h> #define isinf(x) (!_finite(x)) # endif #endif #ifndef HAVE_DECL_NAN #error This platform does not have nan() #endif #ifndef HAVE_DECL_INFINITY #error This platform does not have INFINITY #endif #endif
#ifndef __math_compat_h #define __math_compat_h /* Define isnan, isinf, infinity and nan on Windows/MSVC */ #ifndef HAVE_DECL_ISNAN # ifdef HAVE_DECL__ISNAN #include <float.h> #define isnan(x) _isnan(x) # endif #endif #ifndef HAVE_DECL_ISINF # ifdef HAVE_DECL__FINITE #include <float.h> #define isinf(x) (!_finite(x)) # endif #endif #ifndef HAVE_DECL_INFINITY #include <float.h> #define INFINITY (DBL_MAX + DBL_MAX) #define HAVE_DECL_INFINITY #endif #ifndef HAVE_DECL_NAN #define NAN (INFINITY - INFINITY) #define HAVE_DECL_NAN #endif #endif
Add action predicate block typedef
/* Copyright 2009-2013 Urban Airship 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 binaryform must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided withthe distribution. THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Foundation/Foundation.h> @interface UAAction : NSObject @end
/* Copyright 2009-2013 Urban Airship 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 binaryform must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided withthe distribution. THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Foundation/Foundation.h> #import "UAActionArguments.h" typedef BOOL (^UAActionPredicate)(UAActionArguments *); @interface UAAction : NSObject @end
Add header file for tracking our Maya type IDs
#ifndef MAYATYPEID_H #define MAYATYPEID_H // Inside Maya, the type IDs are used to identify nodes and dependency graph // data. So when we create custom nodes and data in any Maya plugins, they must // all be assigned unique IDs. For any plugins that will be used outside of // Side Effects, we *must* assign globally unique IDs. However, for plugins // that are only used internally inside Side Effects, we could assign the // "internal IDs" (0x0 - 0x7ffff). // Some important notes from the Maya SDK docs: // - In Maya, both intrinsic and user-defined Maya Objects are registered // and recognized by their type identifier or type id. // - It is very important to note that these ids are written into the Maya // binary file format. So, once an id is assigned to a node or data type it // can never be changed while any existing Maya file contains an instance // of that node or data type. If a change is made, such files will become // unreadable. // - For plug-ins that will forever be internal to your site use the // constructor that takes a single unsigned int parameter. The numeric // range 0 - 0x7ffff (524288 ids) has been reserved for such plug-ins. // For more information on these IDs, please refer to the documentation for // MTypeId in the Maya SDK. // Globally unique IDs assigned to Side Effects: // - 0x0011E240 - 0x0011E2BF : 128 IDs requested by Andrew Wong on 2013-07-17 13:55 // More IDs can be requested through the Autodesk Developer Network. // Globally unique IDs being used by Side Effects enum MayaTypeID { }; #endif
Add an API testcase for prototype loop and GC
/* * Prototype loop is tricky to handle internally and must not cause e.g. * GC failures. Exercise a few common paths. */ /*=== *** test_1 (duk_safe_call) first gc make unreachable second gc ==> rc=0, result='undefined' ===*/ static duk_ret_t test_1(duk_context *ctx) { duk_push_object(ctx); duk_push_object(ctx); duk_dup(ctx, 0); duk_set_prototype(ctx, 1); duk_dup(ctx, 1); duk_set_prototype(ctx, 0); /* Both objects are now in a prototype loop. Force garbage * collection to ensure nothing breaks. */ printf("first gc\n"); fflush(stdout); duk_gc(ctx, 0); /* Make the objects unreachable and re-run GC. This triggers * e.g. finalizer checks. */ printf("make unreachable\n"); fflush(stdout); duk_set_top(ctx, 0); printf("second gc\n"); fflush(stdout); duk_gc(ctx, 0); return 0; } void test(duk_context *ctx) { TEST_SAFE_CALL(test_1); }
Fix build of tutorials that require libpng under Visual Studio.
// A current_time function for use in the tests. Returns time in // milliseconds. #ifdef _WIN32 extern "C" bool QueryPerformanceCounter(uint64_t *); extern "C" bool QueryPerformanceFrequency(uint64_t *); double current_time() { uint64_t t, freq; QueryPerformanceCounter(&t); QueryPerformanceFrequency(&freq); return (t * 1000.0) / freq; } #else #include <sys/time.h> double current_time() { static bool first_call = true; static timeval reference_time; if (first_call) { first_call = false; gettimeofday(&reference_time, NULL); return 0.0; } else { timeval t; gettimeofday(&t, NULL); return ((t.tv_sec - reference_time.tv_sec)*1000.0 + (t.tv_usec - reference_time.tv_usec)/1000.0); } } #endif
// A current_time function for use in the tests. Returns time in // milliseconds. #ifdef _WIN32 #include <Windows.h> double current_time() { LARGE_INTEGER freq, t; QueryPerformanceCounter(&t); QueryPerformanceFrequency(&freq); return (t.QuadPart * 1000.0) / freq.QuadPart; } // Gross, these come from Windows.h #undef max #undef min #else #include <sys/time.h> double current_time() { static bool first_call = true; static timeval reference_time; if (first_call) { first_call = false; gettimeofday(&reference_time, NULL); return 0.0; } else { timeval t; gettimeofday(&t, NULL); return ((t.tv_sec - reference_time.tv_sec)*1000.0 + (t.tv_usec - reference_time.tv_usec)/1000.0); } } #endif
Backup of APM 2.5.2 calibration file
/** * FreeIMU calibration header. Automatically generated by FreeIMU_GUI. * Do not edit manually unless you know what you are doing. */ #define CALIBRATION_H const int acc_off_x = 426; const int acc_off_y = -141; const int acc_off_z = -540; const float acc_scale_x = 16255.420145; const float acc_scale_y = 16389.952315; const float acc_scale_z = 16598.537030; const int magn_off_x = 222; const int magn_off_y = -190; const int magn_off_z = -67; const float magn_scale_x = 488.787511; const float magn_scale_y = 513.264462; const float magn_scale_z = 434.896123;
Remove unused byte in freelist
#include "redislite.h" #include "page_string.h" #include "util.h" #include <string.h> #include <stdlib.h> #include <math.h> void redislite_free_freelist(void *_db, void *_page) { redislite_page_string* page = (redislite_page_string*)_page; if (page == NULL) return; redislite_free(page); } void redislite_write_freelist(void *_db, unsigned char *data, void *_page) { redislite *db = (redislite*)_db; redislite_page_string* page = (redislite_page_string*)_page; if (page == NULL) return; data[0] = REDISLITE_PAGE_TYPE_FREELIST; redislite_put_4bytes(&data[1], 0); // reserverd redislite_put_4bytes(&data[5], page->right_page); int size = db->page_size-9; memset(&data[9], 0, size); } void *redislite_read_freelist(void *_db, unsigned char *data) { redislite_page_string* page = redislite_malloc(sizeof(redislite_page_string)); page->right_page = redislite_get_4bytes(&data[5]); return page; }
#include "redislite.h" #include "page_string.h" #include "util.h" #include <string.h> #include <stdlib.h> #include <math.h> void redislite_free_freelist(void *_db, void *_page) { redislite_page_string* page = (redislite_page_string*)_page; if (page == NULL) return; redislite_free(page); } void redislite_write_freelist(void *_db, unsigned char *data, void *_page) { redislite *db = (redislite*)_db; redislite_page_string* page = (redislite_page_string*)_page; if (page == NULL) return; redislite_put_4bytes(&data[0], 0); // reserverd redislite_put_4bytes(&data[4], page->right_page); int size = db->page_size-8; memset(&data[8], 0, size); } void *redislite_read_freelist(void *_db, unsigned char *data) { redislite_page_string* page = redislite_malloc(sizeof(redislite_page_string)); page->right_page = redislite_get_4bytes(&data[8]); return page; }
Fix initialization of once mutex
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <orc/orconce.h> #include <orc/orcdebug.h> #if defined(HAVE_THREAD_PTHREAD) #include <pthread.h> static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER; void _orc_once_init (void) { } void orc_once_mutex_lock (void) { pthread_mutex_lock (&once_mutex); } void orc_once_mutex_unlock (void) { pthread_mutex_unlock (&once_mutex); } #elif defined(HAVE_THREAD_WIN32) #include <windows.h> static CRITICAL_SECTION once_mutex; void _orc_once_init (void) { InitializeCriticalSection (&once_mutex); } void orc_once_mutex_lock (void) { EnterCriticalSection (&once_mutex); } void orc_once_mutex_unlock (void) { LeaveCriticalSection (&once_mutex); } #else void _orc_once_init (void) { } void orc_once_mutex_lock (void) { } void orc_once_mutex_unlock (void) { } #endif
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <orc/orconce.h> #include <orc/orcdebug.h> #if defined(HAVE_THREAD_PTHREAD) #include <pthread.h> static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER; void _orc_once_init (void) { } void orc_once_mutex_lock (void) { pthread_mutex_lock (&once_mutex); } void orc_once_mutex_unlock (void) { pthread_mutex_unlock (&once_mutex); } #elif defined(HAVE_THREAD_WIN32) #include <windows.h> static CRITICAL_SECTION once_mutex; void _orc_once_init (void) { } void orc_once_mutex_lock (void) { EnterCriticalSection (&once_mutex); } void orc_once_mutex_unlock (void) { LeaveCriticalSection (&once_mutex); } int DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) { InitializeCriticalSection (&once_mutex); } return 1; } #else void _orc_once_init (void) { } void orc_once_mutex_lock (void) { } void orc_once_mutex_unlock (void) { } #endif
Include all x86 defines macros for hwloc
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_ #define THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_ #include <private/internal-components.h> static const struct hwloc_component* hwloc_static_components[] = { &hwloc_noos_component, &hwloc_xml_component, &hwloc_synthetic_component, &hwloc_xml_nolibxml_component, &hwloc_linux_component, &hwloc_linuxio_component, #ifdef PLATFORM_IS_X86 &hwloc_x86_component, #endif NULL}; #endif // THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_ #define THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_ #include <private/internal-components.h> static const struct hwloc_component* hwloc_static_components[] = { &hwloc_noos_component, &hwloc_xml_component, &hwloc_synthetic_component, &hwloc_xml_nolibxml_component, &hwloc_linux_component, &hwloc_linuxio_component, #if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \ defined(_M_X64) &hwloc_x86_component, #endif NULL}; #endif // THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_
Remove non-existent 'view' parameter documentation
// // MASCompositeConstraint.h // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASConstraint.h" #import "MASUtilities.h" /** * A group of MASConstraint objects * conforms to MASConstraint */ @interface MASCompositeConstraint : NSObject <MASConstraint> /** * Creates a composite with a predefined array of children * * @param view first item view * @param children child MASConstraints * * @return a composite constraint */ - (id)initWithChildren:(NSArray *)children; @end
// // MASCompositeConstraint.h // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASConstraint.h" #import "MASUtilities.h" /** * A group of MASConstraint objects * conforms to MASConstraint */ @interface MASCompositeConstraint : NSObject <MASConstraint> /** * Creates a composite with a predefined array of children * * @param children child MASConstraints * * @return a composite constraint */ - (id)initWithChildren:(NSArray *)children; @end
Test the presence of some extra functions
#define TEST_NAME "auth" #include "cmptest.h" /* "Test Case 2" from RFC 4231 */ unsigned char key[32] = "Jefe"; unsigned char c[] = "what do ya want for nothing?"; unsigned char a[32]; int main(void) { int i; crypto_auth(a,c,sizeof c - 1U,key); for (i = 0;i < 32;++i) { printf(",0x%02x",(unsigned int) a[i]); if (i % 8 == 7) printf("\n"); } assert(crypto_auth_bytes() > 0U); assert(crypto_auth_keybytes() > 0U); assert(strcmp(crypto_auth_primitive(), "hmacsha512256") == 0); return 0; }
#define TEST_NAME "auth" #include "cmptest.h" /* "Test Case 2" from RFC 4231 */ unsigned char key[32] = "Jefe"; unsigned char c[] = "what do ya want for nothing?"; unsigned char a[32]; int main(void) { int i; crypto_auth(a,c,sizeof c - 1U,key); for (i = 0;i < 32;++i) { printf(",0x%02x",(unsigned int) a[i]); if (i % 8 == 7) printf("\n"); } assert(crypto_auth_bytes() > 0U); assert(crypto_auth_keybytes() > 0U); assert(strcmp(crypto_auth_primitive(), "hmacsha512256") == 0); assert(crypto_auth_hmacsha512256_bytes() > 0U); assert(crypto_auth_hmacsha512256_keybytes() > 0U); return 0; }
Update the shaders to work with Cogl 1.6.0+ and GLES2
#ifndef CLUTTER_GST_SHADERS_H #define CLUTTER_GST_SHADERS_H #include <clutter/clutter.h> /* Copied from test-shaders */ /* These variables are used instead of the standard GLSL variables on GLES 2 */ #ifdef COGL_HAS_GLES #define GLES2_VARS \ "precision mediump float;\n" \ "varying vec2 tex_coord;\n" \ "varying vec4 frag_color;\n" #define TEX_COORD "tex_coord" #define COLOR_VAR "frag_color" #else /* COGL_HAS_GLES */ #define GLES2_VARS "" #define TEX_COORD "gl_TexCoord[0]" #define COLOR_VAR "gl_Color" #endif /* COGL_HAS_GLES */ /* a couple of boilerplate defines that are common amongst all the * sample shaders */ #define FRAGMENT_SHADER_VARS \ GLES2_VARS /* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly * blended with the gl specified color (makes the opacity of actors work * correctly). */ #define FRAGMENT_SHADER_END \ " gl_FragColor = gl_FragColor * " COLOR_VAR ";" #endif
#ifndef CLUTTER_GST_SHADERS_H #define CLUTTER_GST_SHADERS_H #include <clutter/clutter.h> /* Copied from test-shaders */ /* These variables are used instead of the standard GLSL variables on GLES 2 */ #ifdef COGL_HAS_GLES #define GLES2_VARS \ "precision mediump float;\n" #define TEX_COORD "cogl_tex_coord_in[0]" #define COLOR_VAR "cogl_color_in" #else /* COGL_HAS_GLES */ #define GLES2_VARS "" #define TEX_COORD "gl_TexCoord[0]" #define COLOR_VAR "gl_Color" #endif /* COGL_HAS_GLES */ /* a couple of boilerplate defines that are common amongst all the * sample shaders */ #define FRAGMENT_SHADER_VARS \ GLES2_VARS /* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly * blended with the gl specified color (makes the opacity of actors work * correctly). */ #define FRAGMENT_SHADER_END \ " gl_FragColor = gl_FragColor * " COLOR_VAR ";" #endif
Define _SODIUM_C99 as empty on retarded compilers, not only when using C++
#ifndef __SODIUM_UTILS_H__ #define __SODIUM_UTILS_H__ #include <stddef.h> #include "export.h" #ifdef __cplusplus extern "C" { #endif #ifndef __cplusplus # define _SODIUM_C99(X) X #else # define _SODIUM_C99(X) #endif unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len); SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t size); SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hexlen, const unsigned char *bin, const size_t binlen); #ifdef __cplusplus } #endif #endif
#ifndef __SODIUM_UTILS_H__ #define __SODIUM_UTILS_H__ #include <stddef.h> #include "export.h" #ifdef __cplusplus extern "C" { #endif #if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L # define _SODIUM_C99(X) #else # define _SODIUM_C99(X) X #endif unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len); SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t size); SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hexlen, const unsigned char *bin, const size_t binlen); #ifdef __cplusplus } #endif #endif
Call ssh_init() and ssh_finalize() before we run the tests.
#include "torture.h" #include <stdio.h> static int verbosity = 0; int torture_libssh_verbosity(void){ return verbosity; } int main(int argc, char **argv) { (void) argc; (void) argv; return torture_run_tests(); }
#include <stdio.h> #include <libssh/libssh.h> #include "torture.h" static int verbosity = 0; int torture_libssh_verbosity(void){ return verbosity; } int main(int argc, char **argv) { int rc; (void) argc; (void) argv; ssh_init(); rc = torture_run_tests(); ssh_finalize(); return rc; }
Convert LayoutDrawingRecorder to be a simple helper of DrawingRecorder
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef LayoutObjectDrawingRecorder_h #define LayoutObjectDrawingRecorder_h #include "core/layout/PaintPhase.h" #include "platform/geometry/FloatRect.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/paint/DisplayItem.h" #include "platform/graphics/paint/DrawingRecorder.h" namespace blink { class GraphicsContext; class LayoutObject; class LayoutObjectDrawingRecorder { public: LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutRect& clip) : m_drawingRecorder(context, layoutObject, displayItemType, pixelSnappedIntRect(clip)) { } LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip) : m_drawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip) { } LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type type, const FloatRect& clip) : m_drawingRecorder(context, layoutObject, type, clip) { } bool canUseCachedDrawing() const { return m_drawingRecorder.canUseCachedDrawing(); } private: DrawingRecorder m_drawingRecorder; }; } // namespace blink #endif // LayoutObjectDrawingRecorder_h
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef LayoutObjectDrawingRecorder_h #define LayoutObjectDrawingRecorder_h #include "core/layout/PaintPhase.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/paint/DrawingRecorder.h" namespace blink { class GraphicsContext; class LayoutObject; // Convienance constructors for creating DrawingRecorders. class LayoutObjectDrawingRecorder final : public DrawingRecorder { public: LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutRect& clip) : DrawingRecorder(context, layoutObject, displayItemType, pixelSnappedIntRect(clip)) { } LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip) : DrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip) { } LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type type, const FloatRect& clip) : DrawingRecorder(context, layoutObject, type, clip) { } }; } // namespace blink #endif // LayoutObjectDrawingRecorder_h
Add missing itkImageRegionSplitterBase to ImageSourceCommon.
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __itkImageSourceCommon_h #define __itkImageSourceCommon_h #include "ITKCommonExport.h" namespace itk { /** \class ImageSourceCommon * \brief Secondary base class of ImageSource common between templates * * This class provides common non-templated code which can be compiled * and used by all templated versions of ImageSource. * * This class must be inherited privately, and light-weight adapting * of methods is required for virtual methods or non-private methods * for the ImageSource interface. * * \ingroup ITKCommon */ struct ITKCommon_EXPORT ImageSourceCommon { /** * Provide access to a common static object for image region splitting */ static const ImageRegionSplitterBase* GetGlobalDefaultSplitter(void); }; } // end namespace itk #endif
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __itkImageSourceCommon_h #define __itkImageSourceCommon_h #include "ITKCommonExport.h" #include "itkImageRegionSplitterBase.h" namespace itk { /** \class ImageSourceCommon * \brief Secondary base class of ImageSource common between templates * * This class provides common non-templated code which can be compiled * and used by all templated versions of ImageSource. * * This class must be inherited privately, and light-weight adapting * of methods is required for virtual methods or non-private methods * for the ImageSource interface. * * \ingroup ITKCommon */ struct ITKCommon_EXPORT ImageSourceCommon { /** * Provide access to a common static object for image region splitting */ static const ImageRegionSplitterBase* GetGlobalDefaultSplitter(void); }; } // end namespace itk #endif
CREATE was broken if namespace prefixes were set. Patch by Andreas Fuchs.
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "commands.h" int cmd_create(struct client *client) { struct mail_storage *storage; const char *mailbox; int directory; size_t len; /* <mailbox> */ if (!client_read_string_args(client, 1, &mailbox)) return FALSE; storage = client_find_storage(client, &mailbox); if (storage == NULL) return TRUE; len = strlen(mailbox); if (mailbox[len-1] != mail_storage_get_hierarchy_sep(storage)) directory = FALSE; else { /* name ends with hierarchy separator - client is just informing us that it wants to create children under this mailbox. */ directory = TRUE; mailbox = t_strndup(mailbox, len-1); } if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE)) return TRUE; if (mail_storage_mailbox_create(storage, mailbox, directory) < 0) client_send_storage_error(client, storage); else client_send_tagline(client, "OK Create completed."); return TRUE; }
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "commands.h" int cmd_create(struct client *client) { struct mail_storage *storage; const char *mailbox, *full_mailbox; int directory; size_t len; /* <mailbox> */ if (!client_read_string_args(client, 1, &mailbox)) return FALSE; full_mailbox = mailbox; storage = client_find_storage(client, &mailbox); if (storage == NULL) return TRUE; len = strlen(mailbox); if (mailbox[len-1] != mail_storage_get_hierarchy_sep(storage)) directory = FALSE; else { /* name ends with hierarchy separator - client is just informing us that it wants to create children under this mailbox. */ directory = TRUE; mailbox = t_strndup(mailbox, len-1); } if (!client_verify_mailbox_name(client, full_mailbox, FALSE, TRUE)) return TRUE; if (mail_storage_mailbox_create(storage, mailbox, directory) < 0) client_send_storage_error(client, storage); else client_send_tagline(client, "OK Create completed."); return TRUE; }
Fix typos in last commit.
/* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ #include <string.h> #include <stdlib.h> #include <stdio.h> #include "gsm.h" #include "private.h" gsm gsm_create () { gsm = (gsm)calloc(sizeof(struct gsm_state)); if (r) r->nrp = 40; return r; }
/* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ #include <string.h> #include <stdlib.h> #include <stdio.h> #include "gsm.h" #include "private.h" gsm gsm_create () { gsm r = (gsm)calloc(1, sizeof(struct gsm_state)); if (r) r->nrp = 40; return r; }
Fix bridging header for iOS Swift tests
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import <ObjectiveRocks/RocksDB.h> #import <ObjectiveRocks/RocksDBColumnFamily.h> #import <ObjectiveRocks/RocksDBColumnFamilyDescriptor.h> #import <ObjectiveRocks/RocksDBIterator.h> #import <ObjectiveRocks/RocksDBPrefixExtractor.h> #import <ObjectiveRocks/RocksDBWriteBatch.h> #import <ObjectiveRocks/RocksDBComparator.h> #import <ObjectiveRocks/RocksDBOptions.h> #import <ObjectiveRocks/RocksDBDatabaseOptions.h> #import <ObjectiveRocks/RocksDBColumnFamilyOptions.h> #import <ObjectiveRocks/RocksDBWriteOptions.h> #import <ObjectiveRocks/RocksDBReadOptions.h> #import <ObjectiveRocks/RocksDBTableFactory.h> #import <ObjectiveRocks/RocksDBBlockBasedTableOptions.h> #import <ObjectiveRocks/RocksDBCache.h> #import <ObjectiveRocks/RocksDBFilterPolicy.h> #import <ObjectiveRocks/RocksDBMemTableRepFactory.h> #import <ObjectiveRocks/RocksDBEnv.h> #import <ObjectiveRocks/RocksDBSnapshot.h> #import <ObjectiveRocks/RocksDBMergeOperator.h> #import <ObjectiveRocks/RocksDBTypes.h> #import <ObjectiveRocks/RocksDBRange.h>
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import <ObjectiveRocks/RocksDB.h> #import <ObjectiveRocks/RocksDBColumnFamily.h> #import <ObjectiveRocks/RocksDBColumnFamilyDescriptor.h> #import <ObjectiveRocks/RocksDBIterator.h> #import <ObjectiveRocks/RocksDBPrefixExtractor.h> #import <ObjectiveRocks/RocksDBWriteBatch.h> #import <ObjectiveRocks/RocksDBComparator.h> #import <ObjectiveRocks/RocksDBOptions.h> #import <ObjectiveRocks/RocksDBDatabaseOptions.h> #import <ObjectiveRocks/RocksDBColumnFamilyOptions.h> #import <ObjectiveRocks/RocksDBWriteOptions.h> #import <ObjectiveRocks/RocksDBReadOptions.h> #import <ObjectiveRocks/RocksDBTableFactory.h> #import <ObjectiveRocks/RocksDBBlockBasedTableOptions.h> #import <ObjectiveRocks/RocksDBCache.h> #import <ObjectiveRocks/RocksDBFilterPolicy.h> #import <ObjectiveRocks/RocksDBMemTableRepFactory.h> #import <ObjectiveRocks/RocksDBEnv.h> #import <ObjectiveRocks/RocksDBSnapshot.h> #import <ObjectiveRocks/RocksDBMergeOperator.h> #import <ObjectiveRocks/RocksDBRange.h>
Include basictypes.h for DISALLOW macro.
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_AURA_EVENT_FILTER_H_ #define UI_AURA_EVENT_FILTER_H_ #pragma once #include "base/logging.h" #include "ui/gfx/point.h" namespace aura { class Window; class MouseEvent; // An object that filters events sent to an owner window, potentially performing // adjustments to the window's position, size and z-index. class EventFilter { public: explicit EventFilter(Window* owner); virtual ~EventFilter(); // Try to handle |event| (before the owner's delegate gets a chance to). // Returns true if the event was handled by the WindowManager and should not // be forwarded to the owner's delegate. virtual bool OnMouseEvent(Window* target, MouseEvent* event); protected: Window* owner() { return owner_; } private: Window* owner_; DISALLOW_COPY_AND_ASSIGN(EventFilter); }; } // namespace aura #endif // UI_AURA_EVENT_FILTER_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_AURA_EVENT_FILTER_H_ #define UI_AURA_EVENT_FILTER_H_ #pragma once #include "base/basictypes.h" namespace aura { class Window; class MouseEvent; // An object that filters events sent to an owner window, potentially performing // adjustments to the window's position, size and z-index. class EventFilter { public: explicit EventFilter(Window* owner); virtual ~EventFilter(); // Try to handle |event| (before the owner's delegate gets a chance to). // Returns true if the event was handled by the WindowManager and should not // be forwarded to the owner's delegate. virtual bool OnMouseEvent(Window* target, MouseEvent* event); protected: Window* owner() { return owner_; } private: Window* owner_; DISALLOW_COPY_AND_ASSIGN(EventFilter); }; } // namespace aura #endif // UI_AURA_EVENT_FILTER_H_
Change NELEM to take VA_ARGS to handle commas
// Copyright 2015 Malcolm Inglis <http://minglis.id.au> // // This file is part of Libmacro. // // Libmacro 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. // // Libmacro 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 Libmacro. If not, see <https://gnu.org/licenses/>. #ifndef LIBMACRO_NELEM_H #define LIBMACRO_NELEM_H // Gives the number of elements in the array `XS`. Be very careful that // you only call this with an *array* variable, and not a pointer-to-array. // Note that this evaluates to a constant expression. #define NELEM( XS ) \ ( ( sizeof ( XS ) ) / ( sizeof ( ( XS )[ 0 ] ) ) ) #endif
// Copyright 2015 Malcolm Inglis <http://minglis.id.au> // // This file is part of Libmacro. // // Libmacro 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. // // Libmacro 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 Libmacro. If not, see <https://gnu.org/licenses/>. #ifndef LIBMACRO_NELEM_H #define LIBMACRO_NELEM_H // Gives the number of elements in the array `XS`. Be very careful that // you only call this with an *array* variable, and not a pointer-to-array. // Note that this evaluates to a constant expression. #define NELEM( ... ) \ ( ( sizeof ( __VA_ARGS__ ) ) / ( sizeof ( ( __VA_ARGS__ )[ 0 ] ) ) ) #endif
Copy bezierpath category from bibdesk to skim.
// // NSBezierPath_BDSKExtensions.h // Bibdesk // // Created by Adam Maxwell on 10/22/05. /* This software is Copyright (c) 2005,2006,2007 Adam Maxwell. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Adam Maxwell nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Cocoa/Cocoa.h> @interface NSBezierPath (BDSKExtensions) + (void)fillRoundRectInRect:(NSRect)rect radius:(float)radius; + (void)strokeRoundRectInRect:(NSRect)rect radius:(float)radius; + (NSBezierPath*)bezierPathWithRoundRectInRect:(NSRect)rect radius:(float)radius; + (void)drawHighlightInRect:(NSRect)rect radius:(float)radius lineWidth:(float)lineWidth color:(NSColor *)color; + (void)fillHorizontalOvalAroundRect:(NSRect)rect; + (void)strokeHorizontalOvalAroundRect:(NSRect)rect; + (NSBezierPath*)bezierPathWithHorizontalOvalAroundRect:(NSRect)rect; + (void)fillStarInRect:(NSRect)rect; + (void)fillInvertedStarInRect:(NSRect)rect; + (NSBezierPath *)bezierPathWithStarInRect:(NSRect)rect; + (NSBezierPath *)bezierPathWithInvertedStarInRect:(NSRect)rect; @end
Include KeyValuePair definition, if needed.
/** * Appcelerator Titanium - licensed under the Apache Public License 2 * see LICENSE in the root folder for details on the license. * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved. */ #ifndef TITANIUM_URL_H_ #define TITANIUM_URL_H_ namespace ti { void NormalizeURLCallback(const char* url, char* buffer, int bufferLength); void URLToFileURLCallback(const char* url, char* buffer, int bufferLength); int CanPreprocessURLCallback(const char* url); char* PreprocessURLCallback(const char* url, KeyValuePair* headers, char** mimeType); } #endif
/** * Appcelerator Titanium - licensed under the Apache Public License 2 * see LICENSE in the root folder for details on the license. * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved. */ #ifndef TITANIUM_URL_H_ #define TITANIUM_URL_H_ #ifndef KEYVALUESTRUCT typedef struct { char* key; char* value; } KeyValuePair; #define KEYVALUESTRUCT 1 #endif namespace ti { void NormalizeURLCallback(const char* url, char* buffer, int bufferLength); void URLToFileURLCallback(const char* url, char* buffer, int bufferLength); int CanPreprocessURLCallback(const char* url); char* PreprocessURLCallback(const char* url, KeyValuePair* headers, char** mimeType); } #endif
Add more common includes to PCH.
/* StdAfx.h * * Copyright (C) 2013 Michael Imamura * * 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 #ifdef _WIN32 # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # include <windows.h> #endif #include <math.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <list> #include <map> #include <memory> #include <string> #include <utility> #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_ttf.h>
/* StdAfx.h * * Copyright (C) 2013 Michael Imamura * * 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 #ifdef _WIN32 # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # include <windows.h> #endif #include <math.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <list> #include <map> #include <memory> #include <sstream> #include <string> #include <vector> #include <utility> #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_ttf.h>
Add simple post that triggers the earlier breakage of kcgi(3) with a blocking socket.
/* $Id$ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_CONFIG_H #include "../config.h" #endif #include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <curl/curl.h> #include "../kcgi.h" #include "regress.h" static int parent(CURL *curl) { const char *data = "foo=bar"; curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:17123/"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); return(CURLE_OK == curl_easy_perform(curl)); } static int child(void) { struct kreq r; const char *page = "index"; if (KCGI_OK != khttp_parse(&r, NULL, 0, &page, 1, 0)) return(0); khttp_head(&r, kresps[KRESP_STATUS], "%s", khttps[KHTTP_200]); khttp_head(&r, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[KMIME_TEXT_HTML]); khttp_body(&r); khttp_free(&r); return(1); } int main(int argc, char *argv[]) { return(regress_cgi(parent, child) ? EXIT_SUCCESS : EXIT_FAILURE); }
Switch `value_t` to be `uintptr_t`.
/* * 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
Add rudimentary init/clear test for fq_default_poly_factor.
/* Copyright (C) 2021 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */ #include "fq_default_poly_factor.h" #include <stdlib.h> #include <stdio.h> #include <gmp.h> #include "flint.h" #include "nmod_poly.h" #include "ulong_extras.h" int main(void) { int i; FLINT_TEST_INIT(state); flint_printf("init/clear...."); fflush(stdout); for (i = 0; i < 100 * flint_test_multiplier(); i++) { fq_default_ctx_t ctx; fq_default_poly_factor_t fq_poly_fac; fmpz_t p; fmpz_init(p); fmpz_set_ui(p, 5); fq_default_ctx_init(ctx, p, 5, "x"); fq_default_poly_factor_init(fq_poly_fac, ctx); fq_default_poly_factor_clear(fq_poly_fac, ctx); fq_default_ctx_clear(ctx); fq_default_ctx_init(ctx, p, 16, "x"); fq_default_poly_factor_init(fq_poly_fac, ctx); fq_default_poly_factor_clear(fq_poly_fac, ctx); fq_default_ctx_clear(ctx); fmpz_set_str(p, "73786976294838206473", 10); fq_default_ctx_init(ctx, p, 1, "x"); fq_default_poly_factor_init(fq_poly_fac, ctx); fq_default_poly_factor_clear(fq_poly_fac, ctx); fq_default_ctx_clear(ctx); fmpz_clear(p); } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return 0; }
Add another example on complex structure usage
#include "m-array.h" #include "m-string.h" /* This example show how to use complex structure with array embedding another library */ /* This is a trivial library */ typedef struct lib_ext_struct { int id; // Other data } lib_ext_struct; static lib_ext_struct *lib_ext_struct_Duplicate(const lib_ext_struct *obj) { lib_ext_struct *p = malloc(sizeof(lib_ext_struct)); if (!p) abort(); p->id = obj->id; return p; } static void lib_ext_struct_Delete(lib_ext_struct *obj) { free(obj); } /* This is the complex structure */ typedef struct { uint32_t id; string_t type; lib_ext_struct* properties; } data_node; static void data_node_init(data_node *obj) { obj->id = 0; string_init(obj->type); obj->properties = NULL; } static void data_node_init_set(data_node *obj, const data_node *src) { obj->id = src->id; string_init_set(obj->type, src->type); if (src->properties) obj->properties = lib_ext_struct_Duplicate(src->properties); else obj->properties = NULL; } static void data_node_set(data_node *obj, const data_node *src) { obj->id = src->id; string_set(obj->type, src->type); if (obj->properties) lib_ext_struct_Delete(obj->properties); if (src->properties) obj->properties = lib_ext_struct_Duplicate(src->properties); else obj->properties = NULL; } static void data_node_clear(data_node *obj) { string_clear(obj->type); if (obj->properties) lib_ext_struct_Delete(obj->properties); } ARRAY_DEF(array_data_node, data_node, (INIT(API_2(data_node_init)),SET(API_6(data_node_set)),INIT_SET(API_6(data_node_init_set)),CLEAR(API_2(data_node_clear)))) array_data_node_t global_array; int main(void) { array_data_node_init(global_array); array_data_node_clear(global_array); }
Update files, Alura, Introdução a C - Parte 2, Aula 2.1
#include <stdio.h> int main() { int notas[10]; notas[0] = 10; notas[2] = 9; notas[3] = 8; notas[9] = 4; printf("%d %d %d\n", notas[0], notas[2], notas[9]); }
Fix compilation errors on Mac OS
#pragma once #include <time.h> #include <sys/time.h> static inline unsigned long long current_time_ns() { #ifdef __MACH__ clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); unsigned long long s = 1000000000ULL * (unsigned long long)mts.tv_sec; return (unsigned long long)mts.tv_nsec + s; #else struct timespec t ={0,0}; clock_gettime(CLOCK_MONOTONIC, &t); unsigned long long s = 1000000000ULL * (unsigned long long)t.tv_sec; return (((unsigned long long)t.tv_nsec)) + s; #endif }
#pragma once #include <time.h> #include <sys/time.h> #ifdef __MACH__ #include <mach/clock.h> #include <mach/mach.h> #endif static inline unsigned long long current_time_ns() { #ifdef __MACH__ clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); unsigned long long s = 1000000000ULL * (unsigned long long)mts.tv_sec; return (unsigned long long)mts.tv_nsec + s; #else struct timespec t ={0,0}; clock_gettime(CLOCK_MONOTONIC, &t); unsigned long long s = 1000000000ULL * (unsigned long long)t.tv_sec; return (((unsigned long long)t.tv_nsec)) + s; #endif }
Use TERMINAL_IO_H as inclusion guard
#ifndef TERMINALIO_H #define TERMINALIO_H typedef struct io io_t; typedef struct chip8 chip8_t; io_t * terminal_io_new(void); void terminal_io_render(io_t *, chip8_t *); void terminal_io_listen(io_t *, chip8_t *); #endif
#ifndef TERMINAL_IO_H #define TERMINAL_IO_H typedef struct io io_t; typedef struct chip8 chip8_t; io_t * terminal_io_new(void); void terminal_io_render(io_t *, chip8_t *); void terminal_io_listen(io_t *, chip8_t *); #endif
Add macro to assign Double3 values from toml files
// ----------------------------------------------------------------------------- // // Copyright (C) The BioDynaMo Project. // 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. // // See the LICENSE file distributed with this work for details. // See the NOTICE file distributed with this work for additional information // regarding copyright ownership. // // ----------------------------------------------------------------------------- #ifndef CORE_UTIL_CPPTOML_H_ #define CORE_UTIL_CPPTOML_H_ #define BDM_ASSIGN_CONFIG_VALUE(variable, config_key) \ { \ if (config->contains_qualified(config_key)) { \ auto value = config->get_qualified_as<decltype(variable)>(config_key); \ if (value) { \ variable = *value; \ } \ } \ } #endif // CORE_UTIL_CPPTOML_H_
// ----------------------------------------------------------------------------- // // Copyright (C) The BioDynaMo Project. // 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. // // See the LICENSE file distributed with this work for details. // See the NOTICE file distributed with this work for additional information // regarding copyright ownership. // // ----------------------------------------------------------------------------- #ifndef CORE_UTIL_CPPTOML_H_ #define CORE_UTIL_CPPTOML_H_ #define BDM_ASSIGN_CONFIG_VALUE(variable, config_key) \ { \ if (config->contains_qualified(config_key)) { \ auto value = config->get_qualified_as<decltype(variable)>(config_key); \ if (value) { \ variable = *value; \ } \ } \ } #define BDM_ASSIGN_CONFIG_DOUBLE3_VALUE(variable, config_key) \ { \ if (config->contains_qualified(config_key)) { \ auto value = config->get_array_of<double>(config_key); \ if (value) { \ auto vector = *value; \ if (vector.size() == variable.size()) { \ for (uint64_t i = 0; i < vector.size(); i++) { \ variable[i] = vector[i]; \ } \ } else { \ Log::Fatal("cpptoml parameter parsing", \ "An error occured during parameter parsing of (", \ config_key, ". Array dimensions do not match"); \ } \ } \ } \ } #endif // CORE_UTIL_CPPTOML_H_
Use __builtin_trap to break to debugger
#include <stdarg.h> #include <stdio.h> #include <whitgl/logging.h> #define LOG_BUFFER_MAX (256) char _buffer[LOG_BUFFER_MAX]; void whitgl_logit(const char *file, const int line, const char *str, ...) { va_list args; va_start(args, str); vsnprintf(_buffer, LOG_BUFFER_MAX, str, args); printf("%24s:%03d %s\n", file, line, _buffer); } void whitgl_panic(const char *file, const int line, const char *str, ...) { va_list args; va_start(args, str); vsnprintf(_buffer, LOG_BUFFER_MAX, str, args); printf("PANIC %24s:%03d %s\n", file, line, _buffer); printf("PANIC %f", *(double*)0); // do something impossible to crash }
#include <stdarg.h> #include <stdio.h> #include <whitgl/logging.h> #define LOG_BUFFER_MAX (256) char _buffer[LOG_BUFFER_MAX]; void whitgl_logit(const char *file, const int line, const char *str, ...) { va_list args; va_start(args, str); vsnprintf(_buffer, LOG_BUFFER_MAX, str, args); printf("%24s:%03d %s\n", file, line, _buffer); } void whitgl_panic(const char *file, const int line, const char *str, ...) { va_list args; va_start(args, str); vsnprintf(_buffer, LOG_BUFFER_MAX, str, args); printf("PANIC %24s:%03d %s\n", file, line, _buffer); __builtin_trap(); }
Include arraytypes.c early for the no separate compilation case.
/* * This file includes all the .c files needed for a complete multiarray module. * This is used in the case where separate compilation is not enabled */ #include "common.c" #include "hashdescr.c" #include "numpyos.c" #include "scalarapi.c" #include "descriptor.c" #include "flagsobject.c" #include "ctors.c" #include "iterators.c" #include "mapping.c" #include "number.c" #include "getset.c" #include "sequence.c" #include "methods.c" #include "convert_datatype.c" #include "convert.c" #include "shape.c" #include "item_selection.c" #include "calculation.c" #include "usertypes.c" #include "refcount.c" #include "conversion_utils.c" #include "buffer.c" #include "arraytypes.c" #include "scalartypes.c" #ifndef Py_UNICODE_WIDE #include "ucsnarrow.c" #endif #include "arrayobject.c" #include "multiarraymodule.c"
/* * This file includes all the .c files needed for a complete multiarray module. * This is used in the case where separate compilation is not enabled * * Note that the order of the includs matters */ #include "common.c" #include "arraytypes.c" #include "hashdescr.c" #include "numpyos.c" #include "scalarapi.c" #include "descriptor.c" #include "flagsobject.c" #include "ctors.c" #include "iterators.c" #include "mapping.c" #include "number.c" #include "getset.c" #include "sequence.c" #include "methods.c" #include "convert_datatype.c" #include "convert.c" #include "shape.c" #include "item_selection.c" #include "calculation.c" #include "usertypes.c" #include "refcount.c" #include "conversion_utils.c" #include "buffer.c" #include "scalartypes.c" #ifndef Py_UNICODE_WIDE #include "ucsnarrow.c" #endif #include "arrayobject.c" #include "multiarraymodule.c"
Complete the license switch to 2-clause BSD
/* $Id$ */ /* Copyright (c) 2017 Pierre Pronchery <khorben@defora.org> */ /* This file is part of DeforaOS Desktop Mixer */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DESKTOP_MIXER_H # define DESKTOP_MIXER_H # include "Mixer/control.h" #endif /* !DESKTOP_MIXER_H */
/* $Id$ */ /* Copyright (c) 2017 Pierre Pronchery <khorben@defora.org> */ /* This file is part of DeforaOS Desktop Mixer */ /* 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef DESKTOP_MIXER_H # define DESKTOP_MIXER_H # include "Mixer/control.h" #endif /* !DESKTOP_MIXER_H */
Change order of declarations to suppress compiler warning.
#include <Instrument.h> // the base class for this instrument class MYINST : public Instrument { public: MYINST(); virtual ~MYINST(); virtual int init(double *, int); virtual int configure(); virtual int run(); private: void doupdate(); int _nargs, _inchan, _branch; float _amp, _pan; float *_in; };
#include <Instrument.h> // the base class for this instrument class MYINST : public Instrument { public: MYINST(); virtual ~MYINST(); virtual int init(double *, int); virtual int configure(); virtual int run(); private: void doupdate(); float *_in; int _nargs, _inchan, _branch; float _amp, _pan; };