Arduino config works for IDE users again

Fixed a breaking change in the auto detect of rov board that prevented
users from compiling the Arduino software stand alone in an IDE

--- arduino/OpenROV/AConfig.h
+++ arduino/OpenROV/AConfig.h
@@ -10,13 +10,21 @@
 *  and change the pin definitions there.  Things not wired to specific pins but on the I2C bus will
 *  have the address defined in this file.
 */
+
+#include "BoardConfig.h"
+
 //Kit:
+// The boards are auto configure in the on beaglebone build process in the BoardConfig.h which gets
+// created. If running directly in an IDE, the BoardConfig.h wont exist and the #defines below will be
+// used instead.
+
+#if !defined(HAS_STD_CAPE) && !defined(HAS_OROV_CONTROLLERBOARD_25)
 #define HAS_STD_CAPE (0)
-#define HAS_STD_PILOT (1)
-#define HAS_OROV_CONTROLLERBOARD_25 (1)
+#define HAS_OROV_CONTROLLERBOARD_25 (0)
+#endif

 #define HAS_STD_LIGHTS (1)
-#define HAS_STD_CALIBRATIONLASERS (0)
+#define HAS_STD_CALIBRATIONLASERS (1)
 #define HAS_STD_2X1_THRUSTERS (1)
 #define HAS_STD_CAMERAMOUNT (1)

@@ -31,5 +39,4 @@
 #  error "You must select either standard cape or controllerboard25 in the AConfig.h file as they have predefined pin values required by other libraries."
 #endif

-
 #endif


Really update atomic on MIPS.

Really update atomic on MIPS.

--- config/mips/atomic.h
+++ config/mips/atomic.h
@@ -1,10 +1,24 @@
-/* Copyright (C) 2005 Thiemo Seufer
-   Atomic functions for MIPS
-
-   This file is free software; you can redistribute it and/or
+/* Low-level functions for atomic operations. Mips version.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version. */
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _MIPS_BITS_ATOMIC_H
+#define _MIPS_BITS_ATOMIC_H 1

 #include "config-int.h"
 #include <sgidefs.h>
@@ -24,491 +38,266 @@
 typedef intmax_t atomic_max_t;
 typedef uintmax_t uatomic_max_t;

-/*
- * MIPS does not have byte and halfword forms of load linked and store
- * conditional. So for MIPS we stub out the 8- and 16-bit forms.
- */
-#define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, mb1, mb2)	\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, mb1, mb2)	\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, mb1, mb2)	\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, mb1, mb2)	\
-  ({ __builtin_trap (); 0; })
-
-#ifdef UP
-# define __MB		/* nothing */
+#if _MIPS_SIM == _ABIO32
+#define MIPS_PUSH_MIPS2 ".set	mips2\n\t"
 #else
-# define __MB		"	sync\n"
-# define atomic_full_barrier()	__asm ("sync" : : : "memory");
-# define atomic_read_barrier()	__asm ("sync" : : : "memory");
-# define atomic_write_barrier()	__asm ("sync" : : : "memory");
-#endif
+#define MIPS_PUSH_MIPS2
+#endif
+
+/* See the comments in <sys/asm.h> about the use of the sync instruction.  */
+#ifndef MIPS_SYNC
+# define MIPS_SYNC	sync
+#endif
+
+#define MIPS_SYNC_STR_2(X) #X
+#define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X)
+#define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC)

 /* Compare and exchange.  For all of the "xxx" routines, we expect a
    "__prev" and a "__cmp" variable to be provided by the enclosing scope,
    in which values are returned.  */

-#define __arch_compare_and_exchange_xxx_32_int(mem, new, old, mb1, mb2) \
-({									\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%0,%2\n"					\
-	"	 li	%1,0\n"						\
-	"	bne	%0,%3,2f\n"					\
-	"	move	%1,%4\n"					\
-	"	sc	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"2:\n"								\
-	"	.set reorder\n"						\
-	:  "=&r" (__prev),						\
-	   "=&r" (__cmp)						\
-	: "R" (*(volatile atomic32_t *)(mem)),				\
-	   "r" ((atomic32_t)(old)),					\
-	   "r" ((atomic32_t)(new))					\
-	: "memory");							\
-})
-
-#define __arch_compare_and_exchange_xxx_64_int(mem, new, old, mb1, mb2)	\
-({									\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%0,%2\n"					\
-	"	 li	%1,0\n"						\
-	"	bne	%0,%3,2f\n"					\
-	"	move	%1,%4\n"					\
-	"	scd	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"2:\n"								\
-	"	.set reorder"						\
-	:  "=&r" (__prev),						\
-	   "=&r" (__cmp)						\
-	:  "R" (*(volatile atomic32_t *)(mem)),				\
-	   "r" ((atomic64_t)(old)),					\
-	   "r" ((atomic64_t)(new))					\
-	: "memory");							\
-})
-
-/* For all "bool" routines, we return FALSE if exchange successful.  */
-
-#define __arch_compare_and_exchange_bool_32_int(mem, new, old, mb1, mb2) \
-({ unsigned long __prev; int __cmp;					\
-   __arch_compare_and_exchange_xxx_32_int(mem, new, old, mb1, mb2);	\
+#define __arch_compare_and_exchange_xxx_8_int(mem, newval, oldval, rel, acq) \
+  (abort (), __prev = __cmp = 0)
+
+#define __arch_compare_and_exchange_xxx_16_int(mem, newval, oldval, rel, acq) \
+  (abort (), __prev = __cmp = 0)
+
+#define __arch_compare_and_exchange_xxx_32_int(mem, newval, oldval, rel, acq) \
+     __asm__ __volatile__ (						      \
+     ".set	push\n\t"						      \
+     MIPS_PUSH_MIPS2							      \
+     rel	"\n"							      \
+     "1:\t"								      \
+     "ll	%0,%4\n\t"						      \
+     "move	%1,$0\n\t"						      \
+     "bne	%0,%2,2f\n\t"						      \
+     "move	%1,%3\n\t"						      \
+     "sc	%1,%4\n\t"						      \
+     "beqz	%1,1b\n"						      \
+     acq	"\n\t"							      \
+     ".set	pop\n"							      \
+     "2:\n\t"								      \
+	      : "=&r" (__prev), "=&r" (__cmp)				      \
+	      : "r" (oldval), "r" (newval), "m" (*mem)			      \
+	      : "memory")
+
+#if _MIPS_SIM == _ABIO32
+/* We can't do an atomic 64-bit operation in O32.  */
+#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
+  (abort (), __prev = __cmp = 0)
+#else
+#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
+     __asm__ __volatile__ ("\n"						      \
+     ".set	push\n\t"						      \
+     MIPS_PUSH_MIPS2							      \
+     rel	"\n"							      \
+     "1:\t"								      \
+     "lld	%0,%4\n\t"						      \
+     "move	%1,$0\n\t"						      \
+     "bne	%0,%2,2f\n\t"						      \
+     "move	%1,%3\n\t"						      \
+     "scd	%1,%4\n\t"						      \
+     "beqz	%1,1b\n"						      \
+     acq	"\n\t"							      \
+     ".set	pop\n"							      \
+     "2:\n\t"								      \
+	      : "=&r" (__prev), "=&r" (__cmp)				      \
+	      : "r" (oldval), "r" (newval), "m" (*mem)			      \
+	      : "memory")
+#endif
+
+/* For all "bool" routines, we return FALSE if exchange succesful.  */
+
+#define __arch_compare_and_exchange_bool_8_int(mem, new, old, rel, acq)	\
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq);	\
    !__cmp; })

-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_compare_and_exchange_bool_64_int(mem, new, old, mb1, mb2) \
-  ({ __builtin_trap (); 0; })
-#else
-# define __arch_compare_and_exchange_bool_64_int(mem, new, old, mb1, mb2) \
-({ unsigned long __prev; int __cmp;					\
-   __arch_compare_and_exchange_xxx_64_int(mem, new, old, mb1, mb2);	\
+#define __arch_compare_and_exchange_bool_16_int(mem, new, old, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq);	\
    !__cmp; })
-#endif
+
+#define __arch_compare_and_exchange_bool_32_int(mem, new, old, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq);	\
+   !__cmp; })
+
+#define __arch_compare_and_exchange_bool_64_int(mem, new, old, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq);	\
+   !__cmp; })

 /* For all "val" routines, return the old value whether exchange
    successful or not.  */

-#define __arch_compare_and_exchange_val_32_int(mem, new, old, mb1, mb2) \
-({ unsigned long __prev; int __cmp;					\
-   __arch_compare_and_exchange_xxx_32_int(mem, new, old, mb1, mb2);	\
+#define __arch_compare_and_exchange_val_8_int(mem, new, old, rel, acq)	\
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq);	\
    (typeof (*mem))__prev; })

-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_compare_and_exchange_val_64_int(mem, new, old, mb1, mb2) \
-  ({ __builtin_trap (); 0; })
+#define __arch_compare_and_exchange_val_16_int(mem, new, old, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq);	\
+   (typeof (*mem))__prev; })
+
+#define __arch_compare_and_exchange_val_32_int(mem, new, old, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq);	\
+   (typeof (*mem))__prev; })
+
+#define __arch_compare_and_exchange_val_64_int(mem, new, old, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					\
+   __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq);	\
+   (typeof (*mem))__prev; })
+
+/* Compare and exchange with "acquire" semantics, ie barrier after.  */
+
+#define atomic_compare_and_exchange_bool_acq(mem, new, old)	\
+  __atomic_bool_bysize (__arch_compare_and_exchange_bool, int,	\
+		        mem, new, old, "", MIPS_SYNC_STR)
+
+#define atomic_compare_and_exchange_val_acq(mem, new, old)	\
+  __atomic_val_bysize (__arch_compare_and_exchange_val, int,	\
+		       mem, new, old, "", MIPS_SYNC_STR)
+
+/* Compare and exchange with "release" semantics, ie barrier before.  */
+
+#define atomic_compare_and_exchange_bool_rel(mem, new, old)	\
+  __atomic_bool_bysize (__arch_compare_and_exchange_bool, int,	\
+		        mem, new, old, MIPS_SYNC_STR, "")
+
+#define atomic_compare_and_exchange_val_rel(mem, new, old)	\
+  __atomic_val_bysize (__arch_compare_and_exchange_val, int,	\
+		       mem, new, old, MIPS_SYNC_STR, "")
+
+
+
+/* Atomic exchange (without compare).  */
+
+#define __arch_exchange_xxx_8_int(mem, newval, rel, acq) \
+  (abort (), 0)
+
+#define __arch_exchange_xxx_16_int(mem, newval, rel, acq) \
+  (abort (), 0)
+
+#define __arch_exchange_xxx_32_int(mem, newval, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					      \
+     __asm__ __volatile__ ("\n"						      \
+     ".set	push\n\t"						      \
+     MIPS_PUSH_MIPS2							      \
+     rel	"\n"							      \
+     "1:\t"								      \
+     "ll	%0,%3\n\t"						      \
+     "move	%1,%2\n\t"						      \
+     "sc	%1,%3\n\t"						      \
+     "beqz	%1,1b\n"						      \
+     acq	"\n\t"							      \
+     ".set	pop\n"							      \
+     "2:\n\t"								      \
+	      : "=&r" (__prev), "=&r" (__cmp)				      \
+	      : "r" (newval), "m" (*mem)				      \
+	      : "memory");						      \
+  __prev; })
+
+#if _MIPS_SIM == _ABIO32
+/* We can't do an atomic 64-bit operation in O32.  */
+#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \
+  (abort (), 0)
 #else
