/**
 * \usergroup{SceAVConfig}
 * \usage{psp2/avconfig.h,SceAVConfig_stub}
 */

#ifndef _PSP2_AVCONFIG_H_
#define _PSP2_AVCONFIG_H_

#include <psp2/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/***
 * Get the maximum brightness.
 *
 * @param[out] maxBrightness - Maximum brightness.
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigGetDisplayMaxBrightness(int *maxBrightness);

/***
 * Set the screen brightness.
 *
 * @param brightness - Brightness that the screen will be set to (range 21-65536, 0 turns off the screen).
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigSetDisplayBrightness(int brightness);

#ifdef __cplusplus
}
#endif

#endif

/**
 * \usergroup{SceAVConfig}
 * \usage{psp2/avconfig.h,SceAVConfig_stub}
 */

#ifndef _PSP2_AVCONFIG_H_
#define _PSP2_AVCONFIG_H_

#include <psp2/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/***
 * Get the maximum brightness.
 *
 * @param[out] maxBrightness - Maximum brightness.
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigGetDisplayMaxBrightness(int *maxBrightness);

/***
 * Set the screen brightness.
 *
 * @param brightness - Brightness that the screen will be set to (range 21-65536, 0 turns off the screen).
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigSetDisplayBrightness(int brightness);

/***
 * Get the shutter volume.
 *
 * @param[out] volume - shutter volume.
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigGetShutterVol(int *volume);

/***
 * Get the system volume.
 *
 * @param[out] volume - System volume.
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigGetSystemVol(int *volume);

/***
 * Set the system volume.
 *
 * @param volume - volume that the device will be set to (range 0-30).
 *
 * @return 0 on success, < 0 on error.
 */
int sceAVConfigSetSystemVol(int volume);

/**
 * Turns on mute.
 *
 * @return 0 on success, < 0 on error.
 *
 */
int sceAVConfigMuteOn(void);

#ifdef __cplusplus
}
#endif

#endif

Add some sceAVConfig volume functions

Add some sceAVConfig volume functions


//===--- CallingConvention.h - Calling conventions --------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file declares the interfaces for working with abstract and
// phsyical calling conventions.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_IRGEN_CALLINGCONVENTION_H
#define SWIFT_IRGEN_CALLINGCONVENTION_H

#include "llvm/IR/CallingConv.h"

namespace llvm {
  class AttributeSet;
  class Value;
}

namespace swift {
  class ValueDecl;
  enum class SILFunctionTypeRepresentation : uint8_t;

namespace irgen {
  class IRGenModule;

/// Expand an abstract SIL function type representation into a physical
/// convention.
llvm::CallingConv::ID expandCallingConv(IRGenModule &IGM,
                                     SILFunctionTypeRepresentation convention);

} // end namespace irgen
} // end namespace swift

#endif

//===--- CallingConvention.h - Calling conventions --------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file declares the interfaces for working with abstract and
// physical calling conventions.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_IRGEN_CALLINGCONVENTION_H
#define SWIFT_IRGEN_CALLINGCONVENTION_H

#include "llvm/IR/CallingConv.h"

namespace llvm {
  class AttributeSet;
  class Value;
}

namespace swift {
  class ValueDecl;
  enum class SILFunctionTypeRepresentation : uint8_t;

namespace irgen {
  class IRGenModule;

/// Expand an abstract SIL function type representation into a physical
/// convention.
llvm::CallingConv::ID expandCallingConv(IRGenModule &IGM,
                                     SILFunctionTypeRepresentation convention);

} // end namespace irgen
} // end namespace swift

#endif

Fix typo phsyical => physical

Fix typo phsyical => physical


// This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once

namespace swganh
{
namespace tre
{
	template <class T> T ObjectVisitor::attribute(const std::string& key)
	{
		std::map<std::string, std::shared_ptr<boost::any>>::const_iterator it = attributes_.find(key);
		if(it != attributes_.cend())
		{
			return boost::any_cast<T>(*it->second);
		}
		throw std::runtime_error("Invalid type requested for attribute");
	}
}
}

// This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once
#include<stdexcept>
namespace swganh
{
namespace tre
{
	template <class T> T ObjectVisitor::attribute(const std::string& key)
	{
		std::map<std::string, std::shared_ptr<boost::any>>::const_iterator it = attributes_.find(key);
		if(it != attributes_.cend())
		{
			return boost::any_cast<T>(*it->second);
		}
		throw std::runtime_error("Invalid type requested for attribute");
	}
}
}

Fix for missing include that vs studio forgot to complain about


/* enums.h
 *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
 *  Overview:
 *     enums shared by much of the stack-handling code
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#if !defined(PARROT_ENUMS_H_GUARD)
#define PARROT_ENUMS_H_GUARD

typedef enum {
    NO_STACK_ENTRY_TYPE     = 0,
    STACK_ENTRY_INT         = 1,
    STACK_ENTRY_FLOAT       = 2,
    STACK_ENTRY_STRING      = 3,
    STACK_ENTRY_PMC         = 4,
    STACK_ENTRY_POINTER     = 5,
    STACK_ENTRY_DESTINATION = 6
} Stack_entry_type;

typedef enum {
    NO_STACK_ENTRY_FLAGS     = 0,
    STACK_ENTRY_CLEANUP_FLAG = 1 << 0
} Stack_entry_flags;

typedef enum {
    NO_STACK_CHUNK_FLAGS     = 0,
    STACK_CHUNK_COW_FLAG     = 1 << 0
} Stack_chunk_flags;

#endif

/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
*/

Add header and footer comments

Add header and footer comments

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@3957 d31e2699-5ff4-0310-a27c-f18f2fbe73fe


#ifndef CONSOLE_H
#define CONSOLE_H

#include <string>

#include <Cart.h>
#include <Controller.h>
#include <CPU.h>
#include <PPU.h>
#include <APU.h>

class Divider {
public:
    Divider(int interval = 1) {
	setInterval(interval);
    }
    void setInterval(int interval) {
	this->interval = interval;
	clockCounter = interval - 1;
    }
    void tick() {
	clockCounter++;
	if (clockCounter == interval) {
	    clockCounter = 0;
	}
    }
    bool hasClocked() {
	return clockCounter == 0;
    }

private:
    int interval;
    int clockCounter;
};

class Console {
public:
    Console() : cpuDivider(3) { }
    void boot();
    bool loadINesFile(std::string fileName);
    uint32_t *getFrameBuffer();
    void runForOneFrame();

    Cart cart;
    Controller controller1;
    APU apu;

private:
    void tick();

    PPU ppu;
    CPU cpu;
    Divider cpuDivider;
};

#endif

#ifndef CONSOLE_H
#define CONSOLE_H

#include <string>

#include <Cart.h>
#include <Controller.h>
#include <CPU.h>
#include <PPU.h>
#include <APU.h>

class Divider {
public:
    Divider(int interval = 1) {
	setInterval(interval);
    }
    void setInterval(int interval) {
	this->interval = interval;
	clockCounter = interval - 1;
    }
    void tick() {
	clockCounter++;
	if (clockCounter == interval) {
	    clockCounter = 0;
	}
    }
    bool hasClocked() {
	return clockCounter == 0;
    }

private:
    int interval;
    int clockCounter;
};

class Console {
public:
    Console() : cpuDivider(3) { }
    void boot();
    bool loadINesFile(std::string fileName);
    uint32_t *getFrameBuffer();
    void runForOneFrame();

    Controller controller1;

private:
    void tick();

    Cart cart;
    APU apu;
    PPU ppu;
    CPU cpu;
    Divider cpuDivider;
};

#endif

Make cart and apu members private

Make cart and apu members private


#include <stdio.h>
#include <stdlib.h>
#include "../libcpsl.h"
#include <signal.h>

#define RUNTEST(x) ((CurrentTest = #x), x(), printf("Test \"%s\" passed.\n", #x))

static const char *CurrentTest = NULL;

static void SigHandler(const int Signal);

static inline void InitTestUnit(void)
{
	CPSL_Configure(malloc, free, realloc);
	signal(SIGABRT, SigHandler);
	signal(SIGSEGV, SigHandler);
	signal(SIGTERM, SigHandler);
	signal(SIGILL, SigHandler);
	signal(SIGFPE, SigHandler);
	signal(SIGQUIT, SigHandler);
	signal(SIGBUS, SigHandler);

}

static void SigHandler(const int Signal)
{
	fprintf(stderr, "Received signal number %d while running test \"%s()\"\n", Signal, CurrentTest);
	exit(1);
}

#include <stdio.h>
#include <stdlib.h>
#include "../libcpsl.h"
#include <signal.h>

#define RUNTEST(x) ((CurrentTest = #x), x(), printf("Subtest \"%s\" passed.\n", #x))

static const char *CurrentTest = NULL;

static void SigHandler(const int Signal);

static inline void InitTestUnit(void)
{
	CPSL_Configure(malloc, free, realloc);
	signal(SIGABRT, SigHandler);
	signal(SIGSEGV, SigHandler);
	signal(SIGTERM, SigHandler);
	signal(SIGILL, SigHandler);
	signal(SIGFPE, SigHandler);
	signal(SIGQUIT, SigHandler);
	signal(SIGBUS, SigHandler);
	puts("Running test \"" __FILE__ "\"");
}

static void SigHandler(const int Signal)
{
	fprintf(stderr, "Received signal number %d while running test \"%s()\"\n", Signal, CurrentTest);
	exit(1);
}

Fix some wording for unit tests.

Fix some wording for unit tests.


#include "calc.h"

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

int calc(const char* p, int mul_div_flag)
{
    int i;
    int ans;

    ans = atoi(p);
    i = 0;
    while (p[i] != '\0'){
        while (isdigit(p[i])){
            i++;
        }
        switch (p[i]){
            case '+':
                return (ans + calc(p + i + 1, 0));
            case '-':
                return (ans - calc(p + i + 1, 0));
            case '*':
                ans *= calc(p + i + 1, 1);
                if (p[i + 1] == '('){
                    while (p[i] != ')'){
                        i++;
                    }
                }
                i++;
                break;
            case '/':
                ans /= calc(p + i + 1, 1);
                if (p[i + 1] == '('){
                    while (p[i] != ')'){
                        i++;
                    }
                }
                i++;
                break;
            case '(':
                return (calc(p + i + 1, 0));
            case ')':
            case '\0':
                return (ans);
            default:
                puts("Error");
                return (0);
        }
    }

    return (ans);
}

#include "calc.h"

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

