ia32: Use functions instead of macros in bemit_XXX

--- ir/be/ia32/ia32_emitter.c
+++ ir/be/ia32/ia32_emitter.c
@@ -1683,13 +1683,28 @@
 	MOD_REG          = 0xC0  /**< reg1 */
 };

+typedef enum reg_modifier {
+	REG_LOW  = 0,
+	REG_HIGH = 4
+} reg_modifier_t;
+
 /** create R/M encoding for ModR/M */
-#define ENC_RM(x) (x)
+static uint8_t ENC_RM(unsigned const regnum, reg_modifier_t const modifier)
+{
+	return regnum | modifier;
+}
+
 /** create REG encoding for ModR/M */
-#define ENC_REG(x) ((x) << 3)
+static uint8_t ENC_REG(unsigned const regnum, reg_modifier_t const modifier)
+{
+	return (regnum | modifier) << 3;
+}

 /** create encoding for a SIB byte */
-#define ENC_SIB(scale, index, base) ((scale) << 6 | (index) << 3 | (base))
+static uint8_t ENC_SIB(uint8_t scale, uint8_t index, uint8_t base)
+{
+	return scale << 6 | index << 3 | base;
+}

 /* Node: The following routines are supposed to append bytes, words, dwords
    to the output stream.
@@ -1756,18 +1771,13 @@
 /* end emit routines, all emitters following here should only use the functions
    above. */

-typedef enum reg_modifier {
-	REG_LOW  = 0,
-	REG_HIGH = 4
-} reg_modifier_t;
-
 /** Create a ModR/M byte for src1,src2 registers */
 static void bemit_modrr(const arch_register_t *src1,
                         const arch_register_t *src2)
 {
 	unsigned char modrm = MOD_REG;
-	modrm |= ENC_RM(src1->encoding);
-	modrm |= ENC_REG(src2->encoding);
+	modrm |= ENC_RM(src1->encoding, REG_LOW);
+	modrm |= ENC_REG(src2->encoding, REG_LOW);
 	bemit8(modrm);
 }

@@ -1776,8 +1786,8 @@
 						 reg_modifier_t high_part2, const arch_register_t *src2)
 {
 	unsigned char modrm = MOD_REG;
-	modrm |= ENC_RM( high_part1 | src1->encoding);
-	modrm |= ENC_REG(high_part2 | src2->encoding);
+	modrm |= ENC_RM(src1->encoding, high_part1);
+	modrm |= ENC_REG(src2->encoding, high_part2);
 	bemit8(modrm);
 }

@@ -1786,8 +1796,8 @@
 {
 	unsigned char modrm = MOD_REG;
 	assert(ext <= 7);
-	modrm |= ENC_RM(reg->encoding);
-	modrm |= ENC_REG(ext);
+	modrm |= ENC_RM(reg->encoding, REG_LOW);
+	modrm |= ENC_REG(ext, REG_LOW);
 	bemit8(modrm);
 }

@@ -1796,7 +1806,7 @@
 {
 	unsigned char modrm = MOD_REG;
 	assert(reg->encoding < 4);
-	modrm |= ENC_RM(high_part | reg->encoding);
+	modrm |= ENC_RM(reg->encoding, high_part);
 	modrm |= MOD_REG;
 	bemit8(modrm);
 }
@@ -1856,18 +1866,18 @@
 		arch_register_t const *const reg_index = arch_get_irn_register(idx);
 		unsigned               const scale     = get_ia32_am_scale(node);
 		/* R/M set to ESP means SIB in 32bit mode. */
-		modrm   |= ENC_RM(0x04);
+		modrm   |= ENC_RM(0x04, REG_LOW);
 		sib      = ENC_SIB(scale, reg_index->encoding, base_enc);
 		emitsib = true;
 	} else if (base_enc == 0x04) {
 		/* for the above reason we are forced to emit a SIB when base is ESP.
 		 * Only the base is used, index must be ESP too, which means no index.
 		 */
-		modrm   |= ENC_RM(0x04);
+		modrm   |= ENC_RM(0x04, REG_LOW);
 		sib      = ENC_SIB(0, 0x04, 0x04);
 		emitsib  = true;
 	} else {
-		modrm |= ENC_RM(base_enc);
+		modrm |= ENC_RM(base_enc, REG_LOW);
 	}

 	/* We are forced to emit an 8bit offset as EBP base without offset is a
@@ -1877,7 +1887,7 @@
 		emitoffs  = 8;
 	}

-	modrm |= ENC_REG(reg);
+	modrm |= ENC_REG(reg, REG_LOW);

 	bemit8(modrm);
 	if (emitsib)
@@ -1889,41 +1899,6 @@
 	} else if (emitoffs == 32) {
 		bemit_entity(&attr->am_imm);
 	}
-}
-
-/**
- * Emit an unop.
- */
-static void bemit_unop(const ir_node *node, unsigned char code, unsigned char ext, int input)
-{
-	bemit8(code);
-	if (get_ia32_op_type(node) == ia32_Normal) {
-		const arch_register_t *in = arch_get_irn_register_in(node, input);
-		bemit_modru(in, ext);
-	} else {
-		bemit_mod_am(ext, node);
-	}
-}
-
-static void bemit_unop_reg(const ir_node *node, unsigned char code, int input)
-{
-	arch_register_t const *const out = arch_get_irn_register_out(node, pn_ia32_res);
-	bemit_unop(node, code, out->encoding, input);
-}
-
-static void bemit_unop_mem(const ir_node *node, unsigned char code, unsigned char ext)
-{
-	unsigned size = get_mode_size_bits(get_ia32_ls_mode(node));
-	if (size == 16)
-		bemit8(0x66);
-	bemit8(size == 8 ? code : code | OP_16_32);
-	bemit_mod_am(ext, node);
-}
-
-static void bemit_0f_unop_reg(ir_node const *const node, unsigned char const code, int const input)
-{
-	bemit8(0x0F);
-	bemit_unop_reg(node, code, input);
 }

 static void bemit_imm32(ir_node const *const node)
@@ -2011,6 +1986,57 @@
 	bemit_imm32(node);
 }

+/**
+ * Emit an unop.
+ */
+static void bemit_unop(ir_node const *const node, uint8_t const code,
+                       uint8_t const ext, int const input)
+{
+	bemit8(code);
+	if (get_ia32_op_type(node) == ia32_Normal) {
+		const arch_register_t *in = arch_get_irn_register_in(node, input);
+		bemit_modru(in, ext);
+	} else {
+		bemit_mod_am(ext, node);
+	}
+}
+
+static void bemit_not(ir_node const *const node)
+{
+	bemit_unop(node, 0xF7, 2, n_ia32_Not_val);
+}
+
+static void bemit_neg(ir_node const *const node)
+{
+	bemit_unop(node, 0xF7, 3, n_ia32_Neg_val);
+}
+
+static void bemit_mul(ir_node const *const node)
+{
+	bemit_unop(node, 0xF7, 4, n_ia32_Mul_right);
+}
+
+static void bemit_imul1op(ir_node const *const node)
+{
+	bemit_unop(node, 0xF7, 5, n_ia32_IMul1OP_right);
+}
+
+static void bemit_div(ir_node const *const node)
+{
+	bemit_unop(node, 0xF7, 6, n_ia32_Div_divisor);
+}
+
+static void bemit_idiv(ir_node const *const node)
+{
+	bemit_unop(node, 0xF7, 7, n_ia32_IDiv_divisor);
+}
+
+static void bemit_ijmp(ir_node const *const node)
+{
+	/* TODO: am support for IJmp */
+	bemit_unop(node, 0xFF, 4, n_ia32_IJmp_target);
+}
+
 static bool use_eax_short_form(ir_node const *const node)
 {
 	return
@@ -2063,24 +2089,45 @@
 	}
 }

-/**
- * Create a function for a binop.
- */
-#define BINOP(op, code) \
-	static void bemit_##op(ir_node const *const node) \
-	{ \
-		bemit_binop(node, code); \
-	}
-
-/*    insn opcode */
-BINOP(add, 0)
-BINOP(or,  1)
-BINOP(adc, 2)
-BINOP(sbb, 3)
-BINOP(and, 4)
-BINOP(sub, 5)
-BINOP(xor, 6)
-BINOP(cmp, 7)
+static void bemit_add(ir_node const *const node)
+{
+	bemit_binop(node, 0);
+}
+
+static void bemit_or(ir_node const *const node)
+{
+	bemit_binop(node, 1);
+}
+
+static void bemit_adc(ir_node const *const node)
+{
+	bemit_binop(node, 2);
+}
+
+static void bemit_sbb(ir_node const *const node)
+{
+	bemit_binop(node, 3);
+}
+
+static void bemit_and(ir_node const *const node)
+{
+	bemit_binop(node, 4);
+}
+
+static void bemit_sub(ir_node const *const node)
+{
+	bemit_binop(node, 5);
+}
+
+static void bemit_xor(ir_node const *const node)
+{
+	bemit_binop(node, 6);
+}
+
+static void bemit_cmp(ir_node const *const node)
+{
+	bemit_binop(node, 7);
+}

 static void bemit_binop_mem(ir_node const *const node, unsigned const code)
 {
@@ -2109,86 +2156,118 @@
 	}
 }

-#define BINOPMEM(op, code) \
-	static void bemit_##op(ir_node const *const node) \
-	{ \
-		bemit_binop_mem(node, code); \
-	}
-
-BINOPMEM(addmem,  0)
-BINOPMEM(ormem,   1)
-BINOPMEM(andmem,  4)
-BINOPMEM(submem,  5)
-BINOPMEM(xormem,  6)
-
-
-/**
- * Creates a function for an Unop with code /ext encoding.
- */
-#define UNOP(op, code, ext, input)              \
-static void bemit_ ## op(const ir_node *node) { \
-	bemit_unop(node, code, ext, input);         \
-}
-
-UNOP(not,     0xF7, 2, n_ia32_Not_val)
-UNOP(neg,     0xF7, 3, n_ia32_Neg_val)
-UNOP(mul,     0xF7, 4, n_ia32_Mul_right)
-UNOP(imul1op, 0xF7, 5, n_ia32_IMul1OP_right)
-UNOP(div,     0xF7, 6, n_ia32_Div_divisor)
-UNOP(idiv,    0xF7, 7, n_ia32_IDiv_divisor)
-
-/* TODO: am support for IJmp */
-UNOP(ijmp,    0xFF, 4, n_ia32_IJmp_target)
-
-#define SHIFT(op, ext) \
-static void bemit_##op(const ir_node *node) \
-{ \
-	arch_register_t const *const out   = arch_get_irn_register_out(node, pn_ia32_res); \
-	ir_node               *const count = get_irn_n(node, 1); \
-	if (is_ia32_Immediate(count)) { \
-		int32_t offset = get_ia32_immediate_attr_const(count)->imm.offset; \
-		if (offset == 1) { \
-			bemit8(0xD1); \
-			bemit_modru(out, ext); \
-		} else { \
-			bemit8(0xC1); \
-			bemit_modru(out, ext); \
-			bemit8(offset); \
-		} \
-	} else { \
-		bemit8(0xD3); \
-		bemit_modru(out, ext); \
-	} \
-} \
- \
-static void bemit_##op##mem(const ir_node *node) \
-{ \
-	ir_node *count; \
-	unsigned size = get_mode_size_bits(get_ia32_ls_mode(node)); \
-	if (size == 16) \
-		bemit8(0x66); \
-	count = get_irn_n(node, 1); \
-	if (is_ia32_Immediate(count)) { \
-		int32_t offset = get_ia32_immediate_attr_const(count)->imm.offset; \
-		if (offset == 1) { \
-			bemit8(size == 8 ? 0xD0 : 0xD1); \
-			bemit_mod_am(ext, node); \
-		} else { \
-			bemit8(size == 8 ? 0xC0 : 0xC1); \
-			bemit_mod_am(ext, node); \
-			bemit8(offset); \
-		} \
-	} else { \
-		bemit8(size == 8 ? 0xD2 : 0xD3); \
-		bemit_mod_am(ext, node); \
-	} \
-}
-
-SHIFT(rol, 0)
-SHIFT(ror, 1)
-SHIFT(shl, 4)
-SHIFT(shr, 5)
-SHIFT(sar, 7)
+static void bemit_addmem(ir_node const *const node)
+{
+	bemit_binop_mem(node, 0);
+}
+
+static void bemit_ormem(ir_node const *const node)
+{
+	bemit_binop_mem(node, 1);
+}
+
+static void bemit_andmem(ir_node const *const node)
+{
+	bemit_binop_mem(node, 4);
+}
+
+static void bemit_submem(ir_node const *const node)
+{
+	bemit_binop_mem(node, 5);
+}
+
+static void bemit_xormem(ir_node const *const node)
+{
+	bemit_binop_mem(node, 6);
+}
+
+static void bemit_shiftop(ir_node const *const node, uint8_t const ext)
+{
+	arch_register_t const *const out
+		= arch_get_irn_register_out(node, pn_ia32_res);
+	ir_node         const *const count = get_irn_n(node, 1);
+	if (is_ia32_Immediate(count)) {
+		int32_t const offset = get_ia32_immediate_attr_const(count)->imm.offset;
+		if (offset == 1) {
+			bemit8(0xD1);
+			bemit_modru(out, ext);
+		} else {
+			bemit8(0xC1);
+			bemit_modru(out, ext);
+			bemit8(offset);
+		}
+	} else {
+		bemit8(0xD3);
+		bemit_modru(out, ext);
+	}
+}
+
+static void bemit_shiftop_mem(ir_node const *const node, uint8_t const ext)
+{
+	unsigned const size = get_mode_size_bits(get_ia32_ls_mode(node));
+	if (size == 16)
+		bemit8(0x66);
+	ir_node const *const count = get_irn_n(node, 1);
+	if (is_ia32_Immediate(count)) {
+		int32_t const offset = get_ia32_immediate_attr_const(count)->imm.offset;
+		if (offset == 1) {
+			bemit8(size == 8 ? 0xD0 : 0xD1);
+			bemit_mod_am(ext, node);
+		} else {
+			bemit8(size == 8 ? 0xC0 : 0xC1);
+			bemit_mod_am(ext, node);
+			bemit8(offset);
+		}
+	} else {
+		bemit8(size == 8 ? 0xD2 : 0xD3);
+		bemit_mod_am(ext, node);
+	}
+}
+
+static void bemit_rol(ir_node const *const node)
+{
+	bemit_shiftop(node, 0);
+}
+static void bemit_rolmem(ir_node const *const node)
+{
+	bemit_shiftop_mem(node, 0);
+}
+
+static void bemit_ror(ir_node const *const node)
+{
+	bemit_shiftop(node, 1);
+}
+static void bemit_rormem(ir_node const *const node)
+{
+	bemit_shiftop_mem(node, 1);
+}
+
+static void bemit_shl(ir_node const *const node)
+{
+	bemit_shiftop(node, 4);
+}
+static void bemit_shlmem(ir_node const *const node)
+{
+	bemit_shiftop_mem(node, 4);
+}
+
+static void bemit_shr(ir_node const *const node)
+{
+	bemit_shiftop(node, 5);
+}
+static void bemit_shrmem(ir_node const *const node)
+{
+	bemit_shiftop_mem(node, 5);
+}
+
+static void bemit_sar(ir_node const *const node)
+{
+	bemit_shiftop(node, 7);
+}
+static void bemit_sarmem(ir_node const *const node)
+{
+	bemit_shiftop_mem(node, 7);
+}

 static void bemit_shld(const ir_node *node)
 {
@@ -2273,6 +2352,21 @@
 		bemit8(0x90 | pnc2cc(cc));
 		bemit_modrm8(REG_LOW, dreg);
 	}