-# define __arch_compare_and_exchange_val_64_int(mem, new, old, mb1, mb2) \
-({ unsigned long __prev; int __cmp;					\
-   __arch_compare_and_exchange_xxx_64_int(mem, new, old, mb1, mb2);	\
-   (typeof (*mem))__prev; })
-#endif
-
-/* Compare and exchange with "acquire" semantics, ie barrier after.  */
-
-#define atomic_compare_and_exchange_bool_acq(mem, new, old)		\
-  __atomic_bool_bysize (__arch_compare_and_exchange_bool, int,		\
-		        mem, new, old, "", __MB)
-
-#define atomic_compare_and_exchange_val_acq(mem, new, old)		\
-  __atomic_val_bysize (__arch_compare_and_exchange_val, int,		\
-		       mem, new, old, "", __MB)
-
-/* Compare and exchange with "release" semantics, ie barrier before.  */
-
-#define atomic_compare_and_exchange_bool_rel(mem, new, old)		\
-  __atomic_bool_bysize (__arch_compare_and_exchange_bool, int,		\
-		        mem, new, old, __MB, "")
-
-#define atomic_compare_and_exchange_val_rel(mem, new, old)		\
-  __atomic_val_bysize (__arch_compare_and_exchange_val, int,		\
-		       mem, new, old, __MB, "")
-
-
-/* Atomically store value and return the previous value.  */
-
-#define __arch_exchange_8_int(mem, value, mb1, mb2)			\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_exchange_16_int(mem, value, mb1, mb2)			\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_exchange_32_int(mem, value, mb1, mb2)			\
-({									\
-  unsigned int __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%0,%2\n"					\
-	"	move	%1,%3\n"					\
-	"	sc	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem),							\
-	  "r" ((unsigned int)(value))					\
-	: "memory");							\
-  __ret; })
-
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_exchange_64_int(mem, value, mb1, mb2)			\
-  ({ __builtin_trap (); 0; })
+#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					      \
+     __asm__ __volatile__ ("\n"						      \
+     ".set	push\n\t"						      \
+     MIPS_PUSH_MIPS2							      \
+     rel	"\n"							      \
+     "1:\n"								      \
+     "lld	%0,%3\n\t"						      \
+     "move	%1,%2\n\t"						      \
+     "scd	%1,%3\n\t"						      \
+     "beqz	%1,1b\n"						      \
+     acq	"\n\t"							      \
+     ".set	pop\n"							      \
+     "2:\n\t"								      \
+	      : "=&r" (__prev), "=&r" (__cmp)				      \
+	      : "r" (newval), "m" (*mem)				      \
+	      : "memory");						      \
+  __prev; })
+#endif
+
+#define atomic_exchange_acq(mem, value) \
+  __atomic_val_bysize (__arch_exchange_xxx, int, mem, value, "", MIPS_SYNC_STR)
+
+#define atomic_exchange_rel(mem, value) \
+  __atomic_val_bysize (__arch_exchange_xxx, int, mem, value, MIPS_SYNC_STR, "")
+
+
+/* Atomically add value and return the previous (unincremented) value.  */
+
+#define __arch_exchange_and_add_8_int(mem, newval, rel, acq) \
+  (abort (), (typeof(*mem)) 0)
+
+#define __arch_exchange_and_add_16_int(mem, newval, rel, acq) \
+  (abort (), (typeof(*mem)) 0)
+
+#define __arch_exchange_and_add_32_int(mem, value, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					      \
+     __asm__ __volatile__ ("\n"						      \
+     ".set	push\n\t"						      \
+     MIPS_PUSH_MIPS2							      \
+     rel	"\n"							      \
+     "1:\t"								      \
+     "ll	%0,%3\n\t"						      \
+     "addu	%1,%0,%2\n\t"						      \
+     "sc	%1,%3\n\t"						      \
+     "beqz	%1,1b\n"						      \
+     acq	"\n\t"							      \
+     ".set	pop\n"							      \
+     "2:\n\t"								      \
+	      : "=&r" (__prev), "=&r" (__cmp)				      \
+	      : "r" (value), "m" (*mem)					      \
+	      : "memory");						      \
+  __prev; })
+
+#if _MIPS_SIM == _ABIO32
+/* We can't do an atomic 64-bit operation in O32.  */
+#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \
+  (abort (), (typeof(*mem)) 0)
 #else
-# define __arch_exchange_64_int(mem, value, mb1, mb2)			\
-({									\
-  unsigned long __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%0,%2\n"					\
-	"	move	%1,%3\n"					\
-	"	scd	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem),							\
-	  "r" (value)							\
-	: "memory");							\
-  __ret; })
-#endif
-
-#define atomic_exchange_acq(mem, value)					\
-  __atomic_val_bysize (__arch_exchange, int, mem, value, "", __MB)
-
-#define atomic_exchange_rel(mem, value)					\
-  __atomic_val_bysize (__arch_exchange, int, mem, value, __MB, "")
-
-
-/* Atomically add value and return the previous (unincremented) value.  */
-
-#define __arch_exchange_and_add_8_int(mem, value, mb1, mb2)		\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_exchange_and_add_16_int(mem, value, mb1, mb2)		\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_exchange_and_add_32_int(mem, value, mb1, mb2)		\
-({									\
-  unsigned int __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%0,%2\n"					\
-	"	addu	%1,%4,%0\n"					\
-	"	sc	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem),							\
-	  "r" ((unsigned int)(value))					\
-	: "memory");							\
-  __ret; })
-
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_exchange_and_add_64_int(mem, value, mb1, mb2)		\
-  ({ __builtin_trap (); 0; })
-#else
-# define __arch_exchange_and_add_64_int(mem, value, mb1, mb2)		\
-({									\
-  unsigned long __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%0,%2\n"					\
-	"	daddu	%1,%3,%0\n"					\
-	"	scd	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem),							\
-	  "r" ((unsigned long)(value))					\
-	: "memory");							\
-  __ret; })
+#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \
+({ typeof (*mem) __prev; int __cmp;					      \
+     __asm__ __volatile__ (						      \
+     ".set	push\n\t"						      \
+     MIPS_PUSH_MIPS2							      \
+     rel	"\n"							      \
+     "1:\t"								      \
+     "lld	%0,%3\n\t"						      \
+     "daddu	%1,%0,%2\n\t"						      \
+     "scd	%1,%3\n\t"						      \
+     "beqz	%1,1b\n"						      \
+     acq	"\n\t"							      \
+     ".set	pop\n"							      \
+     "2:\n\t"								      \
+	      : "=&r" (__prev), "=&r" (__cmp)				      \
+	      : "r" (value), "m" (*mem)					      \
+	      : "memory");						      \
+  __prev; })
 #endif

 /* ??? Barrier semantics for atomic_exchange_and_add appear to be
    undefined.  Use full barrier for now, as that's safe.  */
