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

#if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1
#warning "Warning: You are using FEATURE_UVISOR, which is unsupported as of Mbed OS 5.9."
#endif

#endif  // __UVISOR_DEPRECATION_H__

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

#if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1
#warning "Warning: uVisor is superseded by the Secure Partition Manager (SPM) defined in the ARM Platform Security Architecture (PSA). \
          uVisor is deprecated as of Mbed OS 5.9, and being replaced by a native PSA-compliant implementation of SPM."
#endif

#endif  // __UVISOR_DEPRECATION_H__

Edit warning about FEATURE_UVISOR being deprecated


#ifndef IDXGEN_H
#define IDXGEN_H

#include "encparams.h"
#include "bitstring.h"

typedef struct NtruIGFState {
    int N;
    int c;
    int clen;
    char *Z;
    int zlen;
    int rem_len;
    NtruBitStr buf;
    int counter;
    void (*hash)(char[], int, char[]);
    int hlen;
} NtruIGFState;

/**
 * @brief IGF initialization
 *
 * Initializes the Index Generation Function.
 * Based on IGF-2 from IEEE P1363.1 section 8.4.2.1.
 *
 * @param seed
 * @param seed_len
 * @param params
 * @param s
 */
void ntru_IGF_init(char *seed, int seed_len, struct NtruEncParams *params, NtruIGFState *s);

/**
 * @brief IGF next index
 *
 * Returns the next index.
 * Based on IGF-2 from IEEE P1363.1 section 8.4.2.1.
 *
 * @param s
 * @param i
 */
void ntru_IGF_next(NtruIGFState *s, int *i);

#endif   /* IDXGEN_H */

#ifndef IDXGEN_H
#define IDXGEN_H

#include "encparams.h"
#include "bitstring.h"

typedef struct NtruIGFState {
    int N;
    int c;
    char *Z;
    int zlen;
    int rem_len;
    NtruBitStr buf;
    int counter;
    void (*hash)(char[], int, char[]);
    int hlen;
} NtruIGFState;

/**
 * @brief IGF initialization
 *
 * Initializes the Index Generation Function.
 * Based on IGF-2 from IEEE P1363.1 section 8.4.2.1.
 *
 * @param seed
 * @param seed_len
 * @param params
 * @param s
 */
void ntru_IGF_init(char *seed, int seed_len, struct NtruEncParams *params, NtruIGFState *s);

/**
 * @brief IGF next index
 *
 * Returns the next index.
 * Based on IGF-2 from IEEE P1363.1 section 8.4.2.1.
 *
 * @param s
 * @param i
 */
void ntru_IGF_next(NtruIGFState *s, int *i);

#endif   /* IDXGEN_H */

Remove an unused struct member

Remove an unused struct member


#include <wiringPi.h>
#include <softPwm.h>

#ifndef GPIOLIB_H
#define GPIOLIB_H

#define FORWARD 1
#define BACKWARD 0

namespace GPIO
{
	int init();

	int controlLeft(int direction,int speed);
	int controlRight(int direction,int speed);
	int stopLeft();
	int stopRight();

	int resetCounter();
	void getCounter(int *countLeft,int *countRight);
	int turnTo(int angle);
}
#endif

Add header file for reference

Add header file for reference


#include "syshead.h"
#include "skbuff.h"

struct sk_buff *alloc_skb(unsigned int size)
{
    struct sk_buff *skb = malloc(sizeof(struct sk_buff));

    memset(skb, 0, sizeof(struct sk_buff));
    skb->data = malloc(size);
    memset(skb->data, 0, size);

    skb->head = skb->data;
    skb->tail = skb->data;
    skb->end = skb->tail + size;

    return skb;
}

void free_skb(struct sk_buff *skb)
{
    free(skb->data);
    free(skb);
}

void *skb_reserve(struct sk_buff *skb, unsigned int len)
{
    skb->data += len;
    skb->tail += len;

    return skb->data;
}

uint8_t *skb_push(struct sk_buff *skb, unsigned int len)
{
    skb->data -= len;
    skb->len += len;

    return skb->data;
}

void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
{
    skb->dst = dst;
}

uint8_t *skb_head(struct sk_buff *skb)
{
    return skb->head;
}

#include "syshead.h"
#include "skbuff.h"

struct sk_buff *alloc_skb(unsigned int size)
{
    struct sk_buff *skb = malloc(sizeof(struct sk_buff));

    memset(skb, 0, sizeof(struct sk_buff));
    skb->data = malloc(size);
    memset(skb->data, 0, size);

    skb->head = skb->data;
    skb->tail = skb->data;
    skb->end = skb->tail + size;

    return skb;
}

void free_skb(struct sk_buff *skb)
{
    free(skb->head);
    free(skb);
}

void *skb_reserve(struct sk_buff *skb, unsigned int len)
{
    skb->data += len;
    skb->tail += len;

    return skb->data;
}

uint8_t *skb_push(struct sk_buff *skb, unsigned int len)
{
    skb->data -= len;
    skb->len += len;

    return skb->data;
}

void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
{
    skb->dst = dst;
}

uint8_t *skb_head(struct sk_buff *skb)
{
    return skb->head;
}

Fix pointer in skb free routine

Fix pointer in skb free routine

You cannot pass a different memory location to malloc than what it was
originally allocated with :p


/*****************************************************************************
 * SOUNDS HEADER                                                             *
 * Provides easy access to all sounds.                                       *
 * See: sdl_snake.c                                                          *
 *****************************************************************************/

#pragma once

#ifdef _WIN32 // STUPID WINDOWS
    #include "SDL_mixer.h"
#else
    #include "SDL/SDL_mixer.h"
#endif

Mix_Chunk *snd_menu_blip;
Mix_Chunk *snd_menu_select;
Mix_Chunk *snd_crash;
Mix_Chunk *snd_eat;
Mix_Chunk *snd_321;
Mix_Chunk *snd_go;

/*****************************************************************************
 * SOUNDS HEADER                                                             *
 * Provides easy access to all sounds.                                       *
 * See: sdl_snake.c                                                          *
 *****************************************************************************/

#pragma once

#if defined _WIN32 || defined __APPLE__
    #include "SDL_mixer.h"
#else
    #include "SDL/SDL_mixer.h"
#endif

Mix_Chunk *snd_menu_blip;
Mix_Chunk *snd_menu_select;
Mix_Chunk *snd_crash;
Mix_Chunk *snd_eat;
Mix_Chunk *snd_321;
Mix_Chunk *snd_go;

Fix compilation on Mac OS X

Fix compilation on Mac OS X


Add another test for pretty printing if-then-else


#ifndef BGLIBS__STR__ENV__H__
#define BGLIBS__STR__ENV__H__

#include <str/str.h>

/** \defgroup envstr envstr: Environment variables in a str.

\par Calling Convention

All functions that allocate memory return \c 0 (false) if the function
failed due to being unable to allocate memory, and non-zero (true)
otherwise.

@{ */

extern const char* envstr_find(const str* env, const char* var, long varlen);
extern const char* envstr_get(const str* env, const char* var);
extern int envstr_set(str* env, const char* var, const char* val, int overwrite);
extern void envstr_unset(str* env, const char* var);
extern int envstr_put(str* env, const char* asgn, int overwrite);
extern int envstr_from_array(str* env, char** array, int overwrite);
extern int envstr_from_string(str* env, const char* s, int overwrite);
extern char** envstr_make_array(const str* env);

/* @} */

#endif

#ifndef BGLIBS__STR__ENV__H__
#define BGLIBS__STR__ENV__H__

struct str;

/** \defgroup envstr envstr: Environment variables in a str.

\par Calling Convention

All functions that allocate memory return \c 0 (false) if the function
failed due to being unable to allocate memory, and non-zero (true)
otherwise.

@{ */

extern const char* envstr_find(const struct str* env, const char* var, long varlen);
extern const char* envstr_get(const struct str* env, const char* var);
extern int envstr_set(struct str* env, const char* var, const char* val, int overwrite);
extern void envstr_unset(struct str* env, const char* var);
extern int envstr_put(struct str* env, const char* asgn, int overwrite);
extern int envstr_from_array(struct str* env, char** array, int overwrite);
extern int envstr_from_string(struct str* env, const char* s, int overwrite);
extern char** envstr_make_array(const struct str* env);

/* @} */

#endif

Use a forward struct str declaration to avoid recursive includes.


#include "main.h"

enum Priority { PRI_HIGH, PRI_MEDIUM_HIGH, PRI_NORMAL, PRI_MEDIUM_LOW, PRI_LOW };

#define MODULE_SPAWN(modName) extern "C" Module* spawn(std::string moduleName, std::map<std::string, std::string> config, std::string workingDir, unsigned short debugLevel, Base* botptr) {\
		return new modName (moduleName, config, workingDir, debugLevel, botptr);\
	}

typedef bool MsgAction;
const bool MSG_CONTINUE = true;
const bool MSG_IGNORE = false;

class Module {
	public:
		Module(std::string modName, std::map<std::string, std::string> conf, std::string workDir, unsigned short debug, Base* botptr);
		const Priority priority;
		unsigned int apiVersion() = 0;
		bool onLoadComplete();
		void onRehash();
		void onModuleLoad(std::string modName);
		void onModuleUnload(std::string modName);

		// TODO: module hooks

		std::string description();
		std::list<std::string> provides();
		std::list<std::string> requires();
		std::list<std::string> supports();
	protected:
		std::string moduleName;
		std::map<std::string, std::string> config;
		std::string workingDir;
		unsigned short debugLevel;
	private:
		Base* bot;
};

#include "main.h"

enum Priority { PRI_HIGH, PRI_MEDIUM_HIGH, PRI_NORMAL, PRI_MEDIUM_LOW, PRI_LOW };

#define MODULE_SPAWN(modName) extern "C" Module* spawn(std::string moduleName, std::map<std::string, std::string> config, std::string workingDir, unsigned short debugLevel, Base* botptr) {\
		return new modName (moduleName, config, workingDir, debugLevel, botptr);\
	}

typedef bool MsgAction;
const bool MSG_CONTINUE = true;
const bool MSG_IGNORE = false;

class Module {
	public:
		Module(std::string modName, std::map<std::string, std::string> conf, std::string workDir, unsigned short debug, Base* botptr);
		const Priority priority;
		virtual unsigned int apiVersion() = 0;
		virtual bool onLoadComplete();
		virtual void onRehash();
		virtual void onModuleLoad(std::string modName);
		virtual void onModuleUnload(std::string modName);

		// TODO: module hooks

		virtual std::string description();
		virtual std::list<std::string> provides();
		virtual std::list<std::string> requires();
		virtual std::list<std::string> supports();
	protected:
		std::string moduleName;
		std::map<std::string, std::string> config;
		std::string workingDir;
		unsigned short debugLevel;
	private:
		Base* bot;
};

Make virtual functions that need to be virtual


/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

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

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

#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

#include <cstdint>

// IWYU pragma: private, include "third_party/tensorflow/core/platform/types.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/types.h

