Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Remove duplicate content in file. | // Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once
#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else // !BUILDING_CEF_SHARED
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif // !BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
// Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once
#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else // !BUILDING_CEF_SHARED
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif // !BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
| // Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once
#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else // !BUILDING_CEF_SHARED
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif // !BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
|
Add integer interpret and register algorithm. | using namespace std;
vector<int> Int;
vector<string> Name;
int CheckForInt(string ProcessInput)
{
if (ProcessInput.substr(0, 3) == "int")
{
int EqualLocation;
int SemicolonLocation;
stringstream Number;
stringstream StringName;
int FinalNumber;
string FinalName;
EqualLocation = ProcessInput.find("=");
EqualLocation++;
SemicolonLocation = ProcessInput.find(";");
Number << ProcessInput.substr(EqualLocation, SemicolonLocation);
Number >> FinalNumber;
StringName << ProcessInput.substr(4, EqualLocation);
StringName >> FinalName;
cout << FinalName << " = " << FinalNumber << "\n\n";
Int.push_back(FinalNumber);
Name.push_back(FinalName);
}
return 0;
}
| |
Handle epoll events one at a time. Doesn't seem to make things slower, and eliminates (I think) risk of freed backends getting events. | #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/epoll.h>
#include "epollinterface.h"
#define MAX_EPOLL_EVENTS 10
void add_epoll_handler(int epoll_fd, struct epoll_event_handler* handler, uint32_t event_mask)
{
struct epoll_event event;
event.data.ptr = handler;
event.events = event_mask;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, handler->fd, &event) == -1) {
perror("Couldn't register server socket with epoll");
exit(-1);
}
}
void do_reactor_loop(int epoll_fd)
{
struct epoll_event epoll_events[MAX_EPOLL_EVENTS];
while (1) {
int ii;
int num_events;
num_events = epoll_wait(epoll_fd, epoll_events, MAX_EPOLL_EVENTS, -1);
for (ii=0; ii < num_events; ii++ ) {
struct epoll_event_handler* handler = (struct epoll_event_handler*) epoll_events[ii].data.ptr;
handler->handle(handler, epoll_events[ii].events);
}
}
}
| #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/epoll.h>
#include "epollinterface.h"
#define MAX_EPOLL_EVENTS 1
void add_epoll_handler(int epoll_fd, struct epoll_event_handler* handler, uint32_t event_mask)
{
struct epoll_event event;
event.data.ptr = handler;
event.events = event_mask;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, handler->fd, &event) == -1) {
perror("Couldn't register server socket with epoll");
exit(-1);
}
}
void do_reactor_loop(int epoll_fd)
{
struct epoll_event epoll_events[MAX_EPOLL_EVENTS];
while (1) {
int ii;
int num_events;
num_events = epoll_wait(epoll_fd, epoll_events, MAX_EPOLL_EVENTS, -1);
for (ii=0; ii < num_events; ii++ ) {
struct epoll_event_handler* handler = (struct epoll_event_handler*) epoll_events[ii].data.ptr;
handler->handle(handler, epoll_events[ii].events);
}
}
}
|
Change name to const char * | #ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H
#include <string>
#include "CardType.h"
namespace ygo
{
namespace data
{
struct StaticCardData
{
std::string name;
CardType cardType;
// monster only
Attribute attribute;
MonsterType monsterType;
Type type;
MonsterType monsterAbility;
int level;
int attack;
int defense;
int lpendulum;
int rpendulum;
// spell and trap only
SpellType spellType;
TrapType trapType;
};
}
}
#endif
| #ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H
#include <string>
#include "CardType.h"
namespace ygo
{
namespace data
{
struct StaticCardData
{
const char* name;
CardType cardType;
// monster only
Attribute attribute;
MonsterType monsterType;
Type type;
MonsterType monsterAbility;
int level;
int attack;
int defense;
int lpendulum;
int rpendulum;
// spell and trap only
SpellType spellType;
TrapType trapType;
};
}
}
#endif
|
Fix warning due to lack of virtual destructor | #ifndef REQUESTHANDLER_H
#define REQUESTHANDLER_H
class RequestHandler {
public:
virtual bool canHandle(HTTPMethod method, String uri) { return false; }
virtual bool canUpload(String uri) { return false; }
virtual bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) { return false; }
virtual void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) {}
RequestHandler* next() { return _next; }
void next(RequestHandler* r) { _next = r; }
private:
RequestHandler* _next = nullptr;
};
#endif //REQUESTHANDLER_H
| #ifndef REQUESTHANDLER_H
#define REQUESTHANDLER_H
class RequestHandler {
public:
virtual ~RequestHandler() { }
virtual bool canHandle(HTTPMethod method, String uri) { return false; }
virtual bool canUpload(String uri) { return false; }
virtual bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) { return false; }
virtual void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) {}
RequestHandler* next() { return _next; }
void next(RequestHandler* r) { _next = r; }
private:
RequestHandler* _next = nullptr;
};
#endif //REQUESTHANDLER_H
|
Increase max kmalloc size for very large systems | #if (PAGE_SIZE == 4096)
CACHE(32)
#endif
CACHE(64)
#if L1_CACHE_BYTES < 64
CACHE(96)
#endif
CACHE(128)
#if L1_CACHE_BYTES < 128
CACHE(192)
#endif
CACHE(256)
CACHE(512)
CACHE(1024)
CACHE(2048)
CACHE(4096)
CACHE(8192)
CACHE(16384)
CACHE(32768)
CACHE(65536)
CACHE(131072)
#ifndef CONFIG_MMU
CACHE(262144)
CACHE(524288)
CACHE(1048576)
#ifdef CONFIG_LARGE_ALLOCS
CACHE(2097152)
CACHE(4194304)
CACHE(8388608)
CACHE(16777216)
CACHE(33554432)
#endif /* CONFIG_LARGE_ALLOCS */
#endif /* CONFIG_MMU */
| #if (PAGE_SIZE == 4096)
CACHE(32)
#endif
CACHE(64)
#if L1_CACHE_BYTES < 64
CACHE(96)
#endif
CACHE(128)
#if L1_CACHE_BYTES < 128
CACHE(192)
#endif
CACHE(256)
CACHE(512)
CACHE(1024)
CACHE(2048)
CACHE(4096)
CACHE(8192)
CACHE(16384)
CACHE(32768)
CACHE(65536)
CACHE(131072)
#if (NR_CPUS > 512) || (MAX_NUMNODES > 256) || !defined(CONFIG_MMU)
CACHE(262144)
#endif
#ifndef CONFIG_MMU
CACHE(524288)
CACHE(1048576)
#ifdef CONFIG_LARGE_ALLOCS
CACHE(2097152)
CACHE(4194304)
CACHE(8388608)
CACHE(16777216)
CACHE(33554432)
#endif /* CONFIG_LARGE_ALLOCS */
#endif /* CONFIG_MMU */
|
Update Skia milestone to 89 | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 88
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 89
#endif
|
Disable MD5, SHA1, SHA256 HW ACC for STM32F439xI | /*
* mbedtls_device.h
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H
/* FIXME: Don't enable AES hardware acceleration until issue #4928 is fixed.
* (https://github.com/ARMmbed/mbed-os/issues/4928) */
/* #define MBEDTLS_AES_ALT */
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_MD5_ALT
#endif /* MBEDTLS_DEVICE_H */
| /*
* mbedtls_device.h
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H
/* FIXME: Don't enable AES hardware acceleration until issue #4928 is fixed.
* (https://github.com/ARMmbed/mbed-os/issues/4928) */
/* #define MBEDTLS_AES_ALT */
/* FIXME: Don't enable SHA1, SHA256 and MD5 hardware acceleration until issue
* #5079 is fixed. (https://github.com/ARMmbed/mbed-os/issues/5079) */
/* #define MBEDTLS_SHA256_ALT */
/* #define MBEDTLS_SHA1_ALT */
/* #define MBEDTLS_MD5_ALT */
#endif /* MBEDTLS_DEVICE_H */
|
Make OpenSSL ECDSA and RSA request only until they can be tested | /*
* Utils for calling OpenSSL
* (C) 2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_OPENSSL_H__
#define BOTAN_OPENSSL_H__
#include <botan/secmem.h>
#include <botan/exceptn.h>
#include <memory>
#include <openssl/err.h>
namespace Botan {
class OpenSSL_Error : public Exception
{
public:
OpenSSL_Error(const std::string& what) :
Exception(what + " failed: " + ERR_error_string(ERR_get_error(), nullptr)) {}
};
#define BOTAN_OPENSSL_BLOCK_PRIO 150
#define BOTAN_OPENSSL_HASH_PRIO 150
#define BOTAN_OPENSSL_RC4_PRIO 150
#define BOTAN_OPENSSL_RSA_PRIO 150
#define BOTAN_OPENSSL_ECDSA_PRIO 150
}
#endif
| /*
* Utils for calling OpenSSL
* (C) 2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_OPENSSL_H__
#define BOTAN_OPENSSL_H__
#include <botan/secmem.h>
#include <botan/exceptn.h>
#include <memory>
#include <openssl/err.h>
namespace Botan {
class OpenSSL_Error : public Exception
{
public:
OpenSSL_Error(const std::string& what) :
Exception(what + " failed: " + ERR_error_string(ERR_get_error(), nullptr)) {}
};
#define BOTAN_OPENSSL_BLOCK_PRIO 150
#define BOTAN_OPENSSL_HASH_PRIO 150
#define BOTAN_OPENSSL_RC4_PRIO 150
#define BOTAN_OPENSSL_RSA_PRIO 90
#define BOTAN_OPENSSL_ECDSA_PRIO 90
}
#endif
|
Fix bug - obviously, recursive template type is impossible. | //===- Slab.h -------------------------------------------------------------===//
//
// The Bold Project
//
// This file is distributed under the New BSD License.
// See LICENSE for details.
//
//===----------------------------------------------------------------------===//
#ifndef BOLD_SUPPORT_SLAB_H
#define BOLD_SUPPORT_SLAB_H
#include <bold/ADT/IListNode.h>
namespace bold {
/** \class Slab
* \brief Slab is a continuous memory space that amounts to `Amount`
* `DataType` elements.
*
* Slab is a basic allocated unit of BumpAllocator.
*
* @tparam DataType the type of elements
* @tparam Amount the amount of elements in a slab
*/
template<typename DataType, unsigned int Amount>
struct Slab : public IListNode<Slab>
{
public:
enum {
max_size = Amount
};
public:
DataType data[max_size];
};
} // namespace bold
#endif
| //===- Slab.h -------------------------------------------------------------===//
//
// The Bold Project
//
// This file is distributed under the New BSD License.
// See LICENSE for details.
//
//===----------------------------------------------------------------------===//
#ifndef BOLD_SUPPORT_SLAB_H
#define BOLD_SUPPORT_SLAB_H
#include <bold/ADT/IListNode.h>
namespace bold {
/** \class Slab
* \brief Slab is a continuous memory space that amounts to `Amount`
* `DataType` elements.
*
* Slab is a basic allocated unit of BumpAllocator.
*
* @tparam DataType the type of elements
* @tparam Amount the amount of elements in a slab
*/
template<typename DataType, unsigned int Amount>
struct Slab : public IListNodeBase
{
public:
enum {
max_size = Amount
};
public:
DataType data[max_size];
};
} // namespace bold
#endif
|
Implement allocation and deallocation for c hamming window. | #include "ruby.h"
#include "noyes.h"
HammingWindow * new_hamming_window(int window_size) {
HammingWindow *hw = malloc(sizeof(HammingWindow));
hw->buf = malloc(window_size * sizeof(double));
hw->buflen = window_size;
return hw;
}
void free_hamming_window(HammingWindow *hw) {
free(hw->buf);
free(hw);
}
NData2 * hamming_window_apply(HammingWindow *self, NData2* data) {
return NULL;
}
| |
Fix licensing errors in files | /*
* Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
*
* 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-1301, USA.
*/
#ifndef __TRACKER_MINER_FS_WRITEBACK_H__
#define __TRACKER_MINER_FS_WRITEBACK_H__
#include <libtracker-miner/tracker-miner.h>
#include "tracker-config.h"
#include "tracker-miner-files.h"
G_BEGIN_DECLS
void tracker_writeback_init (TrackerMinerFiles *miner_files,
TrackerConfig *config,
GError **error);
void tracker_writeback_shutdown (void);
G_END_DECLS
#endif /* __TRACKER_MINER_FS_WRITEBACK_H__ */
| /*
* Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __TRACKER_MINER_FS_WRITEBACK_H__
#define __TRACKER_MINER_FS_WRITEBACK_H__
#include <libtracker-miner/tracker-miner.h>
#include "tracker-config.h"
#include "tracker-miner-files.h"
G_BEGIN_DECLS
void tracker_writeback_init (TrackerMinerFiles *miner_files,
TrackerConfig *config,
GError **error);
void tracker_writeback_shutdown (void);
G_END_DECLS
#endif /* __TRACKER_MINER_FS_WRITEBACK_H__ */
|
Set API ver and disable CRT warnings on Win32. |
/* StdAfx.h
*
* Copyright (C) 2013 Michael Imamura
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
#pragma once
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <list>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include <utility>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
|
/* StdAfx.h
*
* Copyright (C) 2013 Michael Imamura
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
#pragma once
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
// Minimum Windows version: XP
# define WINVER 0x0501
# define _CRT_NONSTDC_NO_WARNINGS
# define _CRT_SECURE_NO_DEPRECATE
# define _SCL_SECURE_NO_DEPRECATE
# include <windows.h>
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <list>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include <utility>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
|
Add comment for WIF functions. | #ifndef __BTC_WIF_H__
#define __BTC_WIF_H__
#include <string>
#include <vector>
namespace btc {
namespace wif {
std::string PrivateKeyToWif(const std::vector<uint8_t> &priv_key);
std::vector<uint8_t> WifToPrivateKey(const std::string &priv_key_str);
} // namespace wif
} // namespace btc
#endif
| #ifndef __BTC_WIF_H__
#define __BTC_WIF_H__
#include <string>
#include <vector>
namespace btc {
namespace wif {
/**
* Convert private key to string in WIF
*
* @param priv_key Private key data.
*
* @return WIF string.
*/
std::string PrivateKeyToWif(const std::vector<uint8_t> &priv_key);
/**
* Parse WIF private key string.
*
* @param priv_key_str Private key string in WIF format.
*
* @return Private key data.
*/
std::vector<uint8_t> WifToPrivateKey(const std::string &priv_key_str);
} // namespace wif
} // namespace btc
#endif
|
Fix ICMPv4 dest addr set | #include "ethernet.h"
#include "icmpv4.h"
#include "ip.h"
#include "utils.h"
void icmpv4_incoming(struct sk_buff *skb)
{
struct iphdr *iphdr = ip_hdr(skb);
struct icmp_v4 *icmp = (struct icmp_v4 *) iphdr->data;
//TODO: Check csum
switch (icmp->type) {
case ICMP_V4_ECHO:
icmpv4_reply(skb);
break;
default:
perror("ICMPv4 did not match supported types");
return;
}
}
void icmpv4_reply(struct sk_buff *skb)
{
struct iphdr *iphdr = ip_hdr(skb);
struct icmp_v4 *icmp = (struct icmp_v4 *) iphdr->data;
uint16_t icmp_len = iphdr->len - (iphdr->ihl * 4);
skb_reserve(skb, ETH_HDR_LEN + IP_HDR_LEN + icmp_len);
skb_push(skb, icmp_len);
icmp->type = ICMP_V4_REPLY;
icmp->csum = 0;
icmp->csum = checksum(icmp, icmp_len, 0);
iphdr->daddr = iphdr->saddr;
skb->protocol = ICMPV4;
ip_output(NULL, skb);
}
| #include "ethernet.h"
#include "icmpv4.h"
#include "ip.h"
#include "utils.h"
void icmpv4_incoming(struct sk_buff *skb)
{
struct iphdr *iphdr = ip_hdr(skb);
struct icmp_v4 *icmp = (struct icmp_v4 *) iphdr->data;
//TODO: Check csum
switch (icmp->type) {
case ICMP_V4_ECHO:
icmpv4_reply(skb);
break;
default:
perror("ICMPv4 did not match supported types");
return;
}
}
void icmpv4_reply(struct sk_buff *skb)
{
struct iphdr *iphdr = ip_hdr(skb);
struct icmp_v4 *icmp;
struct sock sk;
uint16_t icmp_len = iphdr->len - (iphdr->ihl * 4);
skb_reserve(skb, ETH_HDR_LEN + IP_HDR_LEN + icmp_len);
skb_push(skb, icmp_len);
icmp = (struct icmp_v4 *)skb->data;
icmp->type = ICMP_V4_REPLY;
icmp->csum = 0;
icmp->csum = checksum(icmp, icmp_len, 0);
skb->protocol = ICMPV4;
sk.daddr = iphdr->saddr;
ip_output(&sk, skb);
}
|
Add BSTNode & BST struct declaration | #include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
#endif | #include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
#endif |
Add comment on what space the incoming ray should be in | #ifndef GEOMETRY_H
#define GEOMETRY_H
#include <vector>
#include <string>
#include <memory>
#include "linalg/ray.h"
#include "linalg/transform.h"
class Geometry {
public:
virtual bool intersect(Ray &r) = 0;
};
class Node {
std::vector<std::shared_ptr<Node>> children;
std::shared_ptr<Geometry> geometry;
Transform transform;
std::string name;
public:
/*
* Create a node in the scene graph, placing some named geometry in
* the scene
*/
Node(const std::shared_ptr<Geometry> &geom, const Transform &t,
const std::string &name);
const std::vector<std::shared_ptr<Node>>& get_children() const;
std::vector<std::shared_ptr<Node>>& get_children();
const Geometry& get_geometry() const;
const Transform& get_transform() const;
Transform& get_transform();
};
#endif
| #ifndef GEOMETRY_H
#define GEOMETRY_H
#include <vector>
#include <string>
#include <memory>
#include "linalg/ray.h"
#include "linalg/transform.h"
class Geometry {
public:
/*
* Test a ray for intersection with the geometry.
* The ray should have been previously transformed into object space
*/
virtual bool intersect(Ray &r) = 0;
};
class Node {
std::vector<std::shared_ptr<Node>> children;
std::shared_ptr<Geometry> geometry;
Transform transform;
std::string name;
public:
/*
* Create a node in the scene graph, placing some named geometry in
* the scene
*/
Node(const std::shared_ptr<Geometry> &geom, const Transform &t,
const std::string &name);
const std::vector<std::shared_ptr<Node>>& get_children() const;
std::vector<std::shared_ptr<Node>>& get_children();
const Geometry& get_geometry() const;
const Transform& get_transform() const;
Transform& get_transform();
};
#endif
|
Increase node count to 3 | #ifndef DISTRIBUTED_H_
#define DISTRIBUTED_H_
#include <pthread.h>
#include "synch.h"
#define N_WORKERS 2
/* The Nahanni device */
#define SHM_DEV "/dev/uio0"
/* The size of the shared memory, in bytes */
#define SHM_SIZE (1024L * 1024L * 1024L)
/* Where we should map the memory */
#define SHM_LOC (void *)(1024L * 1024L * 1024L * 1024L)
#define MASTER if(master_node)
#define WORKER if(!master_node)
typedef struct {
pthread_spinlock_t lock;
int count;
int alldone;
int exited;
} mr_barrier_t;
void *shm_base;
void shm_init();
void barrier_init(mr_barrier_t *bar);
void barrier(mr_barrier_t *bar);
int master_node;
#endif /* DISTRIBUTED_H_ */
| #ifndef DISTRIBUTED_H_
#define DISTRIBUTED_H_
#include <pthread.h>
#include "synch.h"
/* This is a misnomer - it's actually the number of processes (master + workers) */
#define N_WORKERS 3
/* The Nahanni device */
#define SHM_DEV "/dev/uio0"
/* The size of the shared memory, in bytes */
#define SHM_SIZE (1024L * 1024L * 1024L)
/* Where we should map the memory */
#define SHM_LOC (void *)(1024L * 1024L * 1024L * 1024L)
#define MASTER if(master_node)
#define WORKER if(!master_node)
typedef struct {
pthread_spinlock_t lock;
int count;
int alldone;
int exited;
} mr_barrier_t;
void *shm_base;
void shm_init();
void barrier_init(mr_barrier_t *bar);
void barrier(mr_barrier_t *bar);
int master_node;
#endif /* DISTRIBUTED_H_ */
|
Add a triple, per Ben's suggestion. | // REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -verify -fasm-blocks
#define M __asm int 0x2c
#define M2 int
void t1(void) { M }
void t2(void) { __asm int 0x2c }
void t3(void) { __asm M2 0x2c }
void t4(void) { __asm mov eax, fs:[0x10] }
void t5() {
__asm {
int 0x2c ; } asm comments are fun! }{
}
__asm {}
}
int t6() {
__asm int 3 ; } comments for single-line asm
__asm {}
__asm int 4
return 10;
}
void t7() {
__asm {
push ebx
mov ebx, 0x07
pop ebx
}
}
void t8() {
__asm nop __asm nop __asm nop
}
void t9() {
__asm nop __asm nop ; __asm nop
}
int t_fail() { // expected-note {{to match this}}
__asm
__asm { // expected-error 3 {{expected}} expected-note {{to match this}}
| // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
#define M __asm int 0x2c
#define M2 int
void t1(void) { M }
void t2(void) { __asm int 0x2c }
void t3(void) { __asm M2 0x2c }
void t4(void) { __asm mov eax, fs:[0x10] }
void t5() {
__asm {
int 0x2c ; } asm comments are fun! }{
}
__asm {}
}
int t6() {
__asm int 3 ; } comments for single-line asm
__asm {}
__asm int 4
return 10;
}
void t7() {
__asm {
push ebx
mov ebx, 0x07
pop ebx
}
}
void t8() {
__asm nop __asm nop __asm nop
}
void t9() {
__asm nop __asm nop ; __asm nop
}
int t_fail() { // expected-note {{to match this}}
__asm
__asm { // expected-error 3 {{expected}} expected-note {{to match this}}
|
Make master header platform neutral | //
// UTAPIObjCAdapter-iOS.h
// UTAPIObjCAdapter-iOS
//
// Created by Mark Woollard on 15/05/2016.
// Copyright © 2016 UrbanThings. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT double UTAPIObjCAdapter_iOSVersionNumber;
//! Project version string for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT const unsigned char UTAPIObjCAdapter_iOSVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <UTAPIObjCAdapter_iOS/PublicHeader.h>
| //
// UTAPIObjCAdapter-iOS.h
// UTAPIObjCAdapter-iOS
//
// Created by Mark Woollard on 15/05/2016.
// Copyright © 2016 UrbanThings. All rights reserved.
//
//! Project version number for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT double UTAPIObjCAdapter_iOSVersionNumber;
//! Project version string for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT const unsigned char UTAPIObjCAdapter_iOSVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <UTAPIObjCAdapter_iOS/PublicHeader.h>
|
Solve c problem to validate a string contains no repeated characters | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int is_unique(char *str)
{
int c;
int table[128];
for (int i = 0; i < 128; i++) {
table[i] = 0;
}
for (int i = 0; i < strlen(str); i++) {
if (str[i] != ' ') {
c = (int) str[i];
table[c]++;
if (table[c] > 1) {
return 0;
}
}
}
return 1;
}
int main(void)
{
FILE * file;
char file_name[128];
char * line = NULL;
size_t length = 0;
ssize_t read;
printf("Provide input file: ");
fgets(file_name, 128, stdin);
strtok(file_name, "\n");
file = fopen(file_name, "r");
if (file == NULL) {
printf("Failed to open file at %s: ", file_name);
exit(1);
}
while ((read = getline(&line, &length, file)) != -1) {
strtok(line, "\n");
if (is_unique(line) == 1) {
printf("%s is unique\n", line);
} else {
printf("%s is not unique\n", line);
}
}
free(line);
fclose(file);
exit(0);
} | |
Update documentation for modification of mbc and new properties | // This file is part of RBDyn.
//
// RBDyn 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 3 of the License, or
// (at your option) any later version.
//
// RBDyn 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 RBDyn. If not, see <http://www.gnu.org/licenses/>.
#pragma once
// includes
// std
#include <vector>
// SpaceVecAlg
#include <SpaceVecAlg/SpaceVecAlg>
#include "Jacobian.h"
namespace rbd
{
class MultiBody;
class MultiBodyConfig;
namespace ik {
static constexpr int MAX_ITERATIONS = 50;
static constexpr double LAMBDA = 0.9;
static constexpr double THRESHOLD = 1e-8;
static constexpr double ALMOST_ZERO = 1e-8;
} // ik
/**
* Inverse Kinematics algorithm.
*/
class InverseKinematics
{
public:
InverseKinematics()
{}
/// @param mb MultiBody associated with this algorithm.
InverseKinematics(const MultiBody& mb, int ef_index);
/**
* Compute the inverse kinematics.
* @param mb MultiBody used has model.
* @param mbc Use q generalized position vector
* @return bool if computation has converged
* Fill q with new generalized position, bodyPosW, jointConfig
* and parentToSon
*/
bool inverseKinematics(const MultiBody& mb, MultiBodyConfig& mbc,
const sva::PTransformd& ef_target);
/** safe version of @see inverseKinematics.
* @throw std::domain_error If mb doesn't match mbc.
*/
bool sInverseKinematics(const MultiBody& mb, MultiBodyConfig& mbc,
const sva::PTransformd& ef_target);
/**
* @brief Find q that minimizes the distance between ef and ef_target.
* @return Bool if convergence has been reached
*/
// @brief Maximum number of iterations
int max_iterations_;
// @brief Learning rate
double lambda_;
// @brief Stopping criterion
double threshold_;
// @brief Rounding threshold for the Jacobian
double almost_zero_;
private:
// @brief ef_index is the End Effector index used to build jacobian
int ef_index_;
Jacobian jac_;
Eigen::JacobiSVD<Eigen::MatrixXd> svd_;
};
} // namespace rbd
| |
Change UNKNOWN to UNKNOWN! in 37/03 + chars to signed chars | // PARAM: --enable ana.int.interval --enable ana.int.congruence --disable ana.int.def_exc
// Overflow information should be passed from the interval domain to congruences
#include <assert.h>
#include <stdio.h>
int main(){
char r;
if (r) {
r = -68;
} else {
r = -63;
}
char k = r - 80;
assert (k == 0); //UNKNOWN!
char non_ov = r - 10;
assert (non_ov == -78); //UNKNOWN
char m = r * 2;
assert (m == 0); //UNKNOWN!
char l = r + (-80);
assert (l == 0); //UNKNOWN!
int g;
if (g) {
g = -126;
} else {
g = -128;
}
char f = g / (-1);
assert (f == 1); //UNKNOWN!
char d = -g;
assert (d == 1); //UNKNOWN!
return 0;
}
| // PARAM: --enable ana.int.interval --enable ana.int.congruence --disable ana.int.def_exc
// Overflow information should be passed from the interval domain to congruences
#include <assert.h>
#include <stdio.h>
int main(){
signed char r;
if (r) {
r = -68;
} else {
r = -63;
}
signed char k = r - 80;
assert (k == 0); //UNKNOWN!
signed char non_ov = r - 10;
assert (non_ov == -78); //UNKNOWN!
signed char m = r * 2;
assert (m == 0); //UNKNOWN!
signed char l = r + (-80);
assert (l == 0); //UNKNOWN!
int g;
if (g) {
g = -126;
} else {
g = -128;
}
signed char f = g / (-1);
assert (f == 1); //UNKNOWN!
signed char d = -g;
assert (d == 1); //UNKNOWN!
return 0;
}
|
Add a section which test if the removePoint function work | #include <polygon.h>
int main(int argc, char* argv[]) {
Polygon lol;
lol=createPolygon();
lol=addPoint(lol, createPoint(12.6,-5.3));
lol=addPoint(lol, createPoint(-4.1,456.123));
printf("\n\ntaille : %d", lol.size);
printf("\n\nx premier point : %f", lol.head->value.x);
printf("\ny premier point : %f\n\n", lol.head->value.y);
printf("\n\nx 2eme point : %f", lol.head->next->value.x);
printf("\ny 2eme point : %f\n\n", lol.head->next->value.y);
printf("\n\nx 3eme point : %f", lol.head->next->next->value.x);
printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y);
return EXIT_SUCCESS;
}
| #include <polygon.h>
int main(int argc, char* argv[]) {
Polygon lol;
lol=createPolygon();
lol=addPoint(lol, createPoint(12.6,-5.3));
lol=addPoint(lol, createPoint(-4.1,456.123));
lol=addPoint(lol, createPoint(23.7,1));
printf("\n\ntaille : %d", lol.size);
printf("\n\nx premier point : %f", lol.head->value.x);
printf("\ny premier point : %f\n\n", lol.head->value.y);
printf("\n\nx 2eme point : %f", lol.head->next->value.x);
printf("\ny 2eme point : %f\n\n", lol.head->next->value.y);
printf("\n\nx 3eme point : %f", lol.head->next->next->value.x);
printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y);
printf("\nSuppression du 2e élément...\n");
lol=removePoint(lol, 2);
printf("\n\ntaille : %d", lol.size);
printf("\n\nx premier point : %f", lol.head->value.x);
printf("\ny premier point : %f\n\n", lol.head->value.y);
printf("\n\nx 2eme point : %f", lol.head->next->value.x);
printf("\ny 2eme point : %f\n\n", lol.head->next->value.y);
printf("\n\nx 3eme point : %f", lol.head->next->next->value.x);
printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y);
return EXIT_SUCCESS;
}
|
Fix lack of _Noreturn support in Clang 3.0. | /*
* Copyright (c) 2011-2013 Graham Edgecombe <graham@grahamedgecombe.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef STDNORETURN_H
#define STDNORETURN_H
#define noreturn _Noreturn
#endif
| /*
* Copyright (c) 2011-2013 Graham Edgecombe <graham@grahamedgecombe.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef STDNORETURN_H
#define STDNORETURN_H
#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ == 0
#define noreturn
#else
#define noreturn _Noreturn
#endif
#endif
|
Fix header guard for amalgamation | /*
* RFC 6979 Deterministic Nonce Generator
* (C) 2014 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_RFC6979_GENERATOR__
#define BOTAN_RFC6979_GENERATOR__
#include <botan/bigint.h>
#include <string>
namespace Botan {
/**
* @param x the secret (EC)DSA key
* @param q the group order
* @param h the message hash already reduced mod q
* @param hash the hash function used to generate h
*/
BigInt BOTAN_DLL generate_rfc6979_nonce(const BigInt& x,
const BigInt& q,
const BigInt& h,
const std::string& hash);
}
#endif
| /*
* RFC 6979 Deterministic Nonce Generator
* (C) 2014 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_RFC6979_GENERATOR_H__
#define BOTAN_RFC6979_GENERATOR_H__
#include <botan/bigint.h>
#include <string>
namespace Botan {
/**
* @param x the secret (EC)DSA key
* @param q the group order
* @param h the message hash already reduced mod q
* @param hash the hash function used to generate h
*/
BigInt BOTAN_DLL generate_rfc6979_nonce(const BigInt& x,
const BigInt& q,
const BigInt& h,
const std::string& hash);
}
#endif
|
Create a macro for pipeline debugging | #ifndef __KMS_UTILS_H__
#define __KMS_UTILS_H__
#include <gst/gst.h>
GstElement* kms_get_pipeline();
void kms_dynamic_connection(GstElement *orig, GstElement *dest, const gchar *name);
GstElement* kms_utils_get_element_for_caps(GstElementFactoryListType type,
GstRank rank, const GstCaps *caps,
GstPadDirection direction, gboolean subsetonly,
const gchar *name);
#endif /* __KMS_UTILS_H__ */
| #ifndef __KMS_UTILS_H__
#define __KMS_UTILS_H__
#include <gst/gst.h>
#define KMS_DEBUG_PIPE(name) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS( \
GST_BIN(kms_get_pipeline()), \
GST_DEBUG_GRAPH_SHOW_ALL, name); \
GstElement* kms_get_pipeline();
void kms_dynamic_connection(GstElement *orig, GstElement *dest, const gchar *name);
GstElement* kms_utils_get_element_for_caps(GstElementFactoryListType type,
GstRank rank, const GstCaps *caps,
GstPadDirection direction, gboolean subsetonly,
const gchar *name);
#endif /* __KMS_UTILS_H__ */
|
Add RSA byte length constant | #ifndef _RSA_SIGN_CONSTANTS_H_
#define _RSA_SIGN_CONSTANTS_H_
/*
* RSA Block length. Used to determine the modulo's size.
*/
#define RSA_SIGN_BLOCK_LEN (1024)
#define RSA_SIGN_HASH_METHOD_SHA_1 ("sha1")
#define RSA_SIGN_HASH_METHOD_SHA_256 ("sha256")
/*
* Supported Hashing methods for RSA signature validation
*/
enum rsa_sign_hash_method {SHA1, SHA256 };
#endif /* _RSA_SIGN_CONSTANTS_H_ */
| #ifndef _RSA_SIGN_CONSTANTS_H_
#define _RSA_SIGN_CONSTANTS_H_
/*
* RSA Block length. Used to determine the modulo's size.
*/
#define RSA_SIGN_BLOCK_LEN (RSA_SIGN_KEY_BITSIZE/8)
#define RSA_SIGN_KEY_BITSIZE (1024)
#define RSA_SIGN_HASH_METHOD_SHA_1 ("sha1")
#define RSA_SIGN_HASH_METHOD_SHA_256 ("sha256")
/*
* Supported Hashing methods for RSA signature validation
*/
enum rsa_sign_hash_method {SHA1, SHA256 };
#endif /* _RSA_SIGN_CONSTANTS_H_ */
|
Add some color for console output |
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H
#include KAI_PLATFORM_INCLUDE(GameController.h)
#endif // SHATTER_PLATFORM_GAME_CONTROLLER_H
//EOF
|
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H
#include KAI_PLATFORM_INCLUDE(GameController.h)
#endif
//EOF
|
Fix mismatch in function signature and implementation. | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://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 IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H
#define IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H
#include "mlir/Pass/Pass.h"
namespace mlir {
namespace iree_compiler {
/// Pass to get gpu.module from a gpu.launch operation.
std::unique_ptr<OpPassBase<FuncOp>> createIREEGpuKernelOutliningPass();
} // namespace iree_compiler
} // namespace mlir
#endif
| // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://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 IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H
#define IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H
#include "mlir/Pass/Pass.h"
namespace mlir {
namespace iree_compiler {
/// Pass to get gpu.module from a gpu.launch operation.
std::unique_ptr<OpPassBase<ModuleOp>> createIREEGpuKernelOutliningPass();
} // namespace iree_compiler
} // namespace mlir
#endif
|
Add generic perf counter definitions. | #ifndef TUVOK_PERF_COUNTER_H
#define TUVOK_PERF_COUNTER_H
/// Valid performance counters the system should track.
/// When adding a new counter, please add a (units) clause so we know how to
/// interpret the value!
enum PerfCounter {
PERF_DISK_READ=0, // reading bricks from disk (seconds)
PERF_DECOMPRESSION, // decompressing brick data (seconds)
PERF_COMPRESSION, // compressing brick data (seconds)
PERF_BRICKS, // number of bricks read/processed (counter)
PERF_END_IO, // invalid; end of IO-based metrics
PERF_READ_HTABLE=1000, // reading hash table from GPU (seconds)
PERF_CONDENSE_HTABLE, // condensing hash table [removing empties] (seconds)
PERF_RENDER, // (seconds)
PERF_UPLOAD_BRICKS, // uploading bricks to GPU [tex updates] (seconds)
PERF_END_RENDER, // invalid; end of render-based metrics
PERF_END // invalid; used for sizing table.
};
/// interface for classes which can be queried in this way.
struct PerfQueryable {
virtual double PerfQuery(enum PerfCounter) = 0;
};
#endif
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2013 Interactive Visualization and Data Analysis Group
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.
*/
| |
Add declaration header file for token space. | /** @file
GUID for PcAtChipsetPkg PCD Token Space
Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _PCATCHIPSET_TOKEN_SPACE_GUID_H_
#define _PCATCHIPSET_TOKEN_SPACE_GUID_H_
#define PCATCHIPSET_TOKEN_SPACE_GUID \
{ \
0x326ae723, 0xae32, 0x4589, { 0x98, 0xb8, 0xca, 0xc2, 0x3c, 0xdc, 0xc1, 0xb1 } \
}
extern EFI_GUID gPcAtChipsetPkgTokenSpaceGuid;
#endif
| |
Fix casing for relatively included header to fix Linux builds | //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "core/RecyclerHeapMarkingContext.h"
// Class used to wrap a MarkContext so that calls to MarkObjects during IRecyclerVisitedObject::Trace
// can mark with the correct contextual template parameters
template<bool parallel>
class MarkContextWrapper : public IRecyclerHeapMarkingContext
{
public:
MarkContextWrapper(MarkContext* context) : markContext(context) {}
void __stdcall MarkObjects(void** objects, size_t count, void* parent) override
{
for (size_t i = 0; i < count; i++)
{
// We pass true for interior, since we expect a majority of the pointers being marked by
// external objects to themselves be external (and thus candidates for interior pointers).
markContext->Mark<parallel, /*interior*/true, /*doSpecialMark*/ false>(objects[i], parent);
}
}
private:
// Should only be created on the stack
void* operator new(size_t);
MarkContext* markContext;
};
| //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "Core/RecyclerHeapMarkingContext.h"
// Class used to wrap a MarkContext so that calls to MarkObjects during IRecyclerVisitedObject::Trace
// can mark with the correct contextual template parameters
template<bool parallel>
class MarkContextWrapper : public IRecyclerHeapMarkingContext
{
public:
MarkContextWrapper(MarkContext* context) : markContext(context) {}
void __stdcall MarkObjects(void** objects, size_t count, void* parent) override
{
for (size_t i = 0; i < count; i++)
{
// We pass true for interior, since we expect a majority of the pointers being marked by
// external objects to themselves be external (and thus candidates for interior pointers).
markContext->Mark<parallel, /*interior*/true, /*doSpecialMark*/ false>(objects[i], parent);
}
}
private:
// Should only be created on the stack
void* operator new(size_t);
MarkContext* markContext;
};
|
Make mesh loader actually read stdin | #include "../src/mesh_obj.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *args[]) {
if(argc < 2) {
printf("test_mesh test-mesh-name.obj\n");
return 0;
}
// read mesh from standard input, push into obj parser
Mesh *mesh = meshReadOBJ(args[1]);
if(!mesh) {
return 0;
}
unsigned numFloats = meshGetNumFloats(mesh);
unsigned numVertices = meshGetNumVertices(mesh);
float *buf = malloc(sizeof(float) * numFloats);
meshPackVertices(mesh, buf);
meshClose(mesh);
return 0;
}
| #include "../src/mesh_obj.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *args[]) {
if(argc < 2) {
printf("usage: test_mesh filename.obj\n");
printf(" pass - (a dash character) as filename to read from stdin\n");
return 0;
}
Mesh *mesh;
// read mesh from standard input or file, push into obj parser
if(!strcmp("-", args[1])) {
mesh = meshReadOBJF(stdin, "(stdin)");
} else {
mesh = meshReadOBJ(args[1]);
}
if(!mesh) {
return 0;
}
unsigned numFloats = meshGetNumFloats(mesh);
unsigned numVertices = meshGetNumVertices(mesh);
float *buf = malloc(sizeof(float) * numFloats);
meshPackVertices(mesh, buf);
meshClose(mesh);
free(buf);
return 0;
}
|
Add the missing PNaCl atomicops support. | // Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file is an internal atomic implementation, use atomicops.h instead.
#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
namespace google {
namespace protobuf {
namespace internal {
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
return __sync_val_compare_and_swap(ptr, old_value, new_value);
}
inline void MemoryBarrier() {
__sync_synchronize();
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
MemoryBarrier();
return ret;
}
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
}
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
Atomic32 value = *ptr;
MemoryBarrier();
return value;
}
} // namespace internal
} // namespace protobuf
} // namespace google
#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
| |
Read from tun buffer and print hexdump in loop | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "basic.h"
#include "tuntap_if.h"
#include "utils.h"
int main(int argc, char** argv) {
int tun_fd;
char buf[100];
char *dev = calloc(10, 1);
CLEAR(buf);
tun_fd = tun_alloc(dev);
if (set_if_up(dev) != 0) {
printf("ERROR when setting up if\n");
}
if (set_if_address(dev, "10.0.0.5/24") != 0) {
printf("ERROR when setting address for if\n");
};
if (set_if_route(dev, "10.0.0.0/24") != 0) {
printf("ERROR when setting route for if\n");
}
read(tun_fd, buf, 100);
print_hexdump(buf, 100);
free(dev);
}
| #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "basic.h"
#include "tuntap_if.h"
#include "utils.h"
int main(int argc, char** argv) {
int tun_fd;
char buf[100];
char *dev = calloc(10, 1);
CLEAR(buf);
tun_fd = tun_alloc(dev);
if (set_if_up(dev) != 0) {
printf("ERROR when setting up if\n");
}
if (set_if_address(dev, "10.0.0.5/24") != 0) {
printf("ERROR when setting address for if\n");
};
if (set_if_route(dev, "10.0.0.0/24") != 0) {
printf("ERROR when setting route for if\n");
}
while (1) {
read(tun_fd, buf, 100);
print_hexdump(buf, 100);
}
free(dev);
}
|
Add the timezone to the data model. | //
// SRDataModel.h
// Sensorama
//
// Created by Wojciech Adam Koszek (h) on 19/04/2016.
// Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Realm/Realm.h"
@interface SRDataPoint : RLMObject
@property NSNumber<RLMInt> *accX;
@property NSNumber<RLMInt> *accY;
@property NSNumber<RLMInt> *accZ;
@property NSNumber<RLMInt> *magX;
@property NSNumber<RLMInt> *magY;
@property NSNumber<RLMInt> *magZ;
@property NSNumber<RLMInt> *gyroX;
@property NSNumber<RLMInt> *gyroY;
@property NSNumber<RLMInt> *gyroZ;
@property NSInteger fileId;
@property NSInteger curTime;
@end
@interface SRDataFile : RLMObject
@property NSString *username;
@property NSString *desc;
/* need to do something about device_info */
@property NSInteger sampleInterval;
@property BOOL accEnabled;
@property BOOL magEnabled;
@property BOOL gyroEnabled;
@property NSDate *dateStart;
@property NSDate *dateEnd;
@property NSInteger fileId;
@end | //
// SRDataModel.h
// Sensorama
//
// Created by Wojciech Adam Koszek (h) on 19/04/2016.
// Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Realm/Realm.h"
@interface SRDataPoint : RLMObject
@property NSNumber<RLMInt> *accX;
@property NSNumber<RLMInt> *accY;
@property NSNumber<RLMInt> *accZ;
@property NSNumber<RLMInt> *magX;
@property NSNumber<RLMInt> *magY;
@property NSNumber<RLMInt> *magZ;
@property NSNumber<RLMInt> *gyroX;
@property NSNumber<RLMInt> *gyroY;
@property NSNumber<RLMInt> *gyroZ;
@property NSInteger fileId;
@property NSInteger curTime;
@end
@interface SRDataFile : RLMObject
@property NSString *username;
@property NSString *desc;
@property NSString *timezone;
/* need to do something about device_info */
@property NSInteger sampleInterval;
@property BOOL accEnabled;
@property BOOL magEnabled;
@property BOOL gyroEnabled;
@property NSDate *dateStart;
@property NSDate *dateEnd;
@property NSInteger fileId;
@end |
Add missing include for getpagesize, and fix a typo. | //===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <stdint.h>
#include <sys/mman.h>
//
// The compiler generates calls to __enable_execute_stack() when creating
// trampoline functions on the stack for use with nested functions.
// It is expected to mark the page(s) containing the address
// and the next 48 bytes as executable. Since the stack is normally rw-
// that means changing the protection on those page(s) to rwx.
//
void __enable_execute_stack(void* addr)
{
#if __APPLE__
// On Darwin, pagesize is always 4096 bytes
const uintptr_t pageSize = 4096;
#else
// FIXME: We should have a configure check for this.
const uintptr_t pagesize = getpagesize();
#endif
const uintptr_t pageAlignMask = ~(pageSize-1);
uintptr_t p = (uintptr_t)addr;
unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
mprotect(startPage, endPage-startPage, PROT_READ | PROT_WRITE | PROT_EXEC);
}
| //===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <stdint.h>
#include <sys/mman.h>
#ifndef __APPLE__
#include <unistd.h>
#endif
//
// The compiler generates calls to __enable_execute_stack() when creating
// trampoline functions on the stack for use with nested functions.
// It is expected to mark the page(s) containing the address
// and the next 48 bytes as executable. Since the stack is normally rw-
// that means changing the protection on those page(s) to rwx.
//
void __enable_execute_stack(void* addr)
{
#if __APPLE__
// On Darwin, pagesize is always 4096 bytes
const uintptr_t pageSize = 4096;
#else
// FIXME: We should have a configure check for this.
const uintptr_t pageSize = getpagesize();
#endif
const uintptr_t pageAlignMask = ~(pageSize-1);
uintptr_t p = (uintptr_t)addr;
unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
mprotect(startPage, endPage-startPage, PROT_READ | PROT_WRITE | PROT_EXEC);
}
|
Remove debugging changes from 36/17 | // SKIP PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>
int g = 42; // matches write in t_fun
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
// pthread_mutex_lock(&A);
// pthread_mutex_lock(&B);
// g = 42;
// pthread_mutex_unlock(&B);
// pthread_mutex_unlock(&A);
return NULL;
}
int main(void) {
int r, t;
pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);
pthread_mutex_lock(&A);
pthread_mutex_lock(&B);
if (r * r) {
g = 17;
pthread_mutex_unlock(&B); // publish to g#prot
pthread_mutex_lock(&B);
}
// locally written g is only in one branch, g == g#prot should be forgotten!
t = g;
assert(t == 17); // UNKNOWN!
pthread_mutex_unlock(&B);
pthread_mutex_unlock(&A);
return 0;
}
| // SKIP PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>
int g = 42; // matches write in t_fun
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
pthread_mutex_lock(&A);
pthread_mutex_lock(&B);
g = 42;
pthread_mutex_unlock(&B);
pthread_mutex_unlock(&A);
return NULL;
}
int main(void) {
int r, t;
pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);
pthread_mutex_lock(&A);
pthread_mutex_lock(&B);
if (r) {
g = 17;
pthread_mutex_unlock(&B); // publish to g#prot
pthread_mutex_lock(&B);
}
// locally written g is only in one branch, g == g#prot should be forgotten!
t = g;
assert(t == 17); // UNKNOWN!
pthread_mutex_unlock(&B);
pthread_mutex_unlock(&A);
return 0;
}
|
Support inhert constructors from BaseType | #ifndef __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
#define __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
#include <RTypes.h>
class REvent
{
public:
REvent();
virtual
~REvent();
void
accept();
void
ignore();
bool
isAccepted() const;
void
setAccepted(bool accepted);
virtual rcount
type() const;
static rcount
registerEventType();
private:
bool mIsAccepted;
};
/**
* An easy wrapper template for generate type() method and provide auto
* registered static type variable. So that you could focus on the
* implementation of event class.
*/
template <class DerivedType, class BaseType>
class TypeRegisteredEvent : public BaseType
{
public:
rcount
type() const
{
return sType;
}
static inline rcount
staticType()
{
return sType;
}
private:
static const rcount sType;
};
template <class DerivedType, class BaseType>
const rcount TypeRegisteredEvent<DerivedType,
BaseType>::sType = REvent::registerEventType();
#endif // __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
| #ifndef __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
#define __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
#include <RTypes.h>
class REvent
{
public:
REvent();
virtual
~REvent();
void
accept();
void
ignore();
bool
isAccepted() const;
void
setAccepted(bool accepted);
virtual rcount
type() const;
static rcount
registerEventType();
private:
bool mIsAccepted;
};
/**
* An easy wrapper template for generate type() method and provide auto
* registered static type variable. So that you could focus on the
* implementation of event class.
*/
template <class DerivedType, class BaseType = REvent>
class TypeRegisteredEvent : public BaseType
{
public:
// Inherit all constructors
template <class ... ParamTypes>
TypeRegisteredEvent(ParamTypes ... params)
: BaseType(params ...)
{
}
rcount
type() const
{
return sType;
}
static inline rcount
staticType()
{
return sType;
}
private:
static const rcount sType;
};
template <class DerivedType, class BaseType>
const rcount TypeRegisteredEvent<DerivedType,
BaseType>::sType = REvent::registerEventType();
#endif // __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
|
Allow user to indicate filepaths of taskfiles | #include <stdio.h>
#include <stdlib.h>
#include "src/headers.h"
int main()
{
char* taskfilepath = "D:\\zz_exp\\testinggrounds\\tasks.txt";
task_list* list = gettasks(taskfilepath);
task_list* traveller = list;
while ( traveller != NULL ) {
task_t* task = traveller -> task;
result_t* result = deliver(task);
printf("MESSAGE: %s\n", result -> message);
traveller = traveller -> next;
}
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include "src/headers.h"
int main(int argc, char** argv)
{
for ( int x = 0; x < argc; x++ ) {
char* taskfilepath = argv[x];
task_list* list = gettasks(taskfilepath);
task_list* traveller = list;
while ( traveller != NULL ) {
task_t* task = traveller -> task;
result_t* result = deliver(task);
printf("MESSAGE: %s\n", result -> message);
traveller = traveller -> next;
}
}
return 0;
}
|
Create q6: lower by recursion | #include <stdio.h>
int _findLower(int *vector, int lastIndex, int lowerUntilNow){
if (lastIndex == 0) {
return lowerUntilNow;
} else{
int current = vector[--lastIndex];
lowerUntilNow = (lowerUntilNow < current) ? lowerUntilNow : current;
return _findLower(vector, lastIndex, lowerUntilNow);
}
}
int findLower(int *vector, int size){
int lastValue = vector[size-1];
return _findLower(vector, size, lastValue);
}
int main(){
int vector[] = {10, 5, 2, -9, 8, 4, 9};
printf("%d\n", findLower(vector, 7));
return 0;
}
| |
Fix license header in the export header. | /*
This file is part of the Grantlee template system.
Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 3 only, as published by the Free Software Foundation.
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 version 3 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 GRANTLEE_GUI_EXPORT_H
#define GRANTLEE_GUI_EXPORT_H
#if defined(_WIN32) || defined(_WIN64)
# ifndef GRANTLEE_GUI_EXPORT
# if defined(GRANTLEE_GUI_LIB_MAKEDLL)
# define GRANTLEE_GUI_EXPORT __declspec(dllexport)
# else
# define GRANTLEE_GUI_EXPORT __declspec(dllimport)
# endif
# endif
#else
# define GRANTLEE_GUI_EXPORT __attribute__((visibility("default")))
#endif
#endif
| /*
This file is part of the Grantlee template system.
Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
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 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/>.
*/
#ifndef GRANTLEE_GUI_EXPORT_H
#define GRANTLEE_GUI_EXPORT_H
#if defined(_WIN32) || defined(_WIN64)
# ifndef GRANTLEE_GUI_EXPORT
# if defined(GRANTLEE_GUI_LIB_MAKEDLL)
# define GRANTLEE_GUI_EXPORT __declspec(dllexport)
# else
# define GRANTLEE_GUI_EXPORT __declspec(dllimport)
# endif
# endif
#else
# define GRANTLEE_GUI_EXPORT __attribute__((visibility("default")))
#endif
#endif
|
Fix missing C++ mode comment | //===-- AMDGPUCodeEmitter.h - AMDGPU Code Emitter interface -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// \brief CodeEmitter interface for R600 and SI codegen.
//
//===----------------------------------------------------------------------===//
#ifndef AMDGPUCODEEMITTER_H
#define AMDGPUCODEEMITTER_H
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
class MCInst;
class MCOperand;
class MCSubtargetInfo;
class AMDGPUMCCodeEmitter : public MCCodeEmitter {
virtual void anchor();
public:
uint64_t getBinaryCodeForInstr(const MCInst &MI,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
virtual uint64_t getMachineOpValue(const MCInst &MI, const MCOperand &MO,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
return 0;
}
};
} // End namespace llvm
#endif // AMDGPUCODEEMITTER_H
| //===-- AMDGPUCodeEmitter.h - AMDGPU Code Emitter interface -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// \brief CodeEmitter interface for R600 and SI codegen.
//
//===----------------------------------------------------------------------===//
#ifndef AMDGPUCODEEMITTER_H
#define AMDGPUCODEEMITTER_H
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
class MCInst;
class MCOperand;
class MCSubtargetInfo;
class AMDGPUMCCodeEmitter : public MCCodeEmitter {
virtual void anchor();
public:
uint64_t getBinaryCodeForInstr(const MCInst &MI,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
virtual uint64_t getMachineOpValue(const MCInst &MI, const MCOperand &MO,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
return 0;
}
};
} // End namespace llvm
#endif // AMDGPUCODEEMITTER_H
|
Implement buffer attachment in Stream_New() and Stream_Free() compatibility functions. | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "config.h"
#include "winpr-stream.h"
#include "winpr-wtypes.h"
/*
* NOTE: Because the old API did not support local allocation of the buffer
* for each stream, these compatibility implementations ignore
* the parameters of Stream_New() and Stream_Free() that provide them.
*/
wStream* Stream_New(BYTE* buffer, size_t size) {
return stream_new(size);
}
void Stream_Free(wStream* s, BOOL bFreeBuffer) {
stream_free(s);
}
| /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "config.h"
#include "winpr-stream.h"
#include "winpr-wtypes.h"
wStream* Stream_New(BYTE* buffer, size_t size) {
/* If no buffer is provided, allocate a new stream of the given size */
if (buffer == NULL)
return stream_new(size);
/* Otherwise allocate an empty stream and assign the given buffer */
wStream* stream = stream_new(0);
stream_attach(stream, buffer, size);
return stream;
}
void Stream_Free(wStream* s, BOOL bFreeBuffer) {
/* Disassociate buffer if it will be freed externally */
if (!bFreeBuffer)
stream_detach(s);
stream_free(s);
}
|
Add minimized bench ipmi_devintf fixpoint error test | // PARAM: --enable kernel
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/compat.h>
struct ipmi_file_private
{
struct file *file;
};
static DEFINE_MUTEX(ipmi_mutex);
static int ipmi_open(struct inode *inode, struct file *file)
{
struct ipmi_file_private *priv;
priv = kmalloc(sizeof(*priv), GFP_KERNEL);
mutex_lock(&ipmi_mutex);
priv->file = file; // should reach fixpoint from priv side effect from here
return 0;
}
static const struct file_operations ipmi_fops = {
.open = ipmi_open,
};
static int __init init_ipmi_devintf(void)
{
register_chrdev(0, "ipmidev", &ipmi_fops);
return 0;
}
module_init(init_ipmi_devintf);
| |
Reset motor encoders in pre_auton | /* ======================================================================================================
___________________________________________________________________________________________________
| __ __ ________ __ __ __ ______ __ __ _________ ________ |
| \ \ / / | _____| \ \ / / / \ | _ \ \ \ / / |___ ___| | _____| |
| \ \ / / | |_____ \ \_/ / / /\ \ | |_| / \ \_/ / | | | |_____ |
| \ \ / / | _____| ) _ ( / /__\ \ | _ | \ / | | | _____| |
| \ \/ / | |_____ / / \ \ / ______ \ | |_| \ | | | | | |_____ |
| \__/ |________| /_/ \_\ /_/ \_\ |______/ |_| |_| |________| |
|___________________________________________________________________________________________________|
====================================================================================================== */
void pre_auton()
{
}
task autonomous()
{
}
| /* ======================================================================================================
___________________________________________________________________________________________________
| __ __ ________ __ __ __ ______ __ __ _________ ________ |
| \ \ / / | _____| \ \ / / / \ | _ \ \ \ / / |___ ___| | _____| |
| \ \ / / | |_____ \ \_/ / / /\ \ | |_| / \ \_/ / | | | |_____ |
| \ \ / / | _____| ) _ ( / /__\ \ | _ | \ / | | | _____| |
| \ \/ / | |_____ / / \ \ / ______ \ | |_| \ | | | | | |_____ |
| \__/ |________| /_/ \_\ /_/ \_\ |______/ |_| |_| |________| |
|___________________________________________________________________________________________________|
====================================================================================================== */
static void a_base_encoders_reset(void);
void pre_auton()
{
a_base_encoders_reset();
}
task autonomous()
{
}
static void a_base_encoders_reset()
{
resetMotorEncoder(mBaseFL);
resetMotorEncoder(mBaseFR);
resetMotorEncoder(mBaseBL);
resetMotorEncoder(mBaseBR);
}
|
Update is an abstract base function. | #ifndef ENGINE_RENDER_RENDERSYSTEM_H
#define ENGINE_RENDER_RENDERSYSTEM_H
#include "engine/scene/SceneSystem.h"
#include "engine/UI/UISystem.h"
#include "engine/math/vec3.h"
namespace engine {
namespace render {
/**
* RenderSystem is a parent class for the actual rendering systems.
*
* RenderSystem gets pointers to the sceneSystem and uiSystem and will build the visuals from that.
*/
class RenderSystem : public EngineSystem {
protected:
vec3 cameraPos;
public:
~RenderSystem() {};
vec3 getCameraPos(){
return cameraPos;
}
void setCameraPos(vec3 pos){
cameraPos = pos;
}
};
}
}
#endif
| #ifndef ENGINE_RENDER_RENDERSYSTEM_H
#define ENGINE_RENDER_RENDERSYSTEM_H
#include "engine/scene/SceneSystem.h"
#include "engine/UI/UISystem.h"
#include "engine/math/vec3.h"
namespace engine {
namespace render {
/**
* RenderSystem is a parent class for the actual rendering systems.
*
* RenderSystem gets pointers to the sceneSystem and uiSystem and will build the visuals from that.
*/
class RenderSystem : public EngineSystem {
protected:
vec3 cameraPos;
public:
~RenderSystem() {};
vec3 getCameraPos(){
return cameraPos;
}
void setCameraPos(vec3 pos){
cameraPos = pos;
}
virtual void uninit() = 0;
virtual void update() = 0;
};
}
}
#endif
|
Reset FREEZE to 1 to avoid confusion | /*==================================================================*
| dfltsys.h
| Copyright (c) 1995, Applied Logic Systems, Inc.
|
| -- Default system settings for property tags
|
| Author: Ken Bowen
| Date: 04/10/95
*==================================================================*/
#define BCINTER 1
#define LIBBRK 1
#define SYS_OBP 1
#define HASH 1
#define GENSYM 1
#define OSACCESS 1
#define REXEC 1
#define WINIOBASIS 1
#define XPANDTM 1
#define FSACCESS 1
#define OLDLEXAN 1
#define OLDFIO 1
#define OLDCIO 1
#define OLDCLOAD 1
#define PRIM_DBG 1
#undef OLDCONSULT
#define FREEZE 0
| /*==================================================================*
| dfltsys.h
| Copyright (c) 1995, Applied Logic Systems, Inc.
|
| -- Default system settings for property tags
|
| Author: Ken Bowen
| Date: 04/10/95
*==================================================================*/
#define BCINTER 1
#define LIBBRK 1
#define SYS_OBP 1
#define HASH 1
#define GENSYM 1
#define OSACCESS 1
#define REXEC 1
#define WINIOBASIS 1
#define XPANDTM 1
#define FSACCESS 1
#define OLDLEXAN 1
#define OLDFIO 1
#define OLDCIO 1
#define OLDCLOAD 1
#define PRIM_DBG 1
#undef OLDCONSULT
#define FREEZE 1
|
Extend test-case as requested by Eli | // RUN: %clang_cc1 -std=c11 %s -verify
typedef int type;
typedef type type;
typedef int type;
void f(int N) {
typedef int type2;
typedef type type2;
typedef int type2;
typedef int vla[N]; // expected-note{{previous definition is here}}
typedef int vla[N]; // expected-error{{redefinition of typedef for variably-modified type 'int [N]'}}
}
| // RUN: %clang_cc1 -std=c11 %s -verify
typedef int type;
typedef type type;
typedef int type;
void f(int N) {
typedef int type2;
typedef type type2;
typedef int type2;
typedef int vla[N]; // expected-note{{previous definition is here}}
typedef int vla[N]; // expected-error{{redefinition of typedef for variably-modified type 'int [N]'}}
typedef int vla2[N];
typedef vla2 vla3; // expected-note{{previous definition is here}}
typedef vla2 vla3; // expected-error{{redefinition of typedef for variably-modified type 'vla2' (aka 'int [N]')}}
}
|
Update tests/unboxed-primitive-args: bigarray.h is now in caml/ | /**************************************************************************/
/* */
/* OCaml */
/* */
/* Jeremie Dimino, Jane Street Europe */
/* */
/* Copyright 2015 Institut National de Recherche en Informatique et */
/* en Automatique. */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#include <caml/mlvalues.h>
#include <bigarray.h>
char *ocaml_buffer;
char *c_buffer;
value test_set_buffers(value v_ocaml_buffer, value v_c_buffer)
{
ocaml_buffer = Caml_ba_data_val(v_ocaml_buffer);
c_buffer = Caml_ba_data_val(v_c_buffer);
return Val_unit;
}
value test_cleanup_normal(void)
{
return Val_int(0);
}
double test_cleanup_float(void)
{
return 0.;
}
| /**************************************************************************/
/* */
/* OCaml */
/* */
/* Jeremie Dimino, Jane Street Europe */
/* */
/* Copyright 2015 Institut National de Recherche en Informatique et */
/* en Automatique. */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#include <caml/mlvalues.h>
#include <caml/bigarray.h>
char *ocaml_buffer;
char *c_buffer;
value test_set_buffers(value v_ocaml_buffer, value v_c_buffer)
{
ocaml_buffer = Caml_ba_data_val(v_ocaml_buffer);
c_buffer = Caml_ba_data_val(v_c_buffer);
return Val_unit;
}
value test_cleanup_normal(void)
{
return Val_int(0);
}
double test_cleanup_float(void)
{
return 0.;
}
|
Add in some logs for the MCP9700A | #include "legato.h"
#include "interfaces.h"
#include "mcp970x.h"
static int WpAdcFunction(int32_t *valueUv)
{
return le_adc_ReadValue("EXT_ADC0", valueUv);
}
le_result_t mangOH_ambientTemperature_Read(double *temperature)
{
int32_t tempInt;
int res = mcp970x_read_temperature(MCP970X_CHIP_9700A, WpAdcFunction, &tempInt);
if (res != 0)
{
return LE_FAULT;
}
*temperature = tempInt / 1000.0;
return LE_OK;
}
COMPONENT_INIT
{
}
| #include "legato.h"
#include "interfaces.h"
#include "mcp970x.h"
static int WpAdcFunction(int32_t *valueUv)
{
int32_t valueMv;
le_result_t res = le_adc_ReadValue("EXT_ADC0", &valueMv);
if (res == LE_OK)
{
*valueUv = valueMv * 1000;
}
LE_DEBUG("Read %d uV from the ADC during ambient temperature measurement", *valueUv);
return res;
}
le_result_t mangOH_ambientTemperature_Read(double *temperature)
{
int32_t tempInt;
int res = mcp970x_read_temperature(MCP970X_CHIP_9700A, WpAdcFunction, &tempInt);
if (res != 0)
{
return LE_FAULT;
}
*temperature = tempInt / 1000.0;
LE_DEBUG("Read ambient temperature %f C", *temperature);
return LE_OK;
}
COMPONENT_INIT
{
}
|
Add file that was missing from the last change | /*
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FontSmoothingMode_h
#define FontSmoothingMode_h
namespace WebCore {
enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased };
} // namespace WebCore
#endif // FontSmoothingMode_h
| |
Add missing declaration for start_playlist_scan() | #ifndef _JAPLAY_H_
#define _JAPLAY_H_
#include <stdbool.h> /* bool */
struct song;
struct playlist_entry;
struct playlist;
struct playlist_entry *get_cursor(void);
extern struct playlist *japlay_queue, *japlay_history;
int get_song_info(struct song *song);
struct playlist_entry *add_file_playlist(struct playlist *playlist,
const char *filename);
int add_dir_or_file_playlist(struct playlist *playlist, const char *path);
int load_playlist(struct playlist *playlist, const char *filename);
void japlay_play(void);
void japlay_set_autovol(bool enabled);
void japlay_seek_relative(long msecs);
void japlay_seek(long msecs);
void japlay_stop(void);
void japlay_pause(void);
void japlay_skip(void);
int japlay_init(int *argc, char **argv);
void japlay_exit(void);
#endif
| #ifndef _JAPLAY_H_
#define _JAPLAY_H_
#include <stdbool.h> /* bool */
struct song;
struct playlist_entry;
struct playlist;
struct playlist_entry *get_cursor(void);
extern struct playlist *japlay_queue, *japlay_history;
int get_song_info(struct song *song);
struct playlist_entry *add_file_playlist(struct playlist *playlist,
const char *filename);
int add_dir_or_file_playlist(struct playlist *playlist, const char *path);
int load_playlist(struct playlist *playlist, const char *filename);
void start_playlist_scan(void);
void japlay_play(void);
void japlay_set_autovol(bool enabled);
void japlay_seek_relative(long msecs);
void japlay_seek(long msecs);
void japlay_stop(void);
void japlay_pause(void);
void japlay_skip(void);
int japlay_init(int *argc, char **argv);
void japlay_exit(void);
#endif
|
Change to new name atStr.h. |
#ifndef AT_OS_DEFS_H
#define AT_OS_DEFS_H
// Include the window files if this is the windows version.
#ifdef _MSC_VER
#include <windows.h>
#endif
// Include other files to give OS-independent interfaces
#include "atSleep.h"
#include "atStrCaseCmp.h"
#include "atSymbols.h"
#include "atTime.h"
#endif
|
#ifndef AT_OS_DEFS_H
#define AT_OS_DEFS_H
// Include the window files if this is the windows version.
#ifdef _MSC_VER
#include <windows.h>
#endif
// Include other files to give OS-independent interfaces
#include "atSleep.h"
#include "atStr.h"
#include "atSymbols.h"
#include "atTime.h"
#endif
|
Update expect_never -> never_expect in doc | #include <cgreen/cgreen.h>
#include <cgreen/mocks.h>
static int reader(void *stream) {
return (int)mock(stream);
}
static void writer(void *stream, char *paragraph) {
mock(stream, paragraph);
}
char *read_paragraph(int (*read)(void *), void *stream);
void by_paragraph(int (*read)(void *), void *in, void (*write)(void *, char *), void *out) {
while (1) {
char *line = read_paragraph(read, in);
if ((line == NULL) || (strlen(line) == 0)) {
return;
}
(*write)(out, line);
free(line);
}
}
static int stub_stream(void *stream) {
return (int)mock(stream);
}
static void update_counter(void * counter) {
*(int*)counter = *(int*)counter + 1;
}
Ensure(using_side_effect) {
int number_of_times_reader_was_called = 0;
expect(reader, will_return('\n'));
always_expect(reader,
will_return(EOF),
with_side_effect(&update_counter,
&number_of_times_reader_was_called));
expect_never(writer);
by_paragraph(&reader, NULL, &writer, NULL);
assert_that(number_of_times_reader_was_called, is_equal_to(1));
}
| #include <cgreen/cgreen.h>
#include <cgreen/mocks.h>
static int reader(void *stream) {
return (int)mock(stream);
}
static void writer(void *stream, char *paragraph) {
mock(stream, paragraph);
}
char *read_paragraph(int (*read)(void *), void *stream);
void by_paragraph(int (*read)(void *), void *in, void (*write)(void *, char *), void *out) {
while (1) {
char *line = read_paragraph(read, in);
if ((line == NULL) || (strlen(line) == 0)) {
return;
}
(*write)(out, line);
free(line);
}
}
static int stub_stream(void *stream) {
return (int)mock(stream);
}
static void update_counter(void * counter) {
*(int*)counter = *(int*)counter + 1;
}
Ensure(using_side_effect) {
int number_of_times_reader_was_called = 0;
expect(reader, will_return('\n'));
always_expect(reader,
will_return(EOF),
with_side_effect(&update_counter,
&number_of_times_reader_was_called));
never_expect(writer);
by_paragraph(&reader, NULL, &writer, NULL);
assert_that(number_of_times_reader_was_called, is_equal_to(1));
}
|
Mark ContiguousMemoryRange::size as const. am: f2c28cd765 am: 1b5ab79b0b am: 69614c4761 am: e447d8a1c2 am: b0149a850e | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
#define INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
namespace protozero {
// Keep this struct trivially constructible (no ctors, no default initializers).
struct ContiguousMemoryRange {
uint8_t* begin;
uint8_t* end; // STL style: one byte past the end of the buffer.
inline bool is_valid() const { return begin != nullptr; }
inline void reset() { begin = nullptr; }
inline size_t size() { return static_cast<size_t>(end - begin); }
};
} // namespace protozero
#endif // INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
| /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
#define INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
namespace protozero {
// Keep this struct trivially constructible (no ctors, no default initializers).
struct ContiguousMemoryRange {
uint8_t* begin;
uint8_t* end; // STL style: one byte past the end of the buffer.
inline bool is_valid() const { return begin != nullptr; }
inline void reset() { begin = nullptr; }
inline size_t size() const { return static_cast<size_t>(end - begin); }
};
} // namespace protozero
#endif // INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
|
Add header for importing entire library | /**
@file
@brief Import the entire library
Use of this source code is governed by a BSD-style license that can be found in
the LICENSE file.
*/
#include "core/basis.h"
#include "core/evaluate.h"
#include "core/check.h"
#include "core/modify.h"
#include "geometry/curve.h"
#include "geometry/surface.h"
#include "io/obj.h"
| |
Add text to static card data | #ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H
#include <string>
#include "CardType.h"
namespace ygo
{
namespace data
{
struct StaticCardData
{
std::string name;
CardType cardType;
// monster only
Attribute attribute;
MonsterType monsterType;
Type type;
MonsterType monsterAbility;
int level;
int attack;
int defense;
int lpendulum;
int rpendulum;
// spell and trap only
SpellType spellType;
TrapType trapType;
};
}
}
#endif
| #ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H
#include <string>
#include "CardType.h"
namespace ygo
{
namespace data
{
struct StaticCardData
{
std::string name;
CardType cardType;
// monster only
Attribute attribute;
MonsterType monsterType;
Type type;
MonsterType monsterAbility;
int level;
int attack;
int defense;
int lpendulum;
int rpendulum;
// spell and trap only
SpellType spellType;
TrapType trapType;
std::string text;
};
}
}
#endif
|
Change the variable name for more meaningful. | #include "sys/select.h"
#include "bits/mac_esp8266.h"
#include <stdio.h>
#include "usart.h"
int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds,
fd_set *__exceptfds, struct timeval *__timeout) {
SOCKET i;
int c;
c = 0;
/* Go through interested sockets. */
for(i = SOCKET_BASE; i < nfds; i++) {
if((__readfds != NULL) && FD_ISSET(i, __readfds)) {
if(IsSocketReady2Read(i)) {
/* The interested socket is ready to be read. */
c++;
}
else {
/* The interested socket is not ready to be read. */
FD_CLR(i, __readfds);
}
}
if((__writefds != NULL) && FD_ISSET(i, __writefds)) {
if(IsSocketReady2Write(i)) {
/* The interested socket is ready to be written. */
c++;
}
else {
/* The interested socket is not ready to be written. */
FD_CLR(i, __writefds);
}
}
if((__exceptfds != NULL) && FD_ISSET(i, __exceptfds)) {
// To do: List exception sockets.
/* Zero __exceptfds for now. */
FD_ZERO(__exceptfds);
}
}
return c;
}
| #include "sys/select.h"
#include "bits/mac_esp8266.h"
#include <stdio.h>
#include "usart.h"
int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds,
fd_set *__exceptfds, struct timeval *__timeout) {
SOCKET i;
/* Count the ready socket. */
int count;
count = 0;
/* Go through interested sockets. */
for(i = SOCKET_BASE; i < nfds; i++) {
if((__readfds != NULL) && FD_ISSET(i, __readfds)) {
if(IsSocketReady2Read(i)) {
/* The interested socket is ready to be read. */
count++;
}
else {
/* The interested socket is not ready to be read. */
FD_CLR(i, __readfds);
}
}
if((__writefds != NULL) && FD_ISSET(i, __writefds)) {
if(IsSocketReady2Write(i)) {
/* The interested socket is ready to be written. */
count++;
}
else {
/* The interested socket is not ready to be written. */
FD_CLR(i, __writefds);
}
}
if((__exceptfds != NULL) && FD_ISSET(i, __exceptfds)) {
// To do: List exception sockets.
/* Zero __exceptfds for now. */
FD_ZERO(__exceptfds);
}
}
return count;
}
|
Add missing file from previous commit. | /*
* libopensync - A synchronization framework
* Copyright (C) 2008 Daniel Gollub <dgollub@suse.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_
#define _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_
/*! @brief OSyncPluginConnectionType String Map
*
* @ingroup OSyncPluginConnectionInternalsAPI
**/
typedef struct {
OSyncPluginConnectionType type;
const char *string;
} OSyncPluginConnectionTypeString;
const char *osync_plugin_connection_get_type_string(OSyncPluginConnectionType conn_type);
#endif /*_OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_*/
| |
Fix typo in data structure | /**@file
Setup Variable data structure for Unix platform.
Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __UNIX_SYSTEM_CONFIGUE_H__
#define __UNIX_SYSTEM_CONFIGUE_H__
#define EFI_UXIX_SYSTEM_CONFIG_GUID \
{0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}
#pragma pack(1)
typedef struct {
//
// Console output mode
//
UINT32 ConOutColumn;
UINT32 ConOutRow;
} WIN_NT_SYSTEM_CONFIGURATION;
#pragma pack()
extern EFI_GUID gEfiUnixSystemConfigGuid;
#endif
| /**@file
Setup Variable data structure for Unix platform.
Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __UNIX_SYSTEM_CONFIGUE_H__
#define __UNIX_SYSTEM_CONFIGUE_H__
#define EFI_UXIX_SYSTEM_CONFIG_GUID \
{0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}
#pragma pack(1)
typedef struct {
//
// Console output mode
//
UINT32 ConOutColumn;
UINT32 ConOutRow;
} UNIX_SYSTEM_CONFIGURATION;
#pragma pack()
extern EFI_GUID gEfiUnixSystemConfigGuid;
#endif
|
Return the sorted object as well as sort it in-place | #include <iostream>
#include <vector>
#include <stdlib.h>
template <typename T>
void swap(T& a, T& b) {
T tmp = b;
b = a;
a = tmp;
}
template <typename T>
void bubblesort(T& vec) {
auto f = vec.begin();
auto s = vec.begin();
++s;
bool swapped = false;
while (s != vec.end()) {
if (*f > *s) {
swap(*f, *s);
swapped = true;
}
++f; ++s;
}
if (swapped) {
bubblesort(vec);
}
}
| #include <iostream>
#include <vector>
#include <stdlib.h>
template <typename T>
void swap(T& a, T& b) {
T tmp = b;
b = a;
a = tmp;
}
template <typename T>
T bubblesort(T& vec) {
auto f = vec.begin();
auto s = vec.begin();
++s;
bool swapped = false;
while (s != vec.end()) {
if (*f > *s) {
swap(*f, *s);
swapped = true;
}
++f; ++s;
}
if (swapped) {
bubblesort(vec);
}
return vec;
}
|
Add graphics module and drawable interface | #pragma once
#include <SFML/Graphics.hpp>
class DrawableInterface {
public:
virtual ~DrawableInterface() {}
virtual void draw(sf::RenderWindow *window) = 0;
};
| |
Allow methods called inside MakeAlObjsArray to modify data members | #ifndef ALI_MISALIGNER_H
#define ALI_MISALIGNER_H
#include "TObject.h"
#include "TString.h"
#include "AliCDBMetaData.h"
class TClonesArray;
class AliCDBManager;
// Base class for creating a TClonesArray of simulated misalignment objects
// for a given subdetector of type ideal,residual or full
//
class AliMisAligner : public TObject {
public:
AliMisAligner();
virtual TClonesArray* MakeAlObjsArray() const =0;
virtual AliCDBMetaData* GetCDBMetaData() const =0;
void SetMisalType(const char* misalType)
{
fMisalType=misalType;
}
const char* GetMisalType() const
{
return fMisalType.Data();
}
protected:
TString fMisalType;
private:
ClassDef(AliMisAligner,0);
};
#endif
| #ifndef ALI_MISALIGNER_H
#define ALI_MISALIGNER_H
#include "TObject.h"
#include "TString.h"
#include "AliCDBMetaData.h"
class TClonesArray;
class AliCDBManager;
// Base class for creating a TClonesArray of simulated misalignment objects
// for a given subdetector of type ideal,residual or full
//
class AliMisAligner : public TObject {
public:
AliMisAligner();
virtual TClonesArray* MakeAlObjsArray() =0;
virtual AliCDBMetaData* GetCDBMetaData() const =0;
void SetMisalType(const char* misalType)
{
fMisalType=misalType;
}
const char* GetMisalType() const
{
return fMisalType.Data();
}
protected:
TString fMisalType;
private:
ClassDef(AliMisAligner,0);
};
#endif
|
Use tlog for MSG reports. | #ifndef __DEBUG_H
#define __DEBUG_H
#ifdef DEBUG
extern bool debug;
extern bool debug_z;
#define DBG if (debug)
#define MSG(x) DBG msg x
#else
#define DBG if (0)
#define MSG(x)
#endif
#if defined(DEBUG) || defined(PRECON)
#define PRECONDITION(x) if (x); else precondition( #x , __FILE__, __LINE__)
#else
#define PRECONDITION(x) // nothing
#endif
#endif
| #ifndef __DEBUG_H
#define __DEBUG_H
#ifdef DEBUG
extern bool debug;
extern bool debug_z;
#define DBG if (debug)
#define MSG(x) DBG tlog x
#else
#define DBG if (0)
#define MSG(x)
#endif
#if defined(DEBUG) || defined(PRECON)
#define PRECONDITION(x) if (x); else precondition( #x , __FILE__, __LINE__)
#else
#define PRECONDITION(x) // nothing
#endif
#endif
|
Fix an "conversion, loss of data" compiler warning | #ifndef INCLUDE_revwalk_h__
#define INCLUDE_revwalk_h__
#include "git/common.h"
#include "git/revwalk.h"
struct git_revpool {
git_odb *db;
git_commit_list iterator;
git_commit *(*next_commit)(git_commit_list *);
git_commit_list roots;
git_revpool_table *commits;
unsigned walking:1;
unsigned char sorting;
};
void gitrp__prepare_walk(git_revpool *pool);
int gitrp__enroot(git_revpool *pool, git_commit *commit);
#endif /* INCLUDE_revwalk_h__ */
| #ifndef INCLUDE_revwalk_h__
#define INCLUDE_revwalk_h__
#include "git/common.h"
#include "git/revwalk.h"
struct git_revpool {
git_odb *db;
git_commit_list iterator;
git_commit *(*next_commit)(git_commit_list *);
git_commit_list roots;
git_revpool_table *commits;
unsigned walking:1;
unsigned int sorting;
};
void gitrp__prepare_walk(git_revpool *pool);
int gitrp__enroot(git_revpool *pool, git_commit *commit);
#endif /* INCLUDE_revwalk_h__ */
|
Fix skip grammar of query parser. | #ifndef VAST_QUERY_PARSER_SKIPPER_H
#define VAST_QUERY_PARSER_SKIPPER_H
#include <boost/spirit/include/qi.hpp>
namespace vast {
namespace query {
namespace parser {
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
template <typename Iterator>
struct skipper : qi::grammar<Iterator>
{
skipper()
: skipper::base_type(start)
{
qi::char_type char_;
ascii::space_type space;
start =
char_ // Tab, space, CR, LF
| "/*" >> *(space - "*/") >> "*/" // C-style comments
;
}
qi::rule<Iterator> start;
};
} // namespace ast
} // namespace query
} // namespace vast
#endif
| #ifndef VAST_QUERY_PARSER_SKIPPER_H
#define VAST_QUERY_PARSER_SKIPPER_H
#include <boost/spirit/include/qi.hpp>
namespace vast {
namespace query {
namespace parser {
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
template <typename Iterator>
struct skipper : qi::grammar<Iterator>
{
skipper()
: skipper::base_type(start)
{
qi::char_type char_;
ascii::space_type space;
start =
space // Tab, space, CR, LF
| "/*" >> *(char_ - "*/") >> "*/" // C-style comments
;
}
qi::rule<Iterator> start;
};
} // namespace ast
} // namespace query
} // namespace vast
#endif
|
Add coil variables to type definitions | #define _SLAVETYPES
#include <inttypes.h>
//Declarations for slave types
typedef struct
{
uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
uint8_t *Frame; //Response frame content
} MODBUSResponseStatus; //Type containing information about frame that is set up at slave side
typedef struct
{
uint8_t Address; //Slave address
uint16_t *Registers; //Slave holding registers
uint16_t RegisterCount; //Slave register count
uint8_t *RegisterMask; //Masks for write protection (bit of value 1 - write protection)
uint16_t RegisterMaskLength; //Masks length (each mask covers 8 registers)
MODBUSResponseStatus Response; //Slave response formatting status
} MODBUSSlaveStatus; //Type containing slave device configuration data
| #define _SLAVETYPES
#include <inttypes.h>
//Declarations for slave types
typedef struct
{
uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
uint8_t *Frame; //Response frame content
} MODBUSResponseStatus; //Type containing information about frame that is set up at slave side
typedef struct
{
uint8_t Address; //Slave address
uint16_t *Registers; //Slave holding registers
uint16_t RegisterCount; //Slave register count
uint8_t *Coils; //Slave coils
uint16_t CoilCount; //Slave coil count
uint8_t *RegisterMask; //Masks for write protection (bit of value 1 - write protection)
uint16_t RegisterMaskLength; //Masks length (each mask covers 8 registers)
MODBUSResponseStatus Response; //Slave response formatting status
} MODBUSSlaveStatus; //Type containing slave device configuration data
|
Fix up the header names as several are not correct | #ifndef MIT_Mobile_MITAdditions_h
#define MIT_Mobile_MITAdditions_h
#import "Foundations+MITAdditions.h"
#import "UIKit+MITAdditions.h"
#import "CoreLocation+MITAdditions.h"
#import "UIImage+Resize.h"
#import "NSDateFormatter+RelativeString.h"
#import "MFMailComposeController+RFC2368.h"
#import "NSData+MGTwitterBase64.h"
#import "NSMutableAttributedString+MITAdditions.h"
#endif
| #ifndef MIT_Mobile_MITAdditions_h
#define MIT_Mobile_MITAdditions_h
#import "Foundation+MITAdditions.h"
#import "UIKit+MITAdditions.h"
#import "CoreLocation+MITAdditions.h"
#import "UIImage+Resize.h"
#import "NSDateFormatter+RelativeString.h"
#import "MFMailComposeViewController+RFC2368.h"
#import "NSData+MGTwitterBase64.h"
#import "NSMutableAttributedString+MITAdditions.h"
#endif
|
Add Task 01 for Homework 01 | #include <stdio.h>
#include <string.h>
long hash(char*);
int main() {
char word[200];
fgets(word, 201, stdin);
printf("%ld", hash(word));
return 0;
}
long hash(char *word) {
long result = 42;
int length = strlen(word);
for (int i = 0; i < length; i++) {
result += word[i] * (i + 1);
}
return result;
} | |
Add some interpretations to ausearch for syscall parameters |
/* socktypetab.h --
* Copyright 2012 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors:
* Steve Grubb <sgrubb@redhat.com>
*/
_S(1, "SOCK_STREAM")
_S(2, "SOCK_DGRAM")
_S(3, "SOCK_RAW")
_S(4, "SOCK_RDM")
_S(5, "SOCK_SEQPACKET")
_S(6, "SOCK_DCCP")
_S(10, "SOCK_PACKET")
| |
Fix trier -> def_exc in observer test comment | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
int main()
{
int x, y;
if (__VERIFIER_nondet_int())
{
x = 0;
y = 1;
}
else
{
x = 1;
y = 0;
}
// if (!(x + y == 1))
if (x + y != 1)
__VERIFIER_error();
return 0;
}
// ./goblint --enable ana.sv-comp --enable ana.wp --enable exp.uncilwitness --disable ana.int.trier --enable ana.int.interval --set ana.activated '["base"]' --set phases '[{}, {"ana": {"activated": ["base", "observer"], "path_sens": ["observer"]}}]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
int main()
{
int x, y;
if (__VERIFIER_nondet_int())
{
x = 0;
y = 1;
}
else
{
x = 1;
y = 0;
}
// if (!(x + y == 1))
if (x + y != 1)
__VERIFIER_error();
return 0;
}
// ./goblint --enable ana.sv-comp --enable ana.wp --enable exp.uncilwitness --disable ana.int.def_exc --enable ana.int.interval --set ana.activated '["base"]' --set phases '[{}, {"ana": {"activated": ["base", "observer"], "path_sens": ["observer"]}}]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c |
Add test for function declarations |
int f(int a), g(int a), a;
int
main()
{
return f(1) - g(1);
}
int
f(int a)
{
return a;
}
int
g(int a)
{
return a;
}
| |
Add vector to keep track of controls | #pragma once
#include <Windows.h>
#include <vector>
class UIContext;
/// <summary>
/// Abstract class that encapsulates functionality for dealing with
/// property sheet pages (tabs).
/// </summary>
class Tab {
public:
Tab();
~Tab();
/// <summary>Processes messages sent to the tab page.</summary>
virtual DLGPROC TabProc(
HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
/// <summary>Persists changes made on the tab page</summary>
virtual void SaveSettings() = 0;
protected:
HWND _hWnd;
UIContext *_ctxt;
/// <summary>
/// Performs intitialization for the tab page, similar to a constructor.
/// Since tab page windows are created on demand, this method could be
/// called much later than the constructor for the tab.
/// </summary>
virtual void Initialize() = 0;
/// <summary>Applies the current settings state to the tab page.</summary>
virtual void LoadSettings() = 0;
/// <summary>Handles WM_COMMAND messages.</summary>
/// <param name="nCode">Control-defined notification code</param>
/// <param name="ctrlId">Control identifier</param>
virtual DLGPROC Command(unsigned short nCode, unsigned short ctrlId) = 0;
/// <summary>Handles WM_NOTIFY messages.</summary>
/// <param name="nHdr">Notification header structure</param>
virtual DLGPROC Notification(NMHDR *nHdr) = 0;
}; | #pragma once
#include <Windows.h>
#include <vector>
#include "Control.h"
class UIContext;
/// <summary>
/// Abstract class that encapsulates functionality for dealing with
/// property sheet pages (tabs).
/// </summary>
class Tab {
public:
Tab();
~Tab();
/// <summary>Processes messages sent to the tab page.</summary>
virtual DLGPROC TabProc(
HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
/// <summary>Persists changes made on the tab page</summary>
virtual void SaveSettings() = 0;
protected:
/// <summary>Window handle of this tab.</summary>
HWND _hWnd;
UIContext *_ctxt;
/// <summary>A vector of all the controls present on this tab.</summary>
std::vector<Control *> _controls;
/// <summary>
/// Performs intitialization for the tab page, similar to a constructor.
/// Since tab page windows are created on demand, this method could be
/// called much later than the constructor for the tab.
/// </summary>
virtual void Initialize() = 0;
/// <summary>Applies the current settings state to the tab page.</summary>
virtual void LoadSettings() = 0;
/// <summary>Handles WM_COMMAND messages.</summary>
/// <param name="nCode">Control-defined notification code</param>
/// <param name="ctrlId">Control identifier</param>
virtual DLGPROC Command(unsigned short nCode, unsigned short ctrlId) = 0;
/// <summary>Handles WM_NOTIFY messages.</summary>
/// <param name="nHdr">Notification header structure</param>
virtual DLGPROC Notification(NMHDR *nHdr) = 0;
}; |
Add timeout handling with Glib support | /*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2014 Intel Corporation. All rights reserved.
*
*
* 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.
*
*/
#include "timeout.h"
#include <glib.h>
struct timeout_data {
timeout_func_t func;
timeout_destroy_func_t destroy;
void *user_data;
};
static gboolean timeout_callback(gpointer user_data)
{
struct timeout_data *data = user_data;
if (data->func(data->user_data))
return TRUE;
return FALSE;
}
static void timeout_destroy(gpointer user_data)
{
struct timeout_data *data = user_data;
if (data->destroy)
data->destroy(data->user_data);
g_free(data);
}
int timeout_add(unsigned int ms, timeout_func_t func, void *user_data,
timeout_destroy_func_t destroy)
{
guint id;
struct timeout_data *data = g_malloc0(sizeof(*data));
data->func = func;
data->destroy = destroy;
data->user_data = user_data;
id = g_timeout_add_full(G_PRIORITY_DEFAULT, ms, timeout_callback, data,
timeout_destroy);
if (!id)
g_free(data);
return id;
}
void timeout_remove(unsigned int id)
{
GSource *source = g_main_context_find_source_by_id(NULL, id);
if (source)
g_source_destroy(source);
}
| |
Update SPI flash config for cache change. | #include "storage.h"
// External SPI flash uses standard SPI interface
const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
.sck = MICROPY_HW_SPIFLASH_SCK,
.mosi = MICROPY_HW_SPIFLASH_MOSI,
.miso = MICROPY_HW_SPIFLASH_MISO,
};
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
.bus.u_spi.cs = MICROPY_HW_SPIFLASH_CS,
.bus.u_spi.data = (void*)&soft_spi_bus,
.bus.u_spi.proto = &mp_soft_spi_proto,
};
spi_bdev_t spi_bdev;
| #include "storage.h"
// External SPI flash uses standard SPI interface
STATIC const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
.sck = MICROPY_HW_SPIFLASH_SCK,
.mosi = MICROPY_HW_SPIFLASH_MOSI,
.miso = MICROPY_HW_SPIFLASH_MISO,
};
STATIC mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
.bus.u_spi.cs = MICROPY_HW_SPIFLASH_CS,
.bus.u_spi.data = (void*)&soft_spi_bus,
.bus.u_spi.proto = &mp_soft_spi_proto,
.cache = &spi_bdev_cache,
};
spi_bdev_t spi_bdev;
|
Disable mmap allocator when running under address sanitizer | /* Copyright (c) 2013-2014 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <mgba-util/memory.h>
#include <sys/mman.h>
void* anonymousMemoryMap(size_t size) {
return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
}
void mappedMemoryFree(void* memory, size_t size) {
munmap(memory, size);
}
| /* Copyright (c) 2013-2014 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <mgba-util/memory.h>
#ifndef DISABLE_ANON_MMAP
#ifdef __SANITIZE_ADDRESS__
#define DISABLE_ANON_MMAP
#elif defined(__has_feature)
#if __has_feature(address_sanitizer)
#define DISABLE_ANON_MMAP
#endif
#endif
#endif
#ifndef DISABLE_ANON_MMAP
#include <sys/mman.h>
void* anonymousMemoryMap(size_t size) {
return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
}
void mappedMemoryFree(void* memory, size_t size) {
munmap(memory, size);
}
#else
void* anonymousMemoryMap(size_t size) {
return calloc(1, size);
}
void mappedMemoryFree(void* memory, size_t size) {
UNUSED(size);
free(memory);
}
#endif
|
Fix compile error: comma at end of enumerator list. | //===--- TypeTraits.h - C++ Type Traits Support Enumerations ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines enumerations for the type traits support.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TYPETRAITS_H
#define LLVM_CLANG_TYPETRAITS_H
namespace clang {
/// UnaryTypeTrait - Names for the unary type traits.
enum UnaryTypeTrait {
UTT_HasNothrowAssign,
UTT_HasNothrowCopy,
UTT_HasNothrowConstructor,
UTT_HasTrivialAssign,
UTT_HasTrivialCopy,
UTT_HasTrivialConstructor,
UTT_HasTrivialDestructor,
UTT_HasVirtualDestructor,
UTT_IsAbstract,
UTT_IsClass,
UTT_IsEmpty,
UTT_IsEnum,
UTT_IsPOD,
UTT_IsPolymorphic,
UTT_IsUnion,
UTT_IsLiteral
};
/// BinaryTypeTrait - Names for the binary type traits.
enum BinaryTypeTrait {
BTT_IsBaseOf,
};
}
#endif
| //===--- TypeTraits.h - C++ Type Traits Support Enumerations ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines enumerations for the type traits support.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TYPETRAITS_H
#define LLVM_CLANG_TYPETRAITS_H
namespace clang {
/// UnaryTypeTrait - Names for the unary type traits.
enum UnaryTypeTrait {
UTT_HasNothrowAssign,
UTT_HasNothrowCopy,
UTT_HasNothrowConstructor,
UTT_HasTrivialAssign,
UTT_HasTrivialCopy,
UTT_HasTrivialConstructor,
UTT_HasTrivialDestructor,
UTT_HasVirtualDestructor,
UTT_IsAbstract,
UTT_IsClass,
UTT_IsEmpty,
UTT_IsEnum,
UTT_IsPOD,
UTT_IsPolymorphic,
UTT_IsUnion,
UTT_IsLiteral
};
/// BinaryTypeTrait - Names for the binary type traits.
enum BinaryTypeTrait {
BTT_IsBaseOf
};
}
#endif
|
Make a test compatible with r300508 | // RUN: %clang_cc1 -fsanitize=null -emit-llvm %s -o - | FileCheck %s
struct A {
int a[2];
int b;
};
// CHECK-LABEL: @f1
int *f1() {
// CHECK-NOT: __ubsan_handle_type_mismatch
// CHECK: ret
// CHECK-SAME: getelementptr inbounds (%struct.A, %struct.A* null, i32 0, i32 1)
return &((struct A *)0)->b;
}
// CHECK-LABEL: @f2
int f2() {
// CHECK: __ubsan_handle_type_mismatch
// CHECK: load
// CHECK-SAME: getelementptr inbounds (%struct.A, %struct.A* null, i32 0, i32 1)
// CHECK: ret
return ((struct A *)0)->b;
}
| // RUN: %clang_cc1 -fsanitize=null -emit-llvm %s -o - | FileCheck %s
struct A {
int a[2];
int b;
};
// CHECK-LABEL: @f1
int *f1() {
// CHECK-NOT: __ubsan_handle_type_mismatch
// CHECK: ret
// CHECK-SAME: getelementptr inbounds (%struct.A, %struct.A* null, i32 0, i32 1)
return &((struct A *)0)->b;
}
|
Rename actor/target to x/y to allow for shifting | #include <stdio.h>
typedef struct {
int hands[2][2];
int turn;
} Sticks;
void sticks_create(Sticks *sticks) {
sticks->hands[0][0] = 1;
sticks->hands[0][1] = 1;
sticks->hands[1][0] = 1;
sticks->hands[1][1] = 1;
sticks->turn = 0;
}
void sticks_play(Sticks *sticks, int actor, int target) {
sticks->hands[!sticks->turn][target] += sticks->hands[sticks->turn][actor];
if (sticks->hands[!sticks->turn][target] >= 5) {
sticks->hands[!sticks->turn][target] = 0;
}
sticks->turn = !sticks->turn;
}
int main(void) {
Sticks sticks;
sticks_create(&sticks);
printf("%d\n", sticks.hands[0][0]);
printf("%d\n", sticks.turn);
sticks_play(&sticks, 0, 1);
printf("%d\n", sticks.hands[1][1]);
printf("%d\n", sticks.turn);
}
| #include <stdio.h>
typedef struct {
int hands[2][2];
int turn;
} Sticks;
void sticks_create(Sticks *sticks) {
sticks->hands[0][0] = 1;
sticks->hands[0][1] = 1;
sticks->hands[1][0] = 1;
sticks->hands[1][1] = 1;
sticks->turn = 0;
}
void sticks_play(Sticks *sticks, int x, int y) {
sticks->hands[!sticks->turn][y] += sticks->hands[sticks->turn][x];
if (sticks->hands[!sticks->turn][y] >= 5) {
sticks->hands[!sticks->turn][y] = 0;
}
sticks->turn = !sticks->turn;
}
int main(void) {
Sticks sticks;
sticks_create(&sticks);
printf("%d\n", sticks.hands[0][0]);
printf("%d\n", sticks.turn);
sticks_play(&sticks, 0, 1);
printf("%d\n", sticks.hands[1][1]);
printf("%d\n", sticks.turn);
}
|
Add a private header file for libc/libc_r/libpthread to contain definitions for things like locking etc. | /*
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by John Birrell.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*
* Private definitions for libc, libc_r and libpthread.
*
*/
#ifndef _LIBC_PRIVATE_H_
#define _LIBC_PRIVATE_H_
/*
* This global flag is non-zero when a process has created one
* or more threads. It is used to avoid calling locking functions
* when they are not required.
*/
extern int __isthreaded;
/*
* File lock contention is difficult to diagnose without knowing
* where locks were set. Allow a debug library to be built which
* records the source file and line number of each lock call.
*/
#ifdef _FLOCK_DEBUG
#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__)
#else
#define _FLOCKFILE(x) _flockfile(x)
#endif
/*
* Macros for locking and unlocking FILEs. These test if the
* process is threaded to avoid locking when not required.
*/
#define FLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp)
#define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp)
#endif /* _LIBC_PRIVATE_H_ */
| |
Include config.h so it can define const away for K&R. | #include <stdio.h>
#ifndef DATE
#ifdef __DATE__
#define DATE __DATE__
#else
#define DATE "xx/xx/xx"
#endif
#endif
#ifndef TIME
#ifdef __TIME__
#define TIME __TIME__
#else
#define TIME "xx:xx:xx"
#endif
#endif
#ifndef BUILD
#define BUILD 0
#endif
const char *
Py_GetBuildInfo()
{
static char buildinfo[40];
sprintf(buildinfo, "#%d, %.12s, %.8s", BUILD, DATE, TIME);
return buildinfo;
}
| #include "config.h"
#include <stdio.h>
#ifndef DATE
#ifdef __DATE__
#define DATE __DATE__
#else
#define DATE "xx/xx/xx"
#endif
#endif
#ifndef TIME
#ifdef __TIME__
#define TIME __TIME__
#else
#define TIME "xx:xx:xx"
#endif
#endif
#ifndef BUILD
#define BUILD 0
#endif
const char *
Py_GetBuildInfo()
{
static char buildinfo[40];
sprintf(buildinfo, "#%d, %.12s, %.8s", BUILD, DATE, TIME);
return buildinfo;
}
|
Add default constructors to vectors | #ifndef TE_TYPES_H
#define TE_TYPES_H
namespace te
{
struct Vector2f
{
float x;
float y;
Vector2f(float x, float y);
Vector2f operator+(Vector2f o);
Vector2f operator-(Vector2f o);
};
struct Vector2i
{
int x;
int y;
Vector2i(int x, int y);
Vector2i operator+(Vector2i o);
Vector2i operator-(Vector2i o);
};
}
#endif
| #ifndef TE_TYPES_H
#define TE_TYPES_H
namespace te
{
struct Vector2f
{
float x;
float y;
Vector2f(float x = 0, float y = 0);
Vector2f operator+(Vector2f o);
Vector2f operator-(Vector2f o);
};
struct Vector2i
{
int x;
int y;
Vector2i(int x = 0, int y = 0);
Vector2i operator+(Vector2i o);
Vector2i operator-(Vector2i o);
};
}
#endif
|
Comment out this method, it does nothing right now | //
// DCTOAuthAccount.h
// DTOAuth
//
// Created by Daniel Tull on 09.07.2010.
// Copyright 2010 Daniel Tull. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DCTOAuthAccount : NSObject
+ (DCTOAuthAccount *)OAuthAccountWithType:(NSString *)type
requestTokenURL:(NSURL *)requestTokenURL
authorizeURL:(NSURL *)authorizeURL
accessTokenURL:(NSURL *)accessTokenURL
consumerKey:(NSString *)consumerKey
consumerSecret:(NSString *)consumerSecret;
+ (DCTOAuthAccount *)OAuth2AccountWithType:(NSString *)type
authorizeURL:(NSURL *)authorizeURL
accessTokenURL:(NSURL *)accessTokenURL
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
scopes:(NSArray *)scopes;
@property (nonatomic, readonly) NSString *type;
@property (nonatomic, readonly) NSString *identifier;
@property (nonatomic, copy) NSURL *callbackURL;
- (void)authenticateWithHandler:(void(^)(NSDictionary *returnedValues))handler;
- (void)renewCredentialsWithHandler:(void(^)(BOOL success, NSError *error))handler;
@end
| //
// DCTOAuthAccount.h
// DTOAuth
//
// Created by Daniel Tull on 09.07.2010.
// Copyright 2010 Daniel Tull. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DCTOAuthAccount : NSObject
+ (DCTOAuthAccount *)OAuthAccountWithType:(NSString *)type
requestTokenURL:(NSURL *)requestTokenURL
authorizeURL:(NSURL *)authorizeURL
accessTokenURL:(NSURL *)accessTokenURL
consumerKey:(NSString *)consumerKey
consumerSecret:(NSString *)consumerSecret;
+ (DCTOAuthAccount *)OAuth2AccountWithType:(NSString *)type
authorizeURL:(NSURL *)authorizeURL
accessTokenURL:(NSURL *)accessTokenURL
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
scopes:(NSArray *)scopes;
@property (nonatomic, readonly) NSString *type;
@property (nonatomic, readonly) NSString *identifier;
@property (nonatomic, copy) NSURL *callbackURL;
- (void)authenticateWithHandler:(void(^)(NSDictionary *returnedValues))handler;
//- (void)renewCredentialsWithHandler:(void(^)(BOOL success, NSError *error))handler;
@end
|
Fix typo MAKE_KLEO_LIB not MAKE_LIBKLEO_LIB and make it more coherent with other export files | /* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef LIBKLEO_EXPORT_H
#define LIBKLEO_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
#ifndef KLEO_EXPORT
# if defined(MAKE_LIBKLEO_LIB)
/* We are building this library */
# define KLEO_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define KLEO_EXPORT KDE_IMPORT
# endif
#endif
# ifndef KLEO_EXPORT_DEPRECATED
# define KLEO_EXPORT_DEPRECATED KDE_DEPRECATED KLEO_EXPORT
# endif
#endif
| /* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef LIBKLEO_EXPORT_H
#define LIBKLEO_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
#ifdef Q_WS_WIN
#ifndef KLEO_EXPORT
# ifdef MAKE_KLEO_LIB
# define KLEO_EXPORT KDE_EXPORT
# else
# define KLEO_EXPORT KDE_IMPORT
# endif
#endif
#else // not windows
#define KLEO_EXPORT KDE_EXPORT
#endif /* not windows */
# ifndef KLEO_EXPORT_DEPRECATED
# define KLEO_EXPORT_DEPRECATED KDE_DEPRECATED KLEO_EXPORT
# endif
#endif
|
Swap euid and uid in sudo helper | /*
* A simple setuid binary that runs /usr/bin/phong.py
*/
#include <sys/types.h>
#include <unistd.h>
#ifndef PHONG_PATH
#define PHONG_PATH "/usr/bin/phong.py"
#endif
int main(int argc, char** argv)
{
int i;
char **newArgv;
newArgv = calloc (sizeof (char*), argc+1);
newArgv[0] = strdup (PHONG_PATH);
newArgv[1] = strdup ("sudo");
for (i = 1; i < argc; i++) {
newArgv[i+1] = strdup(argv[i]);
}
newArgv[argc+1] = NULL;
setuid (0);
return execv (newArgv[0], newArgv);
}
| /*
* A simple setuid binary that runs /usr/bin/phong.py
*/
#include <sys/types.h>
#include <unistd.h>
#ifndef PHONG_PATH
#define PHONG_PATH "/usr/bin/phong.py"
#endif
int main(int argc, char** argv)
{
int i;
char **newArgv;
newArgv = calloc (sizeof (char*), argc+1);
newArgv[0] = strdup (PHONG_PATH);
newArgv[1] = strdup ("sudo");
for (i = 1; i < argc; i++) {
newArgv[i+1] = strdup(argv[i]);
}
newArgv[argc+1] = NULL;
setreuid (geteuid (), getuid ());
return execv (newArgv[0], newArgv);
}
|
Define default SPI pins on kb2040 | #define MICROPY_HW_BOARD_NAME "Adafruit KB2040"
#define MICROPY_HW_MCU_NAME "rp2040"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO17)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO12)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO13)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
| #define MICROPY_HW_BOARD_NAME "Adafruit KB2040"
#define MICROPY_HW_MCU_NAME "rp2040"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO17)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO12)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO13)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20)
|
Remove now useless runtime member from the results structure. | /*
* StatZone 1.0.1
* Copyright (c) 2012-2020, Frederic Cambus
* https://www.statdns.com
*
* Created: 2012-02-13
* Last Updated: 2019-01-03
*
* StatZone is released under the BSD 2-Clause license
* See LICENSE file for details.
*/
#ifndef CONFIG_H
#define CONFIG_H
#define VERSION "StatZone 1.0.1"
#define LINE_LENGTH_MAX 65536
struct results {
uint64_t processedLines;
uint64_t a;
uint64_t aaaa;
uint64_t ds;
uint64_t ns;
uint64_t domains;
uint64_t idn;
double runtime;
};
#endif /* CONFIG_H */
| /*
* StatZone 1.0.1
* Copyright (c) 2012-2020, Frederic Cambus
* https://www.statdns.com
*
* Created: 2012-02-13
* Last Updated: 2019-01-03
*
* StatZone is released under the BSD 2-Clause license
* See LICENSE file for details.
*/
#ifndef CONFIG_H
#define CONFIG_H
#define VERSION "StatZone 1.0.1"
#define LINE_LENGTH_MAX 65536
struct results {
uint64_t processedLines;
uint64_t a;
uint64_t aaaa;
uint64_t ds;
uint64_t ns;
uint64_t domains;
uint64_t idn;
};
#endif /* CONFIG_H */
|
Define common MACROS in macros.h | #ifndef __MACROS_H
#define __MACROS_H
#define LINE_MAX_LEN 1024
#define SPC_ERR -1
#define SPC_OK 0
#endif
| |
Use unordered_map rather than map | #ifndef BROKER_H_
#define BROKER_H_
#include <map>
#include <string>
#include <zmq.hpp>
#include "client.h"
#include "topic.h"
#include "message.h"
class Broker {
public:
Broker(std::string bind, std::string private_key) :
bind_(bind), private_key_(private_key) {}
void main_loop();
private:
void handleMessage(const Message& message);
void sendMessage(Client &client, std::vector<std::string> frames);
std::string readPrivateKey(std::string path);
std::map<std::string,Client> clients_;
std::map<std::string,Topic> topics_;
zmq::socket_t* socket_;
size_t recv_ = 0;
size_t sent_ = 0;
std::string bind_;
std::string private_key_;
};
#endif
| #ifndef BROKER_H_
#define BROKER_H_
#include <unordered_map>
#include <string>
#include <zmq.hpp>
#include "client.h"
#include "topic.h"
#include "message.h"
class Broker {
public:
Broker(std::string bind, std::string private_key) :
bind_(bind), private_key_(private_key) {}
void main_loop();
private:
void handleMessage(const Message& message);
void sendMessage(Client &client, std::vector<std::string> frames);
std::string readPrivateKey(std::string path);
std::unordered_map<std::string,Client> clients_;
std::unordered_map<std::string,Topic> topics_;
zmq::socket_t* socket_;
size_t recv_ = 0;
size_t sent_ = 0;
std::string bind_;
std::string private_key_;
};
#endif
|
Update driver version to 5.02.00-k17 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k16"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k17"
|
Update driver version to 5.02.00-k7 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k6"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2010 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k7"
|
Fix implementation of '<' operator | #pragma once
#include <map>
#include <string>
#include "ClassFile.h"
using namespace std;
struct SourceId
{
bool isMethod; // otherwise, field
string className;
string name;
bool operator < (SourceId const& other) const
{
if(isMethod < other.isMethod)
return true;
if(className < other.className)
return true;
if(name < other.name)
return true;
return false;
}
};
extern map<string, string> classRemap;
extern map<SourceId, string> memberRemap;
void doRenamings(ClassFile& class_);
| #pragma once
#include <map>
#include <string>
#include "ClassFile.h"
using namespace std;
struct SourceId
{
bool isMethod; // otherwise, field
string className;
string name;
bool operator < (SourceId const& other) const
{
if(isMethod < other.isMethod)
return true;
if(isMethod > other.isMethod)
return false;
if(className < other.className)
return true;
if(className > other.className)
return false;
return name < other.name;
}
};
extern map<string, string> classRemap;
extern map<SourceId, string> memberRemap;
void doRenamings(ClassFile& class_);
|
Make pipeline work for CGImage processing (missed out the header file) | #import <Foundation/Foundation.h>
#import "GPUImageFilter.h"
@interface GPUImageFilterPipeline : NSObject
@property (strong) NSMutableArray *filters;
@property (strong) GPUImageOutput *input;
@property (strong) id <GPUImageInput> output;
- (id) initWithOrderedFilters:(NSArray*) filters input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
- (id) initWithConfiguration:(NSDictionary*) configuration input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
- (id) initWithConfigurationFile:(NSURL*) configuration input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
- (void) addFilter:(GPUImageFilter*)filter;
- (void) addFilter:(GPUImageFilter*)filter atIndex:(NSUInteger)insertIndex;
- (void) replaceFilterAtIndex:(NSUInteger)index withFilter:(GPUImageFilter*)filter;
- (void) replaceAllFilters:(NSArray*) newFilters;
- (void) removeFilterAtIndex:(NSUInteger)index;
- (void) removeAllFilters;
- (UIImage *) currentFilteredFrame;
@end
| #import <Foundation/Foundation.h>
#import "GPUImageFilter.h"
@interface GPUImageFilterPipeline : NSObject
@property (strong) NSMutableArray *filters;
@property (strong) GPUImageOutput *input;
@property (strong) id <GPUImageInput> output;
- (id) initWithOrderedFilters:(NSArray*) filters input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
- (id) initWithConfiguration:(NSDictionary*) configuration input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
- (id) initWithConfigurationFile:(NSURL*) configuration input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
- (void) addFilter:(GPUImageFilter*)filter;
- (void) addFilter:(GPUImageFilter*)filter atIndex:(NSUInteger)insertIndex;
- (void) replaceFilterAtIndex:(NSUInteger)index withFilter:(GPUImageFilter*)filter;
- (void) replaceAllFilters:(NSArray*) newFilters;
- (void) removeFilterAtIndex:(NSUInteger)index;
- (void) removeAllFilters;
- (UIImage *) currentFilteredFrame;
- (CGImageRef) newCGImageFromCurrentFilteredFrame;
@end
|
Fix store field for tapelev4 (rarely used). | #ifdef ALLOW_EXF
CADJ STORE StoreForcing1 = tapelev4, key = ilev_4
CADJ STORE StoreForcing2 = tapelev4, key = ilev_4
CADJ STORE StoreCTRLS1 = tapelev4, key = ilev_4
# ifdef ALLOW_HFLUX_CONTROL
CADJ STORE xx_hflux0 = tapelev4, key = ilev_4
CADJ STORE xx_hflux1 = tapelev4, key = ilev_4
# endif
# ifdef ALLOW_SFLUX_CONTROL
CADJ STORE xx_sflux0 = tapelev4, key = ilev_4
CADJ STORE xx_sflux1 = tapelev4, key = ilev_4
# endif
# ifdef ALLOW_USTRESS_CONTROL
CADJ STORE xx_tauu0 = tapelev4, key = ilev_4
CADJ STORE xx_tauu1 = tapelev4, key = ilev_4
# endif
# ifdef ALLOW_VSTRESS_CONTROL
CADJ STORE xx_tauv0 = tapelev4, key = ilev_4
CADJ STORE xx_tauv1 = tapelev4, key = ilev_4
# endif
#endif /* ALLOW_EXF */
| #ifdef ALLOW_EXF
CADJ STORE StoreEXF1 = tapelev4, key = ilev_4
CADJ STORE StoreEXF2 = tapelev4, key = ilev_4
CADJ STORE StoreCTRLS1 = tapelev4, key = ilev_4
# ifdef ALLOW_HFLUX_CONTROL
CADJ STORE xx_hflux0 = tapelev4, key = ilev_4
CADJ STORE xx_hflux1 = tapelev4, key = ilev_4
# endif
# ifdef ALLOW_SFLUX_CONTROL
CADJ STORE xx_sflux0 = tapelev4, key = ilev_4
CADJ STORE xx_sflux1 = tapelev4, key = ilev_4
# endif
# ifdef ALLOW_USTRESS_CONTROL
CADJ STORE xx_tauu0 = tapelev4, key = ilev_4
CADJ STORE xx_tauu1 = tapelev4, key = ilev_4
# endif
# ifdef ALLOW_VSTRESS_CONTROL
CADJ STORE xx_tauv0 = tapelev4, key = ilev_4
CADJ STORE xx_tauv1 = tapelev4, key = ilev_4
# endif
#endif /* ALLOW_EXF */
|
Add some comments about expected purpose. | #ifndef __ENGINE_MESH_H__
#define __ENGINE_MESH_H__
#include "std/types.h"
#include "gfx/vector3d.h"
typedef struct Triangle {
uint16_t p1, p2, p3;
} TriangleT;
typedef struct IndexArray {
uint16_t count;
uint16_t *index;
} IndexArrayT;
typedef struct IndexMap {
IndexArrayT *vertex;
uint16_t *indices;
} IndexMapT;
typedef struct Mesh {
size_t vertexNum;
size_t polygonNum;
Vector3D *vertex;
TriangleT *polygon;
Vector3D *surfaceNormal;
Vector3D *vertexNormal;
IndexMapT vertexToPoly;
} MeshT;
MeshT *NewMesh(size_t vertices, size_t triangles);
MeshT *NewMeshFromFile(const char *fileName);
void DeleteMesh(MeshT *mesh);
void NormalizeMeshSize(MeshT *mesh);
void CenterMeshPosition(MeshT *mesh);
void AddSurfaceNormals(MeshT *mesh);
void AddVertexToPolygonMap(MeshT *mesh);
void AddVertexNormals(MeshT *mesh);
#define RSC_MESH_FILE(NAME, FILENAME) \
AddRscSimple(NAME, NewMeshFromFile(FILENAME), (FreeFuncT)DeleteMesh)
#endif
| #ifndef __ENGINE_MESH_H__
#define __ENGINE_MESH_H__
#include "std/types.h"
#include "gfx/vector3d.h"
typedef struct Triangle {
uint16_t p1, p2, p3;
} TriangleT;
typedef struct IndexArray {
uint16_t count;
uint16_t *index;
} IndexArrayT;
typedef struct IndexMap {
IndexArrayT *vertex;
uint16_t *indices;
} IndexMapT;
typedef struct Mesh {
size_t vertexNum;
size_t polygonNum;
Vector3D *vertex;
TriangleT *polygon;
/* map from vertex index to list of polygon indices */
IndexMapT vertexToPoly;
/* useful for lighting and backface culling */
Vector3D *surfaceNormal;
Vector3D *vertexNormal;
} MeshT;
MeshT *NewMesh(size_t vertices, size_t triangles);
MeshT *NewMeshFromFile(const char *fileName);
void DeleteMesh(MeshT *mesh);
void NormalizeMeshSize(MeshT *mesh);
void CenterMeshPosition(MeshT *mesh);
void AddSurfaceNormals(MeshT *mesh);
void AddVertexToPolygonMap(MeshT *mesh);
void AddVertexNormals(MeshT *mesh);
#define RSC_MESH_FILE(NAME, FILENAME) \
AddRscSimple(NAME, NewMeshFromFile(FILENAME), (FreeFuncT)DeleteMesh)
#endif
|
Fix the build on Win32 by making linkage of various symbols consistent again. | /* string_funcs.h
* Copyright (C) 2001-2003, The Perl Foundation.
* SVN Info
* $Id$
* Overview:
* This is the api header for the string subsystem
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#ifndef PARROT_STRING_PRIMITIVES_H_GUARD
#define PARROT_STRING_PRIMITIVES_H_GUARD
#ifdef PARROT_IN_CORE
/* Set the directory where ICU finds its data files (encodings,
locales, etc.) */
void string_set_data_directory(const char *dir);
/* Convert from any supported encoding, into our internal format */
void string_fill_from_buffer(Interp *interp,
const void *buffer, UINTVAL len, const char *encoding_name, STRING *s);
/* Utility method which knows how to uwind a single escape sequence */
typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context);
Parrot_UInt4
string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string);
UINTVAL
Parrot_char_digit_value(Interp *interp, UINTVAL character);
#endif /* PARROT_IN_CORE */
#endif /* PARROT_STRING_PRIMITIVES_H_GUARD */
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
*/
| /* string_funcs.h
* Copyright (C) 2001-2003, The Perl Foundation.
* SVN Info
* $Id$
* Overview:
* This is the api header for the string subsystem
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#ifndef PARROT_STRING_PRIMITIVES_H_GUARD
#define PARROT_STRING_PRIMITIVES_H_GUARD
#ifdef PARROT_IN_CORE
/* Set the directory where ICU finds its data files (encodings,
locales, etc.) */
PARROT_API void string_set_data_directory(const char *dir);
/* Convert from any supported encoding, into our internal format */
PARROT_API void string_fill_from_buffer(Interp *interp,
const void *buffer, UINTVAL len, const char *encoding_name, STRING *s);
/* Utility method which knows how to uwind a single escape sequence */
typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context);
PARROT_API Parrot_UInt4
string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string);
PARROT_API UINTVAL
Parrot_char_digit_value(Interp *interp, UINTVAL character);
#endif /* PARROT_IN_CORE */
#endif /* PARROT_STRING_PRIMITIVES_H_GUARD */
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
*/
|
Add a test case for r81431. | // RUN: %llvmgcc -S %s -o -
// rdar://7208839
extern inline int f1 (void) {return 1;}
int f3 (void) {return f1();}
int f1 (void) {return 0;}
| |
Make the testcase more interesting |
typedef struct {
int op;
} event_t;
event_t test(int X) {
event_t foo, bar;
return X ? foo : bar;
}
|
typedef struct {
int op;
} event_t;
event_t test(int X) {
event_t foo = { 1 }, bar = { 2 };
return X ? foo : bar;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.