-#define atomic_exchange_and_add(mem, value)				\
-  __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, __MB, __MB)
-
-
-/* Atomically increment value (and return the incremented value).  */
-
-#define __arch_increment_8_int(mem, mb1, mb2)				\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_increment_16_int(mem, mb1, mb2)				\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_increment_32_int(mem, mb1, mb2)				\
-({									\
-  unsigned int __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%0,%2\n"					\
-	"	addiu	%0,%1,1\n"					\
-	"	sc	%0,%2\n"					\
-	"	beqz	%0,1b\n"					\
-	"	 addiu	%0,%0,1\n"					\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem)							\
-	: "memory");							\
-  __ret; })
-
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_increment_64_int(mem, mb1, mb2)				\
-  ({ __builtin_trap (); 0; })
-#else
-# define __arch_increment_64_int(mem, mb1, mb2)				\
-({									\
-  unsigned long __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%0,%2\n"					\
-	"	daddiu	%1,%0,1\n"					\
-	"	scd	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 daddiu	%0,%0,1\n"					\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem)							\
-	: "memory");							\
-  __ret; })
-#endif
-
-/* ??? Barrier semantics for atomic_increment_val appear to be
-   undefined.  Use full barrier for now, as that's safe.  */
-#define atomic_increment_val(mem)					\
-  __atomic_val_bysize (__arch_increment, int, mem, __MB, __MB)
-
-#define atomic_increment(mem)						\
-  ({ __atomic_val_bysize (__arch_increment, int, mem, __MB, __MB); (void) 0; })
-
-
-/* Atomically decrement value (and return the decremented value).  */
-
-#define __arch_decrement_8_int(mem, mb1, mb2)				\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_decrement_16_int(mem, mb1, mb2)				\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_decrement_32_int(mem, mb1, mb2)				\
-({									\
-  unsigned int __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%0,%2\n"					\
-	"	addiu	%1,%0,-1\n"					\
-	"	sc	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 addiu	%0,%0,-1\n"					\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem)							\
-	: "memory");							\
-  __ret; })
-
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_decrement_64_int(mem, mb1, mb2)				\
-  ({ __builtin_trap (); 0; })
-#else
-# define __arch_decrement_64_int(mem, mb1, mb2)				\
-({									\
-  unsigned long __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%0,%2\n"					\
-	"	daddiu	%1,%0,-1\n"					\
-	"	scd	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 daddiu	%0,%0,-1\n"					\
-		mb2							\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem)							\
-	: "memory");							\
-  __ret; })
-#endif
-
-/* ??? Barrier semantics for atomic_decrement_val appear to be
-   undefined.  Use full barrier for now, as that's safe.  */
-#define atomic_decrement_val(mem)					\
-  __atomic_val_bysize (__arch_decrement, int, mem, __MB, __MB)
-
-#define atomic_decrement(mem)						\
-  ({ __atomic_val_bysize (__arch_decrement, int, mem, "", ""); (void) 0; })
-
-
-/* Atomically decrement value and return the previous (undecremented) value.  */
-
-#define __arch_decrement_if_positive_8_int(mem, mb1, mb2)		\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_decrement_if_positive_16_int(mem, mb1, mb2)		\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_decrement_if_positive_32_int(mem, mb1, mb2)		\
-({									\
-  signed int __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%0,%2\n"					\
-	"	addiu	%1,%0,-1\n"					\
-	"	bltz	%1,2f\n"					\
-	"	 nop\n"							\
-	"	sc	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"2:\n"								\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem)							\
-	: "memory");							\
-  __ret; })
-
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_decrement_if_positive_64_int(mem, mb1, mb2)		\
-  ({ __builtin_trap (); 0; })
-#else
-# define __arch_decrement_if_positive_64_int(mem, mb1, mb2)		\
-({									\
-  signed long __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%0,%2\n"					\
-	"	daddiu	%1,%0,-1\n"					\
-	"	bltz	%1,2f\n"					\
-	"	 nop\n"							\
-	"	scd	%1,%2\n"					\
-	"	beqz	%1,1b\n"					\
-	"	 nop\n"							\
-		mb2							\
-	"2:\n"								\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem)							\
-	: "memory");							\
-  __ret; })
-#endif
-
-#define atomic_decrement_if_positive(mem)				\
-  __atomic_val_bysize (__arch_decrement_if_positive, int, mem, "", __MB)
-
-
-/* Atomically set a bit and return its old value.  */
-
-#define __arch_bit_test_set_8_int(mem, bit, mb1, mb2)			\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_bit_test_set_16_int(mem, bit, mb1, mb2)			\
-  ({ __builtin_trap (); 0; })
-
-#define __arch_bit_test_set_32_int(mem, bit, mb1, mb2)			\
-({									\
-  unsigned int __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	ll	%1,%2\n"					\
-	"	or	%0,%1,%3\n"					\
-	"	sc	%0,%2\n"					\
-	"	beqz	%0,1b\n"					\
-	"	 and	%0,%2,%3\n"					\
-		mb2							\
-	"2:\n"								\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem),							\
-	  "r" (1UL << bit)						\
-	: "memory");							\
-  __ret != 0; })
-
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __arch_bit_test_set_64_int(mem, bit, mb1, mb2)			\
-  ({ __builtin_trap (); 0; })
-#else
-# define __arch_bit_test_set_64_int(mem, bit, mb1, mb2)			\
-({									\
-  unsigned long __ret, __tmp;						\
-  __asm__ __volatile__ (						\
-	"	.set noreorder\n"					\
-		mb1							\
-	"1:	lld	%1,%2\n"					\
-	"	or	%0,%1,%3\n"					\
-	"	scd	%0,%2\n"					\
-	"	beqz	%0,1b\n"					\
-	"	 and	%0,%1,%2\n"					\
-		mb2							\
-	"2:\n"								\
-	"	.set reorder\n"						\
-	: "=&r" (__ret),						\
-	  "=&r" (__tmp)							\
-	: "R" (*mem),							\
-	  "r" (1 << bit)						\
-	: "memory");							\
-  __ret; })
-#endif
-
-#define atomic_bit_test_set(mem)					\
-  __atomic_val_bysize (__arch_bit_test_set, int, mem, "", __MB)
+#define atomic_exchange_and_add(mem, value) \
+  __atomic_val_bysize (__arch_exchange_and_add, int, mem, value,	      \
+		       MIPS_SYNC_STR, MIPS_SYNC_STR)
+
+/* TODO: More atomic operations could be implemented efficiently; only the
+   basic requirements are done.  */
+
+#define atomic_full_barrier() \
+  __asm__ __volatile__ (".set push\n\t"					      \
+			MIPS_PUSH_MIPS2					      \
+			MIPS_SYNC_STR "\n\t"				      \
+			".set pop" : : : "memory")
+
+#endif /* bits/atomic.h */


client: nullify sock by default.

client: nullify sock by default.

--- src/mongoc/mongoc-client.c
+++ src/mongoc/mongoc-client.c
@@ -81,7 +81,7 @@
                            const mongoc_host_list_t *host,
                            bson_error_t             *error)
 {
-   mongoc_socket_t *sock;
+   mongoc_socket_t *sock = NULL;
    struct addrinfo hints;
    struct addrinfo *result, *rp;
    int32_t connecttimeoutms = DEFAULT_CONNECTTIMEOUTMS;


cursor: set slaveok bit when command readPrefs are not PRIMARY.

--- src/mongoc/mongoc-cursor.c
+++ src/mongoc/mongoc-cursor.c
@@ -139,6 +139,18 @@
    cursor = bson_malloc0 (sizeof *cursor);

    /*
+    * DRIVERS-63:
+    *
+    * If this is a command and we have read_prefs other than PRIMARY, we need to
+    * set SlaveOK bit in the protocol.
+    */
+   if (is_command &&
+       read_prefs &&
+       (mongoc_read_prefs_get_mode (read_prefs) != MONGOC_READ_PRIMARY)) {
+      flags |= MONGOC_QUERY_SLAVE_OK;
+   }
+
+   /*
     * CDRIVER-244:
     *
     * If this is a command, we need to verify we can send it to the location


socket: make sure we don't get SIGPIPE.

socket: make sure we don't get SIGPIPE.

--- src/mongoc/mongoc-socket.c
+++ src/mongoc/mongoc-socket.c
@@ -887,7 +887,7 @@
    memset (&msg, 0, sizeof msg);
    msg.msg_iov = iov;
    msg.msg_iovlen = iovcnt;
-   ret = sendmsg (sock->sd, &msg, 0);
+   ret = sendmsg (sock->sd, &msg, MSG_NOSIGNAL);
 #endif

    /*


* 修复乱码问题

* 修复乱码问题

--- content/ui/ToolTip.h
+++ content/ui/ToolTip.h
@@ -1,4 +1,4 @@
-#ifndef content_browser_ToolTip_h
+#ifndef content_browser_ToolTip_h
 #define content_browser_ToolTip_h

 #include "wke/wkeGlobalVar.h"
@@ -36,7 +36,7 @@

         m_hFont = CreateFont(18, 0, 0, 0, FW_THIN, FALSE, FALSE, FALSE,
             GB2312_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
-            DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"΢ź");
+            DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"微软雅黑");
     }

     ~ToolTip()


A64: adjust the size of reserved code cache space

--- scanner_a64.c
+++ scanner_a64.c
@@ -31,7 +31,7 @@
 #include "pie/pie-a64-field-decoder.h"

 #define NOP 0xD503201F /* NOP Instruction (A64) */
-#define MIN_FSPACE 80
+#define MIN_FSPACE 60

 //#define DEBUG
 #ifdef DEBUG
@@ -611,6 +611,10 @@
       case A64_BLR:
       case A64_RET:
         a64_BR_decode_fields(read_address, &Rn);
+
+#ifdef DBM_INLINE_HASH
+        a64_check_free_space(thread_data, &write_p, &data_p, 88, basic_block);
+#endif

         thread_data->code_cache_meta[basic_block].exit_branch_type = uncond_branch_reg;
         thread_data->code_cache_meta[basic_block].exit_branch_addr = write_p;


A64: Fix the hash table size

A64: Fix the hash table size

--- scanner_a64.c
+++ scanner_a64.c
@@ -615,7 +615,7 @@
             a64_copy_to_reg_64bits(&write_p, x0,
                                     (uint64_t)&thread_data->entry_address.entries);

-            a64_logical_immed(&write_p, 1, 0, 1, 62, 16, realRn, x1);
+            a64_logical_immed(&write_p, 1, 0, 1, 62, 18, realRn, x1);
             write_p++;

             a64_ADD_SUB_shift_reg(&write_p, 1, 0, 0, 0, x1, 0x2, x0, x0);


core/cortex-m: mark gcc helper function "used"

gcc injects calls to that function without notifying LTO.

BRANCH=cr50, cr50-mp
BUG=b:65253310
TEST=after the entire stack was applied Cr50 builds successfully with
     CONFIG_LTO enabled, and passes TCG test suite.

Change-Id: Ie116423a2e8a394dae9d6c7c373786615d9fba4c
Signed-off-by: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@google.com>
Signed-off-by: Vadim Bendebury <5515d6d2d0829cbe0dd0dcf2094aaded06d58514@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1411540

--- core/cortex-m/llsr.c
+++ core/cortex-m/llsr.c
@@ -14,7 +14,7 @@
 	uint32_t w[2];
 };

-uint64_t __aeabi_llsr(uint64_t v, uint32_t shift)
+uint64_t __attribute__((used)) __aeabi_llsr(uint64_t v, uint32_t shift)
 {
 	union words val;
 	union words res;


Mustn't include libconio header as this is just one possible implementation of the conio API (and further code exlusion for fullscreen ctk).

--- core/ctk/ctk-conio.c
+++ core/ctk/ctk-conio.c
@@ -29,13 +29,12 @@
  *
  * This file is part of the "ctk" console GUI toolkit for cc65
  *
- * $Id: ctk-conio.c,v 1.9 2007/12/15 22:18:13 oliverschmidt Exp $
+ * $Id: ctk-conio.c,v 1.10 2007/12/16 13:00:51 oliverschmidt Exp $
  *
  */

 #include <string.h>
 #include <ctype.h>
-#include "lib/libconio.h"

 #include "contiki.h"

@@ -101,12 +100,14 @@
       (void)textcolor(WIDGETCOLOR_FOCUS);
       wfocus = 1;
     }
+#if CTK_CONF_WINDOWS
   } else if(focus & CTK_FOCUS_DIALOG) {
     (void)textcolor(WIDGETCOLOR_DIALOG);
     if(focus & CTK_FOCUS_WIDGET) {
       (void)textcolor(WIDGETCOLOR_FOCUS);
       wfocus = 1;
     }
+#endif /* CTK_CONF_WINDOWS */
   } else {
     (void)textcolor(WIDGETCOLOR);
   }


Remove rotation

Remove rotation

--- core/entity/Entity.h
+++ core/entity/Entity.h
@@ -27,14 +27,6 @@
         Entity::y = y;
     }

-    double getRotation() const {
-        return rotation;
-    }
-
-    void setRotation(double rotation) {
-        Entity::rotation = rotation;
-    }
-
     virtual void update() { }

     virtual ~Entity() { }
@@ -42,7 +34,6 @@
 protected:
     Map *map;
     double x = 0, y = 0;
-    double rotation; //angle in radians
 };

 #endif //C003_ENTITY_H


Updated ruc callback types to fix compiler warnings

--- core/net/rime/rucb.c
+++ core/net/rime/rucb.c
@@ -28,7 +28,7 @@
  *
  * This file is part of the Contiki operating system.
  *
- * $Id: rucb.c,v 1.1 2007/05/22 20:45:49 adamdunkels Exp $
+ * $Id: rucb.c,v 1.2 2007/11/17 09:59:48 adamdunkels Exp $
  */

 /**
@@ -68,7 +68,7 @@
 }
 /*---------------------------------------------------------------------------*/
 static void
-acked(struct ruc_conn *ruc)
+acked(struct ruc_conn *ruc, rimeaddr_t *to, u8_t retransmissions)
 {
   struct rucb_conn *c = (struct rucb_conn *)ruc;
   PRINTF("acked\n");
@@ -79,7 +79,7 @@
 }
 /*---------------------------------------------------------------------------*/
 static void
-timedout(struct ruc_conn *ruc)
+timedout(struct ruc_conn *ruc, rimeaddr_t *to, u8_t retransmissions)
 {
   struct rucb_conn *c = (struct rucb_conn *)ruc;
   PRINTF("timedout\n");


Rx fifo latency fix (#4328)

Rx fifo latency fix (#4328)

* Flush the rx fifo when checking available bytes in fifo.  This gives a more correct result rather than waiting until either the fifo is full or until a serial rx timeout occurs.

* When rx_avaiable is checked return rx_buffer plus rx_fifo.  Then during rx_read and rx_peek functions copy over the data in the fifo as needed.

* Clean up early out case.

* Set the rx full fifo ISR to trigger a little sooner.  This makes the uart rx isr more robust in cases where the ISR can't trigger very fast

--- cores/esp8266/uart.c
+++ cores/esp8266/uart.c
@@ -91,6 +91,31 @@
     return uart->rx_buffer->size;
 }

+inline size_t uart_rx_buffer_available(uart_t* uart) {
+    if(uart->rx_buffer->wpos < uart->rx_buffer->rpos) {
+      return (uart->rx_buffer->wpos + uart->rx_buffer->size) - uart->rx_buffer->rpos;
+    }
+    return uart->rx_buffer->wpos - uart->rx_buffer->rpos;
+}
+
+inline size_t uart_rx_fifo_available(uart_t* uart) {
+    return (USS(uart->uart_nr) >> USRXC) & 0x7F;
+}
+
+// Copy all the rx fifo bytes that fit into the rx buffer
+inline void uart_rx_copy_fifo_to_buffer(uart_t* uart) {
+    while(uart_rx_fifo_available(uart)){
+        size_t nextPos = (uart->rx_buffer->wpos + 1) % uart->rx_buffer->size;
+        if(nextPos == uart->rx_buffer->rpos) {
+            // Stop copying if rx buffer is full
+            break;
+        }
+        uint8_t data = USF(uart->uart_nr);
+        uart->rx_buffer->buffer[uart->rx_buffer->wpos] = data;
+        uart->rx_buffer->wpos = nextPos;
+    }
+}
+
 int uart_peek_char(uart_t* uart)
 {
     if(uart == NULL || !uart->rx_enabled) {
@@ -98,6 +123,11 @@
     }
     if (!uart_rx_available(uart)) {
         return -1;
+    }
+    if (uart_rx_buffer_available(uart) == 0) {
+        ETS_UART_INTR_DISABLE();
+        uart_rx_copy_fifo_to_buffer(uart);
+        ETS_UART_INTR_ENABLE();
     }
     return uart->rx_buffer->buffer[uart->rx_buffer->rpos];
 }
@@ -119,10 +149,7 @@
     if(uart == NULL || !uart->rx_enabled) {
         return 0;
     }
-    if(uart->rx_buffer->wpos < uart->rx_buffer->rpos) {
-      return (uart->rx_buffer->wpos + uart->rx_buffer->size) - uart->rx_buffer->rpos;
-    }
-    return uart->rx_buffer->wpos - uart->rx_buffer->rpos;
+    return uart_rx_buffer_available(uart) + uart_rx_fifo_available(uart);
 }

@@ -135,14 +162,7 @@
         return;
     }
     if(USIS(uart->uart_nr) & ((1 << UIFF) | (1 << UITO))){
-        while((USS(uart->uart_nr) >> USRXC) & 0x7F){
-            uint8_t data = USF(uart->uart_nr);
-            size_t nextPos = (uart->rx_buffer->wpos + 1) % uart->rx_buffer->size;
-            if(nextPos != uart->rx_buffer->rpos) {
-                uart->rx_buffer->buffer[uart->rx_buffer->wpos] = data;
-                uart->rx_buffer->wpos = nextPos;
-            }
-        }
+        uart_rx_copy_fifo_to_buffer(uart);
     }
     USIC(uart->uart_nr) = USIS(uart->uart_nr);
 }
@@ -152,7 +172,11 @@
     if(uart == NULL || !uart->rx_enabled) {
         return;
     }
-    USC1(uart->uart_nr) = (127 << UCFFT) | (0x02 << UCTOT) | (1 <<UCTOE );
+    // UCFFT value is when the RX fifo full interrupt triggers.  A value of 1
+    // triggers the IRS very often.  A value of 127 would not leave much time
+    // for ISR to clear fifo before the next byte is dropped.  So pick a value
+    // in the middle.
+    USC1(uart->uart_nr) = (100   << UCFFT) | (0x02 << UCTOT) | (1 <<UCTOE );
     USIC(uart->uart_nr) = 0xffff;
     USIE(uart->uart_nr) = (1 << UIFF) | (1 << UIFR) | (1 << UITO);
     ETS_UART_INTR_ATTACH(uart_isr,  (void *)uart);


cc2538: spi: Do not call SPI_WAITFOREORx() at end of init

If the SSI has never been used and spi_init() is called, then the SSI receive
FIFO is empty and remains so, so calling SPI_WAITFOREORx() at the end of
spi_init() waits endlessly for SSI_SR.RNE to be set. Hence, this call must be
removed in order to avoid a deadlock.

Signed-off-by: Benoît Thébaudeau <835bc8b01b82c0117127b72626b289641d7633e2@advansee.com>

--- cpu/cc2538/dev/spi.c
+++ cpu/cc2538/dev/spi.c
@@ -91,8 +91,5 @@

   /* Enable the SSI */
   REG(SSI0_BASE + SSI_CR1) |= SSI_CR1_SSE;
-
-  /* Clear the RX FIFO */
-  SPI_WAITFOREORx();
 }
 /** @} */


cpu/cc430/flashrom.c: Fix warning about unused static function by declaring inline

--- cpu/cc430/flashrom.c
+++ cpu/cc430/flashrom.c
@@ -23,8 +23,8 @@
 #include "cpu.h"
 #include "irq.h"

-static uint8_t prepare(void);
-static void finish(uint8_t istate);
+static inline uint8_t prepare(void);
+static inline void finish(uint8_t istate);
 static inline void busy_wait(void);

 /**
@@ -52,7 +52,7 @@
 /**
  * @TODO implement this function
  */
-static uint8_t prepare(void)
+static inline uint8_t prepare(void)
 {
     return 0;
 }
@@ -60,7 +60,7 @@
 /**
  * @TODO implement this function
  */
-void finish(uint8_t istate)
+static inline void finish(uint8_t istate)
 {
     (void) istate;
 }


check payload length validity

check payload length validity

make sure the payload does not exceed the amount of data received

--- cpu/native/net/tap.c
+++ cpu/native/net/tap.c
@@ -87,8 +87,13 @@
                 /* XXX: check overflow */
                 p.length = ntohs(frame.field.payload.nn_header.length);
                 p.data = frame.field.payload.data;
-                DEBUG("_native_handle_tap_input: received packet of length %"PRIu16" for %"PRIu16" from %"PRIu16"\n", p.length, p.dst, p.src);
-                _nativenet_handle_packet(&p);
+                if (p.length > (nread - sizeof(struct nativenet_header))) {
+                    warnx("_native_handle_tap_input: packet with malicious length field received, discarding");
+                }
+                else {
+                    DEBUG("_native_handle_tap_input: received packet of length %"PRIu16" for %"PRIu16" from %"PRIu16"\n", p.length, p.dst, p.src);
+                    _nativenet_handle_packet(&p);
+                }
             }
         }
         else {


BIO_write_ex(): Make handing of BIO b == NULL and dlen == 0 less redundant

Reviewed-by: Tomas Mraz <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15722)

--- crypto/bio/bio_lib.c
+++ crypto/bio/bio_lib.c
@@ -393,13 +393,8 @@

 int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written)
 {
-    if (dlen == 0) {
-        /* no error */
-        if (written != NULL)
-            *written = 0;
-        return 1;
-    }
-    return bio_write_intern(b, data, dlen, written) > 0;
+    return bio_write_intern(b, data, dlen, written) > 0
+        || (b != NULL && dlen == 0); /* order is important for *written */
 }

 int BIO_puts(BIO *b, const char *buf)


BIGNUM: Add a comment on chunk order in struct bignum_st

Reviewed-by: Paul Dale <ddec78389666b4f7c9b4d110380c848489a3e4aa@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17139)

