Call lib init/cleanup in C client test.

Call lib init/cleanup in C client test.

--- test/lib/c/01-con-discon-success.c
+++ test/lib/c/01-con-discon-success.c
@@ -24,6 +24,8 @@
 	int rc;
 	struct mosquitto *mosq;

+	mosquitto_lib_init();
+
 	mosq = mosquitto_new("01-con-discon-success", true, NULL);
 	mosquitto_connect_callback_set(mosq, on_connect);
 	mosquitto_disconnect_callback_set(mosq, on_disconnect);
@@ -34,5 +36,6 @@
 		mosquitto_loop(mosq, -1);
 	}

+	mosquitto_lib_cleanup();
 	return run;
 }

<|original_code|>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <mosquitto.h>

static int run = -1;

void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
	if(rc){
		exit(1);
	}else{
		mosquitto_disconnect(mosq);
	}
}

void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
	run = rc;
}

int main(int argc, char *argv[])
{
	int rc;
	struct mosquitto *mosq;

	mosq = mosquitto_new("01-con-discon-success", true, NULL);
	mosquitto_connect_callback_set(mosq, on_connect);
	mosquitto_disconnect_callback_set(mosq, on_disconnect);

	rc = mosquitto_connect(mosq, "localhost", 1888, 60);

	while(run == -1){
		mosquitto_loop(mosq, -1);
	}

	return run;
}

<|edits_diff|>
--- test/lib/c/01-con-discon-success.c
+++ test/lib/c/01-con-discon-success.c
@@ -24,6 +24,8 @@
 	int rc;
 	struct mosquitto *mosq;

+	mosquitto_lib_init();
+
 	mosq = mosquitto_new("01-con-discon-success", true, NULL);
 	mosquitto_connect_callback_set(mosq, on_connect);
 	mosquitto_disconnect_callback_set(mosq, on_disconnect);
<|current_version|>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <mosquitto.h>

static int run = -1;

void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
	if(rc){
		exit(1);
	}else{
		mosquitto_disconnect(mosq);
	}
}

void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
	run = rc;
}

int main(int argc, char *argv[])
{
	int rc;
	struct mosquitto *mosq;

	mosquitto_lib_init();

	mosq = mosquitto_new("01-con-discon-success", true, NULL);
	mosquitto_connect_callback_set(mosq, on_connect);
	mosquitto_disconnect_callback_set(mosq, on_disconnect);

	rc = mosquitto_connect(mosq, "localhost", 1888, 60);

	while(run == -1){
		mosquitto_loop(mosq, -1);
	}

	return run;
}

<|next_version|>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <mosquitto.h>

static int run = -1;

void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
	if(rc){
		exit(1);
	}else{
		mosquitto_disconnect(mosq);
	}
}

void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
	run = rc;
}

int main(int argc, char *argv[])
{
	int rc;
	struct mosquitto *mosq;

	mosquitto_lib_init();

	mosq = mosquitto_new("01-con-discon-success", true, NULL);
	mosquitto_connect_callback_set(mosq, on_connect);
	mosquitto_disconnect_callback_set(mosq, on_disconnect);

	rc = mosquitto_connect(mosq, "localhost", 1888, 60);

	while(run == -1){
		mosquitto_loop(mosq, -1);
	}

	mosquitto_lib_cleanup();
	return run;
}


Allow to set custom DTB/OS_CALL addresses

Setting those from command line during compilation allows
to create a custom setup without the need of modifying the
sources.

--- src/main/c/emulator/src/config.h
+++ src/main/c/emulator/src/config.h
@@ -3,7 +3,13 @@

 //#define QEMU
 #define SIM
+
+#ifndef OS_CALL
 #define OS_CALL 0xC0000000
+#endif
+
+#ifndef DTB
 #define DTB 0xC3000000
+#endif

 #endif

<|original_code|>
#ifndef CONFIG_H
#define CONFIG_H

//#define QEMU
#define SIM
#define OS_CALL 0xC0000000
#define DTB 0xC3000000

#endif

<|edits_diff|>
--- src/main/c/emulator/src/config.h
+++ src/main/c/emulator/src/config.h
@@ -3,7 +3,12 @@

 //#define QEMU
 #define SIM
+
+#ifndef OS_CALL
 #define OS_CALL 0xC0000000
+#endif
+
+#ifndef DTB
 #define DTB 0xC3000000

 #endif
<|current_version|>
#ifndef CONFIG_H
#define CONFIG_H

//#define QEMU
#define SIM

#ifndef OS_CALL
#define OS_CALL 0xC0000000
#endif

#ifndef DTB
#define DTB 0xC3000000

#endif

<|next_version|>
#ifndef CONFIG_H
#define CONFIG_H

//#define QEMU
#define SIM

#ifndef OS_CALL
#define OS_CALL 0xC0000000
#endif

#ifndef DTB
#define DTB 0xC3000000
#endif

#endif


Print the message from SK_ABORT in stack traces

This will make debugging easier. Instead of using LOG_ALWAYS_FATAL, use
__android_log_assert (which the former uses internally) directly, since
SkQP can only access NDK APIs.

Depends on https://skia-review.googlesource.com/c/skia/+/521001.

Bug: 224771432
Test: manual
Change-Id: Ib9bec1e1d72169a18e6ad1ce8f9008a65dbe5a71

--- include/config/SkUserConfigManual.h
+++ include/config/SkUserConfigManual.h
@@ -7,6 +7,7 @@

 #ifndef SkUserConfigManual_DEFINED
 #define SkUserConfigManual_DEFINED
+  #include <android/log.h>
   #define GR_TEST_UTILS 1
   #define SK_BUILD_FOR_ANDROID_FRAMEWORK
   #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
@@ -30,4 +31,9 @@

   #define SK_DISABLE_DAA  // skbug.com/6886

+  #ifdef LOG_TAG
+    #undef LOG_TAG
+  #endif
+  #define LOG_TAG "skia"
+  #define SK_ABORT(...) __android_log_assert(nullptr, LOG_TAG, ##__VA_ARGS__)
 #endif // SkUserConfigManual_DEFINED

<|original_code|>
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT
  #define SK_SUPPORT_STROKEANDFILL

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

<|edits_diff|>
--- include/config/SkUserConfigManual.h
+++ include/config/SkUserConfigManual.h
@@ -7,6 +7,7 @@

 #ifndef SkUserConfigManual_DEFINED
 #define SkUserConfigManual_DEFINED
+  #include <android/log.h>
   #define GR_TEST_UTILS 1
   #define SK_BUILD_FOR_ANDROID_FRAMEWORK
   #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
<|current_version|>
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #include <android/log.h>
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT
  #define SK_SUPPORT_STROKEANDFILL

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

<|next_version|>
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #include <android/log.h>
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT
  #define SK_SUPPORT_STROKEANDFILL

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

  #ifdef LOG_TAG
    #undef LOG_TAG
  #endif
  #define LOG_TAG "skia"
  #define SK_ABORT(...) __android_log_assert(nullptr, LOG_TAG, ##__VA_ARGS__)
#endif // SkUserConfigManual_DEFINED


Add constructor with title attached

Add constructor with title attached

--- include/ActionBar.h
+++ include/ActionBar.h
@@ -9,6 +9,7 @@
 class ActionBar : public Element {
  public:
   ActionBar() { }
+  ActionBar(const char * _title) : title(_title) { }

   bool isA(const std::string & className) override {
     if (className == "ActionBar") return true;
@@ -19,8 +20,11 @@
   void initialize(FWPlatform * _platform) override {
     Element::initialize(_platform);
     Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
+    c.setTextValue(title);
     sendCommand(c);
   }
+
+  const char * title;
 };

 #endif

<|original_code|>
#ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_

#include <InputElement.h>

#include <Command.h>
#include <FWPlatform.h>

class ActionBar : public Element {
 public:
  ActionBar() { }

  bool isA(const std::string & className) override {
    if (className == "ActionBar") return true;
    return Element::isA(className);
  }

 protected:
  void initialize(FWPlatform * _platform) override {
    Element::initialize(_platform);
    Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
    sendCommand(c);
  }
};

#endif

<|edits_diff|>
--- include/ActionBar.h
+++ include/ActionBar.h
@@ -9,6 +9,7 @@
 class ActionBar : public Element {
  public:
   ActionBar() { }
+  ActionBar(const char * _title) : title(_title) { }

   bool isA(const std::string & className) override {
     if (className == "ActionBar") return true;
@@ -19,6 +20,7 @@
   void initialize(FWPlatform * _platform) override {
     Element::initialize(_platform);
     Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
+    c.setTextValue(title);
     sendCommand(c);
   }
 };
<|current_version|>
#ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_

#include <InputElement.h>

#include <Command.h>
#include <FWPlatform.h>

class ActionBar : public Element {
 public:
  ActionBar() { }
  ActionBar(const char * _title) : title(_title) { }

  bool isA(const std::string & className) override {
    if (className == "ActionBar") return true;
    return Element::isA(className);
  }

 protected:
  void initialize(FWPlatform * _platform) override {
    Element::initialize(_platform);
    Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
    c.setTextValue(title);
    sendCommand(c);
  }
};

#endif

<|next_version|>
#ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_

#include <InputElement.h>

#include <Command.h>
#include <FWPlatform.h>

class ActionBar : public Element {
 public:
  ActionBar() { }
  ActionBar(const char * _title) : title(_title) { }

  bool isA(const std::string & className) override {
    if (className == "ActionBar") return true;
    return Element::isA(className);
  }

 protected:
  void initialize(FWPlatform * _platform) override {
    Element::initialize(_platform);
    Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
    c.setTextValue(title);
    sendCommand(c);
  }

  const char * title;
};

#endif


Check size of unsigned long

x64: Check size of unsigned long

--- include/arch/x86/arch/types.h
+++ include/arch/x86/arch/types.h
@@ -11,10 +11,15 @@
 #ifndef __ARCH_TYPES_H
 #define __ARCH_TYPES_H

+#include <config.h>
 #include <assert.h>
 #include <stdint.h>

+#if defined(CONFIG_ARCH_IA32)
 compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
+#elif defined(CONFIG_ARCH_X86_64)
+compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
+#endif

 typedef unsigned long word_t;
 typedef word_t vptr_t;

<|original_code|>
/*
 * Copyright 2014, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H

#include <assert.h>
#include <stdint.h>

compile_assert(long_is_32bits, sizeof(unsigned long) == 4)

typedef unsigned long word_t;
typedef word_t vptr_t;
typedef word_t paddr_t;
typedef word_t pptr_t;
typedef word_t cptr_t;
typedef word_t dev_id_t;
typedef word_t cpu_id_t;
typedef word_t node_id_t;
typedef word_t dom_t;

/* for libsel4 headers that the kernel shares */
typedef word_t seL4_Word;
typedef cptr_t seL4_CPtr;
typedef uint32_t seL4_Uint32;
typedef uint8_t seL4_Uint8;
typedef node_id_t seL4_NodeId;
typedef paddr_t seL4_PAddr;
typedef dom_t seL4_Domain;
#endif

<|edits_diff|>
--- include/arch/x86/arch/types.h
+++ include/arch/x86/arch/types.h
@@ -11,9 +11,11 @@
 #ifndef __ARCH_TYPES_H
 #define __ARCH_TYPES_H

+#include <config.h>
 #include <assert.h>
 #include <stdint.h>

+#if defined(CONFIG_ARCH_IA32)
 compile_assert(long_is_32bits, sizeof(unsigned long) == 4)

 typedef unsigned long word_t;
<|current_version|>
/*
 * Copyright 2014, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H

#include <config.h>
#include <assert.h>
#include <stdint.h>

#if defined(CONFIG_ARCH_IA32)
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)

typedef unsigned long word_t;
typedef word_t vptr_t;
typedef word_t paddr_t;
typedef word_t pptr_t;
typedef word_t cptr_t;
typedef word_t dev_id_t;
typedef word_t cpu_id_t;
typedef word_t node_id_t;
typedef word_t dom_t;

/* for libsel4 headers that the kernel shares */
typedef word_t seL4_Word;
typedef cptr_t seL4_CPtr;
typedef uint32_t seL4_Uint32;
typedef uint8_t seL4_Uint8;
typedef node_id_t seL4_NodeId;
typedef paddr_t seL4_PAddr;
typedef dom_t seL4_Domain;
#endif

<|next_version|>
/*
 * Copyright 2014, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H

#include <config.h>
#include <assert.h>
#include <stdint.h>

#if defined(CONFIG_ARCH_IA32)
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
#elif defined(CONFIG_ARCH_X86_64)
compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
#endif

typedef unsigned long word_t;
typedef word_t vptr_t;
typedef word_t paddr_t;
typedef word_t pptr_t;
typedef word_t cptr_t;
typedef word_t dev_id_t;
typedef word_t cpu_id_t;
typedef word_t node_id_t;
typedef word_t dom_t;

/* for libsel4 headers that the kernel shares */
typedef word_t seL4_Word;
typedef cptr_t seL4_CPtr;
typedef uint32_t seL4_Uint32;
typedef uint8_t seL4_Uint8;
typedef node_id_t seL4_NodeId;
typedef paddr_t seL4_PAddr;
typedef dom_t seL4_Domain;
#endif


Add another missing extern "C"

Add another missing extern "C"

--- Alc/alconfig.h
+++ Alc/alconfig.h
@@ -1,5 +1,9 @@
 #ifndef ALCONFIG_H
 #define ALCONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 void ReadALConfig(void);
 void FreeALConfig(void);
@@ -14,4 +18,8 @@
 int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
 int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);

+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif /* ALCONFIG_H */

<|original_code|>
#ifndef ALCONFIG_H
#define ALCONFIG_H

void ReadALConfig(void);
void FreeALConfig(void);

int ConfigValueExists(const char *devName, const char *blockName, const char *keyName);
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def);
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def);