+}
+
+static void bemit_unop_reg(ir_node const *const node, uint8_t const code,
+                           int const input)
+{
+	arch_register_t const *const out
+		= arch_get_irn_register_out(node, pn_ia32_res);
+	bemit_unop(node, code, out->encoding, input);
+}
+
+static void bemit_0f_unop_reg(ir_node const *const node, uint8_t const code,
+                              int const input)
+{
+	bemit8(0x0F);
+	bemit_unop_reg(node, code, input);
 }

 static void bemit_bsf(ir_node const *const node)
@@ -2366,16 +2460,35 @@
 	bemit8(0x40 + out->encoding);
 }

-#define UNOPMEM(op, code, ext) \
-static void bemit_##op(const ir_node *node) \
-{ \
-	bemit_unop_mem(node, code, ext); \
-}
-
-UNOPMEM(notmem, 0xF6, 2)
-UNOPMEM(negmem, 0xF6, 3)
-UNOPMEM(incmem, 0xFE, 0)
-UNOPMEM(decmem, 0xFE, 1)
+static void bemit_unop_mem(ir_node const *const node, uint8_t const code,
+                           uint8_t const ext)
+{
+	unsigned size = get_mode_size_bits(get_ia32_ls_mode(node));
+	if (size == 16)
+		bemit8(0x66);
+	bemit8(size == 8 ? code : code | OP_16_32);
+	bemit_mod_am(ext, node);
+}
+
+static void bemit_notmem(ir_node const *const node)
+{
+	bemit_unop_mem(node, 0xF6, 2);
+}
+
+static void bemit_negmem(ir_node const *const node)
+{
+	bemit_unop_mem(node, 0xF6, 3);
+}
+
+static void bemit_incmem(ir_node const *const node)
+{
+	bemit_unop_mem(node, 0xFE, 0);
+}
+
+static void bemit_decmem(ir_node const *const node)
+{
+	bemit_unop_mem(node, 0xFE, 1);
+}

 static void bemit_ldtls(const ir_node *node)
 {
@@ -2385,7 +2498,7 @@
 		bemit8(0xA1); // movl 0, %eax
 	} else {
 		bemit8(0x88 | OP_MEM_SRC | OP_16_32); // movl 0, %reg
-		bemit8(MOD_IND | ENC_REG(out->encoding) | ENC_RM(0x05));
+		bemit8(MOD_IND | ENC_REG(out->encoding, REG_LOW) | ENC_RM(0x05, REG_LOW));
 	}
 	bemit32(0);
 }
@@ -2483,22 +2596,47 @@
 	bemit_helper_sbb( in_hi, out_hi);
 }

-/**
- * Emit a single opcode.
- */
-#define EMIT_SINGLEOP(op, code)                 \
-static void bemit_ ## op(const ir_node *node) { \
-	(void) node;                                \
-	bemit8(code);                               \
-}
-
-EMIT_SINGLEOP(cwtl,  0x98)
-EMIT_SINGLEOP(cltd,  0x99)
-EMIT_SINGLEOP(sahf,  0x9E)
-EMIT_SINGLEOP(leave, 0xC9)
-EMIT_SINGLEOP(int3,  0xCC)
-EMIT_SINGLEOP(cmc,   0xF5)
-EMIT_SINGLEOP(stc,   0xF9)
+static void bemit_cwtl(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0x98);
+}
+
+static void bemit_cltd(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0x99);
+}
+
+static void bemit_sahf(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0x9E);
+}
+
+static void bemit_leave(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0xC9);
+}
+
+static void bemit_int3(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0xCC);
+}
+
+static void bemit_cmc(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0xF5);
+}
+
+static void bemit_stc(ir_node const *const node)
+{
+	(void)node;
+	bemit8(0xF9);
+}

 /**
  * Emits a MOV out, [MEM].


Remove obsolete comment

Remove obsolete comment

--- mudlib/mud/home/System/sys/wiztoold.c
+++ mudlib/mud/home/System/sys/wiztoold.c
@@ -1,9 +1,3 @@
-/** Grants proxies
-
-A proxy is used to grant user level permissions to objects, or to allow
-one subsystem to take advantage of grants made by other subsystems.
-
-*/
 #include <kernel/kernel.h>

 #include <kotaka/paths.h>


wrong spill ?

wrong spill ?

[r16311]

error: pathspec 'ir/be/test/fehler100.c' did not match any file(s) known to git

--- ir/be/test/fehler100.c
+++ ir/be/test/fehler100.c
@@ -0,0 +1,23 @@
+int incs[14];
+
+int bla(int b);
+
+void simpleSort ( int lo, int hi, int d )
+{
+   int i, j, h, bigN, hp;
+   int v;
+
+   for (; hp >= 0; hp--) {
+      h = incs[hp];
+      if (hp >= 5)
+         bla(lo);
+
+      i = lo + h;
+      while (1) {
+         j = i;
+         while (bla(d)) {
+            j = j - h;
+         }
+       }
+   }
+}


Do not change the condition code of an ia32 test instruction.

This fixes backend/setcc.c.

--- ir/be/ia32/ia32_emitter.c
+++ ir/be/ia32/ia32_emitter.c
@@ -760,6 +760,11 @@
 	ir_node           *flags = get_irn_n(node, flags_pos);
 	const ia32_attr_t *flags_attr;
 	flags = skip_Proj(flags);
+
+	/* Permuted operands of a test instruction do not change the result. */
+	if (is_ia32_Test(flags)) {
+		return cc;
+	}

 	if (is_ia32_Sahf(flags)) {
 		ir_node *cmp = get_irn_n(flags, n_ia32_Sahf_val);


even crazier

even crazier

[r17009]

--- ir/be/test/fehler108.c
+++ ir/be/test/fehler108.c
@@ -1,9 +1,12 @@
+#include <stdio.h>
+
 int f(void) {
-	return 0;
+	return 42;
 }

 int (*f_ptr) (void) = &f;

 int main(void) {
-	return (******f_ptr)();
+	(**printf)("Res: %d (should be 42)\n", (********f_ptr)());
+	return 0;
 }


more cases added

more cases added

[r15786]


Fix Bytecode disasm to export type_def (#7460)

TEST=builds

--- iree/vm/bytecode_disasm.c
+++ iree/vm/bytecode_disasm.c
@@ -1001,6 +1001,7 @@
       IREE_RETURN_IF_ERROR(iree_string_builder_append_cstring(b, ", "));
       EMIT_I32_REG_NAME(index_reg);
       EMIT_OPTIONAL_VALUE_I32(regs->i32[index_reg]);
+      EMIT_TYPE_NAME(type_def);
       break;
     }

@@ -1068,6 +1069,7 @@
       IREE_RETURN_IF_ERROR(iree_string_builder_append_cstring(b, " : "));
       EMIT_REF_REG_NAME(false_value_reg);
       EMIT_OPTIONAL_VALUE_REF(&regs->ref[false_value_reg]);
+      EMIT_TYPE_NAME(type_def);
       break;
     }


more cases added

more cases added

[r15788]


return 0

return 0

--- ir/be/test/vandrunen.c
+++ ir/be/test/vandrunen.c
@@ -42,4 +42,5 @@
 int main(int argc, char *argv[]) {
   vandrunen(10, argc & 1, 1);
   printf("%d %d %d\n", T6, T10, T13);
+  return 0;
 }


Fabric: Removing `ConcreteShadowNode::getChildrenSlice`

Summary:
We don't use it anymore.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC, mdvacca

Differential Revision: D20052028

fbshipit-source-id: 22c46b90d87b55465d3549c6de24393c33375833

--- ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h
+++ ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h
@@ -120,27 +120,6 @@
     state_ = std::make_shared<ConcreteState const>(
         std::make_shared<ConcreteStateData const>(std::move(data)), *state_);
   }
-
-  /*
-   * Returns subset of children that are inherited from `SpecificShadowNodeT`.
-   */
-  template <typename SpecificShadowNodeT>
-  better::
-      small_vector<SpecificShadowNodeT *, kShadowNodeChildrenSmallVectorSize>
-      getChildrenSlice() const {
-    better::
-        small_vector<SpecificShadowNodeT *, kShadowNodeChildrenSmallVectorSize>
-            children;
-    for (auto const &childShadowNode : ShadowNode::getChildren()) {
-      auto specificChildShadowNode =
-          dynamic_cast<SpecificShadowNodeT const *>(childShadowNode.get());
-      if (specificChildShadowNode) {
-        children.push_back(
-            const_cast<SpecificShadowNodeT *>(specificChildShadowNode));
-      }
-    }
-    return children;
-  }
 };

 } // namespace react


D3D render system - fixed a small copy\paste bug of the define - D3D9_DEVICE_ACCESS_UNLOCK

--- RenderSystems/Direct3D9/include/OgreD3D9Prerequisites.h
+++ RenderSystems/Direct3D9/include/OgreD3D9Prerequisites.h
@@ -42,7 +42,7 @@

 #if OGRE_THREAD_SUPPORT == 1
 #define D3D9_DEVICE_ACCESS_LOCK				OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
-#define D3D9_DEVICE_ACCESS_UNLOCK			OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
+#define D3D9_DEVICE_ACCESS_UNLOCK			OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
 #define D3D9_DEVICE_ACCESS_CRITICAL_SECTION	OGRE_LOCK_MUTEX(msDeviceAccessMutex)
 #else
 #define D3D9_DEVICE_ACCESS_LOCK


Clean up reset of read/write sequences

Clean up reset of read/write sequences

Use sizeof instead of an explicit size, and use the functions for the
purpose.

Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>

--- ssl/record/rec_layer_s3.c
+++ ssl/record/rec_layer_s3.c
@@ -166,8 +166,8 @@
     SSL3_RECORD_clear(&rl->rrec);
     SSL3_RECORD_clear(&rl->wrec);

-    memset(rl->read_sequence, 0, sizeof(rl->read_sequence));
-    memset(rl->write_sequence, 0, sizeof(rl->write_sequence));
+    RECORD_LAYER_reset_read_sequence(rl);
+    RECORD_LAYER_reset_write_sequence(rl);

     if (rl->d)
         DTLS_RECORD_LAYER_clear(rl);
@@ -219,12 +219,12 @@

 void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl)
 {
-    memset(rl->read_sequence, 0, 8);
+    memset(rl->read_sequence, 0, sizeof(rl->read_sequence));
 }

 void RECORD_LAYER_reset_write_sequence(RECORD_LAYER *rl)
 {
-    memset(rl->write_sequence, 0, 8);
+    memset(rl->write_sequence, 0, sizeof(rl->write_sequence));
 }

 int RECORD_LAYER_setup_comp_buffer(RECORD_LAYER *rl)


Improve coded_stream.h handling on MSVC.  Avoid a bogus runtime check and enable little-endian optimization.  Based on patch from Nathan McDaniel.

--- src/google/protobuf/io/coded_stream.h
+++ src/google/protobuf/io/coded_stream.h
@@ -110,11 +110,24 @@
 #define GOOGLE_PROTOBUF_IO_CODED_STREAM_H__

 #include <string>