--- crypto/bn/bn_local.h
+++ crypto/bn/bn_local.h
@@ -223,8 +223,11 @@
                       int num);

 struct bignum_st {
-    BN_ULONG *d;                /* Pointer to an array of 'BN_BITS2' bit
-                                 * chunks. */
+    BN_ULONG *d;                /*
+                                 * Pointer to an array of 'BN_BITS2' bit
+                                 * chunks. These chunks are organised in
+                                 * a least significant chunk first order.
+                                 */
     int top;                    /* Index of last used d +1. */
     /* The next are internal book keeping for bn_expand. */
     int dmax;                   /* Size of the d array. */


Add support for setting raw private/public 25519/448 keys

Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5520)

--- crypto/ec/ecx_meth.c
+++ crypto/ec/ecx_meth.c
@@ -341,6 +341,19 @@
     }
 }

+static int ecx_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv,
+                            size_t len)
+{
+    return ecx_key_op(pkey, pkey->ameth->pkey_id, NULL, priv, len,
+                       KEY_OP_PRIVATE);
+}
+
+static int ecx_set_pub_key(EVP_PKEY *pkey, const unsigned char *pub, size_t len)
+{
+    return ecx_key_op(pkey, pkey->ameth->pkey_id, NULL, pub, len,
+                      KEY_OP_PUBLIC);
+}
+
 const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth = {
     EVP_PKEY_X25519,
     EVP_PKEY_X25519,
@@ -368,7 +381,18 @@
     ecx_free,
     ecx_ctrl,
     NULL,
-    NULL
+    NULL,
+
+    NULL,
+    NULL,
+    NULL,
+
+    NULL,
+    NULL,
+    NULL,
+
+    ecx_set_priv_key,
+    ecx_set_pub_key,
 };

 const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth = {
@@ -398,7 +422,18 @@
     ecx_free,
     ecx_ctrl,
     NULL,
-    NULL
+    NULL,
+
+    NULL,
+    NULL,
+    NULL,
+
+    NULL,
+    NULL,
+    NULL,
+
+    ecx_set_priv_key,
+    ecx_set_pub_key,
 };

 static int ecd_size25519(const EVP_PKEY *pkey)
@@ -504,7 +539,14 @@
     NULL,
     ecd_item_verify,
     ecd_item_sign25519,
-    ecd_sig_info_set25519
+    ecd_sig_info_set25519,
+
+    NULL,
+    NULL,
+    NULL,
+
+    ecx_set_priv_key,
+    ecx_set_pub_key,
 };

 const EVP_PKEY_ASN1_METHOD ed448_asn1_meth = {
@@ -537,7 +579,14 @@
     NULL,
     ecd_item_verify,
     ecd_item_sign448,
-    ecd_sig_info_set448
+    ecd_sig_info_set448,
+
+    NULL,
+    NULL,
+    NULL,
+
+    ecx_set_priv_key,
+    ecx_set_pub_key,
 };

 static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)


Fix a big leak when using stack-allocated BIO items.

Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>

--- crypto/err/err_prn.c
+++ crypto/err/err_prn.c
@@ -92,23 +92,6 @@
     }
 }

-#ifndef OPENSSL_NO_STDIO
-static int print_fp(const char *str, size_t len, void *fp)
-{
-    BIO bio;
-
-    BIO_set(&bio, BIO_s_file());
-    BIO_set_fp(&bio, fp, BIO_NOCLOSE);
-
-    return BIO_printf(&bio, "%s", str);
-}
-
-void ERR_print_errors_fp(FILE *fp)
-{
-    ERR_print_errors_cb(print_fp, fp);
-}
-#endif
-
 static int print_bio(const char *str, size_t len, void *bp)
 {
     return BIO_write((BIO *)bp, str, len);
@@ -118,3 +101,15 @@
 {
     ERR_print_errors_cb(print_bio, bp);
 }
+
+#ifndef OPENSSL_NO_STDIO
+void ERR_print_errors_fp(FILE *fp)
+{
+    BIO *bio = BIO_new_fp(fp, BIO_NOCLOSE);
+    if (bio == NULL)
+        return;
+
+    ERR_print_errors_cb(print_bio, bio);
+    BIO_free(bio);
+}
+#endif


coverity 1462561 Uninitialized scalar variable

Reviewed-by: Tomas Mraz <973cc78d8b4cb00714230ba9be0225e917ab4ac6@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11651)

--- crypto/rsa/rsa_gen.c
+++ crypto/rsa/rsa_gen.c
@@ -463,7 +463,7 @@
     if (ciphertxt_len <= 0)
         goto err;
     if (ciphertxt_len == plaintxt_len
-        && memcmp(decoded, plaintxt, plaintxt_len) == 0)
+        && memcmp(ciphertxt, plaintxt, plaintxt_len) == 0)
         goto err;

     OSSL_SELF_TEST_oncorrupt_byte(st, ciphertxt);


Avoid undefined results when the parameter is out of range.

--- crypto/stack/stack.c
+++ crypto/stack/stack.c
@@ -307,7 +307,7 @@

 char *sk_value(const STACK *st, int i)
 {
-	if(st == NULL) return NULL;
+	if(!st || (i < 0) || (i >= st->num)) return NULL;
 	return st->data[i];
 }


Clear unused variables in X509_print_ex()

CLA: trivial

Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>
Reviewed-by: Tomas Mraz <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18167)

--- crypto/x509/t_x509.c
+++ crypto/x509/t_x509.c
@@ -55,7 +55,7 @@
 {
     long l;
     int ret = 0, i;
-    char *m = NULL, mlch = ' ';
+    char mlch = ' ';
     int nmindent = 0, printok = 0;
     EVP_PKEY *pkey = NULL;
     const char *neg;
@@ -222,7 +222,6 @@
     }
     ret = 1;
  err:
-    OPENSSL_free(m);
     return ret;
 }


OS X/jemalloc: Fix deadlock on fork()

OS X/jemalloc: Fix deadlock on fork()

When running on OS X with jemalloc we install our own malloc zone
allocator (see darwin_zone.c) to allow us to track memory
allocations. However if an application using this calls fork(), then
there's a deadlock in preparing for the fork. The deadlock is caused
by attempting to lock the zone allocator twice - once via the actual
jemalloc zone, and a second time via our wrapper zone, as we naively
forward the lock/unlock calls down to the jemalloc allocator.

Fix this by making force_{lock,unlock} be a no-op in the wrapper zone,
and let the real jemalloc zone be locked directly.

Change-Id: I1ca580f39e19b0f74a38e230b20ff78bd1269928
Reviewed-on: http://review.couchbase.org/52968
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>

--- daemon/darwin_zone.c
+++ daemon/darwin_zone.c
@@ -47,6 +47,8 @@
 /* Data. */

 static malloc_zone_t zone;
+struct malloc_introspection_t zone_introspection;
+
 static malloc_zone_t* default_zone;

 static malloc_new_hook_t* new_hook = NULL;
@@ -152,6 +154,18 @@
     default_zone->destroy(default_zone);
 }