int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret);
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret);
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret);
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);

#endif /* ALCONFIG_H */

<|edits_diff|>
--- Alc/alconfig.h
+++ Alc/alconfig.h
@@ -1,5 +1,9 @@
 #ifndef ALCONFIG_H
 #define ALCONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 void ReadALConfig(void);
 void FreeALConfig(void);
<|current_version|>
#ifndef ALCONFIG_H
#define ALCONFIG_H

#ifdef __cplusplus
extern "C" {
#endif

void ReadALConfig(void);
void FreeALConfig(void);

int ConfigValueExists(const char *devName, const char *blockName, const char *keyName);
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def);
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def);

int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret);
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret);
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret);
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);

#endif /* ALCONFIG_H */

<|next_version|>
#ifndef ALCONFIG_H
#define ALCONFIG_H

#ifdef __cplusplus
extern "C" {
#endif

void ReadALConfig(void);
void FreeALConfig(void);

int ConfigValueExists(const char *devName, const char *blockName, const char *keyName);
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def);
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def);

int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret);
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret);
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret);
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* ALCONFIG_H */


Add leaf checks to SHA CPUID checks

Add leaf checks to SHA CPUID checks

--- src/shacpuid.c
+++ src/shacpuid.c
@@ -20,6 +20,10 @@
 static int CheckCPUsupportSHA()
 {
     unsigned int CPUInfo[4];
+    __cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
+    if (CPUInfo[0] < 7)
+        return 0;
+
     __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
     return CPUInfo[1] & (1 << 29); /* Check SHA */
 }
@@ -29,6 +33,10 @@
 static int CheckCPUsupportSHA()
 {
     unsigned int CPUInfo[4];
+    __cpuid(CPUInfo, 0);
+    if (CPUInfo[0] < 7)
+        return 0;
+
     __cpuidex(CPUInfo, 7, 0);
     return CPUInfo[1] & (1 << 29); /* Check SHA */
 }

<|original_code|>
/**
 * cpuid.c
 *
 * Checks if CPU has support of SHA instructions
 *
 * @author kryukov@frtk.ru
 * @version 4.0
 *
 * For Putty AES NI project
 * http://putty-aes-ni.googlecode.com/
 */

#ifndef SILENT
#include <stdio.h>
#endif

#if defined(__clang__) || defined(__GNUC__)

#include <cpuid.h>
static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#else /* defined(__clang__) || defined(__GNUC__) */

static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuidex(CPUInfo, 7, 0);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#endif /* defined(__clang__) || defined(__GNUC__) */

int main(int argc, char ** argv)
{
    const int res = !CheckCPUsupportSHA();
#ifndef SILENT
    printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
    return res;
}

<|edits_diff|>
--- src/shacpuid.c
+++ src/shacpuid.c
@@ -20,6 +20,10 @@
 static int CheckCPUsupportSHA()
 {
     unsigned int CPUInfo[4];
+    __cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
+    if (CPUInfo[0] < 7)
+        return 0;
+
     __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
     return CPUInfo[1] & (1 << 29); /* Check SHA */
 }
<|current_version|>
/**
 * cpuid.c
 *
 * Checks if CPU has support of SHA instructions
 *
 * @author kryukov@frtk.ru
 * @version 4.0
 *
 * For Putty AES NI project
 * http://putty-aes-ni.googlecode.com/
 */

#ifndef SILENT
#include <stdio.h>
#endif

#if defined(__clang__) || defined(__GNUC__)

#include <cpuid.h>
static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    if (CPUInfo[0] < 7)
        return 0;

    __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#else /* defined(__clang__) || defined(__GNUC__) */

static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuidex(CPUInfo, 7, 0);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#endif /* defined(__clang__) || defined(__GNUC__) */

int main(int argc, char ** argv)
{
    const int res = !CheckCPUsupportSHA();
#ifndef SILENT
    printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
    return res;
}

<|next_version|>
/**
 * cpuid.c
 *
 * Checks if CPU has support of SHA instructions
 *
 * @author kryukov@frtk.ru
 * @version 4.0
 *
 * For Putty AES NI project
 * http://putty-aes-ni.googlecode.com/
 */

#ifndef SILENT
#include <stdio.h>
#endif

#if defined(__clang__) || defined(__GNUC__)

#include <cpuid.h>
static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    if (CPUInfo[0] < 7)
        return 0;

    __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#else /* defined(__clang__) || defined(__GNUC__) */

static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid(CPUInfo, 0);
    if (CPUInfo[0] < 7)
        return 0;

    __cpuidex(CPUInfo, 7, 0);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#endif /* defined(__clang__) || defined(__GNUC__) */

int main(int argc, char ** argv)
{
    const int res = !CheckCPUsupportSHA();
#ifndef SILENT
    printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
    return res;
}


lib-dict: Allow registering builtin dict drivers multiple times.

--- src/lib-dict/dict-register.c
+++ src/lib-dict/dict-register.c
@@ -3,8 +3,12 @@
 #include "lib.h"
 #include "dict-private.h"