-#ifndef _MSC_VER
-#include <sys/param.h>
-#endif  // !_MSC_VER
+#ifdef _MSC_VER
+  #if defined(_M_IX86) && \
+      !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
+    #define PROTOBUF_LITTLE_ENDIAN 1
+  #endif
+  #if _MSC_VER >= 1300
+    // If MSVC has "/RTCc" set, it will complain about truncating casts at
+    // runtime.  This file contains some intentional truncating casts.
+    #pragma runtime_checks("c", off)
+  #endif
+#else
+  #include <sys/param.h>   // __BYTE_ORDER
+  #if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && \
+      !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
+    #define PROTOBUF_LITTLE_ENDIAN 1
+  #endif
+#endif
 #include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/common.h>          // for GOOGLE_PREDICT_TRUE macro

 namespace google {

@@ -735,8 +748,7 @@
 inline const uint8* CodedInputStream::ReadLittleEndian32FromArray(
     const uint8* buffer,
     uint32* value) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   memcpy(value, buffer, sizeof(*value));
   return buffer + sizeof(*value);
 #else
@@ -751,8 +763,7 @@
 inline const uint8* CodedInputStream::ReadLittleEndian64FromArray(
     const uint8* buffer,
     uint64* value) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   memcpy(value, buffer, sizeof(*value));
   return buffer + sizeof(*value);
 #else
@@ -771,8 +782,7 @@
 }

 inline bool CodedInputStream::ReadLittleEndian32(uint32* value) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   if (GOOGLE_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) {
     memcpy(value, buffer_, sizeof(*value));
     Advance(sizeof(*value));
@@ -786,8 +796,7 @@
 }

 inline bool CodedInputStream::ReadLittleEndian64(uint64* value) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   if (GOOGLE_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) {
     memcpy(value, buffer_, sizeof(*value));
     Advance(sizeof(*value));
@@ -915,8 +924,7 @@

 inline uint8* CodedOutputStream::WriteLittleEndian32ToArray(uint32 value,
                                                             uint8* target) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   memcpy(target, &value, sizeof(value));
 #else
   target[0] = static_cast<uint8>(value);
@@ -929,8 +937,7 @@

 inline uint8* CodedOutputStream::WriteLittleEndian64ToArray(uint64 value,
                                                             uint8* target) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   memcpy(target, &value, sizeof(value));
 #else
   uint32 part0 = static_cast<uint32>(value);
@@ -1087,4 +1094,9 @@
 }  // namespace protobuf

 }  // namespace google
+
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+  #pragma runtime_checks("c", restore)
+#endif  // _MSC_VER
+
 #endif  // GOOGLE_PROTOBUF_IO_CODED_STREAM_H__


Add command bool?.

Add command bool?.

--- commands.c
+++ commands.c
@@ -3598,6 +3598,20 @@
 error:
     return new_exception(TE_SYNTAX,
 			 L"Syntax error at 'nil?', syntax: nil? val", interp);
+}
+
+Toy_Type*
+cmd_isbool(Toy_Interp *interp, Toy_Type *posargs, Hash *nameargs, int arglen) {
+
+    if (arglen != 1) goto error;
+    if (hash_get_length(nameargs) != 0) goto error;
+
+    if (GET_TAG(list_get_item(posargs)) == BOOL) return const_T;
+    return const_Nil;
+
+error:
+    return new_exception(TE_SYNTAX,
+			 L"Syntax error at 'nil?', syntax: bool? val", interp);
 }

 Toy_Type*
@@ -4205,6 +4219,7 @@
     toy_add_func(interp, L"stack-list", cmd_stacklist, 		NULL);
     toy_add_func(interp, L"symbol?", 	cmd_issymbol, 		L"val");
     toy_add_func(interp, L"nil?", 	cmd_isnil, 		L"val");
+    toy_add_func(interp, L"bool?", 	cmd_isbool, 		L"val");
     toy_add_func(interp, L"list?", 	cmd_islist, 		L"val");
     toy_add_func(interp, L"integer?", 	cmd_isinteger, 		L"val");
     toy_add_func(interp, L"real?", 	cmd_isreal, 		L"val");


rtpendpoint: Avoid sending buffers with negative pts or dts

Change-Id: I86695eb2822a5c587c3e3a6a71d4dbd005c81576

--- src/gst-plugins/kmsrecorderendpoint.c
+++ src/gst-plugins/kmsrecorderendpoint.c
@@ -155,6 +155,7 @@
   GstSegment *segment;
   GstBuffer *buffer;
   BaseTimeType *base_time;
+  GstClockTime offset;

   g_signal_emit_by_name (appsink, "pull-sample", &sample);
   if (sample == NULL)
@@ -211,13 +212,23 @@

   if (GST_CLOCK_TIME_IS_VALID (base_time->pts)) {
     if (GST_BUFFER_PTS_IS_VALID (buffer)) {
-      buffer->pts -= base_time->pts + self->priv->paused_time;
+      offset = base_time->pts + self->priv->paused_time;
+      if (buffer->pts > offset) {
+        buffer->pts -= offset;
+      } else {
+        buffer->pts = 0;
+      }
     }
   }

   if (GST_CLOCK_TIME_IS_VALID (base_time->dts)) {
     if (GST_BUFFER_DTS_IS_VALID (buffer)) {
-      buffer->dts -= base_time->dts + self->priv->paused_time;
+      offset = base_time->dts + self->priv->paused_time;
+      if (buffer->dts > offset) {
+        buffer->dts -= offset;
+      } else {
+        buffer->dts = 0;
+      }
     }
   }


changes to be able to load modbus without a seperate config file

--- src/hal/classicladder/classicladder.c
+++ src/hal/classicladder/classicladder.c
@@ -100,13 +100,30 @@

 void display_help (void)
 {
-	printf("Usage: loadusr classicladder [OPTIONS] [PATH]\n"
-			"Start classicladder PLC with an optional project path and program to load. e.g. plcdirectory/ladderprogram.clp\n"
-			"\n"
-			"           --nogui              do not create the GUI\n"
-			"-p port    --modbus_port=port   port to use for modbus server\n"
-			"-c file    --config=file        read MODBUS configuration from designated file\n"
-			);
+	printf("\nClassicLadder v"CL_RELEASE_VER_STRING"\n"CL_RELEASE_DATE_STRING"\n"
+	       "Copyright (C) 2001-2004 Marc Le Douarain\nmavati@club-internet.fr\n"
+	       "Adapted to EMC\n"
+			"\n"
+	       "ClassicLadder comes with NO WARRANTY\n"
+	       "to the extent permitted by law.\n"
+	       "\n"
+	       "You may redistribute copies of ClassicLadder\n"
+	       "under the terms of the GNU Lesser General Public Licence.\n"
+	       "See the file `lesserGPL.txt' for more information.\n");
+
+	printf("This version of Classicladder is adapted for use with EMC and HAL\n"
+               "\nUsage: classicladder [OPTIONS] [PATH]\n"
+	       "eg: loadusr -w classicladder  ladtest.clp\n"
+	       "eg: loadusr -w classicladder  --nogui ladtest.clp\n"
+	       "eg: loadusr -w classicladder  --modmaster ladtest.clp\n"
+               "\n"
+	       "   --nogui            do not create a GUI, only load a configuration\n"
+               "   --config=filename  initilize modbus master I/O & load config file-( deprecated- use --modmaster)\n"
+               "   --modmaster        initilize modbus master I/O ( modbus config is loaded with other objects )\n"
+               "   --modbus_port=portnumber  used for modbus slave using TCP ( ethernet )\n"
+               "Please also note that the classicladder realtime module must be loaded first\n"
+               "eg: loadrt classicladder_rt    for default number of ladder objects\n"
+	                    );
 	hal_exit(compId); // add for emc
 	exit(0);
 }
@@ -124,6 +141,7 @@
 		static const struct option long_options[] = {
 			{"nogui", no_argument, 0, 'n'},
 			{"config", required_argument, 0, 'c'},
+                        {"modmaster",no_argument,0,'m'},
 			{"modbus_port", required_argument, 0, 'p'},
 			{0, 0, 0, 0},
 		};
@@ -147,6 +165,9 @@
 			case 'p':
 				ModbusServerPort = atoi( optarg );
 				break;
+                        case 'm':
+                                nomodbus=0;
+                                break;
 			case '?':
 				error = 1;
 				break;


SceCamera extra enumerations

SceCamera extra enumerations

--- include/psp2/camera.h
+++ include/psp2/camera.h
@@ -78,6 +78,44 @@
 	void *pVBase;
 } SceCameraRead;

+enum SceCameraDevice {
+	SCE_CAMERA_DEVICE_FRONT = 0,
+	SCE_CAMERA_DEVICE_BACK = 1,
+};
+
+enum SceCameraResolution {
+	SCE_CAMERA_RESOLUTION_0_0  = 0,
+	SCE_CAMERA_RESOLUTION_640_480  = 1,
+	SCE_CAMERA_RESOLUTION_320_240  = 2,
+	SCE_CAMERA_RESOLUTION_160_120  = 3,
+	SCE_CAMERA_RESOLUTION_352_288  = 4,
+	SCE_CAMERA_RESOLUTION_176_144 = 5,
+	SCE_CAMERA_RESOLUTION_480_272 = 6,
+	SCE_CAMERA_RESOLUTION_640_360  = 7,
+	SCE_CAMERA_RESOLUTION_640_360_1  = 8,
+};
+
+enum SceCameraFrameRate {
+	SCE_CAMERA_FRAMERATE_3_FPS = 3,
+	SCE_CAMERA_FRAMERATE_5_FPS = 5,
+	SCE_CAMERA_FRAMERATE_7_FPS = 7,
+	SCE_CAMERA_FRAMERATE_10_FPS = 10,
+	SCE_CAMERA_FRAMERATE_15_FPS = 15,
+	SCE_CAMERA_FRAMERATE_20_FPS = 20,
+	SCE_CAMERA_FRAMERATE_30_FPS = 30,
+	SCE_CAMERA_FRAMERATE_60_FPS = 60,
+};
+
+enum SceCameraFxMode {
+	SCE_CAMERA_FXMODE_NORMAL = 0,
+	SCE_CAMERA_FXMODE_NEGATIVE = 1,
+	SCE_CAMERA_FXMODE_BLACKWHITE = 2,
+	SCE_CAMERA_FXMODE_SEPIA = 3,
+	SCE_CAMERA_FXMODE_BLUE = 4,
+	SCE_CAMERA_FXMODE_RED = 5,
+	SCE_CAMERA_FXMODE_GREEN = 6,
+};
+
 int sceCameraOpen(int devnum, SceCameraInfo *pInfo);
 int sceCameraClose(int devnum);
 int sceCameraStart(int devnum);


Fix typo in macros.h

Fix typo in macros.h

[ci skip]

--- include/tins/macros.h
+++ include/tins/macros.h
@@ -47,7 +47,7 @@
     #define TINS_LIKELY(x) (x)
     #define TINS_UNLIKELY(x) (x)
 #else
-    // Not Vistual Studio. Assume this is gcc compatible
+    // Not Visual Studio. Assume this is gcc compatible
     #define TINS_BEGIN_PACK
     #define TINS_END_PACK __attribute__((packed))
     #define TINS_PACKED(DECLARATION) DECLARATION __attribute__((packed))


tests: sleep: rename function to be consistent

Get the reporting right and consistent with other tests.

Signed-off-by: Anas Nashif <0d9952ec84ac43c159f6b7e7ed99a9080c00dd6e@intel.com>

--- tests/kernel/sleep/src/sleep.c
+++ tests/kernel/sleep/src/sleep.c
@@ -181,7 +181,7 @@
 	irq_offload(irq_offload_isr, (void *)test_thread_id);
 }

-void testing_sleep(void)
+void test_sleep(void)
 {
 	int       status = TC_FAIL;
 	u32_t  start_tick;
@@ -240,6 +240,7 @@
 /*test case main entry*/
 void test_main(void)
 {
-	ztest_test_suite(test_sleep, ztest_unit_test(testing_sleep));
-	ztest_run_test_suite(test_sleep);
-}
+	ztest_test_suite(testing_sleep,
+			ztest_unit_test(test_sleep));
+	ztest_run_test_suite(testing_sleep);
+}


vdpau.h: Document exact bitstream data requirements

--- include/vdpau/vdpau.h
+++ include/vdpau/vdpau.h
@@ -340,7 +340,93 @@
  * precise pixel layout is included with the documentation of
  * each surface type. For example, see \ref
  * VDP_RGBA_FORMAT_B8G8R8A8.