+static void
+zone_force_lock(malloc_zone_t *zone)
+{
+    // do nothing
+}
+
+static void
+zone_force_unlock(malloc_zone_t *zone)
+{
+    // do nothing
+}
+
 /* Actually register the wrapper zone */
 void register_wrapper_zone(malloc_new_hook_t* new_hook_,
                            malloc_delete_hook_t* delete_hook_) {
@@ -160,6 +174,14 @@
     default_zone = malloc_default_zone();
     new_hook = new_hook_;
     delete_hook = delete_hook_;
+
+    // Populate the introspection struct for the wrapper zone. Note that
+    // we only forward selected members; if we directly forward
+    // force_{lock,unlock} methods then we can deadlock as Darwin will try to
+    // lock the 'real' default zone twice - once via our wrapper and once via it's own zone.
+    zone_introspection = *default_zone->introspect;
+    zone_introspection.force_lock = zone_force_unlock;
+    zone_introspection.force_unlock = zone_force_lock;

     // Populate our wrapper zone.
     zone.size = zone_size;
@@ -172,7 +194,7 @@
     zone.zone_name = "CouchbaseWrapperZone";
     zone.batch_malloc = NULL;
     zone.batch_free = NULL;
-    zone.introspect = default_zone->introspect;
+    zone.introspect = &zone_introspection;
     zone.version = 8;
     zone.memalign = zone_memalign;
     zone.free_definite_size = zone_free_definite_size;


fixed typo, which was causing build to fail

--- numpy/core/src/multiarray/iterators.c
+++ numpy/core/src/multiarray/iterators.c
@@ -328,7 +328,7 @@
 static PyObject *
 iter_array(PyArrayIterObject *pit, PyObject *NPY_UNUSED(op))
 {
-    RETURN_PYARRAY(NpyArray_FlatView(pit->iter->ao);
+    RETURN_PYARRAY(NpyArray_FlatView(pit->iter->ao));
 }

 static PyObject *


Fixing tiny bug in treiber-stack assignment

--- grader/assignments/treiber-stack/load-reserved.c
+++ grader/assignments/treiber-stack/load-reserved.c
@@ -1,5 +1,5 @@
 uint64_t lr(uint64_t address);

 int main(int argc, char** argv) {
-  return (int) lc(0);
+  return (int) lr(0);
 }


Adds source code for Program 10.1.

Adds source code for Program 10.1.

error: pathspec 'Exercises/Chapter_10/Exercise_01/Program_10_01/program_10_01.c' did not match any file(s) known to git

--- Exercises/Chapter_10/Exercise_01/Program_10_01/program_10_01.c
+++ Exercises/Chapter_10/Exercise_01/Program_10_01/program_10_01.c
@@ -0,0 +1,18 @@
+/*
+ * program_10_01.c
+ */
+
+#include <stdio.h>
+
+int main (void)
+{
+	int count = 10, x;
+	int *int_pointer;
+
+	int_pointer = &count;
+	x = * int_pointer;
+
+	printf ("count = %i, x = %i\n", count, x);
+
+	return 0;
+}


Adds source code for Program 10.11.

Adds source code for Program 10.11.

error: pathspec 'Exercises/Chapter_10/Exercise_01/Program_10_11/program_10_11.c' did not match any file(s) known to git

--- Exercises/Chapter_10/Exercise_01/Program_10_11/program_10_11.c
+++ Exercises/Chapter_10/Exercise_01/Program_10_11/program_10_11.c
@@ -0,0 +1,28 @@
+/*
+ * program_10_11.c - Working with Pointers to Arrays
+ */
+
+#include <stdio.h>
+
+int arraySum (int array[], const int n)
+{
+	int sum = 0, *ptr;
+	int * const arrayEnd = array + n;
+
+	for ( ptr = array; ptr < arrayEnd; ++ptr)
+	{
+		sum += *ptr;
+	}
+
+	return sum;
+}
+
+int main (void)
+{
+	int arraySum(int array[], const int n);
+	int values[10] = {3, 7, -9, 3, 6, -1, 7, 9, 1, -5};
+
+	printf ("The sum is %i\n", arraySum (values, 10));
+
+	return 0;
+}


Spelling fix.

Spelling fix.

--- Exercises/Chapter_10/Exercise_01/Program_10_13/program_10_13.c
+++ Exercises/Chapter_10/Exercise_01/Program_10_13/program_10_13.c
@@ -1,5 +1,5 @@
 /*
- * program_10_13.c - Pointer version of copyString()
+ * program_10_13.c - Pointer Version of copyString()
  */

 #include <stdio.h>


detect round 2

git-svn-id: de1cbd220ac9a29ed59a7cc342d87cbce0beeb96@14088 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/engines/common/evas_cpu.c
+++ src/lib/engines/common/evas_cpu.c
@@ -7,7 +7,7 @@
 #include <setjmp.h>

 #ifndef WIN32
-static sigjmp_buf detect_buf, detect_buf2;
+static sigjmp_buf detect_buf;
 #endif

 static int cpu_feature_mask = 0;
@@ -25,7 +25,7 @@
 static void
 evas_common_cpu_catch_segv(int sig)
 {
-   siglongjmp(detect_buf2, 1);
+   siglongjmp(detect_buf, 1);
 }
 #endif

@@ -89,16 +89,13 @@
    act.sa_flags = SA_RESTART;
    sigemptyset(&act.sa_mask);
    sigaction(SIGILL, &act, &oact);
-   if (sigsetjmp(detect_buf, 1))
-     {
-	sigaction(SIGILL, &oact, NULL);
-	return 0;
-     }
+
    act.sa_handler = evas_common_cpu_catch_segv;
    act.sa_flags = SA_RESTART;
    sigemptyset(&act.sa_mask);
    sigaction(SIGSEGV, &act, &oact2);
-   if (sigsetjmp(detect_buf2, 1))
+
+   if (sigsetjmp(detect_buf, 1))
      {
 	sigaction(SIGILL, &oact, NULL);
 	sigaction(SIGSEGV, &oact2, NULL);


Update Adafruit_BMP085_U.h

Update Adafruit_BMP085_U.h


Add back the BdsDeleteBootOption to pass build.

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

--- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
@@ -1441,3 +1441,59 @@
 }

+/**
+  Deletete the Boot Option from EFI Variable. The Boot Order Arrray
+  is also updated.
+
+  @param OptionNumber    The number of Boot option want to be deleted.
+  @param BootOrder       The Boot Order array.
+  @param BootOrderSize   The size of the Boot Order Array.
+
+  @retval  EFI_SUCCESS           The Boot Option Variable was found and removed
+  @retval  EFI_UNSUPPORTED       The Boot Option Variable store was inaccessible
+  @retval  EFI_NOT_FOUND         The Boot Option Variable was not found
+**/
+EFI_STATUS
+EFIAPI
+BdsDeleteBootOption (
+  IN UINTN                       OptionNumber,
+  IN OUT UINT16                  *BootOrder,
+  IN OUT UINTN                   *BootOrderSize
+  )
+{
+  UINT16      BootOption[100];
+  UINTN       Index;
+  EFI_STATUS  Status;
+  UINTN       Index2Del;
+
+  Status    = EFI_SUCCESS;
+  Index2Del = 0;
+
+  UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);
+  Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);
+
+  //
+  // adjust boot order array
+  //
+  for (Index = 0; Index < *BootOrderSize / sizeof (UINT16); Index++) {
+    if (BootOrder[Index] == OptionNumber) {
+      Index2Del = Index;
+      break;
+    }
+  }
+
+  if (Index != *BootOrderSize / sizeof (UINT16)) {
+    for (Index = 0; Index < *BootOrderSize / sizeof (UINT16) - 1; Index++) {
+      if (Index >= Index2Del) {
+        BootOrder[Index] = BootOrder[Index + 1];
+      }
+    }
+
+    *BootOrderSize -= sizeof (UINT16);
+  }
+
+  return Status;
+
+}
+
+


Analog pins Ax instead of AINx

Analog pins Ax instead of AINx

Changed analog pins names from `AINx` to `Ax` for LaunchPad FraunchPad compatibility.


working on secureChannel, changed various names of "advanced" datatypes

--- open62541Stack/src/opuca_linkedList.c
+++ open62541Stack/src/opuca_linkedList.c
@@ -1,22 +0,0 @@
-/*
- * opuca_linkedList.c
- *
- *  Created on: Feb 5, 2014
- *      Author: opcua
- */
-
-
-#include<stdlib.h>
-#include<stdio.h>
-
-
-
-list_add(element *list,element *elementToAdd)
-{
-	element *nElement;
-	while(list->next != NULL)
-	{
-		nElement = list->next;
-	}
-
-}


Fixed possible ASSERT failure

Fixed possible ASSERT failure

--- src/Items/ItemItemFrame.h
+++ src/Items/ItemItemFrame.h
@@ -21,7 +21,7 @@

 	virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
 	{
-		if (a_Dir == BLOCK_FACE_NONE)
+		if ((a_Dir == BLOCK_FACE_NONE) || (a_Dir == BLOCK_FACE_YP) || (a_Dir == BLOCK_FACE_YM))
 		{
 			// Client sends this if clicked on top or bottom face
 			return false;


--- src/Items/ItemThrowable.h
+++ src/Items/ItemThrowable.h
@@ -89,6 +89,22 @@
 		super(E_ITEM_ENDER_PEARL, cProjectileEntity::pkEnderPearl, 30)
 	{
 	}
+
+	virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
+	{
+		// Creative players cannot throw ender pearls.
+		if (a_Player->IsGameModeCreative())
+		{
+			return false;
+		}
+
+		a_Player->GetInventory().RemoveOneEquippedItem();
+		Vector3d Pos = a_Player->GetThrowStartPos();
+		Vector3d Speed = a_Player->GetLookVector() * m_SpeedCoeff;
+		a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, m_ProjectileKind, a_Player, a_Player->GetEquippedItem(), &Speed);
+
+		return true;
+	}
 } ;


lose obsolete Define_Start_End_Count() - use Stroika_Define_Enum_Bounds instead

--- Library/Sources/Stroika/Foundation/Configuration/Enumeration.h
+++ Library/Sources/Stroika/Foundation/Configuration/Enumeration.h
@@ -89,12 +89,6 @@
                                             eCOUNT      =   eEND - eSTART,

-            /**
-             *  Temporary backward compat... v2.0a2x -LGP 2013-10-14
-             */
-#define Define_Start_End_Count(FIRST_ITEM,LAST_ITEM)    Stroika_Define_Enum_Bounds(FIRST_ITEM,LAST_ITEM)
-
-
         }
     }
 }


media: ident: _chk_results: Rewrite for can_parse_url


Always use the JACK server buffer size as the update size

The buffer-size config option now only specifies an additional mix ahead to
keep ready for audio requests, rather than a pretend period size.

--- Alc/backends/jack.c
+++ Alc/backends/jack.c
@@ -202,15 +202,17 @@
     ALuint bufsize;

     ALCjackPlayback_lock(self);
+    device->UpdateSize = numframes;
+    device->NumUpdates = 2;
+    TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
+
+    bufsize = device->UpdateSize;
     if(ConfigValueUInt("jack", "buffer-size", &bufsize))
-        device->UpdateSize = maxu(numframes, NextPowerOf2(bufsize));
-    else
-        device->UpdateSize = numframes;
-    TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
+        bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
+    bufsize += device->UpdateSize;

     ll_ringbuffer_free(self->Ring);
-    self->Ring = ll_ringbuffer_create(device->UpdateSize * device->NumUpdates,
-                                      FrameSizeFromDevFmt(device->FmtChans, device->FmtType));
+    self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType));
     if(!self->Ring)
     {
         ERR("Failed to reallocate ringbuffer\n");
@@ -377,11 +379,13 @@
      * because there's one element less of it that's writeable, and we only
      * write in update-sized chunks. */
     device->Frequency = jack_get_sample_rate(self->Client);
+    device->UpdateSize = jack_get_buffer_size(self->Client);
+    device->NumUpdates = 2;
+
+    bufsize = device->UpdateSize;
     if(ConfigValueUInt("jack", "buffer-size", &bufsize))
-        device->UpdateSize = maxu(jack_get_buffer_size(self->Client), NextPowerOf2(bufsize));
-    else
-        device->UpdateSize = jack_get_buffer_size(self->Client);
-    device->NumUpdates = 2;
+        bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
+    bufsize += device->UpdateSize;

     /* Force 32-bit float output. */
     device->FmtType = DevFmtFloat;
@@ -415,8 +419,7 @@
     }

     ll_ringbuffer_free(self->Ring);