+static int refcount = 0;
+
 void dict_drivers_register_builtin(void)
 {
+	if (refcount++ > 0)
+		return;
 	dict_driver_register(&dict_driver_client);
 	dict_driver_register(&dict_driver_file);
 	dict_driver_register(&dict_driver_fs);
@@ -15,6 +19,8 @@

 void dict_drivers_unregister_builtin(void)
 {
+	if (--refcount > 0)
+		return;
 	dict_driver_unregister(&dict_driver_client);
 	dict_driver_unregister(&dict_driver_file);
 	dict_driver_unregister(&dict_driver_fs);

<|original_code|>
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

void dict_drivers_register_builtin(void)
{
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}

<|edits_diff|>
--- src/lib-dict/dict-register.c
+++ src/lib-dict/dict-register.c
@@ -3,8 +3,12 @@
 #include "lib.h"
 #include "dict-private.h"

+static int refcount = 0;
+
 void dict_drivers_register_builtin(void)
 {
+	if (refcount++ > 0)
+		return;
 	dict_driver_register(&dict_driver_client);
 	dict_driver_register(&dict_driver_file);
 	dict_driver_register(&dict_driver_fs);
<|current_version|>
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

static int refcount = 0;

void dict_drivers_register_builtin(void)
{
	if (refcount++ > 0)
		return;
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}

<|next_version|>
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

static int refcount = 0;

void dict_drivers_register_builtin(void)
{
	if (refcount++ > 0)
		return;
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	if (--refcount > 0)
		return;
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}


Debug check analysis for both sides.

Debug check analysis for both sides.

--- main.c
+++ main.c
@@ -1,5 +1,7 @@
 #include <stdio.h>
 #include "forsyth.h"
+
+#include "check.h"

 int main(int argc, char* argv[])
 {
@@ -33,5 +35,10 @@
     stream = (argc < 3) ? stdout : fopen(argv[2], "w");
     load_Forsyth(stream);
     fclose(stream);
+
+    if (in_check(WHITE))
+        puts("White is in check.");
+    if (in_check(BLACK))
+        puts("Black is in check.");
     return 0;
 }

<|original_code|>
#include <stdio.h>
#include "forsyth.h"

int main(int argc, char* argv[])
{
    FILE * stream;
    int FEN_status;

    if (argc < 2)
        FEN_status = load_FEN(
            "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
        );
    else
        FEN_status = load_FEN(argv[1]);

#if defined(TEST_MATE_IN_ONE)
    memcpy(&square(a8), "nk....bq", 8);
    memcpy(&square(a7), "ppp.r...", 8);
    memcpy(&square(a6), "........", 8);
    memcpy(&square(a5), "........", 8);
    memcpy(&square(a4), "........", 8);
    memcpy(&square(a3), "........", 8);
    memcpy(&square(a2), "...R.PPP", 8);
    memcpy(&square(a1), "QB....KN", 8);
#endif

    if (FEN_status != FEN_OK)
    {
        fprintf(stderr, "(%i):  FEN record is corrupt!\n\n", FEN_status);
        return (FEN_status);
    }

    stream = (argc < 3) ? stdout : fopen(argv[2], "w");
    load_Forsyth(stream);
    fclose(stream);
    return 0;
}

<|edits_diff|>
--- main.c
+++ main.c
@@ -1,5 +1,7 @@
 #include <stdio.h>
 #include "forsyth.h"
+
+#include "check.h"

 int main(int argc, char* argv[])
 {
<|current_version|>
#include <stdio.h>
#include "forsyth.h"

#include "check.h"

int main(int argc, char* argv[])
{
    FILE * stream;
    int FEN_status;

    if (argc < 2)
        FEN_status = load_FEN(
            "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
        );
    else
        FEN_status = load_FEN(argv[1]);

#if defined(TEST_MATE_IN_ONE)
    memcpy(&square(a8), "nk....bq", 8);
    memcpy(&square(a7), "ppp.r...", 8);
    memcpy(&square(a6), "........", 8);
    memcpy(&square(a5), "........", 8);
    memcpy(&square(a4), "........", 8);
    memcpy(&square(a3), "........", 8);
    memcpy(&square(a2), "...R.PPP", 8);
    memcpy(&square(a1), "QB....KN", 8);
#endif

    if (FEN_status != FEN_OK)
    {
        fprintf(stderr, "(%i):  FEN record is corrupt!\n\n", FEN_status);
        return (FEN_status);
    }

    stream = (argc < 3) ? stdout : fopen(argv[2], "w");
    load_Forsyth(stream);
    fclose(stream);
    return 0;
}

<|next_version|>
#include <stdio.h>
#include "forsyth.h"

#include "check.h"

int main(int argc, char* argv[])
{
    FILE * stream;
    int FEN_status;

    if (argc < 2)
        FEN_status = load_FEN(
            "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
        );
    else
        FEN_status = load_FEN(argv[1]);

#if defined(TEST_MATE_IN_ONE)
    memcpy(&square(a8), "nk....bq", 8);
    memcpy(&square(a7), "ppp.r...", 8);
    memcpy(&square(a6), "........", 8);
    memcpy(&square(a5), "........", 8);
    memcpy(&square(a4), "........", 8);
    memcpy(&square(a3), "........", 8);
    memcpy(&square(a2), "...R.PPP", 8);
    memcpy(&square(a1), "QB....KN", 8);
#endif

    if (FEN_status != FEN_OK)
    {
        fprintf(stderr, "(%i):  FEN record is corrupt!\n\n", FEN_status);
        return (FEN_status);
    }

    stream = (argc < 3) ? stdout : fopen(argv[2], "w");
    load_Forsyth(stream);
    fclose(stream);

    if (in_check(WHITE))
        puts("White is in check.");
    if (in_check(BLACK))
        puts("Black is in check.");
    return 0;
}


Add documentation for the Job class

Add documentation for the Job class

--- MoleQueue/job.h
+++ MoleQueue/job.h
@@ -24,25 +24,46 @@
 class Queue;
 class Program;

+/**
+ * Class to represent an execution of a Program.
+ */
 class Job : public QObject
 {
   Q_OBJECT

 public:
+  /** Creates a new job. */
   explicit Job(const Program *program);
+
+  /* Destroys the job object. */
   ~Job();

+  /** Set the name of the job to \p name. */
   void setName(const QString &name);
+
+  /** Returns the name of the job. */
   QString name() const;
+
+  /** Sets the title of the job to \p title. */
   void setTitle(const QString &title);
+
+  /** Returns the title for the job. */
   QString title() const;

+  /** Returns the program that the job is a type of. */
   const Program* program() const;
+
+  /** Returns the queue that the job is a member of. */
   const Queue* queue() const;

 private:
+  /** The name of the job. */
   QString m_name;
+
+  /** The title of the job. */
   QString m_title;
+
+  /** The program that the job is a type of. */
   const Program* m_program;
 };

<|original_code|>
/******************************************************************************

  This source file is part of the MoleQueue project.

  Copyright 2011 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

  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 JOB_H
#define JOB_H

#include <QObject>

namespace MoleQueue {

class Queue;
class Program;

class Job : public QObject
{
  Q_OBJECT

public:
  explicit Job(const Program *program);
  ~Job();

  void setName(const QString &name);
  QString name() const;
  void setTitle(const QString &title);
  QString title() const;

  const Program* program() const;
  const Queue* queue() const;

private:
  QString m_name;
  QString m_title;
  const Program* m_program;
};

} // end MoleQueue namespace

#endif // JOB_H

<|edits_diff|>
--- MoleQueue/job.h
+++ MoleQueue/job.h
@@ -24,24 +24,43 @@
 class Queue;
 class Program;

+/**
+ * Class to represent an execution of a Program.
+ */
 class Job : public QObject
 {
   Q_OBJECT

 public:
+  /** Creates a new job. */
   explicit Job(const Program *program);
+
+  /* Destroys the job object. */
   ~Job();

+  /** Set the name of the job to \p name. */
   void setName(const QString &name);
+
+  /** Returns the name of the job. */
   QString name() const;
+
+  /** Sets the title of the job to \p title. */
   void setTitle(const QString &title);
+
+  /** Returns the title for the job. */
   QString title() const;

+  /** Returns the program that the job is a type of. */
   const Program* program() const;
+
+  /** Returns the queue that the job is a member of. */
   const Queue* queue() const;

 private:
+  /** The name of the job. */
   QString m_name;
+
+  /** The title of the job. */
   QString m_title;
   const Program* m_program;
 };
<|current_version|>
/******************************************************************************

  This source file is part of the MoleQueue project.

  Copyright 2011 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

  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 JOB_H
#define JOB_H

#include <QObject>

namespace MoleQueue {

class Queue;
class Program;

/**
 * Class to represent an execution of a Program.
 */
class Job : public QObject
{
  Q_OBJECT

public:
  /** Creates a new job. */
  explicit Job(const Program *program);

  /* Destroys the job object. */
  ~Job();

  /** Set the name of the job to \p name. */
  void setName(const QString &name);

  /** Returns the name of the job. */
  QString name() const;

  /** Sets the title of the job to \p title. */
  void setTitle(const QString &title);

  /** Returns the title for the job. */
  QString title() const;

  /** Returns the program that the job is a type of. */
  const Program* program() const;

  /** Returns the queue that the job is a member of. */
  const Queue* queue() const;

private:
  /** The name of the job. */
  QString m_name;

  /** The title of the job. */
  QString m_title;
  const Program* m_program;
};

} // end MoleQueue namespace

#endif // JOB_H

<|next_version|>
/******************************************************************************

  This source file is part of the MoleQueue project.

  Copyright 2011 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

  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 JOB_H
#define JOB_H

#include <QObject>

namespace MoleQueue {

class Queue;
class Program;

/**
 * Class to represent an execution of a Program.
 */
class Job : public QObject
{
  Q_OBJECT

public:
  /** Creates a new job. */
  explicit Job(const Program *program);

  /* Destroys the job object. */
  ~Job();

  /** Set the name of the job to \p name. */
  void setName(const QString &name);

  /** Returns the name of the job. */
  QString name() const;

  /** Sets the title of the job to \p title. */
  void setTitle(const QString &title);

  /** Returns the title for the job. */
  QString title() const;

  /** Returns the program that the job is a type of. */
  const Program* program() const;

  /** Returns the queue that the job is a member of. */
  const Queue* queue() const;

private:
  /** The name of the job. */
  QString m_name;

  /** The title of the job. */
  QString m_title;

  /** The program that the job is a type of. */
  const Program* m_program;
};

} // end MoleQueue namespace

#endif // JOB_H


Add function prototype for monitor clone set.

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

SVN revision: 84208

--- src/modules/conf_randr/e_smart_monitor.h
+++ src/modules/conf_randr/e_smart_monitor.h
@@ -5,11 +5,13 @@

 Evas_Object *e_smart_monitor_add(Evas *evas);
 void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
+Ecore_X_Randr_Crtc e_smart_monitor_crtc_get(Evas_Object *obj);
 void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
 void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh);
 void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh);
 void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy);
 void e_smart_monitor_current_geometry_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
+void e_smart_monitor_clone_set(Evas_Object *obj, Evas_Object *parent);

 # endif
 #endif

<|original_code|>
#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_MONITOR_H
#  define E_SMART_MONITOR_H

Evas_Object *e_smart_monitor_add(Evas *evas);
void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh);
void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh);
void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy);
void e_smart_monitor_current_geometry_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);

# endif
#endif

<|edits_diff|>
--- src/modules/conf_randr/e_smart_monitor.h
+++ src/modules/conf_randr/e_smart_monitor.h
@@ -5,6 +5,7 @@

 Evas_Object *e_smart_monitor_add(Evas *evas);
 void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
+Ecore_X_Randr_Crtc e_smart_monitor_crtc_get(Evas_Object *obj);
 void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
 void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh);
 void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh);
<|current_version|>
#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_MONITOR_H
#  define E_SMART_MONITOR_H

Evas_Object *e_smart_monitor_add(Evas *evas);
void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
Ecore_X_Randr_Crtc e_smart_monitor_crtc_get(Evas_Object *obj);
void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh);
void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh);
void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy);
void e_smart_monitor_current_geometry_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);

# endif
#endif

<|next_version|>
#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_MONITOR_H
#  define E_SMART_MONITOR_H

Evas_Object *e_smart_monitor_add(Evas *evas);
void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
Ecore_X_Randr_Crtc e_smart_monitor_crtc_get(Evas_Object *obj);
void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh);
void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh);
void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy);
void e_smart_monitor_current_geometry_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
void e_smart_monitor_clone_set(Evas_Object *obj, Evas_Object *parent);