- *
+ *
+ * \section video_decoder_usage Video Decoder Usage
+ *
+ * VDPAU is a slice-level API. Put another way, VDPAU implementations accept
+ * "slice" data from the bitstream, and perform all required processing of
+ * those slices (e.g VLD decoding, IDCT, motion compensation, in-loop
+ * deblocking, etc.).
+ *
+ * The client application is responsible for:
+ *
+ * - Extracting the slices from the bitstream (e.g. parsing/demultiplexing
+ *   container formats, scanning the data to determine slice start positions
+ *   and slice sizes).
+ * - Parsing various bitstream headers/structures (e.g. sequence header,
+ *   sequence parameter set, picture parameter set, entry point structures,
+ *   etc.) Various fields from the parsed header structures needs to be
+ *   provided to VDPAU alongside the slice bitstream in a "picture info"
+ *   structure.
+ * - Surface management (e.g. H.264 DPB processing, display re-ordering)
+ *
+ * It is recommended that applications pass solely the slice data to VDPAU;
+ * specifically that any header data structures be excluded from the portion
+ * of the bitstream passed to VDPAU. VDPAU implementations must operate
+ * correctly if non-slice data is included, at least for formats employing
+ * start codes to delimit slice data. However, any extra data may need
+ * to be uploaded to hardware for parsing thus lowering performance, and/or,
+ * in the worst case, may even overflow internal buffers that are sized solely
+ * for slice data.
+ *
+ * The exact data that should be passed to VDPAU is detailed below for each
+ * supported format:
+ *
+ * \subsection MPEG-1 and MPEG-2
+ *
+ * Include all slices beginning with start codes 0x00000101 through
+ * 0x000001AF. The slice start code must be included for all slices.
+ *
+ * \subsection H.264
+ *
+ * Include all NALs with nal_unit_type of 1 or 5 (coded slice of non-IDR/IDR
+ * picture respectively). The complete slice start code (including 0x000001
+ * prefix) must be included for all slices, even when the prefix is not
+ * included in the bitstream.
+ *
+ * Note that if desired:
+ *
+ * - The slice start code prefix may be included in a separate bitstream
+ *   buffer array entry to the actual slice data extracted from the bitstream.
+ * - Multiple bitstream buffer array entries (e.g. one per slice) may point at
+ *   the same physical data storage for the slice start code prefix.
+ *
+ * \subsection VC-1 Simple and Main Profile
+ *
+ * VC-1 simple/main profile bitstreams always consist of a single slice per
+ * picture, and do not use start codes to delimit pictures. Instead, the
+ * container format must indicate where each picture begins/ends.
+ *
+ * As such, no slice start codes should be included in the data passed to
+ * VDPAU; simply pass in the exact data from the bitstream.
+ *
+ * Header information contained in the bitstream should be parsed by the
+ * application and passed to VDPAU using the "picture info" data structure;
+ * this header information explicitly must not be included in the bitstream
+ * data passed to VDPAU for this encoding format.
+ *
+ * \subsection VC-1 Advanced Profile
+ *
+ * Include all slices beginning with start codes 0x0000010D (frame),
+ * 0x0000010C (field) or 0x0000010B (slice). The slice start code should be
+ * included in all cases.
+ *
+ * Some VC-1 advanced profile streams do not contain slice start codes; again,
+ * the container format must indicate where picture data begins and ends. In
+ * this case, pictures are assumed to be progressive and to contain a single
+ * slice. It is highly recommended that applications detect this condition,
+ * and add the missing start codes to the bitstream passed to VDPAU. However,
+ * VDPAU implementations must allow bitstreams with missing start codes, and
+ * act as if a 0x0000010D (frame) start code had been present.
+ *
+ * Note that pictures containing multiple slices, or interlace streams, must
+ * contain a complete set of slice start codes in the original bitstream;
+ * without them, it is not possible to correctly parse and decode the stream.
+ *
+ * The bitstream passed to VDPAU should contain all original emulation
+ * prevention bytes present in the original bitstream; do not remove these
+ * from the bitstream.
+ *
  * \section video_mixer_usage Video Mixer Usage
  *
  * \subsection video_surface_content VdpVideoSurface Content


tests: blob: remove unused callback function

--- tests/object/blob/fromstream.c
+++ tests/object/blob/fromstream.c
@@ -15,22 +15,6 @@
 void test_object_blob_fromstream__cleanup(void)
 {
 	cl_git_sandbox_cleanup();
-}
-
-static int text_chunked_source_cb(char *content, size_t max_length, void *payload)
-{
-	int *count;
-
-	GIT_UNUSED(max_length);
-
-	count = (int *)payload;
-	(*count)--;
-
-	if (*count == 0)
-		return 0;
-
-	strcpy(content, textual_content);
-	return (int)strlen(textual_content);
 }

 void test_object_blob_fromstream__multiple_write(void)


fix warnings/errors on some compilers

fix warnings/errors on some compilers

--- include/yal/entries.h
+++ include/yal/entries.h
@@ -72,13 +72,15 @@

         private:
             template <class T>
-            typename std::enable_if<sizeof(T*) == 4, void>::type printPointer(fmt::MemoryWriter& buffer, const T* value)
+            void printPointer(fmt::MemoryWriter& buffer, const T* value,
+                typename std::enable_if<sizeof(T*) == 4, void>::type* dummy = nullptr)
             {
                 buffer.write("{0:0=#10x}", reinterpret_cast<const uint32_t>(value));
             }

             template <class T>
-            typename std::enable_if<sizeof(T*) == 8, EntryMaker&>::type printPointer(fmt::MemoryWriter& buffer, const T* value)
+            void printPointer(fmt::MemoryWriter& buffer, const T* value,
+                typename std::enable_if<sizeof(T*) == 8, void>::type* dummy = nullptr)
             {
                 buffer.write("{0:0=#10x}", reinterpret_cast<const uint64_t>(value));
             }


Refactoring: more specific type declaration


Use LocationHandler* in kernel cache key. This can avoid cache collision if executing multiple bef file. Because each bef file will have its own LocationHandler*. Eager execution has its own LocationHandler* as well.

PiperOrigin-RevId: 346847700


anv: Fix shader key hashing

anv: Fix shader key hashing

This was copied from inline code to a helper and wasn't updated to hash
a pointer instead.

--- src/intel/vulkan/anv_pipeline_cache.c
+++ src/intel/vulkan/anv_pipeline_cache.c
@@ -86,7 +86,7 @@
    struct mesa_sha1 *ctx;

    ctx = _mesa_sha1_init();
-   _mesa_sha1_update(ctx, &key, sizeof(key));
+   _mesa_sha1_update(ctx, key, key_size);
    _mesa_sha1_update(ctx, module->sha1, sizeof(module->sha1));
    _mesa_sha1_update(ctx, entrypoint, strlen(entrypoint));
    /* hash in shader stage, pipeline layout? */


distributiontest: default to jump hash

distributiontest: default to jump hash

--- issues/distributiontest.c
+++ issues/distributiontest.c
@@ -75,7 +75,7 @@
 	}

 	/* build hash-ring */
-	r = ch_new(FNV1a);  /* or CARBON */
+	r = ch_new(JUMP_FNV1a);  /* or CARBON, FNV1a */
 	for (i = 0; i < SRVCNT; i++) {
 		char ip[24];
 		unsigned char md5[MD5_DIGEST_LENGTH];


mv dst_.reset to CodeContextPrologue

mv dst_.reset to CodeContextPrologue

--- iv/lv5/railgun/compiler.h
+++ iv/lv5/railgun/compiler.h
@@ -667,7 +667,6 @@
     current_variable_scope_ =
         std::shared_ptr<VariableScope>(
             new CodeScope<TYPE>(&lit, upper, &scope, is_eval_decl));
-    dst_.reset();
     {
       // binding instantiation
       if (TYPE == Code::FUNCTION) {


change the order of arguments

change the order of arguments

--- ngx_http_akamai_token_filter_module.c
+++ ngx_http_akamai_token_filter_module.c
@@ -544,9 +544,9 @@
 ngx_http_akamai_token_call_next_filter(
 	ngx_http_request_t *r,
 	time_t expires,
-	time_t last_modified,
-	ngx_str_t* last_modified_str,
-	ngx_str_t* cache_scope)
+	ngx_str_t* cache_scope,
+	time_t last_modified,
+	ngx_str_t* last_modified_str)
 {
 	ngx_table_elt_t *h;
 	ngx_int_t rc;
@@ -629,9 +629,9 @@
         return ngx_http_akamai_token_call_next_filter(
 			r,
 			conf->expires_time,
+			&conf->cache_scope,
 			conf->last_modified_time,
-			&conf->last_modified,
-			&conf->cache_scope);
+			&conf->last_modified);
     }

 	// check the file name
@@ -663,9 +663,9 @@
 			return ngx_http_akamai_token_call_next_filter(
 				r,
 				conf->expires_time,
+				&conf->cache_scope,
 				conf->last_modified_time,
-				&conf->last_modified,
-				&conf->cache_scope);
+				&conf->last_modified);
 		}
 	}

@@ -717,9 +717,9 @@
 		return ngx_http_akamai_token_call_next_filter(
 			r,
 			conf->query_token_expires_time,
+			&conf->token_cache_scope,
 			conf->token_last_modified_time,
-			&conf->token_last_modified,
-			&conf->token_cache_scope);
+			&conf->token_last_modified);
 	}
 	else
 	{
@@ -736,9 +736,9 @@
 		return ngx_http_akamai_token_call_next_filter(
 			r,
 			conf->cookie_token_expires_time,
+			&conf->token_cache_scope,
 			conf->token_last_modified_time,
-			&conf->token_last_modified,
-			&conf->token_cache_scope);
+			&conf->token_last_modified);
 	}
 }


fix initialization

fix initialization

--- sbc/sbc.c
+++ sbc/sbc.c
@@ -705,7 +705,10 @@
 {
 	memset(&state->X, 0, sizeof(state->X));
 	state->subbands = frame->subbands;
-	state->position[0] = state->position[1] = 80;
+	if(frame->subbands == 8)
+		state->position[0] = state->position[1] = 72;
+	else
+		state->position[0] = state->position[1] = 36;
 }

 static inline void _sbc_analyze_four(const int32_t *in, int32_t *out)


sbc: use an uint16 to store frame length in internal frame structure

Otherwise it could overflow in some cases.
For instance in DUAL_CHANNEL mode, with subbands set to SBC_SB_8, blocks
set to SBC_BLK_16 and bitpool set to 64 results in a frame length of 268.

--- sbc/sbc.c
+++ sbc/sbc.c
@@ -119,7 +119,7 @@
 	uint8_t subbands;
 	uint8_t bitpool;
 	uint16_t codesize;
-	uint8_t length;
+	uint16_t length;

 	/* bit number x set means joint stereo has been used in subband x */
 	uint8_t joint;


fix nvtt build fail on vs2015sp1

fix nvtt build fail on vs2015sp1

--- share/nvtt/nvidia-texture-tools/src/nvcore/DefsVcWin32.h
+++ share/nvtt/nvidia-texture-tools/src/nvcore/DefsVcWin32.h
@@ -18,8 +18,9 @@
 #define NV_CONST

 // Set standard function names.
+#if _MSC_VER < 1900
 #define snprintf _snprintf
-#if _MSC_VER < 1500
+#elif _MSC_VER < 1500
 #	define vsnprintf _vsnprintf
 #endif
 #define vsscanf _vsscanf


small change

small change

--- commonfs.h
+++ commonfs.h
@@ -200,4 +200,4 @@
 void cloudfs_debug(int dbg);
 void debugf(int level, char* fmt, ...);

-#endif
+#endif


gnrc_ipv6_nib: fix index calculation

gnrc_ipv6_nib: fix index calculation

We must divide the pointer difference (in bytes) by the size of
the individual elements to get the index of the element.

--- sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c
+++ sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c
@@ -522,6 +522,11 @@
 }

 #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C