namespace tensorflow {

typedef signed char int8;
typedef short int16;
typedef int int32;
[[deprecated("Use int64_t instead.")]] typedef ::std::int64_t int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef std::uint64_t uint64;

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

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

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

#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

#include <cstdint>

// IWYU pragma: private, include "third_party/tensorflow/core/platform/types.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/types.h

namespace tensorflow {

typedef signed char int8;
typedef short int16;
typedef int int32;
typedef ::std::int64_t int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef std::uint64_t uint64;

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

Remove deprecation on int64 type.

Remove deprecation on int64 type.

I have half a million lines of log-spew in my CI from this and clearly there has been ~no effort in the codebase to actually stop using it. Please do not deprecate such a critical type until at least its own codebase has substantially migrated off of it.

PiperOrigin-RevId: 399093429
Change-Id: I807d9e6c79c4c33f4a50f88ba28fe5fda194ddd4


//===- llvm/Transforms/Utils/IntegerDivision.h ------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains an implementation of 32bit integer division for targets
// that don't have native support. It's largely derived from compiler-rt's
// implementation of __udivsi3, but hand-tuned for targets that prefer less
// control flow.
//
//===----------------------------------------------------------------------===//

#ifndef TRANSFORMS_UTILS_INTEGERDIVISION_H
#define TRANSFORMS_UTILS_INTEGERDIVISION_H

namespace llvm {
  class BinaryOperator;
}

namespace llvm {

  bool expandDivision(BinaryOperator* Div);

} // End llvm namespace

#endif

//===- llvm/Transforms/Utils/IntegerDivision.h ------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains an implementation of 32bit integer division for targets
// that don't have native support. It's largely derived from compiler-rt's
// implementation of __udivsi3, but hand-tuned for targets that prefer less
// control flow.
//
//===----------------------------------------------------------------------===//

#ifndef TRANSFORMS_UTILS_INTEGERDIVISION_H
#define TRANSFORMS_UTILS_INTEGERDIVISION_H

namespace llvm {
  class BinaryOperator;
}

namespace llvm {

  /// Generate code to divide two integers, replacing Div with the generated
  /// code. This currently generates code similarly to compiler-rt's
  /// implementations, but future work includes generating more specialized code
  /// when more information about the operands are known. Currently only
  /// implements 32bit scalar division, but future work is removing this
  /// limitation.
  ///
  /// @brief Replace Div with generated code.
  bool expandDivision(BinaryOperator* Div);

} // End llvm namespace

#endif

Document the interface for integer expansion, using doxygen-style comments

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@164231 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef PERSISTENT_COOKIE_JAR_H
#define PERSISTENT_COOKIE_JAR_H

#include <QMutex>
#include <QNetworkCookieJar>
#include <QList>

class QNetworkCookie;
class QObject;
class QUrl;

class PersistentCookieJar : public QNetworkCookieJar
{
	Q_OBJECT

	public:
		explicit PersistentCookieJar(QString filename, QObject *parent = nullptr);
		~PersistentCookieJar();

		void clear();
		bool insertCookies(const QList<QNetworkCookie> &cookies);

		virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override;
		virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override;

	protected:
		void save();
		void load();

	private:
		QString m_filename;
		mutable QMutex m_mutex;
};

#endif // PERSISTENT_COOKIE_JAR_H

#ifndef PERSISTENT_COOKIE_JAR_H
#define PERSISTENT_COOKIE_JAR_H

#include <QMutex>
#include <QNetworkCookieJar>
#include <QList>

class QNetworkCookie;
class QObject;
class QUrl;

/**
 * Network cookie jar which loads and stores cookies on a persistent file on disk.
 */
class PersistentCookieJar : public QNetworkCookieJar
{
	Q_OBJECT

	public:
		/**
		 * Create a new persistent cookie jar.
		 * @param filename The full path of the file to use to load and store cookies.
		 * @param parent The Qt parent object.
		 */
		explicit PersistentCookieJar(QString filename, QObject *parent = nullptr);

		/**
		 * Saves the cookies before destroying the instance.
		 */
		~PersistentCookieJar() override;

		/**
		 * Remove all cookies from the cookie jar.
		 */
		void clear();

		/**
		 * Add new cookies to the cookie jar.
		 * @param cookies The list of cookies to add to the cookie jar.
		 * @return Whether all cookies were successfully added to the cookie jar.
		 */
		bool insertCookies(const QList<QNetworkCookie> &cookies);

		QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override;
		bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override;

	protected:
		/**
		 * Save the cookies to the file.
		 */
		void save();

		/**
		 * Load the cookies from the file.
		 */
		void load();

	private:
		QString m_filename;
		mutable QMutex m_mutex;
};

#endif // PERSISTENT_COOKIE_JAR_H

Add documentation comments for PersistentCookieJar


#pragma once
#include "game/container_sizes.h"

namespace assets {
	enum class recoil_player_id {
		INVALID,
		GENERIC,

		COUNT = MAX_RECOIL_PLAYER_COUNT + 1
	};
}

#pragma once
#include "game/container_sizes.h"

namespace assets {
	enum class recoil_player_id {
		INVALID,

#if BUILD_TEST_SCENES
		GENERIC,
#endif

		COUNT = MAX_RECOIL_PLAYER_COUNT + 1
	};
}

Fix GENERIC recoil_player conditional building


#include <BALL/QSAR/Model.h>
#include <BALL/QSAR/QSARData.h>

namespace BALL
{
	namespace QSAR
	{
		/** A class for automatic creation of the most appropriate QSAR model.\n
		All available model-types are therefore evaluated using nested cross-validation and several successive feature selection steps. */

		class AutomaticModelCreator
		{
			public:

				AutomaticModelCreator(const QSARData* data);

				/** Start the search for most appropriate QSAR model for the current data. \n
				All available model-types are therefore evaluated using nested cross-validation and several successive feature selection steps. \n
				The model that obtained the highest nested prediction quality (>min_quality_) will be returned by this function. \n
				If no model achieved a quality higher than min_quality_, 0 will be returned. */
				Model* generateModel();

				void setData(const QSARData* data);

				void setMinQuality(double min_quality);

			private:

				void optimizeParameters(Model* model);

				void selectFeatures(Model* model);

				const QSARData* data_;

				double min_quality_;
		};

	}
}

#include <BALL/COMMON/global.h>
#include <BALL/QSAR/Model.h>
#include <BALL/QSAR/QSARData.h>

namespace BALL
{
	namespace QSAR
	{
		/** A class for automatic creation of the most appropriate QSAR model.\n
		All available model-types are therefore evaluated using nested cross-validation and several successive feature selection steps. */

		class BALL_EXPORT AutomaticModelCreator
		{
			public:

				AutomaticModelCreator(const QSARData* data);

				/** Start the search for most appropriate QSAR model for the current data. \n
				All available model-types are therefore evaluated using nested cross-validation and several successive feature selection steps. \n
				The model that obtained the highest nested prediction quality (>min_quality_) will be returned by this function. \n
				If no model achieved a quality higher than min_quality_, 0 will be returned. */
				Model* generateModel();

				void setData(const QSARData* data);

				void setMinQuality(double min_quality);

			private:

				void optimizeParameters(Model* model);

				void selectFeatures(Model* model);

				const QSARData* data_;

				double min_quality_;
		};

	}
}

Add a missing BALL_EXPORT to AutoModelCreator


/*
 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/*
 * This file exist for one purpose one: to pick fast, goto driven FSM in
 * validator-x86_64.c or slower table driven FSM in validator-x86_64_table.c.
 * They are functionally identical and produced from the same ragel source
 * with different generation options. Ideally we'd like to always use goto
 * driven FSM, but it includes tens of thousands lines of code which breaks
 * some old/exotic compilers.  Details are below.
 */

/*
 * XCode 4.2 takes too long to compile with -Os.
 * TODO(khim): Remove this when LLVM is upgraded in XCode (clang 3.1 works fine,
 * for example - and it's LLVM-based, too).
 */
#if defined(__APPLE__) && defined(__llvm__)
# define USE_TABLE_BASED_VALIDATOR
#endif

/*
 * MSVC 2010 works fine, MSVC 2008 is too slow with /O1.
 * TODO(khim): Remove this when MSVC 2008 is deprecated.
 */
#if defined(_MSC_VER)
# if _MSC_VER < 1600
#  define USE_TABLE_BASED_VALIDATOR
# endif
#endif

/*
 * ASAN takes too long with optimizations enabled and is killed on buildbot.
 * We don't really need to build with optimizations under ASAN (although it's
 * nice thing to do).
 * TODO(khim): Remove this when/if the following bug is fixed.
 *   http://code.google.com/p/address-sanitizer/issues/detail?id=61
 */
#if !defined(__has_feature)
# define __has_feature(x) 0
#endif
#if __has_feature(address_sanitizer)
# define USE_TABLE_BASED_VALIDATOR
#endif

#ifdef USE_TABLE_BASED_VALIDATOR
# include "native_client/src/trusted/validator_ragel/gen/validator-x86_64_table.c"
#else
# include "native_client/src/trusted/validator_ragel/gen/validator-x86_64.c"
#endif

Add change lost from CL 8577

Add change lost from CL 8577

BUG=http://src.chromium.org/viewvc/native_client?view=rev&revision=8431
TEST=trybots

TBR=pasko
Review URL: https://chromiumcodereview.appspot.com/10383140

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@8578 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#define CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#pragma once

#include "base/observer_list.h"
#include "chrome/browser/chromeos/cros/update_library.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace chromeos {

class MockUpdateLibrary : public UpdateLibrary {
 public:
  MockUpdateLibrary() {}
  virtual ~MockUpdateLibrary() {}
  MOCK_METHOD1(AddObserver, void(Observer*));  // NOLINT
  MOCK_METHOD1(RemoveObserver, void(Observer*));  // NOLINT
  MOCK_METHOD0(CheckForUpdate, bool(void));
  MOCK_METHOD0(RebootAfterUpdate, bool(void));
  MOCK_METHOD1(SetReleaseTrack, bool(const std::string&));
  MOCK_METHOD1(GetReleaseTrack, std::string());
  MOCK_CONST_METHOD0(status, const Status&(void));

 private:
  DISALLOW_COPY_AND_ASSIGN(MockUpdateLibrary);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_

// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#define CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#pragma once

#include "base/observer_list.h"
#include "chrome/browser/chromeos/cros/update_library.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace chromeos {

class MockUpdateLibrary : public UpdateLibrary {
 public:
  MockUpdateLibrary() {}
  virtual ~MockUpdateLibrary() {}
  MOCK_METHOD1(AddObserver, void(Observer*));  // NOLINT
  MOCK_METHOD1(RemoveObserver, void(Observer*));  // NOLINT
  MOCK_METHOD0(CheckForUpdate, bool(void));
  MOCK_METHOD0(RebootAfterUpdate, bool(void));
  MOCK_METHOD1(SetReleaseTrack, bool(const std::string&));
  MOCK_METHOD0(GetReleaseTrack, std::string());
  MOCK_CONST_METHOD0(status, const Status&(void));