-    self->Ring = ll_ringbuffer_create(device->UpdateSize * device->NumUpdates,
-                                      FrameSizeFromDevFmt(device->FmtChans, device->FmtType));
+    self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType));
     if(!self->Ring)
     {
         ERR("Failed to allocate ringbuffer\n");


added some documentation

added some documentation

--- Amethyst/AMLayout.h
+++ Amethyst/AMLayout.h
@@ -49,6 +49,10 @@
 // Subclasses can optionally implement this method.
 - (void)decreaseMainPaneCount;

+// Returns the desired frame for the current  layout based on the user's
+// configuration.
+//
+// screen - The screen from which the proper frame is desired.
 - (CGRect)adjustedFrameForLayout:(NSScreen *)screen;

 @end


Replace tab with white-space when writing to syslog

Pivotal Story: 7813483
https://www.pivotaltracker.com/story/show/7813483

--- signer/src/signer/rrset.c
+++ signer/src/signer/rrset.c
@@ -34,6 +34,7 @@
 #include "config.h"
 #include "shared/allocator.h"
 #include "shared/duration.h"
+#include "shared/file.h"
 #include "shared/hsm.h"
 #include "shared/log.h"
 #include "shared/status.h"
@@ -54,27 +55,34 @@
 log_rr(ldns_rr* rr, const char* pre, int level)
 {
     char* str = NULL;
+    int i = 0;

     str = ldns_rr2str(rr);
     if (str) {
         str[(strlen(str))-1] = '\0';
-    }
-    if (level == 1) {
-        ods_log_error("%s %s", pre?pre:"", str?str:"(null)");
-    } else if (level == 2) {
-        ods_log_warning("%s %s", pre?pre:"", str?str:"(null)");
-    } else if (level == 3) {
-        ods_log_info("%s %s", pre?pre:"", str?str:"(null)");
-    } else if (level == 4) {
-        ods_log_verbose("%s %s", pre?pre:"", str?str:"(null)");
-    } else if (level == 5) {
-        ods_log_debug("%s %s", pre?pre:"", str?str:"(null)");
-    } else if (level == 6) {
-        ods_log_deeebug("%s %s", pre?pre:"", str?str:"(null)");
-    } else {
-        ods_log_deeebug("%s %s", pre?pre:"", str?str:"(null)");
-    }
-    free((void*)str);
+        for (i=0; i < strlen(str); i++) {
+            if (str[i] == '\t') {
+                str[i] = ' ';
+            }
+        }
+
+        if (level == 1) {
+            ods_log_error("%s %s", pre?pre:"", str);
+        } else if (level == 2) {
+            ods_log_warning("%s %s", pre?pre:"", str);
+        } else if (level == 3) {
+            ods_log_info("%s %s", pre?pre:"", str);
+        } else if (level == 4) {
+            ods_log_verbose("%s %s", pre?pre:"", str);
+        } else if (level == 5) {
+            ods_log_debug("%s %s", pre?pre:"", str);
+        } else if (level == 6) {
+            ods_log_deeebug("%s %s", pre?pre:"", str);
+        } else {
+            ods_log_deeebug("%s %s", pre?pre:"", str);
+        }
+        free((void*)str);
+    }
     return;
 }


Bluetooth: controller: Replace use of printk with BT_WARN

Replace printk in ISR with BT_WARN to avoid problems with
co-existing with logging subsystem.

Signed-off-by: Vinayak Kariappa Chettimada <e780c9f87dc729ad454f47292ad82c8652353064@nordicsemi.no>

--- subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c
+++ subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c
@@ -271,7 +271,7 @@
 	/* Check CRC and generate Periodic Advertising Report */
 	if (crc_ok) {
 		/* TODO: */
-		printk("CRC OK\n");
+		BT_WARN("CRC OK");
 	}

 isr_rx_done:


sys: net: gnrc: fix IS_WIRED netopt call

--- sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c
+++ sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c
@@ -863,7 +863,7 @@
              * gnrc_ipv6_netif_add() */
         }

-        if (gnrc_netapi_get(ifs[i], NETOPT_IS_WIRED, 0, &tmp, sizeof(int)) > 0) {
+        if (gnrc_netapi_get(ifs[i], NETOPT_IS_WIRED, 0, NULL, 0) > 0) {
             ipv6_if->flags |= GNRC_IPV6_NETIF_FLAGS_IS_WIRED;
         }
         else {


fix clone example

fix clone example

Link: https://github.com/GeneAssembly/biosal/issues/493
Signed-off-by: Sébastien Boisvert <1a4d2e25eb5ba040b6ad5779a730a1a8a0ff9bc5@anl.gov>

--- engine/thorium/actor.c
+++ engine/thorium/actor.c
@@ -96,8 +96,6 @@
     bsal_queue_init(&actor->forwarding_queue, sizeof(struct bsal_message));

     bsal_map_init(&actor->acquaintance_map, sizeof(int), sizeof(int));
-
-    bsal_actor_register(actor, BSAL_ACTOR_FORWARD_MESSAGES, bsal_actor_forward_messages);

     /*
     bsal_actor_helper_send_to_self_empty(actor, BSAL_ACTOR_UNPIN_FROM_WORKER);
@@ -668,12 +666,6 @@

         return 1;

-    } else if (tag == BSAL_ACTOR_FORWARD_MESSAGES) {
-
-        /* the dispatcher can handle this one
-         */
-        return 0;
-
     } else if (tag == BSAL_ACTOR_MIGRATE_NOTIFY_ACQUAINTANCES) {
         bsal_actor_migrate_notify_acquaintances(actor, message);
         return 1;
@@ -828,7 +820,15 @@
         bsal_actor_helper_send_reply_int(actor, BSAL_ACTOR_GET_NODE_WORKER_COUNT_REPLY,
                         bsal_actor_node_worker_count(actor));
         return 1;
-    }
+
+    } else  if (tag == BSAL_ACTOR_FORWARD_MESSAGES) {
+
+        bsal_actor_forward_messages(actor, message);
+        return 1;
+
+    }
+
+

     return 0;
 }
@@ -883,9 +883,12 @@
 #endif
     }

+
     /* Otherwise, this is a message for the actor itself.
      */
     receive = bsal_actor_get_receive(actor);