# endif
#endif


Set about dialog program name

Set about dialog program name

--- ghighlighter/gh-about-dialog.c
+++ ghighlighter/gh-about-dialog.c
@@ -8,8 +8,10 @@
   dialog = gtk_about_dialog_new ();

   static gchar const *title = "About ghighlighter";
+  static gchar const *program_name = "ghighlighter";

   gtk_window_set_title (GTK_WINDOW (dialog), title);
+  gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (dialog), program_name);

   return dialog;
 }

<|original_code|>
#include <gtk/gtk.h>

GtkWidget *
gh_about_dialog_create ()
{
  GtkWidget *dialog;

  dialog = gtk_about_dialog_new ();

  static gchar const *title = "About ghighlighter";

  gtk_window_set_title (GTK_WINDOW (dialog), title);

  return dialog;
}

<|edits_diff|>
--- ghighlighter/gh-about-dialog.c
+++ ghighlighter/gh-about-dialog.c
@@ -8,6 +8,7 @@
   dialog = gtk_about_dialog_new ();

   static gchar const *title = "About ghighlighter";
+  static gchar const *program_name = "ghighlighter";

   gtk_window_set_title (GTK_WINDOW (dialog), title);

<|current_version|>
#include <gtk/gtk.h>

GtkWidget *
gh_about_dialog_create ()
{
  GtkWidget *dialog;

  dialog = gtk_about_dialog_new ();

  static gchar const *title = "About ghighlighter";
  static gchar const *program_name = "ghighlighter";

  gtk_window_set_title (GTK_WINDOW (dialog), title);

  return dialog;
}

<|next_version|>
#include <gtk/gtk.h>

GtkWidget *
gh_about_dialog_create ()
{
  GtkWidget *dialog;

  dialog = gtk_about_dialog_new ();

  static gchar const *title = "About ghighlighter";
  static gchar const *program_name = "ghighlighter";

  gtk_window_set_title (GTK_WINDOW (dialog), title);
  gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (dialog), program_name);

  return dialog;
}


Add methods to joinable to handle streams

--- server/types/JoinableImpl.h
+++ server/types/JoinableImpl.h
@@ -6,6 +6,7 @@

 using ::com::kurento::kms::api::Joinable;
 using ::com::kurento::kms::api::Direction;
+using ::com::kurento::kms::api::StreamType;

 namespace com { namespace kurento { namespace kms {

@@ -14,10 +15,19 @@
 	JoinableImpl();
 	~JoinableImpl() throw() {};

+	std::vector<StreamType::type> getStreams(const Joinable& joinable);
+
 	void join(const JoinableImpl& to, const Direction::type direction);
 	void unjoin(const JoinableImpl& to);
+
+	void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
+	void unjoin(const JoinableImpl& to, const StreamType::type stream);
+
 	std::vector<Joinable> &getJoinees();
 	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);
+
+	std::vector<Joinable> &getJoinees(const StreamType::type stream);
+	std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction);
 };

 }}} // com::kurento::kms

<|original_code|>
#ifndef JOINABLE_IMPL
#define JOINABLE_IMPL

#include "joinable_types.h"
#include "types/MediaObjectImpl.h"

using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;

namespace com { namespace kurento { namespace kms {

class JoinableImpl : public virtual Joinable, public virtual MediaObjectImpl {
public:
	JoinableImpl();
	~JoinableImpl() throw() {};

	void join(const JoinableImpl& to, const Direction::type direction);
	void unjoin(const JoinableImpl& to);
	std::vector<Joinable> &getJoinees();
	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);
};

}}} // com::kurento::kms

#endif /* JOINABLE_IMPL */
<|edits_diff|>
--- server/types/JoinableImpl.h
+++ server/types/JoinableImpl.h
@@ -6,6 +6,7 @@

 using ::com::kurento::kms::api::Joinable;
 using ::com::kurento::kms::api::Direction;
+using ::com::kurento::kms::api::StreamType;

 namespace com { namespace kurento { namespace kms {

@@ -14,8 +15,14 @@
 	JoinableImpl();
 	~JoinableImpl() throw() {};

+	std::vector<StreamType::type> getStreams(const Joinable& joinable);
+
 	void join(const JoinableImpl& to, const Direction::type direction);
 	void unjoin(const JoinableImpl& to);
+
+	void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
+	void unjoin(const JoinableImpl& to, const StreamType::type stream);
+
 	std::vector<Joinable> &getJoinees();
 	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);
 };
<|current_version|>
#ifndef JOINABLE_IMPL
#define JOINABLE_IMPL

#include "joinable_types.h"
#include "types/MediaObjectImpl.h"

using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;
using ::com::kurento::kms::api::StreamType;

namespace com { namespace kurento { namespace kms {

class JoinableImpl : public virtual Joinable, public virtual MediaObjectImpl {
public:
	JoinableImpl();
	~JoinableImpl() throw() {};

	std::vector<StreamType::type> getStreams(const Joinable& joinable);

	void join(const JoinableImpl& to, const Direction::type direction);
	void unjoin(const JoinableImpl& to);

	void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
	void unjoin(const JoinableImpl& to, const StreamType::type stream);

	std::vector<Joinable> &getJoinees();
	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);
};

}}} // com::kurento::kms

#endif /* JOINABLE_IMPL */
<|next_version|>
#ifndef JOINABLE_IMPL
#define JOINABLE_IMPL

#include "joinable_types.h"
#include "types/MediaObjectImpl.h"

using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;
using ::com::kurento::kms::api::StreamType;

namespace com { namespace kurento { namespace kms {

class JoinableImpl : public virtual Joinable, public virtual MediaObjectImpl {
public:
	JoinableImpl();
	~JoinableImpl() throw() {};

	std::vector<StreamType::type> getStreams(const Joinable& joinable);

	void join(const JoinableImpl& to, const Direction::type direction);
	void unjoin(const JoinableImpl& to);

	void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
	void unjoin(const JoinableImpl& to, const StreamType::type stream);

	std::vector<Joinable> &getJoinees();
	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);

	std::vector<Joinable> &getJoinees(const StreamType::type stream);
	std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction);
};

}}} // com::kurento::kms

#endif /* JOINABLE_IMPL */


Add page fault handler to abort on page fault.

--- src/kernel.c
+++ src/kernel.c
@@ -10,6 +10,11 @@
 //Calling convention on x86-64 System V ABI
 //rdi, rsi, rdx, rcx for ints

+void page_fault(void) {
+	terminal_printf("Fault");
+	assert(0!=0);
+}
+
 void kernel_main(uintptr_t pmultiboot) {
 	init_terminal();

@@ -19,10 +24,14 @@
 	keyboard_init();
 	add_interrupt_handler(0x21, keyboard_interrupt);

+	add_interrupt_handler(0x0e, page_fault);
+
 	init_multiboot_data(pmultiboot);

 	init_allocator(&data);

+
+	remap_kernel();
 	//test();

<|original_code|>
#include "terminal.h"
#include "multiboot.h"
#include "pic.h"
#include "keyboard.h"
#include "frame_allocator.h"
#include "paging.h"

#include "assert.h"

//Calling convention on x86-64 System V ABI
//rdi, rsi, rdx, rcx for ints

void kernel_main(uintptr_t pmultiboot) {
	init_terminal();

	pic_init(0x20, 0x28);
	pic_enable_interrupts();

	keyboard_init();
	add_interrupt_handler(0x21, keyboard_interrupt);

	init_multiboot_data(pmultiboot);

	init_allocator(&data);

	//test();

	while(1) {
		// struct frame f;
		// allocate_frame(&f);

		// print_text("Alloc frame num: ");
		// print_hex_number(f.number);
		// print_newline();
		int foo = 10;
		int bar = 0xdeadbeef;
		size_t baz = 0xcafebabecafebabe;
		//terminal_printf("\ntest\ntest2\ntest3\n%x\n%3X\n%#x\n%X\n%zx", foo, foo, bar, bar, baz);

		for(int k = 0; k < 50000000; ++k) {}
	}
}
<|edits_diff|>
--- src/kernel.c
+++ src/kernel.c
@@ -10,6 +10,11 @@
 //Calling convention on x86-64 System V ABI
 //rdi, rsi, rdx, rcx for ints

+void page_fault(void) {
+	terminal_printf("Fault");
+	assert(0!=0);
+}
+
 void kernel_main(uintptr_t pmultiboot) {
 	init_terminal();

@@ -18,6 +23,8 @@

 	keyboard_init();
 	add_interrupt_handler(0x21, keyboard_interrupt);
+
+	add_interrupt_handler(0x0e, page_fault);

 	init_multiboot_data(pmultiboot);

<|current_version|>
#include "terminal.h"
#include "multiboot.h"
#include "pic.h"
#include "keyboard.h"
#include "frame_allocator.h"
#include "paging.h"

#include "assert.h"

//Calling convention on x86-64 System V ABI
//rdi, rsi, rdx, rcx for ints

void page_fault(void) {
	terminal_printf("Fault");
	assert(0!=0);
}

void kernel_main(uintptr_t pmultiboot) {
	init_terminal();

	pic_init(0x20, 0x28);
	pic_enable_interrupts();

	keyboard_init();
	add_interrupt_handler(0x21, keyboard_interrupt);

	add_interrupt_handler(0x0e, page_fault);

	init_multiboot_data(pmultiboot);

	init_allocator(&data);

	//test();

	while(1) {
		// struct frame f;
		// allocate_frame(&f);

		// print_text("Alloc frame num: ");
		// print_hex_number(f.number);
		// print_newline();
		int foo = 10;
		int bar = 0xdeadbeef;
		size_t baz = 0xcafebabecafebabe;
		//terminal_printf("\ntest\ntest2\ntest3\n%x\n%3X\n%#x\n%X\n%zx", foo, foo, bar, bar, baz);

		for(int k = 0; k < 50000000; ++k) {}
	}
}
<|next_version|>
#include "terminal.h"
#include "multiboot.h"
#include "pic.h"
#include "keyboard.h"
#include "frame_allocator.h"
#include "paging.h"

#include "assert.h"

//Calling convention on x86-64 System V ABI
//rdi, rsi, rdx, rcx for ints

void page_fault(void) {
	terminal_printf("Fault");
	assert(0!=0);
}

void kernel_main(uintptr_t pmultiboot) {
	init_terminal();

	pic_init(0x20, 0x28);
	pic_enable_interrupts();

	keyboard_init();
	add_interrupt_handler(0x21, keyboard_interrupt);

	add_interrupt_handler(0x0e, page_fault);

	init_multiboot_data(pmultiboot);

	init_allocator(&data);

	remap_kernel();
	//test();

	while(1) {
		// struct frame f;
		// allocate_frame(&f);

		// print_text("Alloc frame num: ");
		// print_hex_number(f.number);
		// print_newline();
		int foo = 10;
		int bar = 0xdeadbeef;
		size_t baz = 0xcafebabecafebabe;
		//terminal_printf("\ntest\ntest2\ntest3\n%x\n%3X\n%#x\n%X\n%zx", foo, foo, bar, bar, baz);

		for(int k = 0; k < 50000000; ++k) {}
	}
}


Fix font size on rectangular watches

Fix font size on rectangular watches

--- src/config.h
+++ src/config.h
@@ -22,8 +22,13 @@
 #define BPM_HINT_FONT_HEIGHT 24
 #define BPM_HINT_TEXT "Current BPM:"

+#ifdef PBL_ROUND
 #define METRONOME_HINT_FONT FONT_KEY_GOTHIC_18_BOLD
 #define METRONOME_HINT_FONT_HEIGHT 18
+#else
+#define METRONOME_HINT_FONT FONT_KEY_GOTHIC_14_BOLD
+#define METRONOME_HINT_FONT_HEIGHT 14
+#endif
 #define METRONOME_HINT_TEXT "Metronome BPM:"

 #define METRONOME_VIBE_DURATION_MS 50

<|original_code|>
#pragma once

#include <pebble.h>

#define BG_COLOR GColorWhite

#ifdef PBL_ROUND
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 12)
#else
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 2)
#endif