 private:
  DISALLOW_COPY_AND_ASSIGN(MockUpdateLibrary);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_

Fix the Chrome OS build.

Fix the Chrome OS build.

TEST=make -j40 BUILDTYPE=Release browser_tests
BUG=chromium-os:6030

Review URL: http://codereview.chromium.org/4129006

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@64027 0039d316-1c4b-4281-b951-d872f2087c98


//
//  FileHelper.h
//  arc
//
//  Created by Jerome Cheng on 24/3/13.
//  Copyright (c) 2013 nus.cs3217. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "File.h"
#import "Folder.h"
#import "FileObject.h"

@interface FileHelper : NSObject

// Used to handle files passed in from other applications through iOS' "Open in..."
// Moves the file into a folder named after that application (inside External Applications),
// then returns it.
- (File*) fileWithURL:(NSURL*)url sourceApplication:(NSString*)application annotation:(id)annotation;

@end

//
//  FileHelper.h
//  arc
//
//  Created by Jerome Cheng on 24/3/13.
//  Copyright (c) 2013 nus.cs3217. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "File.h"
#import "Folder.h"
#import "FileObject.h"

@interface FileHelper : NSObject

// Used to handle files passed in from other applications through iOS' "Open in..."
// Moves the file into a folder named after that application (inside External Applications),
// then returns it.
+ (File*)fileWithURL:(NSURL*)url sourceApplication:(NSString*)application annotation:(id)annotation;

@end

Change fileWithURL:sourceApplications:annotation: to be a class method.


#include <fstream>
#include <string>
#include <vector>
#include <pthread.h>
#include <sys/epoll.h>

#include "../parser.h"
#include "connection.h"
#include "Db.h"
#include "MatrixServer.h"

typedef struct Bundle Bundle;

struct Bundle {
	MatrixServer* matrix;
	Db* db;
	int epfd; //for init only, not used in the threads
	int threadNo; //for init only, not used in the threads
	std::string portNo; //for init only, not used in the threads
};

void bundleInit(Bundle& mydata);
void bundleClean(Bundle& serverData);
void threadsLaunch(Bundle& serverData);
void* threadStart(void *arg);

void getSocketMsg(std::string& msg, int fd);
void rearmFD(int epfd, int fd);

#include <fstream>
#include <string>
#include <vector>
#include <pthread.h>
#include <sys/epoll.h>

#include "../parser.h"
#include "connection.h"
#include "Db.h"
#include "MatrixServer.h"
#include "Bundle.h"

//main.cpp
void bundleInit(Bundle& mydata);
void bundleClean(Bundle& serverData);
void threadsLaunch(Bundle& serverData);
void* threadStart(void *arg);

Move struct bundle declaration to dedicated header, and threads functions declarations to ThreadFunc.h


#ifndef APIMOCK_CODES_H
#define	APIMOCK_CODES_H

/* From the specification at: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */

namespace ApiMock {
	enum HTTP_RESPONSE_CODE {
		/* Informational */
		HTTP_CONTINUE						= 100,
		HTTP_SWITCHING_PROTOCOLS			= 101,

		/* Successful */
		HTTP_OK								= 200,
		HTTP_CREATED						= 201,
		HTTP_ACCEPTED						= 202,
		HTTP_NON_AUTHORATIVE_INFO			= 203,
		HTTP_NO_CONTENT						= 204,
		HTTP_RESET_CONTENT					= 205,
		HTTP_PARTIAL_CONTENT				= 206,

		/* Redirection */
		HTTP_MULTIPLE_CHOICES				= 300,
		HTTP_MOVED_PERMANENTLY				= 301,
		HTTP_FOUND							= 302,
		HTTP_SEE_OTHER						= 303,
		HTTP_NOT_MODIFIED					= 304,
		HTTP_USE_PROXY						= 305,
		HTTP_TEMPORARY_REDIRECT				= 307,

		/* Client error */
		HTTP_BAD_REQUEST					= 400,
		HTTP_UNAUTHORIZED					= 401,
		HTTP_FORBIDDEN						= 403,
		HTTP_NOT_FOUND						= 404,
		HTTP_METHOD_NOT_ALLOWED				= 405,
		HTTP_NOT_ACCEPTABLE					= 406,
		HTTP_PROXY_AUTH_REQUIRED			= 407,
		HTTP_REQUEST_TIMEOUT				= 408,
		HTTP_CONFLICT						= 409,
		HTTP_GONE							= 410,
		HTTP_LENGTH_REQUIRED				= 411,
		HTTP_PRECONDITION_FAILED			= 412,
		HTTP_REQUEST_ENTITY_TOO_LARGE		= 413,
		HTTP_REQUEST_URI_TOO_LONG			= 414,
		HTTP_UNSUPPORTED_MEDIA_TYPE			= 415,
		HTTP_REQUREST_RANGE_NOT_SATISFIABLE	= 416,
		HTTP_EXPECTATION_FAILED				= 417,

		/* Server error */
		HTTP_INTERNAL_SERVER_ERROR			= 500,
		HTTP_NOT_IMPLEMENTED				= 501,
		HTTP_BAD_GATEWAY					= 502,
		HTTP_SERVICE_UNAVAILABLE			= 503,
		HTTP_GATEWAY_TIMEOUT				= 504,
		HTTP_VERSION_NOT_SUPPORTED			= 505,
	};
}

#endif

Add HTTP status codes enum

Add HTTP status codes enum


// Copyright (c) 2010 Timur Iskhodzhanov and others. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_COMMON_H_
#define BASE_COMMON_H_

#include <assert.h>

// Use CHECK instead of assert.
// TODO(timurrrr): print stack trace when hitting a CHECK while preserving
// "abort trap" feature on both Windows and POSIX.
#define CHECK(x) assert(x)

#ifdef _DEBUG
#define DCHECK(x) do { } while (0 && (x))
#else
#define DCHECK(x) CHECK(x)
#endif

// Use this macro to disable copy constructor and operator= for CLASS_NAME. See
// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Copy_Constructors#Copy_Constructors
#define DISALLOW_COPY_AND_ASSIGN(CLASS_NAME) \
      CLASS_NAME(const CLASS_NAME &); \
  void operator=(const CLASS_NAME &);

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))

typedef unsigned char  uchar;
typedef unsigned char  byte;
typedef unsigned short ushort;
typedef unsigned int   uint;
const uint MAX_UINT = 0xFFFFFFFF;
// TODO(timurrrr): add 64-bit and ptr type values when necessary.

#endif  // BASE_COMMON_H_

// Copyright (c) 2010 Timur Iskhodzhanov and others. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_COMMON_H_
#define BASE_COMMON_H_

#include <assert.h>

// Use CHECK instead of assert.
// TODO(timurrrr): print stack trace when hitting a CHECK while preserving
// "abort trap" feature on both Windows and POSIX.
#define CHECK(x) assert(x)

#ifdef _DEBUG
#define DCHECK(x) CHECK(x)
#else
#define DCHECK(x) do { } while (0 && (x))
#endif

// Use this macro to disable copy constructor and operator= for CLASS_NAME. See
// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Copy_Constructors#Copy_Constructors
#define DISALLOW_COPY_AND_ASSIGN(CLASS_NAME) \
      CLASS_NAME(const CLASS_NAME &); \
  void operator=(const CLASS_NAME &);

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))

typedef unsigned char  uchar;
typedef unsigned char  byte;
typedef unsigned short ushort;
typedef unsigned int   uint;
const uint MAX_UINT = 0xFFFFFFFF;
// TODO(timurrrr): add 64-bit and ptr type values when necessary.

#endif  // BASE_COMMON_H_

Fix a stupid mistake in DCHECK definition


//
//  XamoomSDK.h
//  XamoomSDK
//
//  Created by Raphael Seher on 14/01/16.
//  Copyright © 2016 xamoom GmbH. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for XamoomSDK.
FOUNDATION_EXPORT double XamoomSDKVersionNumber;

//! Project version string for XamoomSDK.
FOUNDATION_EXPORT const unsigned char XamoomSDKVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <XamoomSDK/PublicHeader.h>

#import <XamoomSDK/XMMEnduserApi.h>
#import <XamoomSDK/XMMContentBlocks.h>

Add XMMContentBlocks to framwork header file


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

// Author: morlovich@google.com (Maksim Orlovich)
//
// dynamic_annotations.h provides various macros for interacting with tools like
// valgrind, mostly to tell them of things like thread operations they would not
// recognize otherwise. It also provides a way of detecting running under
// valgrind.

#ifndef NET_INSTAWEB_UTIL_PUBLIC_DYNAMIC_ANNOTATIONS_H_
#define NET_INSTAWEB_UTIL_PUBLIC_DYNAMIC_ANNOTATIONS_H_

#include "base/third_party/dynamic_annotations/dynamic_annotations.h"

#endif  // NET_INSTAWEB_UTIL_PUBLIC_DYNAMIC_ANNOTATIONS_H_

Add missing file from previous submit.

Add missing file from previous submit.


//The MIT License (MIT)
//
//Copyright (c) 2016 Northeastern University
//
//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.

#ifndef COMMON_MATRIX_OPERATION_INTERFACE_H_
#define COMMON_MATRIX_OPERATION_INTERFACE_H_

#include "Matrix.h"

namespace nice {

//Forward declaration
template <typename T>
class Matrix;

//Abstract class of common matrix operation interface
template <typename T>
class CommonMatrixOperationInterface {
 public:
  virtual void SVD() = 0;
  virtual Matrix<T> Multiply(const Matrix<T> &m) = 0;
  virtual Matrix<T> Add(const Matrix<T> &m) = 0;
  virtual Matrix<T> Substract(const Matrix<T> &m) = 0;
  virtual void Transpose() = 0;
  virtual Matrix<T> Inverse() = 0;
  virtual Matrix<T> Norm(const int &p, const int &axis) = 0;
  virtual Matrix<T> Multiply(const T &v) = 0;
  virtual Matrix<T> Add(const T &v) = 0;
  virtual Matrix<T> Substract(const T &v) = 0;
};

} // namespace nice

#endif //COMMON_MATRIX_OPERATION_INTERFACE_H_

Add common matrix operation interface

Add common matrix operation interface


//
//  BBASearchServiceResult.h
//  BBBAPI
//
//  Created by Owen Worley on 12/01/2015.
//  Copyright (c) 2015 Blinkbox Entertainment Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
@class FEMObjectMapping;
/**
 *  Represents data provided from the search service when searching for books
 */
@interface BBASearchServiceResult : NSObject

@property (nonatomic, copy) NSString *type;
@property (nonatomic, copy) NSString *identifier;
@property (nonatomic, copy) NSArray *links;
@property (nonatomic, assign) NSInteger numberOfResults;
@property (nonatomic, copy) NSArray *books;

/**
 *  Object mapping to convert server search result to `BBASearchServiceResult`
 */
+ (FEMObjectMapping *) searchServiceResultMapping;
@end

//
//  BBASearchServiceResult.h
//  BBBAPI
//
//  Created by Owen Worley on 12/01/2015.
//  Copyright (c) 2015 Blinkbox Entertainment Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
@class FEMObjectMapping;
/**
 *  Represents data provided from the search service when searching for books
 */
@interface BBASearchServiceResult : NSObject

@property (nonatomic, copy) NSString *type;
@property (nonatomic, copy) NSString *identifier;
/**
 *  Array of `BBALibraryItemLink` objects
 */
@property (nonatomic, copy) NSArray *links;
@property (nonatomic, assign) NSInteger numberOfResults;
@property (nonatomic, copy) NSArray *books;

/**
 *  Object mapping to convert server search result to `BBASearchServiceResult`
 */
+ (FEMObjectMapping *) searchServiceResultMapping;
@end

Document contents of Links array

Document contents of Links array


/** @file
    @brief Header to bring shared_ptr into the ::osvr namespace.

    @date 2014

    @author
    Ryan Pavlik
    <ryan@sensics.com>
    <http://sensics.com>

*/

// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)

#ifndef INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C
#define INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C

#if defined(_MSC_VER) && (_MSC_VER < 1600)
#error "Not supported before VS 2010"

#else
#include <memory>

namespace osvr {
using std::shared_ptr;
using std::make_shared;
} // namespace osvr
#endif