+
+    BSAL_DEBUGGER_ASSERT(receive != NULL);

 #ifdef BSAL_ACTOR_DEBUG_SYNC
     printf("DEBUG bsal_actor_receive calls concrete receive tag %d\n",


small bugfix

small bugfix

--- src/units/include/antioch/units.h
+++ src/units/include/antioch/units.h
@@ -722,7 +722,13 @@
     {
       std::ostringstream np;
       np << pow;
-      subsymb.replace(po - nc,nc,np.str());
+      if(po < subsymb.size())
+      {
+         subsymb.replace(po - nc,nc,np.str());
+      }else
+      {
+        subsymb += np.str();
+      }
     }else
     {
       subsymb.erase(po - nc,nc);


check if fifo is empty in bsal_worker_thread_pull_message

Link: https://github.com/GeneAssembly/biosal/issues/49
Signed-off-by: Sébastien Boisvert <1a4d2e25eb5ba040b6ad5779a730a1a8a0ff9bc5@anl.gov>

--- engine/worker_thread.c
+++ engine/worker_thread.c
@@ -291,6 +291,13 @@
 {
     int value;

+    /* avoid the spinlock by checking first if
+     * there is something to actually pull...
+     */
+    if (bsal_fifo_empty(bsal_worker_thread_messages(thread))) {
+        return 0;
+    }
+
 #ifdef BSAL_THREAD_USE_LOCK
     pthread_spin_lock(&thread->message_lock);
 #endif


Revert "[DWARF] Delete redundant check in DWARFAddressRange::intersects"

This reverts rL358377. It isn't redundant, though the semantic seems weird.

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

--- include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
+++ include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
@@ -36,6 +36,9 @@
   /// Returns true if [LowPC, HighPC) intersects with [RHS.LowPC, RHS.HighPC).
   bool intersects(const DWARFAddressRange &RHS) const {
     assert(valid() && RHS.valid());
+    // Empty ranges can't intersect.
+    if (LowPC == HighPC || RHS.LowPC == RHS.HighPC)
+      return false;
     return LowPC < RHS.HighPC && RHS.LowPC < HighPC;
   }


modify the test to keep track of worst case fragmentation

--- src/us_test_allocator_heap_main.c
+++ src/us_test_allocator_heap_main.c
@@ -80,6 +80,7 @@
 int min_repeat_count=INT_MAX;

 #define MAX_ALLOCATIONS (256)
+size_t min_allocated=INT_MAX;
 bool us_test_allocator_heap_stress( us_allocator_heap_t *allocator )
 {
     void *allocations[MAX_ALLOCATIONS];
@@ -121,7 +122,12 @@
             }
             else if(allocations[item] == 0)
             {
-                us_log_error( "Tried to allocate %d bytes, failed, largest free block was %d", sz, largest_free );
+                if( allocator->m_current_allocation_count < min_allocated)
+                {
+                    min_allocated = allocator->m_current_allocation_count;
+                    us_log_info( "Tried to allocate %d bytes, failed, largest free block was %d, new min %d", sz, largest_free, min_allocated );
+                    us_allocator_heap_report( allocator );
+                }
             }
         }
         else
@@ -145,7 +151,7 @@
 {
     int i,j;
     int r = 1;
-    static uint32_t raw_memory[32768];
+    static uint32_t raw_memory[0x8000];
     us_allocator_heap_t heap;
     if ( us_testutil_start ( 2048, 2048, argc, argv ) )
     {
@@ -183,10 +189,10 @@
             }
             j++;
         }
-        for(i=0; i<=min_repeat_count; i++)
-        {
-            us_log_info ( "item[%d],size=%d, %s\n", min_allocation_item[i],min_allocation_size[i],min_allocation_alloc_or_free[i]?"alloc":"free");
-        }
+//        for(i=0; i<=min_repeat_count; i++)
+//        {
+//            us_log_info ( "item[%d],size=%d, %s\n", min_allocation_item[i],min_allocation_size[i],min_allocation_alloc_or_free[i]?"alloc":"free");
+//        }
 #else
         if( us_allocator_heap_init_raw( &heap, &raw_memory[0], sizeof(raw_memory) ) )
         {


Significantly simplify gep_type_iterator, and make its interface more general/powerful

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

--- include/llvm/Support/GetElementPtrTypeIterator.h
+++ include/llvm/Support/GetElementPtrTypeIterator.h
@@ -15,8 +15,7 @@
 #ifndef LLVM_SUPPORT_GETELEMENTPTRTYPE_H
 #define LLVM_SUPPORT_GETELEMENTPTRTYPE_H

-#include "Support/iterator"
-#include "llvm/iMemory.h"
+#include "llvm/User.h"
 #include "llvm/DerivedTypes.h"

 namespace llvm {
@@ -24,30 +23,26 @@
     : public forward_iterator<const Type *, ptrdiff_t> {
     typedef forward_iterator<const Type*, ptrdiff_t> super;

-    User *TheGEP;          // Either GetElementPtrInst or ConstantExpr
+    User::op_iterator OpIt;
     const Type *CurTy;
-    unsigned Operand;
-
     gep_type_iterator() {}
   public:

-    static gep_type_iterator begin(User *gep) {
+    static gep_type_iterator begin(const Type *Ty, User::op_iterator It) {
       gep_type_iterator I;
-      I.TheGEP = gep;
-      I.CurTy = gep->getOperand(0)->getType();
-      I.Operand = 1;
+      I.CurTy = Ty;
+      I.OpIt = It;
       return I;
     }
-    static gep_type_iterator end(User *gep) {
+    static gep_type_iterator end(User::op_iterator It) {
       gep_type_iterator I;
-      I.TheGEP = gep;
       I.CurTy = 0;
-      I.Operand = gep->getNumOperands();
+      I.OpIt = It;
       return I;
     }

     bool operator==(const gep_type_iterator& x) const {
-      return Operand == x.Operand;
+      return OpIt == x.OpIt;
     }
     bool operator!=(const gep_type_iterator& x) const {
       return !operator==(x);
@@ -61,9 +56,7 @@
     // current type directly.
     const Type *operator->() const { return operator*(); }

-    unsigned getOperandNum() const { return Operand; }
-
-    Value *getOperand() const { return TheGEP->getOperand(Operand); }
+    Value *getOperand() const { return *OpIt; }

     gep_type_iterator& operator++() {   // Preincrement
       if (const CompositeType *CT = dyn_cast<CompositeType>(CurTy)) {
@@ -71,7 +64,7 @@
       } else {
         CurTy = 0;
       }
-      ++Operand;
+      ++OpIt;
       return *this;
     }

@@ -81,18 +74,26 @@
   };

   inline gep_type_iterator gep_type_begin(User *GEP) {
-    return gep_type_iterator::begin(GEP);
+    return gep_type_iterator::begin(GEP->getOperand(0)->getType(),
+                                    GEP->op_begin()+1);
   }
-
   inline gep_type_iterator gep_type_end(User *GEP) {
-    return gep_type_iterator::end(GEP);
+    return gep_type_iterator::end(GEP->op_end());
   }
   inline gep_type_iterator gep_type_begin(User &GEP) {
-    return gep_type_iterator::begin(&GEP);
+    return gep_type_iterator::begin(GEP.getOperand(0)->getType(),
+                                    GEP.op_begin()+1);
   }
-
   inline gep_type_iterator gep_type_end(User &GEP) {
-    return gep_type_iterator::end(&GEP);
+    return gep_type_iterator::end(GEP.op_end());
+  }
+  inline gep_type_iterator gep_type_begin(const Type *Op0, User::op_iterator I,
+                                          User::op_iterator E) {
+    return gep_type_iterator::begin(Op0, I);
+  }
+  inline gep_type_iterator gep_type_end(const Type *Op0, User::op_iterator I,
+                                        User::op_iterator E) {
+    return gep_type_iterator::end(E);
   }
 } // end namespace llvm


Can't believe such a stupid bug persisted until now! Has never anyone tried to access children 6 and 7 of a hex?

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@2690 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/deal.II/include/grid/tria_accessor.templates.h
+++ deal.II/deal.II/include/grid/tria_accessor.templates.h
@@ -516,7 +516,8 @@
 template <int dim>
 inline
 unsigned int
-TriaObjectAccessor<3,dim>::quad_index (unsigned int i) const {
+TriaObjectAccessor<3,dim>::quad_index (unsigned int i) const
+{
   Assert (i<6, ExcIndexRange(i,0,6));

   return tria->levels[present_level]->hexes.hexes[present_index].quad(i);
@@ -526,8 +527,9 @@
 template <int dim>
 inline
 TriaIterator<dim,TriaObjectAccessor<3,dim> >
-TriaObjectAccessor<3,dim>::child (const unsigned int i) const {
-  Assert (i<6, ExcIndexRange(i,0,6));
+TriaObjectAccessor<3,dim>::child (const unsigned int i) const
+{
+  Assert (i<8, ExcIndexRange(i,0,8));

   TriaIterator<dim,TriaObjectAccessor<3,dim> > q (tria, present_level+1, child_index (i));


Robot now saves geometry files in internal structure.  Save and SaveGeometry now use this internal structure

--- Modeling/Robot.h
+++ Modeling/Robot.h
@@ -80,24 +80,29 @@
   bool Load(const char* fn);
   bool LoadRob(const char* fn);
   bool LoadURDF(const char* fn);
-  bool Save(const char* fn,const char* geomPrefix="",const char* geomExt="tri");  ///< Saves the geometry line as geomPrefix+[linkName].[geomExt]
-  bool Save(const char* fn,const vector<string>& geomFiles);
-  bool SaveGeometry(const char* geomPrefix="",const char* geomExt="tri");  ///< Saves the geometry files to geomPrefix+[linkName].[geomExt]
-  bool SaveGeometry(const vector<string>& geomFiles);
+  bool Save(const char* fn);
+  void SetGeomFiles(const char* geomPrefix="",const char* geomExt="tri");  ///< Sets the geometry file names to geomPrefix+[linkName].[geomExt]
+  void SetGeomFiles(const vector<string>& geomFiles);
+  bool SaveGeometry(const char* prefix="");
   void InitStandardJoints();
   bool CheckValid() const;
   //adds a geometry to the geometry of the given link
   void Mount(int link,const Geometry::AnyGeometry3D& geom,const RigidTransform& T);
   //adds a subchain as descendents of a given link
   void Mount(int link,const Robot& subchain,const RigidTransform& T);
+  ///Creates this into a mega-robot from several other robots
+  void Merge(const std::vector<Robot*>& robots);

   bool DoesJointAffect(int joint,int dof) const;
   void GetJointIndices(int joint,vector<int>& indices) const;
-  //for floating joints
+  ///Used for setting configuration of floating and ball-and-socket joints
   void SetJointByTransform(int joint,int link,const RigidTransform& T);
+  ///Used for setting configuration of floating and ball-and-socket joints
   void SetJointByOrientation(int joint,int link,const Matrix3& R);
+  ///Used for setting velocity of floating and ball-and-socket joints
   void SetJointVelocityByMoment(int joint,int link,const Vector3& w,const Vector3& v);

+  ///Returns true if the given DOF does not have a driver attached to it
   bool IsPassiveDOF(int dof) const;
   bool DoesDriverAffect(int driver,int dof) const;
   void GetDriverIndices(int driver,vector<int>& indices) const;
@@ -106,14 +111,16 @@
   Real GetDriverVelocity(int driver) const;
   void SetDriverValue(int driver,Real value);
   void SetDriverVelocity(int driver,Real value);
+  ///Returns a vector J such that the change in dof values is J*v where v is the change in the driver value
   void GetDriverJacobian(int driver,Vector& J);

-  //The lipschitz matrix (i,j) is a bound on the amount that the geometry at
-  //link j moves in the workspace in response to a unit change in q(i)
-  //It is used by exact collision checkers, and is uninitialized by default.
+  ///The lipschitz matrix (i,j) is a bound on the amount that the geometry at
+  ///link j moves in the workspace in response to a unit change in q(i)
+  ///It is used by exact collision checkers, and is uninitialized by default.
   void ComputeLipschitzMatrix();

-  Vector accMax;   //conservative acceleration limits, used by DynamicPath
+  vector<string> geomFiles;   ///< geometry file names (used in saving)
+  Vector accMax;   ///< conservative acceleration limits, used by DynamicPath
   vector<RobotJoint> joints;
   vector<RobotJointDriver> drivers;
   vector<string> linkNames;


Created SphericalPoint in array_util.h

Created SphericalPoint in array_util.h

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

Cr-Original-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#9507}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: ebe7422372c561a017990ac59e15e58a2f02d8eb

--- modules/audio_processing/beamformer/array_util.h
+++ modules/audio_processing/beamformer/array_util.h
@@ -23,19 +23,13 @@
     c[1] = y;
     c[2] = z;
   }
-  T x() const {
-    return c[0];
-  }
-  T y() const {
-    return c[1];
-  }
-  T z() const {
-    return c[2];
-  }
+  T x() const { return c[0]; }
+  T y() const { return c[1]; }
+  T z() const { return c[2]; }
   T c[3];
 };

-typedef CartesianPoint<float> Point;
+using Point = CartesianPoint<float>;

 template<typename T>
 float Distance(CartesianPoint<T> a, CartesianPoint<T> b) {
@@ -44,6 +38,21 @@
                    (a.z() - b.z()) * (a.z() - b.z()));
 }

+template <typename T>
+struct SphericalPoint {
+  SphericalPoint(T azimuth, T elevation, T radius) {
+    s[0] = azimuth;
+    s[1] = elevation;
+    s[2] = radius;
+  }
+  T azimuth() const { return s[0]; }
+  T elevation() const { return s[1]; }
+  T distance() const { return s[2]; }
+  T s[3];
+};
+
+using SphericalPointf = SphericalPoint<float>;
+
 }  // namespace webrtc

 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_ARRAY_UTIL_H_


licence information for seril.c

licence information for seril.c

--- Opcodes/serial.c
+++ Opcodes/serial.c
@@ -1,3 +1,34 @@
+/*****************************************************
+
+			CSOUND SERIAL PORT OPCODES
+			  ma++ ingalls, 2011/9/4
+
+ * based on "Arduino-serial"
+ * Copyright (c) 2006, Tod E. Kurt, tod@todbot.com
+ * http://todbot.com/blog/
+
+    Copyright (C) 2011 matt ingalls
+    based on "Arduino-serial", Copyright (c) 2006, Tod E. Kurt, tod@todbot.com
+    http://todbot.com/blog/ and licenced LGPL to csound
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
 #include <stdlib.h>
 #include <stdint.h>   /* Standard types */
 #include <string.h>   /* String function definitions */
@@ -5,14 +36,11 @@
 #ifndef WINDOWS
 #include <unistd.h>   /* UNIX standard function definitions */
 #include <fcntl.h>    /* File control definitions */
-//#include <errno.h>    /* Error number definitions */
 #include <termios.h>  /* POSIX terminal control definitions */
 #include <sys/ioctl.h>
-//#include <getopt.h>
 #endif

 #include "csdl.h"
-//#include "csound.h"

 /* **************************************************
    As far as I can tell his should work on Windows
@@ -21,14 +49,6 @@

 /*****************************************************
-
-			CSOUND SERIAL PORT OPCODES
-			  ma++ ingalls, 2011/9/4
-
- * based on "Arduino-serial"
- * Copyleft (c) 2006, Tod E. Kurt, tod@todbot.com
- * http://todbot.com/blog/
-

 open a port.  baudRate defaults to 9600
 	iPort  serialBegin         SPortName [, baudRate ]


Build for version 0.4.4-alpha+48

Build for version 0.4.4-alpha+48

--- apps/Tasks/src/version.h
+++ apps/Tasks/src/version.h
@@ -9,7 +9,7 @@
 #define PROGRAM_VERSION_MAJOR 0
 #define PROGRAM_VERSION_MINOR 4
 #define PROGRAM_VERSION_PATCH 4
-#define PROGRAM_VERSION_BUILD 47
+#define PROGRAM_VERSION_BUILD 48
 #define PROGRAM_VERSION_STABILITY "-alpha" // "-beta", "-rc", and ""

 #define PROGRAM_VERSION_STRING \


[probes] fixed usage of assume_d in encache.c

--- src/OVAL/probes/encache.c
+++ src/OVAL/probes/encache.c
@@ -47,7 +47,7 @@
 {
         size_t i;

-        assume_d (cache != NULL);
+        assume_d (cache != NULL, /* void */);

         for (i = 0; i < cache->real; ++i)
                 if (cache->name[i] != NULL)
@@ -73,8 +73,8 @@
 {
         SEXP_t *ref;

-        assume_d (cache != NULL);
-        assume_d (name  != NULL);
+        assume_d (cache != NULL, NULL);
+        assume_d (name  != NULL, NULL);

         ref = SEXP_string_new (name, strlen (name));

@@ -88,8 +88,8 @@
                 cache->name  = oscap_realloc (cache->name, sizeof (SEXP_t *) * cache->size);
         }

-        assume_d (cache->name != NULL);
-        assume_d (cache->size > cache->real);
+        assume_d (cache->name != NULL, NULL);
+        assume_d (cache->size > cache->real, NULL);

         cache->name[cache->real] = ref;
         ++cache->real;
@@ -106,8 +106,8 @@
 {
         SEXP_t **ref = NULL;

-        assume_d (cache != NULL);
-        assume_d (name  != NULL);
+        assume_d (cache != NULL, NULL);
+        assume_d (name  != NULL, NULL);

         ENCACHE_RLOCK(cache, NULL);

@@ -128,8 +128,8 @@
 {
         SEXP_t *ref;

-        assume_d (cache != NULL);
-        assume_d (name  != NULL);
+        assume_d (cache != NULL, NULL);
+        assume_d (name  != NULL, NULL);

         ref = encache_get (cache, name);


Document the purpose of the struct _block members.

--- Python/pyarena.c
+++ Python/pyarena.c
@@ -1,7 +1,7 @@
 #include "Python.h"
 #include "pyarena.h"

-/* A simple arena block structure
+/* A simple arena block structure.

    Measurements with standard library modules suggest the average
    allocation is about 20 bytes and that most compiles use a single
@@ -10,9 +10,26 @@

 #define DEFAULT_BLOCK_SIZE 8192
 typedef struct _block {
+	/* Total number of bytes owned by this block available to pass out.
+	 * Read-only after initialization.  The first such byte starts at
+	 * ab_mem.
+	 */
 	size_t ab_size;
+
+	/* Total number of bytes already passed out.  The next byte available
+	 * to pass out starts at ab_mem + ab_offset.
+	 */
 	size_t ab_offset;
+
+	/* An arena maintains a singly-linked, NULL-terminated list of
+	 * all blocks owned by the arena.  These are linked via the
+	 * ab_next member.
+	 */
 	struct _block *ab_next;
+
+	/* Pointer to the first allocatable byte owned by this block.  Read-
+	 * only after initialization.
+	 */
 	void *ab_mem;
 } block;


printing: Use correct units for margins taken via IPP

cups_printer_get_hard_margins() returned margins in millimeters
for margins taken via IPP request instead of Units used before.

--- modules/printbackends/cups/gtkprintbackendcups.c
+++ modules/printbackends/cups/gtkprintbackendcups.c
@@ -6424,10 +6424,10 @@
     }
   else if (cups_printer->media_margin_default_set)
     {
-      *left = cups_printer->media_left_margin_default;
-      *bottom = cups_printer->media_bottom_margin_default;
-      *right = cups_printer->media_right_margin_default;
-      *top = cups_printer->media_top_margin_default;
+      *left = POINTS_PER_INCH * cups_printer->media_left_margin_default / MM_PER_INCH;
+      *bottom = POINTS_PER_INCH * cups_printer->media_bottom_margin_default / MM_PER_INCH;
+      *right = POINTS_PER_INCH * cups_printer->media_right_margin_default / MM_PER_INCH;
+      *top = POINTS_PER_INCH * cups_printer->media_top_margin_default / MM_PER_INCH;
       result = TRUE;
     }


absolute delta temp correction for BME280, forced mode for BME280, some cleaning

--- esp8266_sensors/mqtt_pir_vibro_light_dht22_publisher.c
+++ esp8266_sensors/mqtt_pir_vibro_light_dht22_publisher.c
@@ -100,11 +100,6 @@
 // MQTT topics
 #define mqtt_temp_topic                     "sensor/temp_"
 #define mqtt_temp_ds_topic                  "sensor/temp_ds_"
-#define mqtt_temp_ds1_topic                 "sensor/temp_ds_1_"
-#define mqtt_temp_ds2_topic                 "sensor/temp_ds_2_"
-#define mqtt_temp_ds3_topic                 "sensor/temp_ds_3_"
-#define mqtt_temp_ds4_topic                 "sensor/temp_ds_4_"
-#define mqtt_temp_ds5_topic                 "sensor/temp_ds_5_"
 #define mqtt_humid_topic                    "sensor/hum_"
 #define mqtt_pressure_topic                 "sensor/pres_"
 #define mqtt_movement_topic                 "sensor/pir_"
@@ -132,10 +127,10 @@
 //** comment to deactivate        **
 //**********************************
 // Master switches:
-//#define ESP_TEST1
+#define ESP_TEST1
 //#define ESP_COCINA
 //#define USE_ESP32
-#define ESP_GALERIA
+//#define ESP_GALERIA

 //**********************************

@@ -191,15 +186,10 @@
 #ifdef ESP_COCINA
 #define DHTTYPE                             DHT22  // DHT22 (AM2302) / DHT11
 #define DHTPIN                              2      //D4 (DHT sensor)
-//  #define LED_PIR                             4     //D2 - in dht11 breadboard
 #define LED_RGB_RED                         12     //D6
 #define LED_RGB_GREEN                       13     //D7
 #define LED_RGB_BLUE                        15     //D8
-#define PIN_PIR                             4      //D2 - dht22 box
-//  #define PIN_PIR                             5      //D1
-//  #define PIN_VIBRO                           4      //D2 - dht22 box
-//  #define PIN_VIBRO                           0      //D3 - dht11 breadboard
-//  #define PIN_LIGHT_SENSOR_DIGITAL            14     //D5
+#define PIN_PIR                             0      //D3
 #define PIN_LIGHT_SENSOR_ANALOG             A0     //A0
 #define NEGATE_SENSOR_ANALOG
 #endif
@@ -208,6 +198,8 @@
 //** Configuración *****************
 //**********************************
 #define VERBOSE                             true
+
+#define DELTA_TEMP_BME280                   -.3  // Temperature offset for BME280 (self-heating!)

 #define MQTT_POSTINTERVAL_DHT22_SEC         20
 #define MQTT_POSTINTERVAL_BME280_SEC        40
@@ -782,11 +774,12 @@

     *sampled = true;
     *sample_ok = true;
+
+    bme.takeForcedMeasurement();
+
     temp = bme.readTemperature();
     humid = bme.readHumidity();
     pressure = bme.readPressure() / 100.0F;
-    // #define SEALEVELPRESSURE_HPA (1013.25)      // 1 atm std.
-    //bme.readAltitude(SEALEVELPRESSURE_HPA);

     if (VERBOSE) {
       Serial.print("Temp: ");
@@ -800,7 +793,10 @@
       Serial.println(" mbar");
     }
     if (temp)
+    {
+      temp += DELTA_TEMP_BME280;
       bme_tempSamples.push_front(temp);
+    }
     if (humid)
       bme_humidSamples.push_front(humid);
     if (pressure)
@@ -812,6 +808,7 @@
 #endif
 }

+#ifdef ONE_WIRE_BUS
 bool i_push_front_ds18b20_temp(uint8_t index, DeviceAddress address,
                                std::list<double> *temp_samples)
 {
@@ -833,6 +830,7 @@
   }
   return false;
 }
+#endif

 void sample_ds18b20_sensor_data(bool *sampled, bool *sample_ok)
 {
@@ -1004,15 +1002,15 @@
     delay(10000);
     reset_exec();
   }
-  //    bme.setSampling(sensor_mode mode              = MODE_NORMAL,
-  //       sensor_sampling tempSampling  = SAMPLING_X16,
-  //       sensor_sampling pressSampling = SAMPLING_X16,
-  //       sensor_sampling humSampling   = SAMPLING_X16,
-  //       sensor_filter filter          = FILTER_OFF,
-  //       standby_duration duration     = STANDBY_MS_0_5
-  //       );
-
-  bme.setSampling(Adafruit_BME280::MODE_NORMAL, Adafruit_BME280::SAMPLING_X2, Adafruit_BME280::SAMPLING_X2, Adafruit_BME280::SAMPLING_X2, Adafruit_BME280::FILTER_OFF, Adafruit_BME280::STANDBY_MS_1000);
+  /* bme.setSampling(sensor_mode mode  = MODE_NORMAL,
+         sensor_sampling tempSampling  = SAMPLING_X16,
+         sensor_sampling pressSampling = SAMPLING_X16,
+         sensor_sampling humSampling   = SAMPLING_X16,
+         sensor_filter filter          = FILTER_OFF,
+         standby_duration duration     = STANDBY_MS_0_5
+  ); */
+  //bme.setSampling(Adafruit_BME280::MODE_NORMAL, Adafruit_BME280::SAMPLING_X2, Adafruit_BME280::SAMPLING_X2, Adafruit_BME280::SAMPLING_X2, Adafruit_BME280::FILTER_OFF, Adafruit_BME280::STANDBY_MS_1000);
+  bme.setSampling(Adafruit_BME280::MODE_FORCED, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::FILTER_OFF, Adafruit_BME280::STANDBY_MS_1000);

   delay(100); // let sensor boot up
 }


tests: uart_async_api: fix fault accessing cached device pointer

The cached device pointer must be placed in memory that allows user
mode invocation of the test functions to access it.

Signed-off-by: Peter Bigot <a4112a160b558d5427af084318038e19a95979ee@nordicsemi.no>

--- tests/drivers/uart/uart_async_api/src/test_uart_async.c
+++ tests/drivers/uart/uart_async_api/src/test_uart_async.c
@@ -13,7 +13,7 @@
 K_SEM_DEFINE(rx_disabled, 0, 1);

 ZTEST_BMEM volatile bool failed_in_isr;
-static const struct device *uart_dev;
+ZTEST_BMEM static const struct device *uart_dev;

 void init_test(void)
 {


remove two useless defines.
fixup arguments to the fpu_kernel_enter/exit.

from mike

--- arch/amd64/amd64/aesni.c
+++ arch/amd64/amd64/aesni.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: aesni.c,v 1.1 2010/06/29 21:34:11 thib Exp $	*/
+/*	$OpenBSD: aesni.c,v 1.2 2010/06/30 17:00:42 thib Exp $	*/
 /*-
  * Copyright (c) 2003 Jason Wright
  * Copyright (c) 2003, 2004 Theo de Raadt
@@ -44,9 +44,6 @@
 #define AESCTR_IVSIZE		8
 #define AESCTR_BLOCKSIZE	16

-#define AESCTR_MINKEY		16+4
-#define AESCTR_MAXKEY		32+4
-
 struct aesni_sess {
 	uint32_t		 ses_ekey[4 * (AES_MAXROUNDS + 1)];
 	uint32_t		 ses_dkey[4 * (AES_MAXROUNDS + 1)];
@@ -164,7 +161,7 @@
 	if ((uint64_t)ses % 16 != 0)
 		panic("aesni: unaligned address %p\n", ses);

-	fpu_kernel_enter(0);
+	fpu_kernel_enter();
 	for (c = cri; c != NULL; c = c->cri_next) {
 		switch (c->cri_alg) {
 		case CRYPTO_AES_CBC:
@@ -250,7 +247,7 @@
 			return (EINVAL);
 		}
 	}
-	fpu_kernel_exit(0);
+	fpu_kernel_exit();

 	*sidp = ses->ses_sid;
 	return (0);
@@ -456,7 +453,7 @@
 		goto out;
 	}

-	fpu_kernel_enter(0);
+	fpu_kernel_enter();
 	for (crd = crp->crp_desc; crd; crd = crd->crd_next) {
 		switch (crd->crd_alg) {
 		case CRYPTO_AES_CBC:
@@ -484,7 +481,7 @@
 		}
 	}
 cleanup:
-	fpu_kernel_exit(0);
+	fpu_kernel_exit();
 out:
 	crp->crp_etype = err;
 	crypto_done(crp);


ARM/locomo: Prepare locomo_handler for irq argument removal

The irq argument of most interrupt flow handlers is unused or merily
used instead of a local variable. The handlers which need the irq
argument can retrieve the irq number from the irq descriptor.

Search and update was done with coccinelle and the invaluable help of
Julia Lawall.

Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Julia Lawall <3d4a3affaf9163789962e9770780389962bda29d@lip6.fr>
Cc: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@linux.intel.com>
Cc: Russell King <eb6532bf669c9fcdf954bbb1b3ff99c891d8f96e@arm.linux.org.uk>
Cc: f99ef57ccac738b558d0fc2e44478b3c5def9522@lists.infradead.org