int calc(const char* p, int mul_div_flag)
{
    int i;
    int ans;

    ans = atoi(p);
    if (p[0] != '(' && mul_div_flag == 1){
        return (ans);
    }
    i = 0;
    while (p[i] != '\0'){
        while (isdigit(p[i])){
            i++;
        }
        switch (p[i]){
            case '+':
                return (ans + calc(p + i + 1, 0));
            case '-':
                return (ans - calc(p + i + 1, 0));
            case '*':
                ans *= calc(p + i + 1, 1);
                if (p[i + 1] == '('){
                    while (p[i] != ')'){
                        i++;
                    }
                }
                i++;
                break;
            case '/':
                ans /= calc(p + i + 1, 1);
                if (p[i + 1] == '('){
                    while (p[i] != ')'){
                        i++;
                    }
                }
                i++;
                break;
            case '(':
                return (calc(p + i + 1, 0));
            case ')':
            case '\0':
                return (ans);
            default:
                puts("Error");
                return (0);
        }
    }

    return (ans);
}

Return answer when multiple or divide

Return answer when multiple or divide


#include <stdio.h>
#include <math.h>
#include <gmp.h>

int is_perfect_sq(int n)
{
    int s = sqrt(n);
    return s * s == n;
}

int main(void)
{
    // 10^100 ~< 2^400
    mpf_set_default_prec(512);

    mpf_t a;
    mpf_init(a);
    int total_sum = 0;

    // Count through 100 irrational roots
    for (int i = 2; i <= 100; ++i) {
        if (is_perfect_sq(i)) {
            continue;
        }

        mpf_sqrt_ui(a, i);
        int digital_sum = 0;

        // Count 100 decimal digits
        for (int i = 0; i < 100; ++i) {
            long ip = mpf_get_ui(a);
            digital_sum += ip % 10;

            mpf_sub_ui(a, a, ip);
            mpf_mul_ui(a, a, 10);
        }

        total_sum += digital_sum;
    }

    printf("%d\n", total_sum);
    mpf_clear(a);
}

Add solution for problem 80

Add solution for problem 80

This is done using C, since GMP is already a dependency and the code is
fairly simple.


#pragma once

#include <atomic>

#include "util.h"

namespace happyntrain {

template <typename SelectorImpt>
class Selector : NoCopy {
  SelectorImpt _selector;
  int64_t _id;

 public:
  template <typename... Vars>
  Selector(Vars&&... args) : _id(GetNewId()), _selector(args...) {}
  ~Selector() {}

  inline void AddChannel() { _selector.AddChannel(); }
  inline void RemoveChannel() { _selector.RemoveChannel(); }
  inline void UpdateChannel() { _selector.UpdateChannel(); }

 private:
  static int64_t GetNewId() {
    static std::atomic<int64_t> id(0);
    return id++;
  }
};

// end happyntrain
}

#pragma once

#include <atomic>

#include "util.h"

namespace happyntrain {

const int kMaxSelectEvents = 2000;

template <typename SelectorImpt>
class Selector : NoCopy {
  SelectorImpt _selector;
  int64_t _id;

 public:
  template <typename... Vars>
  Selector(Vars&&... args) : _id(GetNewId()), _selector(args...) {}
  ~Selector() {}

  inline void AddChannel() { _selector.AddChannel(); }
  inline void RemoveChannel() { _selector.RemoveChannel(); }
  inline void UpdateChannel() { _selector.UpdateChannel(); }

 private:
  static int64_t GetNewId() {
    static std::atomic<int64_t> id(0);
    return id++;
  }
};

// end happyntrain
}

Add constants - max events

Add constants - max events


#pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATION_H_

#include <unordered_map>
#include "../task_typedefs.h"

namespace You {
namespace DataStore {

/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
	/// Executes the operation
	virtual bool run() = 0;
protected:
	TaskId taskId;
	SerializedTask task;
};

}   // namespace DataStore
}   // namespace You

#endif  // YOU_DATASTORE_INTERNAL_OPERATION_H_

#pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATION_H_

#include <unordered_map>
#include "../task_typedefs.h"

namespace You {
namespace DataStore {

/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
	virtual ~IOperation();
	/// Executes the operation
	virtual bool run() = 0;
protected:
	TaskId taskId;
	SerializedTask task;
};

}   // namespace DataStore
}   // namespace You

#endif  // YOU_DATASTORE_INTERNAL_OPERATION_H_

Add back virtual dtor for IOperation

Add back virtual dtor for IOperation


/***************************************************************
*
* Copyright (C) 1990-2021, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License.  You may
* obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
***************************************************************/

// Encapsulate the linux peformance counter, for insn retired
// Note this is included in the procd, so we can't use full condor libraries

#ifndef __PERF_COUNTER_H
#define  _PERF_COUNTER_H

#include <sys/types.h>

class PerfCounter {
	public:
		PerfCounter(pid_t pid);
		virtual ~PerfCounter();
		void start() const;
		void stop() const;
		long long getInsns() const;
	private:
		pid_t pid;
		int fd;
};

#endif

/***************************************************************
*
* Copyright (C) 1990-2021, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License.  You may
* obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
***************************************************************/

// Encapsulate the linux peformance counter, for insn retired
// Note this is included in the procd, so we can't use full condor libraries

#ifndef __PERF_COUNTER_H
#define __PERF_COUNTER_H

#include <sys/types.h>

class PerfCounter {
	public:
		PerfCounter(pid_t pid);
		virtual ~PerfCounter();
		void start() const;
		void stop() const;
		long long getInsns() const;
	private:
		pid_t pid;
		int fd;
};

#endif

Fix typo in macro guard HTCONDOR-390

Fix typo in macro guard HTCONDOR-390


//
//  TMCacheBackgroundTaskManager.h
//  TMCache
//
//  Created by Bryan Irace on 4/24/15.
//  Copyright (c) 2015 Tumblr. All rights reserved.
//

@import UIKit;

/**
 A protocol that classes who can begin and end background tasks can conform to. This protocol provides an abstraction in
 order to avoid referencing `+ [UIApplication sharedApplication]` from within an iOS application extension.
 */
@protocol TMCacheBackgroundTaskManager <NSObject>

/**
 Marks the beginning of a new long-running background task.

 @return A unique identifier for the new background task. You must pass this value to the `endBackgroundTask:` method to
 mark the end of this task. This method returns `UIBackgroundTaskInvalid` if running in the background is not possible.
 */
- (UIBackgroundTaskIdentifier)beginBackgroundTask;

/**
 Marks the end of a specific long-running background task.

 @param identifier An identifier returned by the `beginBackgroundTaskWithExpirationHandler:` method.
 */
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;

@end

//
//  TMCacheBackgroundTaskManager.h
//  TMCache
//
//  Created by Bryan Irace on 4/24/15.
//  Copyright (c) 2015 Tumblr. All rights reserved.
//

@import UIKit;

#ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
typedef NSUInteger UIBackgroundTaskIdentifier;
#endif

/**
 A protocol that classes who can begin and end background tasks can conform to. This protocol provides an abstraction in
 order to avoid referencing `+ [UIApplication sharedApplication]` from within an iOS application extension.
 */
@protocol TMCacheBackgroundTaskManager <NSObject>

/**
 Marks the beginning of a new long-running background task.

 @return A unique identifier for the new background task. You must pass this value to the `endBackgroundTask:` method to
 mark the end of this task. This method returns `UIBackgroundTaskInvalid` if running in the background is not possible.
 */
- (UIBackgroundTaskIdentifier)beginBackgroundTask;

/**
 Marks the end of a specific long-running background task.

 @param identifier An identifier returned by the `beginBackgroundTaskWithExpirationHandler:` method.
 */
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;

@end

Define UIBackgroundTaskIdentifier if on OS X


#pragma once

namespace TupleManipulation {

   template<int... Integers>
   struct sequence { };

   template<int N, int... Integers>
   struct gen_sequence : public gen_sequence<N - 1, N - 1, Integers...> { };

   template<int... Integers>
   struct gen_sequence<0, Integers...> : public sequence<Integers...> { };

   template<typename Tuple, typename Functor, int... Integers>
   void for_each(Tuple&& tuple, Functor functor, sequence<Integers...>)
   {
      auto l = { (functor(std::get<Integers>(tuple)), 0)... };
      (void)l;
   }

   template<typename... Types, typename Functor>
   void for_each_in_tuple(std::tuple<Types...> & tuple, Functor functor)
   {
       for_each(tuple, functor, gen_sequence<sizeof...(Types)>());
   }

   template <typename T, typename Tuple>
   struct has_type;

   template <typename T>
   struct has_type<T, std::tuple<>>
   {
      static constexpr bool value = false;
   };

   template <typename T, typename U, typename... Ts>
   struct has_type<T, std::tuple<U, Ts...>> : has_type<T, std::tuple<Ts...>> {};

   template <typename T, typename... Ts>
   struct has_type<T, std::tuple<T, Ts...>> : std::true_type
   {
      static constexpr bool value = true;
   };
}

#pragma once

namespace TupleManipulation {

   template<int... Integers>
   struct sequence { };

   template<int N, int... Integers>
   struct gen_sequence : public gen_sequence<N - 1, N - 1, Integers...> { };

   template<int... Integers>
   struct gen_sequence<0, Integers...> : public sequence<Integers...> { };

   template<typename Tuple, typename Functor, int... Integers>
   void for_each(Tuple&& tuple, Functor functor, sequence<Integers...>)
   {
      auto l = { (functor(std::get<Integers>(tuple)), 0)... };
      (void)l;
   }

   template<typename... Types, typename Functor>
   void for_each_in_tuple(std::tuple<Types...> & tuple, Functor functor)
   {
       for_each(tuple, functor, gen_sequence<sizeof...(Types)>());
   }

   template <typename T, typename Tuple>
   struct has_type;

   template <typename T>
   struct has_type<T, std::tuple<>>
   {
      static constexpr bool value = false;
   };

   template <typename T, typename U, typename... Ts>
   struct has_type<T, std::tuple<U, Ts...>> : public has_type<T, std::tuple<Ts...>> {};

   template <typename T, typename... Ts>
   struct has_type<T, std::tuple<T, Ts...>> : public std::true_type
   {
      static constexpr bool value = true;
   };
}

Fix compiler warning in IAR

Fix compiler warning in IAR


#ifndef windowManager_H
#define windowManager_H

#include <iostream>

// GLEW
#define GLEW_STATIC
#include <GL/glew.h>

// GLFW
#include <GLFW/glfw3.h>

class windowManager
{
public:

	void init();
	void windowManager::getScreenSize();
	//Functions to return dimensions of window
	int getWindowHeight();
	int getWindowWidth();
	GLFWwindow* getWindow();
private:
	//The window height
	int width;
	int height;
	GLFWwindow* currentWindow;
};