#endif // INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C

/** @file
    @brief Header to bring shared_ptr into the ::osvr namespace.

    @date 2014

    @author
    Ryan Pavlik
    <ryan@sensics.com>
    <http://sensics.com>

*/

// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)

#ifndef INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C
#define INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C

#if defined(_MSC_VER) && (_MSC_VER < 1600)
#error "Not supported before VS 2010"

#else
#include <memory>

namespace osvr {
using std::shared_ptr;
using std::weak_ptr;
using std::make_shared;
using std::enable_shared_from_this;
} // namespace osvr
#endif

#endif // INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C

Include more items in our namespace with shared_ptr.


#include "sampgdk.h"

#if SAMPGDK_WINDOWS
  #undef CreateMenu
  #undef DestroyMenu
  #undef GetTickCount
  #undef KillTimer
  #undef SelectObject
  #undef SetTimer
  #include <windows.h>
#endif

#include "sampgdk.h"

#if SAMPGDK_WINDOWS
  #undef CreateMenu
  #undef DestroyMenu
  #undef GetTickCount
  #undef KillTimer
  #undef SelectObject
  #undef SetTimer
  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
#else
  #define _GNU_SOURCE
#endif

Copy some definitions from CMakeLists.txt to preamble


/*
 * Copyright (c) 2006 KATO Kazuyoshi <kzys@8-p.info>
 * This source code is released under the MIT license.
 */

#import <Cocoa/Cocoa.h>

@interface CreamMonkey : NSObject {
}

@end

Add copyright and license header.

Add copyright and license header.


#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>

#include "deps/util.h"
#include "deps/rcswitch/rcswitch.h"

#define PIN_RC PB2

#include "deps/softuart/softuart.h"
#include "packet.h"

int main(void) {
    // initialize serial
    softuart_init();

    // enable interrupts
    sei();

    // enable the rc switch
    rcswitch_enable(PIN_RC);

    while (1) {

        // if there is some data waiting for us
        if (softuart_kbhit()) {

            // parse the data
            struct Packet packet;

            binary_to_packet(&packet, softuart_getchar());

            // handle the packet
            if (packet.status) {
                rcswitch_switch_on(packet.group + 1, packet.plug + 1);
            } else {
                rcswitch_switch_off(packet.group + 1, packet.plug + 1);
            }
        }
    }

    return 0;
}

#include <avr/io.h>
#include <avr/interrupt.h>

#include "deps/rcswitch/rcswitch.h"
#include "deps/softuart/softuart.h"
#include "packet.h"

#define PIN_RC PB2

int main(void) {
    // initialize serial
    softuart_init();

    // enable interrupts
    sei();

    // enable the rc switch
    rcswitch_enable(PIN_RC);

    while (1) {

        // if there is some data waiting for us
        if (softuart_kbhit()) {

            // parse the data
            struct Packet packet;

            binary_to_packet(&packet, softuart_getchar());

            // handle the packet
            if (packet.status) {
                rcswitch_switch_on(packet.group + 1, packet.plug + 1);
            } else {
                rcswitch_switch_off(packet.group + 1, packet.plug + 1);
            }
        }
    }

    return 0;
}

Remove unused includes and move rc pin definition


/*
 ============================================================================
 Name        : thsh.c
 Authors     : Collin Kruger, Denton Underwood, John Christensen, Jon Stacey
 Version     :
 Copyright   : Copyright 2009 Jon Stacey. All rights reserved.
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

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

int main(void) {
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}

/*
 ============================================================================
 Name        : thsh.c
 Authors     : Collin Kruger, Denton Underwood, John Christensen, Jon Stacey
 Version     :
 Copyright   : Copyright 2009 Jon Stacey. All rights reserved.
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

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

extern char **environ;

void printEnVars()
{
	char **env = environ;
	printf("\n");
	printf("%s\n", "--These are the environmental variables--");

	while(*env)
	{
		printf("%s\n", *env);
		env++;
	}
}

int main(int argc, char *argv[], char *envp[])
{
/////////////////////////////////////////////////////// - Print Args
	printf("%s\n", "--This is the total number of args--");
	printf("%s", "argc | ");
	printf("%i\n", argc);

	printf("\n");

	printf("%s\n", "--These are the argument characters--");
	int i;
	for (i = 0; i < argc; i++) {
		printf("%i", i);
		printf("%s", " | ");
		printf("%s\n", argv[i]);
	}

/////////////////////////////////////////////////////// - Print all Environment Variables
	printEnVars();

/////////////////////////////////////////////////////// - Finished
	printf("\n");
	printf("%s\n", "Exited Program");

	return 0;
}

Add environment vars and commandline arguments


#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <quad_tile.h>

my_bool tile_for_point_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
   if ( args->arg_count != 2 ||
        args->arg_type[0] != INT_RESULT ||
        args->arg_type[1] != INT_RESULT )
   {
      strcpy( message, "Your tile_for_point arguments are bogus!" );
      return 1;
   }

   return 0;
}

void tile_for_point_deinit(UDF_INIT *initid)
{
   return;
}

long long tile_for_point(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
   long long lon = *(long long *)args->args[0];
   long long lat = *(long long *)args->args[1];

   return xy2tile(lon2x(lon / 1000000.0), lat2y(lat / 1000000.0));
}

#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <quad_tile.h>

my_bool tile_for_point_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
   if ( args->arg_count != 2 ||
        args->arg_type[0] != INT_RESULT ||
        args->arg_type[1] != INT_RESULT )
   {
      strcpy( message, "Your tile_for_point arguments are bogus!" );
      return 1;
   }

   return 0;
}

void tile_for_point_deinit(UDF_INIT *initid)
{
   return;
}

long long tile_for_point(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
   long long lat = *(long long *)args->args[0];
   long long lon = *(long long *)args->args[1];

   return xy2tile(lon2x(lon / 1000000.0), lat2y(lat / 1000000.0));
}

Make the MySQL tile_for_point function take arguments in the same order as the ruby version.


#ifndef HELPER_H
#define HELPER_H

#define STRINGIFY(x)	#x
#define TOSTRING(x)	STRINGIFY(x)

#define AT()		__FILE__ ":" TOSTRING(__LINE__)

#ifdef DO_DEBUG
#include <iostream>
#include <mutex>
extern std::mutex log_mutex;
#define DEBUG(x) do { std::lock_guard<std::mutex> guard(log_mutex); std::cerr << "[libnice] " << x << " (@" << AT() << ")" << std::endl; } while (0)
#else
#define DEBUG(x)
#endif

static inline std::string trim(const std::string& str, const std::string& target=" \r\n\t") {
	const size_t first = str.find_first_not_of(target);

	if(first == std::string::npos) {
		return std::string();
	} else {
		const size_t last = str.find_last_not_of(target);
		return str.substr(first, last - first + 1);
	}
}

#endif /* HELPER_H */

#ifndef HELPER_H
#define HELPER_H

#include <string>

#define STRINGIFY(x)	#x
#define TOSTRING(x)	STRINGIFY(x)

#define AT()		__FILE__ ":" TOSTRING(__LINE__)

#ifdef DO_DEBUG
#include <iostream>
#include <mutex>
extern std::mutex log_mutex;
#define DEBUG(x) do { std::lock_guard<std::mutex> guard(log_mutex); std::cerr << "[libnice] " << x << " (@" << AT() << ")" << std::endl; } while (0)
#else
#define DEBUG(x)
#endif

static inline std::string trim(const std::string& str, const std::string& target=" \r\n\t") {
	const size_t first = str.find_first_not_of(target);

	if(first == std::string::npos) {
		return std::string();
	} else {
		const size_t last = str.find_last_not_of(target);
		return str.substr(first, last - first + 1);
	}
}

#endif /* HELPER_H */

Add missing header in case of no debug output


int main(){
    int a;
    int b = 1;
    int c = 2;
    int d = 3;
    a = 10/2;
    c = (b+3)*4-5;
    //printf(“a is %d\n",a);
    return 0
}

int main(){
    int a;
    int b = 1;
    int c = 2;
    int d = 3;
    a = 10/2;
    c = (b+3)*4-5;
    //printf(“a is %d\n",a);
    return 0;
}

Fix typo in test case

Fix typo in test case


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

int main() {
    char a[300];
    float b, c;

    scanf("%s", a);
    scanf("%f", &b);
    scanf("%f", &c);

    printf("TOTAL = R$ %.2f\n", b + round((c * 0.15) * 100) / 100);

    return 0;
}

Solve Salary with Bonus in c

Solve Salary with Bonus in c


/*
 * wm8350.h - WM8903 audio codec interface
 *
 * Copyright 2008 Wolfson Microelectronics PLC.
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 */

#ifndef _WM8350_H
#define _WM8350_H

#include <sound/soc.h>

extern struct snd_soc_dai wm8350_dai;
extern struct snd_soc_codec_device soc_codec_dev_wm8350;

enum wm8350_jack {
	WM8350_JDL = 1,
	WM8350_JDR = 2,
};

int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
			  struct snd_soc_jack *jack, int report);

#endif

/*
 * wm8350.h - WM8903 audio codec interface
 *
 * Copyright 2008 Wolfson Microelectronics PLC.
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 */

#ifndef _WM8350_H
#define _WM8350_H

#include <sound/soc.h>
#include <linux/mfd/wm8350/audio.h>

extern struct snd_soc_dai wm8350_dai;
extern struct snd_soc_codec_device soc_codec_dev_wm8350;

enum wm8350_jack {
	WM8350_JDL = 1,
	WM8350_JDR = 2,
};

int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
			  struct snd_soc_jack *jack, int report);

#endif

ASoC: Include WM8350 register definitions in CODEC header

It's expected behaviour for the CODEC header to provide them but the
WM8350 doesn't due to having all the registers together under drivers/mfd.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>


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

int main() {
    int a, b, c, m;

    while (scanf("%d %d %d", &a, &b, &c) != EOF) {
        m = (a + b + abs(a - b)) / 2;
        m = (m + c + abs(m - c)) / 2;

        printf("%d eh o maior\n", m);
    }
}

Solve The Greatest in c

Solve The Greatest in c


//
//  RAPRedditLinks.h
//  redditAPI
//
//  Created by Woudini on 2/3/15.
//  Copyright (c) 2015 Hi Range. All rights reserved.
//

#ifndef redditAPI_RAPRedditLinks_h
#define redditAPI_RAPRedditLinks_h

#define RAPRedditLimit_10_typePrefix_Link_ @"?limit=10?&after=t3_%@"
#define RAPSubredditNew @"r/%@/new.json?limit=10"
#define RAPSubredditHot @"r/%@/hot.json?limit=10"

#define RAPThreadComments @"r/%@/.json"

#endif

//
//  RAPRedditLinks.h
//  redditAPI
//
//  Created by Woudini on 2/3/15.
//  Copyright (c) 2015 Hi Range. All rights reserved.
//

#ifndef redditAPI_RAPRedditLinks_h
#define redditAPI_RAPRedditLinks_h

#define RAPRedditLimit_10_typePrefix_Link_ @".json?limit=10?&after=t3_%@"
#define RAPSubredditNew @"r/%@/new.json?limit=10"
#define RAPSubredditHot @"r/%@/hot.json?limit=10"

#define RAPThreadComments @"r/%@/.json"

#endif

Fix json additional fetch in frontpage

Fix json additional fetch in frontpage


#pragma once
#include "afxwin.h"
#include "afxcmn.h"