#define BPM_DEFAULT_BPM_T 1200

#define BPM_FONT FONT_KEY_BITHAM_42_BOLD
#define BPM_FONT_HEIGHT 42

#define BPM_TEXT_INVALID "---"
#define BPM_TEXT_BUFFER_SIZE 10

#define BPM_HINT_FONT FONT_KEY_GOTHIC_24_BOLD
#define BPM_HINT_FONT_HEIGHT 24
#define BPM_HINT_TEXT "Current BPM:"

#define METRONOME_HINT_FONT FONT_KEY_GOTHIC_18_BOLD
#define METRONOME_HINT_FONT_HEIGHT 18
#define METRONOME_HINT_TEXT "Metronome BPM:"

#define METRONOME_VIBE_DURATION_MS 50

#define METRONOME_EDIT_TAP_REPEAT_MS 30

#define TAP_TIMEOUT_SECONDS 2

<|edits_diff|>
--- src/config.h
+++ src/config.h
@@ -22,6 +22,7 @@
 #define BPM_HINT_FONT_HEIGHT 24
 #define BPM_HINT_TEXT "Current BPM:"

+#ifdef PBL_ROUND
 #define METRONOME_HINT_FONT FONT_KEY_GOTHIC_18_BOLD
 #define METRONOME_HINT_FONT_HEIGHT 18
 #define METRONOME_HINT_TEXT "Metronome BPM:"
<|current_version|>
#pragma once

#include <pebble.h>

#define BG_COLOR GColorWhite

#ifdef PBL_ROUND
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 12)
#else
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 2)
#endif

#define BPM_DEFAULT_BPM_T 1200

#define BPM_FONT FONT_KEY_BITHAM_42_BOLD
#define BPM_FONT_HEIGHT 42

#define BPM_TEXT_INVALID "---"
#define BPM_TEXT_BUFFER_SIZE 10

#define BPM_HINT_FONT FONT_KEY_GOTHIC_24_BOLD
#define BPM_HINT_FONT_HEIGHT 24
#define BPM_HINT_TEXT "Current BPM:"

#ifdef PBL_ROUND
#define METRONOME_HINT_FONT FONT_KEY_GOTHIC_18_BOLD
#define METRONOME_HINT_FONT_HEIGHT 18
#define METRONOME_HINT_TEXT "Metronome BPM:"

#define METRONOME_VIBE_DURATION_MS 50

#define METRONOME_EDIT_TAP_REPEAT_MS 30

#define TAP_TIMEOUT_SECONDS 2

<|next_version|>
#pragma once

#include <pebble.h>

#define BG_COLOR GColorWhite

#ifdef PBL_ROUND
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 12)
#else
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 2)
#endif

#define BPM_DEFAULT_BPM_T 1200

#define BPM_FONT FONT_KEY_BITHAM_42_BOLD
#define BPM_FONT_HEIGHT 42

#define BPM_TEXT_INVALID "---"
#define BPM_TEXT_BUFFER_SIZE 10

#define BPM_HINT_FONT FONT_KEY_GOTHIC_24_BOLD
#define BPM_HINT_FONT_HEIGHT 24
#define BPM_HINT_TEXT "Current BPM:"

#ifdef PBL_ROUND
#define METRONOME_HINT_FONT FONT_KEY_GOTHIC_18_BOLD
#define METRONOME_HINT_FONT_HEIGHT 18
#else
#define METRONOME_HINT_FONT FONT_KEY_GOTHIC_14_BOLD
#define METRONOME_HINT_FONT_HEIGHT 14
#endif
#define METRONOME_HINT_TEXT "Metronome BPM:"

#define METRONOME_VIBE_DURATION_MS 50

#define METRONOME_EDIT_TAP_REPEAT_MS 30

#define TAP_TIMEOUT_SECONDS 2


Add support for react-native < 0.40

Add support for react-native < 0.40

--- ios/RNI18n.h
+++ ios/RNI18n.h
@@ -1,4 +1,8 @@
+#if __has_include("RCTBridgeModule.h")
+#import "RCTBridgeModule.h"
+#else
 #import <React/RCTBridgeModule.h>
+#endif

 @interface RNI18n : NSObject <RCTBridgeModule>
 @end

<|original_code|>
#import <React/RCTBridgeModule.h>

@interface RNI18n : NSObject <RCTBridgeModule>
@end

<|edits_diff|>
--- ios/RNI18n.h
+++ ios/RNI18n.h
@@ -1,3 +1,6 @@
+#if __has_include("RCTBridgeModule.h")
+#import "RCTBridgeModule.h"
+#else
 #import <React/RCTBridgeModule.h>

 @interface RNI18n : NSObject <RCTBridgeModule>
<|current_version|>
#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>

@interface RNI18n : NSObject <RCTBridgeModule>
@end

<|next_version|>
#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>
#endif

@interface RNI18n : NSObject <RCTBridgeModule>
@end


Insert 2 UILabel as property : *switchOnLabel, *switchOffLabel, allow the action function - (void)changeHint:(UISwitch *)userSwitch; to access them.

--- UIViewControllerTest/UIViewControllerTest/ViewController.h
+++ UIViewControllerTest/UIViewControllerTest/ViewController.h
@@ -10,6 +10,9 @@
 #import <UIKit/UIKit.h>

 @interface ViewController : UIViewController
+
+    @property (atomic, readwrite) UILabel *switchOnLabel;
+    @property (atomic, readwrite) UILabel *switchOffLabel;

     + (void)initialize;
     - (instancetype)init;
@@ -27,6 +30,7 @@
     - (void)dealloc;

     - (void)changeColor;
+    - (void)changeHint:(UISwitch *)userSwitch;

 @end

<|original_code|>
/**************************************************************************************************
 * File name    : ViewController.h
 * Description  : Define the ViewController class.
 * Creator      : Frederick Hsu
 * Creation date: Thu.  23 Feb. 2017
 * Copyright(C  2017    All rights reserved.
 *
 **************************************************************************************************/

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

    + (void)initialize;
    - (instancetype)init;
    - (instancetype)initWithCoder:(NSCoder *)coder;
    - (void)awakeFromNib;
    - (void)loadView;
    - (void)viewDidLoad;
    - (void)viewWillLayoutSubviews;
    - (void)viewDidLayoutSubviews;
    - (void)didReceiveMemoryWarning;
    - (void)viewDidAppear:(BOOL)animated;
    - (void)viewWillAppear:(BOOL)animated;
    - (void)viewWillDisappear:(BOOL)animated;
    - (void)viewDidDisappear:(BOOL)animated;
    - (void)dealloc;

    - (void)changeColor;

@end

<|edits_diff|>
--- UIViewControllerTest/UIViewControllerTest/ViewController.h
+++ UIViewControllerTest/UIViewControllerTest/ViewController.h
@@ -10,6 +10,9 @@
 #import <UIKit/UIKit.h>

 @interface ViewController : UIViewController
+
+    @property (atomic, readwrite) UILabel *switchOnLabel;
+    @property (atomic, readwrite) UILabel *switchOffLabel;

     + (void)initialize;
     - (instancetype)init;
<|current_version|>
/**************************************************************************************************
 * File name    : ViewController.h
 * Description  : Define the ViewController class.
 * Creator      : Frederick Hsu
 * Creation date: Thu.  23 Feb. 2017
 * Copyright(C  2017    All rights reserved.
 *
 **************************************************************************************************/

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

    @property (atomic, readwrite) UILabel *switchOnLabel;
    @property (atomic, readwrite) UILabel *switchOffLabel;

    + (void)initialize;
    - (instancetype)init;
    - (instancetype)initWithCoder:(NSCoder *)coder;
    - (void)awakeFromNib;
    - (void)loadView;
    - (void)viewDidLoad;
    - (void)viewWillLayoutSubviews;
    - (void)viewDidLayoutSubviews;
    - (void)didReceiveMemoryWarning;
    - (void)viewDidAppear:(BOOL)animated;
    - (void)viewWillAppear:(BOOL)animated;
    - (void)viewWillDisappear:(BOOL)animated;
    - (void)viewDidDisappear:(BOOL)animated;
    - (void)dealloc;

    - (void)changeColor;

@end

<|next_version|>
/**************************************************************************************************
 * File name    : ViewController.h
 * Description  : Define the ViewController class.
 * Creator      : Frederick Hsu
 * Creation date: Thu.  23 Feb. 2017
 * Copyright(C  2017    All rights reserved.
 *
 **************************************************************************************************/

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

    @property (atomic, readwrite) UILabel *switchOnLabel;
    @property (atomic, readwrite) UILabel *switchOffLabel;

    + (void)initialize;
    - (instancetype)init;
    - (instancetype)initWithCoder:(NSCoder *)coder;
    - (void)awakeFromNib;
    - (void)loadView;
    - (void)viewDidLoad;
    - (void)viewWillLayoutSubviews;
    - (void)viewDidLayoutSubviews;
    - (void)didReceiveMemoryWarning;
    - (void)viewDidAppear:(BOOL)animated;
    - (void)viewWillAppear:(BOOL)animated;
    - (void)viewWillDisappear:(BOOL)animated;
    - (void)viewDidDisappear:(BOOL)animated;
    - (void)dealloc;

    - (void)changeColor;
    - (void)changeHint:(UISwitch *)userSwitch;