#endif

#ifndef windowManager_H
#define windowManager_H

#include <iostream>

// GLEW
#define GLEW_STATIC
#include <GL/glew.h>

// GLFW
#include <GLFW/glfw3.h>

class windowManager
{
public:

	void init();
	void getScreenSize();
	//Functions to return dimensions of window
	int getWindowHeight();
	int getWindowWidth();
	GLFWwindow* getWindow();
private:
	//The window height
	int width;
	int height;
	GLFWwindow* currentWindow;
};

#endif

Fix building error on Linux

Fix building error on Linux


/*
 * Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#include "config.h"

#include "fu-plugin-vfuncs.h"

#include "fu-solokey-device.h"

void
fu_plugin_init (FuPlugin *plugin)
{
	fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
	fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.solokeys");
	fu_plugin_set_device_gtype (plugin, FU_TYPE_SOLOKEY_DEVICE);
}

/*
 * Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#include "config.h"

#include "fu-plugin-vfuncs.h"

#include "fu-solokey-device.h"
#include "fu-solokey-firmware.h"

void
fu_plugin_init (FuPlugin *plugin)
{
	fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
	fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.solokeys");
	fu_plugin_set_device_gtype (plugin, FU_TYPE_SOLOKEY_DEVICE);
	fu_plugin_add_firmware_gtype (plugin, "solokey", FU_TYPE_SOLOKEY_FIRMWARE);
}

Allow parsing firmware with fwupdtool

solokey: Allow parsing firmware with fwupdtool


/** @file
  This file declares GUIDed section extraction protocol.

  This interface provides a means of decoding a GUID defined encapsulation
  section. There may be multiple different GUIDs associated with the GUIDed
  section extraction protocol. That is, all instances of the GUIDed section
  extraction protocol must have the same interface structure.

  Copyright (c) 2006, Intel Corporation
  All rights reserved. This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

  Module Name:  GuidedSectionExtraction.h

  @par Revision Reference:
  This protocol is defined in Firmware Volume Specification.
  Version 0.9

**/

#ifndef __CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
#define __CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__

//
// Protocol GUID definition. Each GUIDed section extraction protocol has the
// same interface but with different GUID. All the GUIDs is defined here.
// May add multiple GUIDs here.
//
#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID \
  { \
    0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } \
  }

//
// may add other GUID here
//
extern EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid;

#endif

Rename GuidedSectionExtraction.h to Crc32GuidedSectonExtraction.h to avoid naming collision with that in MdePkg.
Remove the duplicate definition.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@2821 6f19259b-4bc3-4df7-8a09-765794883524


#pragma once

#include <YunMQTTClient.h>

class ShiftrConnector {

  public :
    void sendCounter(int counter);

    void init();

    void loop();

    //default constructor
    ShiftrConnector() {};

  private :
    YunMQTTClient client;

    void connect();
};

#pragma once

//https://github.com/256dpi/arduino-mqtt
#include <YunMQTTClient.h>

class ShiftrConnector {

  public :
    void sendCounter(int counter);

    void init();

    void loop();

    //default constructor
    ShiftrConnector() {};

  private :
    YunMQTTClient client;

    void connect();
};

Add link to the library

Add link to the library


#include "Chacha20.h"
#include "Poly1305_64.h"

void blit(uint8_t* src, uint32_t len, uint8_t* dest, uint32_t pos);

void poly1305_key_gen(uint8_t* otk, uint8_t* key, uint8_t* nonce);

uint32_t hacl_aead_chacha20_poly1305_encrypt(uint8_t *plaintext,  uint32_t plaintext_len,
                                             uint8_t *aad,        uint32_t aad_len,
                                             uint8_t *key,        uint8_t *iv,
                                             uint8_t *ciphertext, uint8_t *tag);

#include "Chacha20.h"
#include "Poly1305_64.h"

void poly1305_key_gen(uint8_t* otk, uint8_t* key, uint8_t* nonce);

uint32_t hacl_aead_chacha20_poly1305_encrypt(uint8_t *plaintext,  uint32_t plaintext_len,
                                             uint8_t *aad,        uint32_t aad_len,
                                             uint8_t *key,        uint8_t *iv,
                                             uint8_t *ciphertext, uint8_t *tag);

Remove exposed function from AEAD Chacha20 Poly1305 code


/*===- RandomNumbers.h - libSimulation -========================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef RANDOMNUMBERS
#define RANDOMNUMBERS

#include <random>
#include "VectorCompatibility.h"

class RandomNumbers {
public:
	RandomNumbers();
	~RandomNumbers() {}

	const double uniformZeroToOne();
	const double uniformZeroToTwoPi();
	const double guassian(std::normal_distribution<double> &dist);

private:
	std::mt19937_64 engine;

	std::uniform_real_distribution<double> zeroToOne;
	std::uniform_real_distribution<double> zeroToTwoPi;
};

class RandCache {
public:
	__m128d r;
	double l, h;

	RandCache(const __m128d r_ = _mm_set1_pd(0.0),
			  const double l_ = 0.0, const double h_ = 0.0)
	: r(r_), l(l_), h(h_) {}
};

#endif // RANDOMNUMBERS

/*===- RandomNumbers.h - libSimulation -========================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef RANDOMNUMBERS
#define RANDOMNUMBERS

#include <random>
#include "VectorCompatibility.h"

class RandomNumbers {
public:
	RandomNumbers();
	~RandomNumbers() {}

	const double uniformZeroToOne();
	const double uniformZeroToTwoPi();
	const double guassian(std::normal_distribution<double> &dist);

private:
	std::mt19937_64 engine;

	std::uniform_real_distribution<double> zeroToOne;
	std::uniform_real_distribution<double> zeroToTwoPi;
};

// Structure to hold precomuted random numbers for use with thermal forces.
struct RandCache {
	__m128d r;
	double l, h;

	RandCache(const __m128d r_ = _mm_set1_pd(0.0),
			  const double l_ = 0.0, const double h_ = 0.0)
	: r(r_), l(l_), h(h_) {}
};

#endif // RANDOMNUMBERS

Change rand cache to a struct since everything is public. Add comment.


#ifndef IFACE_H_INCLUDED
#define IFACE_H_INCLUDED

#include <fcntl.h>

typedef struct funcs_t {
	unsigned char *(*get_mem_buf_hash)(unsigned char *mem_buf, unsigned long int mem_size);
	unsigned char *(*hash_to_str)(unsigned char *mem_hash);
	int (*is_mem_buf_dumped)(unsigned char *mem_hash);
	void (*dump_mem_buf)(unsigned char *mem_buf, unsigned long int mem_size, char *fname);
} funcs_t;

typedef struct plugin_t {
	void *hndl;
	char *name;
	char *description;
	struct plugin_t *next;
} plugin_t;

#endif

#ifndef IFACE_H_INCLUDED
#define IFACE_H_INCLUDED

#include <fcntl.h>

typedef struct plugin_t {
	void *hndl;
	char *name;
	char *description;
	struct plugin_t *next;
} plugin_t;

#ifdef __cplusplus
extern "C" plugin_t *init();
#endif

#endif

Make plugins's init() function external C


/* */
#undef  VERSION
#define VERSION "1.35.2"
#define BDATE   "28 August 2004"
#define LSMDATE "28Aug04"

/* Debug flags */
#undef  DEBUG
#define DEBUG 1
#define TRACEBACK 1
#define SMCHECK
#define TRACE_FILE 1

/* Debug flags not normally turned on */

/* #define TRACE_JCR_CHAIN 1 */
/* #define TRACE_RES 1 */
/* #define DEBUG_MEMSET 1 */
#define DEBUG_BLOCK_ZEROING 1

/* #define FULL_DEBUG 1 */   /* normally on for testing only */

/* Turn this on ONLY if you want all Dmsg() to append to the
 *   trace file. Implemented mainly for Win32 ...
 */
/*  #define SEND_DMSG_TO_FILE 1 */

/* #define NO_ATTRIBUTES_TEST 1 */
/* #define NO_TAPE_WRITE_TEST 1 */
/* #define FD_NO_SEND TEST 1 */
/* #define DEBUG_MUTEX 1 */

/* */
#undef  VERSION
#define VERSION "1.35.2"
#define BDATE   "30 August 2004"
#define LSMDATE "30Aug04"

/* Debug flags */
#undef  DEBUG
#define DEBUG 1
#define TRACEBACK 1
#define SMCHECK
#define TRACE_FILE 1

/* Debug flags not normally turned on */

/* #define TRACE_JCR_CHAIN 1 */
/* #define TRACE_RES 1 */
/* #define DEBUG_MEMSET 1 */
#define DEBUG_BLOCK_ZEROING 1

/* #define FULL_DEBUG 1 */   /* normally on for testing only */

/* Turn this on ONLY if you want all Dmsg() to append to the
 *   trace file. Implemented mainly for Win32 ...
 */
/*  #define SEND_DMSG_TO_FILE 1 */

/* #define NO_ATTRIBUTES_TEST 1 */
/* #define NO_TAPE_WRITE_TEST 1 */
/* #define FD_NO_SEND TEST 1 */
/* #define DEBUG_MUTEX 1 */

Update manual
Fix CDROM script to handle non-existant files

git-svn-id: bb0627f6f70d46b61088c62c6186faa4b96a9496@1568 91ce42f0-d328-0410-95d8-f526ca767f89


#include <stdio.h>
#include <cs50.h>

int main(int argc, char *argv[]) {

    // check entered key
    if (argc != 2 || atoi(argv[1]) < 0) {
        printf("Usage: ./caesar k\nWhere k is a non negative integer.\n");
        return 1;
    }

    int key = atoi(argv[1]);

    return 0;
}

#include <stdio.h>
#include <cs50.h>
#include <string.h>
#define ALPHA_NUM 26

int main(int argc, char *argv[]) {

    // check argument number and argument key to be greater than -1
    if (argc != 2 || atoi(argv[1]) < 0) {
        printf("Usage (k >= 0):\n./caesar k \n");
        return 1;
    }

    int key = atoi(argv[1]) % ALPHA_NUM;

    // get plaintext from user
    printf("plaintext: ");
    string plaintext = get_string();
    printf("\n");

    string ciphertext = "";

    // encode plaintext
    size_t text_len = strlen(plaintext);
    for (int i = 0; i < text_len; ++i) {

    }

    return 0;
}

Add unfinished loop to encode message

Add  unfinished loop to encode message


/*
 * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
 */

#ifndef SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
#define SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_

#include <boost/array.hpp>
#include <boost/system/error_code.hpp>

#include <string>