class Hotkeys : public CPropertyPage {
	DECLARE_DYNAMIC(Hotkeys)

public:
	Hotkeys();
	virtual ~Hotkeys();

// Dialog Data
	enum { IDD = IDD_HOTKEYS };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    virtual BOOL OnInitDialog();
	DECLARE_MESSAGE_MAP()

private:
    void SelectItem(int idx);

private:
    CComboBox _action;
    CButton _keys;
    CListCtrl _list;
    afx_msg void OnBnClickedAdd();
    afx_msg void OnBnClickedRemove();
    afx_msg void OnLvnItemchangedKeys(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnBnClickedKeys();
};

#pragma once
#include "afxwin.h"
#include "afxcmn.h"

#include <vector>

#include "HotkeyInfo.h"

class Hotkeys : public CPropertyPage {
	DECLARE_DYNAMIC(Hotkeys)

public:
	Hotkeys();
	virtual ~Hotkeys();

	enum { IDD = IDD_HOTKEYS };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);
    virtual BOOL OnInitDialog();
	DECLARE_MESSAGE_MAP()

private:
    std::vector<HotkeyInfo> _keyInfo;
    void SelectItem(int idx);

private:
    CComboBox _action;
    CButton _keys;
    CListCtrl _list;
    afx_msg void OnBnClickedAdd();
    afx_msg void OnBnClickedRemove();
    afx_msg void OnLvnItemchangedKeys(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnBnClickedKeys();
};

Add list to contain hotkey info

Add list to contain hotkey info


/*
 * waysome - wayland based window manager
 *
 * Copyright in alphabetical order:
 *
 * Copyright (C) 2014-2015 Julian Ganz
 * Copyright (C) 2014-2015 Manuel Messner
 * Copyright (C) 2014-2015 Marcel Müller
 * Copyright (C) 2014-2015 Matthias Beyer
 * Copyright (C) 2014-2015 Nadja Sommerfeld
 *
 * This file is part of waysome.
 *
 * waysome is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * waysome is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with waysome. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @addtogroup serializer_module "Serializer module"
 *
 * @{
 */

/**
 * @addtogroup serializer_module_json_backend "Serializer JSON backend"
 *
 * @{
 */

/**
 * @addtogroup serializer_module_json_backend_common "JSON backend utils"
 *
 * Serializer module JSON backend private utilities
 *
 * @{
 */

/**
 * @file keys.h
 *
 * This file contains JSON object key definitions. Each define here is one key
 * in the JSON object the deserializer wants to parse.
 */

#ifndef __WS_SERIALIZE_JSON_KEYS_H__
#define __WS_SERIALIZE_JSON_KEYS_H__

#define COMMANDS    "CMDS"
#define UID         "UID"
#define TYPE        "TYPE"

#define TYPE_TRANSACTION "transaction"

#endif //__WS_SERIALIZE_JSON_KEYS_H__

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

Add transaction main key definitions

Add transaction main key definitions


/*
 *  Copyright 2016 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.
 */

#ifndef SDK_OBJC_BASE_RTCMACROS_H_
#define SDK_OBJC_BASE_RTCMACROS_H_

#define RTC_OBJC_EXPORT __attribute__((visibility("default")))
// TODO(mbonadei): Remove RTC_EXPORT in order to be able to land
// https://webrtc-review.googlesource.com/c/src/+/97960.
#define RTC_EXPORT RTC_OBJC_EXPORT

#if defined(__cplusplus)
#define RTC_EXTERN extern "C" RTC_OBJC_EXPORT
#else
#define RTC_EXTERN extern RTC_OBJC_EXPORT
#endif

#ifdef __OBJC__
#define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname
#else
#define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname
#endif

#endif  // SDK_OBJC_BASE_RTCMACROS_H_

/*
 *  Copyright 2016 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.
 */

#ifndef SDK_OBJC_BASE_RTCMACROS_H_
#define SDK_OBJC_BASE_RTCMACROS_H_

#define RTC_OBJC_EXPORT __attribute__((visibility("default")))

#if defined(__cplusplus)
#define RTC_EXTERN extern "C" RTC_OBJC_EXPORT
#else
#define RTC_EXTERN extern RTC_OBJC_EXPORT
#endif

#ifdef __OBJC__
#define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname
#else
#define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname
#endif

#endif  // SDK_OBJC_BASE_RTCMACROS_H_

Remove backwards compatible macro RTC_EXPORT from sdk/.

Symbols under sdk/ are now exported using RTC_OBJC_EXPORT, while
RTC_EXPORT is used for C++ symbols.

Bug: webrtc:9419
Change-Id: Icdf7ee0e7b3faf4d7fec33e9b33a3b13260f45b7
Reviewed-on: https://webrtc-review.googlesource.com/102461
Reviewed-by: Peter Hanspers <d02e325c30aa6f5b5d3f28abcc70f6d579033e9e@webrtc.org>
Commit-Queue: Mirko Bonadei <d2c43c210eae6feef04f53bae50885e8152edcca@webrtc.org>
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#24886}


#include "include/cef_base.h"
#include "include/cef_v8.h"

namespace v8_extensions {

class Git : public CefV8Handler {
public:
  Git();

  virtual bool Execute(const CefString& name,
                       CefRefPtr<CefV8Value> object,
                       const CefV8ValueList& arguments,
                       CefRefPtr<CefV8Value>& retval,
                       CefString& exception) OVERRIDE;

  // Provide the reference counting implementation for this class.
  IMPLEMENT_REFCOUNTING(Native);
};

}

#include "include/cef_base.h"
#include "include/cef_v8.h"

namespace v8_extensions {

class Git : public CefV8Handler {
public:
  Git();

  virtual bool Execute(const CefString& name,
                       CefRefPtr<CefV8Value> object,
                       const CefV8ValueList& arguments,
                       CefRefPtr<CefV8Value>& retval,
                       CefString& exception) OVERRIDE;

  // Provide the reference counting implementation for this class.
  IMPLEMENT_REFCOUNTING(Git);
};

}

Add ref counting to Git class

Add ref counting to Git class


#include <stdlib.h>
#include "seatest.h"

static void test_abs (void)
{
    // abs
    assert_true(abs(0) == 0);
    assert_true(abs(1) == 1);
    assert_true(abs(INT_MAX) == INT_MAX);
    assert_true(abs(-1) == 1);
    // labs
    assert_true(labs(0) == 0);
    assert_true(labs(1) == 1);
    assert_true(labs(LONG_MAX) == LONG_MAX);
    assert_true(labs(-1) == 1);
    // llabs
    assert_true(llabs(0) == 0);
    assert_true(llabs(1) == 1);
    assert_true(llabs(LLONG_MAX) == LLONG_MAX);
    assert_true(llabs(-1) == 1);
}

void test_stdlib (void)
{
    test_fixture_start();
    run_test(test_abs);
    test_fixture_end();
}

#include <stdlib.h>
#include "seatest.h"

static void test_abs (void)
{
    // abs
    assert_int_equal(0, abs(0));
    assert_int_equal(1, abs(1));
    assert_int_equal(INT_MAX, abs(INT_MAX));
    assert_int_equal(1, abs(-1));
    // labs
    assert_true(labs(0) == 0);
    assert_true(labs(1) == 1);
    assert_true(labs(LONG_MAX) == LONG_MAX);
    assert_true(labs(-1) == 1);
    // llabs
    assert_true(llabs(0) == 0);
    assert_true(llabs(1) == 1);
    assert_true(llabs(LLONG_MAX) == LLONG_MAX);
    assert_true(llabs(-1) == 1);
}

void test_stdlib (void)
{
    test_fixture_start();
    run_test(test_abs);
    test_fixture_end();
}

Use assert_int_equal not assert_true where possible


// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_
#define COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_

#include "base/compiler_specific.h"

namespace policy {

// A delegate for the Android policy provider. This class is responsible for
// setting policies on the PolicyProviderAndroid and refreshing them on demand.
class POLICY_EXPORT PolicyProviderAndroidDelegate {
 public:
  // Called to refresh policies. If this method is called, the delegate must
  // eventually call SetPolicies on the provider.
  virtual void RefreshPolicies() = 0;

  // Called before the provider is destroyed.
  virtual void PolicyProviderShutdown() = 0;

 protected:
  virtual ~PolicyProviderAndroidDelegate() {}
};

}  // namespace policy

#endif  // COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_
#define COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_

#include "base/compiler_specific.h"
#include "components/policy/policy_export.h"

namespace policy {

// A delegate for the Android policy provider. This class is responsible for
// setting policies on the PolicyProviderAndroid and refreshing them on demand.
class POLICY_EXPORT PolicyProviderAndroidDelegate {
 public:
  // Called to refresh policies. If this method is called, the delegate must
  // eventually call SetPolicies on the provider.
  virtual void RefreshPolicies() = 0;

  // Called before the provider is destroyed.
  virtual void PolicyProviderShutdown() = 0;

