Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Remove extra public access modifier. | // Copyright 2014-present Bill Fisher. All rights reserved.
#ifndef OFP_ACTIONID_H_
#define OFP_ACTIONID_H_
#include "ofp/constants.h"
#include "ofp/actiontype.h"
namespace ofp {
class ActionID {
public:
public:
enum {
ProtocolIteratorSizeOffset = sizeof(OFPActionType),
ProtocolIteratorAlignment = 4
};
explicit ActionID(OFPActionType type = OFPAT_OUTPUT, UInt32 experimenter = 0)
: type_(type, type == OFPAT_EXPERIMENTER ? 8U : 4U),
experimenter_{experimenter} {}
explicit ActionID(ActionType type, UInt32 experimenter = 0)
: ActionID{type.enumType(), experimenter} {}
ActionType type() const { return type_.zeroLength(); }
UInt32 experimenter() const { return experimenter_; }
private:
ActionType type_;
Big32 experimenter_;
size_t length() const { return type_.length(); }
friend class ActionIDList;
};
} // namespace ofp
#endif // OFP_ACTIONID_H_
| // Copyright 2014-present Bill Fisher. All rights reserved.
#ifndef OFP_ACTIONID_H_
#define OFP_ACTIONID_H_
#include "ofp/constants.h"
#include "ofp/actiontype.h"
namespace ofp {
class ActionID {
public:
enum {
ProtocolIteratorSizeOffset = sizeof(OFPActionType),
ProtocolIteratorAlignment = 4
};
explicit ActionID(OFPActionType type = OFPAT_OUTPUT, UInt32 experimenter = 0)
: type_(type, type == OFPAT_EXPERIMENTER ? 8U : 4U),
experimenter_{experimenter} {}
explicit ActionID(ActionType type, UInt32 experimenter = 0)
: ActionID{type.enumType(), experimenter} {}
ActionType type() const { return type_.zeroLength(); }
UInt32 experimenter() const { return experimenter_; }
private:
ActionType type_;
Big32 experimenter_;
size_t length() const { return type_.length(); }
friend class ActionIDList;
};
} // namespace ofp
#endif // OFP_ACTIONID_H_
|
Increase version to 1.44 in preparation for new release | #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.44f;
// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'
| #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.45f;
// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'
|
Add LEDs enable to platform/stm32/f3/stm32f3-discovery/ | #include <stm32f3discovery.conf.h>
CONFIG {
uarts[1].status = ENABLED;
}
| #include <stm32f3discovery.conf.h>
CONFIG {
uarts[1].status = ENABLED;
leds[0].status = ENABLED;
leds[1].status = ENABLED;
leds[2].status = ENABLED;
leds[3].status = ENABLED;
leds[4].status = ENABLED;
leds[5].status = ENABLED;
leds[6].status = ENABLED;
leds[7].status = ENABLED;
}
|
Fix missing include (for size_t) | #if !defined(ED_XMLFILE_H)
#define ED_XMLFILE_H
void* ED_createXML(const char* fileName);
void ED_destroyXML(void* _xml);
double ED_getDoubleFromXML(void* _xml, const char* varName);
const char* ED_getStringFromXML(void* _xml, const char* varName);
int ED_getIntFromXML(void* _xml, const char* varName);
void ED_getDoubleArray1DFromXML(void* _xml, const char* varName, double* a, size_t n);
void ED_getDoubleArray2DFromXML(void* _xml, const char* varName, double* a, size_t m, size_t n);
#endif
| #if !defined(ED_XMLFILE_H)
#define ED_XMLFILE_H
#include <stdlib.h>
void* ED_createXML(const char* fileName);
void ED_destroyXML(void* _xml);
double ED_getDoubleFromXML(void* _xml, const char* varName);
const char* ED_getStringFromXML(void* _xml, const char* varName);
int ED_getIntFromXML(void* _xml, const char* varName);
void ED_getDoubleArray1DFromXML(void* _xml, const char* varName, double* a, size_t n);
void ED_getDoubleArray2DFromXML(void* _xml, const char* varName, double* a, size_t m, size_t n);
#endif
|
Fix file name in comment header | /*
* preventfork.c
* Copyright (C) 2010 Adrian Perez <aperez@igalia.com>
*
* Distributed under terms of the MIT license.
*/
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
pid_t
fork (void)
{
return 0;
}
int
daemon (int nochdir, int noclose)
{
if (!nochdir == 0) {
if (chdir ("/"))
return -1;
}
if (!noclose) {
close (0);
if (open ("/dev/null", O_RDONLY, 0) != 0)
return -1;
close (1);
if (open ("/dev/null", O_WRONLY, 0) != 1)
return -1;
close (2);
if (dup (1) != 2)
return -1;
}
return 0;
}
| /*
* nofork.c
* Copyright (C) 2010 Adrian Perez <aperez@igalia.com>
*
* Distributed under terms of the MIT license.
*/
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
pid_t
fork (void)
{
return 0;
}
int
daemon (int nochdir, int noclose)
{
if (!nochdir == 0) {
if (chdir ("/"))
return -1;
}
if (!noclose) {
close (0);
if (open ("/dev/null", O_RDONLY, 0) != 0)
return -1;
close (1);
if (open ("/dev/null", O_WRONLY, 0) != 1)
return -1;
close (2);
if (dup (1) != 2)
return -1;
}
return 0;
}
|
Undo change proposed by Philippe. Too many side effects. | #ifndef G__IOSFWD_H
#define G__IOSFWD_H
#include <iostream.h>
typedef basic_streambuf<char, char_traits<char> > streambuf;
#endif
| #ifndef G__IOSFWD_H
#define G__IOSFWD_H
#include <iostream.h>
#endif
|
Switch various calls to folly::setThreadName to set the current thread's name | /*
* Copyright (c) 2017, 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 <atomic>
#include <string>
#include <thread>
#include <wangle/concurrent/ThreadFactory.h>
#include <folly/Conv.h>
#include <folly/Range.h>
#include <folly/ThreadName.h>
namespace wangle {
class NamedThreadFactory : public ThreadFactory {
public:
explicit NamedThreadFactory(folly::StringPiece prefix)
: prefix_(prefix.str()), suffix_(0) {}
std::thread newThread(folly::Func&& func) override {
auto thread = std::thread(std::move(func));
folly::setThreadName(
thread.native_handle(),
folly::to<std::string>(prefix_, suffix_++));
return thread;
}
void setNamePrefix(folly::StringPiece prefix) {
prefix_ = prefix.str();
}
std::string getNamePrefix() {
return prefix_;
}
private:
std::string prefix_;
std::atomic<uint64_t> suffix_;
};
} // namespace wangle
| /*
* Copyright (c) 2017, 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 <atomic>
#include <string>
#include <thread>
#include <wangle/concurrent/ThreadFactory.h>
#include <folly/Conv.h>
#include <folly/Range.h>
#include <folly/ThreadName.h>
namespace wangle {
class NamedThreadFactory : public ThreadFactory {
public:
explicit NamedThreadFactory(folly::StringPiece prefix)
: prefix_(prefix.str()), suffix_(0) {}
std::thread newThread(folly::Func&& func) override {
auto thread = std::thread([&](folly::Func&& funct) {
folly::setThreadName(folly::to<std::string>(prefix_, suffix_++));
funct();
}, std::move(func));
return thread;
}
void setNamePrefix(folly::StringPiece prefix) {
prefix_ = prefix.str();
}
std::string getNamePrefix() {
return prefix_;
}
private:
std::string prefix_;
std::atomic<uint64_t> suffix_;
};
} // namespace wangle
|
Fix missing class forward declaration that could cause build errors with some include orders. | //
// TLKSocketIOSignalingDelegate.h
// Copyright (c) 2014 &yet, LLC and TLKWebRTC contributors
//
#import <Foundation/Foundation.h>
@class TLKSocketIOSignaling;
@protocol TLKSocketIOSignalingDelegate <NSObject>
@optional
// Called when a connect request has failed due to a bad room key. Delegate is expected to
// get the room key from the user, and then call connect again with the correct key
-(void)serverRequiresPassword:(TLKSocketIOSignaling*)server;
-(void)addedStream:(TLKMediaStreamWrapper*)stream;
-(void)removedStream:(TLKMediaStreamWrapper*)stream;
-(void)peer:(NSString*)peer toggledAudioMute:(BOOL)mute;
-(void)peer:(NSString*)peer toggledVideoMute:(BOOL)mute;
-(void)lockChange:(BOOL)locked;
@end
| //
// TLKSocketIOSignalingDelegate.h
// Copyright (c) 2014 &yet, LLC and TLKWebRTC contributors
//
#import <Foundation/Foundation.h>
@class TLKSocketIOSignaling;
@class TLKMediaStreamWrapper;
@protocol TLKSocketIOSignalingDelegate <NSObject>
@optional
// Called when a connect request has failed due to a bad room key. Delegate is expected to
// get the room key from the user, and then call connect again with the correct key
-(void)serverRequiresPassword:(TLKSocketIOSignaling*)server;
-(void)addedStream:(TLKMediaStreamWrapper*)stream;
-(void)removedStream:(TLKMediaStreamWrapper*)stream;
-(void)peer:(NSString*)peer toggledAudioMute:(BOOL)mute;
-(void)peer:(NSString*)peer toggledVideoMute:(BOOL)mute;
-(void)lockChange:(BOOL)locked;
@end
|
Replace getcpy() with mh_xstrdup() where the string isn't NULL. |
/*
* seq_setprev.c -- set the Previous-Sequence
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
/*
* Add all the messages currently SELECTED to
* the Previous-Sequence. This way, when the next
* command is given, there is a convenient way to
* selected all the messages used in the previous
* command.
*/
void
seq_setprev (struct msgs *mp)
{
char **ap, *cp, *dp;
/*
* Get the list of sequences for Previous-Sequence
* and split them.
*/
if ((cp = context_find (psequence))) {
dp = getcpy (cp);
if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
free (dp);
return;
}
} else {
return;
}
/* Now add all SELECTED messages to each sequence */
for (; *ap; ap++)
seq_addsel (mp, *ap, -1, 1);
free (dp);
}
|
/*
* seq_setprev.c -- set the Previous-Sequence
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
#include <h/utils.h>
/*
* Add all the messages currently SELECTED to
* the Previous-Sequence. This way, when the next
* command is given, there is a convenient way to
* selected all the messages used in the previous
* command.
*/
void
seq_setprev (struct msgs *mp)
{
char **ap, *cp, *dp;
/*
* Get the list of sequences for Previous-Sequence
* and split them.
*/
if ((cp = context_find (psequence))) {
dp = mh_xstrdup(cp);
if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
free (dp);
return;
}
} else {
return;
}
/* Now add all SELECTED messages to each sequence */
for (; *ap; ap++)
seq_addsel (mp, *ap, -1, 1);
free (dp);
}
|
Fix typo in header name | /*
* Copyright 2011 Chris Wong.
*
* 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 "honk-windows.h"
#if !(defined(_WIN32))
# error This file can only be used on Microsoft Windows systems.
#endif
#include <windows.h>
/**
* Windows doesn't need a handle to the console,
* so we just use an arbitrary value instead
*/
static const int default_handle = 42;
int
beep_open() {
return default_handle;
}
int
beep_do(handle_t handle, double freq, double len) {
/* Check the user passed in the same handle we gave them earlier */
if (handle != default_handle)
FAIL;
/* Perform the beep */
Beep((DWORD) freq, (DWORD) (len * 1000));
/* Return the handle */
return handle;
}
void
beep_close(handle_t handle) {
/* Turn off the speaker, if it is running */
Beep(0, 0);
}
| /*
* Copyright 2011 Chris Wong.
*
* 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 "honk.h"
#if !(defined(_WIN32))
# error This file can only be used on Microsoft Windows systems.
#endif
#include <windows.h>
/**
* Windows doesn't need a handle to the console,
* so we just use an arbitrary value instead
*/
static const int default_handle = 42;
int
beep_open() {
return default_handle;
}
int
beep_do(handle_t handle, double freq, double len) {
/* Check the user passed in the same handle we gave them earlier */
if (handle != default_handle)
FAIL;
/* Perform the beep */
Beep((DWORD) freq, (DWORD) (len * 1000));
/* Return the handle */
return handle;
}
void
beep_close(handle_t handle) {
/* Turn off the speaker, if it is running */
Beep(0, 0);
}
|
Remove unnecessary API export on typedef | /*
**
** Author(s):
** - Cedric GESTES <gestes@aldebaran-robotics.com>
**
** Copyright (C) 2012 Aldebaran Robotics
*/
#ifndef _QIMESSAGING_OBJECT_H_
#define _QIMESSAGING_OBJECT_H_
#include <qimessaging/c/api_c.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct qi_object_t_s {} qi_object_t;
//forward declaration
typedef struct qi_message_t_s qi_message_t;
typedef struct qi_future_t_s qi_future_t;
QIMESSAGING_API typedef void (*qi_object_method_t)(const char *complete_signature, qi_message_t *msg, qi_message_t *ret, void *data);
QIMESSAGING_API qi_object_t *qi_object_create(const char *name);
QIMESSAGING_API void qi_object_destroy(qi_object_t *object);
QIMESSAGING_API int qi_object_register_method(qi_object_t *object, const char *complete_signature, qi_object_method_t func, void *data);
QIMESSAGING_API qi_future_t *qi_object_call(qi_object_t *object, const char *signature, qi_message_t *message);
#ifdef __cplusplus
}
#endif
#endif
| /*
**
** Author(s):
** - Cedric GESTES <gestes@aldebaran-robotics.com>
**
** Copyright (C) 2012 Aldebaran Robotics
*/
#ifndef _QIMESSAGING_OBJECT_H_
#define _QIMESSAGING_OBJECT_H_
#include <qimessaging/c/api_c.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct qi_object_t_s {} qi_object_t;
//forward declaration
typedef struct qi_message_t_s qi_message_t;
typedef struct qi_future_t_s qi_future_t;
typedef void (*qi_object_method_t)(const char *complete_signature, qi_message_t *msg, qi_message_t *ret, void *data);
QIMESSAGING_API qi_object_t *qi_object_create(const char *name);
QIMESSAGING_API void qi_object_destroy(qi_object_t *object);
QIMESSAGING_API int qi_object_register_method(qi_object_t *object, const char *complete_signature, qi_object_method_t func, void *data);
QIMESSAGING_API qi_future_t *qi_object_call(qi_object_t *object, const char *signature, qi_message_t *message);
#ifdef __cplusplus
}
#endif
#endif
|
Add boost tuple comparison header | // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#pragma once
#include <boost/tuple/tuple.hpp>
namespace std {
template<typename... Ts>
class tuple {
public:
tuple(const Ts&... ele):
m_tuple(ele...)
{}
virtual ~tuple(void){}
bool operator==(const tuple<Ts...>& other) const {
return m_tuple == other.m_tuple;
}
bool operator<(const tuple<Ts...>& other) const {
return m_tuple < other.m_tuple;
}
boost::tuple<Ts...> m_tuple;
};
template<int I, typename... Ts>
auto get(const ::std::tuple<Ts...>& tup) -> decltype(boost::get<I>(tup.m_tuple)) {
return boost::get<I>(tup.m_tuple);
}
template<typename... Ts>
::std::tuple<Ts...> make_tuple(const Ts&... ele) {
return ::std::tuple<Ts...>(ele...);
}
}//namespace std
| // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#pragma once
#include <boost/tuple/tuple.hpp>
#include "boost/tuple/tuple_comparison.hpp"
namespace std {
template<typename... Ts>
class tuple {
public:
tuple(const Ts&... ele):
m_tuple(ele...)
{}
virtual ~tuple(void){}
bool operator==(const tuple<Ts...>& other) const {
return m_tuple == other.m_tuple;
}
bool operator<(const tuple<Ts...>& other) const {
return m_tuple < other.m_tuple;
}
boost::tuple<Ts...> m_tuple;
};
template<int I, typename... Ts>
auto get(const ::std::tuple<Ts...>& tup) -> decltype(boost::get<I>(tup.m_tuple)) {
return boost::get<I>(tup.m_tuple);
}
template<typename... Ts>
::std::tuple<Ts...> make_tuple(const Ts&... ele) {
return ::std::tuple<Ts...>(ele...);
}
}//namespace std
|
Mark default ctor host/device for hcc | // This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#ifndef VSNRAY_MATH_RAY_H
#define VSNRAY_MATH_RAY_H 1
#include "config.h"
#include "vector.h"
namespace MATH_NAMESPACE
{
template <typename T>
class basic_ray
{
public:
typedef T scalar_type;
typedef vector<3, T> vec_type;
public:
vec_type ori;
vec_type dir;
basic_ray() = default;
MATH_FUNC basic_ray(vector<3, T> const& o, vector<3, T> const& d);
};
} // MATH_NAMESPACE
#include "detail/ray.inl"
#endif // VSNRAY_MATH_RAY_H
| // This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#ifndef VSNRAY_MATH_RAY_H
#define VSNRAY_MATH_RAY_H 1
#include "config.h"
#include "vector.h"
namespace MATH_NAMESPACE
{
template <typename T>
class basic_ray
{
public:
typedef T scalar_type;
typedef vector<3, T> vec_type;
public:
vec_type ori;
vec_type dir;
MATH_FUNC basic_ray() = default;
MATH_FUNC basic_ray(vector<3, T> const& o, vector<3, T> const& d);
};
} // MATH_NAMESPACE
#include "detail/ray.inl"
#endif // VSNRAY_MATH_RAY_H
|
Add a header file for the POSIX filesystem. | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_C_EXPERIMENTAL_FILESYSTEM_PLUGINS_POSIX_POSIX_FILESYSTEM_H_
#define TENSORFLOW_C_EXPERIMENTAL_FILESYSTEM_PLUGINS_POSIX_POSIX_FILESYSTEM_H_
// Initialize the POSIX filesystem.
//
// In general, the `TF_InitPlugin` symbol doesn't need to be exposed in a header
// file, since the plugin registration will look for the symbol in the DSO file
// that provides the filesystem functionality. However, the POSIX filesystem
// needs to be statically registered in some tests and utilities for building
// the API files at the time of creating the pip package. Hence, we need to
// expose this function so that this filesystem can be statically registered
// when needed.
void TF_InitPlugin(TF_FilesystemPluginInfo* info);
#endif // TENSORFLOW_C_EXPERIMENTAL_FILESYSTEM_MODULAR_FILESYSTEM_H_
| |
Allow disable of save/restore object | #include <kotaka/privilege.h>
#include <kotaka/paths.h>
#include <kotaka/log.h>
#include <trace.h>
#include <type.h>
#include <status.h>
inherit "call_guard";
inherit "callout_guard";
inherit "touch";
inherit "object";
object canary;
/**********/
/* status */
/**********/
void set_canary(object new_canary)
{
ACCESS_CHECK(SYSTEM());
canary = new_canary;
}
object query_canary()
{
ACCESS_CHECK(SYSTEM());
return canary;
}
nomask void _F_dummy()
{
}
nomask mixed _F_status(mixed args ...)
{
ACCESS_CHECK(SYSTEM());
return status(this_object(), args ...);
}
| #include <kotaka/privilege.h>
#include <kotaka/paths.h>
#include <kotaka/log.h>
#include <trace.h>
#include <type.h>
#include <status.h>
inherit "call_guard";
inherit "callout_guard";
inherit "touch";
inherit "object";
object canary;
/**********/
/* status */
/**********/
void set_canary(object new_canary)
{
ACCESS_CHECK(SYSTEM());
canary = new_canary;
}
object query_canary()
{
ACCESS_CHECK(SYSTEM());
return canary;
}
nomask void _F_dummy()
{
}
nomask mixed _F_status(mixed args ...)
{
ACCESS_CHECK(SYSTEM());
return status(this_object(), args ...);
}
#if 0
nomask void save_object(string filename)
{
error("save_object is disabled");
}
nomask void restore_object(string filename)
{
error("restore_object is disabled");
}
#endif
|
Add a missing forward def of CheckerManager. NFC. | //==--- InterCheckerAPI.h ---------------------------------------*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// This file allows introduction of checker dependencies. It contains APIs for
// inter-checker communications.
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_INTERCHECKERAPI_H
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_INTERCHECKERAPI_H
namespace clang {
namespace ento {
/// Register the checker which evaluates CString API calls.
void registerCStringCheckerBasic(CheckerManager &Mgr);
}}
#endif /* INTERCHECKERAPI_H_ */
| //==--- InterCheckerAPI.h ---------------------------------------*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// This file allows introduction of checker dependencies. It contains APIs for
// inter-checker communications.
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_INTERCHECKERAPI_H
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_INTERCHECKERAPI_H
namespace clang {
class CheckerManager;
namespace ento {
/// Register the checker which evaluates CString API calls.
void registerCStringCheckerBasic(CheckerManager &Mgr);
}}
#endif /* INTERCHECKERAPI_H_ */
|
Fix the endianness of arch_spinlock_t | /*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License 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.
*
* 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 __ASM_SPINLOCK_TYPES_H
#define __ASM_SPINLOCK_TYPES_H
#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
# error "please don't include this file directly"
#endif
#define TICKET_SHIFT 16
typedef struct {
u16 owner;
u16 next;
} __aligned(4) arch_spinlock_t;
#define __ARCH_SPIN_LOCK_UNLOCKED { 0 , 0 }
typedef struct {
volatile unsigned int lock;
} arch_rwlock_t;
#define __ARCH_RW_LOCK_UNLOCKED { 0 }
#endif
| /*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License 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.
*
* 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 __ASM_SPINLOCK_TYPES_H
#define __ASM_SPINLOCK_TYPES_H
#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
# error "please don't include this file directly"
#endif
#define TICKET_SHIFT 16
typedef struct {
#ifdef __AARCH64EB__
u16 next;
u16 owner;
#else
u16 owner;
u16 next;
#endif
} __aligned(4) arch_spinlock_t;
#define __ARCH_SPIN_LOCK_UNLOCKED { 0 , 0 }
typedef struct {
volatile unsigned int lock;
} arch_rwlock_t;
#define __ARCH_RW_LOCK_UNLOCKED { 0 }
#endif
|
Use DeviceType enum for the type field. | #pragma once
#include <cstdint>
namespace ni {
struct InputPacket {
constexpr static int MAGIC = 0xD00D;
constexpr static int TYPE_LENGTH = 16;
constexpr static int DATA_LENGTH = 128;
uint16_t magic;
char type[TYPE_LENGTH];
uint16_t length;
uint8_t data[DATA_LENGTH];
bool isValid() const;
bool isSafe() const;
};
} | #pragma once
#include <cstdint>
#include "DeviceType.h"
namespace ni {
struct InputPacket {
constexpr static int MAGIC = 0xD00D;
constexpr static int DATA_LENGTH = 128;
uint16_t magic;
DeviceType type;
uint16_t length;
uint8_t data[DATA_LENGTH];
bool isValid() const;
bool isSafe() const;
};
} |
Set "flags" variable in constructor | //
// Created by dar on 2/13/16.
//
#ifndef C003_GUITEXT_H
#define C003_GUITEXT_H
#include "GuiElement.h"
#include <string>
class GuiText : public GuiElement {
public:
GuiText(const std::string &string, int x, int y, char position, float scale, int color, char flags) {
this->string = string;
this->rawX = x;
this->rawY = y;
this->positionFlag = position;
this->scale = scale;
this->recalculateSize();
}
const std::string &getString() const {
return string;
}
void updateString(const std::string &string) {
this->string = string;
this->recalculateSize();
}
float getScale() const {
return scale;
}
void setScale(float scale) {
GuiText::scale = scale;
}
int getColor() const {
return color;
}
void setColor(int color) {
GuiText::color = color;
}
char getFlags() const {
return flags;
}
void setFlags(char flags) {
GuiText::flags = flags;
}
private:
std::string string;
float scale;
int color;
char flags;
void recalculateSize() {
//TODO this->width = getStringWidth(string); this->height = ...
}
};
#endif //C003_GUITEXT_H
| //
// Created by dar on 2/13/16.
//
#ifndef C003_GUITEXT_H
#define C003_GUITEXT_H
#include "GuiElement.h"
#include <string>
class GuiText : public GuiElement {
public:
GuiText(const std::string &string, int x, int y, char position, float scale, int color, char flags) {
this->string = string;
this->rawX = x;
this->rawY = y;
this->positionFlag = position;
this->scale = scale;
this->flags = flags;
this->recalculateSize();
}
const std::string &getString() const {
return string;
}
void updateString(const std::string &string) {
this->string = string;
this->recalculateSize();
}
float getScale() const {
return scale;
}
void setScale(float scale) {
GuiText::scale = scale;
}
int getColor() const {
return color;
}
void setColor(int color) {
GuiText::color = color;
}
char getFlags() const {
return flags;
}
void setFlags(char flags) {
GuiText::flags = flags;
}
private:
std::string string;
float scale;
int color;
char flags;
void recalculateSize() {
//TODO this->width = getStringWidth(string); this->height = ...
}
};
#endif //C003_GUITEXT_H
|
Remove unused declarations from headers. | #include <libavutil/rational.h>
typedef struct {
char *fname;
int w, h, bitrate;
AVRational fps;
} output_params;
void lpms_init();
void lpms_deinit();
int lpms_rtmp2hls(char *listen, char *outf, char *ts_tmpl, char *seg_time, char *seg_start);
int lpms_transcode(char *inp, output_params *params, int nb_outputs);
int lpms_length(char *inp, int ts_max, int packet_max);
| #ifndef _LPMS_FFMPEG_H_
#define _LPMS_FFMPEG_H_
#include <libavutil/rational.h>
typedef struct {
char *fname;
int w, h, bitrate;
AVRational fps;
} output_params;
void lpms_init();
int lpms_rtmp2hls(char *listen, char *outf, char *ts_tmpl, char *seg_time, char *seg_start);
int lpms_transcode(char *inp, output_params *params, int nb_outputs);
#endif // _LPMS_FFMPEG_H_
|
Add a constructor taking an c error number. | //
// IOException.h
// pgf+
//
// Created by Emil Djupfeldt on 2012-06-22.
// Copyright (c) 2012 Chalmers University of Technology. All rights reserved.
//
#ifndef pgf__IOException_h
#define pgf__IOException_h
#include <gf/Exception.h>
namespace gf {
class IOException : public Exception {
private:
public:
IOException();
IOException(const std::string& message);
virtual ~IOException();
};
}
#endif
| //
// IOException.h
// pgf+
//
// Created by Emil Djupfeldt on 2012-06-22.
// Copyright (c) 2012 Chalmers University of Technology. All rights reserved.
//
#ifndef pgf__IOException_h
#define pgf__IOException_h
#include <gf/Exception.h>
namespace gf {
class IOException : public Exception {
private:
public:
IOException();
IOException(const std::string& message);
IOException(int err);
virtual ~IOException();
};
}
#endif
|
Increase libkcal version number, since we had bic changes since kde 3.3.... | /*
This file is part of libkcal.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_KCALVERSION_H
#define KCAL_KCALVERSION_H
#define LIBKCAL_IS_VERSION( a,b,c ) ( LIBKCAL_VERSION >= KDE_MAKE_VERSION(a,b,c) )
#define LIBKCAL_VERSION KDE_MAKE_VERSION(1,1,0)
#define LIBKCAL_VERSIONSTR "1.1"
#endif
| /*
This file is part of libkcal.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_KCALVERSION_H
#define KCAL_KCALVERSION_H
#define LIBKCAL_IS_VERSION( a,b,c ) ( LIBKCAL_VERSION >= KDE_MAKE_VERSION(a,b,c) )
#define LIBKCAL_VERSION KDE_MAKE_VERSION(1,2,0)
#define LIBKCAL_VERSIONSTR "1.2"
#endif
|
Correct mock -> fake in InlineExecutor documentation. Change: 163386931 | /* Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_SERVING_UTIL_INLINE_EXECUTOR_H_
#define TENSORFLOW_SERVING_UTIL_INLINE_EXECUTOR_H_
#include <functional>
#include "tensorflow/core/platform/macros.h"
#include "tensorflow_serving/util/executor.h"
namespace tensorflow {
namespace serving {
// An InlineExecutor is a trivial executor that immediately executes the closure
// given to it. It's useful as a mock, and in cases where an executor is needed,
// but multi-threadedness is not.
class InlineExecutor : public Executor {
public:
InlineExecutor();
~InlineExecutor() override;
void Schedule(std::function<void()> fn) override;
};
} // namespace serving
} // namespace tensorflow
#endif // TENSORFLOW_SERVING_UTIL_INLINE_EXECUTOR_H_
| /* Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_SERVING_UTIL_INLINE_EXECUTOR_H_
#define TENSORFLOW_SERVING_UTIL_INLINE_EXECUTOR_H_
#include <functional>
#include "tensorflow/core/platform/macros.h"
#include "tensorflow_serving/util/executor.h"
namespace tensorflow {
namespace serving {
// An InlineExecutor is a trivial executor that immediately executes the closure
// given to it. It's useful as a fake, and in cases where an executor is needed,
// but multi-threadedness is not.
class InlineExecutor : public Executor {
public:
InlineExecutor();
~InlineExecutor() override;
void Schedule(std::function<void()> fn) override;
};
} // namespace serving
} // namespace tensorflow
#endif // TENSORFLOW_SERVING_UTIL_INLINE_EXECUTOR_H_
|
Make use of test_bytes in the int encoder test. | #include <bert/encoder.h>
#include <bert/magic.h>
#include <bert/errno.h>
#include "test.h"
unsigned char output[6];
void test_output()
{
if (output[0] != BERT_MAGIC)
{
test_fail("bert_encoder_push did not add the magic byte");
}
if (output[1] != BERT_INT)
{
test_fail("bert_encoder_push did not add the INT magic byte");
}
unsigned int i;
for (i=2;i<6;i++)
{
if (output[i] != 0xff)
{
test_fail("output[%u] is 0x%x, expected 0x%x",output[i],0xff);
}
}
}
int main()
{
bert_encoder_t *encoder = test_encoder(output,6);
bert_data_t *data;
if (!(data = bert_data_create_int(0xffffffff)))
{
test_fail("malloc failed");
}
test_encoder_push(encoder,data);
bert_data_destroy(data);
bert_encoder_destroy(encoder);
test_output();
return 0;
}
| #include <bert/encoder.h>
#include <bert/magic.h>
#include <bert/errno.h>
#include "test.h"
unsigned char output[6];
void test_output()
{
if (output[0] != BERT_MAGIC)
{
test_fail("bert_encoder_push did not add the magic byte");
}
if (output[1] != BERT_INT)
{
test_fail("bert_encoder_push did not add the INT magic byte");
}
unsigned char bytes[] = {0xff, 0xff, 0xff, 0xff};
test_bytes(output+2,bytes,4);
}
int main()
{
bert_encoder_t *encoder = test_encoder(output,6);
bert_data_t *data;
if (!(data = bert_data_create_int(0xffffffff)))
{
test_fail("malloc failed");
}
test_encoder_push(encoder,data);
bert_data_destroy(data);
bert_encoder_destroy(encoder);
test_output();
return 0;
}
|
Add Linked List Insert at nth position | #include <stdio.h>
#include <stdlib.h>
/* Linked List Implementation in C */
// This program aims at "Inserting a node at the n-th position"
typedef struct node{
int data;
struct node *link;
} node;
node* head; //global variable
void insert_n(int x, int n){
node* temp;
temp = (node*)malloc(sizeof(node));
temp->data = x;
temp->link=NULL;
if(n == 1) { //if the node is to be inserted at the beginning
temp->link = head;
head = temp;
return;
}
//if not at begining then we need to traverse to the n-1 th node
node* temp_travel;
temp_travel = head; //start at head
int i;
for (i =1 ; i<n-1 ; i++){
temp_travel = temp_travel->link;
}
//copy the nth nodes link into temp new node's link
temp->link = temp_travel->link;
//after copy we can destroy this link in n-1 th node and make it point to the new node
temp_travel->link= temp;
return;
}
void print(){
node* temp = head;
printf("list is:");
while(temp->link != NULL){
printf(" %d",temp->data);
temp = temp->link;
}
printf("\n");
}
int main(){
head = NULL; //empty list
insert_n(2,1); //list is: 2
insert_n(3,2); //list is: 2 3
insert_n(3,2); //list is: 2 3
insert_n(4,1); //list is: 4 2 3
insert_n(5,2); //list is: 4 5 2 3
insert_n(6,4); //list is: 4 5 2 6 3
insert_n(7,6); //list is: 4 5 2 6 3 7
print();
return 0;
} | |
Make return type decl match hash_fn. | /* lookup-node.c -- hash */
#include <stdlib.h>
#include "datastruct/hash.h"
#include "impl.h"
hash_node_t **hash_lookup_node(hash_t *h, const void *key)
{
int hash;
hash_node_t **n;
hash = h->hash_fn(key) % h->nbins;
for (n = &h->bins[hash]; *n != NULL; n = &(*n)->next)
if (h->compare(key, (*n)->key) == 0)
break;
return n;
}
| /* lookup-node.c -- hash */
#include <stdlib.h>
#include "datastruct/hash.h"
#include "impl.h"
hash_node_t **hash_lookup_node(hash_t *h, const void *key)
{
unsigned int hash;
hash_node_t **n;
hash = h->hash_fn(key) % h->nbins;
for (n = &h->bins[hash]; *n != NULL; n = &(*n)->next)
if (h->compare(key, (*n)->key) == 0)
break;
return n;
}
|
Fix type for placement new on 32-bit Mac | //===-- sanitizer_placement_new.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is shared between AddressSanitizer and ThreadSanitizer
// run-time libraries.
//
// The file provides 'placement new'.
// Do not include it into header files, only into source files.
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_PLACEMENT_NEW_H
#define SANITIZER_PLACEMENT_NEW_H
#include "sanitizer_internal_defs.h"
#if __WORDSIZE == 64
inline void *operator new(__sanitizer::uptr sz, void *p) {
return p;
}
#else
inline void *operator new(__sanitizer::u32 sz, void *p) {
return p;
}
#endif
#endif // SANITIZER_PLACEMENT_NEW_H
| //===-- sanitizer_placement_new.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is shared between AddressSanitizer and ThreadSanitizer
// run-time libraries.
//
// The file provides 'placement new'.
// Do not include it into header files, only into source files.
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_PLACEMENT_NEW_H
#define SANITIZER_PLACEMENT_NEW_H
#include "sanitizer_internal_defs.h"
namespace __sanitizer {
#if (__WORDSIZE == 64) || defined(__APPLE__)
typedef __sanitizer::uptr operator_new_ptr_type;
#else
typedef __sanitizer::u32 operator_new_ptr_type;
#endif
} // namespace __sanitizer
inline void *operator new(operator_new_ptr_type sz, void *p) {
return p;
}
#endif // SANITIZER_PLACEMENT_NEW_H
|
Delete char_dev massive from header | /**
* @file
* @description char devices
*/
#ifndef __CHAR_DEVICE_H
#define __CHAR_DEVICE_H
typedef struct chardev {
int (*putc) (void);
int (*getc) (int);
} chardev_t;
#define MAX_COUNT_CHAR_DEVICES 10
static chardev_t pool_chardev[MAX_COUNT_CHAR_DEVICES];
static int chardev_c = 0;
#define ADD_CHAR_DEVICE(__NAME,__IN,__OUT) \
int __NAME=0;\
__NAME=chardev_c; \
pool_chardev[chardev_c++] = { \
.getc = __IN; \
.putc = __OUT;\
};
#endif /* __CHAR_DEVICE_H */
| /**
* @file
* @description char devices
*/
#ifndef __CHAR_DEVICE_H
#define __CHAR_DEVICE_H
typedef struct chardev {
int (*putc) (void);
int (*getc) (int);
} chardev_t;
#if 0
#define MAX_COUNT_CHAR_DEVICES 10
static chardev_t pool_chardev[MAX_COUNT_CHAR_DEVICES];
static int chardev_c = 0;
#define ADD_CHAR_DEVICE(__NAME,__IN,__OUT) \
int __NAME=0;\
__NAME=chardev_c; \
pool_chardev[chardev_c++] = { \
.getc = __IN; \
.putc = __OUT;\
};
#endif
#endif /* __CHAR_DEVICE_H */
|
Test case for Radar 8004649. | // RUN: %llvmgcc -S %s
// Test case by Eric Postpischil!
void foo(void)
{
char a[1];
int t = 1;
((char (*)[t]) a)[0][0] = 0;
}
| |
Store size of drawing area | #ifndef _FAKE_LOCK_SCREEN_PATTERN_H_
#define _FAKE_LOCK_SCREEN_PATTERN_H_
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION(3, 0, 0)
typedef struct {
gdouble red;
gdouble green;
gdouble blue;
gdouble alpha;
} GdkRGBA;
#endif
typedef struct _FakeLockOption {
void *module;
gchar *real;
gchar *dummy;
} FakeLockOption;
typedef struct {
gint mark;
gint value;
GdkPoint top_left;
GdkPoint bottom_right;
} FakeLockPatternPoint;
typedef enum {
FLSP_ONE_STROKE,
FLSP_ON_BOARD,
FLSP_N_PATTERN,
} FakeLockScreenPattern;
void flsp_draw_circle(cairo_t *context,
gint x, gint y, gint radius,
GdkRGBA circle, GdkRGBA border);
gboolean is_marked(gint x, gint y,
gint *marked, void *user_data);
#endif
| #ifndef _FAKE_LOCK_SCREEN_PATTERN_H_
#define _FAKE_LOCK_SCREEN_PATTERN_H_
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION(3, 0, 0)
typedef struct {
gdouble red;
gdouble green;
gdouble blue;
gdouble alpha;
} GdkRGBA;
#endif
typedef struct _FakeLockOption {
void *module;
gint width;
gint height;
gchar *real;
gchar *dummy;
} FakeLockOption;
typedef struct {
gint mark;
gint value;
GdkPoint top_left;
GdkPoint bottom_right;
} FakeLockPatternPoint;
typedef enum {
FLSP_ONE_STROKE,
FLSP_ON_BOARD,
FLSP_N_PATTERN,
} FakeLockScreenPattern;
void flsp_draw_circle(cairo_t *context,
gint x, gint y, gint radius,
GdkRGBA circle, GdkRGBA border);
gboolean is_marked(gint x, gint y,
gint *marked, void *user_data);
#endif
|
Include the correct files since math_lib.h no longer does that. | /**
* @file tree/bounds.h
*
* Bounds that are useful for binary space partitioning trees.
*
* TODO: Come up with a better design so you can do plug-and-play distance
* metrics.
*
* @experimental
*/
#ifndef TREE_BOUNDS_H
#define TREE_BOUNDS_H
#include <mlpack/core/math/math_lib.h>
#include <mlpack/core/kernels/lmetric.h>
#include "hrectbound.h"
#include "dhrectperiodicbound.h"
#include "dballbound.h"
#endif // TREE_BOUNDS_H
| /**
* @file tree/bounds.h
*
* Bounds that are useful for binary space partitioning trees.
*
* TODO: Come up with a better design so you can do plug-and-play distance
* metrics.
*
* @experimental
*/
#ifndef TREE_BOUNDS_H
#define TREE_BOUNDS_H
#include <mlpack/core/math/math_lib.h>
#include <mlpack/core/math/range.h>
#include <mlpack/core/math/kernel.h>
#include <mlpack/core/kernels/lmetric.h>
#include "hrectbound.h"
#include "dhrectperiodicbound.h"
#include "dballbound.h"
#endif // TREE_BOUNDS_H
|
Update to `UEX` prefix for unversioned C/C++ API | #include <stdint.h>
#include <jni.h>
#include <JavaScriptCore/JSContextRef.h>
#include "EXGL.h"
JNIEXPORT jint JNICALL
Java_host_exp_exponent_exgl_EXGL_EXGLContextCreate
(JNIEnv *env, jclass clazz, jlong jsCtxPtr) {
JSGlobalContextRef jsCtx = (JSGlobalContextRef) (intptr_t) jsCtxPtr;
if (jsCtx) {
return EXGLContextCreate(jsCtx);
}
return 0;
}
JNIEXPORT void JNICALL
Java_host_exp_exponent_exgl_EXGL_EXGLContextDestroy
(JNIEnv *env, jclass clazz, jint exglCtxId) {
EXGLContextDestroy(exglCtxId);
}
JNIEXPORT void JNICALL
Java_host_exp_exponent_exgl_EXGL_EXGLContextFlush
(JNIEnv *env, jclass clazz, jint exglCtxId) {
EXGLContextFlush(exglCtxId);
}
| #include <stdint.h>
#include <jni.h>
#include <JavaScriptCore/JSContextRef.h>
#include "EXGL.h"
JNIEXPORT jint JNICALL
Java_host_exp_exponent_exgl_EXGL_EXGLContextCreate
(JNIEnv *env, jclass clazz, jlong jsCtxPtr) {
JSGlobalContextRef jsCtx = (JSGlobalContextRef) (intptr_t) jsCtxPtr;
if (jsCtx) {
return UEXGLContextCreate(jsCtx);
}
return 0;
}
JNIEXPORT void JNICALL
Java_host_exp_exponent_exgl_EXGL_EXGLContextDestroy
(JNIEnv *env, jclass clazz, jint exglCtxId) {
UEXGLContextDestroy(exglCtxId);
}
JNIEXPORT void JNICALL
Java_host_exp_exponent_exgl_EXGL_EXGLContextFlush
(JNIEnv *env, jclass clazz, jint exglCtxId) {
UEXGLContextFlush(exglCtxId);
}
|
Make it a no-op for UNW_LOCAL_ONLY. | /* libunwind - a platform-independent unwind library
Copyright (C) 2002 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
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 "unwind_i.h"
void
unw_destroy_addr_space (unw_addr_space_t as)
{
#ifndef UNW_LOCAL_ONLY
# ifdef UNW_DEBUG
memset (as, 0, sizeof (*as));
# endif
free (as);
#endif
}
| |
Adjust code to be more reliable. | /*
* This program tests if a new thread's initial tls data
* is clean.
*
* David Xu <davidxu@freebsd.org>
*
* $FreeBSD$
*/
#include <stdio.h>
#include <pthread.h>
int __thread n;
void *f1(void *arg)
{
n = 1;
return (0);
}
void *f2(void *arg)
{
if (n != 0) {
printf("bug, n == %d \n", n);
exit(1);
}
return (0);
}
int main()
{
pthread_t td;
int i;
pthread_create(&td, NULL, f1, NULL);
pthread_join(td, NULL);
for (i = 0; i < 1000; ++i) {
pthread_create(&td, NULL, f2, NULL);
pthread_yield();
pthread_join(td, NULL);
}
return (0);
}
| /*
* This program tests if a new thread's initial tls data
* is clean.
*
* David Xu <davidxu@freebsd.org>
*
* $FreeBSD$
*/
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
int __thread n;
void *f1(void *arg)
{
if (n != 0) {
printf("bug, n == %d \n", n);
exit(1);
}
n = 1;
return (0);
}
int main()
{
pthread_t td;
int i;
for (i = 0; i < 1000; ++i) {
pthread_create(&td, NULL, f1, NULL);
pthread_join(td, NULL);
}
sleep(2);
for (i = 0; i < 1000; ++i) {
pthread_create(&td, NULL, f1, NULL);
pthread_join(td, NULL);
}
return (0);
}
|
Define minimal struct dev_archdata, similarly to sparc64. | /*
* Arch specific extensions to struct device
*
* This file is released under the GPLv2
*/
#include <asm-generic/device.h>
| /*
* Arch specific extensions to struct device
*
* This file is released under the GPLv2
*/
#ifndef _ASM_SPARC_DEVICE_H
#define _ASM_SPARC_DEVICE_H
struct device_node;
struct of_device;
struct dev_archdata {
struct device_node *prom_node;
struct of_device *op;
};
#endif /* _ASM_SPARC_DEVICE_H */
|
Add autocomplete and preview to 'Go To Address' dialog | #pragma once
#include <QtWidgets/QDialog>
#include <QtWidgets/QLabel>
#include <QtCore/QStringListModel>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtCore/QTimer>
#include <QtCore/QThread>
#include "binaryninjaapi.h"
#include "uitypes.h"
class BINARYNINJAUIAPI GetSymbolsListThread: public QThread
{
Q_OBJECT
QStringList m_allSymbols;
std::function<void()> m_completeFunc;
std::mutex m_mutex;
bool m_done;
BinaryViewRef m_view;
protected:
virtual void run() override;
public:
GetSymbolsListThread(BinaryViewRef view, const std::function<void()>& completeFunc);
void cancel();
const QStringList& getSymbols() const { return m_allSymbols; }
};
class BINARYNINJAUIAPI AddressDialogWithPreview: public QDialog
{
Q_OBJECT
QComboBox* m_combo;
QStringListModel* m_model;
QLabel* m_previewText;
BinaryViewRef m_view;
uint64_t m_addr;
uint64_t m_here;
QCheckBox* m_checkBox;
bool m_resultValid;
QTimer* m_updateTimer;
QStringList m_historyEntries;
int m_historySize;
GetSymbolsListThread* m_updateThread;
QColor m_defaultColor;
QFont m_defaultFont;
QString m_prompt;
void commitHistory();
void customEvent(QEvent* event);
private Q_SLOTS:
void updateTimerEvent();
void accepted();
void updateRelativeState(int state);
void updatePreview(QString text);
public:
AddressDialogWithPreview(QWidget* parent, BinaryViewRef view, uint64_t here,
const QString& title = "Go to Address", const QString& prompt = "Enter Expression");
~AddressDialogWithPreview() { delete m_updateThread; }
uint64_t getOffset() const { return m_addr; }
};
| |
Revert "gvalue: Use g_value_clear as clear function" | /*
* Copyright © 2015 Canonical Limited
*
* 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 of the licence, 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/>.
*
* Author: Ryan Lortie <desrt@desrt.ca>
*/
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_clear)
| /*
* Copyright © 2015 Canonical Limited
*
* 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 of the licence, 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/>.
*
* Author: Ryan Lortie <desrt@desrt.ca>
*/
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)
|
Add notification message, bearing some abstract integer. | //
// Copyright (C) 2007 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MprnIntMsg_h_
#define _MprnIntMsg_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsMsg.h"
#include "utl/UtlString.h"
#include "MpResNotificationMsg.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
/// Message notification object used to send an abstract integer.
class MprnIntMsg : public MpResNotificationMsg
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Constructor
MprnIntMsg(MpResNotificationMsg::RNMsgType msgType,
const UtlString& namedResOriginator,
int value,
MpConnectionID connId = MP_INVALID_CONNECTION_ID,
int streamId = -1);
/// Copy constructor
MprnIntMsg(const MprnIntMsg& rMsg);
/// Create a copy of this msg object (which may be of a derived type)
virtual OsMsg* createCopy() const;
/// Destructor
virtual ~MprnIntMsg();
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Assignment operator
MprnIntMsg& operator=(const MprnIntMsg& rhs);
/// Set the value this notification reports.
void setValue(int value);
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Get the value this notification reports.
int getValue() const;
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
int mValue; ///< Reported value.
};
/* ============================ INLINE METHODS ============================ */
#endif // _MprnIntMsg_h_
| |
Add a max routing time estimate (in clock ticks) |
#ifndef __DIJKSTRA_H__
#define __DIJKSTRA_H__
#include <track_node.h>
int dijkstra(const track_node* const track,
const track_node* const start,
const track_node* const end,
path_node* const path);
#endif
|
#ifndef __DIJKSTRA_H__
#define __DIJKSTRA_H__
#include <track_node.h>
#define MAX_ROUTING_TIME_ESTIMATE 5
int dijkstra(const track_node* const track,
const track_node* const start,
const track_node* const end,
path_node* const path);
#endif
|
Change the way execution results are collected. | #pragma once
#include <libevm/VMFace.h>
#include <evmjit/libevmjit/ExecutionEngine.h>
namespace dev
{
namespace eth
{
class JitVM: public VMFace
{
public:
virtual bytesConstRef execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) override final;
private:
jit::RuntimeData m_data;
jit::ExecutionEngine m_engine;
std::unique_ptr<VMFace> m_fallbackVM; ///< VM used in case of input data rejected by JIT
};
}
}
| #pragma once
#include <libevm/VMFace.h>
#include <evmjit/libevmjit/ExecutionEngine.h>
namespace dev
{
namespace eth
{
class JitVM: public VMFace
{
public:
virtual bytesConstRef execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) override final;
private:
jit::RuntimeData m_data;
jit::ExecutionEngine m_engine;
std::unique_ptr<VMFace> m_fallbackVM; ///< VM used in case of input data rejected by JIT
};
}
}
|
Revert 64847 - Clang fix. | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#define CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#pragma once
#include <string>
#include "base/ref_counted.h"
class Extension;
namespace base {
class Time;
}
namespace webkit_glue {
struct WebApplicationInfo;
}
// Generates a version number for an extension from a time. The goal is to make
// use of the version number to communicate some useful information. The
// returned version has the format:
// <year>.<month><day>.<upper 16 bits of unix timestamp>.<lower 16 bits>
std::string ConvertTimeToExtensionVersion(const base::Time& time);
// Wraps the specified web app in an extension. The extension is created
// unpacked in the system temp dir. Returns a valid extension that the caller
// should take ownership on success, or NULL and |error| on failure.
//
// NOTE: This function does file IO and should not be called on the UI thread.
// NOTE: The caller takes ownership of the directory at extension->path() on the
// returned object.
scoped_refptr<Extension> ConvertWebAppToExtension(
const webkit_glue::WebApplicationInfo& web_app_info,
const base::Time& create_time);
#endif // CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
| // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#define CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#pragma once
#include <string>
#include "base/ref_counted.h"
class Extension;
namespace base {
class Time;
}
namespace webkit_glue {
class WebApplicationInfo;
}
// Generates a version number for an extension from a time. The goal is to make
// use of the version number to communicate some useful information. The
// returned version has the format:
// <year>.<month><day>.<upper 16 bits of unix timestamp>.<lower 16 bits>
std::string ConvertTimeToExtensionVersion(const base::Time& time);
// Wraps the specified web app in an extension. The extension is created
// unpacked in the system temp dir. Returns a valid extension that the caller
// should take ownership on success, or NULL and |error| on failure.
//
// NOTE: This function does file IO and should not be called on the UI thread.
// NOTE: The caller takes ownership of the directory at extension->path() on the
// returned object.
scoped_refptr<Extension> ConvertWebAppToExtension(
const webkit_glue::WebApplicationInfo& web_app_info,
const base::Time& create_time);
#endif // CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
|
Make powerpc compile. Needs this header... | /* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _SYS_MSG_H
# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
#endif
#include <bits/types.h>
/* Define options for message queue functions. */
#define MSG_NOERROR 010000 /* no error if message is too big */
#ifdef __USE_GNU
# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
#endif
/* Types used in the structure definition. */
typedef unsigned long int msgqnum_t;
typedef unsigned long int msglen_t;
/* Structure of record for one message inside the kernel.
The type `struct msg' is opaque. */
struct msqid_ds
{
struct ipc_perm msg_perm; /* structure describing operation permission */
unsigned int __unused1;
__time_t msg_stime; /* time of last msgsnd command */
unsigned int __unused2;
__time_t msg_rtime; /* time of last msgrcv command */
unsigned int __unused3;
__time_t msg_ctime; /* time of last change */
unsigned long __msg_cbytes; /* current number of bytes on queue */
msgqnum_t msg_qnum; /* number of messages currently on queue */
msglen_t msg_qbytes; /* max number of bytes allowed on queue */
__pid_t msg_lspid; /* pid of last msgsnd() */
__pid_t msg_lrpid; /* pid of last msgrcv() */
unsigned long __unused4;
unsigned long __unused5;
};
#ifdef __USE_MISC
# define msg_cbytes __msg_cbytes
/* ipcs ctl commands */
# define MSG_STAT 11
# define MSG_INFO 12
/* buffer for msgctl calls IPC_INFO, MSG_INFO */
struct msginfo
{
int msgpool;
int msgmap;
int msgmax;
int msgmnb;
int msgmni;
int msgssz;
int msgtql;
unsigned short int msgseg;
};
#endif /* __USE_MISC */
| |
Fix name of C syslog function. | /* syslog_c.c -- call syslog for Go.
Copyright 2011 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
#include <syslog.h>
/* We need to use a C function to call the syslog function, because we
can't represent a C varargs function in Go. */
void syslog_c(int, const char*)
asm ("libgo_syslog.syslog.syslog_c");
void
syslog_c (int priority, const char *msg)
{
syslog (priority, "%s", msg);
}
| /* syslog_c.c -- call syslog for Go.
Copyright 2011 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
#include <syslog.h>
/* We need to use a C function to call the syslog function, because we
can't represent a C varargs function in Go. */
void syslog_c(int, const char*)
asm ("libgo_log.syslog.syslog_c");
void
syslog_c (int priority, const char *msg)
{
syslog (priority, "%s", msg);
}
|
Fix newline at end of file issue. | /** @file
Platform specific Debug Agent abstraction for timer used by the agent.
The timer is used by the debugger to break into a running program.
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
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.
**/
#ifndef __GDB_TIMER_LIB__
#define __GDB_TIMER_LIB__
/**
Setup all the hardware needed for the debug agents timer.
This function is used to set up debug enviroment. It may enable interrupts.
**/
VOID
EFIAPI
DebugAgentTimerIntialize (
VOID
);
/**
Set the period for the debug agent timer. Zero means disable the timer.
@param[in] TimerPeriodMilliseconds Frequency of the debug agent timer.
**/
VOID
EFIAPI
DebugAgentTimerSetPeriod (
IN UINT32 TimerPeriodMilliseconds
);
/**
Perform End Of Interrupt for the debug agent timer. This is called in the
interrupt handler after the interrupt has been processed.
**/
VOID
EFIAPI
DebugAgentTimerEndOfInterrupt (
VOID
);
#endif
| /** @file
Platform specific Debug Agent abstraction for timer used by the agent.
The timer is used by the debugger to break into a running program.
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
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.
**/
#ifndef __GDB_TIMER_LIB__
#define __GDB_TIMER_LIB__
/**
Setup all the hardware needed for the debug agents timer.
This function is used to set up debug enviroment. It may enable interrupts.
**/
VOID
EFIAPI
DebugAgentTimerIntialize (
VOID
);
/**
Set the period for the debug agent timer. Zero means disable the timer.
@param[in] TimerPeriodMilliseconds Frequency of the debug agent timer.
**/
VOID
EFIAPI
DebugAgentTimerSetPeriod (
IN UINT32 TimerPeriodMilliseconds
);
/**
Perform End Of Interrupt for the debug agent timer. This is called in the
interrupt handler after the interrupt has been processed.
**/
VOID
EFIAPI
DebugAgentTimerEndOfInterrupt (
VOID
);
#endif
|
Clean up 7: Split function parameter list to multiple lines. | #ifndef RPLNN_RASTERIZER_H
#define RPLNN_RASTERIZER_H
/* Currently wants the points in pixel coordinates, (0, 0) at screen center increasing towards top-right. Tri wanted as CCW
* Depth buffer stores the depth in the first 24bits and the rest 8 are reserved for future use (stencil). */
void rasterizer_rasterize(uint32_t *render_target, uint32_t *depth_buf, const struct vec2_int *target_size, const struct vec4_float *vert_buf, const struct vec2_float *uv_buf, const unsigned int *ind_buf, const unsigned int index_count, uint32_t *texture, struct vec2_int *texture_size);
void rasterizer_clear_depth_buffer(uint32_t *depth_buf, const struct vec2_int *buf_size);
#endif /* RPLNN_RASTERIZER_H */
| #ifndef RPLNN_RASTERIZER_H
#define RPLNN_RASTERIZER_H
/* Currently wants the points in pixel coordinates, (0, 0) at screen center increasing towards top-right. Tri wanted as CCW
* Depth buffer stores the depth in the first 24bits and the rest 8 are reserved for future use (stencil). */
void rasterizer_rasterize(uint32_t *render_target, uint32_t *depth_buf, const struct vec2_int *target_size,
const struct vec4_float *vert_buf, const struct vec2_float *uv_buf, const unsigned int *ind_buf, const unsigned int index_count,
uint32_t *texture, struct vec2_int *texture_size);
void rasterizer_clear_depth_buffer(uint32_t *depth_buf, const struct vec2_int *buf_size);
#endif /* RPLNN_RASTERIZER_H */
|
Create slave coils module header file | #include "../modlib.h"
#include "../parser.h"
#include "stypes.h"
#include "scoils.h"
//Use external slave configuration
extern MODBUSSlaveStatus MODBUSSlave;
| |
Undo commenting out of __goblint_check | // PARAM: --enable sem.unknown_function.spawn
#include <goblint.h>
#include <stddef.h>
int magic(void* (f (void *)));
void *t_fun(void *arg) {
// __goblint_check(1); // reachable
return NULL;
}
int main() {
magic(t_fun); // unknown function
return 0;
}
| // PARAM: --enable sem.unknown_function.spawn
#include <goblint.h>
#include <stddef.h>
int magic(void* (f (void *)));
void *t_fun(void *arg) {
__goblint_check(1); // reachable
return NULL;
}
int main() {
magic(t_fun); // unknown function
return 0;
}
|
Add a test case for code-completion in the presence of tabs | // Test code-completion in the presence of tabs
struct Point { int x, y; };
void f(struct Point *p) {
p->
// RUN: c-index-test -code-completion-at=%s:5:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText x}
// CHECK-CC1: {TypedText y}
| |
Add header for parameters and tweakables | /*
* libreset - Reentrent set library for fast set operations in C
*
* Copyright (C) 2014 Matthias Beyer
* Copyright (C) 2014 Julian Ganz
*
* This file is part of libreset.
*
* libreset 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.
*
* libreset 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 libreset. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @addtogroup internal_parameters
*
* This group contains parameters and tweakables for the data structures.
*
* @{
*/
#ifndef __PARAMS_H__
#define __PARAMS_H__
/**
* Number of variants to derive from a hash function
*
* When generating a bloom filter for a single element from a hash, some
* transformatoin will be applied to generate multiple variants of the hash.
* This way, only one hash is neccessary to use bloom filters.
*/
#define HASH_VARIANTS (3)
/**
* @}
*/
#endif
| |
Use autoconf answers from config.h (FIXME, should autoconf this file directly instead). | //===-- Support/ThreadSupport.h - Generic threading support -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines platform-agnostic interfaces that can be used to write
// multi-threaded programs. Autoconf is used to chose the correct
// implementation of these interfaces, or default to a non-thread-capable system
// if no matching system support is available.
//
//===----------------------------------------------------------------------===//
#ifndef SUPPORT_THREADSUPPORT_H
#define SUPPORT_THREADSUPPORT_H
// FIXME: We need autoconf support to detect pthreads!
#if 0
#include "Support/ThreadSupport-PThreads.h"
#else
#include "Support/ThreadSupport-NoSupport.h"
#endif // If no system support is available
namespace llvm {
/// MutexLocker - Instances of this class acquire a given Lock when
/// constructed and hold that lock until destruction.
///
class MutexLocker {
Mutex &M;
MutexLocker(const LockHolder &); // DO NOT IMPLEMENT
void operator=(const MutexLocker&); // DO NOT IMPLEMENT
public:
MutexLocker(Mutex &m) : M(m) { M.acquire(); }
~MutexLocker() { M.release(); }
};
}
#endif // SUPPORT_THREADSUPPORT_H
| //===-- Support/ThreadSupport.h - Generic threading support -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines platform-agnostic interfaces that can be used to write
// multi-threaded programs. Autoconf is used to chose the correct
// implementation of these interfaces, or default to a non-thread-capable system
// if no matching system support is available.
//
//===----------------------------------------------------------------------===//
#ifndef SUPPORT_THREADSUPPORT_H
#define SUPPORT_THREADSUPPORT_H
// FIXME: Eventually don't #include config.h here
#include "Config/config.h"
#if defined(HAVE_PTHREAD_MUTEX_LOCK) && HAVE_PTHREAD_MUTEX_LOCK
#include "Support/ThreadSupport-PThreads.h"
#else
#include "Support/ThreadSupport-NoSupport.h"
#endif // If no system support is available
namespace llvm {
/// MutexLocker - Instances of this class acquire a given Lock when
/// constructed and hold that lock until destruction.
///
class MutexLocker {
Mutex &M;
MutexLocker(const MutexLocker &); // DO NOT IMPLEMENT
void operator=(const MutexLocker &); // DO NOT IMPLEMENT
public:
MutexLocker(Mutex &m) : M(m) { M.acquire(); }
~MutexLocker() { M.release(); }
};
}
#endif // SUPPORT_THREADSUPPORT_H
|
Enhance -fsyntax-only test of Carbon.h to also include testing for PTH. | // RUN: clang %s -fsyntax-only -print-stats
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#endif
| // RUN: clang %s -fsyntax-only -print-stats &&
// RUN: clang -x c-header -o %t %s && clang -token-cache %t %s
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#endif
|
Add memset, needed by compiler for initializing structs and such | /*
* Copyright 2015 Wink Saville
*
* 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 <ac_stop.h>
#include <ac_printf.h>
/**
* Set memory to the given byte value
*
* @param s points to the array
* @param val is a byte used to fill the array
* @param count is an integer the size of a pointer
*
* @return = s
*/
void* ac_memset(void *s, ac_u8 val, ac_uptr count) {
// TODO: Optimize
ac_u8* pU8 = s;
for(ac_uptr i = 0; i < count; i++) {
*pU8++ = val;
}
return s;
}
| /*
* Copyright 2015 Wink Saville
*
* 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 <ac_stop.h>
#include <ac_printf.h>
/**
* Set memory to the given byte value
*
* @param s points to the array
* @param val is a byte used to fill the array
* @param count is an integer the size of a pointer
*
* @return = s
*/
void* ac_memset(void *s, ac_u8 val, ac_uptr count) {
// TODO: Optimize
ac_u8* pU8 = s;
for(ac_uptr i = 0; i < count; i++) {
*pU8++ = val;
}
return s;
}
/**
* Set memory, compiler needs this for initializing structs and such.
*/
void* memset(void *s, int val, ac_size_t count) {
return ac_memset(s, val, count);
}
|
Set the height of the HUD to 90. | //
// ISHAppDelegate.h
// isHUD
//
// Created by ghawkgu on 11/15/11.
// Copyright (c) 2011 ghawkgu. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#define HUD_FADE_IN_DURATION (0.25)
#define HUD_FADE_OUT_DURATION (0.5)
#define HUD_DISPLAY_DURATION (2.0)
#define HUD_ALPHA_VALUE (0.6)
#define HUD_CORNER_RADIUS (18.0)
#define HUD_HORIZONTAL_MARGIN (30)
#define HUD_HEIGHT (100)
#define MENUITEM_TAG_TOGGLE_LOGIN_ITEM 1
#define STATUS_MENU_ICON @"icon-18x18.png"
@interface ISHAppDelegate : NSObject <NSApplicationDelegate> {
@private
BOOL fadingOut;
}
@property (unsafe_unretained) IBOutlet NSWindow *window;
@property (unsafe_unretained) IBOutlet NSTextField *isName;
@property (unsafe_unretained) IBOutlet NSMenu *statusMenu;
@property (unsafe_unretained) IBOutlet NSView *panelView;
@property (unsafe_unretained) IBOutlet NSImageView *isImage;
@property (strong) NSStatusItem * myStatusMenu;
- (IBAction)quit:(id)sender;
- (IBAction)toggleLoginItem:(id)sender;
@end
| //
// ISHAppDelegate.h
// isHUD
//
// Created by ghawkgu on 11/15/11.
// Copyright (c) 2011 ghawkgu. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#define HUD_FADE_IN_DURATION (0.25)
#define HUD_FADE_OUT_DURATION (0.5)
#define HUD_DISPLAY_DURATION (2.0)
#define HUD_ALPHA_VALUE (0.6)
#define HUD_CORNER_RADIUS (18.0)
#define HUD_HORIZONTAL_MARGIN (30)
#define HUD_HEIGHT (90)
#define MENUITEM_TAG_TOGGLE_LOGIN_ITEM 1
#define STATUS_MENU_ICON @"icon-18x18.png"
@interface ISHAppDelegate : NSObject <NSApplicationDelegate> {
@private
BOOL fadingOut;
}
@property (unsafe_unretained) IBOutlet NSWindow *window;
@property (unsafe_unretained) IBOutlet NSTextField *isName;
@property (unsafe_unretained) IBOutlet NSMenu *statusMenu;
@property (unsafe_unretained) IBOutlet NSView *panelView;
@property (unsafe_unretained) IBOutlet NSImageView *isImage;
@property (strong) NSStatusItem * myStatusMenu;
- (IBAction)quit:(id)sender;
- (IBAction)toggleLoginItem:(id)sender;
@end
|
Remove unneeded method override declaration from Freedom to Move | #ifndef FREEDOM_TO_MOVE_GENE_H
#define FREEDOM_TO_MOVE_GENE_H
#include <fstream>
#include "Gene.h"
// Total number of legal moves
class Freedom_To_Move_Gene : public Gene
{
public:
Freedom_To_Move_Gene();
explicit Freedom_To_Move_Gene(std::ifstream& ifs);
~Freedom_To_Move_Gene() override;
Freedom_To_Move_Gene* duplicate() const override;
std::string name() const override;
private:
size_t maximum_number_of_moves;
double score_board(const Board& board, Color perspective) const override;
};
#endif // FREEDOM_TO_MOVE_GENE_H
| #ifndef FREEDOM_TO_MOVE_GENE_H
#define FREEDOM_TO_MOVE_GENE_H
#include <fstream>
#include "Gene.h"
// Total number of legal moves
class Freedom_To_Move_Gene : public Gene
{
public:
Freedom_To_Move_Gene();
~Freedom_To_Move_Gene() override;
Freedom_To_Move_Gene* duplicate() const override;
std::string name() const override;
private:
size_t maximum_number_of_moves;
double score_board(const Board& board, Color perspective) const override;
};
#endif // FREEDOM_TO_MOVE_GENE_H
|
Adjust GPIO settings and add some test code | #include <stm32f4xx.h>
#include <stm32f4xx_gpio.h>
void init_GPIO()
{
GPIO_InitTypeDef GPIO_InitStruct = {
.GPIO_Pin = GPIO_Pin_15,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_OType =GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
};
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_Init(GPIOD, &GPIO_InitStruct);
}
int main()
{
init_GPIO();
return 0;
}
| #include <stm32f4xx.h>
#include <stm32f4xx_gpio.h>
void init_GPIO()
{
GPIO_InitTypeDef GPIO_InitStruct = {
.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_OType =GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_DOWN
};
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_Init(GPIOD, &GPIO_InitStruct);
}
int main()
{
init_GPIO();
GPIO_SetBits(GPIOD, GPIO_Pin_12);
return 0;
}
|
Change default region back to US | // project-specific definitions for otaa sensor
//#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au921 1
//#define CFG_as923 1
#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
| // project-specific definitions for otaa sensor
//#define CFG_eu868 1
#define CFG_us915 1
//#define CFG_au921 1
//#define CFG_as923 1
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
|
Build delegate change so reporting back updates shows correctly | /* Definition of protocol GSXCBuildDelegate
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento
Date: 25-01-2022
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#ifndef _GSXCBuildDelegate_h_INCLUDE
#define _GSXCBuildDelegate_h_INCLUDE
#import <Foundation/NSObject.h>
#if defined(__cplusplus)
extern "C" {
#endif
@protocol GSXCBuildDelegate
@optional
- (void) project: (PBXProject *)project publishMessage: (NSString *)message;
@end
#if defined(__cplusplus)
}
#endif
#endif /* _GSXCBuildDelegate_h_INCLUDE */
| /* Definition of protocol GSXCBuildDelegate
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento
Date: 25-01-2022
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#ifndef _GSXCBuildDelegate_h_INCLUDE
#define _GSXCBuildDelegate_h_INCLUDE
#import <Foundation/NSObject.h>
#import "PBXProject.h"
#if defined(__cplusplus)
extern "C" {
#endif
@protocol GSXCBuildDelegate
@optional
- (void) project: (PBXProject *)project publishMessage: (NSString *)message;
@end
#if defined(__cplusplus)
}
#endif
#endif /* _GSXCBuildDelegate_h_INCLUDE */
|
Add properties to HTML Range interface | //
// HTMLRange.h
// HTMLKit
//
// Created by Iska on 20/11/16.
// Copyright © 2016 BrainCookie. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface HTMLRange : NSObject
@end
| //
// HTMLRange.h
// HTMLKit
//
// Created by Iska on 20/11/16.
// Copyright © 2016 BrainCookie. All rights reserved.
//
#import "HTMLNode.h"
/**
A HTML Range, represents a sequence of content within a node tree.
Each range has a start and an end which are boundary points.
A boundary point is a tuple consisting of a node and a non-negative numeric offset.
https://dom.spec.whatwg.org/#ranges
*/
@interface HTMLRange : NSObject
/**
The node of the start boundary point.
*/
@property (nonatomic, readonly, strong) HTMLNode *startContainer;
/**
The offset of the start boundary point.
*/
@property (nonatomic, readonly, assign) NSUInteger startOffset;
/**
The node of the end boundary point.
*/
@property (nonatomic, readonly, strong) HTMLNode *endContainer;
/**
The offset of the end boundary point.
*/
@property (nonatomic, readonly, assign) NSUInteger endOffset;
/**
Checks whether the range is collapsed, i.e. if start is the same as end.
@return `YES` if the range is collapsed, `NO` otherwise.
*/
@property (nonatomic, readonly, assign, getter=isCollapsed) BOOL collapsed;
/**
The common container node that contains both start and end nodes.
*/
@property (nonatomic, readonly, weak) HTMLNode *commonAncestorContainer;
@end
|
Add skipped base AD.meet unsoundness test | // SKIP
// TODO: be sound and claim that assert may hold instead of must not hold
// assert passes when compiled
#include <assert.h>
struct s {
int fst;
};
int main() {
struct s a;
void *p = &a.fst;
void *q = ((int(*)[1]) (&a))[0];
assert(p == q);
return 0;
}
| |
Remove orphaned notifyUnlock friend function | #pragma once
#include "sqlite3.h"
#include "Common.h"
namespace SQLite3 {
class Statement {
friend void notifyUnlock(void* args[], int nArgs);
public:
static StatementPtr Prepare(sqlite3* sqlite, Platform::String^ sql);
~Statement();
void Bind(const SafeParameterVector& params);
void Bind(ParameterMap^ params);
void Run();
Platform::String^ One();
Platform::String^ All();
void Each(EachCallback^ callback, Windows::UI::Core::CoreDispatcher^ dispatcher);
bool ReadOnly() const;
private:
Statement(sqlite3_stmt* statement);
void BindParameter(int index, Platform::Object^ value);
int BindParameterCount();
std::wstring BindParameterName(int index);
int BindText(int index, Platform::String^ val);
int BindInt(int index, int64 val);
int BindDouble(int index, double val);
int BindNull(int index);
int Step();
void GetRow(std::wostringstream& row);
Platform::Object^ GetColumn(int index);
int ColumnCount();
int ColumnType(int index);
Platform::String^ ColumnName(int index);
Platform::String^ ColumnText(int index);
int64 ColumnInt(int index);
double ColumnDouble(int index);
private:
HANDLE dbLockMutex;
sqlite3_stmt* statement;
};
}
| #pragma once
#include "sqlite3.h"
#include "Common.h"
namespace SQLite3 {
class Statement {
public:
static StatementPtr Prepare(sqlite3* sqlite, Platform::String^ sql);
~Statement();
void Bind(const SafeParameterVector& params);
void Bind(ParameterMap^ params);
void Run();
Platform::String^ One();
Platform::String^ All();
void Each(EachCallback^ callback, Windows::UI::Core::CoreDispatcher^ dispatcher);
bool ReadOnly() const;
private:
Statement(sqlite3_stmt* statement);
void BindParameter(int index, Platform::Object^ value);
int BindParameterCount();
std::wstring BindParameterName(int index);
int BindText(int index, Platform::String^ val);
int BindInt(int index, int64 val);
int BindDouble(int index, double val);
int BindNull(int index);
int Step();
void GetRow(std::wostringstream& row);
Platform::Object^ GetColumn(int index);
int ColumnCount();
int ColumnType(int index);
Platform::String^ ColumnName(int index);
Platform::String^ ColumnText(int index);
int64 ColumnInt(int index);
double ColumnDouble(int index);
private:
HANDLE dbLockMutex;
sqlite3_stmt* statement;
};
}
|
Put dummy BOT_ASSERT in case of non-Windows build | #pragma once
#include <cstdio>
#include <cstdarg>
#include <sstream>
#include <stdarg.h>
#include <ctime>
#include <iomanip>
#define BOT_BREAK __debugbreak();
#if true
#define BOT_ASSERT(cond, msg, ...) \
do \
{ \
if (!(cond)) \
{ \
Assert::ReportFailure(#cond, __FILE__, __LINE__, (msg), ##__VA_ARGS__); \
BOT_BREAK \
} \
} while(0)
#else
#define BOT_ASSERT(cond, msg, ...)
#endif
namespace Assert
{
extern std::string lastErrorMessage;
const std::string CurrentDateTime();
void ReportFailure(const char * condition, const char * file, int line, const char * msg, ...);
}
| #pragma once
#include <cstdio>
#include <cstdarg>
#include <sstream>
#include <stdarg.h>
#include <ctime>
#include <iomanip>
#ifdef WIN32
#define BOT_BREAK __debugbreak();
#else
#define BOT_BREAK ;
#endif
#if true
#define BOT_ASSERT(cond, msg, ...) \
do \
{ \
if (!(cond)) \
{ \
Assert::ReportFailure(#cond, __FILE__, __LINE__, (msg), ##__VA_ARGS__); \
BOT_BREAK \
} \
} while(0)
#else
#define BOT_ASSERT(cond, msg, ...)
#endif
namespace Assert
{
extern std::string lastErrorMessage;
const std::string CurrentDateTime();
void ReportFailure(const char * condition, const char * file, int line, const char * msg, ...);
}
|
Test normal (backend-)allocas inside VLA scope | // RUN: %ocheck 0 %s
void abort(void);
g()
{
return 0;
}
main()
{
int n = 5; // an unaligned value
int vla[n];
vla[0] = 1;
vla[1] = 2;
vla[2] = 3;
vla[3] = 4;
{
// this alloca is done in order after the vla,
// but is coalesced to before the VLA by the stack logic
int x = 99;
if(x != 99) abort();
if(g())
return 3; // scope-leave/restore vla, but doesn't pop the vla state
int y = 35;
if(y != 35) abort();
// more scope leave code
for(int i = 0; i < 10; i++)
if(i == 5)
break;
if(vla[0] != 1) abort();
if(vla[1] != 2) abort();
if(vla[2] != 3) abort();
if(vla[3] != 4) abort();
if(sizeof vla != n * sizeof(int))
abort();
if(y != 35) abort();
if(x != 99) abort();
}
if(vla[0] != 1) abort();
if(vla[1] != 2) abort();
if(vla[2] != 3) abort();
if(vla[3] != 4) abort();
if(sizeof vla != n * sizeof(int))
abort();
return 0;
}
| |
Update header for use from C++ | #ifndef IPSS_BENCH_H
#define IPSS_BENCH_H
extern void start_ipss_measurement();
extern void stop_ipss_measurement();
#endif
| #ifndef IPSS_BENCH_H
#define IPSS_BENCH_H
#ifdef __cplusplus
extern "C"
{
#endif
void start_ipss_measurement();
void stop_ipss_measurement();
#ifdef __cplusplus
}
#endif
#endif
|
Add basic test for pointers | /*
name: TEST016
description: Basic pointer test
output:
test016.c:43: error: redefinition of 'func2'
test016.c:47: error: incompatible types when assigning
G1 I g
F1
G2 F1 func1
{
-
A2 I x
A4 P p
G1 #I1 :I
A2 #I1 :I
A4 A2 'P :P
A4 @I #I0 :I
j L5 A2 #I0 =I
yI #I1
L5
A4 G1 'P :P
A4 @I #I0 :I
j L6 A4 #I0 IP !I
yI #I1
L6
yI #I0
}
G3 F1 func2
{
-
A1 I x
A2 P p
A4 P pp
A1 #I1 :I
A2 A1 'P :P
A4 A2 'P :P
j L5 A2 #I0 IP =I
A4 @P @I #I0 :I
L5
A2 #I0 IP :P
yI A1
}
????
*/
#line 1
int g;
int
func1(void)
{
int x;
int *p;
g = 1;
x = 1;
p = &x;
*p = 0;
if (x)
return 1;
p = &g;
*p = 0;
if (p == 0)
return 1;
return 0;
}
int
func2(void)
{
int x;
int *p;
int **pp;
x = 1;
p = &x;
pp = &p;
if (p != 0)
**pp = 0;
p = 0;
return x;
}
int
func2(void)
{
char c;
int *p;
p = &c;
return *p;
}
| |
Add RocksDB comparator import to the main public header | //
// ObjectiveRocks.h
// ObjectiveRocks
//
// Created by Iska on 20/11/14.
// Copyright (c) 2014 BrainCookie. All rights reserved.
//
#import "RocksDB.h"
#import "RocksDBOptions.h"
#import "RocksDBReadOptions.h"
#import "RocksDBWriteOptions.h"
#import "RocksDBWriteBatch.h"
#import "RocksDBIterator.h"
#import "RocksDBSnapshot.h"
| //
// ObjectiveRocks.h
// ObjectiveRocks
//
// Created by Iska on 20/11/14.
// Copyright (c) 2014 BrainCookie. All rights reserved.
//
#import "RocksDB.h"
#import "RocksDBOptions.h"
#import "RocksDBReadOptions.h"
#import "RocksDBWriteOptions.h"
#import "RocksDBWriteBatch.h"
#import "RocksDBIterator.h"
#import "RocksDBSnapshot.h"
#import "RocksDBComparator.h"
|
Fix extensions flags bit collision. | #include <stdlib.h>
#include <stdio.h>
#include <glib.h>
enum markdown_extensions {
EXT_SMART = 1,
EXT_NOTES = 2,
EXT_FILTER_HTML = 3,
EXT_FILTER_STYLES = 4
};
enum markdown_formats {
HTML_FORMAT,
LATEX_FORMAT,
GROFF_MM_FORMAT
};
GString * markdown_to_g_string(char *text, int extensions, int output_format);
char * markdown_to_string(char *text, int extensions, int output_format);
/* vim: set ts=4 sw=4 : */
| #include <stdlib.h>
#include <stdio.h>
#include <glib.h>
enum markdown_extensions {
EXT_SMART = 0x01,
EXT_NOTES = 0x02,
EXT_FILTER_HTML = 0x04,
EXT_FILTER_STYLES = 0x08
};
enum markdown_formats {
HTML_FORMAT,
LATEX_FORMAT,
GROFF_MM_FORMAT
};
GString * markdown_to_g_string(char *text, int extensions, int output_format);
char * markdown_to_string(char *text, int extensions, int output_format);
/* vim: set ts=4 sw=4 : */
|
Add new U param to ScopedValue<T, U> | // LAF Base Library
// Copyright (c) 2014-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef BASE_SCOPED_VALUE_H_INCLUDED
#define BASE_SCOPED_VALUE_H_INCLUDED
#pragma once
namespace base {
template<typename T>
class ScopedValue {
public:
ScopedValue(T& instance, const T& inScopeValue, const T& outScopeValue)
: m_instance(instance)
, m_outScopeValue(outScopeValue) {
m_instance = inScopeValue;
}
~ScopedValue() {
m_instance = m_outScopeValue;
}
private:
T& m_instance;
T m_outScopeValue;
};
} // namespace base
#endif
| // LAF Base Library
// Copyright (c) 2022 Igara Studio S.A.
// Copyright (c) 2014-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef BASE_SCOPED_VALUE_H_INCLUDED
#define BASE_SCOPED_VALUE_H_INCLUDED
#pragma once
namespace base {
template<typename T,
typename U = T>
class ScopedValue {
public:
ScopedValue(T& instance, const U& inScopeValue, const U& outScopeValue)
: m_instance(instance)
, m_outScopeValue(outScopeValue) {
m_instance = inScopeValue;
}
~ScopedValue() {
m_instance = m_outScopeValue;
}
private:
T& m_instance;
U m_outScopeValue;
};
} // namespace base
#endif
|
Add params name in put_audio_samples_rx pointer function definition. | #ifndef __AUDIO_RX_H__
#define __AUDIO_RX_H__
#include <stdint.h>
typedef void (*put_audio_samples_rx)(uint8_t*, int, int);
int start_audio_rx(const char* sdp, int maxDelay, put_audio_samples_rx callback);
int stop_audio_rx();
#endif /* __AUDIO_RX_H__ */
| #ifndef __AUDIO_RX_H__
#define __AUDIO_RX_H__
#include <stdint.h>
typedef void (*put_audio_samples_rx)(uint8_t *samples, int size, int nframe);
int start_audio_rx(const char* sdp, int maxDelay, put_audio_samples_rx callback);
int stop_audio_rx();
#endif /* __AUDIO_RX_H__ */
|
Add missing TClass creation for vector<Long64_t> and vector<ULong64_t> | #include <string>
#include <vector>
#ifndef __hpux
using namespace std;
#endif
#pragma create TClass vector<bool>;
#pragma create TClass vector<char>;
#pragma create TClass vector<short>;
#pragma create TClass vector<long>;
#pragma create TClass vector<unsigned char>;
#pragma create TClass vector<unsigned short>;
#pragma create TClass vector<unsigned int>;
#pragma create TClass vector<unsigned long>;
#pragma create TClass vector<float>;
#pragma create TClass vector<double>;
#pragma create TClass vector<char*>;
#pragma create TClass vector<const char*>;
#pragma create TClass vector<string>;
#if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300)
// gcc3.1,3.2 has a problem with iterator<void*,...,void&>
#pragma create TClass vector<void*>;
#endif
| #include <string>
#include <vector>
#ifndef __hpux
using namespace std;
#endif
#pragma create TClass vector<bool>;
#pragma create TClass vector<char>;
#pragma create TClass vector<short>;
#pragma create TClass vector<long>;
#pragma create TClass vector<unsigned char>;
#pragma create TClass vector<unsigned short>;
#pragma create TClass vector<unsigned int>;
#pragma create TClass vector<unsigned long>;
#pragma create TClass vector<float>;
#pragma create TClass vector<double>;
#pragma create TClass vector<char*>;
#pragma create TClass vector<const char*>;
#pragma create TClass vector<string>;
#pragma create TClass vector<Long64_t>;
#pragma create TClass vector<ULong64_t>;
#if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300)
// gcc3.1,3.2 has a problem with iterator<void*,...,void&>
#pragma create TClass vector<void*>;
#endif
|
Fix unit test compilation error | /* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Mock PWM control module for Chrome EC */
#include "pwm.h"
#include "timer.h"
#include "uart.h"
static int fan_target_rpm;
static int kblight;
int pwm_set_fan_target_rpm(int rpm)
{
uart_printf("Fan RPM: %d\n", rpm);
fan_target_rpm = rpm;
return EC_SUCCESS;
}
int pwm_get_fan_target_rpm(void)
{
return fan_target_rpm;
}
int pwm_set_keyboard_backlight(int percent)
{
uart_printf("KBLight: %d\n", percent);
kblight = percent;
return EC_SUCCESS;
}
int pwm_get_keyboard_backlight(void)
{
return kblight;
}
int pwm_get_keyboard_backlight_enabled(void)
{
/* Always enabled */
return 1;
}
int pwm_enable_keyboard_backlight(int enable)
{
/* Not implemented */
return EC_SUCCESS;
}
void pwm_task(void)
{
/* Do nothing */
while (1)
usleep(5000000);
}
| /* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Mock PWM control module for Chrome EC */
#include "pwm.h"
#include "timer.h"
#include "uart.h"
static int fan_target_rpm;
static int kblight;
int pwm_set_fan_target_rpm(int rpm)
{
uart_printf("Fan RPM: %d\n", rpm);
fan_target_rpm = rpm;
return EC_SUCCESS;
}
int pwm_get_fan_target_rpm(void)
{
return fan_target_rpm;
}
int pwm_set_keyboard_backlight(int percent)
{
uart_printf("KBLight: %d\n", percent);
kblight = percent;
return EC_SUCCESS;
}
int pwm_get_keyboard_backlight(void)
{
return kblight;
}
int pwm_get_keyboard_backlight_enabled(void)
{
/* Always enabled */
return 1;
}
int pwm_enable_keyboard_backlight(int enable)
{
/* Not implemented */
return EC_SUCCESS;
}
int pwm_set_fan_duty(int percent)
{
/* Not implemented */
return EC_SUCCESS;
}
void pwm_task(void)
{
/* Do nothing */
while (1)
usleep(5000000);
}
|
Add a bunch of rmc tests that we brutally miscompile because llvm optimizes everything away. | #include "rmc.h"
// HMMMMM. All of these get optimized away and shouldn't.
// Also, if r doesn't get used usefully, that load gets optimized away.
// I can't decide whether that is totally fucked or not.
int global_p, global_q;
int bogus_ctrl_dep1() {
XEDGE(read, write);
L(read, int r = global_p);
if (r == r) {
L(write, global_q = 1);
}
return r;
}
// Do basically the same thing in each branch
int bogus_ctrl_dep2() {
XEDGE(read, write);
L(read, int r = global_p);
if (r) {
L(write, global_q = 1);
} else {
L(write, global_q = 1);
}
return r;
}
// Have a bogus ctrl dep
int bogus_ctrl_dep3() {
XEDGE(read, write);
L(read, int r = global_p);
if (r) {};
L(write, global_q = 1);
return r;
}
| |
Add missing forward class declaration to ThingsHubConfiguration | //
// CDZThingsHubConfiguration.h
// thingshub
//
// Created by Chris Dzombak on 1/13/14.
// Copyright (c) 2014 Chris Dzombak. All rights reserved.
//
@interface CDZThingsHubConfiguration : NSObject
/**
Asynchronously returns the app's current `CZDThingsHubConfiguration` as the next value in the signal, then completes.
Walks from ~ down to the current directory, merging in .thingshubconfig files as they are found.
Command-line parameters override any parameters set in the merged config file.
If there's a validation error, the signal will complete with an error.
*/
+ (RACSignal *)currentConfiguration;
/// Global (typically); configured by "tagNamespace = ". Default is "github".
@property (nonatomic, copy, readonly) NSString *tagNamespace;
/// Global (typically); configured by "reviewTag = ". Default is "review".
@property (nonatomic, copy, readonly) NSString *reviewTagName;
/// Global (typically); configured by "githubLogin = "
@property (nonatomic, copy, readonly) NSString *githubLogin;
/// Per-project (typically); configured by "githubOrg = "
@property (nonatomic, copy, readonly) NSString *githubOrgName;
/// Per-project; configured by "githubRepo = "
@property (nonatomic, copy, readonly) NSString *githubRepoName;
/// Per-project; configured by "thingsArea = ". May be missing; default is nil.
@property (nonatomic, copy, readonly) NSString *thingsAreaName;
@end
| //
// CDZThingsHubConfiguration.h
// thingshub
//
// Created by Chris Dzombak on 1/13/14.
// Copyright (c) 2014 Chris Dzombak. All rights reserved.
//
@class RACSignal;
@interface CDZThingsHubConfiguration : NSObject
/**
Asynchronously returns the app's current `CZDThingsHubConfiguration` as the next value in the signal, then completes.
Walks from ~ down to the current directory, merging in .thingshubconfig files as they are found.
Command-line parameters override any parameters set in the merged config file.
If there's a validation error, the signal will complete with an error.
*/
+ (RACSignal *)currentConfiguration;
/// Global (typically); configured by "tagNamespace = ". Default is "github".
@property (nonatomic, copy, readonly) NSString *tagNamespace;
/// Global (typically); configured by "reviewTag = ". Default is "review".
@property (nonatomic, copy, readonly) NSString *reviewTagName;
/// Global (typically); configured by "githubLogin = "
@property (nonatomic, copy, readonly) NSString *githubLogin;
/// Per-project (typically); configured by "githubOrg = "
@property (nonatomic, copy, readonly) NSString *githubOrgName;
/// Per-project; configured by "githubRepo = "
@property (nonatomic, copy, readonly) NSString *githubRepoName;
/// Per-project; configured by "thingsArea = ". May be missing; default is nil.
@property (nonatomic, copy, readonly) NSString *thingsAreaName;
@end
|
Test taking address of C array | #include <stdio.h>
int my_array[] = {1,2,3,4,5,6};
void f()
{
printf("called f\n");
}
void (*f_pointer())(void)
{
return &f;
}
int hundredth(int a[])
{
return a[100];
}
int head(int a[])
{
return a[0];
}
int (*f2())(int*)
{
return &head;
}
int previous(int a[])
{
return a[-1];
}
int main(void)
{
int one = head(my_array);
int prev = previous(&my_array[1]);
int two = f2()(my_array);
f();
f_pointer()();
printf("Head of array => %d\n", one);
printf("Head of array => %d\n", prev);
printf("Head of array => %d\n", two);
return 0;
}
| #include <stdio.h>
int my_array[] = {1,2,3,4,5,6};
void f()
{
printf("called f\n");
}
void (*f_pointer())(void)
{
return &f;
}
int hundredth(int a[])
{
return a[100];
}
int head(int a[])
{
return a[0];
}
int (*f2())(int*)
{
return &head;
}
int previous(int a[])
{
return a[-1];
}
int main(void)
{
int one = head(my_array);
int prev = previous(&my_array[1]);
int two = f2()(my_array);
f();
f_pointer()();
printf("Head of array => %d\n", one);
printf("Head of array => %d\n", prev);
printf("Head of array => %d\n", two);
return 0;
}
|
Change the PRIMITIV_ERROR value from 1 to -1 so that MSB can imply errors. | /* Copyright 2017 The primitiv Authors. All Rights Reserved. */
#ifndef PRIMITIV_C_STATUS_H_
#define PRIMITIV_C_STATUS_H_
#include <primitiv/c/define.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum primitiv_Status {
PRIMITIV_OK = 0,
PRIMITIV_ERROR = 1,
} primitiv_Status;
extern PRIMITIV_C_API const char *primitiv_Status_get_message();
extern PRIMITIV_C_API void primitiv_Status_reset();
#ifdef __cplusplus
} // end extern "C"
#endif
#endif // PRIMITIV_C_STATUS_H_
| /* Copyright 2017 The primitiv Authors. All Rights Reserved. */
#ifndef PRIMITIV_C_STATUS_H_
#define PRIMITIV_C_STATUS_H_
#include <primitiv/c/define.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum primitiv_Status {
PRIMITIV_OK = 0,
PRIMITIV_ERROR = -1,
} primitiv_Status;
extern PRIMITIV_C_API const char *primitiv_Status_get_message();
extern PRIMITIV_C_API void primitiv_Status_reset();
#ifdef __cplusplus
} // end extern "C"
#endif
#endif // PRIMITIV_C_STATUS_H_
|
Update the include of string16.h to point to its new location. | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_EXAMPLES_MULTILINE_EXAMPLE_H_
#define UI_VIEWS_EXAMPLES_MULTILINE_EXAMPLE_H_
#include "base/compiler_specific.h"
#include "base/string16.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/examples/example_base.h"
namespace views {
class Label;
namespace examples {
// An example that compares the multi-line rendering of different controls.
class MultilineExample : public ExampleBase,
public TextfieldController {
public:
MultilineExample();
virtual ~MultilineExample();
// ExampleBase:
virtual void CreateExampleView(View* container) OVERRIDE;
private:
class RenderTextView;
// TextfieldController:
virtual void ContentsChanged(Textfield* sender,
const string16& new_contents) OVERRIDE;
virtual bool HandleKeyEvent(Textfield* sender,
const ui::KeyEvent& key_event) OVERRIDE;
RenderTextView* render_text_view_;
Label* label_;
Textfield* textfield_;
DISALLOW_COPY_AND_ASSIGN(MultilineExample);
};
} // namespace examples
} // namespace views
#endif // UI_VIEWS_EXAMPLES_MULTILINE_EXAMPLE_H_
| // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_EXAMPLES_MULTILINE_EXAMPLE_H_
#define UI_VIEWS_EXAMPLES_MULTILINE_EXAMPLE_H_
#include "base/compiler_specific.h"
#include "base/strings/string16.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/examples/example_base.h"
namespace views {
class Label;
namespace examples {
// An example that compares the multi-line rendering of different controls.
class MultilineExample : public ExampleBase,
public TextfieldController {
public:
MultilineExample();
virtual ~MultilineExample();
// ExampleBase:
virtual void CreateExampleView(View* container) OVERRIDE;
private:
class RenderTextView;
// TextfieldController:
virtual void ContentsChanged(Textfield* sender,
const string16& new_contents) OVERRIDE;
virtual bool HandleKeyEvent(Textfield* sender,
const ui::KeyEvent& key_event) OVERRIDE;
RenderTextView* render_text_view_;
Label* label_;
Textfield* textfield_;
DISALLOW_COPY_AND_ASSIGN(MultilineExample);
};
} // namespace examples
} // namespace views
#endif // UI_VIEWS_EXAMPLES_MULTILINE_EXAMPLE_H_
|
Use RARRAY_LEN and RARRAY_PTR on ruby 1.9 | #include <ruby.h>
static ID id_cmp;
static VALUE rb_array_binary_index(VALUE self, VALUE value) {
int lower = 0;
int upper = RARRAY(self)->len - 1;
int i, comp;
while(lower <= upper) {
i = lower + (upper - lower) / 2;
comp = FIX2INT(rb_funcall(value, id_cmp, 1, RARRAY(self)->ptr[i]));
if(comp == 0) {
return LONG2NUM(i);
} else if(comp == 1) {
lower = i + 1;
} else {
upper = i - 1;
};
}
return Qnil;
}
void Init_binary_search() {
id_cmp = rb_intern("<=>");
rb_define_method(rb_cArray, "binary_index", rb_array_binary_index, 1);
}
| #include <ruby.h>
#ifndef RARRAY_PTR
#define RARRAY_PTR(ary) RARRAY(ary)->ptr
#endif
#ifndef RARRAY_LEN
#define RARRAY_LEN(ary) RARRAY(ary)->len
#endif
static ID id_cmp;
static VALUE rb_array_binary_index(VALUE self, VALUE value) {
int lower = 0;
int upper = RARRAY_LEN(self) - 1;
int i, comp;
while(lower <= upper) {
i = lower + (upper - lower) / 2;
comp = FIX2INT(rb_funcall(value, id_cmp, 1, RARRAY_PTR(self)[i]));
if(comp == 0) {
return LONG2NUM(i);
} else if(comp == 1) {
lower = i + 1;
} else {
upper = i - 1;
};
}
return Qnil;
}
void Init_binary_search() {
id_cmp = rb_intern("<=>");
rb_define_method(rb_cArray, "binary_index", rb_array_binary_index, 1);
}
|
Fix pointer without cast issue. | #include <windows.h>
#include <stdio.h>
#include <tchar.h>
//
// RelativeLink.c
// by Jacob Appelbaum <jacob@appelbaum.net>
//
// This is a very small program to work around the lack of relative links
// in any of the most recent builds of Windows.
//
// To build this, you need Cygwin or MSYS.
//
// You need to build the icon resource first:
// windres RelativeLink-res.rc RelativeLink-res.o
//
// Then you'll compile the program and include the icon object file:
// gcc -mwindows -o StartTorBrowserBundle RelativeLink.c RelativeLink-res.o
//
// End users will be able to use StartTorBrowserBundle.exe
//
//int _tmain( int argc, TCHAR *argv[])
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory ( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory ( &pi, sizeof(pi) );
TCHAR *ProgramToStart;
ProgramToStart = TEXT ("App/vidalia.exe --datadir .\\Data\\Vidalia\\");
if( !CreateProcess(
NULL, ProgramToStart, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
{
MessageBox ( NULL, TEXT ("Unable to start Vidalia"), NULL, NULL );
return -1;
}
return 0;
}
| #include <windows.h>
#include <stdio.h>
#include <tchar.h>
//
// RelativeLink.c
// by Jacob Appelbaum <jacob@appelbaum.net>
//
// This is a very small program to work around the lack of relative links
// in any of the most recent builds of Windows.
//
// To build this, you need Cygwin or MSYS.
//
// You need to build the icon resource first:
// windres RelativeLink-res.rc RelativeLink-res.o
//
// Then you'll compile the program and include the icon object file:
// gcc -mwindows -o StartTorBrowserBundle RelativeLink.c RelativeLink-res.o
//
// End users will be able to use StartTorBrowserBundle.exe
//
//int _tmain( int argc, TCHAR *argv[])
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory ( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory ( &pi, sizeof(pi) );
TCHAR *ProgramToStart;
ProgramToStart = TEXT ("App/vidalia.exe --datadir .\\Data\\Vidalia\\");
if( !CreateProcess(
NULL, ProgramToStart, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
{
MessageBox ( NULL, TEXT ("Unable to start Vidalia"), NULL, MB_OK);
return -1;
}
return 0;
}
|
Test that mmap()ing a region twice does not fail. | #include <stdlib.h> /* malloc(), free() */
#include <sys/mman.h> /* mmap(), munmap() */
#include <stdio.h> /* perror() */
#include <assert.h>
int main(int argc, char **argv)
{
void *addr, *addr2;
size_t size = 16 * 1024;
addr = mmap((void*) 0, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, (off_t) 0);
assert(addr != MAP_FAILED);
/* Assert: memory mapped twice does not error. */
addr2 = mmap(addr + (size / 2), size / 2, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, (off_t) 0);
assert(addr2 != MAP_FAILED);
return 0;
}
| |
Move IDPViewControllerViewOfClassGetterSynthesize to CommonKit -> IDPPropertyMacros.h | //
// UIViewController+IDPExtensions.h
// ClipIt
//
// Created by Vadim Lavrov Viktorovich on 2/20/13.
// Copyright (c) 2013 IDAP Group. All rights reserved.
//
#import <UIKit/UIKit.h>
#define IDPViewControllerViewOfClassGetterSynthesize(theClass, getterName) \
- (theClass *)getterName { \
if ([self.view isKindOfClass:[theClass class]]) { \
return (theClass *)self.view; \
} \
return nil; \
}
@interface UIViewController (IDPExtensions)
@property (nonatomic, retain, readonly) UITableView *tableView;
@end
| //
// UIViewController+IDPExtensions.h
// ClipIt
//
// Created by Vadim Lavrov Viktorovich on 2/20/13.
// Copyright (c) 2013 IDAP Group. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIViewController (IDPExtensions)
@property (nonatomic, retain, readonly) UITableView *tableView;
@end
|
Redefine version macro to avoid gcc 4.5 features not supported by CIL | #define KBUILD_MODNAME "SomeModule"
#define CONFIG_DEBUG_SPINLOCK 1 | #define KBUILD_MODNAME "SomeModule"
#define CONFIG_DEBUG_SPINLOCK 1
#undef __GNUC_MINOR__
#define __GNUC_MINOR__ 4
|
Revert "[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`." | // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
// XFAIL: -linux-
// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64
typedef int a;
| // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
// XFAIL: -linux-
// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
typedef int a;
|
Add an OS mutex to Halide runtime. | #ifndef HALIDE_RUNTIME_MUTEX_H
#define HALIDE_RUNTIME_MUTEX_H
#include "HalideRuntime.h"
// Avoid ODR violations
namespace {
// An RAII mutex
struct ScopedMutexLock {
halide_mutex *mutex;
ScopedMutexLock(halide_mutex *mutex) : mutex(mutex) {
halide_mutex_lock(mutex);
}
~ScopedMutexLock() {
halide_mutex_unlock(mutex);
}
};
}
#endif
| |
Add srate field to InputDesc. | /* To avoid recursion in certain includes */
#ifndef _RTDEFS_H_
#define _RTDEFS_H_ 1
#define MAXCHANS 4
#define MAX_INPUT_FDS 128
#define AUDIO_DEVICE 9999999
/* definition of input file desc struct used by rtinput */
typedef struct inputdesc {
char filename[1024];
int fd;
int refcount;
#ifdef USE_SNDLIB
short header_type; /* e.g., AIFF_sound_file (in sndlib.h) */
short data_format; /* e.g., snd_16_linear (in sndlib.h) */
short chans;
#else
#ifdef sgi
void *handle;
#endif
#endif
int data_location; /* offset of sound data start in file */
float dur;
} InputDesc;
/* for insts - so they don't have to include globals.h */
extern int MAXBUF;
extern int NCHANS;
extern int RTBUFSAMPS;
extern float SR;
#endif /* _RTDEFS_H_ */
| /* To avoid recursion in certain includes */
#ifndef _RTDEFS_H_
#define _RTDEFS_H_ 1
#define MAXCHANS 4
#define MAX_INPUT_FDS 128
#define AUDIO_DEVICE 9999999
/* definition of input file desc struct used by rtinput */
typedef struct inputdesc {
char filename[1024];
int fd;
int refcount;
#ifdef USE_SNDLIB
short header_type; /* e.g., AIFF_sound_file (in sndlib.h) */
short data_format; /* e.g., snd_16_linear (in sndlib.h) */
short chans;
float srate;
#else
#ifdef sgi
void *handle;
#endif
#endif
int data_location; /* offset of sound data start in file */
float dur;
} InputDesc;
/* for insts - so they don't have to include globals.h */
extern int MAXBUF;
extern int NCHANS;
extern int RTBUFSAMPS;
extern float SR;
#endif /* _RTDEFS_H_ */
|
Change perf. test to reasonable number | #include <stdlib.h>
#include <stdio.h>
#include "bomalloc.h"
#include "dummy.h"
#define NUM_ROUNDS 500000
size_t class_for_rnd(int rnd) {
return ALIGN(CLASS_TO_SIZE(rnd % NUM_CLASSES) - sizeof(block_t));
}
typedef struct {
int * space;
size_t size;
} record_t;
int main() {
int rnd;
size_t alloc_size;
srand(0);
for (rnd = 0; rnd < NUM_ROUNDS; rnd++) {
alloc_size = class_for_rnd(rnd);
bomalloc_malloc(alloc_size);
}
printf("Performance test complete\n");
print_bomalloc_stats();
}
| #include <stdlib.h>
#include <stdio.h>
#include "bomalloc.h"
#include "dummy.h"
#define NUM_ROUNDS 500
size_t class_for_rnd(int rnd) {
return ALIGN(CLASS_TO_SIZE(rnd % NUM_CLASSES) - sizeof(block_t));
}
typedef struct {
int * space;
size_t size;
} record_t;
int main() {
int rnd;
size_t alloc_size;
srand(0);
for (rnd = 0; rnd < NUM_ROUNDS; rnd++) {
alloc_size = class_for_rnd(rnd);
bomalloc_malloc(alloc_size);
}
printf("Performance test complete\n");
print_bomalloc_stats();
}
|
Delete copy and move constructor | /*
* ostream_log_strategy.h
*
* Author: Ming Tsang
* Copyright (c) 2014 Ming Tsang
* Refer to LICENSE for details
*/
#pragma once
#include <ostream>
#include "libutils/io/log_strategy.h"
namespace utils
{
namespace io
{
template<typename CharT_>
class OstreamLogStrategy : public LogStrategy<CharT_>
{
public:
void Flush()
{
GetStream().flush();
}
protected:
explicit OstreamLogStrategy(std::basic_ostream<CharT_> *stream)
: OstreamLogStrategy(stream, true)
{}
OstreamLogStrategy(std::basic_ostream<CharT_> *stream, const bool is_owner);
virtual ~OstreamLogStrategy();
std::basic_ostream<CharT_>& GetStream()
{
return *m_stream;
}
private:
std::basic_ostream<CharT_> *m_stream;
bool m_is_owner;
};
}
}
#include "ostream_log_strategy.tcc"
| /*
* ostream_log_strategy.h
*
* Author: Ming Tsang
* Copyright (c) 2014 Ming Tsang
* Refer to LICENSE for details
*/
#pragma once
#include <ostream>
#include "libutils/io/log_strategy.h"
namespace utils
{
namespace io
{
template<typename CharT_>
class OstreamLogStrategy : public LogStrategy<CharT_>
{
public:
void Flush()
{
GetStream().flush();
}
protected:
explicit OstreamLogStrategy(std::basic_ostream<CharT_> *stream)
: OstreamLogStrategy(stream, true)
{}
OstreamLogStrategy(std::basic_ostream<CharT_> *stream, const bool is_owner);
OstreamLogStrategy(const OstreamLogStrategy&) = delete;
OstreamLogStrategy(OstreamLogStrategy&&) = delete;
virtual ~OstreamLogStrategy();
std::basic_ostream<CharT_>& GetStream()
{
return *m_stream;
}
private:
std::basic_ostream<CharT_> *m_stream;
bool m_is_owner;
};
}
}
#include "ostream_log_strategy.tcc"
|
Add option to read from stdin | #include "config_parse.h"
#include <stdio.h>
#include <stdlib.h>
extern char **environ;
/******************************************************************************/
int main(
int argc,
char *argv[]
)
{
FILE * conf_fd;
config_parse_res_t res;
if(argc != 2)
{
printf("usage: config_parse file\n");
return EXIT_FAILURE;
}
conf_fd = fopen(argv[1], "r");
if(NULL != conf_fd)
{
res = config_parse(conf_fd, 1);
if(CONFIG_PARSE_OK == res)
{
char **env;
for (env = environ; *env; ++env)
printf("%s\n", *env);
}
else
{
printf("Error no. %d while processing file \n", res);
}
fclose(conf_fd);
}
else
{
printf("Could not open the specified file.\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
} | #include "config_parse.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char **environ;
/******************************************************************************/
int main(
int argc,
char *argv[]
)
{
FILE * conf_fd;
config_parse_res_t res;
if(argc != 2)
{
printf("usage: config_parse file ('-' for stdin)\n");
return EXIT_FAILURE;
}
if(0 == strcmp("-", argv[1]))
{
conf_fd = stdin;
}
else
{
conf_fd = fopen(argv[1], "r");
}
if(NULL != conf_fd)
{
res = config_parse(conf_fd, 1);
if(CONFIG_PARSE_OK == res)
{
char **env;
for (env = environ; *env; ++env)
printf("%s\n", *env);
}
else
{
printf("Error no. %d while processing file \n", res);
}
fclose(conf_fd);
}
else
{
printf("Could not open the specified file.\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
|
Add initial C interface with support for Douglas-Peucker | /* 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/. */
/*
psimpl-c
Copyright (c) 2013 Jamie Bullock <jamie@jamiebullock.com>
Based on psimpl
Copyright (c) 2010-2011 Elmar de Koning <edekoning@gmail.com>
*/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
double *psimpl_simplify_douglas_peucker(
uint8_t dimensions,
double tolerance,
double *original_points,
double *simplified_points
);
#ifdef __cplusplus
}
#endif | |
Add in comments the files that uses this header | /* OCaml promise library
* http://www.ocsigen.org/lwt
* Copyright (C) 2009-2010 Jérémie Dimino
* 2009 Mauricio Fernandez
* 2010 Pierre Chambart
*
* This program 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, with linking exceptions;
* either version 2.1 of the License, or (at your option) any later
* version. See COPYING file for details.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#pragma once
#include "lwt_config.h"
#if !defined(LWT_ON_WINDOWS)
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
int socket_domain(int fd);
#endif
| /* OCaml promise library
* http://www.ocsigen.org/lwt
* Copyright (C) 2009-2010 Jérémie Dimino
* 2009 Mauricio Fernandez
* 2010 Pierre Chambart
*
* This program 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, with linking exceptions;
* either version 2.1 of the License, or (at your option) any later
* version. See COPYING file for details.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#pragma once
#include "lwt_config.h"
/*
* Included in:
* - unix_mcast_modify_membership.c
* - unix_mcast_set_loop.c
* - unix_mcast_set_ttl.c
* - unix_mcast_utils.c
*/
#if !defined(LWT_ON_WINDOWS)
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
int socket_domain(int fd);
#endif
|
Add comment remarks to CDT & ADT | #include <stdio.h>
#include <stdlib.h>
#include "utility.h"
/*
* MAW 3.25.a Write the routines to implement queues using: Linked Lists
*
* We use a header node at the very beginning of the linked list.
*
* Front: | header node | -> | data node | -> | data node | :Rear
*/
#ifndef _QUEUE_H
#define _QUEUE_H
typedef int ET;
struct QueueRecord;
struct QueueCDT;
typedef struct QueueRecord* PtrToNode;
typedef struct QueueCDT* QueueADT; // naming convention: https://www.cs.bu.edu/teaching/c/queue/linked-list/types.html
int isEmpty(QueueADT Q);
QueueADT createQueue();
void disposeQueue(QueueADT Q);
void makeEmpty(QueueADT Q);
void enqueue(ET elem, QueueADT Q);
ET front(QueueADT Q);
void dequeue(QueueADT Q);
ET frontAndDequeue(QueueADT Q);
QueueADT initializeQueue(ET array[], int lengthArray);
void printQueue(QueueADT Q);
#endif
| #include <stdio.h>
#include <stdlib.h>
#include "utility.h"
/*
* MAW 3.25.a Write the routines to implement queues using: Linked Lists
*
* We use a header node at the very beginning of the linked list.
*
* Front: | header node | -> | data node | -> | data node | :Rear
*/
#ifndef _QUEUE_H
#define _QUEUE_H
typedef int ET;
struct QueueRecord;
struct QueueCDT;
typedef struct QueueRecord* PtrToNode;
// CDT: concrete-type-of-a-queue
// ADT: abstract-type-of-a-queue
typedef struct QueueCDT* QueueADT; // naming convention: https://www.cs.bu.edu/teaching/c/queue/linked-list/types.html
int isEmpty(QueueADT Q);
QueueADT createQueue();
void disposeQueue(QueueADT Q);
void makeEmpty(QueueADT Q);
void enqueue(ET elem, QueueADT Q);
ET front(QueueADT Q);
void dequeue(QueueADT Q);
ET frontAndDequeue(QueueADT Q);
QueueADT initializeQueue(ET array[], int lengthArray);
void printQueue(QueueADT Q);
#endif
|
Comment for pieter in Gesture manager. Read && fix | #pragma once
#ifdef _WIN32
#else
#include <android_native_app_glue.h>
#endif
#include <vector>
#include "BaseGesture.h"
namespace star
{
struct WinInputState;
class GestureManager {
public:
GestureManager();
~GestureManager();
void Update(const Context& context);
void AddGesture(BaseGesture* gesture);
void RemoveGesture(BaseGesture* gesture);
#ifdef _WIN32
void OnUpdateWinInputState();
#else
void OnTouchEvent(AInputEvent* pEvent);
#endif
private:
std::vector<BaseGesture*> m_GestureVec;
double m_dTime;
double m_TotalTime;
GestureManager(const GestureManager& t);
GestureManager(GestureManager&& t);
GestureManager& operator=(const GestureManager& t);
};
}
| #pragma once
#ifdef _WIN32
#else
#include <android_native_app_glue.h>
#endif
#include <vector>
#include "BaseGesture.h"
namespace star
{
struct WinInputState
// [COMMENT] Gesture-Tags
// Gestures should also be given a user-defined tag
// when added to the the manager.
// this way the user can look them up by tag, rather then
// on pointer ( for adding one, or removing one, or getting one )
// Part of the beauty of this kind of managing concept is
// that the user doesn't have to bother about the pointers
// as that's all managed inside the manager.
// On a side note... It's probably a good practice that the user defines
// these gestures in the Game class, as scenes get created
// and deleted everytime the screen rotates on android.
class GestureManager {
public:
GestureManager();
~GestureManager();
void Update(const Context& context);
void AddGesture(BaseGesture* gesture);
void RemoveGesture(BaseGesture* gesture);
#ifdef _WIN32
void OnUpdateWinInputState();
#else
void OnTouchEvent(AInputEvent* pEvent);
#endif
private:
std::vector<BaseGesture*> m_GestureVec;
double m_dTime;
double m_TotalTime;
GestureManager(const GestureManager& t);
GestureManager(GestureManager&& t);
GestureManager& operator=(const GestureManager& t);
};
}
|
Add hash function for std::tr1::shared_ptr<> | // Copyright (c) 2015, Cloudera, inc.
// Confidential Cloudera Information: Covered by NDA.
#ifndef KUDU_UTIL_SHARED_PTR_UTIL_H_
#define KUDU_UTIL_SHARED_PTR_UTIL_H_
#include <cstddef>
#include <tr1/memory>
namespace kudu {
// This is needed on TR1. With C++11, std::hash<std::shared_ptr<>> is provided.
template <class T>
struct SharedPtrHashFunctor {
std::size_t operator()(const std::tr1::shared_ptr<T>& key) const {
return reinterpret_cast<std::size_t>(key.get());
}
};
} // namespace kudu
#endif // KUDU_UTIL_SHARED_PTR_UTIL_H_
| |
Fix relocation of vector on STM32. | /* mbed Microcontroller Library - cmsis_nvic for STM32F4
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
*
* CMSIS-style functionality to support dynamic vectors
*/
#include "cmsis_nvic.h"
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Location of vectors in RAM
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
uint32_t *vectors = (uint32_t*)SCB->VTOR;
uint32_t i;
// Copy and switch to dynamic vectors if the first time called
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
uint32_t *old_vectors = vectors;
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
for (i=0; i<NVIC_NUM_VECTORS; i++) {
vectors[i] = old_vectors[i];
}
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
}
vectors[IRQn + 16] = vector;
}
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
uint32_t *vectors = (uint32_t*)SCB->VTOR;
return vectors[IRQn + 16];
}
| /* mbed Microcontroller Library - cmsis_nvic for STM32F4
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
*
* CMSIS-style functionality to support dynamic vectors
*/
#include "cmsis_nvic.h"
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Location of vectors in RAM
static unsigned char vtor_relocated;
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
uint32_t *vectors = (uint32_t*)SCB->VTOR;
uint32_t i;
// Copy and switch to dynamic vectors if the first time called
if (!vtor_relocated) {
uint32_t *old_vectors = vectors;
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
for (i=0; i<NVIC_NUM_VECTORS; i++) {
vectors[i] = old_vectors[i];
}
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
vtor_relocated = 1;
}
vectors[IRQn + 16] = vector;
}
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
uint32_t *vectors = (uint32_t*)SCB->VTOR;
return vectors[IRQn + 16];
}
|
Update MSVC build config for libsecp256k1 | /**********************************************************************
* Copyright (c) 2013, 2014 Pieter Wuille *
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#ifndef BITCOIN_LIBSECP256K1_CONFIG_H
#define BITCOIN_LIBSECP256K1_CONFIG_H
#undef USE_ASM_X86_64
#undef USE_ENDOMORPHISM
#undef USE_FIELD_10X26
#undef USE_FIELD_5X52
#undef USE_FIELD_INV_BUILTIN
#undef USE_FIELD_INV_NUM
#undef USE_NUM_GMP
#undef USE_NUM_NONE
#undef USE_SCALAR_4X64
#undef USE_SCALAR_8X32
#undef USE_SCALAR_INV_BUILTIN
#undef USE_SCALAR_INV_NUM
#define USE_NUM_NONE 1
#define USE_FIELD_INV_BUILTIN 1
#define USE_SCALAR_INV_BUILTIN 1
#define USE_FIELD_10X26 1
#define USE_SCALAR_8X32 1
#endif /* BITCOIN_LIBSECP256K1_CONFIG_H */
| /**********************************************************************
* Copyright (c) 2013, 2014 Pieter Wuille *
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#ifndef BITCOIN_LIBSECP256K1_CONFIG_H
#define BITCOIN_LIBSECP256K1_CONFIG_H
#undef USE_ASM_X86_64
#undef USE_ENDOMORPHISM
#undef USE_FIELD_10X26
#undef USE_FIELD_5X52
#undef USE_FIELD_INV_BUILTIN
#undef USE_FIELD_INV_NUM
#undef USE_NUM_GMP
#undef USE_NUM_NONE
#undef USE_SCALAR_4X64
#undef USE_SCALAR_8X32
#undef USE_SCALAR_INV_BUILTIN
#undef USE_SCALAR_INV_NUM
#define USE_NUM_NONE 1
#define USE_FIELD_INV_BUILTIN 1
#define USE_SCALAR_INV_BUILTIN 1
#define USE_FIELD_10X26 1
#define USE_SCALAR_8X32 1
#define ECMULT_GEN_PREC_BITS 4
#define ECMULT_WINDOW_SIZE 15
#endif /* BITCOIN_LIBSECP256K1_CONFIG_H */
|
Test file tab to space | #include <stdio.h>
int main() {
int a = 0;
while(1) {
printf("%d\t",a);
printf("a = 0x%x\n",a);
int temp;
scanf("%d",&temp);
if(temp == 0) {
continue;
}
else {
a = temp;
}
printf("%d\t",a);
printf("a changed 0x%x\n",a);
}
return 0;
}
| #include <stdio.h>
int main() {
int a = 0;
while(1) {
printf("%d\t",a);
printf("a = 0x%x\n",a);
int temp;
scanf("%d",&temp);
if(temp == 0) {
continue;
}
else {
a = temp;
}
printf("%d\t",a);
printf("a changed 0x%x\n",a);
}
return 0;
}
|
Reword comment to be consistent with comment in ConfinementForce. | /*===- RectConfinementForce.h - libSimulation -=================================
*
* DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/
#ifndef RECTCONFINEMENTFORCE_H
#define RECTCONFINEMENTFORCE_H
#include "Force.h"
#include "VectorCompatibility.h"
class RectConfinementForce : public Force
{
public:
RectConfinementForce(Cloud * const myCloud, double confineConstX, double confineConstY); // confinement consts must be positive!
~RectConfinementForce() {} // destructor
// public functions:
// Note: currentTime parameter is necessary (due to parent class) but unused
void force1(const double currentTime); // rk substep 1
void force2(const double currentTime); // rk substep 2
void force3(const double currentTime); // rk substep 3
void force4(const double currentTime); // rk substep 4
void writeForce(fitsfile * const file, int * const error) const;
void readForce(fitsfile * const file, int * const error);
private:
// private variables:
double confineX;
double confineY;
// private functions:
void force(const unsigned int currentParticle, const __m128d currentPositionX, const __m128d currentPositionY);
};
#endif // RECTCONFINEMENTFORCE_H
| /*===- RectConfinementForce.h - libSimulation -=================================
*
* DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/
#ifndef RECTCONFINEMENTFORCE_H
#define RECTCONFINEMENTFORCE_H
#include "Force.h"
#include "VectorCompatibility.h"
class RectConfinementForce : public Force
{
public:
RectConfinementForce(Cloud * const myCloud, double confineConstX, double confineConstY);
// IMPORTANT: In the above constructor, confineConst_'s must be positive!
~RectConfinementForce() {} // destructor
// public functions:
// Note: currentTime parameter is necessary (due to parent class) but unused
void force1(const double currentTime); // rk substep 1
void force2(const double currentTime); // rk substep 2
void force3(const double currentTime); // rk substep 3
void force4(const double currentTime); // rk substep 4
void writeForce(fitsfile * const file, int * const error) const;
void readForce(fitsfile * const file, int * const error);
private:
// private variables:
double confineX;
double confineY;
// private functions:
void force(const unsigned int currentParticle, const __m128d currentPositionX, const __m128d currentPositionY);
};
#endif // RECTCONFINEMENTFORCE_H
|
Fix min gcc version for __attribute__(format) | /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009 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 __MACROS_H
#define __MACROS_H
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define SPICE_ATTR_PRINTF(a,b) \
__attribute__((format(printf,a,b)))
#else
#define SPICE_ATTR_PRINTF(a,b)
#endif /* __GNUC__ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
#define SPICE_ATTR_NORETURN \
__attribute__((noreturn))
#else
#define SPICE_ATTR_NORETURN
#endif /* __GNUC__ */
#endif /* __MACROS_H */
| /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009 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 __MACROS_H
#define __MACROS_H
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
#define SPICE_ATTR_NORETURN \
__attribute__((noreturn))
#define SPICE_ATTR_PRINTF(a,b) \
__attribute__((format(printf,a,b)))
#else
#define SPICE_ATTR_NORETURN
#define SPICE_ATTR_PRINTF
#endif /* __GNUC__ */
#endif /* __MACROS_H */
|
Revert "added button callback functions" | #ifndef __MENU_STATE_H__
#define __MENU_STATE_H__
#include <vector>
#include "Game_state.h"
#include "Game_object.h"
class Menu_state : public Game_state {
public:
void update();
void render();
bool on_enter();
bool on_exit();
const std::string get_state_id() const { return s_menu_id; };
private:
static const std::string s_menu_id;
std::vector<Game_object*> m_game_objects;
static void menu_to_play();
static void menu_to_exit();
};
#endif | #ifndef __MENU_STATE_H__
#define __MENU_STATE_H__
#include <vector>
#include "Game_state.h"
#include "Game_object.h"
class Menu_state : public Game_state {
public:
void update();
void render();
bool on_enter();
bool on_exit();
const std::string get_state_id() const { return s_menu_id; };
private:
static const std::string s_menu_id;
std::vector<Game_object*> m_game_objects;
};
#endif |
Add a default constructor for FormData. There are too many places that create FormDatas, and we shouldn't need to initialize user_submitted for each call site. | // Copyright (c) 2010 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 WEBKIT_GLUE_FORM_DATA_H__
#define WEBKIT_GLUE_FORM_DATA_H__
#include <vector>
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"
namespace webkit_glue {
// Holds information about a form to be filled and/or submitted.
struct FormData {
// The name of the form.
string16 name;
// GET or POST.
string16 method;
// The URL (minus query parameters) containing the form.
GURL origin;
// The action target of the form.
GURL action;
// true if this form was submitted by a user gesture and not javascript.
bool user_submitted;
// A vector of all the input fields in the form.
std::vector<FormField> fields;
// Used by FormStructureTest.
inline bool operator==(const FormData& form) const {
return (name == form.name &&
StringToLowerASCII(method) == StringToLowerASCII(form.method) &&
origin == form.origin &&
action == form.action &&
user_submitted == form.user_submitted &&
fields == form.fields);
}
};
} // namespace webkit_glue
#endif // WEBKIT_GLUE_FORM_DATA_H__
| // Copyright (c) 2010 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 WEBKIT_GLUE_FORM_DATA_H__
#define WEBKIT_GLUE_FORM_DATA_H__
#include <vector>
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"
namespace webkit_glue {
// Holds information about a form to be filled and/or submitted.
struct FormData {
// The name of the form.
string16 name;
// GET or POST.
string16 method;
// The URL (minus query parameters) containing the form.
GURL origin;
// The action target of the form.
GURL action;
// true if this form was submitted by a user gesture and not javascript.
bool user_submitted;
// A vector of all the input fields in the form.
std::vector<FormField> fields;
FormData() : user_submitted(false) {}
// Used by FormStructureTest.
inline bool operator==(const FormData& form) const {
return (name == form.name &&
StringToLowerASCII(method) == StringToLowerASCII(form.method) &&
origin == form.origin &&
action == form.action &&
user_submitted == form.user_submitted &&
fields == form.fields);
}
};
} // namespace webkit_glue
#endif // WEBKIT_GLUE_FORM_DATA_H__
|
Remove GLKMatrixStack ... thanks Twilight! :D | //
// GLKMath.h
// GLKit
//
// Copyright (c) 2011, Apple Inc. All rights reserved.
//
#include <GLKit/GLKMathTypes.h>
#include <GLKit/GLKMatrix3.h>
#include <GLKit/GLKMatrix4.h>
#include <GLKit/GLKVector2.h>
#include <GLKit/GLKVector3.h>
#include <GLKit/GLKVector4.h>
#include <GLKit/GLKQuaternion.h>
#include <GLKit/GLKMatrixStack.h>
#include <GLKit/GLKMathUtils.h>
| //
// GLKMath.h
// GLKit
//
// Copyright (c) 2011, Apple Inc. All rights reserved.
//
#include <GLKit/GLKMathTypes.h>
#include <GLKit/GLKMatrix3.h>
#include <GLKit/GLKMatrix4.h>
#include <GLKit/GLKVector2.h>
#include <GLKit/GLKVector3.h>
#include <GLKit/GLKVector4.h>
#include <GLKit/GLKQuaternion.h>
//#include <GLKit/GLKMatrixStack.h>
#include <GLKit/GLKMathUtils.h>
|
Set Tor Default Monitoring to False | // Copyright (c) 2015 The BitCoin Core developers
// Copyright (c) 2016 The Silk Network developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
/**
* Functionality for communicating with Tor.
*/
#ifndef SILK_TORCONTROL_H
#define SILK_TORCONTROL_H
#include "scheduler.h"
extern const std::string DEFAULT_TOR_CONTROL;
static const bool DEFAULT_LISTEN_ONION = true;
void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler);
void InterruptTorControl();
void StopTorControl();
#endif /* SILK_TORCONTROL_H */
| // Copyright (c) 2015 The BitCoin Core developers
// Copyright (c) 2016 The Silk Network developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
/**
* Functionality for communicating with Tor.
*/
#ifndef SILK_TORCONTROL_H
#define SILK_TORCONTROL_H
#include "scheduler.h"
extern const std::string DEFAULT_TOR_CONTROL;
static const bool DEFAULT_LISTEN_ONION = false;
void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler);
void InterruptTorControl();
void StopTorControl();
#endif /* SILK_TORCONTROL_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.