Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add header and footer comments | #if !defined(PARROT_ENUMS_H_GUARD)
#define PARROT_ENUMS_H_GUARD
typedef enum {
NO_STACK_ENTRY_TYPE = 0,
STACK_ENTRY_INT = 1,
STACK_ENTRY_FLOAT = 2,
STACK_ENTRY_STRING = 3,
STACK_ENTRY_PMC = 4,
STACK_ENTRY_POINTER = 5,
STACK_ENTRY_DESTINATION = 6
} Stack_entry_type;
typedef enum {
NO_STACK_ENTRY_FLAGS = 0,
STACK_ENTRY_CLEANUP_FLAG = 1 << 0
} Stack_entry_flags;
typedef enum {
NO_STACK_CHUNK_FLAGS = 0,
STACK_CHUNK_COW_FLAG = 1 << 0
} Stack_chunk_flags;
#endif
| /* enums.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* Overview:
* enums shared by much of the stack-handling code
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#if !defined(PARROT_ENUMS_H_GUARD)
#define PARROT_ENUMS_H_GUARD
typedef enum {
NO_STACK_ENTRY_TYPE = 0,
STACK_ENTRY_INT = 1,
STACK_ENTRY_FLOAT = 2,
STACK_ENTRY_STRING = 3,
STACK_ENTRY_PMC = 4,
STACK_ENTRY_POINTER = 5,
STACK_ENTRY_DESTINATION = 6
} Stack_entry_type;
typedef enum {
NO_STACK_ENTRY_FLAGS = 0,
STACK_ENTRY_CLEANUP_FLAG = 1 << 0
} Stack_entry_flags;
typedef enum {
NO_STACK_CHUNK_FLAGS = 0,
STACK_CHUNK_COW_FLAG = 1 << 0
} Stack_chunk_flags;
#endif
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/
|
Make cart and apu members private | #ifndef CONSOLE_H
#define CONSOLE_H
#include <string>
#include <Cart.h>
#include <Controller.h>
#include <CPU.h>
#include <PPU.h>
#include <APU.h>
class Divider {
public:
Divider(int interval = 1) {
setInterval(interval);
}
void setInterval(int interval) {
this->interval = interval;
clockCounter = interval - 1;
}
void tick() {
clockCounter++;
if (clockCounter == interval) {
clockCounter = 0;
}
}
bool hasClocked() {
return clockCounter == 0;
}
private:
int interval;
int clockCounter;
};
class Console {
public:
Console() : cpuDivider(3) { }
void boot();
bool loadINesFile(std::string fileName);
uint32_t *getFrameBuffer();
void runForOneFrame();
Cart cart;
Controller controller1;
APU apu;
private:
void tick();
PPU ppu;
CPU cpu;
Divider cpuDivider;
};
#endif
| #ifndef CONSOLE_H
#define CONSOLE_H
#include <string>
#include <Cart.h>
#include <Controller.h>
#include <CPU.h>
#include <PPU.h>
#include <APU.h>
class Divider {
public:
Divider(int interval = 1) {
setInterval(interval);
}
void setInterval(int interval) {
this->interval = interval;
clockCounter = interval - 1;
}
void tick() {
clockCounter++;
if (clockCounter == interval) {
clockCounter = 0;
}
}
bool hasClocked() {
return clockCounter == 0;
}
private:
int interval;
int clockCounter;
};
class Console {
public:
Console() : cpuDivider(3) { }
void boot();
bool loadINesFile(std::string fileName);
uint32_t *getFrameBuffer();
void runForOneFrame();
Controller controller1;
private:
void tick();
Cart cart;
APU apu;
PPU ppu;
CPU cpu;
Divider cpuDivider;
};
#endif
|
Fix some wording for unit tests. | #include <stdio.h>
#include <stdlib.h>
#include "../libcpsl.h"
#include <signal.h>
#define RUNTEST(x) ((CurrentTest = #x), x(), printf("Test \"%s\" passed.\n", #x))
static const char *CurrentTest = NULL;
static void SigHandler(const int Signal);
static inline void InitTestUnit(void)
{
CPSL_Configure(malloc, free, realloc);
signal(SIGABRT, SigHandler);
signal(SIGSEGV, SigHandler);
signal(SIGTERM, SigHandler);
signal(SIGILL, SigHandler);
signal(SIGFPE, SigHandler);
signal(SIGQUIT, SigHandler);
signal(SIGBUS, SigHandler);
}
static void SigHandler(const int Signal)
{
fprintf(stderr, "Received signal number %d while running test \"%s()\"\n", Signal, CurrentTest);
exit(1);
}
| #include <stdio.h>
#include <stdlib.h>
#include "../libcpsl.h"
#include <signal.h>
#define RUNTEST(x) ((CurrentTest = #x), x(), printf("Subtest \"%s\" passed.\n", #x))
static const char *CurrentTest = NULL;
static void SigHandler(const int Signal);
static inline void InitTestUnit(void)
{
CPSL_Configure(malloc, free, realloc);
signal(SIGABRT, SigHandler);
signal(SIGSEGV, SigHandler);
signal(SIGTERM, SigHandler);
signal(SIGILL, SigHandler);
signal(SIGFPE, SigHandler);
signal(SIGQUIT, SigHandler);
signal(SIGBUS, SigHandler);
puts("Running test \"" __FILE__ "\"");
}
static void SigHandler(const int Signal)
{
fprintf(stderr, "Received signal number %d while running test \"%s()\"\n", Signal, CurrentTest);
exit(1);
}
|
Return answer when multiple or divide | #include "calc.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int calc(const char* p, int mul_div_flag)
{
int i;
int ans;
ans = atoi(p);
i = 0;
while (p[i] != '\0'){
while (isdigit(p[i])){
i++;
}
switch (p[i]){
case '+':
return (ans + calc(p + i + 1, 0));
case '-':
return (ans - calc(p + i + 1, 0));
case '*':
ans *= calc(p + i + 1, 1);
if (p[i + 1] == '('){
while (p[i] != ')'){
i++;
}
}
i++;
break;
case '/':
ans /= calc(p + i + 1, 1);
if (p[i + 1] == '('){
while (p[i] != ')'){
i++;
}
}
i++;
break;
case '(':
return (calc(p + i + 1, 0));
case ')':
case '\0':
return (ans);
default:
puts("Error");
return (0);
}
}
return (ans);
}
| #include "calc.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int calc(const char* p, int mul_div_flag)
{
int i;
int ans;
ans = atoi(p);
if (p[0] != '(' && mul_div_flag == 1){
return (ans);
}
i = 0;
while (p[i] != '\0'){
while (isdigit(p[i])){
i++;
}
switch (p[i]){
case '+':
return (ans + calc(p + i + 1, 0));
case '-':
return (ans - calc(p + i + 1, 0));
case '*':
ans *= calc(p + i + 1, 1);
if (p[i + 1] == '('){
while (p[i] != ')'){
i++;
}
}
i++;
break;
case '/':
ans /= calc(p + i + 1, 1);
if (p[i + 1] == '('){
while (p[i] != ')'){
i++;
}
}
i++;
break;
case '(':
return (calc(p + i + 1, 0));
case ')':
case '\0':
return (ans);
default:
puts("Error");
return (0);
}
}
return (ans);
}
|
Add solution for problem 80 | #include <stdio.h>
#include <math.h>
#include <gmp.h>
int is_perfect_sq(int n)
{
int s = sqrt(n);
return s * s == n;
}
int main(void)
{
// 10^100 ~< 2^400
mpf_set_default_prec(512);
mpf_t a;
mpf_init(a);
int total_sum = 0;
// Count through 100 irrational roots
for (int i = 2; i <= 100; ++i) {
if (is_perfect_sq(i)) {
continue;
}
mpf_sqrt_ui(a, i);
int digital_sum = 0;
// Count 100 decimal digits
for (int i = 0; i < 100; ++i) {
long ip = mpf_get_ui(a);
digital_sum += ip % 10;
mpf_sub_ui(a, a, ip);
mpf_mul_ui(a, a, 10);
}
total_sum += digital_sum;
}
printf("%d\n", total_sum);
mpf_clear(a);
}
| |
Add back virtual dtor for IOperation | #pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATION_H_
#include <unordered_map>
#include "../task_typedefs.h"
namespace You {
namespace DataStore {
/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
/// Executes the operation
virtual bool run() = 0;
protected:
TaskId taskId;
SerializedTask task;
};
} // namespace DataStore
} // namespace You
#endif // YOU_DATASTORE_INTERNAL_OPERATION_H_
| #pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATION_H_
#include <unordered_map>
#include "../task_typedefs.h"
namespace You {
namespace DataStore {
/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
virtual ~IOperation();
/// Executes the operation
virtual bool run() = 0;
protected:
TaskId taskId;
SerializedTask task;
};
} // namespace DataStore
} // namespace You
#endif // YOU_DATASTORE_INTERNAL_OPERATION_H_
|
Fix typo in macro guard HTCONDOR-390 | /***************************************************************
*
* Copyright (C) 1990-2021, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* 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.
*
***************************************************************/
// Encapsulate the linux peformance counter, for insn retired
// Note this is included in the procd, so we can't use full condor libraries
#ifndef __PERF_COUNTER_H
#define _PERF_COUNTER_H
#include <sys/types.h>
class PerfCounter {
public:
PerfCounter(pid_t pid);
virtual ~PerfCounter();
void start() const;
void stop() const;
long long getInsns() const;
private:
pid_t pid;
int fd;
};
#endif
| /***************************************************************
*
* Copyright (C) 1990-2021, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* 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.
*
***************************************************************/
// Encapsulate the linux peformance counter, for insn retired
// Note this is included in the procd, so we can't use full condor libraries
#ifndef __PERF_COUNTER_H
#define __PERF_COUNTER_H
#include <sys/types.h>
class PerfCounter {
public:
PerfCounter(pid_t pid);
virtual ~PerfCounter();
void start() const;
void stop() const;
long long getInsns() const;
private:
pid_t pid;
int fd;
};
#endif
|
Define UIBackgroundTaskIdentifier if on OS X | //
// TMCacheBackgroundTaskManager.h
// TMCache
//
// Created by Bryan Irace on 4/24/15.
// Copyright (c) 2015 Tumblr. All rights reserved.
//
@import UIKit;
/**
A protocol that classes who can begin and end background tasks can conform to. This protocol provides an abstraction in
order to avoid referencing `+ [UIApplication sharedApplication]` from within an iOS application extension.
*/
@protocol TMCacheBackgroundTaskManager <NSObject>
/**
Marks the beginning of a new long-running background task.
@return A unique identifier for the new background task. You must pass this value to the `endBackgroundTask:` method to
mark the end of this task. This method returns `UIBackgroundTaskInvalid` if running in the background is not possible.
*/
- (UIBackgroundTaskIdentifier)beginBackgroundTask;
/**
Marks the end of a specific long-running background task.
@param identifier An identifier returned by the `beginBackgroundTaskWithExpirationHandler:` method.
*/
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;
@end
| //
// TMCacheBackgroundTaskManager.h
// TMCache
//
// Created by Bryan Irace on 4/24/15.
// Copyright (c) 2015 Tumblr. All rights reserved.
//
@import UIKit;
#ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
typedef NSUInteger UIBackgroundTaskIdentifier;
#endif
/**
A protocol that classes who can begin and end background tasks can conform to. This protocol provides an abstraction in
order to avoid referencing `+ [UIApplication sharedApplication]` from within an iOS application extension.
*/
@protocol TMCacheBackgroundTaskManager <NSObject>
/**
Marks the beginning of a new long-running background task.
@return A unique identifier for the new background task. You must pass this value to the `endBackgroundTask:` method to
mark the end of this task. This method returns `UIBackgroundTaskInvalid` if running in the background is not possible.
*/
- (UIBackgroundTaskIdentifier)beginBackgroundTask;
/**
Marks the end of a specific long-running background task.
@param identifier An identifier returned by the `beginBackgroundTaskWithExpirationHandler:` method.
*/
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;
@end
|
Fix compiler warning in IAR | #pragma once
namespace TupleManipulation {
template<int... Integers>
struct sequence { };
template<int N, int... Integers>
struct gen_sequence : public gen_sequence<N - 1, N - 1, Integers...> { };
template<int... Integers>
struct gen_sequence<0, Integers...> : public sequence<Integers...> { };
template<typename Tuple, typename Functor, int... Integers>
void for_each(Tuple&& tuple, Functor functor, sequence<Integers...>)
{
auto l = { (functor(std::get<Integers>(tuple)), 0)... };
(void)l;
}
template<typename... Types, typename Functor>
void for_each_in_tuple(std::tuple<Types...> & tuple, Functor functor)
{
for_each(tuple, functor, gen_sequence<sizeof...(Types)>());
}
template <typename T, typename Tuple>
struct has_type;
template <typename T>
struct has_type<T, std::tuple<>>
{
static constexpr bool value = false;
};
template <typename T, typename U, typename... Ts>
struct has_type<T, std::tuple<U, Ts...>> : has_type<T, std::tuple<Ts...>> {};
template <typename T, typename... Ts>
struct has_type<T, std::tuple<T, Ts...>> : std::true_type
{
static constexpr bool value = true;
};
}
| #pragma once
namespace TupleManipulation {
template<int... Integers>
struct sequence { };
template<int N, int... Integers>
struct gen_sequence : public gen_sequence<N - 1, N - 1, Integers...> { };
template<int... Integers>
struct gen_sequence<0, Integers...> : public sequence<Integers...> { };
template<typename Tuple, typename Functor, int... Integers>
void for_each(Tuple&& tuple, Functor functor, sequence<Integers...>)
{
auto l = { (functor(std::get<Integers>(tuple)), 0)... };
(void)l;
}
template<typename... Types, typename Functor>
void for_each_in_tuple(std::tuple<Types...> & tuple, Functor functor)
{
for_each(tuple, functor, gen_sequence<sizeof...(Types)>());
}
template <typename T, typename Tuple>
struct has_type;
template <typename T>
struct has_type<T, std::tuple<>>
{
static constexpr bool value = false;
};
template <typename T, typename U, typename... Ts>
struct has_type<T, std::tuple<U, Ts...>> : public has_type<T, std::tuple<Ts...>> {};
template <typename T, typename... Ts>
struct has_type<T, std::tuple<T, Ts...>> : public std::true_type
{
static constexpr bool value = true;
};
}
|
Fix building error on Linux | #ifndef windowManager_H
#define windowManager_H
#include <iostream>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
class windowManager
{
public:
void init();
void windowManager::getScreenSize();
//Functions to return dimensions of window
int getWindowHeight();
int getWindowWidth();
GLFWwindow* getWindow();
private:
//The window height
int width;
int height;
GLFWwindow* currentWindow;
};
#endif
| #ifndef windowManager_H
#define windowManager_H
#include <iostream>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
class windowManager
{
public:
void init();
void getScreenSize();
//Functions to return dimensions of window
int getWindowHeight();
int getWindowWidth();
GLFWwindow* getWindow();
private:
//The window height
int width;
int height;
GLFWwindow* currentWindow;
};
#endif
|
Allow parsing firmware with fwupdtool | /*
* Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-plugin-vfuncs.h"
#include "fu-solokey-device.h"
void
fu_plugin_init (FuPlugin *plugin)
{
fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.solokeys");
fu_plugin_set_device_gtype (plugin, FU_TYPE_SOLOKEY_DEVICE);
}
| /*
* Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-plugin-vfuncs.h"
#include "fu-solokey-device.h"
#include "fu-solokey-firmware.h"
void
fu_plugin_init (FuPlugin *plugin)
{
fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.solokeys");
fu_plugin_set_device_gtype (plugin, FU_TYPE_SOLOKEY_DEVICE);
fu_plugin_add_firmware_gtype (plugin, "solokey", FU_TYPE_SOLOKEY_FIRMWARE);
}
|
Rename GuidedSectionExtraction.h to Crc32GuidedSectonExtraction.h to avoid naming collision with that in MdePkg. Remove the duplicate definition. | /** @file
This file declares GUIDed section extraction protocol.
This interface provides a means of decoding a GUID defined encapsulation
section. There may be multiple different GUIDs associated with the GUIDed
section extraction protocol. That is, all instances of the GUIDed section
extraction protocol must have the same interface structure.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: GuidedSectionExtraction.h
@par Revision Reference:
This protocol is defined in Firmware Volume Specification.
Version 0.9
**/
#ifndef __CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
#define __CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
//
// Protocol GUID definition. Each GUIDed section extraction protocol has the
// same interface but with different GUID. All the GUIDs is defined here.
// May add multiple GUIDs here.
//
#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID \
{ \
0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } \
}
//
// may add other GUID here
//
extern EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid;
#endif
| |
Add link to the library | #pragma once
#include <YunMQTTClient.h>
class ShiftrConnector {
public :
void sendCounter(int counter);
void init();
void loop();
//default constructor
ShiftrConnector() {};
private :
YunMQTTClient client;
void connect();
};
| #pragma once
//https://github.com/256dpi/arduino-mqtt
#include <YunMQTTClient.h>
class ShiftrConnector {
public :
void sendCounter(int counter);
void init();
void loop();
//default constructor
ShiftrConnector() {};
private :
YunMQTTClient client;
void connect();
};
|
Remove exposed function from AEAD Chacha20 Poly1305 code | #include "Chacha20.h"
#include "Poly1305_64.h"
void blit(uint8_t* src, uint32_t len, uint8_t* dest, uint32_t pos);
void poly1305_key_gen(uint8_t* otk, uint8_t* key, uint8_t* nonce);
uint32_t hacl_aead_chacha20_poly1305_encrypt(uint8_t *plaintext, uint32_t plaintext_len,
uint8_t *aad, uint32_t aad_len,
uint8_t *key, uint8_t *iv,
uint8_t *ciphertext, uint8_t *tag);
| #include "Chacha20.h"
#include "Poly1305_64.h"
void poly1305_key_gen(uint8_t* otk, uint8_t* key, uint8_t* nonce);
uint32_t hacl_aead_chacha20_poly1305_encrypt(uint8_t *plaintext, uint32_t plaintext_len,
uint8_t *aad, uint32_t aad_len,
uint8_t *key, uint8_t *iv,
uint8_t *ciphertext, uint8_t *tag);
|
Change rand cache to a struct since everything is public. Add comment. | /*===- RandomNumbers.h - libSimulation -========================================
*
* DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/
#ifndef RANDOMNUMBERS
#define RANDOMNUMBERS
#include <random>
#include "VectorCompatibility.h"
class RandomNumbers {
public:
RandomNumbers();
~RandomNumbers() {}
const double uniformZeroToOne();
const double uniformZeroToTwoPi();
const double guassian(std::normal_distribution<double> &dist);
private:
std::mt19937_64 engine;
std::uniform_real_distribution<double> zeroToOne;
std::uniform_real_distribution<double> zeroToTwoPi;
};
class RandCache {
public:
__m128d r;
double l, h;
RandCache(const __m128d r_ = _mm_set1_pd(0.0),
const double l_ = 0.0, const double h_ = 0.0)
: r(r_), l(l_), h(h_) {}
};
#endif // RANDOMNUMBERS
| /*===- RandomNumbers.h - libSimulation -========================================
*
* DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/
#ifndef RANDOMNUMBERS
#define RANDOMNUMBERS
#include <random>
#include "VectorCompatibility.h"
class RandomNumbers {
public:
RandomNumbers();
~RandomNumbers() {}
const double uniformZeroToOne();
const double uniformZeroToTwoPi();
const double guassian(std::normal_distribution<double> &dist);
private:
std::mt19937_64 engine;
std::uniform_real_distribution<double> zeroToOne;
std::uniform_real_distribution<double> zeroToTwoPi;
};
// Structure to hold precomuted random numbers for use with thermal forces.
struct RandCache {
__m128d r;
double l, h;
RandCache(const __m128d r_ = _mm_set1_pd(0.0),
const double l_ = 0.0, const double h_ = 0.0)
: r(r_), l(l_), h(h_) {}
};
#endif // RANDOMNUMBERS
|
Make plugins's init() function external C | #ifndef IFACE_H_INCLUDED
#define IFACE_H_INCLUDED
#include <fcntl.h>
typedef struct funcs_t {
unsigned char *(*get_mem_buf_hash)(unsigned char *mem_buf, unsigned long int mem_size);
unsigned char *(*hash_to_str)(unsigned char *mem_hash);
int (*is_mem_buf_dumped)(unsigned char *mem_hash);
void (*dump_mem_buf)(unsigned char *mem_buf, unsigned long int mem_size, char *fname);
} funcs_t;
typedef struct plugin_t {
void *hndl;
char *name;
char *description;
struct plugin_t *next;
} plugin_t;
#endif | #ifndef IFACE_H_INCLUDED
#define IFACE_H_INCLUDED
#include <fcntl.h>
typedef struct plugin_t {
void *hndl;
char *name;
char *description;
struct plugin_t *next;
} plugin_t;
#ifdef __cplusplus
extern "C" plugin_t *init();
#endif
#endif |
Update manual Fix CDROM script to handle non-existant files | /* */
#undef VERSION
#define VERSION "1.35.2"
#define BDATE "28 August 2004"
#define LSMDATE "28Aug04"
/* Debug flags */
#undef DEBUG
#define DEBUG 1
#define TRACEBACK 1
#define SMCHECK
#define TRACE_FILE 1
/* Debug flags not normally turned on */
/* #define TRACE_JCR_CHAIN 1 */
/* #define TRACE_RES 1 */
/* #define DEBUG_MEMSET 1 */
#define DEBUG_BLOCK_ZEROING 1
/* #define FULL_DEBUG 1 */ /* normally on for testing only */
/* Turn this on ONLY if you want all Dmsg() to append to the
* trace file. Implemented mainly for Win32 ...
*/
/* #define SEND_DMSG_TO_FILE 1 */
/* #define NO_ATTRIBUTES_TEST 1 */
/* #define NO_TAPE_WRITE_TEST 1 */
/* #define FD_NO_SEND TEST 1 */
/* #define DEBUG_MUTEX 1 */
| /* */
#undef VERSION
#define VERSION "1.35.2"
#define BDATE "30 August 2004"
#define LSMDATE "30Aug04"
/* Debug flags */
#undef DEBUG
#define DEBUG 1
#define TRACEBACK 1
#define SMCHECK
#define TRACE_FILE 1
/* Debug flags not normally turned on */
/* #define TRACE_JCR_CHAIN 1 */
/* #define TRACE_RES 1 */
/* #define DEBUG_MEMSET 1 */
#define DEBUG_BLOCK_ZEROING 1
/* #define FULL_DEBUG 1 */ /* normally on for testing only */
/* Turn this on ONLY if you want all Dmsg() to append to the
* trace file. Implemented mainly for Win32 ...
*/
/* #define SEND_DMSG_TO_FILE 1 */
/* #define NO_ATTRIBUTES_TEST 1 */
/* #define NO_TAPE_WRITE_TEST 1 */
/* #define FD_NO_SEND TEST 1 */
/* #define DEBUG_MUTEX 1 */
|
Add unfinished loop to encode message | #include <stdio.h>
#include <cs50.h>
int main(int argc, char *argv[]) {
// check entered key
if (argc != 2 || atoi(argv[1]) < 0) {
printf("Usage: ./caesar k\nWhere k is a non negative integer.\n");
return 1;
}
int key = atoi(argv[1]);
return 0;
}
| #include <stdio.h>
#include <cs50.h>
#include <string.h>
#define ALPHA_NUM 26
int main(int argc, char *argv[]) {
// check argument number and argument key to be greater than -1
if (argc != 2 || atoi(argv[1]) < 0) {
printf("Usage (k >= 0):\n./caesar k \n");
return 1;
}
int key = atoi(argv[1]) % ALPHA_NUM;
// get plaintext from user
printf("plaintext: ");
string plaintext = get_string();
printf("\n");
string ciphertext = "";
// encode plaintext
size_t text_len = strlen(plaintext);
for (int i = 0; i < text_len; ++i) {
}
return 0;
}
|
Update min/max global SGIDs values to match Schema Transformer | /*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
#define SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
#include <boost/array.hpp>
#include <boost/system/error_code.hpp>
#include <string>
#include "base/parse_object.h"
#include "bgp/bgp_common.h"
class SecurityGroup {
public:
static const int kSize = 8;
static const uint32_t kMinGlobalId = 1000000;
static const uint32_t kMaxGlobalId = 1999999;
typedef boost::array<uint8_t, kSize> bytes_type;
SecurityGroup(as_t asn, uint32_t id);
explicit SecurityGroup(const bytes_type &data);
as_t as_number() const;
uint32_t security_group_id() const;
bool IsGlobal() const;
const bytes_type &GetExtCommunity() const {
return data_;
}
const uint64_t GetExtCommunityValue() const {
return get_value(data_.begin(), 8);
}
std::string ToString();
private:
bytes_type data_;
};
#endif // SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
| /*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
#define SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
#include <boost/array.hpp>
#include <boost/system/error_code.hpp>
#include <string>
#include "base/parse_object.h"
#include "bgp/bgp_common.h"
class SecurityGroup {
public:
static const int kSize = 8;
static const uint32_t kMinGlobalId = 1;
static const uint32_t kMaxGlobalId = 7999999;
typedef boost::array<uint8_t, kSize> bytes_type;
SecurityGroup(as_t asn, uint32_t id);
explicit SecurityGroup(const bytes_type &data);
as_t as_number() const;
uint32_t security_group_id() const;
bool IsGlobal() const;
const bytes_type &GetExtCommunity() const {
return data_;
}
const uint64_t GetExtCommunityValue() const {
return get_value(data_.begin(), 8);
}
std::string ToString();
private:
bytes_type data_;
};
#endif // SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
|
Add file that SVN somehow missed. | /*
This file is part of the kblog library.
Copyright (c) 2006-2007 Christian Weilbach <christian_weilbach@web.de>
Copyright (c) 2007 Mike Arthur <mike@mikearthur.co.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef BLOGPOSTINGCOMMENT_P_H
#define BLOGPOSTINGCOMMENT_P_H
#include "blogcomment.h"
#include <KDateTime>
#include <KUrl>
namespace KBlog{
class BlogCommentPrivate
{
public:
BlogComment *q_ptr;
QString mTitle;
QString mContent;
QString mEmail;
QString mName;
QString mCommentId;
KUrl mUrl;
QString mError;
BlogComment::Status mStatus;
KDateTime mModificationDateTime;
KDateTime mCreationDateTime;
};
} // namespace KBlog
#endif
| |
Add task with points for October | #include <stdio.h>
void increase_coordinates();
typedef struct {
int x;
int y;
int z;
} Point;
Point pt;
int main () {
printf("x = ");scanf("%d",&pt.x);
printf("y = ");scanf("%d",&pt.y);
printf("z = ");scanf("%d",&pt.z);
increase_coordinates();
printf("\nx = %d", pt.x);
printf("\ny = %d", pt.y);
printf("\nz = %d", pt.z);
return 0;
}
void increase_coordinates () {
pt.x = pt.x + 1;
pt.y = pt.y + 1;
pt.z = pt.z + 1;
}
| |
Add comment on why ana.int.wrap_on_signed_overflow needs to enabled for test case | //PARAM: --enable ana.int.wrap_on_signed_overflow
#include<stdio.h>
#include<assert.h>
int main() {
int i,k,j;
if (k == 5) {
assert(k == 5);
return 0;
}
assert(k != 5);
// simple arithmetic
i = k + 1;
assert(i != 6);
i = k - 1;
assert(i != 4);
i = k * 3; // multiplication with odd numbers is injective
assert(i != 15);
i = k * 2; // multiplication with even numbers is not injective
assert(i != 10); // UNKNOWN! k could be -2147483643;
i = k / 2;
assert(i != 2); // UNKNOWN! k could be 4
return 0;
}
| //PARAM: --enable ana.int.wrap_on_signed_overflow
// Enabling ana.int.wrap_on_signed_overflow here, to retain precision for cases when a signed overflow might occcur
#include<stdio.h>
#include<assert.h>
int main() {
int i,k,j;
if (k == 5) {
assert(k == 5);
return 0;
}
assert(k != 5);
// Signed overflows might occur in some of the following operations (e.g. the first assignment k could be MAX_INT).
// Signed overflows are undefined behavior, so by default we go to top when they might occur.
// Here we activated wrap_on_signed_overflow, so we retain precision, assuming that signed overflows are defined (via the usual two's complement representation).
// simple arithmetic
i = k + 1;
assert(i != 6);
i = k - 1;
assert(i != 4);
i = k * 3; // multiplication with odd numbers is injective
assert(i != 15);
i = k * 2; // multiplication with even numbers is not injective
assert(i != 10); // UNKNOWN! k could be -2147483643;
i = k / 2;
assert(i != 2); // UNKNOWN! k could be 4
return 0;
}
|
Use quoted includes in umbrella header | //
// KVODelegate.h
// KVODelegate
//
// Created by Ian Gregory on 15-03-2017.
// Copyright © 2017 ThatsJustCheesy. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <KVODelegate/KVOObservationDelegate.h>
#import <KVODelegate/KVONotificationDelegate.h>
| //
// KVODelegate.h
// KVODelegate
//
// Created by Ian Gregory on 15-03-2017.
// Copyright © 2017 ThatsJustCheesy. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "KVOObservationDelegate.h"
#import "KVONotificationDelegate.h"
|
Add antibiotic concentration artificial minimum floor | #include <math.h>
#include "abBlood.h"
void updateAB(simBac *sim)
{
sim->c_b = sim->c_b_peak * \
exp( -1 * sim->param.k_a * \
( sim->t - sim->param.doses_t[sim->dose_num-1] ) \
/ sim->param.v_w );
// Exponential decay from last time spike
// ( 1.0 - sim->param.t_s * sim->param.gam_ab ) * sim->c_b;
// Exponential decay according to renal clearance rate
if (sim->c_b < 0) // set 0 as min concentration
{
sim->c_b = 0;
}
if (sim->dose_num < sim->param.num_doses) // if under total number of doses
{
if (sim->t >= sim->param.doses_t[sim->dose_num])
// If we're at the next dosing time...
{
sim->c_b += sim->param.doses_c[sim->dose_num];
// Add concentration of next dose to blood
++sim->dose_num; // Advance dose counter
sim->c_b_peak = sim->c_b; // set new peak concentration
}
}
}
| #include <math.h>
#include "abBlood.h"
void updateAB(simBac *sim)
{
sim->c_b = sim->c_b_peak * \
exp( -1 * sim->param.k_a * \
( sim->t - sim->param.doses_t[sim->dose_num-1] ) \
/ sim->param.v_w );
// Exponential decay from last time spike
// ( 1.0 - sim->param.t_s * sim->param.gam_ab ) * sim->c_b;
// Exponential decay according to renal clearance rate
if (sim->c_b < sim->param.c_c / 2) // set half of c_c as min concentration
{
sim->c_b = sim->param.c_c / 2;
}
if (sim->dose_num < sim->param.num_doses) // if under total number of doses
{
if (sim->t >= sim->param.doses_t[sim->dose_num])
// If we're at the next dosing time...
{
sim->c_b += sim->param.doses_c[sim->dose_num];
// Add concentration of next dose to blood
++sim->dose_num; // Advance dose counter
sim->c_b_peak = sim->c_b; // set new peak concentration
}
}
}
|
Fix compilation error when debugfs is disabled | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* 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.
*/
#ifndef _SPMI_DBGFS_H
#define _SPMI_DBGFS_H
#include <linux/debugfs.h>
#ifdef CONFIG_DEBUG_FS
int spmi_dfs_add_controller(struct spmi_controller *ctrl);
int spmi_dfs_del_controller(struct spmi_controller *ctrl);
#else
static inline int spmi_dfs_add_controller(struct spmi_controller *ctrl)
{
return 0;
}
static inline int spmi_dfs_del_controller(struct spmi_controller *ctrl)
{
return 0;
}
#endif
struct dentry *spmi_dfs_create_file(struct spmi_controller *ctrl,
const char *name, void *data,
const struct file_operations *fops);
#endif /* _SPMI_DBGFS_H */
| /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* 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.
*/
#ifndef _SPMI_DBGFS_H
#define _SPMI_DBGFS_H
#include <linux/debugfs.h>
#ifdef CONFIG_DEBUG_FS
int spmi_dfs_add_controller(struct spmi_controller *ctrl);
int spmi_dfs_del_controller(struct spmi_controller *ctrl);
struct dentry *spmi_dfs_create_file(struct spmi_controller *ctrl,
const char *name, void *data,
const struct file_operations *fops);
#else
static inline int spmi_dfs_add_controller(struct spmi_controller *ctrl)
{
return 0;
}
static inline int spmi_dfs_del_controller(struct spmi_controller *ctrl)
{
return 0;
}
static inline struct dentry *spmi_dfs_create_file(struct spmi_controller *ctrl,
const char *name, void *data,
const struct file_operations *fops)
{
return 0;
}
#endif
#endif /* _SPMI_DBGFS_H */
|
Fix test to not force triple, and also to not need stdint.h. | // RUN: %clang_cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s
#include <stdint.h>
static int f = 10;
static int b = f; // expected-error {{initializer element is not a compile-time constant}}
float r = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
intptr_t s = (intptr_t) &s;
_Bool t = &t;
union bar {
int i;
};
struct foo {
unsigned ptr;
};
union bar u[1];
struct foo x = {(intptr_t) u}; // no-error
struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}
| // RUN: %clang_cc1 -fsyntax-only -verify %s
typedef __typeof((int*) 0 - (int*) 0) intptr_t;
static int f = 10;
static int b = f; // expected-error {{initializer element is not a compile-time constant}}
float r = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
intptr_t s = (intptr_t) &s;
_Bool t = &t;
union bar {
int i;
};
struct foo {
unsigned ptr;
};
union bar u[1];
struct foo x = {(intptr_t) u}; // no-error
struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}
|
Add a blank line at the end | /*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-09-05 Meco Man fix bugs
* 2020-12-16 Meco Man add useconds_t
*/
#ifndef __SYS_TYPES_H__
#define __SYS_TYPES_H__
#include <stdint.h>
#include <stddef.h>
#include <time.h>
typedef int32_t clockid_t;
typedef int32_t key_t; /* Used for interprocess communication. */
typedef int pid_t; /* Used for process IDs and process group IDs. */
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef signed long off_t;
typedef int mode_t;
#ifndef ARCH_CPU_64BIT
typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
#else
typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
#endif
typedef long suseconds_t; /* microseconds. */
typedef unsigned long useconds_t; /* microseconds (unsigned) */
typedef unsigned long dev_t;
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned long u_long;
#endif | /*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-09-05 Meco Man fix bugs
* 2020-12-16 Meco Man add useconds_t
*/
#ifndef __SYS_TYPES_H__
#define __SYS_TYPES_H__
#include <stdint.h>
#include <stddef.h>
#include <time.h>
typedef int32_t clockid_t;
typedef int32_t key_t; /* Used for interprocess communication. */
typedef int pid_t; /* Used for process IDs and process group IDs. */
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef signed long off_t;
typedef int mode_t;
#ifndef ARCH_CPU_64BIT
typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
#else
typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
#endif
typedef long suseconds_t; /* microseconds. */
typedef unsigned long useconds_t; /* microseconds (unsigned) */
typedef unsigned long dev_t;
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned long u_long;
#endif
|
Increase version number for KDE 3.5.10. | // KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h
#define KMAIL_VERSION "1.9.9"
#endif /*kmversion_h*/
| // KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h
#define KMAIL_VERSION "1.9.10"
#endif /*kmversion_h*/
|
Add a function of ParseItem which returns a c-style string directly. | /*
* parser item
* (c) Copyright 2015 Micooz
*
* Released under the Apache License.
* See the LICENSE file or
* http://www.apache.org/licenses/LICENSE-2.0.txt for more information.
*/
#ifndef PARSER_ITEM_H_
#define PARSER_ITEM_H_
#include <sstream>
namespace program_options {
class ParseItem {
public:
ParseItem(const std::string& value);
/*
* dynamic type cast, support base data types including std::string
*/
template <typename T>
T as() {
T r;
std::stringstream buf;
buf << value_;
buf >> r;
return r;
}
/*
* alias of as<std::string>()
*/
inline std::string val() const { return value_; }
private:
std::string value_;
};
}
#endif // PARSER_ITEM_H_ | /*
* parser item
* (c) Copyright 2015 Micooz
*
* Released under the Apache License.
* See the LICENSE file or
* http://www.apache.org/licenses/LICENSE-2.0.txt for more information.
*/
#ifndef PARSER_ITEM_H_
#define PARSER_ITEM_H_
#include <sstream>
namespace program_options {
class ParseItem {
public:
ParseItem(const std::string& value);
/*
* dynamic type cast, support base data types including std::string
*/
template<typename T>
T as() {
T r;
std::stringstream buf;
buf << value_;
buf >> r;
return r;
}
/*
* alias of as<std::string>()
*/
inline std::string val() const { return value_; }
/*
* returns c-style string, will be useful if you want a const char*
*/
inline const char* c_str() const { return value_.c_str(); }
private:
std::string value_;
};
}
#endif // PARSER_ITEM_H_ |
Add THEMIS Secure Record interface | /**
* @file
*
* (c) CossackLabs
*/
#ifndef _SECURE_RECORD_H_
#define _SECURE_RECORD_H_
typedef struct themis_secure_record_type themis_secure_record_t;
themis_secure_record_t* themis_secure_record_create(const uint8_t* master_key, const size_t master_key_length);
themis_status_t themis_secure_record_encrypt_1(themis_secure_record_t* ctx,
const uint8_t* message,
const size_t message_length,
uint8_t* encrypted_message,
size_t* encrypted_message_length);
themis_status_t themis_secure_record_decrypt_1(themis_secure_record_t* ctx,
const uint8_t* encrypted_message,
const size_t encrypted_message_length,
uint8_t* plain_message,
size_t* plain_message_length);
themis_status_t themis_secure_record_encrypt_2(themis_secure_record_t* ctx,
const uint8_t* message,
const size_t message_length,
uint8_t* auth_tag_iv,
size_t* auth_tag_iv_length,
uint8_t* encrypted_message,
size_t* encrypted_message_length);
themis_status_t themis_secure_record_decrypt_2(themis_secure_record_t* ctx,
const uint8_t* encrypted_message,
const size_t encrypted_message_length,
const uint8_t* auth_tag_iv,
const size_t auth_tag_iv_length,
uint8_t* plain_message,
size_t* plain_message_length);
themis_status_t themis_secure_record_encrypt_3(themis_secure_record_t* ctx,
const uint8_t* message,
const size_t message_length,
const uint8_t* auth_tag_iv,
const size_t auth_tag_iv_length,
uint8_t* encrypted_message,
size_t* encrypted_message_length);
themis_status_t themis_secure_record_decrypt_3(themis_secure_record_t* ctx,
const uint8_t* encrypted_message,
const size_t encrypted_message_length,
const uint8_t* auth_tag_iv,
const size_t auth_tag_iv_length,
uint8_t* plain_message,
size_t* plain_message_length);
themis_status_t themis_secure_record_destroy(themis_secure_record_t* ctx);
#endif /* _SECURE_RECORD_H_ */
| |
Add the ctor for MEGAHandleList (Obj-C) | /**
* @file MEGAHandleList+init
* @brief Private functions of MEGAHandleList
*
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK 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.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/
#import "MEGAHandleList.h"
#import "megaapi.h"
@interface MEGAHandleList (init)
- (mega::MegaHandleList *)getCPtr;
@end
| /**
* @file MEGAHandleList+init
* @brief Private functions of MEGAHandleList
*
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK 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.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/
#import "MEGAHandleList.h"
#import "megaapi.h"
@interface MEGAHandleList (init)
- (instancetype)initWithMegaHandleList:(mega::MegaHandleList *)megaHandleList cMemoryOwn:(BOOL)cMemoryOwn;
- (mega::MegaHandleList *)getCPtr;
@end
|
Add command-line option for SSBS | // RUN: %clang -### -target aarch64-none-none-eabi -march=armv8a+ssbs %s 2>&1 | FileCheck %s
// CHECK: "-target-feature" "+ssbs"
// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8a+nossbs %s 2>&1 | FileCheck %s --check-prefix=NOSSBS
// NOSSBS: "-target-feature" "-ssbs"
// RUN: %clang -### -target aarch64-none-none-eabi %s 2>&1 | FileCheck %s --check-prefix=ABSENTSSBS
// ABSENTSSBS-NOT: "-target-feature" "+ssbs"
// ABSENTSSBS-NOT: "-target-feature" "-ssbs"
| |
Fix enviroment variable getter on windows | /*
* Copyright (C) 2015 BMW Car IT GmbH
*
* 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 CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
#define CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
#include <capu/os/Generic/EnvironmentVariables.h>
namespace capu
{
namespace os
{
class EnvironmentVariables: private capu::generic::EnvironmentVariables
{
public:
using capu::generic::EnvironmentVariables::getAll;
static bool get(const String& key, String& value);
};
inline
bool EnvironmentVariables::get(const String& key, String& value)
{
char* envValue = 0;
bool found = (0 == _dupenv_s(&envValue, 0, key.c_str()));
value = envValue;
free(envValue);
return found;
}
}
}
#endif // CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
| /*
* Copyright (C) 2015 BMW Car IT GmbH
*
* 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 CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
#define CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
#include <capu/os/Generic/EnvironmentVariables.h>
namespace capu
{
namespace os
{
class EnvironmentVariables: private capu::generic::EnvironmentVariables
{
public:
using capu::generic::EnvironmentVariables::getAll;
static bool get(const String& key, String& value);
};
inline
bool EnvironmentVariables::get(const String& key, String& value)
{
char* envValue = 0;
errno_t err = _dupenv_s(&envValue, 0, key.c_str());
bool found = (err == 0 && envValue != 0);
value = envValue;
free(envValue);
return found;
}
}
}
#endif // CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
|
Fix : is real for number object. | //
// NSNumber+Fix.h
// LYCategory
//
// Created by Rick Luo on 11/25/13.
// Copyright (c) 2013 Luo Yu. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSNumber (Fix)
- (id)objectAtIndex:(NSUInteger)index;
- (id)objectForKey:(id)aKey;
- (BOOL)isEqualToString:(NSString *)aString;
- (NSUInteger)length;
- (NSString *)string;
@end
| //
// NSNumber+Fix.h
// LYCategory
//
// Created by Rick Luo on 11/25/13.
// Copyright (c) 2013 Luo Yu. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSNumber (Fix)
- (id)objectAtIndex:(NSUInteger)index;
- (id)objectForKey:(id)aKey;
- (BOOL)isEqualToString:(NSString *)aString;
- (NSUInteger)length;
- (NSString *)string;
- (BOOL)isReal;
@end
|
Switch to fputs stderr to try to fix output buffering issues | // RUN: %clang_asan -O2 %s -o %t
// RUN: %env_asan_opts=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// FIXME: sprintf is not intercepted on Windows yet.
// XFAIL: win32
#include <stdio.h>
int main() {
volatile char c = '0';
volatile int x = 12;
volatile float f = 1.239;
volatile char s[] = "34";
volatile char buf[2];
puts("before sprintf");
sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
puts("after sprintf");
puts((const char *)buf);
return 0;
// Check that size of output buffer is sanitized.
// CHECK-ON: before sprintf
// CHECK-ON-NOT: after sprintf
// CHECK-ON: stack-buffer-overflow
// CHECK-ON-NOT: 0 12 1.239 34
}
| // RUN: %clang_asan -O2 %s -o %t
// RUN: %env_asan_opts=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// FIXME: sprintf is not intercepted on Windows yet.
// XFAIL: win32
#include <stdio.h>
int main() {
volatile char c = '0';
volatile int x = 12;
volatile float f = 1.239;
volatile char s[] = "34";
volatile char buf[2];
fputs(stderr, "before sprintf");
sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
fputs(stderr, "after sprintf");
fputs(stderr, (const char *)buf);
return 0;
// Check that size of output buffer is sanitized.
// CHECK-ON: before sprintf
// CHECK-ON-NOT: after sprintf
// CHECK-ON: stack-buffer-overflow
// CHECK-ON-NOT: 0 12 1.239 34
}
|
Use a static_assert instead of using the old array of size -1 trick. | //===--- AllDiagnostics.h - Aggregate Diagnostic headers --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Includes all the separate Diagnostic headers & some related helpers.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H
#define LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/CommentDiagnostic.h"
#include "clang/Analysis/AnalysisDiagnostic.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "clang/Serialization/SerializationDiagnostic.h"
namespace clang {
template <size_t SizeOfStr, typename FieldType>
class StringSizerHelper {
char FIELD_TOO_SMALL[SizeOfStr <= FieldType(~0U) ? 1 : -1];
public:
enum { Size = SizeOfStr };
};
} // end namespace clang
#define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \
fieldTy>::Size
#endif
| //===--- AllDiagnostics.h - Aggregate Diagnostic headers --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Includes all the separate Diagnostic headers & some related helpers.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H
#define LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/CommentDiagnostic.h"
#include "clang/Analysis/AnalysisDiagnostic.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "clang/Serialization/SerializationDiagnostic.h"
namespace clang {
template <size_t SizeOfStr, typename FieldType>
class StringSizerHelper {
static_assert(SizeOfStr <= FieldType(~0U), "Field too small!");
public:
enum { Size = SizeOfStr };
};
} // end namespace clang
#define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \
fieldTy>::Size
#endif
|
Fix bug if timer executed with 0 ms | #include <stddef.h>
#include <time.h>
#include <pthread.h>
#include <stdlib.h>
#include "timers.h"
struct timer_data_t {
long millis;
timer_callback_t timer_callback;
void* data;
};
void *timer_thread(void *data) {
struct timer_data_t *timer_data = data;
struct timespec t;
t.tv_sec = timer_data->millis / 1000;
t.tv_nsec = 1000 * 1000 * (timer_data->millis % 1000);
nanosleep(&t, NULL);
timer_data->timer_callback(timer_data->data);
free(data);
return NULL;
}
void start_timer(long millis, timer_callback_t timer_callback, void *data) {
struct timer_data_t *timer_data = malloc(sizeof(struct timer_data_t));
timer_data->millis = millis;
timer_data->timer_callback = timer_callback;
timer_data->data = data;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_t thread;
pthread_create(&thread, &attr, timer_thread, timer_data);
}
| #include <stddef.h>
#include <time.h>
#include <pthread.h>
#include <stdlib.h>
#include "timers.h"
struct timer_data_t {
long millis;
timer_callback_t timer_callback;
void* data;
};
void *timer_thread(void *data) {
struct timer_data_t *timer_data = data;
struct timespec t;
t.tv_sec = timer_data->millis / 1000;
t.tv_nsec = 1000 * 1000 * (timer_data->millis % 1000);
if (t.tv_sec == 0 && t.tv_nsec == 0) {
t.tv_nsec = 1; /* Evidently needed on Ubuntu 14.04 */
}
nanosleep(&t, NULL);
timer_data->timer_callback(timer_data->data);
free(data);
return NULL;
}
void start_timer(long millis, timer_callback_t timer_callback, void *data) {
struct timer_data_t *timer_data = malloc(sizeof(struct timer_data_t));
timer_data->millis = millis;
timer_data->timer_callback = timer_callback;
timer_data->data = data;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_t thread;
pthread_create(&thread, &attr, timer_thread, timer_data);
}
|
Fix header guard, add impossible return value, add default name | #ifndef _NEWSPAPER_H_
#define _NEWSPAPER_H_
#include <string>
#include "advertenum.h"
using namespace std;
class Newspaper {
string name;
int textPrice, imagePrice, textImagePrice;
public:
Newspaper(const string& name): name(name) {}
int getPriceFor(AdvertType type) const {
switch(type) {
case AdvertType::Image:
return imagePrice;
case AdvertType::Text:
return textPrice;
case AdvertType::TextImage:
return textImagePrice;
}
}
void setPriceFor(AdvertType type, int price) {
switch(type) {
case AdvertType::Image:
imagePrice=price;
case AdvertType::Text:
textPrice=price;
case AdvertType::TextImage:
textImagePrice=price;
}
}
const string& getName() const {
return name;
}
virtual ~Newspaper() {}
};
#endif
| #ifndef NEWSPAPER_H
#define NEWSPAPER_H
#include <string>
#include "advertenum.h"
using namespace std;
class Newspaper {
string name;
int textPrice, imagePrice, textImagePrice;
public:
Newspaper(): name("") {}
Newspaper(const string& name): name(name) {}
int getPriceFor(AdvertType type) const {
switch(type) {
case AdvertType::Image:
return imagePrice;
case AdvertType::Text:
return textPrice;
case AdvertType::TextImage:
return textImagePrice;
}
return 0;
}
void setPriceFor(AdvertType type, int price) {
switch(type) {
case AdvertType::Image:
imagePrice=price;
case AdvertType::Text:
textPrice=price;
case AdvertType::TextImage:
textImagePrice=price;
}
}
const string& getName() const {
return name;
}
virtual ~Newspaper() {}
};
#endif
|
Add BSD header on top of all files (forgot some files) | #ifndef WEBWIDGET_H
#define WEBWIDGET_H
#include "webpage.h"
#include <QtWebKit>
#include <QStringList>
class WebWidget : public QWebView
{
Q_OBJECT
public:
WebWidget(QWidget * parent=0);
virtual void wheelEvent(QWheelEvent *);
public slots:
void changeFor(WebPage::UserAgents agent);
void refitPage();
private slots:
void onNetworkReply(QNetworkReply * reply);
void refitPage(bool b);
signals:
void noHostFound(QUrl);
void connectionRefused();
void remotlyClosed();
void timeOut();
void operationCancelled();
void pageNotFound(QUrl);
private:
WebPage * mWebPage;
};
#endif // WEBWIDGET_H
| /* Mobile On Desktop - A Smartphone emulator on desktop
* Copyright (c) 2012 Régis FLORET
*
* 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 Régis FLORET 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 REGENTS 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 REGENTS AND 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 WEBWIDGET_H
#define WEBWIDGET_H
#include "webpage.h"
#include <QtWebKit>
#include <QStringList>
class WebWidget : public QWebView
{
Q_OBJECT
public:
WebWidget(QWidget * parent=0);
virtual void wheelEvent(QWheelEvent *);
public slots:
void changeFor(WebPage::UserAgents agent);
void refitPage();
private slots:
void onNetworkReply(QNetworkReply * reply);
void refitPage(bool b);
signals:
void noHostFound(QUrl);
void connectionRefused();
void remotlyClosed();
void timeOut();
void operationCancelled();
void pageNotFound(QUrl);
private:
WebPage * mWebPage;
};
#endif // WEBWIDGET_H
|
Move to iOS and Mac targets only. | /*! @file GTMAppAuth.h
@brief GTMAppAuth SDK
@copyright
Copyright 2016 Google Inc.
@copydetails
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "GTMAppAuthFetcherAuthorization.h"
#import "GTMAppAuthFetcherAuthorization+Keychain.h"
#import "GTMKeychain.h"
#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS
#import "GTMOAuth2KeychainCompatibility.h"
#elif TARGET_OS_MAC
#import "GTMOAuth2KeychainCompatibility.h"
#else
#warn "Platform Undefined"
#endif
| /*! @file GTMAppAuth.h
@brief GTMAppAuth SDK
@copyright
Copyright 2016 Google Inc.
@copydetails
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "GTMAppAuthFetcherAuthorization.h"
#import "GTMAppAuthFetcherAuthorization+Keychain.h"
#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS || TARGET_OS_MAC
#import "GTMKeychain.h"
#import "GTMOAuth2KeychainCompatibility.h"
#else
#warn "Platform Undefined"
#endif
|
Convert defines to enums. Named percentage category enum. Documented values. | // batwarn - (C) 2015-2016 Jeffrey E. Bedard
#ifndef CONFIG_H
#define CONFIG_H
#define GAMMA_NORMAL 1.0
#define GAMMA_WARNING 5.0
enum {
CRIT_PERCENT=5
,LOW_PERCENT=10
,FULL_PERCENT=90
};
#ifndef DEBUG
#define WAIT 60
#else//DEBUG
#define WAIT 1
#endif//!DEBUG
#define BATSYSFILE "/sys/class/power_supply/BAT0/capacity"
#define ACSYSFILE "/sys/class/power_supply/AC/online"
#define SUSPEND_CMD "systemctl suspend"
#endif//CONFIG_H
| // batwarn - (C) 2015-2016 Jeffrey E. Bedard
#ifndef BW_CONFIG_H
#define BW_CONFIG_H
#define GAMMA_NORMAL 1.0
#define GAMMA_WARNING 5.0
enum PercentCat {
CRIT_PERCENT=5,
LOW_PERCENT=10,
FULL_PERCENT=90
};
// Delay for checking system files:
#ifndef DEBUG
enum { WAIT = 60 };
#else//DEBUG
enum { WAIT = 1 };
#endif//!DEBUG
// System files to check:
#define BATSYSFILE "/sys/class/power_supply/BAT0/capacity"
#define ACSYSFILE "/sys/class/power_supply/AC/online"
#define SUSPEND_CMD "systemctl suspend"
#endif//!BW_CONFIG_H
|
Fix warning on printing value of type size_t. | /* Copyright (c) 2012 Francis Russell <francis@unchartedbackwaters.co.uk>
*
* 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.
*/
#include <stdlib.h>
#include <stdio.h>
#include "memory.h"
void *lmalloc(const size_t size)
{
void* const data = malloc(size);
if (data == NULL)
{
fprintf(stderr, "Failed to allocate region of %li bytes.\n", size);
exit(EXIT_FAILURE);
}
return data;
}
void lfree(void *const data)
{
free(data);
}
| /* Copyright (c) 2012 Francis Russell <francis@unchartedbackwaters.co.uk>
*
* 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.
*/
#include <stdlib.h>
#include <stdio.h>
#include "memory.h"
void *lmalloc(const size_t size)
{
void* const data = malloc(size);
if (data == NULL)
{
fprintf(stderr, "Failed to allocate region of %zu bytes.\n", size);
exit(EXIT_FAILURE);
}
return data;
}
void lfree(void *const data)
{
free(data);
}
|
Add nullability specifiers to attribute selector | //
// CSSAttributeSelector.h
// HTMLKit
//
// Created by Iska on 14/05/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CSSSelector.h"
#import "CSSSimpleSelector.h"
typedef NS_ENUM(NSUInteger, CSSAttributeSelectorType)
{
CSSAttributeSelectorExists,
CSSAttributeSelectorExactMatch,
CSSAttributeSelectorIncludes,
CSSAttributeSelectorBegins,
CSSAttributeSelectorEnds,
CSSAttributeSelectorContains,
CSSAttributeSelectorHyphen
};
@interface CSSAttributeSelector : CSSSelector <CSSSimpleSelector>
@property (nonatomic, assign) CSSAttributeSelectorType type;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *value;
+ (instancetype)selectorForClass:(NSString *)className;
+ (instancetype)selectorForId:(NSString *)elementId;
- (instancetype)initWithType:(CSSAttributeSelectorType)type
attributeName:(NSString *)name
attrbiuteValue:(NSString *)value;
@end
| //
// CSSAttributeSelector.h
// HTMLKit
//
// Created by Iska on 14/05/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CSSSelector.h"
#import "CSSSimpleSelector.h"
typedef NS_ENUM(NSUInteger, CSSAttributeSelectorType)
{
CSSAttributeSelectorExists,
CSSAttributeSelectorExactMatch,
CSSAttributeSelectorIncludes,
CSSAttributeSelectorBegins,
CSSAttributeSelectorEnds,
CSSAttributeSelectorContains,
CSSAttributeSelectorHyphen,
CSSAttributeSelectorNot
};
@interface CSSAttributeSelector : CSSSelector <CSSSimpleSelector>
@property (nonatomic, assign) CSSAttributeSelectorType type;
@property (nonatomic, copy) NSString * _Nonnull name;
@property (nonatomic, copy) NSString * _Nonnull value;
+ (nullable instancetype)selectorForClass:(nonnull NSString *)className;
+ (nullable instancetype)selectorForId:(nonnull NSString *)elementId;
- (nullable instancetype)initWithType:(CSSAttributeSelectorType)type
attributeName:(nonnull NSString *)name
attrbiuteValue:(nullable NSString *)value;
@end
|
Clarify strange syntax for itk::MetaEvent | /*=========================================================================
*
* 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 itkMetaEvent_h
#define itkMetaEvent_h
#include "itkMacro.h"
#include "metaEvent.h"
namespace itk
{
/** \class MetaEvent
* \brief Event abstract class
* \ingroup ITKSpatialObjects
*/
class MetaEvent : public :: MetaEvent
{
public:
MetaEvent();
virtual ~MetaEvent();
};
} // 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 itkMetaEvent_h
#define itkMetaEvent_h
#include "itkMacro.h"
#include "metaEvent.h"
namespace itk
{
/** \class MetaEvent
* \brief Event abstract class
*
* The itk::MetaEvent inherits from the
* global namespace ::MetaEvent that is provided
* by the MetaIO/src/metaEvent.h class.
* \ingroup ITKSpatialObjects
*/
class MetaEvent : public ::MetaEvent
{
public:
MetaEvent();
virtual ~MetaEvent();
};
} // end namespace itk
#endif
|
Use override (pacify clang++ warning) | // ======================================================================
/*!
* \brief A Meb Maps Service Layer data structure for query data layer
*
* Characteristics:
*
* -
* -
*/
// ======================================================================
#pragma once
#include "WMSConfig.h"
namespace SmartMet
{
namespace Plugin
{
namespace WMS
{
class WMSQueryDataLayer : public WMSLayer
{
private:
const Engine::Querydata::Engine* itsQEngine;
const std::string itsProducer;
boost::posix_time::ptime itsModificationTime = boost::posix_time::from_time_t(0);
protected:
virtual void updateLayerMetaData();
public:
WMSQueryDataLayer(const WMSConfig& config, const std::string& producer)
: WMSLayer(config), itsQEngine(config.qEngine()), itsProducer(producer)
{
}
const boost::posix_time::ptime& modificationTime() const override;
};
} // namespace WMS
} // namespace Plugin
} // namespace SmartMet
| // ======================================================================
/*!
* \brief A Meb Maps Service Layer data structure for query data layer
*
* Characteristics:
*
* -
* -
*/
// ======================================================================
#pragma once
#include "WMSConfig.h"
namespace SmartMet
{
namespace Plugin
{
namespace WMS
{
class WMSQueryDataLayer : public WMSLayer
{
private:
const Engine::Querydata::Engine* itsQEngine;
const std::string itsProducer;
boost::posix_time::ptime itsModificationTime = boost::posix_time::from_time_t(0);
protected:
void updateLayerMetaData() override;
public:
WMSQueryDataLayer(const WMSConfig& config, const std::string& producer)
: WMSLayer(config), itsQEngine(config.qEngine()), itsProducer(producer)
{
}
const boost::posix_time::ptime& modificationTime() const override;
};
} // namespace WMS
} // namespace Plugin
} // namespace SmartMet
|
Remove no longer valid comment | #ifndef CLIENTMODEL_H
#define CLIENTMODEL_H
#include <QObject>
class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;
QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE
// Interface to Bitcoin network client
class ClientModel : public QObject
{
Q_OBJECT
public:
// The only reason that this constructor takes a wallet is because
// the global client settings are stored in the main wallet.
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
OptionsModel *getOptionsModel();
int getNumConnections() const;
int getNumBlocks() const;
QDateTime getLastBlockDate() const;
// Return true if client connected to testnet
bool isTestNet() const;
// Return true if core is doing initial block download
bool inInitialBlockDownload() const;
// Return conservative estimate of total number of blocks, or 0 if unknown
int getTotalBlocksEstimate() const;
QString formatFullVersion() const;
private:
OptionsModel *optionsModel;
int cachedNumConnections;
int cachedNumBlocks;
signals:
void numConnectionsChanged(int count);
void numBlocksChanged(int count);
// Asynchronous error notification
void error(const QString &title, const QString &message);
public slots:
private slots:
void update();
};
#endif // CLIENTMODEL_H
| #ifndef CLIENTMODEL_H
#define CLIENTMODEL_H
#include <QObject>
class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;
QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE
// Interface to Bitcoin network client
class ClientModel : public QObject
{
Q_OBJECT
public:
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
OptionsModel *getOptionsModel();
int getNumConnections() const;
int getNumBlocks() const;
QDateTime getLastBlockDate() const;
// Return true if client connected to testnet
bool isTestNet() const;
// Return true if core is doing initial block download
bool inInitialBlockDownload() const;
// Return conservative estimate of total number of blocks, or 0 if unknown
int getTotalBlocksEstimate() const;
QString formatFullVersion() const;
private:
OptionsModel *optionsModel;
int cachedNumConnections;
int cachedNumBlocks;
signals:
void numConnectionsChanged(int count);
void numBlocksChanged(int count);
// Asynchronous error notification
void error(const QString &title, const QString &message);
public slots:
private slots:
void update();
};
#endif // CLIENTMODEL_H
|
Set default log level to info | //
// SFBLELogging.h
// SFBluetoothLowEnergyDevice
//
// Created by Thomas Billicsich on 2014-04-04.
// Copyright (c) 2014 Thomas Billicsich. All rights reserved.
#import <CocoaLumberjack/CocoaLumberjack.h>
// To define a different local (per file) log level
// put the following line _before_ the import of SFBLELogging.h
// #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG
#define GLOBAL_LOG_LEVEL DDLogLevelVerbose
#ifndef LOCAL_LOG_LEVEL
#define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL
#endif
static int ddLogLevel = LOCAL_LOG_LEVEL;
| //
// SFBLELogging.h
// SFBluetoothLowEnergyDevice
//
// Created by Thomas Billicsich on 2014-04-04.
// Copyright (c) 2014 Thomas Billicsich. All rights reserved.
#import <CocoaLumberjack/CocoaLumberjack.h>
// To define a different local (per file) log level
// put the following line _before_ the import of SFBLELogging.h
// #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG
#define GLOBAL_LOG_LEVEL DDLogLevelInfo
#ifndef LOCAL_LOG_LEVEL
#define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL
#endif
static int ddLogLevel = LOCAL_LOG_LEVEL;
|
Test whether removing a cast still hurts performance. | /*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
/* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
const int16_t* seq1,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int right_shifts,
int step_seq2) {
int i = 0, j = 0;
for (i = 0; i < dim_cross_correlation; i++) {
int32_t corr = 0;
/* Unrolling doesn't seem to improve performance. */
for (j = 0; j < dim_seq; j++) {
// It's not clear why casting |right_shifts| here helps performance.
corr += (seq1[j] * seq2[j]) >> (int16_t)right_shifts;
}
seq2 += step_seq2;
*cross_correlation++ = corr;
}
}
| /*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
/* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
const int16_t* seq1,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int right_shifts,
int step_seq2) {
int i = 0, j = 0;
for (i = 0; i < dim_cross_correlation; i++) {
int32_t corr = 0;
/* Unrolling doesn't seem to improve performance. */
for (j = 0; j < dim_seq; j++)
corr += (seq1[j] * seq2[j]) >> right_shifts;
seq2 += step_seq2;
*cross_correlation++ = corr;
}
}
|
Allow data to contain also lowercase hex characters. | /* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hex-dec.h"
void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
unsigned int i;
for (i = 0; i < hexstr_size; i++) {
unsigned int value = dec & 0x0f;
if (value < 10)
hexstr[hexstr_size-i-1] = value + '0';
else
hexstr[hexstr_size-i-1] = value - 10 + 'A';
dec >>= 4;
}
}
uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
unsigned int i;
uintmax_t value = 0;
for (i = 0; i < len; i++) {
value = value*0x10;
if (data[i] >= '0' && data[i] <= '9')
value += data[i]-'0';
else if (data[i] >= 'A' && data[i] <= 'F')
value += data[i]-'A' + 10;
else
return 0;
}
return value;
}
| /* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hex-dec.h"
void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
unsigned int i;
for (i = 0; i < hexstr_size; i++) {
unsigned int value = dec & 0x0f;
if (value < 10)
hexstr[hexstr_size-i-1] = value + '0';
else
hexstr[hexstr_size-i-1] = value - 10 + 'A';
dec >>= 4;
}
}
uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
unsigned int i;
uintmax_t value = 0;
for (i = 0; i < len; i++) {
value = value*0x10;
if (data[i] >= '0' && data[i] <= '9')
value += data[i]-'0';
else if (data[i] >= 'A' && data[i] <= 'F')
value += data[i]-'A' + 10;
else if (data[i] >= 'a' && data[i] <= 'f')
value += data[i]-'a' + 10;
else
return 0;
}
return value;
}
|
Add regression test for infinite loop combinations CFG connectedness | int main()
{
// non-deterministically make all variants live
int r;
switch (r)
{
case 0:
single();
break;
case 1:
sequential_last();
break;
case 2:
sequential_both();
break;
case 3:
branch_one();
break;
case 4:
branch_both();
break;
case 5:
nested_outer();
break;
case 6:
nested_inner();
break;
case 7:
nested_both();
break;
}
return 0;
}
void single()
{
while (1)
assert(1);
}
void sequential_last()
{
int i = 0;
while (i < 0)
i++;
while (1)
assert(1);
}
void sequential_both()
{
// TODO: fix crash
// while (1)
// assert(1);
// while (1)
// assert(1);
}
void branch_one()
{
int r;
if (r)
{
int i = 0;
while (i < 0)
i++;
}
else
{
while (1)
assert(1);
}
}
void branch_both()
{
int r;
if (r)
{
while (1)
assert(1);
}
else
{
while (1)
assert(1);
}
}
void nested_outer()
{
while (1)
{
int i = 0;
while (i < 0)
i++;
}
}
void nested_inner()
{
int i = 0;
while (i < 0)
{
while (1)
assert(1);
i++;
}
}
void nested_both()
{
// TODO: fix crash
// while (1)
// {
// while (1)
// assert(1);
// }
}
| |
Fix partitioned array option in additional test | // SKIP PARAM: --enable ana.int.interval --set solver td3 --enable ana.base.partition-arrays.enabled --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// This is part of 34-localization, but also symlinked to 36-apron.
// ALSO: --enable ana.int.interval --set solver slr3 --enable ana.base.partition-arrays.enabled --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// Example from Halbwachs-Henry, SAS 2012
// Localized widening or restart policy should be able to prove that i <= j+3
// if the abstract domain is powerful enough.
void main()
{
int i = 0;
while (i<4) {
int j=0;
while (j<4) {
i=i+1;
j=j+1;
}
i = i-j+1;
assert(i <= j+3);
}
return ;
}
| // SKIP PARAM: --enable ana.int.interval --set solver td3 --set ana.base.arrays.domain partitioned --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// This is part of 34-localization, but also symlinked to 36-apron.
// ALSO: --enable ana.int.interval --set solver slr3 --set ana.base.arrays.domain partitioned --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// Example from Halbwachs-Henry, SAS 2012
// Localized widening or restart policy should be able to prove that i <= j+3
// if the abstract domain is powerful enough.
void main()
{
int i = 0;
while (i<4) {
int j=0;
while (j<4) {
i=i+1;
j=j+1;
}
i = i-j+1;
assert(i <= j+3);
}
return ;
}
|
Add test for nested macro expansion |
/*
name: TEST029
description: Test of nested expansion and refusing macro without arguments
comments: f(2) will expand to 2*g, which will expand to 2*f, and in this
moment f will not be expanded because the macro definition is
a function alike macro, and in this case there is no arguments.
output:
test029.c:34: error: redefinition of 'f1'
F2
G3 F2 f1
{
\
A4 I f
A4 #I2 *I
}
test029.c:35: error: 'f' undeclared
*/
#define f(a) a*g
#define g f
int
f1(void)
{
int f;
f(2);
}
int
f1(void)
{
f(2);
}
| |
Add "escaping" via recursion example | // SKIP PARAM: --set solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','apron','escape']" --set ana.base.privatization none --set ana.apron.privatization dummy
int rec(int i,int* ptr) {
int top;
int x = 17;
if(i == 0) {
rec(5,&x);
// Recursive call may have modified x
assert(x == 17); //UNKNOWN!
// If we analyse this with int contexts, there is no other x that is reachable, so this
// update is strong
x = 17;
assert(x == 17);
} else {
x = 31;
// ptr points to the outer x, it is unaffected by this assignment
// and should be 17
assert(*ptr == 31); //UNKNOWN!
if(top) {
ptr = &x;
}
// ptr may now point to both the inner and the outer x
*ptr = 12;
assert(*ptr == 12); //UNKNOWN!
assert(x == 12); //UNKNOWN!
if(*ptr == 12) {
assert(x == 12); //UNKNOWN!
}
// ptr may still point to the outer instance
assert(ptr == &x); //UNKNOWN!
// Another copy of x is reachable, so we are conservative and do a weak update
x = 31;
assert(x == 31); // UNKNOWN
}
return 0;
}
int main() {
int t;
rec(0,&t);
return 0;
}
| |
Add arrays example in C | /*
* Author: Jhonatan Casale (jhc)
*
* Contact : jhonatan@jhonatancasale.com
* : casale.jhon@gmail.com
* : https://github.com/jhonatancasale
* : https://twitter.com/jhonatancasale
* : http://jhonatancasale.github.io/
*
* Create date Sat 10 Dec 16:28:22 BRST 2016
*
*/
#include <stdlib.h>
#include <stdio.h>
int main (int argc, char **argv)
{
int i;
int array[ 100 ];
int sum = 0;
for ( i = 0; i < 100; i++ )
array[ i ] = i + 1;
for ( i = 0; i < 100; i++ )
sum += array[ i ];
printf ("Sum from 0 to 100: %d\n", sum);
return (EXIT_SUCCESS);
}
| |
Fix some build issues in the open source code. | /*
* Copyright (c) 2004-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.
*
*/
#pragma once
#include <folly/Range.h>
#include <chrono>
namespace facebook {
class SpinLock {
};
class SpinLockHolder {
public:
explicit SpinLockHolder(SpinLock*) {}
};
namespace stats {
enum ExportType {
SUM,
COUNT,
AVG,
RATE,
PERCENT,
NUM_TYPES,
};
struct ExportedStat {
void addValue(std::chrono::seconds, int64_t) {}
};
class ExportedStatMap {
public:
class LockAndStatItem {
public:
std::shared_ptr<SpinLock> first;
std::shared_ptr<ExportedStat> second;
};
LockAndStatItem getLockAndStatItem(folly::StringPiece,
const ExportType* = nullptr) {
static LockAndStatItem it = {
std::make_shared<SpinLock>(), std::make_shared<ExportedStat>()
};
return it;
}
};
}}
| /*
* Copyright (c) 2004-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.
*
*/
#pragma once
#include <folly/Range.h>
#include <chrono>
namespace facebook {
class SpinLock {
};
class SpinLockHolder {
public:
explicit SpinLockHolder(SpinLock*) {}
};
namespace stats {
enum ExportType {
SUM,
COUNT,
AVG,
RATE,
PERCENT,
NUM_TYPES,
};
struct ExportedStat {
void addValue(std::chrono::seconds, int64_t) {}
};
class ExportedStatMap {
public:
class LockAndStatItem {
public:
std::shared_ptr<SpinLock> first;
std::shared_ptr<ExportedStat> second;
};
LockAndStatItem getLockAndStatItem(folly::StringPiece,
const ExportType* = nullptr) {
static LockAndStatItem it = {
std::make_shared<SpinLock>(), std::make_shared<ExportedStat>()
};
return it;
}
std::shared_ptr<ExportedStat> getStatPtr(folly::StringPiece name) {
return std::make_shared<ExportedStat>();
}
};
}}
|
Use EditDefaultsOnly insted of EditAnywhere | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Pawn.h"
#include "Tank.generated.h" // Put new includes above
class UTankBarrel; // Do a class forward declaration
class UTurret;
class UTankAimingComponent;
class AProjectile;
UCLASS()
class DEV_API ATank : public APawn
{
GENERATED_BODY()
public:
void AimAt(FVector hitLocation);
// Make the following method be callable from blueprint
UFUNCTION(BlueprintCallable, Category = Setup)
void SetBarrelReference(UTankBarrel* barrelToSet);
UFUNCTION(BlueprintCallable, Category = Setup)
void SetTurretReference(UTurret* turretToSet);
UFUNCTION(BlueprintCallable, Category = Setup)
void FireCannon();
protected:
UTankAimingComponent* tankAimingComponent = nullptr;
private:
UPROPERTY(EditAnywhere, Category = Firing)
float launchSpeed = 4000.0f; // 1000 metres per second. TODO: find a sensible default
// Sets default values for this pawn's properties
ATank();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere, Category = "Setup")
TSubclassOf<AProjectile> projectileBlueprint;
UTankBarrel* barrel = nullptr;
float reloadTimeInSeconds = 3.0f; // sensible default
double lastFireTime = 0;
};
| // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Pawn.h"
#include "Tank.generated.h" // Put new includes above
class UTankBarrel; // Do a class forward declaration
class UTurret;
class UTankAimingComponent;
class AProjectile;
UCLASS()
class DEV_API ATank : public APawn
{
GENERATED_BODY()
public:
void AimAt(FVector hitLocation);
// Make the following method be callable from blueprint
UFUNCTION(BlueprintCallable, Category = "Setup")
void SetBarrelReference(UTankBarrel* barrelToSet);
UFUNCTION(BlueprintCallable, Category = "Setup")
void SetTurretReference(UTurret* turretToSet);
UFUNCTION(BlueprintCallable, Category = "Setup")
void FireCannon();
protected:
UTankAimingComponent* tankAimingComponent = nullptr;
private:
UPROPERTY(EditAnywhere, Category = Firing)
float launchSpeed = 4000.0f; // 1000 metres per second. TODO: find a sensible default
// Sets default values for this pawn's properties
ATank();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditDefaultsOnly, Category = "Setup")
TSubclassOf<AProjectile> projectileBlueprint;
UTankBarrel* barrel = nullptr;
UPROPERTY(EditDefaultsOnly, Category = "Firing")
float reloadTimeInSeconds = 3.0f; // sensible default
double lastFireTime = 0;
};
|
Stop pending watchers during shutdown. | #include "qnd.h"
/* Global context for server */
qnd_context ctx;
int main(int argc, char **argv)
{
struct ev_signal signal_watcher;
struct ev_io w_accept;
struct ev_loop *loop = ev_default_loop(0);
qnd_context_init(&ctx);
if (qnd_context_listen(&ctx, DEFAULT_PORT) == -1)
exit(1);
ev_signal_init(&signal_watcher, sigint_cb, SIGINT);
ev_signal_start(loop, &signal_watcher);
ev_io_init(&w_accept, accept_cb, ctx.sd, EV_READ);
ev_io_start(loop, &w_accept);
ev_loop(loop, 0);
qnd_context_cleanup(&ctx);
return 0;
}
| #include "qnd.h"
/* Global context for server */
qnd_context ctx;
int main(int argc, char **argv)
{
struct ev_signal signal_watcher;
struct ev_io w_accept;
struct ev_loop *loop = ev_default_loop(0);
qnd_context_init(&ctx);
if (qnd_context_listen(&ctx, DEFAULT_PORT) == -1)
exit(1);
ev_signal_init(&signal_watcher, sigint_cb, SIGINT);
ev_signal_start(loop, &signal_watcher);
ev_io_init(&w_accept, accept_cb, ctx.sd, EV_READ);
ev_io_start(loop, &w_accept);
ev_loop(loop, 0);
ev_signal_stop(loop, &signal_watcher);
ev_io_stop(loop, &w_accept);
qnd_context_cleanup(&ctx);
return 0;
}
|
Mark NativeCursor::Cursors as not needed in switch/cases | // LAF OS Library
// Copyright (C) 2021 Igara Studio S.A.
// Copyright (C) 2012-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_NATIVE_CURSOR_H_INCLUDED
#define OS_NATIVE_CURSOR_H_INCLUDED
#pragma once
#include "gfx/fwd.h"
namespace os {
enum class NativeCursor {
Hidden,
Arrow,
Crosshair,
IBeam,
Wait,
Link,
Help,
Forbidden,
Move,
SizeNS,
SizeWE,
SizeN,
SizeNE,
SizeE,
SizeSE,
SizeS,
SizeSW,
SizeW,
SizeNW,
Cursors
};
} // namespace os
#endif
| // LAF OS Library
// Copyright (C) 2021-2022 Igara Studio S.A.
// Copyright (C) 2012-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_NATIVE_CURSOR_H_INCLUDED
#define OS_NATIVE_CURSOR_H_INCLUDED
#pragma once
#include "gfx/fwd.h"
namespace os {
enum class NativeCursor {
Hidden,
Arrow,
Crosshair,
IBeam,
Wait,
Link,
Help,
Forbidden,
Move,
SizeNS,
SizeWE,
SizeN,
SizeNE,
SizeE,
SizeSE,
SizeS,
SizeSW,
SizeW,
SizeNW,
Cursors [[maybe_unused]]
};
} // namespace os
#endif
|
Fix clang build that have been broken by 81364. | // 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 CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"
class GURL;
class QuotaDispatcherHost : public BrowserMessageFilter {
public:
~QuotaDispatcherHost();
bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok);
private:
void OnQueryStorageUsageAndQuota(
int request_id,
const GURL& origin_url,
WebKit::WebStorageQuotaType type);
void OnRequestStorageQuota(
int request_id,
const GURL& origin_url,
WebKit::WebStorageQuotaType type,
int64 requested_size);
};
#endif // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_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 CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"
class GURL;
class QuotaDispatcherHost : public BrowserMessageFilter {
public:
~QuotaDispatcherHost();
virtual bool OnMessageReceived(const IPC::Message& message,
bool* message_was_ok);
private:
void OnQueryStorageUsageAndQuota(
int request_id,
const GURL& origin_url,
WebKit::WebStorageQuotaType type);
void OnRequestStorageQuota(
int request_id,
const GURL& origin_url,
WebKit::WebStorageQuotaType type,
int64 requested_size);
};
#endif // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
|
Synchronize the mailbox after expunging messages to actually get them expunged. | /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!client_verify_open_mailbox(cmd))
return TRUE;
storage = mailbox_get_storage(mailbox);
client->mailbox = NULL;
if (!imap_expunge(mailbox, NULL))
client_send_untagged_storage_error(client, storage);
if (mailbox_close(&mailbox) < 0)
client_send_untagged_storage_error(client, storage);
client_update_mailbox_flags(client, NULL);
client_send_tagline(cmd, "OK Close completed.");
return TRUE;
}
| /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!client_verify_open_mailbox(cmd))
return TRUE;
storage = mailbox_get_storage(mailbox);
client->mailbox = NULL;
if (!imap_expunge(mailbox, NULL))
client_send_untagged_storage_error(client, storage);
else if (mailbox_sync(mailbox, 0, 0, NULL) < 0)
client_send_untagged_storage_error(client, storage);
if (mailbox_close(&mailbox) < 0)
client_send_untagged_storage_error(client, storage);
client_update_mailbox_flags(client, NULL);
client_send_tagline(cmd, "OK Close completed.");
return TRUE;
}
|
Fix valgrind 'invalid read of size 1' bug. | #pragma once
#include <cmath>
#include <vector>
#include <murmur3/MurmurHash3.h>
#include <libcount/hll.h>
#include "type/value.h"
#include "common/macros.h"
#include "common/logger.h"
namespace peloton {
namespace optimizer {
/*
* A wrapper for libcount::HLL with murmurhash3
*/
class HLL {
public:
HLL(const int kPrecision = 8) {
hll_ = libcount::HLL::Create(kPrecision);
}
void Update(type::Value& value) {
hll_->Update(Hash(value));
}
uint64_t EstimateCardinality() {
uint64_t cardinality = hll_->Estimate();
LOG_INFO("Estimated cardinality with HLL: [%lu]", cardinality);
return cardinality;
}
~HLL() {
delete hll_;
}
private:
libcount::HLL* hll_;
uint64_t Hash(type::Value& value) {
uint64_t hash[2];
const char* raw_value = value.ToString().c_str();
MurmurHash3_x64_128(raw_value, (uint64_t)strlen(raw_value), 0, hash);
return hash[0];
}
};
} /* namespace optimizer */
} /* namespace peloton */
| #pragma once
#include <cmath>
#include <vector>
#include <murmur3/MurmurHash3.h>
#include <libcount/hll.h>
#include "type/value.h"
#include "common/macros.h"
#include "common/logger.h"
namespace peloton {
namespace optimizer {
/*
* A wrapper for libcount::HLL with murmurhash3
*/
class HLL {
public:
HLL(const int kPrecision = 8) {
hll_ = libcount::HLL::Create(kPrecision);
}
void Update(type::Value& value) {
hll_->Update(Hash(value));
}
uint64_t EstimateCardinality() {
uint64_t cardinality = hll_->Estimate();
LOG_INFO("Estimated cardinality with HLL: [%lu]", cardinality);
return cardinality;
}
~HLL() {
delete hll_;
}
private:
libcount::HLL* hll_;
uint64_t Hash(type::Value& value) {
uint64_t hash[2];
std::string value_str = value.ToString();
const char* raw_value = value_str.c_str();
MurmurHash3_x64_128(raw_value, (uint64_t)strlen(raw_value), 0, hash);
return hash[0];
}
};
} /* namespace optimizer */
} /* namespace peloton */
|
Test whether removing a cast still hurts performance. | /*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
/* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
const int16_t* seq1,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int right_shifts,
int step_seq2) {
int i = 0, j = 0;
for (i = 0; i < dim_cross_correlation; i++) {
int32_t corr = 0;
/* Unrolling doesn't seem to improve performance. */
for (j = 0; j < dim_seq; j++) {
// It's not clear why casting |right_shifts| here helps performance.
corr += (seq1[j] * seq2[j]) >> (int16_t)right_shifts;
}
seq2 += step_seq2;
*cross_correlation++ = corr;
}
}
| /*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
/* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
const int16_t* seq1,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int right_shifts,
int step_seq2) {
int i = 0, j = 0;
for (i = 0; i < dim_cross_correlation; i++) {
int32_t corr = 0;
/* Unrolling doesn't seem to improve performance. */
for (j = 0; j < dim_seq; j++)
corr += (seq1[j] * seq2[j]) >> right_shifts;
seq2 += step_seq2;
*cross_correlation++ = corr;
}
}
|
Add in Ps2keyboard.inf and Ps2Mouse.inf to IntelFrameworkModuelPkg | /*++
Copyright (c) 2006, Intel Corporation. All rights reserved.
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
Module Name:
Ps2Policy.h
Abstract:
Protocol used for PS/2 Policy definition.
--*/
#ifndef _PS2_POLICY_PROTOCOL_H_
#define _PS2_POLICY_PROTOCOL_H_
#define EFI_PS2_POLICY_PROTOCOL_GUID \
{ \
0x4df19259, 0xdc71, 0x4d46, {0xbe, 0xf1, 0x35, 0x7b, 0xb5, 0x78, 0xc4, 0x18 } \
}
#define EFI_KEYBOARD_CAPSLOCK 0x0004
#define EFI_KEYBOARD_NUMLOCK 0x0002
#define EFI_KEYBOARD_SCROLLLOCK 0x0001
typedef
EFI_STATUS
(EFIAPI *EFI_PS2_INIT_HARDWARE) (
IN EFI_HANDLE Handle
);
typedef struct {
UINT8 KeyboardLight;
EFI_PS2_INIT_HARDWARE Ps2InitHardware;
} EFI_PS2_POLICY_PROTOCOL;
extern EFI_GUID gEfiPs2PolicyProtocolGuid;
#endif
| |
Include database reader in main library header | //
// SQLiteDatabaseHelper
// Include/SQLiteDatabaseHelper.h
//
#ifndef __SQLITEDATABASEHELPER_H__
#define __SQLITEDATABASEHELPER_H__
#include <stdio.h>
#include <sqlite3.h>
#endif | //
// SQLiteDatabaseHelper
// Include/SQLiteDatabaseHelper.h
//
#ifndef __SQLITEDATABASEHELPER_H__
#define __SQLITEDATABASEHELPER_H__
#include <SQLiteDatabaseHelper/Operations/Read/DatabaseReader.h>
#endif |
Add clear() and delete constructor with initializer_list | #pragma once
// This file is part of 'Atoms' library - https://github.com/yaqwsx/atoms
// Author: Jan 'yaqwsx' Mrzek
#include <array>
#include <initializer_list>
#include <algorithm>
namespace atoms {
template <class T, size_t SIZE>
class RollingAverage {
public:
RollingAverage() : sum(0), index(0)
{
std::fill(values.begin(), values.end(), T(0));
};
RollingAverage(const std::initializer_list<T>& l) : sum(0), index(0)
{
std::copy(l.begin(), l.end(), values.begin());
}
void push(const T& t) {
sum += t - values[index];
values[index] = t;
index++;
if (index == SIZE)
index = 0;
}
T get_average() {
return sum / T(SIZE);
}
T get_sum() {
return sum;
}
private:
std::array<T, SIZE> values;
T sum;
size_t index;
};
} | #pragma once
// This file is part of 'Atoms' library - https://github.com/yaqwsx/atoms
// Author: Jan 'yaqwsx' Mrázek
#include <array>
#include <initializer_list>
#include <algorithm>
namespace atoms {
template <class T, size_t SIZE>
class RollingAverage {
public:
RollingAverage() : sum(0), index(0)
{
std::fill(values.begin(), values.end(), T(0));
};
void push(const T& t) {
sum += t - values[index];
values[index] = t;
index++;
if (index == SIZE)
index = 0;
}
T get_average() {
return sum / T(SIZE);
}
T get_sum() {
return sum;
}
void clear(T t = 0) {
std::fill(values.begin(), values.end(), t);
sum = t * SIZE;
}
private:
std::array<T, SIZE> values;
T sum;
size_t index;
};
}
|
Add (deactivated) casting test for congruence domain | // PARAM: --disable ana.int.def_exc --enable ana.int.interval
// Ensures that the cast_to function handles casting for congruences correctly.
// TODO: Implement appropriate cast_to function, enable for congruences only and adjust test if necessary.
#include <assert.h>
#include <stdio.h>
int main(){
int c = 128;
for (int i = 0; i < 1; i++) {
c = c - 150;
}
char k = (char) c;
printf ("k: %d", k);
assert (k == -22); //UNKNOWN
k = k + 150;
assert (k == 0); //UNKNOWN!
}
| |
Revert "Force being outside speex." | #define OUTSIDE_SPEEX
#define RANDOM_PREFIX cubeb
#define FLOATING_POINT
#include <speex/speex_resampler.h>
| #include <speex/speex_resampler.h>
|
Fix windows build by requiring stdint.h | /*
* *****************************************************************************
* Copyright 2014 Spectra Logic Corporation. 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. A copy of the License
* is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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 NUMBER_HELPER_H
#define NUMBER_HELPER_H
#include <QString>
class NumberHelper
{
public:
static const uint64_t B;
static const uint64_t KB;
static const uint64_t MB;
static const uint64_t GB;
static const uint64_t TB;
static QString ToHumanSize(uint64_t bytes);
};
#endif
| /*
* *****************************************************************************
* Copyright 2014 Spectra Logic Corporation. 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. A copy of the License
* is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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 NUMBER_HELPER_H
#define NUMBER_HELPER_H
#include <stdint.h>
#include <QString>
class NumberHelper
{
public:
static const uint64_t B;
static const uint64_t KB;
static const uint64_t MB;
static const uint64_t GB;
static const uint64_t TB;
static QString ToHumanSize(uint64_t bytes);
};
#endif
|
Add another uninitialized values test case illustrating that the CFG correctly handles declarations with multiple variables. | // RUN: clang-cc -analyze -warn-uninit-values -verify %s
int f1() {
int x;
return x; // expected-warning {{use of uninitialized variable}}
}
int f2(int x) {
int y;
int z = x + y; // expected-warning {{use of uninitialized variable}}
return z;
}
int f3(int x) {
int y;
return x ? 1 : y; // expected-warning {{use of uninitialized variable}}
}
int f4(int x) {
int y;
if (x) y = 1;
return y; // expected-warning {{use of uninitialized variable}}
}
int f5() {
int a;
a = 30; // no-warning
}
void f6(int i) {
int x;
for (i = 0 ; i < 10; i++)
printf("%d",x++); // expected-warning {{use of uninitialized variable}} \
// expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \
// expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
}
void f7(int i) {
int x = i;
int y;
for (i = 0; i < 10; i++ ) {
printf("%d",x++); // no-warning
x += y; // expected-warning {{use of uninitialized variable}}
}
}
| // RUN: clang-cc -analyze -warn-uninit-values -verify %s
int f1() {
int x;
return x; // expected-warning {{use of uninitialized variable}}
}
int f2(int x) {
int y;
int z = x + y; // expected-warning {{use of uninitialized variable}}
return z;
}
int f3(int x) {
int y;
return x ? 1 : y; // expected-warning {{use of uninitialized variable}}
}
int f4(int x) {
int y;
if (x) y = 1;
return y; // expected-warning {{use of uninitialized variable}}
}
int f5() {
int a;
a = 30; // no-warning
}
void f6(int i) {
int x;
for (i = 0 ; i < 10; i++)
printf("%d",x++); // expected-warning {{use of uninitialized variable}} \
// expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \
// expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
}
void f7(int i) {
int x = i;
int y;
for (i = 0; i < 10; i++ ) {
printf("%d",x++); // no-warning
x += y; // expected-warning {{use of uninitialized variable}}
}
}
int f8(int j) {
int x = 1, y = x + 1;
if (y) // no-warning
return x;
return y;
}
|
Update driver version to 5.02.00-k6 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k5"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k6"
|
Update driver version to 5.02.00-k18 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k17"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k18"
|
Remove preference change handler declaration. | //
// Tomighty - http://www.tomighty.org
//
// This software is licensed under the Apache License Version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
#import <Foundation/Foundation.h>
@protocol TYAppUI <NSObject>
- (void)switchToIdleState;
- (void)switchToPomodoroState;
- (void)switchToShortBreakState;
- (void)switchToLongBreakState;
- (void)updateRemainingTime:(int)remainingSeconds;
- (void)updatePomodoroCount:(int)count;
- (void)handlePrerencesChange:(NSString*)which;
@end
| //
// Tomighty - http://www.tomighty.org
//
// This software is licensed under the Apache License Version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
#import <Foundation/Foundation.h>
@protocol TYAppUI <NSObject>
- (void)switchToIdleState;
- (void)switchToPomodoroState;
- (void)switchToShortBreakState;
- (void)switchToLongBreakState;
- (void)updateRemainingTime:(int)remainingSeconds;
- (void)updatePomodoroCount:(int)count;
@end
|
Use PSP for all threads | /**
* @file
* @brief
*
* @author Anton Kozlov
* @date 25.10.2012
*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <assert.h>
#include <hal/context.h>
#include <asm/modes.h>
#include <arm/fpu.h>
/* In the RVCT v2.0 and above, all generated code and C library code
* will maintain eight-byte stack alignment on external interfaces. */
#define ARM_SP_ALIGNMENT 8
void context_init(struct context *ctx, unsigned int flags,
void (*routine_fn)(void), void *sp) {
ctx->lr = (uint32_t) routine_fn;
ctx->sp = (uint32_t) sp;
assertf(((uint32_t) sp % ARM_SP_ALIGNMENT) == 0,
"Stack pointer is not aligned to 8 bytes.\n"
"Firstly please make sure the thread stack size is aligned to 8 bytes"
);
ctx->control = 0;
if (!(flags & CONTEXT_PRIVELEGED)) {
ctx->control |= CONTROL_NPRIV;
}
arm_fpu_context_init(&ctx->fpu_data);
}
| /**
* @file
* @brief
*
* @author Anton Kozlov
* @date 25.10.2012
*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <assert.h>
#include <hal/context.h>
#include <asm/modes.h>
#include <arm/fpu.h>
/* In the RVCT v2.0 and above, all generated code and C library code
* will maintain eight-byte stack alignment on external interfaces. */
#define ARM_SP_ALIGNMENT 8
void context_init(struct context *ctx, unsigned int flags,
void (*routine_fn)(void), void *sp) {
ctx->lr = (uint32_t) routine_fn;
ctx->sp = (uint32_t) sp;
assertf(((uint32_t) sp % ARM_SP_ALIGNMENT) == 0,
"Stack pointer is not aligned to 8 bytes.\n"
"Firstly please make sure the thread stack size is aligned to 8 bytes"
);
ctx->control = CONTROL_SPSEL_PSP;
if (!(flags & CONTEXT_PRIVELEGED)) {
ctx->control |= CONTROL_NPRIV;
}
arm_fpu_context_init(&ctx->fpu_data);
}
|
Fix a typo which causes infinite recursion | /* This file is part of Metallic, a runtime library for WebAssembly.
*
* Copyright (C) 2018 Chen-Pang He <chen.pang.he@jdh8.org>
*
* This Source Code Form is subject to the terms of the Mozilla
* Public License v. 2.0. If a copy of the MPL was not distributed
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
#include "floatuntidf.h"
double __floatuntidf(unsigned __int128 a)
{
return __floatuntidf(a);
}
| /* This file is part of Metallic, a runtime library for WebAssembly.
*
* Copyright (C) 2018 Chen-Pang He <chen.pang.he@jdh8.org>
*
* This Source Code Form is subject to the terms of the Mozilla
* Public License v. 2.0. If a copy of the MPL was not distributed
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
#include "floatuntidf.h"
double __floatuntidf(unsigned __int128 a)
{
return _floatuntidf(a);
}
|
Set the NSString property to copy mode | //
// CWSCore.h
// yafacwesConsole
//
// Created by Matthias Lamoureux on 13/07/2015.
// Copyright (c) 2015 pinguzaph. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CWSCore : NSObject
@property (nonatomic, strong) NSString * name;
@end
| //
// CWSCore.h
// yafacwesConsole
//
// Created by Matthias Lamoureux on 13/07/2015.
// Copyright (c) 2015 pinguzaph. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CWSCore : NSObject
@property (nonatomic, copy) NSString * name;
@end
|
Clean up shared lib header code | #ifndef LIB_TEMPLATE_CMAKE_H
#define LIB_TEMPLATE_CMAKE_H
namespace LibTemplateCMake {
/**
* \class LibTemplateCMake::aClass
* \headerfile template-lib.h <TemplateLib/templatelib.h>
*
* \brief A class from LibTemplateCMake namespace.
*
* This class that does a summation.
*/
class summationClass
{
public:
/**
* Constructor
*/
summationClass();
/**
* Destructory
*/
virtual ~summationClass();
/**
* A method that does a summation
*/
virtual double doSomething(double op1, double op2);
};
/**
* \class LibTemplateCMake::anotherClass
* \headerfile template-lib.h <TemplateLib/templatelib.h>
*
* \brief A derived class from LibTemplateCMake namespace.
*
* This class performs a difference.
*/
class differenceClass : public summationClass
{
public:
/**
* Constructor
*/
differenceClass();
/**
* Destructory
*/
virtual ~differenceClass();
/**
* A method that does something
*/
virtual double doSomething(double op1, double op2);
};
} // namespace LibTemplateCMake
#endif /* LIB_TEMPLATE_CMAKE_H */
| #ifndef LIB_TEMPLATE_CMAKE_H
#define LIB_TEMPLATE_CMAKE_H
namespace LibTemplateCMake {
/**
* \class LibTemplateCMake::aClass
* \headerfile template-lib.h <TemplateLib/templatelib.h>
*
* \brief A class from LibTemplateCMake namespace.
*
* This class that does a summation.
*/
class summationClass
{
public:
/**
* Constructor
*/
summationClass();
/**
* Destructor
*/
virtual ~summationClass();
/**
* A method that does a summation
*/
virtual double doSomething(double op1, double op2);
};
/**
* \class LibTemplateCMake::anotherClass
* \headerfile template-lib.h <TemplateLib/templatelib.h>
*
* \brief A derived class from LibTemplateCMake namespace.
*
* This class performs a difference.
*/
class differenceClass : public summationClass
{
public:
/**
* Constructor
*/
differenceClass();
/**
* Destructor
*/
virtual ~differenceClass();
/**
* A method that does something
*/
virtual double doSomething(double op1, double op2);
};
} // namespace LibTemplateCMake
#endif /* LIB_TEMPLATE_CMAKE_H */
|
Correct type of `pthread_once` argument | //PARAM: --disable sem.unknown_function.spawn
#include <pthread.h>
#include <assert.h>
int g;
pthread_once_t once = PTHREAD_ONCE_INIT;
void *t_fun(void *arg) {
assert(1); // reachable!
return NULL;
}
int main() {
pthread_once(&once,t_fun);
return 0;
}
| //PARAM: --disable sem.unknown_function.spawn
#include <pthread.h>
#include <assert.h>
int g;
pthread_once_t once = PTHREAD_ONCE_INIT;
void t_fun() {
assert(1); // reachable!
return NULL;
}
int main() {
pthread_once(&once,t_fun);
return 0;
}
|
Add solution to Exercise 1-19. | /* Exercise 1-19: Write a function "reverse(s)" that reverses the character
* string "s". Use it to write a program that reverses its input a line at a
* time. */
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
uint32_t reverse(char *s);
int main(int argc, char **argv)
{
char *buffer = NULL;
uint32_t buffer_length = 0;
char character = 0;
bool finished_inputting = false;
/* You would normally have the end-of-file test in the loop condition
* expression, however this introduces a subtle bug where the last line
* isn't processed if the input doesn't end with a newline. See
* <http://users.powernet.co.uk/eton/kandr2/krx113.html> for details. */
while (finished_inputting == false) {
character = getchar();
if (character == '\n' || (character == EOF && buffer_length > 0)) {
buffer = realloc(buffer, ++buffer_length * sizeof(char));
buffer[buffer_length - 1] = '\0';
reverse(buffer);
printf("%s\n", buffer);
free(buffer);
buffer = NULL;
buffer_length = 0;
} else {
buffer = realloc(buffer, ++buffer_length * sizeof(char));
buffer[buffer_length - 1] = character;
}
finished_inputting = (character == EOF);
}
return EXIT_SUCCESS;
}
uint32_t reverse(char *s)
{
uint32_t string_length = 0;
while (s[string_length] != '\0') {
string_length++;
}
int32_t i = 0, j = string_length - 1;
char temp = 0;
for (i = 0; i < j; i++, j--) {
temp = s[i];
s[i] = s[j];
s[j] = temp;
}
return string_length;
}
| |
Enable history pruning at depth 4 | #ifndef _CONFIG_H
#define _CONFIG_H
#define ENABLE_COUNTERMOVE_HISTORY 0
#define ENABLE_HISTORY_PRUNE_DEPTH 0
#define ENABLE_NNUE 0
#define ENABLE_NNUE_SIMD 0
#endif
| #ifndef _CONFIG_H
#define _CONFIG_H
#define ENABLE_COUNTERMOVE_HISTORY 0
#define ENABLE_HISTORY_PRUNE_DEPTH 4
#define ENABLE_NNUE 0
#define ENABLE_NNUE_SIMD 0
#endif
|
Fix naming of rand_rangef name | #ifndef DW_RANDOM_H
#define DW_RANDOM_H
int rand_rangei(int min, int max);
float rand_rangei(float min, float max);
#define rand_bool() rand_rangei(0, 2)
#endif
| #ifndef DW_RANDOM_H
#define DW_RANDOM_H
int rand_rangei(int min, int max);
float rand_rangef(float min, float max);
#define rand_bool() rand_rangei(0, 2)
#endif
|
Fix a typo in a comment | /*
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2016 Cryptography Research, Inc.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*
* Originally written by Mike Hamburg
*/
#ifndef __ARCH_ARCH_32_ARCH_INTRINSICS_H__
# define __ARCH_ARCH_32_ARCH_INTRINSICS_H__
# define ARCH_WORD_BITS 32
static ossl_inline uint32_t word_is_zero(uint32_t a)
{
/* let's hope the compiler isn't clever enough to optimize this. */
return (((uint64_t)a) - 1) >> 32;
}
static ossl_inline uint64_t widemul(uint32_t a, uint32_t b)
{
return ((uint64_t)a) * b;
}
#endif /* __ARCH_ARM_32_ARCH_INTRINSICS_H__ */
| /*
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2016 Cryptography Research, Inc.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*
* Originally written by Mike Hamburg
*/
#ifndef __ARCH_ARCH_32_ARCH_INTRINSICS_H__
# define __ARCH_ARCH_32_ARCH_INTRINSICS_H__
# define ARCH_WORD_BITS 32
static ossl_inline uint32_t word_is_zero(uint32_t a)
{
/* let's hope the compiler isn't clever enough to optimize this. */
return (((uint64_t)a) - 1) >> 32;
}
static ossl_inline uint64_t widemul(uint32_t a, uint32_t b)
{
return ((uint64_t)a) * b;
}
#endif /* __ARCH_ARCH_32_ARCH_INTRINSICS_H__ */
|
Fix compilation on MacOSX (common symbols not allowed with MH_DYLIB output format) | #ifdef _WIN32
#define DL_EXPORT __declspec( dllexport )
#else
#define DL_EXPORT
#endif
DL_EXPORT int TestDynamicLoaderData;
DL_EXPORT void TestDynamicLoaderFunction()
{
}
| #ifdef _WIN32
#define DL_EXPORT __declspec( dllexport )
#else
#define DL_EXPORT
#endif
DL_EXPORT int TestDynamicLoaderData = 0;
DL_EXPORT void TestDynamicLoaderFunction()
{
}
|
Remove the previously added comment. Probabilly me is the only one who didn't know userland and kerneland sizes were mismatching. | /*-
* Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org>
* All rights reserved.
*
* Copyright (c) 2008 Nokia Corporation
* 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 unmodified, this list of conditions, and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__CPUSET_H_
#define _SYS__CPUSET_H_
#include <sys/param.h>
#ifdef _KERNEL
#define CPU_SETSIZE MAXCPU
#endif
#define CPU_MAXSIZE (4 * MAXCPU)
#ifndef CPU_SETSIZE
#define CPU_SETSIZE CPU_MAXSIZE
#endif
#define _NCPUBITS (sizeof(long) * NBBY) /* bits per mask */
#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS)
typedef struct _cpuset {
long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
} cpuset_t;
#endif /* !_SYS__CPUSET_H_ */
| |
Add branching test for congruence domain | // PARAM: --sets solver td3 --enable ana.int.congruence --disable ana.int.def_exc
int main(){
// A refinement of a congruence class should only take place for the == and != operator.
int i;
if (i==0){
assert(i==0);
} else {
assert(i!=0); //UNKNOWN!
}
int j;
if (j != 0){
assert (j != 0); //UNKNOWN!
} else {
assert (j == 0);
}
int k;
if (k > 0) {
assert (k == 0); //UNKNOWN!
} else {
assert (k != 0); //UNKNOWN!
}
return 0;
} | |
Change to 3D active read | C $Header$
C $Name$
CBOP
C !ROUTINE: OPENAD_OPTIONS.h
C !INTERFACE:
C #include "OPENAD_OPTIONS.h"
C !DESCRIPTION:
C *==================================================================*
C | CPP options file for OpenAD (openad) package:
C | Control which optional features to compile in this package code.
C *==================================================================*
CEOP
#ifndef OPENAD_OPTIONS_H
#define OPENAD_OPTIONS_H
#include "PACKAGES_CONFIG.h"
#include "CPP_OPTIONS.h"
#ifdef ALLOW_OPENAD
#define ALLOW_OPENAD_ACTIVE_READ_XYZ
#undef ALLOW_OPENAD_ACTIVE_READ_XY
#undef ALLOW_OPENAD_ACTIVE_WRITE
#endif /* ALLOW_OPENAD */
#endif /* OPENAD_OPTIONS_H */
| |
Add basic example with multiple contexts | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR: __VERIFIER_error();
}
return;
}
void foo(int x)
{
__VERIFIER_assert(x - 1 < x);
}
int main()
{
foo(1);
foo(2);
return 0;
} | |
Replace %02hhx with %02x in UUID format | /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2010 Red Hat, Inc.
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef SPICE_UTIL_PRIV_H
#define SPICE_UTIL_PRIV_H
#include <glib.h>
G_BEGIN_DECLS
#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
gboolean spice_strv_contains(const GStrv strv, const gchar *str);
gchar* spice_uuid_to_string(const guint8 uuid[16]);
G_END_DECLS
#endif /* SPICE_UTIL_PRIV_H */
| /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2010 Red Hat, Inc.
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef SPICE_UTIL_PRIV_H
#define SPICE_UTIL_PRIV_H
#include <glib.h>
G_BEGIN_DECLS
#define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
gboolean spice_strv_contains(const GStrv strv, const gchar *str);
gchar* spice_uuid_to_string(const guint8 uuid[16]);
G_END_DECLS
#endif /* SPICE_UTIL_PRIV_H */
|
Test cleanup-attribute with const struct parameter | // RUN: %ocheck 0 %s
struct store_out
{
int *local;
int *ret;
};
void store_out(const struct store_out *const so)
{
*so->ret = *so->local;
}
void f(int *p)
{
int i = *p;
struct store_out so __attribute((cleanup(store_out))) = {
.local = &i,
.ret = p
};
i = 5;
}
main()
{
int i = 3;
f(&i);
if(i != 5)
abort();
return 0;
}
| |
Add c_list to standard lib header file. | /*
* cynapses libc functions
*
* Copyright (c) 2008 by Andreas Schneider <mail@cynapses.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.
*
* vim: ts=2 sw=2 et cindent
*/
#include "c_macro.h"
#include "c_alloc.h"
#include "c_dir.h"
#include "c_file.h"
#include "c_path.h"
#include "c_rbtree.h"
#include "c_string.h"
#include "c_time.h"
| /*
* cynapses libc functions
*
* Copyright (c) 2008 by Andreas Schneider <mail@cynapses.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.
*
* vim: ts=2 sw=2 et cindent
*/
#include "c_macro.h"
#include "c_alloc.h"
#include "c_dir.h"
#include "c_file.h"
#include "c_list.h"
#include "c_path.h"
#include "c_rbtree.h"
#include "c_string.h"
#include "c_time.h"
|
Make sample app a little more clear | /*
* Copyright 2014 SimpleThings, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <canopy.h>
int main(void)
{
canopy_post_sample(
CANOPY_CLOUD_SERVER, "dev02.canopy.link",
CANOPY_DEVICE_UUID, "9dfe2a00-efe2-45f9-a84c-8afc69caf4e7",
CANOPY_PROPERTY_NAME, "cpu",
CANOPY_VALUE_FLOAT32, 0.22f
);
return 0;
}
| /*
* Copyright 2014 SimpleThings, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <canopy.h>
int main(void)
{
// Your code here for determining sensor value...
float temperature = 24.0f;
// Send sample to the cloud:
canopy_post_sample(
CANOPY_CLOUD_SERVER, "dev02.canopy.link",
CANOPY_DEVICE_UUID, "9dfe2a00-efe2-45f9-a84c-8afc69caf4e7",
CANOPY_PROPERTY_NAME, "temperature",
CANOPY_VALUE_FLOAT32, temperature
);
return 0;
}
|
Store ID for source template. | //
// Encounter.h
// ProeliaKit
//
// Created by Paul Schifferer on 3/5/15.
// Copyright (c) 2015 Pilgrimage Software. All rights reserved.
//
@import Foundation;
#import "EncounterConstants.h"
#import "GameSystem.h"
#import "AbstractEncounter.h"
@class EncounterMap;
@class EncounterParticipant;
@class EncounterRegion;
@class EncounterTimelineEntry;
/**
* An instance of this class represents an encounter created from a template that is being run.
*/
@interface Encounter : AbstractEncounter
// -- Attributes --
/**
*
*/
@property (nonatomic, assign) NSInteger currentRound;
/**
*
*/
@property (nonatomic, assign) NSTimeInterval endDate;
/**
*
*/
@property (nonatomic, assign) NSInteger numberOfRounds;
/**
*
*/
@property (nonatomic, assign) NSInteger numberOfTurns;
/**
*
*/
@property (nonatomic, copy) NSString *encounterTemplateName;
/**
*
*/
@property (nonatomic, assign) NSTimeInterval startDate;
/**
*
*/
@property (nonatomic, assign) EncounterState state;
/**
*
*/
@property (nonatomic, copy) NSData *turnQueue;
// -- Relationships --
@end
| //
// Encounter.h
// ProeliaKit
//
// Created by Paul Schifferer on 3/5/15.
// Copyright (c) 2015 Pilgrimage Software. All rights reserved.
//
@import Foundation;
#import "EncounterConstants.h"
#import "GameSystem.h"
#import "AbstractEncounter.h"
@class EncounterMap;
@class EncounterParticipant;
@class EncounterRegion;
@class EncounterTimelineEntry;
/**
* An instance of this class represents an encounter created from a template that is being run.
*/
@interface Encounter : AbstractEncounter
// -- Attributes --
/**
*
*/
@property (nonatomic, assign) NSInteger currentRound;
/**
*
*/
@property (nonatomic, assign) NSTimeInterval endDate;
/**
*
*/
@property (nonatomic, assign) NSInteger numberOfRounds;
/**
*
*/
@property (nonatomic, assign) NSInteger numberOfTurns;
/**
*
*/
@property (nonatomic, copy) NSString *encounterTemplateName;
/**
*
*/
@property (nonatomic, assign) NSTimeInterval startDate;
/**
*
*/
@property (nonatomic, assign) EncounterState state;
/**
*
*/
@property (nonatomic, copy) NSData *turnQueue;
// -- Relationships --
/**
*/
@property (nonatomic, copy) NSString* templateId;
@end
|
Add insert node at tail fn | /*
Input Format
You have to complete the Node* Insert(Node* head, int data) method which takes two arguments - the head of the linked list and the integer to insert. You should NOT read any input from stdin/console.
Output Format
Insert the new node at the tail and just return the head of the updated linked list. Do NOT print anything to stdout/console.
Sample Input
NULL, data = 2
2 --> NULL, data = 3
Sample Output
2 -->NULL
2 --> 3 --> NULL
Explanation
1. We have an empty list and we insert 2.
2. We have 2 in the tail, when 3 is inserted 3 becomes the tail.
*/
/*
Insert Node at the end of a linked list
head pointer input could be NULL as well for empty list
Node is defined as
struct Node
{
int data;
struct Node *next;
}
*/
Node* Insert(Node *head,int data)
{
Node* temp;
temp =(Node*) malloc(sizeof(Node));
temp->data = data;
temp->next = NULL;
Node* head_temp=head;
if(head ==NULL){
head = temp;
}
else {
while(head_temp->next!=NULL){
head_temp = head_temp->next;
}
head_temp->next = temp;
}
return head;
}
| |
Test exported symbol set against RTUBsan | // Check that the ubsan and ubsan-minimal runtimes have the same symbols,
// making exceptions as necessary.
//
// REQUIRES: x86_64-darwin
// RUN: nm -jgU `%clangxx -fsanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_minimal_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_minimal_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
// RUN: | sed 's/_minimal//g' \
// RUN: > %t.minimal.symlist
//
// RUN: nm -jgU `%clangxx -fno-sanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
// RUN: | grep -vE "^___ubsan_handle_dynamic_type_cache_miss" \
// RUN: | grep -vE "^___ubsan_handle_cfi_bad_type" \
// RUN: | sed 's/_v1//g' \
// RUN: > %t.full.symlist
//
// RUN: diff %t.minimal.symlist %t.full.symlist
| |
Fix GE0/GE1 init on ix2-200 as GE0 has no PHY | /*
* arch/arm/mach-kirkwood/board-iomega_ix2_200.c
*
* Iomega StorCenter ix2-200
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mv643xx_eth.h>
#include <linux/ethtool.h>
#include "common.h"
static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_NONE,
.speed = SPEED_1000,
.duplex = DUPLEX_FULL,
};
void __init iomega_ix2_200_init(void)
{
/*
* Basic setup. Needs to be called early.
*/
kirkwood_ge01_init(&iomega_ix2_200_ge00_data);
}
| /*
* arch/arm/mach-kirkwood/board-iomega_ix2_200.c
*
* Iomega StorCenter ix2-200
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mv643xx_eth.h>
#include <linux/ethtool.h>
#include "common.h"
static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_NONE,
.speed = SPEED_1000,
.duplex = DUPLEX_FULL,
};
static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(11),
};
void __init iomega_ix2_200_init(void)
{
/*
* Basic setup. Needs to be called early.
*/
kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
}
|
Add provisional version, to be finished at home later today. | //-------------------------------------------------------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//-------------------------------------------------------------------------
/**
* @defgroup constraints Constraints on degrees of freedom
* @ingroup dofs
*
* This module deals with constraints on degrees of
* freedom. Constraints typically come from several sources, for
* example:
* - If you have Dirichlet-type boundary conditions, one usually enforces
* them by requiring that that degrees of freedom on the boundary have
* particular values, for example $x_12=42$ if the boundary condition
* requires that the finite element solution at the location of degree
* of freedom 12 has the value 42.
*
* This class implements dealing with linear (possibly inhomogeneous)
* constraints on degrees of freedom. In particular, it handles constraints of
* the form $x_{i_1} = \sum_{j=2}^M a_{i_j} x_{i_j} + b_i$. In the context of
* adaptive finite elements, such constraints appear most frequently as
* "hanging nodes" and for implementing Dirichlet boundary conditions in
* strong form. The class is meant to deal with a limited number of
* constraints relative to the total number of degrees of freedom, for example
* a few per cent up to maybe 30 per cent; and with a linear combination of
* $M$ other degrees of freedom where $M$ is also relatively small (no larger
* than at most around the average number of entries per row of a linear
* system). It is <em>not</em> meant to describe full rank linear systems.
*/
| |
Fix fwd decl for windows. | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_DISPLAY_H
#define CLING_DISPLAY_H
#include <string>
namespace llvm {
class raw_ostream;
}
namespace cling {
void DisplayClasses(llvm::raw_ostream &stream,
const class Interpreter *interpreter, bool verbose);
void DisplayClass(llvm::raw_ostream &stream,
const Interpreter *interpreter, const char *className,
bool verbose);
void DisplayGlobals(llvm::raw_ostream &stream, const Interpreter *interpreter);
void DisplayGlobal(llvm::raw_ostream &stream, const Interpreter *interpreter,
const std::string &name);
}
#endif
| //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_DISPLAY_H
#define CLING_DISPLAY_H
#include <string>
namespace llvm {
class raw_ostream;
}
namespace cling {
class Interpreter;
void DisplayClasses(llvm::raw_ostream &stream,
const Interpreter *interpreter, bool verbose);
void DisplayClass(llvm::raw_ostream &stream,
const Interpreter *interpreter, const char *className,
bool verbose);
void DisplayGlobals(llvm::raw_ostream &stream, const Interpreter *interpreter);
void DisplayGlobal(llvm::raw_ostream &stream, const Interpreter *interpreter,
const std::string &name);
}
#endif
|
Revert r125642. This broke the build? It should be a no-op. | //===--- ClangSACheckers.h - Registration functions for Checkers *- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Declares the registation functions for the checkers defined in
// libclangStaticAnalyzerCheckers.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_SA_LIB_CHECKERS_CLANGSACHECKERS_H
#define LLVM_CLANG_SA_LIB_CHECKERS_CLANGSACHECKERS_H
namespace clang {
namespace ento {
class ExprEngine;
#define GET_CHECKERS
#define CHECKER(FULLNAME,CLASS,CXXFILE,HELPTEXT,HIDDEN) \
void register##CLASS(ExprEngine &Eng);
#include "Checkers.inc"
#undef CHECKER
#undef GET_CHECKERS
} // end ento namespace
} // end clang namespace
#endif
| //===--- ClangSACheckers.h - Registration functions for Checkers *- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Declares the registation functions for the checkers defined in
// libclangStaticAnalyzerCheckers.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_SA_LIB_CHECKERS_CLANGSACHECKERS_H
#define LLVM_CLANG_SA_LIB_CHECKERS_CLANGSACHECKERS_H
namespace clang {
namespace ento {
class ExprEngine;
#define GET_CHECKERS
#define CHECKER(FULLNAME,CLASS,CXXFILE,HELPTEXT,HIDDEN) \
void register##CLASS(ExprEngine &Eng);
#include "../Checkers/Checkers.inc"
#undef CHECKER
#undef GET_CHECKERS
} // end ento namespace
} // end clang namespace
#endif
|
Add facilities to define classes with arithmetic semantics | //----------------------------------------------------------------------------
//
// "Copyright Centre National d'Etudes Spatiales"
//
// License: LGPL-2
//
// See LICENSE.txt file in the top level directory for more details.
//
//----------------------------------------------------------------------------
// $Id$
#ifndef ossimOperatorUtilities_h
#define ossimOperatorUtilities_h
namespace ossimplugins {
// Uses Barton-Nackman trick to help implement operator on classes
// Strongly inspired by boost.operators interface
// See ossimTimeUtilities.h and ossimTimeUtilitiesTest.cpp for example of
// use
#define DEFINE_OPERATORS(name, compound, op) \
template <typename T> struct name ## 1 \
{ \
friend T operator op(T lhs, T const& rhs) { \
lhs compound rhs; \
return lhs; \
} \
}; \
template <typename T, typename U> struct name ## 2 \
{ \
friend T operator op(T lhs, U const& rhs) { \
lhs compound rhs; \
return lhs; \
} \
friend T operator op(U const& lhs, T rhs) { \
rhs compound lhs; \
return rhs; \
} \
}; \
template <typename T, typename U=void> struct name : name ## 2<T,U> {}; \
template <typename T> struct name<T,void> : name ## 1<T> {};
template <typename U, typename V> struct substractable_asym
{
friend U operator-(V const& lhs, V const& rhs) {
return V::template diff<U,V>(lhs, rhs);
}
};
DEFINE_OPERATORS(addable, +=, +);
DEFINE_OPERATORS(substractable, -=, -);
DEFINE_OPERATORS(multipliable, *=, *);
#undef DEFINE_OPERATORS
template <typename T, typename R> struct dividable {
typedef R scalar_type;
friend T operator/(T lhs, scalar_type const& rhs) {
lhs /= rhs;
return lhs;
}
friend scalar_type operator/(T const& lhs, T const& rhs) {
return ratio(lhs, rhs);
}
};
template <typename T> struct streamable {
friend std::ostream & operator<<(std::ostream & os, const T & v)
{ return v.display(os); }
};
template <typename T> struct less_than_comparable {
friend bool operator>(T const& lhs, T const& rhs) {
return rhs < lhs;
}
friend bool operator>=(T const& lhs, T const& rhs) {
return !(lhs < rhs);
}
friend bool operator<=(T const& lhs, T const& rhs) {
return !(rhs < lhs);
}
};
template <typename T> struct equality_comparable {
friend bool operator!=(T const& lhs, T const& rhs) {
return !(rhs == lhs);
}
};
}// namespace ossimplugins
#endif // ossimOperatorUtilities_h
| |
Add guards for GAME_VERSION for command line customization | /**
* WarfaceBot, a blind XMPP client for Warface (FPS)
* Copyright (C) 2015 Levak Borok <levak92@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WB_GAME_VERSION_H
# define WB_GAME_VERSION_H
# define GAME_VERSION "1.1.1.3570"
#endif /* !WB_GAME_VERSION_H */
| /**
* WarfaceBot, a blind XMPP client for Warface (FPS)
* Copyright (C) 2015 Levak Borok <levak92@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WB_GAME_VERSION_H
# define WB_GAME_VERSION_H
# ifndef GAME_VERSION
# define GAME_VERSION "1.1.1.3570"
# endif /* !GAME_VERSION */
#endif /* !WB_GAME_VERSION_H */
|
Fix fwd decl for windows. | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_DISPLAY_H
#define CLING_DISPLAY_H
#include <string>
namespace llvm {
class raw_ostream;
}
namespace cling {
void DisplayClasses(llvm::raw_ostream &stream,
const class Interpreter *interpreter, bool verbose);
void DisplayClass(llvm::raw_ostream &stream,
const Interpreter *interpreter, const char *className,
bool verbose);
void DisplayGlobals(llvm::raw_ostream &stream, const Interpreter *interpreter);
void DisplayGlobal(llvm::raw_ostream &stream, const Interpreter *interpreter,
const std::string &name);
}
#endif
| //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_DISPLAY_H
#define CLING_DISPLAY_H
#include <string>
namespace llvm {
class raw_ostream;
}
namespace cling {
class Interpreter;
void DisplayClasses(llvm::raw_ostream &stream,
const Interpreter *interpreter, bool verbose);
void DisplayClass(llvm::raw_ostream &stream,
const Interpreter *interpreter, const char *className,
bool verbose);
void DisplayGlobals(llvm::raw_ostream &stream, const Interpreter *interpreter);
void DisplayGlobal(llvm::raw_ostream &stream, const Interpreter *interpreter,
const std::string &name);
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.