@end


Watch for input from stdin and print it.

--- client/loop.c
+++ client/loop.c
@@ -7,6 +7,7 @@
 	struct timespec timeout;
 	fd_set readfds;
 	int fdcount;
+	char buf[1024];

 	while(1){
 		FD_ZERO(&readfds);
@@ -16,6 +17,11 @@

 		fdcount = pselect(1, &readfds, NULL, NULL, &timeout, NULL);
 		printf("loop %d\n", fdcount);
+
+		if(FD_ISSET(0, &readfds)){
+			read(0, buf, 1024);
+			printf("buf: %s\n", buf);
+		}
 	}
 	return 0;
 }

<|original_code|>
#include <stdio.h>
#include <sys/select.h>

/* pselect loop test */
int main(int argc, char *argv[])
{
	struct timespec timeout;
	fd_set readfds;
	int fdcount;

	while(1){
		FD_ZERO(&readfds);
		FD_SET(0, &readfds);
		timeout.tv_sec = 1;
		timeout.tv_nsec = 0;

		fdcount = pselect(1, &readfds, NULL, NULL, &timeout, NULL);
		printf("loop %d\n", fdcount);
	}
	return 0;
}

<|edits_diff|>
--- client/loop.c
+++ client/loop.c
@@ -7,6 +7,7 @@
 	struct timespec timeout;
 	fd_set readfds;
 	int fdcount;
+	char buf[1024];

 	while(1){
 		FD_ZERO(&readfds);
<|current_version|>
#include <stdio.h>
#include <sys/select.h>

/* pselect loop test */
int main(int argc, char *argv[])
{
	struct timespec timeout;
	fd_set readfds;
	int fdcount;
	char buf[1024];

	while(1){
		FD_ZERO(&readfds);
		FD_SET(0, &readfds);
		timeout.tv_sec = 1;
		timeout.tv_nsec = 0;

		fdcount = pselect(1, &readfds, NULL, NULL, &timeout, NULL);
		printf("loop %d\n", fdcount);
	}
	return 0;
}

<|next_version|>
#include <stdio.h>
#include <sys/select.h>

/* pselect loop test */
int main(int argc, char *argv[])
{
	struct timespec timeout;
	fd_set readfds;
	int fdcount;
	char buf[1024];

	while(1){
		FD_ZERO(&readfds);
		FD_SET(0, &readfds);
		timeout.tv_sec = 1;
		timeout.tv_nsec = 0;

		fdcount = pselect(1, &readfds, NULL, NULL, &timeout, NULL);
		printf("loop %d\n", fdcount);

		if(FD_ISSET(0, &readfds)){
			read(0, buf, 1024);
			printf("buf: %s\n", buf);
		}
	}
	return 0;
}


Add nodoc for beta fields.

Add nodoc for beta fields.

--- Sources/BraintreeVenmo/Public/BraintreeVenmo/BTVenmoAccountNonce.h
+++ Sources/BraintreeVenmo/Public/BraintreeVenmo/BTVenmoAccountNonce.h
@@ -10,26 +10,31 @@
 @interface BTVenmoAccountNonce : BTPaymentMethodNonce

 /**
+ :nodoc:
  The email associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *email;

 /**
+ :nodoc:
  The external ID associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *externalId;

 /**
+ :nodoc:
  The first name associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *firstName;

 /**
+ :nodoc:
  The last name associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *lastName;

 /**
+ :nodoc:
  The phone number associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *phoneNumber;

<|original_code|>
#if __has_include(<Braintree/BraintreeVenmo.h>)
#import <Braintree/BraintreeCore.h>
#else
#import <BraintreeCore/BraintreeCore.h>
#endif

/**
 Contains information about a Venmo Account payment method
 */
@interface BTVenmoAccountNonce : BTPaymentMethodNonce

/**
 The email associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *email;

/**
 The external ID associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *externalId;

/**
 The first name associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *firstName;

/**
 The last name associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *lastName;

/**
 The phone number associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *phoneNumber;

/**
 The username associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *username;

@end

<|edits_diff|>
--- Sources/BraintreeVenmo/Public/BraintreeVenmo/BTVenmoAccountNonce.h
+++ Sources/BraintreeVenmo/Public/BraintreeVenmo/BTVenmoAccountNonce.h
@@ -10,21 +10,25 @@
 @interface BTVenmoAccountNonce : BTPaymentMethodNonce

 /**
+ :nodoc:
  The email associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *email;

 /**
+ :nodoc:
  The external ID associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *externalId;

 /**
+ :nodoc:
  The first name associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *firstName;

 /**
+ :nodoc:
  The last name associated with the Venmo account
 */
 @property (nonatomic, nullable, readonly, copy) NSString *lastName;
<|current_version|>
#if __has_include(<Braintree/BraintreeVenmo.h>)
#import <Braintree/BraintreeCore.h>
#else
#import <BraintreeCore/BraintreeCore.h>
#endif

/**
 Contains information about a Venmo Account payment method
 */
@interface BTVenmoAccountNonce : BTPaymentMethodNonce

/**
 :nodoc:
 The email associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *email;

/**
 :nodoc:
 The external ID associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *externalId;

/**
 :nodoc:
 The first name associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *firstName;

/**
 :nodoc:
 The last name associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *lastName;

/**
 The phone number associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *phoneNumber;

/**
 The username associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *username;

@end

<|next_version|>
#if __has_include(<Braintree/BraintreeVenmo.h>)
#import <Braintree/BraintreeCore.h>
#else
#import <BraintreeCore/BraintreeCore.h>
#endif

/**
 Contains information about a Venmo Account payment method
 */
@interface BTVenmoAccountNonce : BTPaymentMethodNonce

/**
 :nodoc:
 The email associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *email;

/**
 :nodoc:
 The external ID associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *externalId;

/**
 :nodoc:
 The first name associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *firstName;

/**
 :nodoc:
 The last name associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *lastName;

/**
 :nodoc:
 The phone number associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *phoneNumber;

/**
 The username associated with the Venmo account
*/
@property (nonatomic, nullable, readonly, copy) NSString *username;

@end


Add headers to request data

Add headers to request data

--- src/http/requestdata.h
+++ src/http/requestdata.h
@@ -2,6 +2,7 @@
 #define APIMOCK_REQUESTDATA_H

 #include <string>
+#include <unordered_map>

 namespace ApiMock {
 	struct RequestData {
@@ -17,6 +18,7 @@
 		} method;

 		std::string requestUri;
+		std::unordered_map<std::string, std::string> headers;
 	};
 }

<|original_code|>
#ifndef APIMOCK_REQUESTDATA_H
#define APIMOCK_REQUESTDATA_H

#include <string>

namespace ApiMock {
	struct RequestData {
		enum HTTP_VERSION {
			HTTP_1_1,
		} httpVersion;

		enum METHOD {
			GET,
			POST,
			PUT,
			DELETE,
		} method;

		std::string requestUri;
	};
}

#endif
<|edits_diff|>
--- src/http/requestdata.h
+++ src/http/requestdata.h
@@ -2,6 +2,7 @@
 #define APIMOCK_REQUESTDATA_H

 #include <string>