#include "base/parse_object.h"
#include "bgp/bgp_common.h"

class SecurityGroup {
public:
    static const int kSize = 8;
    static const uint32_t kMinGlobalId = 1000000;
    static const uint32_t kMaxGlobalId = 1999999;
    typedef boost::array<uint8_t, kSize> bytes_type;

    SecurityGroup(as_t asn, uint32_t id);
    explicit SecurityGroup(const bytes_type &data);

    as_t as_number() const;
    uint32_t security_group_id() const;
    bool IsGlobal() const;

    const bytes_type &GetExtCommunity() const {
        return data_;
    }

    const uint64_t GetExtCommunityValue() const {
        return get_value(data_.begin(), 8);
    }
    std::string ToString();

private:
    bytes_type data_;
};

#endif  // SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_

/*
 * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
 */

#ifndef SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
#define SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_

#include <boost/array.hpp>
#include <boost/system/error_code.hpp>

#include <string>

#include "base/parse_object.h"
#include "bgp/bgp_common.h"

class SecurityGroup {
public:
    static const int kSize = 8;
    static const uint32_t kMinGlobalId = 1;
    static const uint32_t kMaxGlobalId = 7999999;
    typedef boost::array<uint8_t, kSize> bytes_type;

    SecurityGroup(as_t asn, uint32_t id);
    explicit SecurityGroup(const bytes_type &data);

    as_t as_number() const;
    uint32_t security_group_id() const;
    bool IsGlobal() const;

    const bytes_type &GetExtCommunity() const {
        return data_;
    }

    const uint64_t GetExtCommunityValue() const {
        return get_value(data_.begin(), 8);
    }
    std::string ToString();

private:
    bytes_type data_;
};

#endif  // SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_

Update min/max global SGIDs values to match Schema Transformer

Change-Id: I63d5634e9a374ce33e9e0e779caf499e8fbccdec
Closes-Bug: 1381145


/*
  This file is part of the kblog library.

  Copyright (c) 2006-2007 Christian Weilbach <christian_weilbach@web.de>
  Copyright (c) 2007 Mike Arthur <mike@mikearthur.co.uk>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; see the file COPYING.LIB.  If not, write to
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  Boston, MA 02110-1301, USA.
*/

#ifndef BLOGPOSTINGCOMMENT_P_H
#define BLOGPOSTINGCOMMENT_P_H

#include "blogcomment.h"

#include <KDateTime>
#include <KUrl>

namespace KBlog{

class BlogCommentPrivate
{
  public:
    BlogComment *q_ptr;
    QString mTitle;
    QString mContent;
    QString mEmail;
    QString mName;
    QString mCommentId;
    KUrl mUrl;
    QString mError;
    BlogComment::Status mStatus;
    KDateTime mModificationDateTime;
    KDateTime mCreationDateTime;
};

} // namespace KBlog
#endif

Add file that SVN somehow missed.

Add file that SVN somehow missed.

svn path=/trunk/KDE/kdepimlibs/; revision=711804


#include <stdio.h>

void increase_coordinates();

typedef struct {

	int x;
	int y;
	int z;

} Point;

Point pt;

int main () {

	printf("x = ");scanf("%d",&pt.x);
	printf("y = ");scanf("%d",&pt.y);
	printf("z = ");scanf("%d",&pt.z);

	increase_coordinates();

	printf("\nx = %d", pt.x);
	printf("\ny = %d", pt.y);
	printf("\nz = %d", pt.z);

	return 0;
}

void increase_coordinates () {

	pt.x = pt.x + 1;
	pt.y = pt.y + 1;
	pt.z = pt.z + 1;

}

Add task with points for October

Add task with points for October


//PARAM: --enable ana.int.wrap_on_signed_overflow
#include<stdio.h>
#include<assert.h>

int main() {
  int i,k,j;

  if (k == 5) {
    assert(k == 5);
    return 0;
  }
  assert(k != 5);

  // simple arithmetic
  i = k + 1;
  assert(i != 6);
  i = k - 1;
  assert(i != 4);
  i = k * 3;       // multiplication with odd numbers is injective
  assert(i != 15);
  i = k * 2;       // multiplication with even numbers is not injective
  assert(i != 10); // UNKNOWN! k could be -2147483643;
  i = k / 2;
  assert(i != 2); // UNKNOWN! k could be 4

  return 0;
}

//PARAM: --enable ana.int.wrap_on_signed_overflow
// Enabling ana.int.wrap_on_signed_overflow here, to retain precision for cases when a signed overflow might occcur
#include<stdio.h>
#include<assert.h>

int main() {
  int i,k,j;

  if (k == 5) {
    assert(k == 5);
    return 0;
  }
  assert(k != 5);

  // Signed overflows might occur in some of the following operations (e.g. the first assignment k could be MAX_INT).
  // Signed overflows are undefined behavior, so by default we go to top when they might occur.
  // Here we activated wrap_on_signed_overflow, so we retain precision, assuming that signed overflows are defined (via the usual two's complement representation).

  // simple arithmetic
  i = k + 1;
  assert(i != 6);
  i = k - 1;
  assert(i != 4);
  i = k * 3;       // multiplication with odd numbers is injective
  assert(i != 15);
  i = k * 2;       // multiplication with even numbers is not injective
  assert(i != 10); // UNKNOWN! k could be -2147483643;
  i = k / 2;
  assert(i != 2); // UNKNOWN! k could be 4

  return 0;
}

Add comment on why ana.int.wrap_on_signed_overflow needs to enabled for test case


//
//  KVODelegate.h
//  KVODelegate
//
//  Created by Ian Gregory on 15-03-2017.
//  Copyright © 2017 ThatsJustCheesy. All rights reserved.
//

#import <Foundation/Foundation.h>

#import <KVODelegate/KVOObservationDelegate.h>
#import <KVODelegate/KVONotificationDelegate.h>

//
//  KVODelegate.h
//  KVODelegate
//
//  Created by Ian Gregory on 15-03-2017.
//  Copyright © 2017 ThatsJustCheesy. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "KVOObservationDelegate.h"
#import "KVONotificationDelegate.h"

Use quoted includes in umbrella header

Use quoted includes in umbrella header


#include <math.h>
#include "abBlood.h"

void updateAB(simBac *sim)
{
    sim->c_b = sim->c_b_peak * \
        exp( -1 * sim->param.k_a * \
        ( sim->t - sim->param.doses_t[sim->dose_num-1] ) \
        / sim->param.v_w );
        // Exponential decay from last time spike
        // ( 1.0 - sim->param.t_s * sim->param.gam_ab ) * sim->c_b;
        // Exponential decay according to renal clearance rate

    if (sim->c_b < 0) // set 0 as min concentration
    {
        sim->c_b = 0;
    }

    if (sim->dose_num < sim->param.num_doses) // if under total number of doses
    {
        if (sim->t >= sim->param.doses_t[sim->dose_num])
            // If we're at the next dosing time...
        {
            sim->c_b += sim->param.doses_c[sim->dose_num];
                // Add concentration of next dose to blood
            ++sim->dose_num; // Advance dose counter
            sim->c_b_peak = sim->c_b; // set new peak concentration
        }
    }
}

#include <math.h>
#include "abBlood.h"

void updateAB(simBac *sim)
{
    sim->c_b = sim->c_b_peak * \
        exp( -1 * sim->param.k_a * \
        ( sim->t - sim->param.doses_t[sim->dose_num-1] ) \
        / sim->param.v_w );
        // Exponential decay from last time spike
        // ( 1.0 - sim->param.t_s * sim->param.gam_ab ) * sim->c_b;
        // Exponential decay according to renal clearance rate

    if (sim->c_b < sim->param.c_c / 2) // set half of c_c as min concentration
    {
        sim->c_b = sim->param.c_c / 2;
    }

    if (sim->dose_num < sim->param.num_doses) // if under total number of doses
    {
        if (sim->t >= sim->param.doses_t[sim->dose_num])
            // If we're at the next dosing time...
        {
            sim->c_b += sim->param.doses_c[sim->dose_num];
                // Add concentration of next dose to blood
            ++sim->dose_num; // Advance dose counter
            sim->c_b_peak = sim->c_b; // set new peak concentration
        }
    }
}

Add antibiotic concentration artificial minimum floor


/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef _SPMI_DBGFS_H
#define _SPMI_DBGFS_H

#include <linux/debugfs.h>

#ifdef CONFIG_DEBUG_FS
int spmi_dfs_add_controller(struct spmi_controller *ctrl);
int spmi_dfs_del_controller(struct spmi_controller *ctrl);
#else
static inline int spmi_dfs_add_controller(struct spmi_controller *ctrl)
{
	return 0;
}
static inline int spmi_dfs_del_controller(struct spmi_controller *ctrl)
{
	return 0;
}
#endif

struct dentry *spmi_dfs_create_file(struct spmi_controller *ctrl,
					const char *name, void *data,
					const struct file_operations *fops);

#endif /* _SPMI_DBGFS_H */

/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef _SPMI_DBGFS_H
#define _SPMI_DBGFS_H

#include <linux/debugfs.h>

#ifdef CONFIG_DEBUG_FS
int spmi_dfs_add_controller(struct spmi_controller *ctrl);
int spmi_dfs_del_controller(struct spmi_controller *ctrl);
struct dentry *spmi_dfs_create_file(struct spmi_controller *ctrl,
					const char *name, void *data,
					const struct file_operations *fops);
#else
static inline int spmi_dfs_add_controller(struct spmi_controller *ctrl)
{
	return 0;
}
static inline int spmi_dfs_del_controller(struct spmi_controller *ctrl)
{
	return 0;
}

static inline struct dentry *spmi_dfs_create_file(struct spmi_controller *ctrl,
					const char *name, void *data,
					const struct file_operations *fops)
{
	return 0;
}
#endif

#endif /* _SPMI_DBGFS_H */

spmi: Fix compilation error when debugfs is disabled

Code does not compile with debugfs disabled. Fix this.

Change-Id: I11fa09401f29e9f2fb65d19668cae455253f6355
Signed-off-by: Olav Haugan <fbf4ddd114d5f0aa83cb721b7dacab8a264ccf22@codeaurora.org>


// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s

#include <stdint.h>

static int f = 10;
static int b = f; // expected-error {{initializer element is not a compile-time constant}}

float r  = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
intptr_t s = (intptr_t) &s;
_Bool t = &t;

union bar {
  int i;
};

struct foo {
  unsigned ptr;
};

union bar u[1];
struct foo x = {(intptr_t) u}; // no-error
struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}

// RUN: %clang_cc1 -fsyntax-only -verify %s