 protected:
  virtual ~PolicyProviderAndroidDelegate() {}
};

}  // namespace policy

#endif  // COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_

Add a missing policy_export include

Add a missing policy_export include

When including only policy_provider_android and no other policy
related header, this made the compiler complain about the missing
declaration of POLICY_EXPORT

BUG=506809

Review URL: https://codereview.chromium.org/1225583002

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


/**
 * @file debug.h
 * @brief Initializer and main loop of EthShield
 *
 * \copyright Copyright 2013 /Dev. All rights reserved.
 * \license This project is released under MIT license.
 *
 * @author Ferdi van der Werf <efcm@slashdev.nl>
 * @since 0.1.0
 */

// Speed of micro-controller (20.0 MHz)
#ifndef F_CPU
#define F_CPU 20000000
#endif

#include <inttypes.h>
#include <avr/interrupt.h>
#include "net/network.h"
#include "utils/logger.h"
#include "utils/uptime.h"

int main(void) {
	// Enable interrupts
    sei();

    // Initialize debug
    logger_init();

    // Initialize uptime
    uptime_init();

    // Initialize network chip
    network_init();

    // Infinite loop
    while (1) {

    }

}

/**
 * @file debug.h
 * @brief Initializer and main loop of EthShield
 *
 * \copyright Copyright 2013 /Dev. All rights reserved.
 * \license This project is released under MIT license.
 *
 * @author Ferdi van der Werf <efcm@slashdev.nl>
 * @since 0.1.0
 */

// Speed of micro-controller (20.0 MHz)
#ifndef F_CPU
#define F_CPU 20000000
#endif

#include <inttypes.h>
#include <avr/interrupt.h>
#include "net/network.h"
#include "utils/logger.h"
#include "utils/uptime.h"

int main(void) {
	// Enable interrupts
    sei();

    // Initialize debug
    logger_init();

    // Initialize uptime
    uptime_init();

    // Initialize network chip
    network_init();

    // Infinite loop
    while (1) {
        // Handle network traffic
        network_backbone();
    }

}

Handle network traffic in main loop

Handle network traffic in main loop


#include <stdio.h>

#define RANGE 1000

unsigned int count_divisibility(unsigned int divisor) {
    int count = 0;

    for ( int i = 1 ; i < RANGE ; i++ ) {
        if ( i % divisor == 0 ) {
            count++;
        }
    }

    return count;
}

// Use the identity n(n+1)/2 to calculate the sum
unsigned int calculate_divisibility_sum(unsigned int number, unsigned int count) {
    unsigned int divisibility_sum = 0;

    divisibility_sum = number * (count * (count + 1)) / 2;

    return divisibility_sum;
}

int main() {
    unsigned short div_three_count = 0,
                   div_five_count = 0,
                   div_fifteen_count = 0;

    unsigned int div_three_sum,
                 div_five_sum,
                 div_fifteen_sum,
                 total_sum;

    div_three_count = count_divisibility(3);
    div_five_count = count_divisibility(5);
    div_fifteen_count = count_divisibility(15);

    div_three_sum = calculate_divisibility_sum(3, div_three_count);
    div_five_sum = calculate_divisibility_sum(5, div_five_count);
    div_fifteen_sum = calculate_divisibility_sum(15, div_fifteen_count);

    total_sum = div_three_sum + div_five_sum - div_fifteen_sum;

    printf("%d", total_sum);
    return 0;
}

#include <stdio.h>

#define RANGE 1000

unsigned short count_divisibility(unsigned short divisor) {
    int count = 0;

    count = (RANGE - 1) / divisor;

    return count;
}

// Use the identity n(n+1)/2 to calculate the sum
unsigned int calculate_divisibility_sum(unsigned short number, unsigned short count) {
    unsigned int divisibility_sum = 0;

    divisibility_sum = number * (count * (count + 1)) / 2;

    return divisibility_sum;
}

int main() {
    unsigned short div_three_count = 0,
                   div_five_count = 0,
                   div_fifteen_count = 0;

    unsigned int div_three_sum,
                 div_five_sum,
                 div_fifteen_sum,
                 total_sum;

    div_three_count = count_divisibility(3);
    div_five_count = count_divisibility(5);
    div_fifteen_count = count_divisibility(15);

    div_three_sum = calculate_divisibility_sum(3, div_three_count);
    div_five_sum = calculate_divisibility_sum(5, div_five_count);
    div_fifteen_sum = calculate_divisibility_sum(15, div_fifteen_count);

    total_sum = div_three_sum + div_five_sum - div_fifteen_sum;

    printf("%d", total_sum);
    return 0;
}

Refactor Problem 1's solution in C

Refactor Problem 1's solution in C

My logic failed me and I noticed that I just need to divide 1000 by
the number to get the amount of divisible numbers. -_- That's why I
removed the for-loop.

Changed the datatype for some of the functions and arguments,
because `short int` is sufficient enough to store the values.


#pragma once

#define NTDDI_VERSION 0x06010000
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601

#include <ShellScalingApi.h>
#include <Shlobj.h>
#include <ShObjIdl.h>
#include <Windows.h>
#include <wrl.h>

#undef min
#undef max

#include <algorithm>
#include <unordered_map>

namespace WRL
{
	using namespace Microsoft::WRL;
}

#if _DEBUG
#define Assert(x) do { if (!(x)) __debugbreak(); } while (false, false)
#else
#define Assert(x) do { if (false, false) (void)(x); } while (false, false)
#endif

#pragma once

#define NTDDI_VERSION 0x0A000007 // NTDDI_WIN10_19H1
#define _WIN32_WINNT 0x0A00 // _WIN32_WINNT_WIN10
#define WINVER 0x0A00

#include <ShellScalingApi.h>
#include <Shlobj.h>
#include <ShObjIdl.h>
#include <Windows.h>
#include <wrl.h>

#undef min
#undef max

#include <algorithm>
#include <unordered_map>

namespace WRL
{
	using namespace Microsoft::WRL;
}

#if _DEBUG
#define Assert(x) do { if (!(x)) __debugbreak(); } while (false, false)
#else
#define Assert(x) do { if (false, false) (void)(x); } while (false, false)
#endif

Drop support for Windows 7.

Drop support for Windows 7.


//
// Created by cyber on 15.08.19.
//

#ifndef DRONEBRIDGE_DB_COMMON_H
#define DRONEBRIDGE_DB_COMMON_H

#endif //DRONEBRIDGE_DB_COMMON_H

Move to syslog, minor exit bug on usbbridge


/*
 * Copyright (c) 2016, Texas Instruments Incorporated
 *
 * SPDX-License-Identifier: Apache-2.0
 */
#include <inc/hw_types.h>
#include <driverlib/prcm.h>

/*
 * Copyright (c) 2016-2017, Texas Instruments Incorporated
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <inc/hw_types.h>
#include <driverlib/prcm.h>

/*
 * CMSIS IRQn_Type enum is broken relative to ARM GNU compiler.
 *
 * So redefine the IRQn_Type enum to a unsigned int to avoid
 * the ARM compiler from sign extending IRQn_Type values higher than 0x80
 * into negative IRQ values, which causes hard-to-debug Hard Faults.
 */
typedef u32_t IRQn_Type;

/* Need to keep the remaining from cmsis.h, as Zephyr expects these. */
enum {
	Reset_IRQn                    = -15,
	NonMaskableInt_IRQn           = -14,
	HardFault_IRQn                = -13,
#if defined(CONFIG_ARMV7_M)
	MemoryManagement_IRQn         = -12,
	BusFault_IRQn                 = -11,
	UsageFault_IRQn               = -10,
#endif /* CONFIG_ARMV7_M */
	SVCall_IRQn                   =  -5,
	DebugMonitor_IRQn             =  -4,
	PendSV_IRQn                   =  -2,
	SysTick_IRQn                  =  -1,
} CMSIS_IRQn_Type;

#define __CM4_REV        0
#define __MPU_PRESENT                  0 /* Zephyr has no MPU support */
#define __NVIC_PRIO_BITS               CONFIG_NUM_IRQ_PRIO_BITS
#define __Vendor_SysTickConfig         0 /* Default to standard SysTick */

cc32xx: Redefine CMSIS IRQn_Type enum to unsigned int

Previously, calling NVIC_SetPriority(IRQn_Type irqn, ....) with
the NWP interrupt number of 171 caused a hard fault during a
subsequent svc #0 instruction during _Swap().

GNU compiler is generating a bit extension instruction (sxtb) which
converts a positive IRQ value argument to a negative value when
casting to the CMSIS IRQn_Type enum parameter type.

This generates a negative index, which then writes to an SCB
control register instead of NVIC register, causing a hard
fault later on.

This issue only occurs when passing interrupt numbers > 0x80
(eg: 171 (0xab) for the NWP) to the CMSIS NVIC apis.

The solution here is simply to redefine IRQn_Type to be an
unsigned 32 bit integer, while redefining the CMSIS IRQn_Type
enum definitions for interrupts less than zero.

Jira: ZEP-1958

Signed-off-by: Gil Pitney <477da50908f0a7963c2c490cce0ff096d2cac162@linaro.org>


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

#include <time.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

time_t timer_clock(void) {
  return GetTickCount();
}

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

#include <time.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

time_t timer_clock(void) {
  LARGE_INTEGER freq, count;

  if (!QueryPerformanceFrequency(&freq)) {
    return 0;
  }

  if (!QueryPerformanceCounter(&count)) {
    return 0;
  }

  return (time_t)(1000.0L / freq.QuadPart * count.QuadPart);;
}

Use QueryPerformanceCounter() timer instead of GetTickCount()

GetTickCount() has poor resolution according to MSDN docs (from
10 to 16 ms).


/*
 * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include "internal/cryptlib.h"
#include "eng_int.h"

void ENGINE_load_builtin_engines(void)
{
    /* Some ENGINEs need this */
    OPENSSL_cpuid_setup();

    OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL);
}

#if (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)) && !defined(OPENSSL_NO_DEPRECATED)
void ENGINE_setup_bsd_cryptodev(void)
{
}
#endif

/*
 * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include "internal/cryptlib.h"
#include "eng_int.h"

void ENGINE_load_builtin_engines(void)
{
    /* Some ENGINEs need this */
    OPENSSL_cpuid_setup();

    OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL);
}

#if (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)) && OPENSSL_API_COMPAT < 0x10100000L
void ENGINE_setup_bsd_cryptodev(void)
{
}
#endif

Convert our own check of OPENSSL_NO_DEPRECATED

... to the check OPENSSL_API_COMPAT < 0x10100000L, to correspond with
how it's declared.

Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6470)


#ifndef T3F_VIEW_H
#define T3F_VIEW_H

/* structure holds information about a 3D viewport usually used to represent
   one player's screen, split screen games will have multiple viewports */
typedef struct
{

	/* offset of viewport */
	float offset_x;
	float offset_y;
	float width;
	float height;

	/* vanishing point */
	float vp_x;
	float vp_y;

} T3F_VIEW;

extern T3F_VIEW * t3f_default_view;
extern T3F_VIEW * t3f_current_view;

T3F_VIEW * t3f_create_view(float ox, float oy, float w, float h, float vpx, float vpy);
void t3f_destroy_view(T3F_VIEW * vp);
void t3f_store_state(T3F_VIEW * sp);
void t3f_restore_state(T3F_VIEW * sp);
void t3f_select_view(T3F_VIEW * sp);
T3F_VIEW * t3f_get_current_view(void);
bool t3f_project_coordinates(float vw, float vpx, float vpy, float * x, float * y, float z);
float t3f_project_x(float x, float z);
float t3f_project_y(float y, float z);

#endif

#ifndef T3F_VIEW_H
#define T3F_VIEW_H

#include <allegro5/allegro5.h>

/* structure holds information about a 3D viewport usually used to represent
   one player's screen, split screen games will have multiple viewports */
typedef struct
{

	/* offset of viewport */
	float offset_x;
	float offset_y;
	float width;
	float height;

	/* vanishing point */
	float vp_x;
	float vp_y;

} T3F_VIEW;

extern T3F_VIEW * t3f_default_view;
extern T3F_VIEW * t3f_current_view;

T3F_VIEW * t3f_create_view(float ox, float oy, float w, float h, float vpx, float vpy);
void t3f_destroy_view(T3F_VIEW * vp);
void t3f_store_state(T3F_VIEW * sp);
void t3f_restore_state(T3F_VIEW * sp);
void t3f_select_view(T3F_VIEW * sp);
T3F_VIEW * t3f_get_current_view(void);
bool t3f_project_coordinates(float vw, float vpx, float vpy, float * x, float * y, float z);
float t3f_project_x(float x, float z);
float t3f_project_y(float y, float z);

#endif

Include Allegro header so we can use 'bool'.


/* encrypted keys */

static const uint32_t internal_device_number = 0;

static const uint8_t internal_dk_list[][21] = {
  {
  },
};

static const uint8_t internal_pk_list[][16] = {
  {
  },
};

static const uint8_t internal_hc_list[][112] = {
  {
  },
};

/* customize this function to "hide" the keys in the binary */

static void decrypt_key(uint8_t *out, const uint8_t *in, size_t size)
{
    memcpy(out, in, size);
}

/* encrypted keys */

static const uint32_t internal_device_number = 0;

static const uint8_t internal_dk_list[][21] = {
  { 0 },
};

static const uint8_t internal_pk_list[][16] = {
  { 0 },
};

static const uint8_t internal_hc_list[][112] = {
  { 0 },
};

/* customize this function to "hide" the keys in the binary */

static void decrypt_key(uint8_t *out, const uint8_t *in, size_t size)
{
    memcpy(out, in, size);
}

Fix MSVC error C2133 : unknown size of multi-dimensional static const arrays (despite supposed support of C99). Have not confirmed if this breaks anything yet.


//Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef MOCKSOCKET_H
#define MOCKSOCKET_H

#include <Arcus/Socket.h> //Inheriting from this to be able to swap this socket in the tested class.
#include <deque> //History of sent and received messages.