+#include <unordered_map>

 namespace ApiMock {
 	struct RequestData {
<|current_version|>
#ifndef APIMOCK_REQUESTDATA_H
#define APIMOCK_REQUESTDATA_H

#include <string>
#include <unordered_map>

namespace ApiMock {
	struct RequestData {
		enum HTTP_VERSION {
			HTTP_1_1,
		} httpVersion;

		enum METHOD {
			GET,
			POST,
			PUT,
			DELETE,
		} method;

		std::string requestUri;
	};
}

#endif
<|next_version|>
#ifndef APIMOCK_REQUESTDATA_H
#define APIMOCK_REQUESTDATA_H

#include <string>
#include <unordered_map>

namespace ApiMock {
	struct RequestData {
		enum HTTP_VERSION {
			HTTP_1_1,
		} httpVersion;

		enum METHOD {
			GET,
			POST,
			PUT,
			DELETE,
		} method;

		std::string requestUri;
		std::unordered_map<std::string, std::string> headers;
	};
}

#endif


Add new typedef for values sent to setsockopt().

--- os/atNetwork.h
+++ os/atNetwork.h
@@ -16,6 +16,7 @@
     typedef SOCKET   Socket;
     typedef int      socklen_t;
     typedef char     SocketOptionFlag;
+    typedef int      SocketOptionValue;
 #else
     #include <unistd.h>
     #include <string.h>
@@ -31,6 +32,7 @@

     typedef int   Socket;
     typedef int   SocketOptionFlag;
+    typedef int   SocketOptionValue;
 #endif

<|original_code|>

#ifndef AT_NETWORK_H
#define AT_NETWORK_H

// Under Windows, define stuff that we need
#ifdef _MSC_VER
    #include <winsock.h>

    #define MAXHOSTNAMELEN   64

    #define EWOULDBLOCK   WSAEWOULDBLOCK
    #define EINPROGRESS   WSAEINPROGRESS
    #define MSG_WAITALL   0

    typedef SOCKET   Socket;
    typedef int      socklen_t;
    typedef char     SocketOptionFlag;
#else
    #include <unistd.h>
    #include <string.h>
    #include <netdb.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <sys/param.h>
    #include <sys/select.h>
    #include <netinet/in.h>
    #include <netinet/tcp.h>

    typedef int   Socket;
    typedef int   SocketOptionFlag;
#endif

void     initNetwork();
void     cleanupNetwork();

Socket   openSocket(int domain, int type, int protocol);
void     closeSocket(Socket socket);

void     setBlockingFlag(Socket socket, bool block);
bool     getBlockingFlag(Socket socket);

#endif

<|edits_diff|>
--- os/atNetwork.h
+++ os/atNetwork.h
@@ -16,6 +16,7 @@
     typedef SOCKET   Socket;
     typedef int      socklen_t;
     typedef char     SocketOptionFlag;
+    typedef int      SocketOptionValue;
 #else
     #include <unistd.h>
     #include <string.h>
<|current_version|>

#ifndef AT_NETWORK_H
#define AT_NETWORK_H

// Under Windows, define stuff that we need
#ifdef _MSC_VER
    #include <winsock.h>

    #define MAXHOSTNAMELEN   64

    #define EWOULDBLOCK   WSAEWOULDBLOCK
    #define EINPROGRESS   WSAEINPROGRESS
    #define MSG_WAITALL   0

    typedef SOCKET   Socket;
    typedef int      socklen_t;
    typedef char     SocketOptionFlag;
    typedef int      SocketOptionValue;
#else
    #include <unistd.h>
    #include <string.h>
    #include <netdb.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <sys/param.h>
    #include <sys/select.h>
    #include <netinet/in.h>
    #include <netinet/tcp.h>

    typedef int   Socket;
    typedef int   SocketOptionFlag;
#endif

void     initNetwork();
void     cleanupNetwork();

Socket   openSocket(int domain, int type, int protocol);
void     closeSocket(Socket socket);

void     setBlockingFlag(Socket socket, bool block);
bool     getBlockingFlag(Socket socket);

#endif

<|next_version|>

#ifndef AT_NETWORK_H
#define AT_NETWORK_H

// Under Windows, define stuff that we need
#ifdef _MSC_VER
    #include <winsock.h>

    #define MAXHOSTNAMELEN   64

    #define EWOULDBLOCK   WSAEWOULDBLOCK
    #define EINPROGRESS   WSAEINPROGRESS
    #define MSG_WAITALL   0

    typedef SOCKET   Socket;
    typedef int      socklen_t;
    typedef char     SocketOptionFlag;
    typedef int      SocketOptionValue;
#else
    #include <unistd.h>
    #include <string.h>
    #include <netdb.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <sys/param.h>
    #include <sys/select.h>
    #include <netinet/in.h>
    #include <netinet/tcp.h>

    typedef int   Socket;
    typedef int   SocketOptionFlag;
    typedef int   SocketOptionValue;
#endif

void     initNetwork();
void     cleanupNetwork();

Socket   openSocket(int domain, int type, int protocol);
void     closeSocket(Socket socket);

void     setBlockingFlag(Socket socket, bool block);
bool     getBlockingFlag(Socket socket);

#endif


Allow the trace output by mbed error to be conditional of NDEBUG.

This change avoid inclusion of printf and friends code in a binary when it
is compiled with the macro NDEBUG enabled (this macro is usually enabled
for production builds).

Unlike assert, the error function will still crash/halt the execution of the
application even if NDEBUG is enabled; the traces are just not outputed.

--- hal/common/mbed_error.c
+++ hal/common/mbed_error.c
@@ -24,9 +24,11 @@
 #endif

 WEAK void error(const char* format, ...) {
+#ifndef NDEBUG
     va_list arg;
     va_start(arg, format);
     mbed_error_vfprintf(format, arg);
     va_end(arg);
+#endif
     exit(1);
 }

<|original_code|>
/* mbed Microcontroller Library
 * Copyright (c) 2006-2013 ARM Limited
 *
 * 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 <stdlib.h>
#include <stdarg.h>
#include "device.h"
#include "toolchain.h"
#include "mbed_error.h"
#include "mbed_interface.h"
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif

WEAK void error(const char* format, ...) {
    va_list arg;
    va_start(arg, format);
    mbed_error_vfprintf(format, arg);
    va_end(arg);
    exit(1);
}

<|edits_diff|>
--- hal/common/mbed_error.c
+++ hal/common/mbed_error.c
@@ -24,6 +24,7 @@
 #endif

 WEAK void error(const char* format, ...) {
+#ifndef NDEBUG
     va_list arg;
     va_start(arg, format);
     mbed_error_vfprintf(format, arg);
<|current_version|>
/* mbed Microcontroller Library
 * Copyright (c) 2006-2013 ARM Limited
 *
 * 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 <stdlib.h>
#include <stdarg.h>
#include "device.h"
#include "toolchain.h"
#include "mbed_error.h"
#include "mbed_interface.h"
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif

WEAK void error(const char* format, ...) {
#ifndef NDEBUG
    va_list arg;
    va_start(arg, format);
    mbed_error_vfprintf(format, arg);
    va_end(arg);
    exit(1);
}

<|next_version|>
/* mbed Microcontroller Library
 * Copyright (c) 2006-2013 ARM Limited
 *
 * 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 <stdlib.h>
#include <stdarg.h>
#include "device.h"
#include "toolchain.h"
#include "mbed_error.h"
#include "mbed_interface.h"
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif

WEAK void error(const char* format, ...) {
#ifndef NDEBUG
    va_list arg;
    va_start(arg, format);
    mbed_error_vfprintf(format, arg);
    va_end(arg);
#endif
    exit(1);
}


Add serialization to Node class.

Add serialization to Node class.

--- src/node.h
+++ src/node.h
@@ -3,6 +3,9 @@
 #define SRC_NODE_H_

 #include "./render_data.h"
+#include <boost/serialization/serialization.hpp>
+#include <boost/serialization/access.hpp>
+#include <boost/serialization/nvp.hpp>

 /**
  * \brief
@@ -22,6 +25,10 @@
   Node()
   {
   }
+ private:
+  friend class boost::serialization::access;
+  template <class Archive>
+  void serialize(Archive &ar, unsigned int version) const {};
 };

 #endif  // SRC_NODE_H_

<|original_code|>
#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include "./render_data.h"

/**
 * \brief
 *
 *
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(const RenderData &renderData) = 0;

 protected:
  Node()
  {
  }
};

#endif  // SRC_NODE_H_

<|edits_diff|>
--- src/node.h
+++ src/node.h
@@ -3,6 +3,9 @@
 #define SRC_NODE_H_

 #include "./render_data.h"
+#include <boost/serialization/serialization.hpp>
+#include <boost/serialization/access.hpp>
+#include <boost/serialization/nvp.hpp>

 /**
  * \brief
<|current_version|>
#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include "./render_data.h"
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>

/**
 * \brief
 *
 *
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(const RenderData &renderData) = 0;

 protected:
  Node()
  {
  }
};

#endif  // SRC_NODE_H_

<|next_version|>
#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include "./render_data.h"
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>

/**
 * \brief
 *
 *
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(const RenderData &renderData) = 0;

 protected:
  Node()
  {
  }
 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const {};
};

#endif  // SRC_NODE_H_


Add comment to public QUID functions

Add comment to public QUID functions

--- include/quid.h
+++ include/quid.h
@@ -23,7 +23,15 @@
  * Create new QUID
  */
 void quid_create(struct quid *);
+
+/*
+ * Compare to QUID keys
+ */
 int quidcmp(const struct quid *a, const struct quid *b);
+
+/*
+ * Convert QUID key to string
+ */
 void quidtostr(char *s, struct quid *u);

 #endif // QUID_H_INCLUDED

<|original_code|>
#ifndef QUID_H_INCLUDED
#define QUID_H_INCLUDED

#define UIDS_PER_TICK 1024			/* Generate identifiers per tick interval */
#define EPOCH_DIFF 11644473600LL	/* Conversion needed for EPOCH to UTC */
#define RND_SEED_CYCLE 4096			/* Generate new random seed after interval */

/*
 * Identifier structure
 */
struct quid {
	unsigned long time_low;				/* Time lover half */
	unsigned short time_mid;			/* Time middle half */
	unsigned short time_hi_and_version;		/* Time upper half and structure version */
	unsigned char clock_seq_hi_and_reserved;	/* Clock sequence */
	unsigned char clock_seq_low;			/* Clock sequence lower half */
	unsigned char node[6];				/* Node allocation, filled with random memory data */
} __attribute__((packed));

typedef unsigned long long int cuuid_time_t;

/*
 * Create new QUID
 */
void quid_create(struct quid *);
int quidcmp(const struct quid *a, const struct quid *b);
void quidtostr(char *s, struct quid *u);

#endif // QUID_H_INCLUDED

<|edits_diff|>
--- include/quid.h
+++ include/quid.h
@@ -23,6 +23,10 @@
  * Create new QUID
  */
 void quid_create(struct quid *);
+
+/*
+ * Compare to QUID keys
+ */
 int quidcmp(const struct quid *a, const struct quid *b);
 void quidtostr(char *s, struct quid *u);

<|current_version|>
#ifndef QUID_H_INCLUDED
#define QUID_H_INCLUDED

#define UIDS_PER_TICK 1024			/* Generate identifiers per tick interval */
#define EPOCH_DIFF 11644473600LL	/* Conversion needed for EPOCH to UTC */
#define RND_SEED_CYCLE 4096			/* Generate new random seed after interval */

/*
 * Identifier structure
 */
struct quid {
	unsigned long time_low;				/* Time lover half */
	unsigned short time_mid;			/* Time middle half */
	unsigned short time_hi_and_version;		/* Time upper half and structure version */
	unsigned char clock_seq_hi_and_reserved;	/* Clock sequence */
	unsigned char clock_seq_low;			/* Clock sequence lower half */
	unsigned char node[6];				/* Node allocation, filled with random memory data */
} __attribute__((packed));

typedef unsigned long long int cuuid_time_t;

/*
 * Create new QUID
 */
void quid_create(struct quid *);

/*
 * Compare to QUID keys
 */
int quidcmp(const struct quid *a, const struct quid *b);
void quidtostr(char *s, struct quid *u);

#endif // QUID_H_INCLUDED

<|next_version|>
#ifndef QUID_H_INCLUDED
#define QUID_H_INCLUDED

#define UIDS_PER_TICK 1024			/* Generate identifiers per tick interval */
#define EPOCH_DIFF 11644473600LL	/* Conversion needed for EPOCH to UTC */
#define RND_SEED_CYCLE 4096			/* Generate new random seed after interval */

/*
 * Identifier structure
 */
struct quid {
	unsigned long time_low;				/* Time lover half */
	unsigned short time_mid;			/* Time middle half */
	unsigned short time_hi_and_version;		/* Time upper half and structure version */
	unsigned char clock_seq_hi_and_reserved;	/* Clock sequence */
	unsigned char clock_seq_low;			/* Clock sequence lower half */
	unsigned char node[6];				/* Node allocation, filled with random memory data */
} __attribute__((packed));

typedef unsigned long long int cuuid_time_t;

/*
 * Create new QUID
 */
void quid_create(struct quid *);

/*
 * Compare to QUID keys
 */
int quidcmp(const struct quid *a, const struct quid *b);

/*
 * Convert QUID key to string
 */
void quidtostr(char *s, struct quid *u);

#endif // QUID_H_INCLUDED


Allow to override SSL_LIB during build

Allow to override SSL_LIB during build

SSL_LIB defaults to libssl.so which is only provided by a -devel
package and hence not loadable dynamically during runtime.

--- src/server/shttpd/compat_unix.h
+++ src/server/shttpd/compat_unix.h
@@ -20,7 +20,9 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <dlfcn.h>
+#ifndef SSL_LIB
 #define	SSL_LIB				"libssl.so"
+#endif
 #define	DIRSEP				'/'
 #define	IS_DIRSEP_CHAR(c)		((c) == '/')
 #define	O_BINARY			0

<|original_code|>
/*
 * Copyright (c) 2004-2007 Sergey Lyubka <valenok@gmail.com>
 * All rights reserved
 *
 * "THE BEER-WARE LICENSE" (Revision 42):
 * Sergey Lyubka wrote this file.  As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return.
 */

#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>

#include <pwd.h>
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
#define	SSL_LIB				"libssl.so"
#define	DIRSEP				'/'
#define	IS_DIRSEP_CHAR(c)		((c) == '/')
#define	O_BINARY			0
#define	closesocket(a)			close(a)
#define	ERRNO				errno
#define	NO_GUI

#define	InitializeCriticalSection(x)	/* FIXME UNIX version is not MT safe */
#define	EnterCriticalSection(x)
#define	LeaveCriticalSection(x)

<|edits_diff|>
--- src/server/shttpd/compat_unix.h
+++ src/server/shttpd/compat_unix.h
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <dlfcn.h>
+#ifndef SSL_LIB
 #define	SSL_LIB				"libssl.so"
 #define	DIRSEP				'/'
 #define	IS_DIRSEP_CHAR(c)		((c) == '/')
<|current_version|>
/*
 * Copyright (c) 2004-2007 Sergey Lyubka <valenok@gmail.com>
 * All rights reserved
 *
 * "THE BEER-WARE LICENSE" (Revision 42):
 * Sergey Lyubka wrote this file.  As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return.
 */

#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>

#include <pwd.h>
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
#ifndef SSL_LIB
#define	SSL_LIB				"libssl.so"
#define	DIRSEP				'/'
#define	IS_DIRSEP_CHAR(c)		((c) == '/')
#define	O_BINARY			0
#define	closesocket(a)			close(a)
#define	ERRNO				errno
#define	NO_GUI

#define	InitializeCriticalSection(x)	/* FIXME UNIX version is not MT safe */
#define	EnterCriticalSection(x)
#define	LeaveCriticalSection(x)

<|next_version|>
/*
 * Copyright (c) 2004-2007 Sergey Lyubka <valenok@gmail.com>
 * All rights reserved
 *
 * "THE BEER-WARE LICENSE" (Revision 42):
 * Sergey Lyubka wrote this file.  As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return.
 */

#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>

#include <pwd.h>
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
#ifndef SSL_LIB
#define	SSL_LIB				"libssl.so"
#endif
#define	DIRSEP				'/'
#define	IS_DIRSEP_CHAR(c)		((c) == '/')
#define	O_BINARY			0
#define	closesocket(a)			close(a)
#define	ERRNO				errno
#define	NO_GUI

#define	InitializeCriticalSection(x)	/* FIXME UNIX version is not MT safe */
#define	EnterCriticalSection(x)
#define	LeaveCriticalSection(x)


--- src/lib-dict/dict-register.c
+++ src/lib-dict/dict-register.c
@@ -3,8 +3,12 @@
 #include "lib.h"
 #include "dict-private.h"

+static int refcount = 0;
+
 void dict_drivers_register_builtin(void)
 {
+	if (refcount++ > 0)
+		return;
 	dict_driver_register(&dict_driver_client);
 	dict_driver_register(&dict_driver_file);
 	dict_driver_register(&dict_driver_fs);
@@ -15,6 +19,8 @@

 void dict_drivers_unregister_builtin(void)
 {
+	if (--refcount > 0)
+		return;
 	dict_driver_unregister(&dict_driver_client);
 	dict_driver_unregister(&dict_driver_file);
 	dict_driver_unregister(&dict_driver_fs);

<|original_code|>
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

void dict_drivers_register_builtin(void)
{
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}

<|edits_diff|>
--- src/lib-dict/dict-register.c
+++ src/lib-dict/dict-register.c
@@ -3,8 +3,12 @@
 #include "lib.h"
 #include "dict-private.h"

+static int refcount = 0;
+
 void dict_drivers_register_builtin(void)
 {
+	if (refcount++ > 0)
+		return;
 	dict_driver_register(&dict_driver_client);
 	dict_driver_register(&dict_driver_file);
 	dict_driver_register(&dict_driver_fs);
<|current_version|>
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

static int refcount = 0;

void dict_drivers_register_builtin(void)
{
	if (refcount++ > 0)
		return;
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}

<|next_version|>
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

static int refcount = 0;

void dict_drivers_register_builtin(void)
{
	if (refcount++ > 0)
		return;
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	if (--refcount > 0)
		return;
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}


Add externs for the functions used

Add externs for the functions used

--- tools/hardware.h
+++ tools/hardware.h
@@ -32,9 +32,11 @@
 // Track seeking
 extern int hw_attrackzero();
 extern void hw_seektotrackzero();
+extern void hw_seektotrack(int track);
 extern void hw_sideselect(const int side);

 // Signaling and data sampling
+extern void hw_waitforindex();
 extern int hw_writeprotected();
 extern void hw_samplerawtrackdata(char* buf, uint32_t len);

<|original_code|>
#ifndef _HARDWARE_H_
#define _HARDWARE_H_

#include <stdint.h>

// For disk/drive status
#define HW_NODRIVE 0
#define HW_NODISK 1
#define HW_HAVEDISK 2

// Drive geometry
#define HW_MAXHEADS 2
#define HW_MAXTRACKS 80

#define HW_NORMALSTEPPING 1
#define HW_DOUBLESTEPPING 2

extern int hw_currenttrack;
extern int hw_currenthead;

extern int hw_stepping;

// Initialisation
extern int hw_init();

// Drive control
extern unsigned char hw_detectdisk();
extern void hw_driveselect();
extern void hw_startmotor();
extern void hw_stopmotor();

// Track seeking
extern int hw_attrackzero();
extern void hw_seektotrackzero();
extern void hw_sideselect(const int side);

// Signaling and data sampling
extern int hw_writeprotected();
extern void hw_samplerawtrackdata(char* buf, uint32_t len);

// Clean up
extern void hw_done();

#endif

<|edits_diff|>
--- tools/hardware.h
+++ tools/hardware.h
@@ -32,6 +32,7 @@
 // Track seeking
 extern int hw_attrackzero();
 extern void hw_seektotrackzero();
+extern void hw_seektotrack(int track);
 extern void hw_sideselect(const int side);

 // Signaling and data sampling
<|current_version|>
#ifndef _HARDWARE_H_
#define _HARDWARE_H_

#include <stdint.h>

// For disk/drive status
#define HW_NODRIVE 0
#define HW_NODISK 1
#define HW_HAVEDISK 2

// Drive geometry
#define HW_MAXHEADS 2
#define HW_MAXTRACKS 80

#define HW_NORMALSTEPPING 1
#define HW_DOUBLESTEPPING 2

extern int hw_currenttrack;
extern int hw_currenthead;

extern int hw_stepping;

// Initialisation
extern int hw_init();

// Drive control
extern unsigned char hw_detectdisk();
extern void hw_driveselect();
extern void hw_startmotor();
extern void hw_stopmotor();

// Track seeking
extern int hw_attrackzero();
extern void hw_seektotrackzero();
extern void hw_seektotrack(int track);
extern void hw_sideselect(const int side);

// Signaling and data sampling
extern int hw_writeprotected();
extern void hw_samplerawtrackdata(char* buf, uint32_t len);

// Clean up
extern void hw_done();

#endif

<|next_version|>
#ifndef _HARDWARE_H_
#define _HARDWARE_H_

#include <stdint.h>

// For disk/drive status
#define HW_NODRIVE 0
#define HW_NODISK 1
#define HW_HAVEDISK 2

// Drive geometry
#define HW_MAXHEADS 2
#define HW_MAXTRACKS 80

#define HW_NORMALSTEPPING 1
#define HW_DOUBLESTEPPING 2

extern int hw_currenttrack;
extern int hw_currenthead;

extern int hw_stepping;

// Initialisation
extern int hw_init();

// Drive control
extern unsigned char hw_detectdisk();
extern void hw_driveselect();
extern void hw_startmotor();
extern void hw_stopmotor();

// Track seeking
extern int hw_attrackzero();
extern void hw_seektotrackzero();
extern void hw_seektotrack(int track);
extern void hw_sideselect(const int side);

// Signaling and data sampling
extern void hw_waitforindex();
extern int hw_writeprotected();
extern void hw_samplerawtrackdata(char* buf, uint32_t len);

// Clean up
extern void hw_done();

#endif


Disable clang diagnostics pragma on windows

Use clang diagnostics pragma only if it project is compiled with clang.

Bug: http://b/150575491
Test: ninja

--- OrbitLinuxTracing/Logging.h
+++ OrbitLinuxTracing/Logging.h
@@ -5,13 +5,17 @@

 #include <cstdio>

+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
+#endif

 #define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

 #define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

+#ifdef __clang__
 #pragma clang diagnostic pop
+#endif

 #endif  // ORBIT_LINUX_TRACING_LOGGING_H_

<|original_code|>
#ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_

// TODO: Move logging to OrbitBase once we have clearer plans for such module.

#include <cstdio>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"

#define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

#define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

#pragma clang diagnostic pop

#endif  // ORBIT_LINUX_TRACING_LOGGING_H_

<|edits_diff|>
--- OrbitLinuxTracing/Logging.h
+++ OrbitLinuxTracing/Logging.h
@@ -5,13 +5,16 @@

 #include <cstdio>

+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
+#endif

 #define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

 #define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

+#ifdef __clang__
 #pragma clang diagnostic pop

 #endif  // ORBIT_LINUX_TRACING_LOGGING_H_
<|current_version|>
#ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_

// TODO: Move logging to OrbitBase once we have clearer plans for such module.

#include <cstdio>

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif

#define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

#define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

#ifdef __clang__
#pragma clang diagnostic pop

#endif  // ORBIT_LINUX_TRACING_LOGGING_H_

<|next_version|>
#ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_

// TODO: Move logging to OrbitBase once we have clearer plans for such module.

#include <cstdio>

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif

#define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

#define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#endif  // ORBIT_LINUX_TRACING_LOGGING_H_