typedef __typeof((int*) 0 - (int*) 0) intptr_t;

static int f = 10;
static int b = f; // expected-error {{initializer element is not a compile-time constant}}

float r  = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
intptr_t s = (intptr_t) &s;
_Bool t = &t;

union bar {
  int i;
};

struct foo {
  unsigned ptr;
};

union bar u[1];
struct foo x = {(intptr_t) u}; // no-error
struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}

Fix test to not force triple, and also to not need stdint.h.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@96499 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-09-05     Meco Man     fix bugs
 * 2020-12-16     Meco Man     add useconds_t
 */
#ifndef __SYS_TYPES_H__
#define __SYS_TYPES_H__

#include <stdint.h>
#include <stddef.h>
#include <time.h>

typedef int32_t          clockid_t;
typedef int32_t          key_t;         /* Used for interprocess communication. */
typedef int              pid_t;         /* Used for process IDs and process group IDs. */
typedef unsigned short   uid_t;
typedef unsigned short   gid_t;
typedef signed long      off_t;
typedef int              mode_t;
#ifndef ARCH_CPU_64BIT
typedef signed int       ssize_t;       /* Used for a count of bytes or an error indication. */
#else
typedef long signed int  ssize_t;       /* Used for a count of bytes or an error indication. */
#endif
typedef long             suseconds_t;   /* microseconds. */
typedef unsigned long    useconds_t;    /* microseconds (unsigned) */

typedef unsigned long    dev_t;

typedef unsigned int     u_int;
typedef unsigned char    u_char;
typedef unsigned long    u_long;

#endif

Add a blank line at the end

[update] Add a blank line at the end


/**
 *  @copyright Copyright 2017 The J-PET Framework Authors. All rights reserved.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may find a copy of the License in the LICENCE file.
 *
 *  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.
 *
 *  @file EventCategorizerTools.h
 */

#ifndef _EVENTCATEGORIZERTOOLS_H_
#define _EVENTCATEGORIZERTOOLS_H_

#include <DataObjects/JPetHit/JPetHit.h>

struct Point3D
{
  double x=0;
  double y=0;
  double z=0;
};

class EventCategorizerTools
{
public:
    static double calculateTOF(const JPetHit& firstHit, const JPetHit& latterHit);
    static Point3D calculateAnnihilationPoint(const JPetHit& firstHit, const JPetHit& latterHit);
};

#endif /*  !EVENTCATEGORIZERTOOLS_H */

/**
 *  @copyright Copyright 2017 The J-PET Framework Authors. All rights reserved.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may find a copy of the License in the LICENCE file.
 *
 *  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.
 *
 *  @file EventCategorizerTools.h
 */

#ifndef _EVENTCATEGORIZERTOOLS_H_
#define _EVENTCATEGORIZERTOOLS_H_

#include <JPetHit/JPetHit.h>

struct Point3D
{
  double x=0;
  double y=0;
  double z=0;
};

class EventCategorizerTools
{
public:
    static double calculateTOF(const JPetHit& firstHit, const JPetHit& latterHit);
    static Point3D calculateAnnihilationPoint(const JPetHit& firstHit, const JPetHit& latterHit);
};

#endif /*  !EVENTCATEGORIZERTOOLS_H */

Change include to proper one

Change include to proper one


// KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h

#define KMAIL_VERSION "1.9.9"

#endif /*kmversion_h*/

// KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h

#define KMAIL_VERSION "1.9.10"

#endif /*kmversion_h*/

Increase version number for KDE 3.5.10.

Increase version number for KDE 3.5.10.

svn path=/branches/KDE/3.5/kdepim/; revision=846406


/*
* parser item
* (c) Copyright 2015 Micooz
*
* Released under the Apache License.
* See the LICENSE file or
* http://www.apache.org/licenses/LICENSE-2.0.txt for more information.
*/
#ifndef PARSER_ITEM_H_
#define PARSER_ITEM_H_

#include <sstream>

namespace program_options {

class ParseItem {
 public:
  ParseItem(const std::string& value);

  /*
   * dynamic type cast, support base data types including std::string
   */
  template <typename T>
  T as() {
    T r;
    std::stringstream buf;
    buf << value_;
    buf >> r;
    return r;
  }

  /*
   * alias of as<std::string>()
   */
  inline std::string val() const { return value_; }

 private:
  std::string value_;
};
}

#endif  // PARSER_ITEM_H_

/*
* parser item
* (c) Copyright 2015 Micooz
*
* Released under the Apache License.
* See the LICENSE file or
* http://www.apache.org/licenses/LICENSE-2.0.txt for more information.
*/
#ifndef PARSER_ITEM_H_
#define PARSER_ITEM_H_

#include <sstream>

namespace program_options {

class ParseItem {
 public:
  ParseItem(const std::string& value);

  /*
   * dynamic type cast, support base data types including std::string
   */
  template<typename T>
  T as() {
    T r;
    std::stringstream buf;
    buf << value_;
    buf >> r;
    return r;
  }

  /*
   * alias of as<std::string>()
   */
  inline std::string val() const { return value_; }

  /*
   * returns c-style string, will be useful if you want a const char*
   */
  inline const char* c_str() const { return value_.c_str(); }

 private:
  std::string value_;
};
}

#endif  // PARSER_ITEM_H_

Add a function of ParseItem which returns a c-style string directly.


/**
 * @file
 *
 * (c) CossackLabs
 */

#ifndef _SECURE_RECORD_H_
#define _SECURE_RECORD_H_

typedef struct themis_secure_record_type themis_secure_record_t;

themis_secure_record_t* themis_secure_record_create(const uint8_t* master_key, const size_t master_key_length);

themis_status_t themis_secure_record_encrypt_1(themis_secure_record_t* ctx,
					       const uint8_t* message,
					       const size_t message_length,
					       uint8_t* encrypted_message,
					       size_t* encrypted_message_length);

themis_status_t themis_secure_record_decrypt_1(themis_secure_record_t* ctx,
					       const uint8_t* encrypted_message,
					       const size_t encrypted_message_length,
					       uint8_t* plain_message,
					       size_t* plain_message_length);

themis_status_t themis_secure_record_encrypt_2(themis_secure_record_t* ctx,
					       const uint8_t* message,
					       const size_t message_length,
					       uint8_t* auth_tag_iv,
					       size_t* auth_tag_iv_length,
					       uint8_t* encrypted_message,
					       size_t* encrypted_message_length);

themis_status_t themis_secure_record_decrypt_2(themis_secure_record_t* ctx,
					       const uint8_t* encrypted_message,
					       const size_t encrypted_message_length,
					       const uint8_t* auth_tag_iv,
					       const size_t auth_tag_iv_length,
					       uint8_t* plain_message,
					       size_t* plain_message_length);

themis_status_t themis_secure_record_encrypt_3(themis_secure_record_t* ctx,
					       const uint8_t* message,
					       const size_t message_length,
					       const uint8_t* auth_tag_iv,
					       const size_t auth_tag_iv_length,
					       uint8_t* encrypted_message,
					       size_t* encrypted_message_length);

themis_status_t themis_secure_record_decrypt_3(themis_secure_record_t* ctx,
					       const uint8_t* encrypted_message,
					       const size_t encrypted_message_length,
					       const uint8_t* auth_tag_iv,
					       const size_t auth_tag_iv_length,
					       uint8_t* plain_message,
					       size_t* plain_message_length);

themis_status_t themis_secure_record_destroy(themis_secure_record_t* ctx);

#endif /* _SECURE_RECORD_H_ */

Add THEMIS Secure Record interface

Add THEMIS Secure Record interface


/**
 * @file MEGAHandleList+init
 * @brief Private functions of MEGAHandleList
 *
 * (c) 2013-2017 by Mega Limited, Auckland, New Zealand
 *
 * This file is part of the MEGA SDK - Client Access Engine.
 *
 * Applications using the MEGA API must present a valid application key
 * and comply with the the rules set forth in the Terms of Service.
 *
 * The MEGA SDK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright Simplified (2-clause) BSD License.
 *
 * You should have received a copy of the license along with this
 * program.
 */

#import "MEGAHandleList.h"
#import "megaapi.h"

@interface MEGAHandleList (init)

- (mega::MegaHandleList *)getCPtr;

@end

/**
 * @file MEGAHandleList+init
 * @brief Private functions of MEGAHandleList
 *
 * (c) 2013-2017 by Mega Limited, Auckland, New Zealand
 *
 * This file is part of the MEGA SDK - Client Access Engine.
 *
 * Applications using the MEGA API must present a valid application key
 * and comply with the the rules set forth in the Terms of Service.
 *
 * The MEGA SDK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright Simplified (2-clause) BSD License.
 *
 * You should have received a copy of the license along with this
 * program.
 */

#import "MEGAHandleList.h"
#import "megaapi.h"

@interface MEGAHandleList (init)

- (instancetype)initWithMegaHandleList:(mega::MegaHandleList *)megaHandleList cMemoryOwn:(BOOL)cMemoryOwn;
- (mega::MegaHandleList *)getCPtr;

@end

Add the ctor for MEGAHandleList (Obj-C)

Add the ctor for MEGAHandleList (Obj-C)


// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8a+ssbs   %s 2>&1 | FileCheck %s
// CHECK: "-target-feature" "+ssbs"

// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8a+nossbs %s 2>&1 | FileCheck %s --check-prefix=NOSSBS
// NOSSBS: "-target-feature" "-ssbs"

// RUN: %clang -### -target aarch64-none-none-eabi                      %s 2>&1 | FileCheck %s --check-prefix=ABSENTSSBS
// ABSENTSSBS-NOT: "-target-feature" "+ssbs"
// ABSENTSSBS-NOT: "-target-feature" "-ssbs"

Add command-line option for SSBS

[AArch64] Add command-line option for SSBS

Summary:
SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds testing for
the ssbs command line option, added to allow enabling the feature
in previous Armv8-A architectures to 8.5.

Reviewers: olista01, samparker, aemerson

Reviewed By: samparker

Subscribers: javed.absar, kristof.beyls, cfe-commits

Differential Revision: https://reviews.llvm.org/D54961

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@348142 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * Copyright (C) 2015 BMW Car IT GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
#define CAPU_WINDOWS_ENVIRONMENTVARIABLES_H

#include <capu/os/Generic/EnvironmentVariables.h>

namespace capu
{
    namespace os
    {
        class EnvironmentVariables: private capu::generic::EnvironmentVariables
        {
        public:
            using capu::generic::EnvironmentVariables::getAll;
            static bool get(const String& key, String& value);
        };