+static inline unsigned _idx_dsts(const _nib_offl_entry_t *dst)
+{
+    return (dst - _dsts) / sizeof(*dst);
+}
+
 static inline bool _in_abrs(const _nib_abr_entry_t *abr)
 {
     return (abr < (_abrs + GNRC_IPV6_NIB_ABR_NUMOF));
@@ -655,7 +660,7 @@
 {
     _nib_offl_remove(nib_offl, _PL);
 #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C
-    unsigned idx = nib_offl - _dsts;
+    unsigned idx = _idx_dsts(nib_offl);
     if (idx < GNRC_IPV6_NIB_OFFL_NUMOF) {
         for (_nib_abr_entry_t *abr = _abrs; _in_abrs(abr); abr++) {
             if (bf_isset(abr->pfxs, idx)) {
@@ -731,7 +736,7 @@
 void _nib_abr_add_pfx(_nib_abr_entry_t *abr, const _nib_offl_entry_t *offl)
 {
     assert((abr != NULL) && (offl != NULL) && (offl->mode & _PL));
-    unsigned idx = (unsigned)(_dsts - offl);
+    unsigned idx = _idx_dsts(offl);

     DEBUG("nib: Prefix %s/%u ",
           ipv6_addr_to_str(addr_str, &offl->pfx, sizeof(addr_str)),
@@ -747,14 +752,14 @@
                                      const _nib_offl_entry_t *last)
 {
     if ((last == NULL) ||
-        (((unsigned)(_dsts - last)) < GNRC_IPV6_NIB_OFFL_NUMOF)) {
+        (_idx_dsts(last) < GNRC_IPV6_NIB_OFFL_NUMOF)) {
         /* we don't change `ptr`, so dropping const qualifier for now is okay */
         _nib_offl_entry_t *ptr = (_nib_offl_entry_t *)last;

         while ((ptr = _nib_offl_iter(ptr))) {
             /* bf_isset() discards const, but doesn't change the array, so
              * discarding it on purpose */
-            if ((ptr->mode & _PL) && (bf_isset((uint8_t *)abr->pfxs, ptr - _dsts))) {
+            if ((ptr->mode & _PL) && (bf_isset((uint8_t *)abr->pfxs, _idx_dsts(ptr)))) {
                 return ptr;
             }
         }


In ecpglib restore LC_NUMERIC in case of an error.

--- src/interfaces/ecpg/ecpglib/execute.c
+++ src/interfaces/ecpg/ecpglib/execute.c
@@ -1492,7 +1492,11 @@
 	if (statement_type == ECPGst_prepnormal)
 	{
 		if (!ecpg_auto_prepare(lineno, connection_name, compat, questionmarks, &prepname, query))
+			setlocale(LC_NUMERIC, oldlocale);
+			ecpg_free(oldlocale);
+			va_end(args);
 			return (false);
+		}

 		/*
 		 * statement is now prepared, so instead of the query we have to


Remove counter from nordic critical HAL implementation

hal_critical_section_enter() is safe to call multiple times, however
hal_critical_section_exit() is only called on the last exit from a
critical section. This will cause a mismatch in the counter and the
interrupt state will never be restored if the critical section is
nested. Change this to a bool so that the interrupt save state is
tracked for hal_in_critical_section() to work correctly.

--- targets/TARGET_NORDIC/TARGET_NRF5/nordic_critical.c
+++ targets/TARGET_NORDIC/TARGET_NRF5/nordic_critical.c
@@ -19,7 +19,7 @@
 #include "app_util_platform.h"

 #if defined(SOFTDEVICE_PRESENT)
-static volatile uint32_t nordic_cr_nested = 0;
+static volatile bool state_saved = false;

 static void nordic_nvic_critical_region_enter(void);
 static void nordic_nvic_critical_region_exit(void);
@@ -56,7 +56,7 @@

 bool hal_in_critical_section(void)
 {
-    return (nordic_cr_nested != 0);
+    return (state_saved != 0);
 }

@@ -70,7 +70,7 @@
 {
     int was_masked = __sd_nvic_irq_disable();

-    if (nordic_cr_nested == 0) {
+    if (state_saved == false) {
             nrf_nvic_state.__irq_masks[0] = ( NVIC->ICER[0] & __NRF_NVIC_APP_IRQS_0 );
             NVIC->ICER[0] = __NRF_NVIC_APP_IRQS_0;
 #ifdef NRF52
@@ -79,7 +79,7 @@
 #endif
     }

-    nordic_cr_nested++;
+    state_saved = true;

     if (!was_masked) {
         __sd_nvic_irq_enable();
@@ -93,17 +93,15 @@
  */
 static inline void nordic_nvic_critical_region_exit(void)
 {
-    nordic_cr_nested--;
+    state_saved = false;

-    if (nordic_cr_nested == 0) {
-        int was_masked = __sd_nvic_irq_disable();
-        NVIC->ISER[0] = nrf_nvic_state.__irq_masks[0];
+    int was_masked = __sd_nvic_irq_disable();
+    NVIC->ISER[0] = nrf_nvic_state.__irq_masks[0];
 #ifdef NRF52
-        NVIC->ISER[1] = nrf_nvic_state.__irq_masks[1];
+    NVIC->ISER[1] = nrf_nvic_state.__irq_masks[1];
 #endif
-        if (!was_masked) {
-        __sd_nvic_irq_enable();
-        }
+    if (!was_masked) {
+    __sd_nvic_irq_enable();
     }
 }
 #endif


tifflike: Fix compiler warnings with libtiff < 4

The TIFFDataType enum of libtiff < 4 doesn't include the BigTIFF type
values.  There's no reason we need to use the enum, so drop it.

--- src/openslide-decode-tifflike.c
+++ src/openslide-decode-tifflike.c
@@ -47,7 +47,7 @@
 };

 struct tiff_item {
-  TIFFDataType type;
+  uint16_t type;
   int64_t count;
   void *value;
 };
@@ -252,7 +252,7 @@

     // allocate the item
     struct tiff_item *item = g_slice_new(struct tiff_item);
-    item->type = (TIFFDataType) type;
+    item->type = type;
     item->count = count;

     // load the value


[Matrix]: allow EM matrix to be persistent in SAFS.

--- matrix/EM_dense_matrix.h
+++ matrix/EM_dense_matrix.h
@@ -147,6 +147,14 @@
 			const std::vector<off_t> &idxs) const;
 	virtual std::shared_ptr<const vec_store> get_col_vec(off_t idx) const;
 	virtual std::shared_ptr<const vec_store> get_row_vec(off_t idx) const;
+
+	/*
+	 * Set this matrix persistent in SAFS, so that even if there isn't
+	 * a reference to the matrix, its data still stored in SAFS.
+	 */
+	bool set_persistent(const std::string &name) const {
+		return holder->set_persistent(name);
+	}
 };

 }


git-svn-id: svn://obiwan/Jaguar@493 1d14b586-ad98-11dc-b037-dddde97c3f5c

error: pathspec 'stdio/fgetc.c' did not match any file(s) known to git

--- stdio/fgetc.c
+++ stdio/fgetc.c
@@ -0,0 +1,28 @@
+/* Jaguar C library */
+/* Copyright (C) 2006 Seb/The Removers */
+/* http://removers.atari.org/ */
+
+/* This library is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU Lesser General Public */
+/* License as published by the Free Software Foundation; either */
+/* version 2.1 of the License, or (at your option) any later version. */
+
+/* This library is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU */
+/* Lesser General Public License for more details. */
+
+/* You should have received a copy of the GNU Lesser General Public */
+/* License along with this library; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA */
+
+#include <stdio.h>
+
+int fgetc(FILE *stream) {
+  if(stream->getc != NULL) {
+    return stream->getc(stream);
+  } else {
+    return EOF;
+  }
+}
+


remove dafault(None) (#1477)

remove dafault(None) (#1477)

--- mdtraj/rmsd/src/center.c
+++ mdtraj/rmsd/src/center.c
@@ -19,7 +19,7 @@
     __m128 x, y, z, x2, y2, z2;

     #ifdef _OPENMP
-    #pragma omp parallel for default(none) shared(coords, traces, n_frames, n_atoms) \
+    #pragma omp parallel for shared(coords, traces) \
         private(sx_, sy_, sz_, trace_, mux_, muy_, muz_, sxf, syf, szf, \
         confp, i, x, y, z, x2, y2, z2, sx, sy, sz, trace)
     #endif


Some update to revise

Some update to revise

--- AVL/avl_tree.h
+++ AVL/avl_tree.h
@@ -21,13 +21,9 @@

     void printElem(Node_T *&p);

-    void singleLeftRotation(Node_T *&p);
-
-    void singleRightRotation(Node_T *&p);
-
-    void doubleLeftRotation(Node_T *&p);
-
-    void doubleRightRotation(Node_T *&p);
+    void singleRotation(Node_T *&p);
+
+    void doubleRotation(Node_T *&p);

 public:

@@ -42,6 +38,8 @@
     bool remove(T &d);

     int height();
+
+    void balance(Node_T *ptr = m_pRoot);

     void printIn();

@@ -77,13 +75,12 @@
 }

 template <typename T>
-void AVL_tree<T>::singleLeftRotation(Node_T *&p) {
-
-}
-
-template <typename T>
-void AVL_tree<T>::singleRightRotation(Node_T *&p) {
-
+void AVL_tree<T>::singleRotation(Node_T *&p, int way) {
+    Node_T *Child = p->m_pChildren[!way],
+           *tmp = Child->m_pChildren[way];
+    Child->m_pChildren[way] = p;
+    parent->m_pChildren[!way] = tmp;
+    p = Child;
 }

 template <typename T>
@@ -95,20 +92,6 @@
 void AVL_tree<T>::doubleRightRotation(Node_T *&p) {

 }
-
-//template <typename T>
-//bool AVL_tree<T>::insert(T &d) {
-//    Node_T **p;
-//    if(find(d, p))
-//        return false;
-//    *p = new Node_T(d);
-//    m_size++;
-
-//    balance();
-//    m_pRoot->update_height();
-
-//    return true;
-//}

 template <typename T>
 bool AVL_tree<T>::insert(T &d, Node_T *&p = m_pRoot) {
@@ -125,10 +108,12 @@
         case -1:
         case 1:
             return true;
-        case -2:    //Heavy Left
-            break;
-        case 2:     //Heavy Right
-            break;
+        case -2:    //Left Heavy
+//          do_stuff();
+            return true;
+        case 2:     //Right Heavy
+//          do_stuff();
+            return true;
         default:
             throw 0;
         }


Add join table query extension for litesql

error: pathspec 'src/pcre_check/litesql_helper.h' did not match any file(s) known to git

--- src/pcre_check/litesql_helper.h
+++ src/pcre_check/litesql_helper.h
@@ -0,0 +1,189 @@
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/container/map/map_fwd.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/fusion/include/has_key.hpp>
+#include <boost/fusion/include/map.hpp>
+#include <boost/fusion/include/map_fwd.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+
+#include <litesql.hpp>
+
+class JoinedQuery {
+  bool _distinct;
+  int _limit, _offset;
+  litesql::Split _results;
+  litesql::Split _sources;
+  std::string _where;
+  litesql::Split _groupBy;
+  std::string _having;
+  litesql::Split _orderBy;
+
+public:
+  JoinedQuery() : _distinct(false), _limit(0), _offset(0), _where("True") {}
+  JoinedQuery& distinct(bool d)
+  {
+    _distinct = d;
+    return *this;
+  }
+  JoinedQuery& limit(int value)
+  {
+    _limit = value;
+    return *this;
+  }
+
+  JoinedQuery& offset(int value)
+  {
+    _offset = value;
+    return *this;
+  }
+
+  JoinedQuery& result(std::string r)
+  {
+    _results.push_back(r);
+    return *this;
+  }
+
+  JoinedQuery& clearResults()
+  {
+    _results.clear();
+    return *this;
+  }
+
+  JoinedQuery& source(std::string s, std::string alias = "")
+  {
+    if (!alias.empty())
+      s += " AS " + alias;
+    _sources.push_back(s);
+    return *this;
+  }
+
+  JoinedQuery& where(const litesql::Expr& w)
+  {
+    _where = (litesql::RawExpr(_where) && w).asString();
+    return *this;
+  }
+
+  JoinedQuery& where(std::string w)
+  {
+    _where = (litesql::RawExpr(_where) && litesql::RawExpr(w)).asString();
+    return *this;
+  }
+
+  JoinedQuery& groupBy(std::string gb)
+  {
+    _groupBy.push_back(gb);
+    return *this;
+  }
+
+  JoinedQuery& having(const litesql::Expr& h)
+  {
+    _having = h.asString();
+    return *this;
+  }
+
+  JoinedQuery& having(std::string h)
+  {
+    _having = h;
+    return *this;
+  }
+
+  JoinedQuery& orderBy(std::string ob, bool ascending = true)
+  {
+    std::string value = ob;
+    if (!ascending)
+      value += " DESC";
+    _orderBy.push_back(value);
+    return *this;
+  }
+
+  operator std::string() const
+  {
+    std::string res = "SELECT ";
+    if (_distinct)
+      res += "DISTINCT ";
+    res += _results.join(",");
+    res += " FROM ";
+    res += _sources.join(",");
+    if (_where != "True")
+      res += " WHERE " + _where;
+    if (_groupBy.size() > 0)
+      res += " GROUP BY " + _groupBy.join(",");
+    if (!_having.empty())
+      res += " HAVING " + _having;
+    if (_orderBy.size() > 0)
+      res += " ORDER BY " + _orderBy.join(",");
+    if (_limit)
+      res += " LIMIT " + litesql::toString(_limit);
+    if (_offset)
+      res += " OFFSET " + litesql::toString(_offset);
+    return res;
+  }
+
+  std::string asString() const { return this->operator std::string(); }
+};
+
+template <typename... T> class JoinedSource {
+public:
+  typedef boost::fusion::map<boost::fusion::pair<T, std::pair<int, int>>...>
+      map_type;
+
+  JoinedSource(const litesql::Database& db_, bool leftjoin = false)
+      : db(db_), typeMap(boost::fusion::make_pair<T>(std::make_pair(0, 0))...)
+  {
+    setupInternal();
+  }
+
+  litesql::Records queryRaw(const litesql::Expr& e = litesql::Expr())
+  {
+    JoinedQuery sel;
+
+    for (size_t i = 0; i < tables.size(); i++)
+      sel.source(tables[i]);
+    sel.where(e.asString());
+    for (size_t i = 0; i < fdatas.size(); i++)
+      sel.result(fdatas[i].table() + "." + fdatas[i].name());
+
+    return db.query(sel);
+  }
+
+private:
+  struct fill_field_type {
+    fill_field_type(std::vector<litesql::FieldType>& fdatas_)
+        : fdatasRef(fdatas_)
+    {
+    }
+    template <typename U> void operator()(U&) const
+    {
+      U::first_type::getFieldTypes(fdatasRef);
+    }
+
+  private:
+    std::vector<litesql::FieldType>& fdatasRef;
+  };
+
+  void setupInternal()
+  {
+    boost::fusion::for_each(typeMap, fill_field_type(fdatas));
+
+    for (size_t i = 0; i < fdatas.size(); i++)
+      if (tableSet.find(fdatas[i].table()) == tableSet.end()) {
+        tables.push_back(fdatas[i].table());
+        tableSet.insert(fdatas[i].table());
+      }
+  }
+
+  const litesql::Database& db;
+
+  // helper data
+  map_type typeMap;
+  std::vector<litesql::FieldType> fdatas;
+  litesql::Split tables;
+  std::set<std::string> tableSet;
+};


use 'typedef' instead of 'using' to compile on gcc4.8.2

--- tensorflow/core/distributed_runtime/rpc/grpc_call.h
+++ tensorflow/core/distributed_runtime/rpc/grpc_call.h
@@ -247,7 +247,7 @@

   // Used as void* completion markers from grpc to indicate different
   // events of interest for a Call.
-  using typename UntypedCall<Service>::Tag;
+  typedef typename UntypedCall<Service>::Tag Tag;
   Tag request_received_tag_{this, Tag::kRequestReceived};
   Tag response_sent_tag_{this, Tag::kResponseSent};
   Tag cancelled_tag_{this, Tag::kCancelled};


make format() const

make format() const

svn path=/trunk/KDE/kdepim/akregator/; revision=486316

--- akregator/src/libsyndication/src/abstractparser.h
+++ akregator/src/libsyndication/src/abstractparser.h
@@ -74,7 +74,7 @@
          *
          * @return a string like "rss2", "atom" or "rdf"
          */
-        virtual QString format() const = 0;
+        virtual QString format() = 0;
 };

 } // namespace LibSyndication


CID #1271336 fix the fix that was bad

CID #1271336 fix the fix that was bad

--- proxy/http2/Http2ConnectionState.h
+++ proxy/http2/Http2ConnectionState.h
@@ -71,9 +71,13 @@
   unsigned
   set(Http2SettingsIdentifier id, unsigned value)
   {
-    ink_assert(id < HTTP2_SETTINGS_MAX);
-
-    return this->settings[indexof(id)] = value;
+    if (id < HTTP2_SETTINGS_MAX) {
+      return this->settings[indexof(id)] = value;
+    } else {
+      ink_assert(!"Bad Settings Identifier");
+    }
+
+    return 0;
   }

 private:


modify journal logging

modify journal logging

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@11746 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- psc_fsutil_libs/psc_util/journal.c
+++ psc_fsutil_libs/psc_util/journal.c
@@ -390,11 +390,15 @@

 	PJ_ULOCK(pj);

-	psc_info("Writing a log entry for transaction %"PRIx64": "
-	    "transaction tail = %d, log tail = %d",
+	psc_info("Writing a log entry xid=%"PRIx64": xtail = %d, ltail = %d",
 	    xh->pjx_xid, xh->pjx_tailslot, tail_slot);

 	rc = pjournal_logwrite_internal(xh, slot, type, data, size);
+
+	psc_info("Completed writing log entry xid=%"PRIx64
+		 ": xtail = %d, ltail = %d",
+		 xh->pjx_xid, xh->pjx_tailslot, tail_slot);
+
 	return (rc);
 }


Use PJ_PJESZ(&pj)

Use PJ_PJESZ(&pj)

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@8651 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- psc_fsutil_libs/psc_util/journal.c
+++ psc_fsutil_libs/psc_util/journal.c
@@ -633,7 +633,8 @@

 		count = (nents - slot <= ra) ? (nents - slot) : ra;
 		for (i = 0; i < count; i++) {
-			pje = (struct psc_journal_enthdr *)&jbuf[pjh.pjh_entsz * i];
+
+			pje = (struct psc_journal_enthdr *)&jbuf[PJ_PJESZ(&pj) * i];
 			pje->pje_magic = PJE_MAGIC;
 			pje->pje_type = PJE_FORMAT;
 			pje->pje_xid = PJE_XID_NONE;
@@ -647,10 +648,10 @@

 			pje->pje_chksum = chksum;
 		}
-		size = pwrite(fd, jbuf, pjh.pjh_entsz * count,
+		size = pwrite(fd, jbuf, PJ_PJESZ(&pj) * count,
 			(off_t)(PJE_OFFSET + (slot * pjh.pjh_entsz)));
 		/* At least on one instance, short write actually returns success on a RAM-backed file system */
-		if (size < 0 || size != pjh.pjh_entsz * count) {
+		if (size < 0 || size != PJ_PJESZ(&pj) * count) {
 			psc_fatal("Failed to write %d entries at slot %d", count, slot);
 		}
 	}


Throw python error if no video found

Throw python error if no video found

--- impl/src/findvidWrapper.c
+++ impl/src/findvidWrapper.c
@@ -48,7 +48,7 @@
 PyObject * getFeaturesWrapper(PyObject *self, PyObject *args) {
 	const char * filename;
 	const char * hashstring;
-	char defaultpath[64] = "/video/videosearch/findvid/thumbnails";
+	char defaultpath[64] = "/video2/videosearch/findvid/thumbnails";
 	const char * path = defaultpath;

 	int vidThumb = 0;
@@ -83,7 +83,13 @@
 	}

 	FeatureTuple * results = getFeatures(filename, hashstring, path, vidThumb, scenes,(int)size);
-	printf("Got features\n");
+	if (!results) {
+			char err[128];
+			sprintf(err, "Video could not be opened!");
+			PyErr_SetString(PyExc_TypeError, err);
+			return NULL;
+	}
+
 	if (size > results->feature_count) {
 		fprintf(stderr, "Warning: Some keyframes could not be extracted!\n");
 		size = (Py_ssize_t)results->feature_count;


Prefer old-fashioned NULL to nullptr

Prefer old-fashioned NULL to nullptr

--- include/EventDispatcher.h
+++ include/EventDispatcher.h
@@ -67,7 +67,7 @@
         // Notify all observers of the same type
         for(int i = 0; i < event->parameter->getNumObservers(); ++i) {
           PluginParameterObserver* observer = event->parameter->getObserver(i);
-          if(observer != nullptr &&
+          if(observer != NULL &&
              observer->isRealtimePriority() == isRealtime &&
              observer != event->sender) {
             observer->onParameterUpdated(event->parameter);


Formatting

Formatting

--- include/Support/CmdLine.h
+++ include/Support/CmdLine.h
@@ -117,10 +117,14 @@
     bool expandAndParse(StringVector argv);

     // Returns the list of errors
-    StringVector const& errors() const { return errors_; }
+    StringVector const& errors() const {
+        return errors_;
+    }

     // Returns the list of unknown command line arguments
-    StringVector const& unknowns() const { return unknowns_; }
+    StringVector const& unknowns() const {
+        return unknowns_;
+    }

     // Returns the list of (unique) options, sorted by name.
     ConstOptionVector options() const;
@@ -471,28 +475,44 @@

 public:
     // Returns the name of this option
-    std::string const& name() const { return name_; }
+    std::string const& name() const {
+        return name_;
+    }

     // Return name of the value
-    std::string const& argName() const { return argName_; }
+    std::string const& argName() const {
+        return argName_;
+    }

     // Resturns the description of this option
-    std::string const& desc() const { return desc_; }
+    std::string const& desc() const {
+        return desc_;
+    }

     // Returns how often the option must/may be specified on the command line
-    NumOccurrences numOccurrences() const { return numOccurrences_; }
+    NumOccurrences numOccurrences() const {
+        return numOccurrences_;
+    }

     // Returns whether the option expects a value
-    NumArgs numArgs() const { return numArgs_; }
+    NumArgs numArgs() const {
+        return numArgs_;
+    }

     // Returns how the option might be specified
-    Formatting formatting() const { return formatting_; }
+    Formatting formatting() const {
+        return formatting_;
+    }

     // Returns other flags
-    MiscFlags flags() const { return miscFlags_; }
+    MiscFlags flags() const {
+        return miscFlags_;
+    }

     // Returns the number of times this option has been specified on the command line
-    unsigned count() const { return count_; }
+    unsigned count() const {
+        return count_;
+    }

     // Returns whether this option may be specified multiple times.
     bool isUnbounded() const;
@@ -519,8 +539,7 @@
     void apply(MiscFlags x)         { miscFlags_ = static_cast<MiscFlags>(miscFlags_ | x); }

     void apply(OptionGroup& x) {
-        // FIXME: Check for duplicates
-        x.options_.push_back(this);
+        x.options_.push_back(this); // FIXME: Check for duplicates
     }

     template <class U>
@@ -599,16 +618,24 @@
     using value_type = RemoveReference<T>;

     // Returns the value
-    value_type& value() { return value_; }
+    value_type& value() {
+        return value_;
+    }

     // Returns the value
-    value_type const& value() const { return value_; }
+    value_type const& value() const {
+        return value_;
+    }

     // Returns a pointer to the value
-    value_type* operator->() { return std::addressof(value_); }
+    value_type* operator->() {
+        return std::addressof(value_);
+    }

     // Returns a pointer to the value
-    value_type const* operator->() const { return std::addressof(value_); }
+    value_type const* operator->() const {
+        return std::addressof(value_);
+    }
 };

 //--------------------------------------------------------------------------------------------------
@@ -646,10 +673,14 @@
     }

     // Returns the parser
-    parser_type& parser() { return parser_; }
+    parser_type& parser() {
+        return parser_;
+    }

     // Returns the parser
-    parser_type const& parser() const { return parser_; }
+    parser_type const& parser() const {
+        return parser_;
+    }

     // Returns a list of allowed values for this option
     void allowedValues(StringRefVector& vec) const override final


Some more usefulities

Some more usefulities

--- include/Support/Utility.h
+++ include/Support/Utility.h
@@ -4,12 +4,23 @@
 #pragma once

 #include <cstddef>
+#include <functional>
 #include <iterator>
 #include <type_traits>
 #include <utility>

 namespace support
 {
+
+//--------------------------------------------------------------------------------------------------
+// Misc.
+//
+
+struct NotAType {};
+
+struct AnyType {
+    template <class... Ts> AnyType(Ts&&...) {}
+};

 //--------------------------------------------------------------------------------------------------
 // Alias templates
@@ -33,14 +44,12 @@
 namespace details
 {
     template <class T>
-    struct RemoveCVRec
-    {
+    struct RemoveCVRec {
         using type = RemoveCV<T>;
     };

     template <template <class...> class T, class... A>
-    struct RemoveCVRec<T<A...>>
-    {
+    struct RemoveCVRec<T<A...>> {
         using type = T<typename RemoveCVRec<A>::type...>;
     };
 }
@@ -54,4 +63,20 @@
 template <class From, class To>
 using IsConvertible = typename std::is_convertible<From, To>::type;

+namespace details
+{
+    template <class T>
+    struct UnwrapReferenceWrapper {
+        using type = T;
+    };
+
+    template <class T>
+    struct UnwrapReferenceWrapper<std::reference_wrapper<T>> {
+        using type = T;
+    };
+}
+
+template <class T>
+using UnwrapReferenceWrapper = typename details::UnwrapReferenceWrapper<T>::type;
+
 } // namespace support


[MIPS] Fold non-__mips64 case into CONFIG_32BIT case.      Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

[MIPS] Fold non-__mips64 case into CONFIG_32BIT case.

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

--- include/asm-mips/unistd.h
+++ include/asm-mips/unistd.h
@@ -1184,10 +1184,8 @@
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
-# ifndef __mips64
+# ifdef CONFIG_32BIT
 #  define __ARCH_WANT_STAT64
-# endif
-# ifdef CONFIG_32BIT
 #  define __ARCH_WANT_SYS_TIME
 # endif
 # ifdef CONFIG_MIPS32_O32


Changed printf's to advise() calls

Changed printf's to advise() calls

--- insts/std/MOVE/setup.c
+++ insts/std/MOVE/setup.c
@@ -37,8 +37,6 @@
    for (i = 0; i < 12; i++)
       for (j = 0; j < 12; j++)
          _Matrix[j][i] = 0.72 * default_matrix[j][i];
-
-   printf("Default matrix loaded.\n");
 }

@@ -132,7 +130,7 @@
 {
    _MikeAngle = p[0] * PI / 180.0;  /* convert to rads */
    _MikePatternFactor = (p[1] <= 1.0) ? p[1] : 1.0;
-   printf("Microphone angles: %.1f degrees, Pattern factor: %.1f\n",
+   advise("mikes", "Microphone angles: %.1f degrees, Pattern factor: %.1f",
           p[0], _MikePatternFactor);
    _UseMikes = 1;

@@ -146,7 +144,7 @@
 double
 mikes_off(float p[], int n_args)
 {
-   printf("Microphone usage turned off.\n");
+   advise("mikes", "Microphone usage turned off.\n");
    _UseMikes = 0;

    return 0.0;
@@ -179,7 +177,7 @@
             _Matrix[i][j] = val * amp;
          }
       }
-      printf("Matrix loaded.\n");
+      advise("matrix", "Matrix loaded.\n");
       matrix_flag = 1;
    }
    else


ARM: shmobile: kzm9g-reference: Remove unneeded nr_irqs initialization

As per arch_probe_nr_irqs(), the default value is NR_IRQS, which maps to
NR_IRQS_LEGACY if CONFIG_SPARSE_IRQ=y.

Since SPARSE_IRQ is selected by both ARCH_MULTIPLATFORM and
ARCH_SHMOBILE_LEGACY, it's always enabled on shmobile.

Signed-off-by: Geert Uytterhoeven <a1ff81395f7e6bf5b509fe9aab06bf3419493e1d@glider.be>
Signed-off-by: Simon Horman <9662bddcc379be37df16f02a449c344b4718c1a1@verge.net.au>

--- arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -52,7 +52,6 @@
 	.smp		= smp_ops(sh73a0_smp_ops),
 	.map_io		= sh73a0_map_io,
 	.init_early	= sh73a0_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_machine	= kzm_init,
 	.init_late	= shmobile_init_late,
 	.dt_compat	= kzm9g_boards_compat_dt,


ignore sig pipe

ignore sig pipe

--- APPS/incast/incast_client.c
+++ APPS/incast/incast_client.c
@@ -1,4 +1,5 @@
 #include <incast_fmt.h>
+#include <sys/signal.h>

 struct incast_control ctrl;

@@ -233,6 +234,7 @@
 		goto use;
 	}
 	/* Setup our list and init things */
+	signal(SIGPIPE, SIG_IGN);
 	LIST_INIT(&ctrl.master_list);
 	ctrl.decrement_amm = 1;
 	ctrl.cnt_of_times = 1;


Adding in ffmpeg_common.h into header for definition of CodecID.

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@18459 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


Bugzilla #198: IRIX conditional compile

Bugzilla #198: IRIX conditional compile

git-svn-id: d99324e817494df82bb0080d8e7ab74680731a10@2270 13f79535-47bb-0310-9956-ffa450edef68

--- spamd/spamc.c
+++ spamd/spamc.c
@@ -35,7 +35,7 @@
 #endif

 /* SunOS 4.1.4 patch from Tom Lipkis <tal@pss.com> */
-#if defined(__sun__) && defined(__sparc__) && !defined(__svr4__)
+#if (defined(__sun__) && defined(__sparc__) && !defined(__svr4__)) || (defined(_IRIX_))
 # ifndef EX__MAX
 # define EX__MAX 77
 extern char *optarg;


pkcs15init-OpenPGP: Add store_data functions.

We need this function to use OpenPGP's specific action flow instead pkcs15init's default.
This will help to avoid redundant steps which may make the overall process fail.

--- src/pkcs15init/pkcs15-openpgp.c
+++ src/pkcs15init/pkcs15-openpgp.c
@@ -142,6 +142,58 @@
 	/* When unbinding pkcs15init, this function will be called.
 	 * But for OpenPGP, token info does not need to change, we do nothing. */
 	LOG_FUNC_RETURN(p15card->card->ctx, SC_SUCCESS);
+}
+
+static int openpgp_store_data(struct sc_pkcs15_card *p15card, struct sc_profile *profile,
+                              struct sc_pkcs15_object *obj,	struct sc_pkcs15_der *content,
+                              struct sc_path *path)
+{
+	sc_card_t *card = p15card->card;
+	sc_file_t *file;
+	sc_pkcs15_cert_info_t *cinfo;
+	sc_pkcs15_id_t *cid;
+	int r;
+
+	LOG_FUNC_CALLED(card->ctx);
+
+	switch (obj->type & SC_PKCS15_TYPE_CLASS_MASK) {
+	case SC_PKCS15_TYPE_PRKEY:
+	case SC_PKCS15_TYPE_PUBKEY:
+		/* For these two type, store_data just don't need to do anything.
+		 * All have been done already before this function is called */
+		r = SC_SUCCESS;
+		break;
+
+	case SC_PKCS15_TYPE_CERT:
+		cinfo = (sc_pkcs15_cert_info_t *) obj->data;
+		cid = &(cinfo->id);
+
+		if (cid->len != 1)
+			LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS);
+
+		/* OpenPGP card v.2 contains only 1 certificate */
+		if (cid->value[0] != 3) {
+			sc_log(card->ctx,
+			       "This version does not support certificate ID = %d (only ID=3 is supported).",
+			       cid->value[0]);
+			LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED);
+		}
+		/* Just update the certificate DO */
+		sc_format_path("7F21", path);
+		r = sc_select_file(card, path, &file);
+		LOG_TEST_RET(card->ctx, r, "Cannot select cert file");
+		r = sc_pkcs15init_authenticate(profile, p15card, file, SC_AC_OP_UPDATE);
+		if (r >= 0 && content->len)
+			r = sc_update_binary(p15card->card, 0,
+			                     (const unsigned char *) content->value,
+			                     content->len, 0);
+		break;
+
+	default:
+		r = SC_ERROR_NOT_IMPLEMENTED;
+	}
+
+	LOG_FUNC_RETURN(card->ctx, r);
 }

 static struct sc_pkcs15init_operations sc_pkcs15init_openpgp_operations = {
@@ -161,7 +213,8 @@
 	NULL,
 	openpgp_emu_update_any_df,
 	openpgp_emu_update_tokeninfo,
-	NULL, NULL, 	/* pkcs15init emulation */
+	NULL,   /* emu_write_info */
+	openpgp_store_data, /* emu_store_data */
 	NULL				/* sanity_check */
 };


branches/zip: btr_copy_externally_stored_field(): Correct the reporting and handling of inflate() errors.

--- btr/btr0cur.c
+++ btr/btr0cur.c
@@ -4229,6 +4229,7 @@
 #endif /* UNIV_SYNC_DEBUG */
 		if (UNIV_UNLIKELY(zip_size)) {
 			int	err;
+			ulint	next_page_no;

 			if (UNIV_UNLIKELY(fil_page_get_type(page)
 					  != FIL_PAGE_TYPE_ZBLOB)) {
@@ -4241,7 +4242,7 @@
 					(ulong) page_no, (ulong) space_id);
 			}

-			page_no = mach_read_from_4(page + offset);
+			next_page_no = mach_read_from_4(page + offset);

 			if (UNIV_LIKELY(offset == FIL_PAGE_NEXT)) {
 				/* When the BLOB begins at page header,
@@ -4260,14 +4261,14 @@
 			case Z_OK:
 				break;
 			case Z_STREAM_END:
-				if (page_no == FIL_NULL) {
+				if (next_page_no == FIL_NULL) {
 					goto end_of_blob;
 				}
 				/* fall through */
 			default:
+inflate_error:
 				mtr_commit(&mtr);
 				inflateEnd(&d_stream);
-inflate_error:
 				ut_print_timestamp(stderr);
 				fprintf(stderr,
 					"  InnoDB: inflate() of"
@@ -4279,7 +4280,7 @@
 				return(buf);
 			}

-			if (page_no == FIL_NULL) {
+			if (next_page_no == FIL_NULL) {
 				err = inflate(&d_stream, Z_FINISH);
 				if (UNIV_UNLIKELY(err != Z_STREAM_END)) {

@@ -4301,6 +4302,7 @@
 			/* On other BLOB pages except the first
 			the BLOB header always is at the page header: */

+			page_no = next_page_no;
 			offset = FIL_PAGE_NEXT;
 		} else {
 			byte*	blob_header	= page + offset;


runtime/cgo: export symbols in both internal and external link mode

R=rsc, r
CC=golang-dev
https://golang.org/cl/9060045

--- src/pkg/runtime/cgo/callbacks.c
+++ src/pkg/runtime/cgo/callbacks.c
@@ -45,7 +45,8 @@
 	FLUSH(&ret);
 }

-#pragma dynexport _cgo_allocate _cgo_allocate
+#pragma cgo_export_static _cgo_allocate
+#pragma cgo_export_dynamic _cgo_allocate
 void
 _cgo_allocate(void *a, int32 n)
 {
@@ -73,7 +74,8 @@
 	runtime·panic(err);
 }

-#pragma dynexport _cgo_panic _cgo_panic
+#pragma cgo_export_static _cgo_panic
+#pragma cgo_export_dynamic _cgo_panic
 void
 _cgo_panic(void *a, int32 n)
 {


Label and elapsed time accessors

Label and elapsed time accessors

--- include/cps/base_future.h
+++ include/cps/base_future.h
@@ -484,6 +484,16 @@
 		return ex_->reason();
 	}

+	/** Returns the label for this future */
+	const std::string &label() const { return label_; }
+
+	/**
+	 * Reports number of nanoseconds that have elapsed so far
+	 */
+	boost::chrono::nanoseconds elapsed() const {
+		return (is_ready() ? resolved_ : boost::chrono::high_resolution_clock::now()) - created_;
+	}
+
 protected:
 	/** Used internally to mark this base_future as ready. Takes a single parameter
 	 * which indicates the state - failed, completed, cancelled */


remove a few lines that weren't really necessary

--- include/cxxhttp/network.h
+++ include/cxxhttp/network.h
@@ -289,23 +289,18 @@
    *
    * Pad the number of available connections so that there's at least `n`
    * available in the connections pool.
+   *
+   * This will ignore the connection's service for testing how many connections
+   * there are, although it will only create new ones for the correct service.
+   * If you need to have a certain number of connections available and you use
+   * separate IO services, you should warm up the cache for `n` of one type,
+   * then `n*2` for the next one, etc.
    */
   static void pad(std::size_t n, efgy::beacons<connection> &pConnections =
                                      efgy::global<efgy::beacons<connection>>(),
                   service &pio = efgy::global<service>()) {
-    std::size_t have = 0;
-
-    for (auto &c : pConnections) {
-      if (&pio == &(c->io)) {
-        have++;
-      }
-    }
-
-    while (have < n) {
-      // not assigning this anywhere because pConnections is keeping track of
-      // this already.
+    while (pConnections.size() < n) {
       new connection(pConnections, pio);
-      have++;
     }
   }


branches/zip: buf_page_init(): Improve diagnostic output in case of buf_pool->page_hash corruption.

--- buf/buf0buf.c
+++ buf/buf0buf.c
@@ -1924,6 +1924,7 @@
 				in units of a page */
 	buf_block_t*	block)	/* in: block to init */
 {
+	buf_page_t*	hash_page;
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(mutex_own(&(buf_pool->mutex)));
 	ut_ad(mutex_own(&(block->mutex)));
@@ -1940,12 +1941,15 @@

 	/* Insert into the hash table of file pages */

-	if (UNIV_LIKELY_NULL(buf_page_hash_get(space, offset))) {
+	hash_page = buf_page_hash_get(space, offset);
+
+	if (UNIV_LIKELY_NULL(hash_page)) {
 		fprintf(stderr,
 			"InnoDB: Error: page %lu %lu already found"
-			" in the hash table\n",
+			" in the hash table: %p, %p\n",
 			(ulong) space,
-			(ulong) offset);
+			(ulong) offset,
+			hash_page, block);
 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
 		mutex_exit(&block->mutex);
 		mutex_exit(&buf_pool->mutex);


Fixed compiler warning (error on -Werror)

--- include/dbus-c++/server.h
+++ include/dbus-c++/server.h
@@ -60,7 +60,7 @@

 protected:

-  Server(const Server &s)
+  Server(const Server &)
   {}

   virtual void on_new_connection(Connection &c) = 0;


BUG(116): Change bzero into memset also in sse optimized equalizer version.

--- src/plugins/equalizer/iir_sse.c
+++ src/plugins/equalizer/iir_sse.c
@@ -59,7 +59,7 @@
   setup_gain(band_count);

   /* Zero the history arrays */
-  bzero(history, sizeof(history));
+  memset(history, 0, sizeof(history));
   /* Init pointers */
   for (i=0; i<EQ_CHANNELS; i++)
   {
@@ -81,9 +81,9 @@
 static void load_coeffs(int bands)
 {
   int i;
-  bzero(support.sse_iir_cf_alpha, sizeof(support.sse_iir_cf_alpha));
-  bzero(support.sse_iir_cf_beta, sizeof(support.sse_iir_cf_beta));
-  bzero(support.sse_iir_cf_gamma, sizeof(support.sse_iir_cf_gamma));
+  memset(support.sse_iir_cf_alpha, 0, sizeof(support.sse_iir_cf_alpha));
+  memset(support.sse_iir_cf_beta, 0, sizeof(support.sse_iir_cf_beta));
+  memset(support.sse_iir_cf_gamma, 0, sizeof(support.sse_iir_cf_gamma));
   for (i = 0; i < bands; i++)
   {
     support.sse_iir_cf_alpha[i/4].f[i%4] = iir_cf[i].alpha;


[MAMAC] mamaPlugin Feature - addition

[MAMAC] mamaPlugin Feature - addition

Addition to the existing mamaPlugin patch to remove references to internal shared objects
and a missing null check.

Signed-off-by: Gary Molloy <6f80d14d57525bedd455b5e987db2e9348481b41@srtechlabs.com>

--- mama/c_cpp/src/c/plugin.c
+++ mama/c_cpp/src/c/plugin.c
@@ -216,9 +216,6 @@
         }
     }

-    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");
-    mama_loadPlugin ("mamacenterprise");
-
     return MAMA_STATUS_OK;
 }

@@ -243,15 +240,10 @@
     if (pluginImpl == NULL)
     {
        /* The plugin name should be of the format mamaplugin<name> */
-        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)
-            snprintf(loadPluginName, MAX_PLUGIN_STRING,
-                "%s",
-                pluginName);
-        else
-            snprintf(loadPluginName, MAX_PLUGIN_STRING,
-                "%s%s",
-                PLUGIN_NAME,
-                pluginName);
+        snprintf(loadPluginName, MAX_PLUGIN_STRING,
+            "%s%s",
+            PLUGIN_NAME,
+            pluginName);

         pluginLib = openSharedLib (loadPluginName, NULL);

@@ -345,31 +337,34 @@

     for (plugin = 0; plugin <= gPluginNo; plugin++)
     {
-        if (gPlugins[plugin]->mPluginHandle != NULL)
-        {
-            /* Fire the user shutdown hook first - if one is present */
-            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)
+        if (gPlugins[plugin] != NULL)
+        {
+            if (gPlugins[plugin]->mPluginHandle != NULL)
             {
-                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);
+                /* Fire the user shutdown hook first - if one is present */
+                if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)
+                {
+                    gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);
+                }
+
+                ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);
+                if (0!=ret)
+                {
+                     mama_log (MAMA_LOG_LEVEL_WARN,
+                                "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",
+                                gPlugins[plugin]->mPluginName);
+                }
+                else
+                {
+                     mama_log (MAMA_LOG_LEVEL_WARN,
+                                "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",
+                                gPlugins[plugin]->mPluginName);
+                }
+
+                free ((char*)gPlugins[plugin]->mPluginName);
+                free (gPlugins[plugin]);
+                gPlugins[plugin] = NULL;
             }
-
-            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);
-            if (0!=ret)
-            {
-                 mama_log (MAMA_LOG_LEVEL_WARN,
-                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",
-                            gPlugins[plugin]->mPluginName);
-            }
-            else
-            {
-                 mama_log (MAMA_LOG_LEVEL_WARN,
-                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",
-                            gPlugins[plugin]->mPluginName);
-            }
-
-            free ((char*)gPlugins[plugin]->mPluginName);
-            free (gPlugins[plugin]);
-            gPlugins[plugin] = NULL;
         }
     }
     return status;


connector-c-l8: added tuple reply iteration.

--- connector/c/include/tp.h
+++ connector/c/include/tp.h
@@ -489,6 +489,7 @@
 	if (tp_unlikely(tp_unfetched(p) == 0))
 		return p->code;
 	p->cnt = *(uint32_t*)tp_fetch(p, sizeof(uint32_t));
+	p->t = p->c;
 	return p->code;
 }

@@ -502,16 +503,42 @@
 	p->f = p->t;
 }

-static inline ssize_t
+static inline uint32_t
+tp_fqtuplesize(char *p) {
+	return *(uint32_t*)p;
+}
+
+static inline uint32_t
+tp_fqtuplecount(char *p) {
+	return *(uint32_t*)(p + 4);
+}
+
+static inline char*
 tp_next(struct tp *p) {
-	(void)p;
-	return 0;
-}
-
-static inline ssize_t
-tp_nextfield(struct tp *p) {
-	(void)p;
-	return 0;
+	assert(p->t != NULL);
+	if ((p->t - p->e) < sizeof(uint32_t))
+		return NULL;
+	char *c = p->t;
+	uint32_t size = tp_fqtuplesize(c);
+	/* tuple size + tuple cardinality */
+	p->f = p->t + 8;
+	p->t += size;
+	return c;
+}
+
+static inline char*
+tp_nextfield(struct tp *p, size_t *sz) {
+	assert(p->t != NULL);
+	assert(p->f != NULL);
+	if ((p->f - p->t) <= 1)
+		return NULL;
+	(void)sz;
+	/* loadsize
+	 * set size
+	 * set return data
+	 * inc pointer
+	 */
+	return NULL;
 }

 #endif /* TP_H_INCLUDED */


Added "keeppos" when inserting molecules

--- include/faunus/molecule.h
+++ include/faunus/molecule.h
@@ -28,9 +28,10 @@
       Point offset;      //!< Added to random position. Default (0,0,0)
       bool checkOverlap; //!< Set to true to enable container overlap check
       bool rotate;       //!< Set to true to randomly rotate molecule when inserted. Default: true
+      bool keeppos;      //!< Set to true to keep original positions (default: false)
       int maxtrials;     //!< Maximum number of overlap checks if `checkOverlap==true`

-      RandomInserter() : dir(1,1,1), offset(0,0,0), checkOverlap(true), maxtrials(2e3) { name = "random"; }
+      RandomInserter() : dir(1,1,1), offset(0,0,0), checkOverlap(true), keeppos(false), maxtrials(2e3) { name = "random"; }

       Tpvec operator() (Geometry::Geometrybase &geo, const Tpvec &p, TMoleculeData &mol) {
         bool _overlap=true;
@@ -56,19 +57,25 @@
               geo.boundary( i );
             }
           } else { // insert molecule
-            Point a, b;
-            geo.randompos(a);              // random point in container
-            a = a.cwiseProduct(dir);       // apply user defined directions (default: 1,1,1)
-            Geometry::cm2origo(geo, v);    // translate to origo - obey boundary conditions
-            Geometry::QuaternionRotate rot;
-            b.ranunit(slump);              // random unit vector
-            rot.setAxis(geo, {0,0,0}, b, slump() * 2 * pc::pi); // random rot around random vector
-            for (auto &i : v) {            // apply rotation to all points
-              if (rotate)
-                i = rot(i) + a + offset;   // ...and translate
-              else
-                i += a + offset;
-              geo.boundary(i);             // ...and obey boundaries
+            if (keeppos) {                   // keep original positions (no rotation/trans)
+              for (auto &i : v)              // ...but let's make sure it fits
+                if (geo.collision(i,0))
+                  throw std::runtime_error("Error: Inserted molecule does not fit in container");
+            } else {                         // generate a now position/orientation
+              Point a, b;
+              geo.randompos(a);              // random point in container
+              a = a.cwiseProduct(dir);       // apply user defined directions (default: 1,1,1)
+              Geometry::cm2origo(geo, v);    // translate to origo - obey boundary conditions
+              Geometry::QuaternionRotate rot;
+              b.ranunit(slump);              // random unit vector
+              rot.setAxis(geo, {0,0,0}, b, slump() * 2 * pc::pi); // random rot around random vector
+              for (auto &i : v) {            // apply rotation to all points
+                if (rotate)
+                  i = rot(i) + a + offset;   // ...and translate
+                else
+                  i += a + offset;
+                geo.boundary(i);             // ...and obey boundaries
+              }
             }
           }

@@ -130,6 +137,7 @@
    * `fasta`       | string  | Construct bonded chain from fasta sequence (hardcoded k and req)
    * `insdir`      | string  | Directions for generation of random position. Default: "1 1 1" = XYZ
    * `insoffset`   | string  | Translate generated random position. Default: "0 0 0" = no translation
+   * `keeppos`     | bool    | Keep original positions (`insdir`, `insoffset` ignored. Default: `false`)
    * `Ninit`       | int     | Initial number of molecules
    * `checkoverlap`| bool    | Check for overlap while inserting. Default: true
    * `rotate`      | bool    | Randomly rotate molecule or anisotropic atom upon insertion. Default: true
@@ -178,6 +186,7 @@
           ins.offset << ( molecule.value()["insoffset"] | string("0 0 0") );
           ins.checkOverlap = molecule.value()["checkoverlap"] | true;
           ins.rotate       = molecule.value()["rotate"] | true;
+          ins.keeppos      = molecule.value()["keeppos"] | false;
           setInserter( ins );
         }


Format string.h's namespace like we do the other headers.

--- include/formatxx/string.h
+++ include/formatxx/string.h
@@ -36,35 +36,36 @@
 #include <formatxx/wide.h>
 #include <string>

-namespace formatxx {
+namespace formatxx
+{
+	template <typename StringT> class basic_string_writer;

-template <typename StringT> class basic_string_writer;
+	using string_writer = basic_string_writer<std::string>;
+	using wstring_writer = basic_string_writer<std::wstring>;

-using string_writer = basic_string_writer<std::string>;
+	template <typename StringT = std::string, typename... Args> StringT sformat(basic_string_view<typename StringT::value_type> format, Args const&... args);
+	template <typename StringT = std::string, typename... Args> StringT sprintf(basic_string_view<typename StringT::value_type> format, Args const&... args);

-template <typename StringT = std::string, typename... Args> StringT sformat(basic_string_view<typename StringT::value_type> format, Args const&... args);
-template <typename StringT = std::string, typename... Args> StringT sprintf(basic_string_view<typename StringT::value_type> format, Args const&... args);
+	template <typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
+	format_writer& format(format_writer& writer, std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
+	template <typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
+	format_writer& printf(format_writer& writer, std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
+	template <typename StringT = std::string, typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
+	StringT sformat(std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
+	template <typename StringT = std::string, typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
+	StringT sprintf(std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);

-template <typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
-format_writer& format(format_writer& writer, std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
-template <typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
-format_writer& printf(format_writer& writer, std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
-template <typename StringT = std::string, typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
-StringT sformat(std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
-template <typename StringT = std::string, typename CharT, typename CharTraitsT, typename AllocatorT, typename... Args>
-StringT sprintf(std::basic_string<CharT, CharTraitsT, AllocatorT> format, Args const&... args);
+	template <typename CharT, typename TraitsT, typename AllocatorT>
+	void format_value(format_writer& out, std::basic_string<CharT, TraitsT, AllocatorT> const& string, string_view spec)
+	{
+		format_value(out, basic_string_view<CharT>(string.c_str(), string.size()), spec);
+	}

-template <typename CharT, typename TraitsT, typename AllocatorT>
-void format_value(format_writer& out, std::basic_string<CharT, TraitsT, AllocatorT> const& string, string_view spec)
-{
-    format_value(out, basic_string_view<CharT>(string.c_str(), string.size()), spec);
-}
-
-template <typename CharT, typename TraitsT, typename AllocatorT>
-void format_value(wformat_writer& out, std::basic_string<CharT, TraitsT, AllocatorT> const& string, wstring_view spec)
-{
-    format_value(out, basic_string_view<CharT>(string.c_str(), string.size()), spec);
-}
+	template <typename CharT, typename TraitsT, typename AllocatorT>
+	void format_value(wformat_writer& out, std::basic_string<CharT, TraitsT, AllocatorT> const& string, wstring_view spec)
+	{
+		format_value(out, basic_string_view<CharT>(string.c_str(), string.size()), spec);
+	}

 } // namespace formatxx


added the tag for the "DSIG" table

added the tag for the "DSIG" table

--- include/freetype/tttags.h
+++ include/freetype/tttags.h
@@ -22,9 +22,9 @@

 #include <freetype/freetype.h>   /* for MAKE_TT_TAG() */

-
 #define TTAG_cmap  FT_MAKE_TAG( 'c', 'm', 'a', 'p' )
 #define TTAG_cvt   FT_MAKE_TAG( 'c', 'v', 't', ' ' )
+#define TTAG_DSIG  FT_MAKE_TAG( 'D', 'S', 'I', 'G' )
 #define TTAG_EBDT  FT_MAKE_TAG( 'E', 'B', 'D', 'T' )
 #define TTAG_EBLC  FT_MAKE_TAG( 'E', 'B', 'L', 'C' )
 #define TTAG_EBSC  FT_MAKE_TAG( 'E', 'B', 'S', 'C' )
@@ -53,7 +53,6 @@
 #define TTAG_vhea  FT_MAKE_TAG( 'v', 'h', 'e', 'a' )
 #define TTAG_vmtx  FT_MAKE_TAG( 'v', 'm', 't', 'x' )

-
 #endif /* TTAGS_H */


Performance improvements and fixes

Performance improvements and fixes

Greatly improvded fr::Packet>> performance.
Added buffer overflow protection to fr::Packet>>.
Added fr::Packet::reset_read_cursor to reset the packet data read position back to the beginning.

--- include/frnetlib/Packet.h
+++ include/frnetlib/Packet.h
@@ -15,7 +15,11 @@
     class Packet
     {
     public:
-        Packet() noexcept = default;
+        Packet() noexcept
+        : buffer_offset(0)
+        {
+
+        }

         //Nasty constructor to allow things like Packet{1, 2, 3, "bob"}.
         template <typename T, typename ...Args>
@@ -25,14 +29,14 @@
         }

         template<typename T, typename ...Args>
-        void add(T const& part, Args &&...args)
+        inline void add(T const& part, Args &&...args)
         {
             *this << part;
             add(std::forward<Args>(args)...);
         }

         template<typename T>
-        void add(T const part)
+        inline void add(T const part)
         {
             *this << part;
         }
@@ -102,8 +106,10 @@
          */
         inline Packet &operator>>(bool &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             return *this;
         }

@@ -123,8 +129,10 @@
          */
         inline Packet &operator>>(uint16_t &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohs(var);
             return *this;
         }
@@ -134,8 +142,8 @@
          */
         inline Packet &operator<<(uint32_t var)
         {
-            buffer.resize(buffer.size() + sizeof(var));
             var = htonl(var);
+            buffer.resize(buffer.size() + sizeof(var));
             memcpy(&buffer[buffer.size() - sizeof(var)], &var, sizeof(var));
             return *this;
         }
@@ -145,8 +153,10 @@
          */
         inline Packet &operator>>(uint32_t &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohl(var);
             return *this;
         }
@@ -167,8 +177,10 @@
          */
         inline Packet &operator>>(uint64_t &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohll(var);
             return *this;
         }
@@ -189,8 +201,10 @@
          */
         inline Packet &operator>>(int16_t &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohs((uint16_t)var);
             return *this;
         }
@@ -211,8 +225,10 @@
          */
         inline Packet &operator>>(int32_t &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohl((uint32_t)var);
             return *this;
         }
@@ -233,8 +249,10 @@
          */
         inline Packet &operator>>(int64_t &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohll((uint64_t)var);
             return *this;
         }
@@ -255,8 +273,10 @@
          */
         inline Packet &operator>>(float &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);
             var = ntohf(var);
             return *this;
         }
@@ -277,8 +297,10 @@
          */
         inline Packet &operator>>(double &var)
         {
-            memcpy(&var, &buffer[0], sizeof(var));
-            buffer.erase(0, sizeof(var));
+            assert_data_remaining(sizeof(var));
+
+            memcpy(&var, &buffer[buffer_offset], sizeof(var));
+            buffer_offset += sizeof(var);;
             var = ntohd(var);
             return *this;
         }
@@ -311,8 +333,8 @@
             uint32_t length = (uint32_t)var.length();
             *this >> length;

-            var = buffer.substr(0, length);
-            buffer.erase(0, length);
+            var = buffer.substr(buffer_offset, length);
+            buffer_offset += sizeof(length);

             return *this;
         }
@@ -333,10 +355,34 @@
         inline void clear()
         {
             buffer.clear();
+            buffer_offset = 0;
+        }
+
+        /*!
+         * Resets the buffer read cursor back to the beginning
+         * of the packet.
+         */
+        inline void reset_read_cursor()
+        {
+            buffer_offset = 0;
         }

     private:
+        /*!
+         * Checks that there's enough data in the buffer to extract
+         * a given number of bytes to prevent buffer overflows.
+         * Throws an exception if there is not enough space.
+         *
+         * @param required_space The number of bytes needed
+         */
+        inline void assert_data_remaining(size_t required_space)
+        {
+            if(buffer_offset + required_space > buffer.size())
+                throw std::out_of_range("Not enough bytes remaining in packet to extract requested");
+        }
+
         std::string buffer; //Packet data buffer
+        size_t buffer_offset; //Current read position
     };
 }


Compiler warning fix

Compiler warning fix

--- src/plugins/quota/quota-count.c
+++ src/plugins/quota/quota-count.c
@@ -75,7 +75,7 @@
 {
 	struct mail_storage *const *storages;
 	unsigned int i, count;
-	int ret;
+	int ret = 0;

 	i_assert(!quota->counting);