namespace cura
{

/*
 * \brief Mocks a socket connection from libArcus such that we can test with it
 * without creating an actual connection.
 */
class MockSocket : public Arcus::Socket
{
public:
    MockSocket();
    //virtual ~MockSocket();

    virtual void connect(const std::string& address, int port);
    virtual void listen(const std::string& address, int port);
    virtual void close();
    virtual void reset();

    virtual void sendMessage(Arcus::MessagePtr message);
    virtual Arcus::MessagePtr takeNextMessage();
    //virtual Arcus::MessagePtr createMessage(const std::string& type_name);

    void pushMessageToReceivedQueue(Arcus::MessagePtr message);
    Arcus::MessagePtr popMessageFromSendQueue();
    // void setName(const std::string& new_name);
    // void printMessages();

    std::deque<Arcus::MessagePtr> sent_messages;
    std::deque<Arcus::MessagePtr> received_messages;
};

} //namespace cura

#endif //MOCKSOCKET_H

//Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef MOCKSOCKET_H
#define MOCKSOCKET_H

#include <Arcus/Socket.h> //Inheriting from this to be able to swap this socket in the tested class.
#include <deque> //History of sent and received messages.

namespace cura
{

/*
 * \brief Mocks a socket connection from libArcus such that we can test with it
 * without creating an actual connection.
 */
class MockSocket : public Arcus::Socket
{
public:
    MockSocket();

    //These functions are overridden to be no-op.
    void connect(const std::string& address, int port) override;
    void listen(const std::string& address, int port) override;
    void close() override;
    void reset() override;

    //Catch these functions so that we can see whether they are called.
    void sendMessage(Arcus::MessagePtr message) override;
    Arcus::MessagePtr takeNextMessage() override;

    //Helpers to store the sent and received messages.
    void pushMessageToReceivedQueue(Arcus::MessagePtr message);
    Arcus::MessagePtr popMessageFromSendQueue();
    std::deque<Arcus::MessagePtr> sent_messages;
    std::deque<Arcus::MessagePtr> received_messages;
};

} //namespace cura

#endif //MOCKSOCKET_H

Mark functions as override if they override

So that if for some reason they don't override anything, we get a compiler error.
This bit me in the arse, anyway.

Contributes to issue CURA-4410.


/* ISC license. */

#include <skalibs/alloc.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
#include <s6-dns/skadns.h>

static int skadnsanswer_free (char *p, void *stuff)
{
  register skadnsanswer_t *q = (skadnsanswer_t_ref)p ;
  alloc_free(&q->data) ;
  (void)stuff ;
  return 1 ;
}

void skadns_end (skadns_t *a)
{
  skaclient_end(&a->connection) ;
  genalloc_free(uint16, &a->list) ;
  gensetdyn_iter(&a->q, &skadnsanswer_free, 0) ;
  gensetdyn_free(&a->q) ;
  *a = skadns_zero ;
}

/* ISC license. */

#include <skalibs/alloc.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
#include <s6-dns/skadns.h>

static int skadnsanswer_free (char *p, void *stuff)
{
  register skadnsanswer_t *q = (skadnsanswer_t_ref)p ;
  alloc_free(&q->data) ;
  (void)stuff ;
  return 1 ;
}

void skadns_end (skadns_t *a)
{
  skaclient_end(&a->connection) ;
  genalloc_free(uint16, &a->list) ;
  (void)gensetdyn_iter(&a->q, &skadnsanswer_free, 0) ;
  gensetdyn_free(&a->q) ;
  *a = skadns_zero ;
}

Adjust to gensetdyn_iter change in skalibs


#ifndef __EXGL_H__
#define __EXGL_H__

#include <OpenGLES/ES2/gl.h>
#include <JavaScriptCore/JSBase.h>

#ifdef __cplusplus
extern "C" {
#endif

// Identifies an EXGL context. No EXGL context has the id 0, so that can be
// used as a 'null' value.
typedef unsigned int EXGLContextId;

// [JS thread] Create an EXGL context and return its id number. Saves the
// JavaScript interface object (has a WebGLRenderingContext-style API) at
// `global.__EXGLContexts[id]` in JavaScript.
EXGLContextId EXGLContextCreate(JSGlobalContextRef jsCtx);

// [Any thread] Release the resources for an EXGL context. The same id is never
// reused.
void EXGLContextDestroy(EXGLContextId exglCtxId);

// [GL thread] Perform one frame's worth of queued up GL work
void EXGLContextFlush(EXGLContextId exglCtxId);

// [GL thread] Set the default framebuffer (used when binding 0). Allows using
// platform-specific extensions on the default framebuffer, such as MSAA.
void EXGLContextSetDefaultFramebuffer(EXGLContextId exglCtxId, GLint framebuffer);

#ifdef __cplusplus
}
#endif

#endif

#ifndef __EXGL_H__
#define __EXGL_H__

#ifdef __ANDROID__
#include <GLES2/gl2.h>
#endif
#ifdef __APPLE__
#include <OpenGLES/ES2/gl.h>
#endif

#include <JavaScriptCore/JSBase.h>

#ifdef __cplusplus
extern "C" {
#endif

// Identifies an EXGL context. No EXGL context has the id 0, so that can be
// used as a 'null' value.
typedef unsigned int EXGLContextId;

// [JS thread] Create an EXGL context and return its id number. Saves the
// JavaScript interface object (has a WebGLRenderingContext-style API) at
// `global.__EXGLContexts[id]` in JavaScript.
EXGLContextId EXGLContextCreate(JSGlobalContextRef jsCtx);

// [Any thread] Release the resources for an EXGL context. The same id is never
// reused.
void EXGLContextDestroy(EXGLContextId exglCtxId);

// [GL thread] Perform one frame's worth of queued up GL work
void EXGLContextFlush(EXGLContextId exglCtxId);

// [GL thread] Set the default framebuffer (used when binding 0). Allows using
// platform-specific extensions on the default framebuffer, such as MSAA.
void EXGLContextSetDefaultFramebuffer(EXGLContextId exglCtxId, GLint framebuffer);

#ifdef __cplusplus
}
#endif

#endif

Fix Android vs. iOS GL header include

Fix Android vs. iOS GL header include

fbshipit-source-id: 75ec20a


#ifndef E_MOD_MAIN_H
# define E_MOD_MAIN_H

# ifndef ECORE_X_RANDR_1_2
#  define ECORE_X_RANDR_1_2 ((1 << 16) | 2)
# endif

# ifndef ECORE_X_RANDR_1_3
#  define ECORE_X_RANDR_1_3 ((1 << 16) | 3)
# endif

# ifndef E_RANDR_12
#  define E_RANDR_12 (e_randr_screen_info.rrvd_info.randr_info_12)
# endif

EAPI extern E_Module_Api e_modapi;

EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);

extern const char *mod_dir;

/**
 * @addtogroup Optional_Conf
 * @{
 *
 * @defgroup Module_Conf_RandR RandR (Screen Resize, Rotate and Mirror)
 *
 * Configures size, rotation and mirroring of screen. Uses the X11
 * RandR protocol (does not work with NVidia proprietary drivers).
 *
 * @}
 */

#endif

#ifndef E_MOD_MAIN_H
# define E_MOD_MAIN_H

# define LOGFNS 1

# ifdef LOGFNS
#  include <stdio.h>
#  define LOGFN(fl, ln, fn) printf("-CONF-RANDR: %25s: %5i - %s\n", fl, ln, fn);
# else
#  define LOGFN(fl, ln, fn)
# endif

# ifndef ECORE_X_RANDR_1_2
#  define ECORE_X_RANDR_1_2 ((1 << 16) | 2)
# endif

# ifndef ECORE_X_RANDR_1_3
#  define ECORE_X_RANDR_1_3 ((1 << 16) | 3)
# endif

# ifndef E_RANDR_12
#  define E_RANDR_12 (e_randr_screen_info.rrvd_info.randr_info_12)
# endif

EAPI extern E_Module_Api e_modapi;

EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);

extern const char *mod_dir;

/**
 * @addtogroup Optional_Conf
 * @{
 *
 * @defgroup Module_Conf_RandR RandR (Screen Resize, Rotate and Mirror)
 *
 * Configures size, rotation and mirroring of screen. Uses the X11
 * RandR protocol (does not work with NVidia proprietary drivers).
 *
 * @}
 */

#endif

Add LOGFN macro to header.

Add LOGFN macro to header.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 84140


//===- lld/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h --------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H
#define LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H

#include "lld/ReaderWriter/ELFLinkingContext.h"
#include <system_error>

namespace lld {
namespace elf {
class AMDGPUTargetHandler;
class AMDGPUTargetLayout;

class AMDGPUTargetRelocationHandler final : public TargetRelocationHandler {
public:
  AMDGPUTargetRelocationHandler(AMDGPUTargetLayout &layout)
      : _targetLayout(layout) {}

  std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
                                  const AtomLayout &,
                                  const Reference &) const override;

private:
  AMDGPUTargetLayout &_targetLayout;
};
} // elf
} // lld
#endif

//===- lld/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h --------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H
#define LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H

#include "lld/ReaderWriter/ELFLinkingContext.h"
#include <system_error>

namespace lld {
namespace elf {
class AMDGPUTargetHandler;
class AMDGPUTargetLayout;

class AMDGPUTargetRelocationHandler final : public TargetRelocationHandler {
public:
  AMDGPUTargetRelocationHandler(AMDGPUTargetLayout &layout) { }

  std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
                                  const AtomLayout &,
                                  const Reference &) const override;

};
} // elf
} // lld
#endif

ELF/AMDGPU: Remove another unused private member variable

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@246164 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef CPR_AUTH_H
#define CPR_AUTH_H

#include <string>

namespace cpr {

    class Authentication {
      public:
        Authentication(const std::string& username, const std::string& password) :
            username_{username}, password_{password}, auth_string_{username + ":" + password} {}

        const char* GetAuthString() const;

      private:
        std::string username_;
        std::string password_;
        std::string auth_string_;
    };

}

#endif

#ifndef CPR_AUTH_H
#define CPR_AUTH_H

#include <string>

namespace cpr {

    class Authentication {
      public:
        Authentication(const std::string& username, const std::string& password) :
            username_{username}, password_{password}, auth_string_{username_ + ":" + password_} {}

        const char* GetAuthString() const;

      private:
        std::string username_;
        std::string password_;
        std::string auth_string_;
    };

}

#endif

Use the member strings since their types on concrete


#ifndef __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#define __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C

#include <pt.h>

class RCoRoutineRunner
{
public:
  RCoRoutineRunner();
  virtual
  ~RCoRoutineRunner();

  virtual char
  run();

public:
  struct pt mPt;
};

#endif // __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C

#ifndef __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#define __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C

#include <pt/pt.h>

class RCoRoutineRunner
{
public:
  RCoRoutineRunner();
  virtual
  ~RCoRoutineRunner();

  virtual char
  run();

public:
  struct pt mPt;
};

#endif // __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C

Use protothread library which included in RabirdToolkitThirdParties


#include<stdio.h>

int main()
{
int printed_numb=0;
int x;
int prev_number=2;
int number=2;
int flag;
  while(printed_numb<10)
  {
	flag=0;

	for(x=2;x<=number/2;x++)
	{
	  if(number%x==0)
 	   {
		flag=1;
		break;
	   }

	}
	if(flag=0)
	{
		if(number==prev_number+2)
		{
		 printf("%d - ",prev_number);
		 printf("%d\n",number);
		 printed_numb++;
		}
	   prev_number=number;
        }
      number++;

  }

return 0;
}