        inline
        bool EnvironmentVariables::get(const String& key, String& value)
        {
            char* envValue = 0;
            bool found = (0 == _dupenv_s(&envValue, 0, key.c_str()));
            value = envValue;
            free(envValue);
            return found;
        }
    }
}

#endif // CAPU_WINDOWS_ENVIRONMENTVARIABLES_H

/*
 * Copyright (C) 2015 BMW Car IT GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef CAPU_WINDOWS_ENVIRONMENTVARIABLES_H
#define CAPU_WINDOWS_ENVIRONMENTVARIABLES_H

#include <capu/os/Generic/EnvironmentVariables.h>

namespace capu
{
    namespace os
    {
        class EnvironmentVariables: private capu::generic::EnvironmentVariables
        {
        public:
            using capu::generic::EnvironmentVariables::getAll;
            static bool get(const String& key, String& value);
        };

        inline
        bool EnvironmentVariables::get(const String& key, String& value)
        {
            char* envValue = 0;
            errno_t err = _dupenv_s(&envValue, 0, key.c_str());
            bool found = (err == 0 && envValue != 0);
            value = envValue;
            free(envValue);
            return found;
        }
    }
}

#endif // CAPU_WINDOWS_ENVIRONMENTVARIABLES_H

Fix enviroment variable getter on windows

found result was always true because condition only checked error code,
not if there is really a value

Change-Id: Ie8b8edab0419c629dd558ce9b5466a582de359f8


//
//  NSNumber+Fix.h
//  LYCategory
//
//  Created by Rick Luo on 11/25/13.
//  Copyright (c) 2013 Luo Yu. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSNumber (Fix)

- (id)objectAtIndex:(NSUInteger)index;

- (id)objectForKey:(id)aKey;

- (BOOL)isEqualToString:(NSString *)aString;

- (NSUInteger)length;

- (NSString *)string;

@end

//
//  NSNumber+Fix.h
//  LYCategory
//
//  Created by Rick Luo on 11/25/13.
//  Copyright (c) 2013 Luo Yu. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSNumber (Fix)

- (id)objectAtIndex:(NSUInteger)index;

- (id)objectForKey:(id)aKey;

- (BOOL)isEqualToString:(NSString *)aString;

- (NSUInteger)length;

- (NSString *)string;

- (BOOL)isReal;

@end

Fix : is real for number object.

Fix : is real for number object.


// RUN: %clang_asan -O2 %s -o %t
// RUN: %env_asan_opts=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s

// FIXME: sprintf is not intercepted on Windows yet.
// XFAIL: win32

#include <stdio.h>
int main() {
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile char buf[2];
  puts("before sprintf");
  sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
  puts("after sprintf");
  puts((const char *)buf);
  return 0;
  // Check that size of output buffer is sanitized.
  // CHECK-ON: before sprintf
  // CHECK-ON-NOT: after sprintf
  // CHECK-ON: stack-buffer-overflow
  // CHECK-ON-NOT: 0 12 1.239 34
}

// RUN: %clang_asan -O2 %s -o %t
// RUN: %env_asan_opts=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s

// FIXME: sprintf is not intercepted on Windows yet.
// XFAIL: win32

#include <stdio.h>
int main() {
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile char buf[2];
  fputs(stderr, "before sprintf");
  sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
  fputs(stderr, "after sprintf");
  fputs(stderr, (const char *)buf);
  return 0;
  // Check that size of output buffer is sanitized.
  // CHECK-ON: before sprintf
  // CHECK-ON-NOT: after sprintf
  // CHECK-ON: stack-buffer-overflow
  // CHECK-ON-NOT: 0 12 1.239 34
}

Switch to fputs stderr to try to fix output buffering issues

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@263293 91177308-0d34-0410-b5e6-96231b3b80d8


//===--- AllDiagnostics.h - Aggregate Diagnostic headers --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Includes all the separate Diagnostic headers & some related helpers.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H
#define LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H

#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/CommentDiagnostic.h"
#include "clang/Analysis/AnalysisDiagnostic.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "clang/Serialization/SerializationDiagnostic.h"

namespace clang {
template <size_t SizeOfStr, typename FieldType>
class StringSizerHelper {
  char FIELD_TOO_SMALL[SizeOfStr <= FieldType(~0U) ? 1 : -1];
public:
  enum { Size = SizeOfStr };
};
} // end namespace clang

#define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \
                                                        fieldTy>::Size

#endif

//===--- AllDiagnostics.h - Aggregate Diagnostic headers --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Includes all the separate Diagnostic headers & some related helpers.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H
#define LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H

#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/CommentDiagnostic.h"
#include "clang/Analysis/AnalysisDiagnostic.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "clang/Serialization/SerializationDiagnostic.h"

namespace clang {
template <size_t SizeOfStr, typename FieldType>
class StringSizerHelper {
  static_assert(SizeOfStr <= FieldType(~0U), "Field too small!");
public:
  enum { Size = SizeOfStr };
};
} // end namespace clang

#define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \
                                                        fieldTy>::Size

#endif

[Basic] Use a static_assert instead of using the old array of size -1 trick.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@305439 91177308-0d34-0410-b5e6-96231b3b80d8


#include <stddef.h>
#include <time.h>
#include <pthread.h>
#include <stdlib.h>
#include "timers.h"

struct timer_data_t {
    long millis;
    timer_callback_t timer_callback;
    void* data;
};

void *timer_thread(void *data) {

    struct timer_data_t *timer_data = data;

    struct timespec t;
    t.tv_sec = timer_data->millis / 1000;
    t.tv_nsec = 1000 * 1000 * (timer_data->millis % 1000);
    nanosleep(&t, NULL);
    timer_data->timer_callback(timer_data->data);

    free(data);

    return NULL;
}

void start_timer(long millis, timer_callback_t timer_callback, void *data) {

    struct timer_data_t *timer_data = malloc(sizeof(struct timer_data_t));
    timer_data->millis = millis;
    timer_data->timer_callback = timer_callback;
    timer_data->data = data;

    pthread_attr_t attr;
    pthread_attr_init(&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    pthread_t thread;
    pthread_create(&thread, &attr, timer_thread, timer_data);
}

#include <stddef.h>
#include <time.h>
#include <pthread.h>
#include <stdlib.h>
#include "timers.h"

struct timer_data_t {
    long millis;
    timer_callback_t timer_callback;
    void* data;
};

void *timer_thread(void *data) {

    struct timer_data_t *timer_data = data;

    struct timespec t;
    t.tv_sec = timer_data->millis / 1000;
    t.tv_nsec = 1000 * 1000 * (timer_data->millis % 1000);
    if (t.tv_sec == 0 && t.tv_nsec == 0) {
        t.tv_nsec = 1; /* Evidently needed on Ubuntu 14.04 */
    }
    nanosleep(&t, NULL);
    timer_data->timer_callback(timer_data->data);

    free(data);

    return NULL;
}

void start_timer(long millis, timer_callback_t timer_callback, void *data) {

    struct timer_data_t *timer_data = malloc(sizeof(struct timer_data_t));
    timer_data->millis = millis;
    timer_data->timer_callback = timer_callback;
    timer_data->data = data;

    pthread_attr_t attr;
    pthread_attr_init(&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    pthread_t thread;
    pthread_create(&thread, &attr, timer_thread, timer_data);
}

Fix bug if timer executed with 0 ms

Fix bug if timer executed with 0 ms


#ifndef _NEWSPAPER_H_
#define _NEWSPAPER_H_
#include <string>
#include "advertenum.h"
using namespace std;
class Newspaper {
    string name;
    int textPrice, imagePrice, textImagePrice;
    public:
    Newspaper(const string& name): name(name) {}
    int getPriceFor(AdvertType type) const {
        switch(type) {
            case AdvertType::Image:
                return imagePrice;
            case AdvertType::Text:
                return textPrice;
            case AdvertType::TextImage:
                return textImagePrice;
        }
    }
    void setPriceFor(AdvertType type, int price) {
        switch(type) {
            case AdvertType::Image:
                imagePrice=price;
            case AdvertType::Text:
                textPrice=price;
            case AdvertType::TextImage:
                textImagePrice=price;
        }
    }
    const string& getName() const {
        return name;
    }
    virtual ~Newspaper() {}
};
#endif

#ifndef NEWSPAPER_H
#define NEWSPAPER_H
#include <string>
#include "advertenum.h"
using namespace std;
class Newspaper {
    string name;
    int textPrice, imagePrice, textImagePrice;
    public:
    Newspaper(): name("") {}
    Newspaper(const string& name): name(name) {}
    int getPriceFor(AdvertType type) const {
        switch(type) {
            case AdvertType::Image:
                return imagePrice;
            case AdvertType::Text:
                return textPrice;
            case AdvertType::TextImage:
                return textImagePrice;
        }
        return 0;
    }
    void setPriceFor(AdvertType type, int price) {
        switch(type) {
            case AdvertType::Image:
                imagePrice=price;
            case AdvertType::Text:
                textPrice=price;
            case AdvertType::TextImage:
                textImagePrice=price;
        }
    }
    const string& getName() const {
        return name;
    }
    virtual ~Newspaper() {}
};
#endif

Fix header guard, add impossible return value, add default name


/* Mobile On Desktop - A Smartphone emulator on desktop
 * Copyright (c) 2012 Régis FLORET
 *
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Régis FLORET nor the names of its contributors
 * 	  may be used to endorse or promote products derived from this
 * 	  software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef WEBWIDGET_H
#define WEBWIDGET_H

#include "webpage.h"

#include <QtWebKit>
#include <QStringList>

class WebWidget : public QWebView
{
        Q_OBJECT
    public:
        WebWidget(QWidget * parent=0);
        virtual void wheelEvent(QWheelEvent *);

    public slots:
        void changeFor(WebPage::UserAgents agent);
        void refitPage();

    private slots:
        void onNetworkReply(QNetworkReply * reply);
        void refitPage(bool b);

    signals:
        void noHostFound(QUrl);
        void connectionRefused();
        void remotlyClosed();
        void timeOut();
        void operationCancelled();
        void pageNotFound(QUrl);

    private:
        WebPage * mWebPage;
};

#endif // WEBWIDGET_H

Add BSD header on top of all files (forgot some files)


/*! @file GTMAppAuth.h
    @brief GTMAppAuth SDK
    @copyright
        Copyright 2016 Google Inc.
    @copydetails
        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
 */

#import "GTMAppAuthFetcherAuthorization.h"
#import "GTMAppAuthFetcherAuthorization+Keychain.h"
#import "GTMKeychain.h"

#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS
#import "GTMOAuth2KeychainCompatibility.h"
#elif TARGET_OS_MAC
#import "GTMOAuth2KeychainCompatibility.h"
#else
#warn "Platform Undefined"
#endif

/*! @file GTMAppAuth.h
    @brief GTMAppAuth SDK
    @copyright
        Copyright 2016 Google Inc.
    @copydetails
        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
 */

#import "GTMAppAuthFetcherAuthorization.h"
#import "GTMAppAuthFetcherAuthorization+Keychain.h"

#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS || TARGET_OS_MAC
#import "GTMKeychain.h"
#import "GTMOAuth2KeychainCompatibility.h"
#else
#warn "Platform Undefined"
#endif

Move to iOS and Mac targets only.

Move to iOS and Mac targets only.


// batwarn - (C) 2015-2016 Jeffrey E. Bedard

#ifndef CONFIG_H
#define	CONFIG_H

#define GAMMA_NORMAL    1.0
#define GAMMA_WARNING   5.0

enum {
	CRIT_PERCENT=5
	,LOW_PERCENT=10
	,FULL_PERCENT=90
};

#ifndef DEBUG
#define WAIT 60
#else//DEBUG
#define WAIT 1
#endif//!DEBUG

#define BATSYSFILE "/sys/class/power_supply/BAT0/capacity"
#define ACSYSFILE "/sys/class/power_supply/AC/online"

#define SUSPEND_CMD "systemctl suspend"

#endif//CONFIG_H

// batwarn - (C) 2015-2016 Jeffrey E. Bedard

#ifndef BW_CONFIG_H
#define	BW_CONFIG_H

#define GAMMA_NORMAL    1.0
#define GAMMA_WARNING   5.0

enum PercentCat {
	CRIT_PERCENT=5,
	LOW_PERCENT=10,
	FULL_PERCENT=90
};

// Delay for checking system files:
#ifndef DEBUG
enum { WAIT = 60 };
#else//DEBUG
enum { WAIT = 1 };
#endif//!DEBUG

// System files to check:
#define BATSYSFILE "/sys/class/power_supply/BAT0/capacity"
#define ACSYSFILE "/sys/class/power_supply/AC/online"

#define SUSPEND_CMD "systemctl suspend"

#endif//!BW_CONFIG_H

Convert defines to enums. Named percentage category enum. Documented values.


/* Copyright (c) 2012 Francis Russell <francis@unchartedbackwaters.co.uk>
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#include <stdlib.h>
#include <stdio.h>
#include "memory.h"

void *lmalloc(const size_t size)
{
  void* const data = malloc(size);

  if (data == NULL)
  {
    fprintf(stderr, "Failed to allocate region of %li bytes.\n", size);
    exit(EXIT_FAILURE);
  }

  return data;
}

void lfree(void *const data)
{
  free(data);
}

/* Copyright (c) 2012 Francis Russell <francis@unchartedbackwaters.co.uk>
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#include <stdlib.h>
#include <stdio.h>
#include "memory.h"

void *lmalloc(const size_t size)
{
  void* const data = malloc(size);

  if (data == NULL)
  {
    fprintf(stderr, "Failed to allocate region of %zu bytes.\n", size);
    exit(EXIT_FAILURE);
  }

  return data;
}

void lfree(void *const data)
{
  free(data);
}

Fix warning on printing value of type size_t.

Monotone-Parent: f3b43f63ea982bf3ea58c1b0757c412b6a05a42a
Monotone-Revision: 159ac37e2f3b80788fff369effa2496f32bc5adf


//
//  CSSAttributeSelector.h
//  HTMLKit
//
//  Created by Iska on 14/05/15.
//  Copyright (c) 2015 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CSSSelector.h"
#import "CSSSimpleSelector.h"

typedef NS_ENUM(NSUInteger, CSSAttributeSelectorType)
{
	CSSAttributeSelectorExists,
	CSSAttributeSelectorExactMatch,
	CSSAttributeSelectorIncludes,
	CSSAttributeSelectorBegins,
	CSSAttributeSelectorEnds,
	CSSAttributeSelectorContains,
	CSSAttributeSelectorHyphen
};

@interface CSSAttributeSelector : CSSSelector <CSSSimpleSelector>

@property (nonatomic, assign) CSSAttributeSelectorType type;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *value;

+ (instancetype)selectorForClass:(NSString *)className;
+ (instancetype)selectorForId:(NSString *)elementId;

- (instancetype)initWithType:(CSSAttributeSelectorType)type
			   attributeName:(NSString *)name
			  attrbiuteValue:(NSString *)value;

@end

//
//  CSSAttributeSelector.h
//  HTMLKit
//
//  Created by Iska on 14/05/15.
//  Copyright (c) 2015 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CSSSelector.h"
#import "CSSSimpleSelector.h"

typedef NS_ENUM(NSUInteger, CSSAttributeSelectorType)
{
	CSSAttributeSelectorExists,
	CSSAttributeSelectorExactMatch,
	CSSAttributeSelectorIncludes,
	CSSAttributeSelectorBegins,
	CSSAttributeSelectorEnds,
	CSSAttributeSelectorContains,
	CSSAttributeSelectorHyphen,
	CSSAttributeSelectorNot
};

@interface CSSAttributeSelector : CSSSelector <CSSSimpleSelector>

@property (nonatomic, assign) CSSAttributeSelectorType type;
@property (nonatomic, copy) NSString * _Nonnull name;
@property (nonatomic, copy) NSString * _Nonnull value;

+ (nullable instancetype)selectorForClass:(nonnull NSString *)className;
+ (nullable instancetype)selectorForId:(nonnull NSString *)elementId;

- (nullable instancetype)initWithType:(CSSAttributeSelectorType)type
						attributeName:(nonnull NSString *)name
					   attrbiuteValue:(nullable NSString *)value;

@end

Add nullability specifiers to attribute selector


/*=========================================================================
 *
 *  Copyright Insight Software Consortium
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef itkMetaEvent_h
#define itkMetaEvent_h

#include "itkMacro.h"
#include "metaEvent.h"

namespace itk
{
/** \class MetaEvent
 * \brief Event abstract class
 * \ingroup ITKSpatialObjects
 */
class MetaEvent : public :: MetaEvent
{
public:
  MetaEvent();
  virtual ~MetaEvent();
};
} // end namespace itk

#endif

/*=========================================================================
 *
 *  Copyright Insight Software Consortium
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef itkMetaEvent_h
#define itkMetaEvent_h

#include "itkMacro.h"
#include "metaEvent.h"

namespace itk
{
/** \class MetaEvent
 * \brief Event abstract class
 *
 * The itk::MetaEvent inherits from the
 * global namespace ::MetaEvent that is provided
 * by the MetaIO/src/metaEvent.h class.
 * \ingroup ITKSpatialObjects
 */
class MetaEvent : public ::MetaEvent
{
public:
  MetaEvent();
  virtual ~MetaEvent();
};
} // end namespace itk

#endif

DOC: Clarify strange syntax for itk::MetaEvent

The itk::MetaEvent inherits from the
global namespace ::MetaEvent that is provided
by the MetaIO/src/metaEvent.h class.

Change-Id: I43aaeeee22298b69cfe4f1acb06186f9599586ac


// ======================================================================
/*!
 * \brief A Meb Maps Service Layer data structure for query data layer
 *
 * Characteristics:
 *
 *  -
 *  -
 */
// ======================================================================

#pragma once

#include "WMSConfig.h"

namespace SmartMet
{
namespace Plugin
{
namespace WMS
{
class WMSQueryDataLayer : public WMSLayer
{
 private:
  const Engine::Querydata::Engine* itsQEngine;
  const std::string itsProducer;
  boost::posix_time::ptime itsModificationTime = boost::posix_time::from_time_t(0);

 protected:
  virtual void updateLayerMetaData();

 public:
  WMSQueryDataLayer(const WMSConfig& config, const std::string& producer)
      : WMSLayer(config), itsQEngine(config.qEngine()), itsProducer(producer)
  {
  }

  const boost::posix_time::ptime& modificationTime() const override;
};

}  // namespace WMS
}  // namespace Plugin
}  // namespace SmartMet

// ======================================================================
/*!
 * \brief A Meb Maps Service Layer data structure for query data layer
 *
 * Characteristics:
 *
 *  -
 *  -
 */
// ======================================================================

#pragma once

#include "WMSConfig.h"

namespace SmartMet
{
namespace Plugin
{
namespace WMS
{
class WMSQueryDataLayer : public WMSLayer
{
 private:
  const Engine::Querydata::Engine* itsQEngine;
  const std::string itsProducer;
  boost::posix_time::ptime itsModificationTime = boost::posix_time::from_time_t(0);

 protected:
  void updateLayerMetaData() override;

 public:
  WMSQueryDataLayer(const WMSConfig& config, const std::string& producer)
      : WMSLayer(config), itsQEngine(config.qEngine()), itsProducer(producer)
  {
  }

  const boost::posix_time::ptime& modificationTime() const override;
};

}  // namespace WMS
}  // namespace Plugin
}  // namespace SmartMet

Use override (pacify clang++ warning)

Use override (pacify clang++ warning)


#pragma once

#include "Control.h"

#include <CommCtrl.h>

class Spinner : public Control {
public:
    Spinner() {

    }

    Spinner(int id, HWND parent) :
    Control(id, parent) {

    }

    virtual void Enable();
    virtual void Disable();

    void Buddy(int buddyId);

    /// <summary>Sets the range (min, max) for the spin control.</summary>
    /// <param name="lo">Lower bound for the spinner.</param>
    /// <param name="hi">Upper bound for the spinner.</param>
    void Range(int lo, int hi);

    std::wstring Text();
    int TextAsInt();
    bool Text(std::wstring text);
    bool Text(int value);

    virtual DLGPROC Notification(NMHDR *nHdr);

public:
    /* Event Handlers */
    std::function<bool(NMUPDOWN *)> OnSpin;

private:
    int _buddyId;
    HWND _buddyWnd;

};

#pragma once

#include "Control.h"

#include <CommCtrl.h>

/// <summary>
/// Manages a 'spin control': a numeric edit box with a up/down 'buddy' to
/// increment or decrement the current value of the box.
/// </summary>
class Spinner : public Control {
public:
    Spinner() {

    }

    Spinner(int id, HWND parent) :
    Control(id, parent) {

    }

    virtual void Enable();
    virtual void Disable();

    void Buddy(int buddyId);

    /// <summary>Sets the range (min, max) for the spin control.</summary>
    /// <param name="lo">Lower bound for the spinner.</param>
    /// <param name="hi">Upper bound for the spinner.</param>
    void Range(int lo, int hi);