#include<stdio.h>

int main()
{
int printed_numb=0;
int x;
int prev_number=2;
int number=2;
int flag;
  while(printed_numb<10)
  {
	flag=0;

	for(x=2;x<=number/2;x++)
	{
	  if(number%x==0)
 	   {
		flag=1;
		break;
	   }

	}
	if(flag==0)
	{
		if(number==prev_number+2)
		{
		 printf("%d - ",prev_number);
		 printf("%d\n",number);
		 printed_numb++;
		}
	   prev_number=number;
        }
      number++;

  }

return 0;
}

Repair on Twin Primes.Homework 2 completed.Stefan Iliev 26 10V


/*  Copyright (c) 2013, laborer (laborer@126.com)
 *  Licensed under the BSD 2-Clause License.
 */

#include "common.h"
#include "iic.h"
#include "uart.h"

void welcome(void)
{
    uart_baudrate();
    uart_init();
    uart_putstr("c51drv\n");
}

void main(void) {
    welcome();

    while (1);
}

Add an empty iic test case

Add an empty iic test case


#ifndef GLMENU_H
#define GLMENU_H

#include "viewport.h"
GtkWidget* create_popup_menu (GtkWidget* drawing_area);
#endif

/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifndef GLMENU_H
#define GLMENU_H

#include "viewport.h"
GtkWidget *create_popup_menu(GtkWidget * drawing_area);
#endif

Clean up smyrna files: remove unnecessary globals modify libraries not to rely on code in cmd/smyrna remove static declarations from .h files remove unnecessary libraries mark unused code and clean up warnings


#include <sqlite3.h>
#include <stdio.h>

static sqlite3 *db;

int _mqtt_db_create_tables(void);

int mqtt_db_open(const char *filename)
{
	if(sqlite3_open(filename, &db) != SQLITE_OK){
		fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
		return 1;
	}

	return _mqtt_db_create_tables();
}

int mqtt_db_close(void)
{
	sqlite3_close(db);
	db = NULL;

	return 0;
}

int _mqtt_db_create_tables(void)
{
	int rc;
	char *errmsg = NULL;

	rc = sqlite3_exec(db,
		"CREATE TABLE IF NOT EXISTS clients("
		"id TEXT, "
		"will INTEGER, will_retain INTEGER, will_qos "
		"will_topic TEXT, will_message TEXT)",
		NULL, NULL, &errmsg);

	if(errmsg) sqlite3_free(errmsg);

	if(rc == SQLITE_OK){
		return 0;
	}else{
		return 1;
	}
}

#include <sqlite3.h>
#include <stdio.h>

static sqlite3 *db;

int _mqtt_db_create_tables(void);

int mqtt_db_open(const char *filename)
{
	if(sqlite3_open(filename, &db) != SQLITE_OK){
		fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
		return 1;
	}

	return _mqtt_db_create_tables();
}

int mqtt_db_close(void)
{
	sqlite3_close(db);
	db = NULL;

	return 0;
}

int _mqtt_db_create_tables(void)
{
	int rc = 0;
	char *errmsg = NULL;

	if(sqlite3_exec(db,
		"CREATE TABLE IF NOT EXISTS clients("
		"id TEXT, "
		"will INTEGER, will_retain INTEGER, will_qos "
		"will_topic TEXT, will_message TEXT)",
		NULL, NULL, &errmsg) != SQLITE_OK){

		rc = 1;
	}

	if(errmsg) sqlite3_free(errmsg);

	if(sqlite3_exec(db,
		"CREATE TABLE IF NOT EXISTS subs("
		"client_id TEXT, sub TEXT, qos INTEGER)",
		NULL, NULL, &errmsg) != SQLITE_OK){

		rc = 1;
	}

	if(errmsg) sqlite3_free(errmsg);

	return rc;
}

Create db table for subscriptions.

Create db table for subscriptions.


#include <telepathy-logger/channel-factory-internal.h>
#include <telepathy-logger/observer-internal.h>

static gint factory_counter = 0;

static TplChannel *
mock_factory (const gchar *chan_type,
    TpConnection *conn, const gchar *object_path, GHashTable *tp_chan_props,
    TpAccount *tp_acc, GError **error)
{
  factory_counter += 1;
  return NULL;
}

int
main (int argc, char **argv)
{
  TplObserver *obs, *obs2;

  g_type_init ();

  obs = _tpl_observer_new ();

  /* TplObserver is a singleton, be sure both references point to the same
   * memory address  */
  obs2 = _tpl_observer_new ();
  g_assert (obs == obs2);

  /* unref the second singleton pointer and check that the it is still
   * valid: checking correct object ref-counting after each _dup() call */
  g_object_unref (obs2);
  g_assert (TPL_IS_OBSERVER (obs));

  /* it points to the same mem area, it should be still valid */
  g_assert (TPL_IS_OBSERVER (obs2));

  /* register a ChanFactory and test ObserveChannel() */
  _tpl_observer_set_channel_factory (obs, mock_factory);

  /* proper disposal for the singleton when no references are present */
  g_object_unref (obs);
  g_assert (!TPL_IS_OBSERVER (obs));

  return 0;
}

#include <telepathy-logger/channel-factory-internal.h>
#include <telepathy-logger/observer-internal.h>

static gint factory_counter = 0;

static TplChannel *
mock_factory (const gchar *chan_type,
    TpConnection *conn, const gchar *object_path, GHashTable *tp_chan_props,
    TpAccount *tp_acc, GError **error)
{
  factory_counter += 1;
  return NULL;
}

int
main (int argc, char **argv)
{
  TplObserver *obs, *obs2;

  g_type_init ();

  obs = _tpl_observer_new ();

  /* TplObserver is a singleton, be sure both references point to the same
   * memory address  */
  obs2 = _tpl_observer_new ();
  g_assert (obs == obs2);

  /* unref the second singleton pointer and check that the it is still
   * valid: checking correct object ref-counting after each _dup() call */
  g_object_unref (obs2);
  g_assert (TPL_IS_OBSERVER (obs));

  /* it points to the same mem area, it should be still valid */
  g_assert (TPL_IS_OBSERVER (obs2));

  /* register a ChanFactory and test ObserveChannel() */
  _tpl_observer_set_channel_factory (obs, mock_factory);

  /* proper disposal for the singleton when no references are present */
  g_object_unref (obs);

  return 0;
}

Fix invalid read in pseudo observer test


//
//  include/guard_overflow.h
//  tbd
//
//  Created by inoahdev on 12/29/18.
//  Copyright © 2018 - 2019 inoahdev. All rights reserved.
//

#ifndef GUARD_OVERFLOW_H
#define GUARD_OVERFLOW_H

#include <stdint.h>

#define guard_overflow_add(left_in, right) _Generic((left_in), \
    uint32_t *: __builtin_uadd_overflow, \
    uint64_t *: __builtin_uaddl_overflow \
) (*left_in, right, left_in)

#define guard_overflow_mul(left_in, right) _Generic((left_in), \
    uint32_t *: __builtin_umul_overflow, \
    uint64_t *: __builtin_umull_overflow \
) (*left_in, right, left_in)

#define guard_overflow_shift_left(left_in, right) _Generic((left_in), \
    uint32_t *: guard_overflow_shift_left_uint32, \
    uint64_t *: guard_overflow_shift_left_uint64 \
) (left_in, right)

int guard_overflow_shift_left_uint32(uint32_t *left_in, uint32_t right);
int guard_overflow_shift_left_uint64(uint64_t *left_in, uint64_t right);

#endif /* GUARD_OVERFLOW_H */

//
//  include/guard_overflow.h
//  tbd
//
//  Created by inoahdev on 12/29/18.
//  Copyright © 2018 - 2019 inoahdev. All rights reserved.
//

#ifndef GUARD_OVERFLOW_H
#define GUARD_OVERFLOW_H

#include <stdint.h>

#define guard_overflow_add(left_in, right) \
    __builtin_add_overflow(*left_in, right, left_in)

#define guard_overflow_mul(left_in, right) \
    __builtin_mul_overflow(*left_in, right, left_in)

#define guard_overflow_shift_left(left_in, right) _Generic((left_in), \
    uint32_t *: guard_overflow_shift_left_uint32, \
    uint64_t *: guard_overflow_shift_left_uint64 \
) (left_in, right)

int guard_overflow_shift_left_uint32(uint32_t *left_in, uint32_t right);
int guard_overflow_shift_left_uint64(uint64_t *left_in, uint64_t right);

#endif /* GUARD_OVERFLOW_H */

Fix compile errors with different integer-types


#ifndef _ROOT_DEV_H_
#define _ROOT_DEV_H_

#include <linux/major.h>

enum {
	Root_NFS = MKDEV(UNNAMED_MAJOR, 255),
	Root_RAM0 = MKDEV(RAMDISK_MAJOR, 0),
	Root_RAM1 = MKDEV(RAMDISK_MAJOR, 1),
	Root_FD0 = MKDEV(FLOPPY_MAJOR, 0),
	Root_HDA1 = MKDEV(IDE0_MAJOR, 1),
	Root_HDA2 = MKDEV(IDE0_MAJOR, 2),
	Root_SDA1 = MKDEV(SCSI_DISK0_MAJOR, 1),
	Root_SDA2 = MKDEV(SCSI_DISK0_MAJOR, 2),
	Root_HDC1 = MKDEV(IDE1_MAJOR, 1),
	Root_SR0 = MKDEV(SCSI_CDROM_MAJOR, 0),
};

extern dev_t ROOT_DEV;

#endif

#ifndef _ROOT_DEV_H_
#define _ROOT_DEV_H_

#include <linux/major.h>
#include <linux/types.h>
#include <linux/kdev_t.h>

enum {
	Root_NFS = MKDEV(UNNAMED_MAJOR, 255),
	Root_RAM0 = MKDEV(RAMDISK_MAJOR, 0),
	Root_RAM1 = MKDEV(RAMDISK_MAJOR, 1),
	Root_FD0 = MKDEV(FLOPPY_MAJOR, 0),
	Root_HDA1 = MKDEV(IDE0_MAJOR, 1),
	Root_HDA2 = MKDEV(IDE0_MAJOR, 2),
	Root_SDA1 = MKDEV(SCSI_DISK0_MAJOR, 1),
	Root_SDA2 = MKDEV(SCSI_DISK0_MAJOR, 2),
	Root_HDC1 = MKDEV(IDE1_MAJOR, 1),
	Root_SR0 = MKDEV(SCSI_CDROM_MAJOR, 0),
};

extern dev_t ROOT_DEV;

#endif

[PATCH] Fix broken kernel headers preventing ARM build

As a result of 894673ee6122a3ce1958e1fe096901ba5356a96b, the ARM
architecture is more or less unbuildable - only one defconfig appears
to build, with all others erroring out with:

	  CC      arch/arm/kernel/setup.o
	In file included from /home/rmk/git/linux-2.6-rmk/arch/arm/kernel/setup.c:22:
	/home/rmk/git/linux-2.6-rmk/include/linux/root_dev.h:7: warning: implicit declaration of function `MKDEV'
	...

Essentially, root_dev.h uses MKDEV and dev_t, but does not include any
headers which provide either of these definitions.  The reason it worked
previously is that linux/tty.h just happened to include the required
headers for linux/root_dev.h.

Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>