    std::wstring Text();
    int TextAsInt();
    bool Text(std::wstring text);
    bool Text(int value);

    virtual DLGPROC Notification(NMHDR *nHdr);

public:
    /* Event Handlers */
    std::function<bool(NMUPDOWN *)> OnSpin;

private:
    int _buddyId;
    HWND _buddyWnd;

};

Add summary for spin control class

Add summary for spin control class


#ifndef CLIENTMODEL_H
#define CLIENTMODEL_H

#include <QObject>

class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;

QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE

// Interface to Bitcoin network client
class ClientModel : public QObject
{
    Q_OBJECT
public:
    // The only reason that this constructor takes a wallet is because
    // the global client settings are stored in the main wallet.
    explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);

    OptionsModel *getOptionsModel();

    int getNumConnections() const;
    int getNumBlocks() const;

    QDateTime getLastBlockDate() const;

    // Return true if client connected to testnet
    bool isTestNet() const;
    // Return true if core is doing initial block download
    bool inInitialBlockDownload() const;
    // Return conservative estimate of total number of blocks, or 0 if unknown
    int getTotalBlocksEstimate() const;

    QString formatFullVersion() const;

private:
    OptionsModel *optionsModel;

    int cachedNumConnections;
    int cachedNumBlocks;

signals:
    void numConnectionsChanged(int count);
    void numBlocksChanged(int count);

    // Asynchronous error notification
    void error(const QString &title, const QString &message);

public slots:

private slots:
    void update();
};

#endif // CLIENTMODEL_H

#ifndef CLIENTMODEL_H
#define CLIENTMODEL_H

#include <QObject>

class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;

QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE

// Interface to Bitcoin network client
class ClientModel : public QObject
{
    Q_OBJECT
public:
    explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);

    OptionsModel *getOptionsModel();

    int getNumConnections() const;
    int getNumBlocks() const;

    QDateTime getLastBlockDate() const;

    // Return true if client connected to testnet
    bool isTestNet() const;
    // Return true if core is doing initial block download
    bool inInitialBlockDownload() const;
    // Return conservative estimate of total number of blocks, or 0 if unknown
    int getTotalBlocksEstimate() const;

    QString formatFullVersion() const;

private:
    OptionsModel *optionsModel;

    int cachedNumConnections;
    int cachedNumBlocks;

signals:
    void numConnectionsChanged(int count);
    void numBlocksChanged(int count);

    // Asynchronous error notification
    void error(const QString &title, const QString &message);

public slots:

private slots:
    void update();
};

#endif // CLIENTMODEL_H

Remove no longer valid comment

Remove no longer valid comment


//
//  SFBLELogging.h
//  SFBluetoothLowEnergyDevice
//
//  Created by Thomas Billicsich on 2014-04-04.
//  Copyright (c) 2014 Thomas Billicsich. All rights reserved.

#import <CocoaLumberjack/CocoaLumberjack.h>

// To define a different local (per file) log level
// put the following line _before_ the import of SFBLELogging.h
//  #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG
#define GLOBAL_LOG_LEVEL DDLogLevelVerbose
#ifndef LOCAL_LOG_LEVEL
  #define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL
#endif

static int ddLogLevel = LOCAL_LOG_LEVEL;

//
//  SFBLELogging.h
//  SFBluetoothLowEnergyDevice
//
//  Created by Thomas Billicsich on 2014-04-04.
//  Copyright (c) 2014 Thomas Billicsich. All rights reserved.

#import <CocoaLumberjack/CocoaLumberjack.h>

// To define a different local (per file) log level
// put the following line _before_ the import of SFBLELogging.h
//  #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG
#define GLOBAL_LOG_LEVEL DDLogLevelInfo
#ifndef LOCAL_LOG_LEVEL
  #define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL
#endif

static int ddLogLevel = LOCAL_LOG_LEVEL;

Set default log level to info

Set default log level to info

[Delivers #87082830]


/*
 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"

/* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
                                 const int16_t* seq1,
                                 const int16_t* seq2,
                                 int16_t dim_seq,
                                 int16_t dim_cross_correlation,
                                 int right_shifts,
                                 int step_seq2) {
  int i = 0, j = 0;

  for (i = 0; i < dim_cross_correlation; i++) {
    int32_t corr = 0;
    /* Unrolling doesn't seem to improve performance. */
    for (j = 0; j < dim_seq; j++) {
      // It's not clear why casting |right_shifts| here helps performance.
      corr += (seq1[j] * seq2[j]) >> (int16_t)right_shifts;
    }
    seq2 += step_seq2;
    *cross_correlation++ = corr;
  }
}

/*
 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"

/* C version of WebRtcSpl_CrossCorrelation() for generic platforms. */
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
                                 const int16_t* seq1,
                                 const int16_t* seq2,
                                 int16_t dim_seq,
                                 int16_t dim_cross_correlation,
                                 int right_shifts,
                                 int step_seq2) {
  int i = 0, j = 0;

  for (i = 0; i < dim_cross_correlation; i++) {
    int32_t corr = 0;
    /* Unrolling doesn't seem to improve performance. */
    for (j = 0; j < dim_seq; j++)
      corr += (seq1[j] * seq2[j]) >> right_shifts;
    seq2 += step_seq2;
    *cross_correlation++ = corr;
  }
}

Test whether removing a cast still hurts performance.

BUG=499241
TEST=none
TBR=andrew

Review URL: https://codereview.webrtc.org/1206653002

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#9491}


/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hex-dec.h"

void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
	unsigned int i;

	for (i = 0; i < hexstr_size; i++) {
		unsigned int value = dec & 0x0f;
		if (value < 10)
			hexstr[hexstr_size-i-1] = value + '0';
		else
			hexstr[hexstr_size-i-1] = value - 10 + 'A';
		dec >>= 4;
	}
}

uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
	unsigned int i;
	uintmax_t value = 0;

	for (i = 0; i < len; i++) {
		value = value*0x10;
		if (data[i] >= '0' && data[i] <= '9')
			value += data[i]-'0';
		else if (data[i] >= 'A' && data[i] <= 'F')
			value += data[i]-'A' + 10;
		else
			return 0;
	}
	return value;
}

/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hex-dec.h"

void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
	unsigned int i;

	for (i = 0; i < hexstr_size; i++) {
		unsigned int value = dec & 0x0f;
		if (value < 10)
			hexstr[hexstr_size-i-1] = value + '0';
		else
			hexstr[hexstr_size-i-1] = value - 10 + 'A';
		dec >>= 4;
	}
}

uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
	unsigned int i;
	uintmax_t value = 0;

	for (i = 0; i < len; i++) {
		value = value*0x10;
		if (data[i] >= '0' && data[i] <= '9')
			value += data[i]-'0';
		else if (data[i] >= 'A' && data[i] <= 'F')
			value += data[i]-'A' + 10;
		else if (data[i] >= 'a' && data[i] <= 'f')
			value += data[i]-'a' + 10;
		else
			return 0;
	}
	return value;
}

hex2dec(): Allow data to contain also lowercase hex characters.


int main()
{
  // non-deterministically make all variants live
  int r;
  switch (r)
  {
    case 0:
      single();
      break;
    case 1:
      sequential_last();
      break;
    case 2:
      sequential_both();
      break;
    case 3:
      branch_one();
      break;
    case 4:
      branch_both();
      break;
    case 5:
      nested_outer();
      break;
    case 6:
      nested_inner();
      break;
    case 7:
      nested_both();
      break;
  }

  return 0;
}

void single()
{
  while (1)
    assert(1);
}

void sequential_last()
{
  int i = 0;
  while (i < 0)
    i++;

  while (1)
    assert(1);
}

void sequential_both()
{
  // TODO: fix crash
  // while (1)
  //   assert(1);

  // while (1)
  //   assert(1);
}

void branch_one()
{
  int r;
  if (r)
  {
    int i = 0;
    while (i < 0)
      i++;
  }
  else
  {
    while (1)
      assert(1);
  }
}

void branch_both()
{
  int r;
  if (r)
  {
    while (1)
      assert(1);
  }
  else
  {
    while (1)
      assert(1);
  }
}

void nested_outer()
{
  while (1)
  {
    int i = 0;
    while (i < 0)
      i++;
  }
}

void nested_inner()
{
  int i = 0;
  while (i < 0)
  {
    while (1)
      assert(1);
    i++;
  }
}

void nested_both()
{
  // TODO: fix crash
  // while (1)
  // {
  //   while (1)
  //     assert(1);
  // }
}

Add regression test for infinite loop combinations CFG connectedness


// SKIP PARAM: --enable ana.int.interval --set solver td3 --enable ana.base.partition-arrays.enabled  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// This is part of 34-localization, but also symlinked to 36-apron.

// ALSO:  --enable ana.int.interval --set solver slr3 --enable ana.base.partition-arrays.enabled  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// Example from Halbwachs-Henry, SAS 2012
// Localized widening or restart policy should be able to prove that i <= j+3
// if the abstract domain is powerful enough.

void main()
{
   int i = 0;
   while (i<4) {
      int j=0;
      while (j<4) {
         i=i+1;
         j=j+1;
      }
      i = i-j+1;
      assert(i <= j+3);
   }
   return ;
}

// SKIP PARAM: --enable ana.int.interval --set solver td3 --set ana.base.arrays.domain partitioned  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// This is part of 34-localization, but also symlinked to 36-apron.

// ALSO:  --enable ana.int.interval --set solver slr3 --set ana.base.arrays.domain partitioned  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy --set sem.int.signed_overflow assume_none
// Example from Halbwachs-Henry, SAS 2012
// Localized widening or restart policy should be able to prove that i <= j+3
// if the abstract domain is powerful enough.

void main()
{
   int i = 0;
   while (i<4) {
      int j=0;
      while (j<4) {
         i=i+1;
         j=j+1;
      }
      i = i-j+1;
      assert(i <= j+3);
   }
   return ;
}

Fix partitioned array option in additional test


/*
name: TEST029
description: Test of nested expansion and refusing macro without arguments
comments: f(2) will expand to 2*g, which will expand to 2*f, and in this
          moment f will not be expanded because the macro definition is
          a function alike macro, and in this case there is no arguments.
output:
test029.c:34: error: redefinition of 'f1'
F2
G3	F2	f1
{
\
A4	I	f
	A4	#I2	*I
}
test029.c:35: error: 'f' undeclared
*/

#define f(a) a*g
#define g f

int
f1(void)
{
	int f;

	f(2);
}

int
f1(void)
{
	f(2);
}

Add test for nested macro expansion

Add test for nested macro expansion

This test also check what happens when a macro with arguments  is
found without them.