vsnprintf: Handle %s and %d

vsnprintf: Handle %s and %d

--- libc/src/stdio.c
+++ libc/src/stdio.c
@@ -75,14 +75,58 @@
 }

 int vsnprintf(char * restrict s, size_t n, const char * restrict format, va_list arg) {
-	(void)s;
 	(void)n;
-	(void)format;
-	(void)arg;
-	puts("vsnprintf: not implemented");
-	//FILE *f = fmemopen(s, 0, 0);
-	//return vfnprintf(f, format, arg);
-	return -1;
+
+	size_t dstpos = 0;
+	for(size_t srcpos = 0; format[srcpos] != '\0'; ++srcpos) {
+		if(format[srcpos] == '%') {
+			switch(format[srcpos + 1]) {
+			case 's': {
+				char *sz = va_arg(arg, char *);
+				size_t len = strlen(sz);
+				memcpy(&s[dstpos], sz, len);
+				++srcpos;
+				dstpos += len;
+				break;
+			}
+			case 'd': {
+				int x = va_arg(arg, int);
+				size_t len = 0;
+
+				if(x < 0) {
+					s[dstpos++] = '-';
+					x = -x;
+					++len;
+				}
+
+				char tmp[16];
+				char *ptr = tmp;
+
+				while(x || ptr == tmp) {
+					int i = x % 10;
+					x /= 10;
+					*ptr++ = '0' + i;
+				}
+
+				len += ptr - tmp;
+
+				while(ptr > tmp) {
+					s[dstpos++] = *--ptr;
+				}
+
+				++srcpos;
+				break;
+			}
+			default:
+				s[dstpos++] = format[srcpos];
+			}
+		} else {
+			s[dstpos++] = format[srcpos];
+		}
+	}
+	s[dstpos] = '\0';
+
+	return dstpos;
 }

 int vsprintf(char * restrict s, const char * restrict format, va_list arg) {


Add getopt support to ectool

Add getopt support to ectool

This is needed for supporting device passthru.  Right now, the --dev
option simply prints an error.

BUG=chrome-os-partner:30079
BRANCH=none
TEST=manual
	ectool -> prints an error
	ectool help -> prints list of commands
	ectool version -> prints EC version
	ectool --dev=0 version -> prints EC version
	ectool --dev=1 version -> prints error about bad device 1
	ectool --dev=0 -> prints an error (because there's no command)
	ectool --dev=0 foo -> prints 'unknown command foo'

Change-Id: I0f431a4789428cd6cc8ef48b396b38237935282a
Signed-off-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207904

--- util/ectool.c
+++ util/ectool.c
@@ -5,6 +5,7 @@

 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -21,6 +22,17 @@
 #include "lock/gec_lock.h"
 #include "misc_util.h"
 #include "panic.h"
+
+/* Command line options */
+enum {
+	OPT_HELP = '?',
+	OPT_DEV = 1000,
+};
+
+static struct option long_opts[] = {
+	{"dev", 1, 0, OPT_DEV},
+	{NULL, 0, 0, 0}
+};

 #define GEC_LOCK_TIMEOUT_SECS	30  /* 30 secs */

@@ -168,12 +180,6 @@
 	"      Prints EC version\n"
 	"  wireless <flags> [<mask> [<suspend_flags> <suspend_mask>]]\n"
 	"      Enable/disable WLAN/Bluetooth radio\n"
-	"\n"
-	"Not working for you?  Make sure LPC I/O is configured:\n"
-	"  pci_write32 0 0x1f 0 0x88 0x00fc0801\n"
-	"  pci_write32 0 0x1f 0 0x8c 0x00fc0901\n"
-	"  pci_write16 0 0x1f 0 0x80 0x0010\n"
-	"  pci_write16 0 0x1f 0 0x82 0x3d01\n"
 	"";

 /* Note: depends on enum system_image_copy_t */
@@ -208,10 +214,14 @@
 	}
 }

-void print_help(const char *prog)
-{
-	printf("Usage: %s <command> [params]\n\n", prog);
-	puts(help_str);
+void print_help(const char *prog, int print_cmds)
+{
+	printf("Usage: %s [--dev=n] <command> [params]\n\n",
+	       prog);
+	if (print_cmds)
+		puts(help_str);
+	else
+		printf("Use '%s help' to print a list of commands.\n", prog);
 }

 static uint8_t read_mapped_mem8(uint8_t offset)
@@ -4526,17 +4536,55 @@
 	{NULL, NULL}
 };

-
 int main(int argc, char *argv[])
 {
 	const struct command *cmd;
+	int dev = 0;
 	int rv = 1;
+	int parse_error = 0;
+	char *e;
+	int i;

 	BUILD_ASSERT(ARRAY_SIZE(lb_command_paramcount) == LIGHTBAR_NUM_CMDS);

-	if (argc < 2 || !strcasecmp(argv[1], "-?") ||
-	    !strcasecmp(argv[1], "help")) {
-		print_help(argv[0]);
+	while ((i = getopt_long(argc, argv, "?", long_opts, NULL)) != -1) {
+		switch (i) {
+		case '?':
+			/* Unhandled option */
+			parse_error = 1;
+			break;
+
+		case OPT_DEV:
+			dev = strtoul(optarg, &e, 0);
+			if (!*optarg || (e && *e)) {
+				fprintf(stderr, "Invalid --dev\n");
+				parse_error = 1;
+			}
+			break;
+		}
+	}
+
+	/* Must specify a command */
+	if (!parse_error && optind == argc)
+		parse_error = 1;
+
+	/* 'ectool help' prints help with commands */
+	if (!parse_error && !strcasecmp(argv[optind], "help")) {
+		print_help(argv[0], 1);
+		exit(1);
+	}
+
+	/*
+	 * --dev support is coming in the next patch.  For now this is a
+	 * placeholder used in testing getopt_long()
+	 */
+	if (dev != 0) {
+		fprintf(stderr, "Bad device number %d\n", dev);
+		parse_error = 1;
+	}
+
+	if (parse_error) {
+		print_help(argv[0], 0);
 		exit(1);
 	}

@@ -4552,15 +4600,15 @@

 	/* Handle commands */
 	for (cmd = commands; cmd->name; cmd++) {
-		if (!strcasecmp(argv[1], cmd->name)) {
-			rv = cmd->handler(argc - 1, argv + 1);
+		if (!strcasecmp(argv[optind], cmd->name)) {
+			rv = cmd->handler(argc - optind, argv + optind);
 			goto out;
 		}
 	}

 	/* If we're still here, command was unknown */
-	fprintf(stderr, "Unknown command '%s'\n\n", argv[1]);
-	print_help(argv[0]);
+	fprintf(stderr, "Unknown command '%s'\n\n", argv[optind]);
+	print_help(argv[0], 0);

 out:
 	release_gec_lock();


Use rtp_packet_parse_raw().

Use rtp_packet_parse_raw().

--- extractaudio/rtpp_loader.c
+++ extractaudio/rtpp_loader.c
@@ -135,7 +135,7 @@
         if (pkt->plen < sizeof(rtp_hdr_t))
             continue;
         pack = malloc(sizeof(*pack));
-        if (rtp_packet_parse(cp, pkt->plen, &(pack->parsed)) != RTP_PARSER_OK) {
+        if (rtp_packet_parse_raw(cp, pkt->plen, &(pack->parsed)) != RTP_PARSER_OK) {
             /* XXX error handling */
             free(pack);
             continue;
@@ -224,7 +224,7 @@
         if (rtp_len < sizeof(rtp_hdr_t))
             continue;
         pack = malloc(sizeof(*pack) + sizeof(*pack->pkt));
-        if (rtp_packet_parse(cp, rtp_len, &(pack->parsed)) != RTP_PARSER_OK) {
+        if (rtp_packet_parse_raw(cp, rtp_len, &(pack->parsed)) != RTP_PARSER_OK) {
             /* XXX error handling */
             free(pack);
             continue;


Forgot to add the new header file for rdtsc.c

git-svn-id: 7608aaac65d591179a662c43fcd0db553969f4bd@78 3b4be424-7ac5-41d7-8526-f4ddcb85d872

error: pathspec 'libcpuid/rdtsc.h' did not match any file(s) known to git

--- libcpuid/rdtsc.h
+++ libcpuid/rdtsc.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010  Veselin Georgiev,
+ * anrieffNOSPAM @ mgail_DOT.com (convert to gmail)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __RDTSC_H__
+#define __RDTSC_H__
+
+void sys_precise_clock(uint64_t *result);
+int busy_loop_delay(int milliseconds);
+
+
+#endif /* __RDTSC_H__ */


util/genvif.c: close file on error

util/genvif.c: close file on error

BUG=none
BRANCH=none
TEST=none

Change-Id: I873dcfc15f90642e509ba82d521971a29c28b54d
Signed-off-by: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@google.com>
Found-by: Coverity Scan #180595
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725954
Tested-by: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@chromium.org>
Auto-Submit: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@chromium.org>
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Commit-Queue: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@chromium.org>

--- util/genvif.c
+++ util/genvif.c
@@ -517,6 +517,7 @@
 			pwr = write_pdo_to_buf(&buf, src_pdo[i], SRC, i+1);
 			if (pwr < 0) {
 				fprintf(stderr, "ERROR: Out of memory.\n");
+				fclose(vif);
 				return 1;
 			}

@@ -547,6 +548,7 @@

 			if (pwr < 0) {
 				fprintf(stderr, "ERROR: Out of memory.\n");
+				fclose(vif);
 				return 1;
 			}


Delay unregister of fd until freelisted

Delay unregister of fd until freelisted

Prevents a race whereby we start deleting the freelist before it's used

--- src/core/iomgr/fd_posix.c
+++ src/core/iomgr/fd_posix.c
@@ -74,6 +74,7 @@
   gpr_mu_lock(&fd_freelist_mu);
   fd->freelist_next = fd_freelist;
   fd_freelist = fd;
+  grpc_iomgr_unregister_object(&fd->iomgr_object);
   gpr_mu_unlock(&fd_freelist_mu);
 }

@@ -139,7 +140,6 @@
 #endif
   old = gpr_atm_full_fetch_add(&fd->refst, -n);
   if (old == n) {
-    grpc_iomgr_unregister_object(&fd->iomgr_object);
     freelist_fd(fd);
   } else {
     GPR_ASSERT(old > n);


libcrypt: make crypt() itself more modular

By using a function table, we can more cleanly support new crypt
implementations, such as SHA256 ($5$) and SHA512 ($6$).

Signed-off-by: William Pitcock <904d3da5c2001f94bfa014239941837342b65c9b@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <ce1ac9e9ad16abccd7821f371ad381197b4768ac@gmail.com>

--- libcrypt/crypt.c
+++ libcrypt/crypt.c
@@ -8,17 +8,35 @@
 #define __FORCE_GLIBC
 #include <crypt.h>
 #include <unistd.h>
+#include <string.h>
+#include <errno.h>
 #include "libcrypt.h"
+
+typedef char *(*crypt_impl_f)(const unsigned char *pw, const unsigned char *salt);
+
+static const struct {
+	const char *salt_pfx;
+	const crypt_impl_f crypt_impl;
+} crypt_impl_tab[] = {
+	{ "$1$",        __md5_crypt },
+	{ NULL,         __des_crypt },
+};

 char *crypt(const char *key, const char *salt)
 {
 	const unsigned char *ukey = (const unsigned char *)key;
 	const unsigned char *usalt = (const unsigned char *)salt;
+	size_t i;

-	/* First, check if we are supposed to be using the MD5 replacement
-	 * instead of DES...  */
-	if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
-		return __md5_crypt(ukey, usalt);
-	else
-		return __des_crypt(ukey, usalt);
+	for (i = 0; i < ARRAY_SIZE(crypt_impl_tab); i++) {
+		if (crypt_impl_tab[i].salt_pfx != NULL &&
+		    strncmp(crypt_impl_tab[i].salt_pfx, salt, strlen(crypt_impl_tab[i].salt_pfx)))
+			continue;
+
+		return crypt_impl_tab[i].crypt_impl(ukey, usalt);
+	}
+
+	/* no crypt implementation was found, set errno to ENOSYS and return NULL */
+	__set_errno(ENOSYS);
+	return NULL;
 }


Pull in Brian Cook's win32 CPU utilization fix.

--- win32/freespace_device.c
+++ win32/freespace_device.c
@@ -463,6 +463,7 @@

 int finalizeSendStruct(struct FreespaceSendStruct* send, BOOL doClose) {
     send->interface_ = NULL;
+    ResetEvent(send->overlapped_.hEvent);
     if (doClose) {
         // Close the overlapped report event.
         CloseHandle(send->overlapped_.hEvent);


If the parent interface is not IFF_RUNNING, do not call its start function.
This prevent a variety of fun panics.

From NetBSD

--- net/if_vlan.c
+++ net/if_vlan.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_vlan.c,v 1.50 2005/04/18 03:29:18 brad Exp $ */
+/*	$OpenBSD: if_vlan.c,v 1.51 2005/04/18 04:07:17 brad Exp $ */
 /*
  * Copyright 1998 Massachusetts Institute of Technology
  *
@@ -255,7 +255,7 @@
 		}

 		ifp->if_opackets++;
-		if ((p->if_flags & IFF_OACTIVE) == 0)
+		if ((p->if_flags & (IFF_RUNNING|IFF_OACTIVE)) == IFF_RUNNING)
 			p->if_start(p);
 	}
 	ifp->if_flags &= ~IFF_OACTIVE;


add solution for problem 100

add solution for problem 100

error: pathspec 'interview/leetcode.com/algorithm/[100]same-tree/100.c' did not match any file(s) known to git

--- interview/leetcode.com/algorithm/[100]same-tree/100.c
+++ interview/leetcode.com/algorithm/[100]same-tree/100.c
@@ -0,0 +1,38 @@
+/*
+ *  Source: https://leetcode.com/problems/same-tree/
+ *  Author: matthew6868(mxu.public@outlook.com)
+ *  Date: 2016-12-2
+ *
+    100. Same Tree
+    Total Accepted: 169187
+    Total Submissions: 375983
+    Difficulty: Easy
+    Contributors: Admin
+    Given two binary trees, write a function to check if they are equal or not.
+
+    Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
+ */
+
+/**
+ * Definition for a binary tree node.
+ * struct TreeNode {
+ *     int val;
+ *     struct TreeNode *left;
+ *     struct TreeNode *right;
+ * };
+ */
+bool isSameTree(struct TreeNode* p, struct TreeNode* q) {
+    if (p == NULL && q == NULL) {
+        return true;
+    }
+
+    if (p == NULL || q == NULL) {
+        return false;
+    }
+
+    if (p->val == q->val) {
+        return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
+    }
+
+    return false;
+}


Start to derivative visitor.

Start to derivative visitor.

--- src/derivative-visitor.c
+++ src/derivative-visitor.c
@@ -81,12 +81,15 @@
 static GObject *derivative_symbol (CompilerKitVisitor *self, GObject *obj)
 {
     CompilerKitSymbol *symbol;
+    gunichar *character = self->state;
+    gunichar regex_symb = compilerkit_symbol_get_symbol(symbol);
     g_assert(COMPILERKIT_IS_SYMBOL(obj));

     symbol = COMPILERKIT_SYMBOL (obj);

-    compilerkit_symbol_get_symbol(symbol);
-    return NULL;
+    if (*character == regex_symb)
+        return compilerkit_empty_string_get_instance();
+    return compilerkit_empty_set_get_instance();
 }

 /* Derivative empty set. */
@@ -94,7 +97,7 @@
 {
     g_assert(COMPILERKIT_IS_EMPTY_SET(obj));

-    return NULL;
+    return compilerkit_empty_set_get_instance();
 }

 /* Derivative empty string. */
@@ -102,7 +105,7 @@
 {
     g_assert(COMPILERKIT_IS_EMPTY_STRING(obj));

-    return NULL;
+    return compilerkit_empty_set_get_instance();
 }

 /* Derivative grammar. */


Conform to RFC 2367 numbering (hshoexer@rommelwood.de)

--- net/pfkeyv2.h
+++ net/pfkeyv2.h
@@ -225,13 +225,13 @@
 #define SADB_AALG_MAX                7

 #define SADB_EALG_NONE        0
-#define SADB_EALG_DESCBC      1
-#define SADB_EALG_3DESCBC     2
-#define SADB_X_EALG_BLF       3
+#define SADB_EALG_DESCBC      2
+#define SADB_EALG_3DESCBC     3
 #define SADB_X_EALG_CAST      4
 #define SADB_X_EALG_SKIPJACK  5
 #define SADB_X_EALG_AES       6
-#define SADB_EALG_MAX         6
+#define SADB_X_EALG_BLF       7
+#define SADB_EALG_MAX         7

 #define SADB_SAFLAGS_PFS         	0x001    /* perfect forward secrecy */
 #define SADB_X_SAFLAGS_HALFIV    	0x002    /* Used for ESP-old */


Minor changes to iface_addr switching over different Addess Family

--- net_helpers.c
+++ net_helpers.c
@@ -96,7 +96,25 @@
 	freeifaddrs(if_addr);
 	return host_addr;
 #else
-    if(iface != NULL && strcmp(iface, "lo") == 0) return (l3==IPv4?"127.0.0.1":"::1");
+    char *res;
+    if(iface != NULL && strcmp(iface, "lo") == 0)
+    {
+	  switch (l3)
+	  {
+		case IPv4:
+			res = malloc (INET_ADDRSTRLEN);
+			strcpy(res, "127.0.0.1");
+		  break;
+		case IPv6:
+			res = malloc (INET6_ADDRSTRLEN);
+			strcpy(res, "::1");
+		  break;
+		default:
+		  return NULL;
+		  break;
+	  }
+      return res;
+    }
     if(iface != NULL && inet_addr(iface) != INADDR_NONE) return strdup(iface);
     return default_ip_addr();
 #endif


Disable finger_num_to_str when debugging is disabled

One less warning.

--- libfprint/data.c
+++ libfprint/data.c
@@ -73,6 +73,7 @@
 	((finger) >= LEFT_THUMB && (finger) <= RIGHT_LITTLE)

 /* for debug messages only */
+#ifdef ENABLE_DEBUG_LOGGING
 static const char *finger_num_to_str(enum fp_finger finger)
 {
 	const char *names[] = {
@@ -91,6 +92,7 @@
 		return "UNKNOWN";
 	return names[finger];
 }
+#endif

 static struct fp_print_data *print_data_new(uint16_t driver_id,
 	uint32_t devtype, enum fp_print_data_type type, size_t length)


Check for nullpointer

Check for nullpointer

--- libmdnsd/mdnsd.c
+++ libmdnsd/mdnsd.c
@@ -140,6 +140,9 @@

 static mdns_record_t *_r_next(mdns_daemon_t *d, mdns_record_t *r, char *host, int type)
 {
+	if (host == NULL)
+		return 0;
+
 	if (r == 0)
 		r = d->published[_namehash(host) % SPRIME];
 	else
@@ -603,6 +606,8 @@

 	/* Process each answer, check for a conflict, and cache */
 	for (i = 0; i < m->ancount; i++) {
+		if (m->an[i].name == NULL)
+			continue;
 		if ((r = _r_next(d, 0, m->an[i].name, m->an[i].type)) != 0 &&
 		    r->unique && _a_match(&m->an[i], &r->rr) == 0)
 			_conflict(d, r);


Revert incorrect version of "libpdbg/p8chip.c: ram state setup sequence ..."

This reverts commit eb1d866e30a1f8488fb794776bb5a1e0bc42d2e5.

Signed-off-by: Alistair Popple <e9adbcf81c8a36ccc628e09bc92d0e25e1c8e501@popple.id.au>

--- libpdbg/p8chip.c
+++ libpdbg/p8chip.c
@@ -284,6 +284,8 @@
 {
 	int i = 0;
 	uint64_t val;
+	struct core *chip = target_to_core(
+		pdbg_target_require_parent("core", &thread->target));

 	/* Quiese active thread */
 	CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP));
@@ -302,16 +304,38 @@
 			}
 			break;
 		}
-	} while (!(val & RAS_STATUS_INST_COMPLETE) &&
-		 !(val & RAS_STATUS_TS_QUIESCE));
+
+		/* We can continue ramming if either the
+		 * thread is not active or the SRQ/LSU/TS bits
+		 * are set. */
+	} while ((val & RAS_STATUS_THREAD_ACTIVE) &&
+		 !((val & RAS_STATUS_SRQ_EMPTY)
+		   && (val & RAS_STATUS_LSU_QUIESCED)
+		   && (val & RAS_STATUS_TS_QUIESCE)));
+
+
+	/* Make the threads RAM thread active */
+	CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val));
+	val |= PPC_BIT(8) >> thread->id;
+	CHECK_ERR(pib_write(&chip->target, THREAD_ACTIVE_REG, val));

 	return 0;
 }

 static int p8_thread_start(struct thread *thread)
 {
+	uint64_t val;
+	struct core *chip = target_to_core(
+		pdbg_target_require_parent("core", &thread->target));
+
 	/* Activate thread */
 	CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_START));
+
+	/* Restore thread active */
+	CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val));
+	val &= ~(PPC_BIT(8) >> thread->id);
+	val |= PPC_BIT(thread->id);
+	CHECK_ERR(pib_write(&chip->target, THREAD_ACTIVE_REG, val));

 	return 0;
 }
@@ -348,10 +372,8 @@
 #endif
 	}

-	if (!(thread->status.active)) {
-		PR_WARNING("Thread is in power save state, can not RAM\n");
+	if (!(thread->status.active))
 		return 2;
-	}

 	/* Activate RAM mode */
 	CHECK_ERR(pib_read(&chip->target, RAM_MODE_REG, &ram_mode));
@@ -410,14 +432,7 @@
 {
 	struct core *chip = target_to_core(
 		pdbg_target_require_parent("core", &thread->target));
-	uint64_t val, ram_mode;
-
-	if (!(get_thread_status(thread).active)) {
-		/* Mark the RAM thread active so GPRs stick */
-		CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val));
-		val |= PPC_BIT(8) >> thread->id;
-		CHECK_ERR(pib_write(&chip->target, THREAD_ACTIVE_REG, val));
-	}
+	uint64_t ram_mode;

 	/* Disable RAM mode */
 	CHECK_ERR(pib_read(&chip->target, RAM_MODE_REG, &ram_mode));


BST_TIMEVAL get method should be const

BST_TIMEVAL get method should be const

--- libpfkutil/bst.h
+++ libpfkutil/bst.h
@@ -343,7 +343,7 @@
         btv_sec.v = (uint64_t) tv.tv_sec;
         btv_usec.v = (uint32_t) tv.tv_usec;
     }
-    void get(struct timeval &tv) {
+    const void get(struct timeval &tv) const {
         tv.tv_sec = (typeof(tv.tv_sec)) btv_sec.v;
         tv.tv_usec = (typeof(tv.tv_usec)) btv_usec.v;
     }
@@ -354,6 +354,7 @@
     }
 };

+// BUG: this can't handle strings >= 65536 in length.
 // it is legal for string to be a null ptr; however
 // it will be represented identically as a zero-length string.
 struct BST_STRING : public BST {


do not extract files identical to what is already present

--- libpkg/pkg_add.c
+++ libpkg/pkg_add.c
@@ -177,6 +177,18 @@
 		strlcpy(rpath, pathname, sizeof(rpath));

 		if (lstat(rpath, &st) != -1 && !S_ISDIR(st.st_mode)) {
+			/* check is the old version is the same as the new version */
+			if (S_ISREG(st.st_mode) && st.st_size == archive_entry_size(ae)) {
+				char localsum[SHA256_DIGEST_LENGTH + 2 + 1];
+				if (sha256_file(rpath, localsum) == EPKG_OK) {
+					HASH_FIND_STR(pkg->files, path, rf);
+					if (strcmp(localsum, rf->sum) == 0) {
+						pkg_debug(2, "Do not extract identical file");
+						pkg_emit_progress_tick(cur_file++, nfiles);
+						continue;
+					}
+				}
+			}
 			/*
 			 * We have an existing file on the path, so handle it
 			 */


Register the package before trying to install it.

This avoids the problem of spending a lot of time installing a package only
to reject the registration.  If the installation fails, the package will be
unregistered afterwards.  This should probably have a flag in the database
that sets the current state of the package ("installing", "installed",
"deinstalled", etc).

--- libpkg/pkg_add.c
+++ libpkg/pkg_add.c
@@ -65,6 +65,7 @@
 	char dpath[MAXPATHLEN];
 	const char *basedir;
 	const char *ext;
+	int registered = 0;
 	int retcode = EPKG_OK;
 	int ret;
 	int i;
@@ -147,6 +148,13 @@
 		}
 	}

+	/* Register the package before installing it in case there are
+	 * problems that could be caught here. */
+	retcode = pkgdb_register_pkg(db, pkg);
+	registered = 1;
+	if (retcode != EPKG_OK)
+		goto cleanup;
+
 	/*
 	 * Execute pre-install scripts
 	 */
@@ -215,11 +223,11 @@

 	cleanup:

+	if (registered && retcode != EPKG_OK)
+		pkgdb_unregister_pkg(db, pkg_get(pkg, PKG_ORIGIN));
+
 	if (a != NULL)
 		archive_read_finish(a);
-
-	if (retcode == EPKG_OK)
-		retcode = pkgdb_register_pkg(db, pkg);

 	if (pkg_p != NULL)
 		*pkg_p = (retcode == EPKG_OK) ? pkg : NULL;


Don't know how and why c was looked for as a wildcard...

--- libpkg/pkg_elf.c
+++ libpkg/pkg_elf.c
@@ -981,7 +981,7 @@
 {
 	bool iswildcard;

-	iswildcard = (strchr(arch, 'c') != NULL);
+	iswildcard = (strchr(arch, '*') != NULL);

 	if (iswildcard && isdefault)
 		pkg_emit_developer_mode("Configuration error: arch \"%s\" "


gobject: Do not serialize default values

If a property is set to its default value then we can skip its
serialization, to keep the number of JSON object members down.

--- json-glib/json-gobject.c
+++ json-glib/json-gobject.c
@@ -397,6 +397,13 @@
         json_serializable_get_property (serializable, pspec, &value);
       else
         g_object_get_property (gobject, pspec->name, &value);
+
+      /* skip if the value is the default for the property */
+      if (g_param_value_defaults (pspec, &value))
+        {
+          g_value_unset (&value);
+          continue;
+        }

       /* if there is a serialization vfunc, then it is completely responsible
        * for serializing the property, possibly by calling the implementation


Use pkg_sbuf_printf

Use pkg_sbuf_printf

--- libpkg/scripts.c
+++ libpkg/scripts.c
@@ -49,7 +49,7 @@
 	size_t i, j;
 	int error, pstat;
 	pid_t pid;
-	const char *name, *prefix, *version, *script_cmd_p;
+	const char *prefix, *script_cmd_p;
 	const char *argv[4];
 	char **ep;
 	int ret = EPKG_OK;
@@ -75,7 +75,7 @@
 		{"POST-DEINSTALL", PKG_SCRIPT_DEINSTALL, PKG_SCRIPT_POST_DEINSTALL},
 	};

-	pkg_get(pkg, PKG_PREFIX, &prefix, PKG_NAME, &name, PKG_VERSION, &version);
+	pkg_get(pkg, PKG_PREFIX, &prefix);

 	for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) {
 		if (map[i].a == type)
@@ -93,8 +93,7 @@
 			pkg_config_bool(PKG_CONFIG_DEBUG_SCRIPTS, &debug);
 			if (debug)
 				sbuf_printf(script_cmd, "set -x\n");
-			sbuf_printf(script_cmd, "set -- %s-%s",
-			    name, version);
+			pkg_sbuf_printf(script_cmd, "set -- %s-%s", pkg, pkg);

 			if (j == map[i].b) {
 				/* add arg **/


Added a flush to get prompt working under Linux; cleaned up headers.

svn path=/trunk/; revision=2348

--- utils/pltcl.c
+++ utils/pltcl.c
@@ -1,68 +1,5 @@
 /* $Id$
- * $Log$
- * Revision 1.13  2000/12/18 21:01:50  airwin
- * Change to new style plplot/*.h header file locations.
- *
- * Revision 1.12  1995/10/22 17:46:24  mjl
- * Removed call to plParseOpts, as this is now done in pltclMain(), and removed
- * automatic call to plinit().  Now users can/need-to call plinit() as required
- * by the application.  You can use the new plglevel accessor function to
- * determine what state the package is in (e.g. whether plinit has already been
- * called) to build stand-alone plot modules.
- *
- * Revision 1.11  1995/07/27  21:17:06  furnish
- * Improvement of arg parsing for use in extended shells.
- *
- * Revision 1.10  1995/06/01  21:47:10  mjl
- * Now is [incr Tcl] aware, if HAVE_ITCL has been defined (done during
- * configure).
- *
- * Revision 1.9  1995/05/07  03:17:20  mjl
- * Changed to use new name for options-parsing function plParseOpts().
- *
- * Revision 1.8  1994/11/02  19:59:47  mjl
- * Changed prompt.
- *
- * Revision 1.7  1994/09/23  07:54:17  mjl
- * Changed to a more powerful prompt mechanism.  Prompt now gives program
- * name (pltcl) followed by an underscore and the current stream number.
- * Very handy when doing multiple stream work.
- *
- * Revision 1.6  1994/09/18  07:15:42  mjl
- * Changed the syntax for pltclMain() in order for it to work better with
- * shared libraries.  In particular, Tcl_AppInit is no longer external but
- * passed as a function pointer.
- *
- * Revision 1.5  1994/08/25  04:05:16  mjl
- * Fixed error output; removes spurious <RET> at end.
- *
- * Revision 1.4  1994/07/19  22:33:16  mjl
- * Internal header file inclusion changed to /not/ use a search path so that
- * it will work better with makedepend.
- *
- * Revision 1.3  1994/06/30  18:55:50  mjl
- * Minor changes to eliminate gcc -Wall warnings.
- *
- * Revision 1.2  1994/06/24  20:41:35  mjl
- * Added error handler specific to pltcl.  Ensures output device is in text
- * mode before issuing error message.
- *
- * Revision 1.1  1994/06/23  22:51:28  mjl
- * A plotting interpreter that uses Tcl to drive PLplot primitives.  This can
- * be used with virtually any PLplot output driver.  The executable is an
- * extended tclsh that has been embellished with a (soon to be) large set
- * of Tcl commands for executing PLplot graphics calls.  The scripts are not
- * the same as those that plserver can execute, as the latter is object-based
- * and uses widget commands, whereas pltcl uses global commands to drive
- * PLplot.  The two style of commands are similar enough, however (differing
- * only by an introducer) that a text filter could be used to go between
- * them.
- */
-
-/*----------------------------------------------------------------------*\
  *
- * pltcl.c --
- *
  *	Main program for Tcl-interface to PLplot.  Allows interpretive
  *	execution of plotting primitives without regard to output driver.
  *
@@ -70,7 +7,7 @@
  * IFS, University of Texas at Austin
  * 19-Jun-1994
  *
-\*----------------------------------------------------------------------*/
+ */

 #include "plplot/plplotP.h"
 #include "plplot/pltcl.h"
@@ -142,9 +79,9 @@
     plgpls(&pls);

     if (pls->ipls == 0)
-	sprintf(prompt, "pltext; puts -nonewline \"pltcl> \"");
+	sprintf(prompt, "pltext; puts -nonewline \"pltcl> \"; flush stdout");
     else
-	sprintf(prompt, "pltext; puts -nonewline \"pltcl_%d> \"", pls->ipls);
+	sprintf(prompt, "pltext; puts -nonewline \"pltcl_%d> \"; flush stdout", pls->ipls);

     Tcl_VarEval(interp, prompt, 0);


Add missing macro existence check in byte swapping code in bignum.c

--- library/bignum.c
+++ library/bignum.c
@@ -741,7 +741,7 @@
 #if ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ )

 /* For GCC and Clang, have builtins for byte swapping. */
-#if( defined(__GNUC__) && __GNUC_PREREQ(4,3) )
+#if( defined(__GNUC__) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4,3) )
 #define have_bswap
 #elif defined(__clang__)                &&               \
       defined(__has_builtin)            &&               \


Back-out unnecessary change

Back-out unnecessary change

--- src/core/surface/server.c
+++ src/core/surface/server.c
@@ -1247,12 +1247,6 @@
     gpr_free(req);
   }

-  if (gpr_atm_acq_load(&server->shutdown_flag)) {
-    gpr_mu_lock(&server->mu_global);
-    maybe_finish_shutdown(server);
-    gpr_mu_unlock(&server->mu_global);
-  }
-
   server_unref(server);
 }


tab indent SO_RDOMAIN, like all the other SO_* defines.

--- sys/socket.h
+++ sys/socket.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: socket.h,v 1.60 2009/06/05 00:05:22 claudio Exp $	*/
+/*	$OpenBSD: socket.h,v 1.61 2009/06/11 08:11:53 jsg Exp $	*/
 /*	$NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $	*/

 /*
@@ -85,7 +85,7 @@
 #define	SO_ERROR	0x1007		/* get error status and clear */
 #define	SO_TYPE		0x1008		/* get socket type */
 #define	SO_NETPROC	0x1020		/* multiplex; network processing */
-#define SO_RDOMAIN	0x1021		/* routing domain socket belongs to */
+#define	SO_RDOMAIN	0x1021		/* routing domain socket belongs to */

 /*
  * Structure used for manipulating linger option.


Kill process with SIGKILL signal

Kill process with SIGKILL signal

An "adb push" command is not terminated by SIGTERM.

--- app/src/sys/unix/process.c
+++ app/src/sys/unix/process.c
@@ -118,7 +118,7 @@
              (int) pid);
         abort();
     }
-    return kill(pid, SIGTERM) != -1;
+    return kill(pid, SIGKILL) != -1;
 }

 exit_code_t


do not permanently avoid the BRKSIZ gap in the heap for mmap. after some allocations have been made, open it up. this is a variation on a previous change that was lost in the great uvm map rewrite. allows some platforms, notably i386, to fully utilize their address space.

--- uvm/uvm_map.c
+++ uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: uvm_map.c,v 1.159 2013/02/10 19:19:30 beck Exp $	*/
+/*	$OpenBSD: uvm_map.c,v 1.160 2013/04/17 17:46:53 tedu Exp $	*/
 /*	$NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $	*/

 /*
@@ -3641,6 +3641,7 @@
 uvm_map_hint(struct vmspace *vm, vm_prot_t prot)
 {
 	vaddr_t addr;
+	vaddr_t spacing;

 #ifdef __i386__
 	/*
@@ -3654,10 +3655,18 @@
 		return (round_page(addr));
 	}
 #endif
-	/* start malloc/mmap after the brk */
-	addr = (vaddr_t)vm->vm_daddr + BRKSIZ;
+
+	spacing = (MIN((256 * 1024 * 1024), BRKSIZ) - 1);
+
+	/*
+	 * Start malloc/mmap after the brk.
+	 * If the random spacing area has been used up,
+	 * the brk area becomes fair game for mmap as well.
+	 */
+	if (vm->vm_dused < spacing >> PAGE_SHIFT)
+		addr = (vaddr_t)vm->vm_daddr + BRKSIZ;
 #if !defined(__vax__)
-	addr += arc4random() & (MIN((256 * 1024 * 1024), BRKSIZ) - 1);
+	addr += arc4random() & spacing;
 #endif
 	return (round_page(addr));
 }


r60996@windhund:  schwern | 2008-09-11 03:49:44 -0700  Remove the casting by changing to an ok()

--- t/overflow.c
+++ t/overflow.c
@@ -12,8 +12,8 @@

     error = gmtime64_r(&time, &date);

-    is_int( (int)error, (int)NULL,      "gmtime64_r() returned null on overflow" );
-    is_int( errno, EOVERFLOW,           "  errno set to EOVERFLOW" );
+    ok( error == NULL,          "gmtime64_r() returned null on overflow" );
+    is_int( errno, EOVERFLOW,   "  errno set to EOVERFLOW" );

     done_testing();
     return 0;


Make definition visible before it is used

--- src/cpp/src/TESTS/tutil.h
+++ src/cpp/src/TESTS/tutil.h
@@ -6,6 +6,19 @@
 #include <array>
 #include <limits>
 #include <cmath>
+
+template<typename T, size_t N>
+std::ostream& operator<<(std::ostream& os, const std::array<T, N>& arr) {
+  if constexpr (N == 0) {
+    return os << "[]";
+  }
+
+  os << "[" << arr[0];
+  for (size_t i = 1; i < N; ++i) {
+    os << ", " << arr[i];
+  }
+  return os << "]";
+}

 class TEST{

@@ -65,19 +78,6 @@
     std::ostream& _out;
 };

-template<typename T, size_t N>
-std::ostream& operator<<(std::ostream& os, const std::array<T, N>& arr) {
-  if constexpr (N == 0) {
-    return os << "[]";
-  }
-
-  os << "[" << arr[0];
-  for (size_t i = 1; i < N; ++i) {
-    os << ", " << arr[i];
-  }
-  return os << "]";
-}
-
 bool approxEqual(double lhs, double rhs) {
   // Following a similar, but slightly simplified approach as Catch2::Approx here
   constexpr double epsilon = std::numeric_limits<float>::epsilon() * 100;


doc fix.

doc fix.

git-svn-id: 4b6d41e9940b00d32d826e7d279a79f5b8ae3021@1409 459513c6-d918-8e31-8e7a-abb81885386f

--- libs/std/int32.c
+++ libs/std/int32.c
@@ -162,7 +162,7 @@
 **/
 INT32_UNOP(neg,-);
 /**
-	int32_complement : #int32 -> #int32 -> #int32
+	int32_complement : #int32 -> #int32
 	<doc>Return the one-complement bitwised integer</doc>
 **/
 INT32_UNOP(complement,~);


set socket to blocking for SSL_connect, unset afterwards

--- libsrsirc/conn.c
+++ libsrsirc/conn.c
@@ -201,21 +201,33 @@
 		}
 		D("(%p) sent proxy logon sequence", (void *)ctx);

-		//D("(%p) setting to blocking mode", (void *)ctx);
-
-		//if (!lsi_b_blocking(sh.sck, true)) {
-		//	WE("(%p) failed to set blocking mode", (void *)ctx);
-		//	lsi_b_close(sh.sck);
-		//	ctx->sh.sck = -1;
-		//	return false;
-		//}
-	}
-
-	if (ctx->ssl && !(ctx->sh.shnd = lsi_b_sslize(sh.sck, ctx->sctx))) {
-		lsi_b_close(sh.sck);
-		ctx->sh.sck = -1;
-		W("connect bailing out; couldn't initiate ssl");
-		return false;
+	}
+
+	if (ctx->ssl) {
+		D("(%p) setting to blocking mode for ssl connect", (void *)ctx);
+
+		if (!lsi_b_blocking(sh.sck, true)) {
+			WE("(%p) failed to set blocking mode", (void *)ctx);
+			lsi_b_close(sh.sck);
+			ctx->sh.sck = -1;
+			return false;
+		}
+
+		if (!(ctx->sh.shnd = lsi_b_sslize(sh.sck, ctx->sctx))) {
+			lsi_b_close(sh.sck);
+			ctx->sh.sck = -1;
+			W("connect bailing out; couldn't initiate ssl");
+			return false;
+		}
+
+		D("(%p) setting to nonblocking mode after ssl connect", (void *)ctx);
+
+		if (!lsi_b_blocking(sh.sck, false)) {
+			WE("(%p) failed to clear blocking mode", (void *)ctx);
+			lsi_b_close(sh.sck);
+			ctx->sh.sck = -1;
+			return false;
+		}
 	}

 	ctx->state = ON;


Simplify code and avoid exceeding the 80 characters per line limit

--- libyara/object.c
+++ libyara/object.c
@@ -1100,15 +1100,17 @@
             "%s%s = \"",
             indent_spaces,
             object->identifier);
+
         for (int i = 0; i < ((YR_OBJECT_STRING*) object)->value->length; i++)
         {
-          if (isprint(((YR_OBJECT_STRING*) object)->value->c_string[i]))
-            printf("%c",
-                ((YR_OBJECT_STRING*) object)->value->c_string[i]);
+          char c = ((YR_OBJECT_STRING*) object)->value->c_string[i];
+
+          if (isprint(c))
+            printf("%c", c);
           else
-            printf("\\x%02x",
-                (unsigned char) ((YR_OBJECT_STRING*) object)->value->c_string[i]);
+            printf("\\x%02x", (unsigned char) c);
         }
+
         printf("\"\n");
       }
       break;


Remove code that is not necessary.

Remove code that is not necessary.

--- libyara/parser.c
+++ libyara/parser.c
@@ -635,26 +635,7 @@

       goto _exit;
     }
-
-    if (modifier.flags & STRING_GFLAGS_BASE64 ||
-        modifier.flags & STRING_GFLAGS_BASE64_WIDE)
-    {
-      RE re;
-
-      FAIL_ON_ERROR(yr_arena_reserve_memory(
-          compiler->code_arena, sizeof(int64_t) + RE_MAX_CODE_SIZE));
-
-      re.flags = 0;
-
-      FAIL_ON_ERROR_WITH_CLEANUP(
-          yr_arena_write_data(
-              compiler->re_code_arena,
-              &re,
-              sizeof(re),
-              NULL),
-          yr_re_ast_destroy(re_ast));
-    }
-
+
     if (re_ast->flags & RE_FLAGS_FAST_REGEXP)
       modifier.flags |= STRING_GFLAGS_FAST_REGEXP;


Eliminate some debugging which has overstayed its usefulness

--- bin/varnishd/cache/cache_fetch.c
+++ bin/varnishd/cache/cache_fetch.c
@@ -536,8 +536,6 @@
 	if (bo->state != BOS_FAILED)
 		VBO_setstate(bo, BOS_FINISHED);

-VSLb(bo->vsl, SLT_Debug, "YYY REF %d %d",
-    bo->refcount, bo->fetch_obj->objcore->refcnt);
 	return (F_STP_DONE);
 }

@@ -691,20 +689,6 @@
 	return (F_STP_DONE);
 }

-static const char *
-vbf_step_name(enum fetch_step stp)
-{
-	switch (stp) {
-#define FETCH_STEP(l, U, arg)						\
-		case F_STP_##U:						\
-			return (#U);
-#include "tbl/steps.h"
-#undef FETCH_STEP
-	default:
-		return ("F-step ?");
-	}
-}
-
 static void
 vbf_fetch_thread(struct worker *wrk, void *priv)
 {
@@ -739,8 +723,6 @@
 		default:
 			WRONG("Illegal fetch_step");
 		}
-		VSLb(bo->vsl, SLT_Debug, "%s -> %s",
-		    vbf_step_name(bo->step), vbf_step_name(stp));
 	}
 	assert(WRW_IsReleased(wrk));


daemon: use g_ascii_strtod instead of sscanf for locale-independent float conversion

--- src/daemon/snra-manager.c
+++ src/daemon/snra-manager.c
@@ -572,7 +572,8 @@
       if (id_str != NULL)
         sscanf (id_str, "%u", &client_id);

-      if (vol_str && sscanf (vol_str, "%lf", &new_vol)) {
+      if (vol_str) {
+        new_vol = g_ascii_strtod (vol_str, NULL);
         new_vol = CLAMP (new_vol, 0.0, 10.0);
         if (client_id == 0)
           snra_manager_adjust_volume (manager, new_vol);


egl: remove egl_gallium from the loader

egl: remove egl_gallium from the loader

Acked-by: Kristian Høgsberg <ca9b5b1e27d4fa7f4ba6848bdd08ca52cfd6330c@bitplanet.net>
Reviewed-by: Eric Anholt <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@anholt.net>
Informally acked-by: Jose Fonseca

--- src/egl/main/egldriver.c
+++ src/egl/main/egldriver.c
@@ -518,19 +518,6 @@

 /**
- * Add egl_gallium to the module array.
- */
-static void
-_eglAddGalliumDriver(void)
-{
-#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM
-   void *external = (void *) "egl_gallium";
-   _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external);
-#endif
-}
-
-
-/**
  * Add built-in drivers to the module array.
  */
 static void
@@ -562,7 +549,6 @@
        * Add other drivers only when EGL_DRIVER is not set.  The order here
        * decides the priorities.
        */
-      _eglAddGalliumDriver();
       _eglAddBuiltInDrivers();
    }


The data structure used in unaccent is a trie, not suffix tree.

Fix the term used in variable and struct names, and comments.

Alexander Korotkov

--- contrib/unaccent/unaccent.c
+++ contrib/unaccent/unaccent.c
@@ -23,30 +23,29 @@
 PG_MODULE_MAGIC;

 /*
- * Unaccent dictionary uses uncompressed suffix tree to find a
- * character to replace. Each node of tree is an array of
- * SuffixChar struct with length = 256 (n-th element of array
+ * Unaccent dictionary uses a trie to find a character to replace. Each node of
+ * the trie is an array of 256 TrieChar structs (n-th element of array
  * corresponds to byte)
  */
-typedef struct SuffixChar
-{
-	struct SuffixChar *nextChar;
+typedef struct TrieChar
+{
+	struct TrieChar *nextChar;
 	char	   *replaceTo;
 	int			replacelen;
-} SuffixChar;
-
-/*
- * placeChar - put str into tree's structure, byte by byte.
- */
-static SuffixChar *
-placeChar(SuffixChar *node, unsigned char *str, int lenstr, char *replaceTo, int replacelen)
-{
-	SuffixChar *curnode;
+} TrieChar;
+
+/*
+ * placeChar - put str into trie's structure, byte by byte.
+ */
+static TrieChar *
+placeChar(TrieChar *node, unsigned char *str, int lenstr, char *replaceTo, int replacelen)
+{
+	TrieChar *curnode;

 	if (!node)
 	{
-		node = palloc(sizeof(SuffixChar) * 256);
-		memset(node, 0, sizeof(SuffixChar) * 256);
+		node = palloc(sizeof(TrieChar) * 256);
+		memset(node, 0, sizeof(TrieChar) * 256);
 	}

 	curnode = node + *str;
@@ -71,13 +70,14 @@
 }

 /*
- * initSuffixTree  - create suffix tree from file. Function converts
- * UTF8-encoded file into current encoding.
- */
-static SuffixChar *
-initSuffixTree(char *filename)
-{
-	SuffixChar *volatile rootSuffixTree = NULL;
+ * initTrie  - create trie from file.
+ *
+ * Function converts UTF8-encoded file into current encoding.
+ */
+static TrieChar *
+initTrie(char *filename)
+{
+	TrieChar *volatile rootTrie = NULL;
 	MemoryContext ccxt = CurrentMemoryContext;
 	tsearch_readline_state trst;
 	volatile bool skip;
@@ -161,7 +161,7 @@
 				}

 				if (state >= 3)
-					rootSuffixTree = placeChar(rootSuffixTree,
+					rootTrie = placeChar(rootTrie,
 											   (unsigned char *) src, srclen,
 											   trg, trglen);

@@ -192,14 +192,14 @@

 	tsearch_readline_end(&trst);

-	return rootSuffixTree;
-}
-
-/*
- * findReplaceTo - find multibyte character in tree
- */
-static SuffixChar *
-findReplaceTo(SuffixChar *node, unsigned char *src, int srclen)
+	return rootTrie;
+}
+
+/*
+ * findReplaceTo - find multibyte character in trie
+ */
+static TrieChar *
+findReplaceTo(TrieChar *node, unsigned char *src, int srclen)
 {
 	while (node)
 	{
@@ -221,7 +221,7 @@
 unaccent_init(PG_FUNCTION_ARGS)
 {
 	List	   *dictoptions = (List *) PG_GETARG_POINTER(0);
-	SuffixChar *rootSuffixTree = NULL;
+	TrieChar   *rootTrie = NULL;
 	bool		fileloaded = false;
 	ListCell   *l;

@@ -235,7 +235,7 @@
 				ereport(ERROR,
 						(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 						 errmsg("multiple Rules parameters")));
-			rootSuffixTree = initSuffixTree(defGetString(defel));
+			rootTrie = initTrie(defGetString(defel));
 			fileloaded = true;
 		}
 		else
@@ -254,7 +254,7 @@
 				 errmsg("missing Rules parameter")));
 	}

-	PG_RETURN_POINTER(rootSuffixTree);
+	PG_RETURN_POINTER(rootTrie);
 }

 PG_FUNCTION_INFO_V1(unaccent_lexize);
@@ -262,21 +262,21 @@
 Datum
 unaccent_lexize(PG_FUNCTION_ARGS)
 {
-	SuffixChar *rootSuffixTree = (SuffixChar *) PG_GETARG_POINTER(0);
+	TrieChar   *rootTrie = (TrieChar *) PG_GETARG_POINTER(0);
 	char	   *srcchar = (char *) PG_GETARG_POINTER(1);
 	int32		len = PG_GETARG_INT32(2);
 	char	   *srcstart,
 			   *trgchar = NULL;
 	int			charlen;
 	TSLexeme   *res = NULL;
-	SuffixChar *node;
+	TrieChar   *node;

 	srcstart = srcchar;
 	while (srcchar - srcstart < len)
 	{
 		charlen = pg_mblen(srcchar);

-		node = findReplaceTo(rootSuffixTree, (unsigned char *) srcchar, charlen);
+		node = findReplaceTo(rootTrie, (unsigned char *) srcchar, charlen);
 		if (node && node->replaceTo)
 		{
 			if (!res)


Keyborg: do not trim response before sending back to master

ADC sampling is slower than SPI communication. If we spend more CPU
cycle trimming the response, we are just wasting time and letting SPI
bus sit idle.

BUG=None
TEST=Build and boot. Check scanning rate.
BRANCH=None

Change-Id: I9a4ece28a29ffd3205931ea71958cbc73642be6b
Signed-off-by: Vic Yang <5fd92abeee651458f98e2856f4f200ee971cee4d@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200673
Reviewed-by: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>

--- board/keyborg/touch_scan.c
+++ board/keyborg/touch_scan.c
@@ -162,10 +162,7 @@
 			resp->data[ROW_COUNT - 1 - i] = v;
 		}

-		/* Trim trailing zeros. */
-		for (i = 0; i < ROW_COUNT; ++i)
-			if (resp->data[i] >= THRESHOLD)
-				resp->size = i + 1;
+		resp->size = ROW_COUNT;

 		/* Flush the last response */
 		if (col != 0)
@@ -220,9 +217,7 @@
 			resp = spi_master_wait_response_done();
 			if (resp == NULL)
 				return EC_ERROR_UNKNOWN;
-			memcpy(last_dptr, resp->data, resp->size);
-			memset(last_dptr + resp->size, 0,
-					ROW_COUNT - resp->size);
+			memcpy(last_dptr, resp->data, ROW_COUNT);
 			encode_add_column(last_dptr);
 		}

@@ -242,8 +237,7 @@
 	resp = spi_master_wait_response_done();
 	if (resp == NULL)
 		return EC_ERROR_UNKNOWN;
-	memcpy(last_dptr, resp->data, resp->size);
-	memset(last_dptr + resp->size, 0, ROW_COUNT - resp->size);
+	memcpy(last_dptr, resp->data, ROW_COUNT);
 	encode_add_column(last_dptr);

 	master_slave_sync(20);


board/osiris/usbc_config.c: Format with clang-format

BUG=b:236386294
BRANCH=none
TEST=none

Change-Id: I058af98a401e9a43980ea85cd2eaa58f4347122b
Signed-off-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728804
Reviewed-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>

--- board/osiris/usbc_config.c
+++ board/osiris/usbc_config.c
@@ -32,8 +32,8 @@
 #include "usb_pd.h"
 #include "usb_pd_tcpm.h"

-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)

 /* USBC TCPC configuration */
 const struct tcpc_config_t tcpc_config[] = {
@@ -94,7 +94,6 @@

 unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);

-
 /*
  * USB3 MB/DB mux configuration - the top level mux still needs to be set
  * to the virtual_usb_mux_driver so the AP gets notified of mux changes
@@ -144,7 +143,6 @@
 };
 BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);

-
 #ifdef CONFIG_CHARGE_RAMP_SW

 /*
@@ -169,8 +167,8 @@
 	}

 	if (voltage < BC12_MIN_VOLTAGE) {
-		CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
-			port, voltage, BC12_MIN_VOLTAGE);
+		CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+			voltage, BC12_MIN_VOLTAGE);
 		return 1;
 	}

@@ -220,7 +218,6 @@
 	/* Enable BC1.2 interrupts. */
 	gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
 	gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
-
 }
 DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);


util: Allow util_draw_texquad to draw quads with non-integer coordinates.

--- src/gallium/auxiliary/util/u_draw_quad.c
+++ src/gallium/auxiliary/util/u_draw_quad.c
@@ -82,7 +82,7 @@
    uint numAttribs = 2, i, j;
    uint vertexBytes = 4 * (4 * numAttribs * sizeof(float));
    struct pipe_resource *vbuf = NULL;
-   uint *v = NULL;
+   float *v = NULL;

    v = MALLOC(vertexBytes);
    if (v == NULL)
@@ -121,7 +121,7 @@

    vbuf = pipe_user_buffer_create(pipe->screen, v, vertexBytes,
 				  PIPE_BIND_VERTEX_BUFFER);
-   if (!vbuf)
+   if (!vbuf)
       goto out;

    util_draw_vertex_buffer(pipe, cso, vbuf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, 2);


radeonsi: add more cases for copying unsupported formats to resource_copy_region

Ported from r600g commit:

8891b2f9c91b2f6c8625184c23a10b8e55875dc0

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>

NOTE: This is a candidate for the 9.1 branch.

--- src/gallium/drivers/radeonsi/r600_blit.c
+++ src/gallium/drivers/radeonsi/r600_blit.c
@@ -429,6 +429,18 @@
 			r600_change_format(dst, dst_level, &orig_info[1],
 					   PIPE_FORMAT_R8G8B8A8_UNORM);
 			break;
+		case 8:
+			r600_change_format(src, src_level, &orig_info[0],
+					   PIPE_FORMAT_R16G16B16A16_UINT);
+			r600_change_format(dst, dst_level, &orig_info[1],
+					   PIPE_FORMAT_R16G16B16A16_UINT);
+			break;
+		case 16:
+			r600_change_format(src, src_level, &orig_info[0],
+					   PIPE_FORMAT_R32G32B32A32_UINT);
+			r600_change_format(dst, dst_level, &orig_info[1],
+					   PIPE_FORMAT_R32G32B32A32_UINT);
+			break;
 		default:
 			fprintf(stderr, "Unhandled format %s with blocksize %u\n",
 				util_format_short_name(src->format), blocksize);


radeonsi: add a workaround for a bug in LLVM <= 3.8

This is not directly applicable to stable and needs to be backported.

Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>

--- src/gallium/drivers/radeonsi/si_shader.c
+++ src/gallium/drivers/radeonsi/si_shader.c
@@ -555,6 +555,13 @@
 	LLVMValueRef result = get_indirect_index(ctx, ind, rel_index);
 	LLVMValueRef c_max = LLVMConstInt(ctx->i32, num - 1, 0);
 	LLVMValueRef cc;
+
+	/* LLVM 3.8: If indirect resource indexing is used:
+	 * - SI & CIK hang
+	 * - VI crashes
+	 */
+	if (HAVE_LLVM <= 0x0308)
+		return LLVMGetUndef(ctx->i32);

 	if (util_is_power_of_two(num)) {
 		result = LLVMBuildAnd(builder, result, c_max, "");


simplified meta data loader logic

simplified meta data loader logic

--- tae/loader.c
+++ tae/loader.c
@@ -100,33 +100,33 @@
   jsmntok_t tokens[128];
   load_json(f, output, 2048, tokens, 128);

-  int i = 1;
-  char line[MAX_JSON_LINE_CHARS];
-  while (tokens[i].end != 0 && tokens[i].end < tokens[0].end) {
-
-    if (tokens[i].type == JSMN_STRING) {
-      strncpy(line, "", sizeof(line));
-      strncpy(line, output + tokens[i].start, tokens[i].end - tokens[i].start);
+  int i = 0, j, j_max;
+  char line[MAX_JSON_LINE_CHARS];
+
+  if (tokens[i].type == JSMN_OBJECT) {
+    // iterate through meta object parts
+    j_max = tokens[i].size;
+    for (j = 0; j < j_max; j++) {
       i++;
-      if (strcmp(line, "title") == 0) {
+      if (j % 2 == 0 && tokens[i].type == JSMN_STRING) {
         load_json_token(output, line, tokens, i);
-        strncpy(data->title, line, sizeof(data->title));
-      } else if (strcmp(line, "version") == 0) {
-        load_json_token(output, line, tokens, i);
-        strncpy(data->version, line, sizeof(data->version));
-      } else if (strcmp(line, "author") == 0) {
-        load_json_token(output, line, tokens, i);
-        strncpy(data->author, line, sizeof(data->author));
-      } else if (strcmp(line, "year") == 0) {
-        load_json_token(output, line, tokens, i);
-        data->cyear = atoi(line);
-      }
-    }
-    if (tokens[i].end >= tokens[0].end)
-      break;
-    i++;
-  }
-
+        // get meta object part content by key
+        if (strcmp(line, "title") == 0) {
+          load_json_token(output, line, tokens, i+1);
+          strncpy(data->title, line, sizeof(data->title));
+        } else if (strcmp(line, "version") == 0) {
+          load_json_token(output, line, tokens, i+1);
+          strncpy(data->version, line, sizeof(data->version));
+        } else if (strcmp(line, "author") == 0) {
+          load_json_token(output, line, tokens, i+1);
+          strncpy(data->author, line, sizeof(data->author));
+        } else if (strcmp(line, "year") == 0) {
+          load_json_token(output, line, tokens, i+1);
+          data->cyear = atoi(line);
+        }
+      }
+    }
+  }
   fclose(f);
 }


Updating to remove Ardiuno references

Updating to remove Ardiuno references

--- firmware/Adafruit_VS1053.h
+++ firmware/Adafruit_VS1053.h
@@ -13,18 +13,6 @@
  ****************************************************/
 #ifndef ADAFRUIT_VS1053_H
 #define ADAFRUIT_VS1053_H
-
-#if (ARDUINO >= 100)
- #include <Arduino.h>
-#else
- #include <WProgram.h>
- #include <pins_arduino.h>
-#endif
-
-#include "pins_arduino.h"
-#include "wiring_private.h"
-#include <SPI.h>
-#include <SD.h>

 #ifdef __SAM3X8E__
 typedef volatile RwReg PortReg;


radeonsi: remove LLVMNoUnwindAttribute uses

always set by gallivm

Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>

--- src/gallium/drivers/radeonsi/si_shader.c
+++ src/gallium/drivers/radeonsi/si_shader.c
@@ -494,7 +494,7 @@
 	args[2] = buffer_index;
 	input = lp_build_intrinsic(gallivm->builder,
 		"llvm.SI.vs.load.input", ctx->v4f32, args, 3,
-		LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+		LLVMReadNoneAttribute);

 	/* Break up the vec4 into individual components */
 	for (chan = 0; chan < 4; chan++) {
@@ -909,8 +909,7 @@
 		         type_names[func]);

 		return lp_build_intrinsic(gallivm->builder, name, types[func], args,
-		                          ARRAY_SIZE(args), LLVMReadOnlyAttribute |
-		                          LLVMNoUnwindAttribute);
+		                          ARRAY_SIZE(args), LLVMReadOnlyAttribute);
 	} else {
 		LLVMValueRef args[] = {
 			LLVMBuildBitCast(gallivm->builder, rsrc, ctx->v16i8, ""),
@@ -941,8 +940,7 @@
 		         type_names[func], arg_type);

 		return lp_build_intrinsic(gallivm->builder, name, types[func], args,
-		                          ARRAY_SIZE(args), LLVMReadOnlyAttribute |
-		                          LLVMNoUnwindAttribute);
+		                          ARRAY_SIZE(args), LLVMReadOnlyAttribute);
 	}
 }

@@ -1229,14 +1227,14 @@
 	value = lp_build_intrinsic(gallivm->builder,
 				   "llvm.SI.buffer.load.dword.i32.i32",
 				   ctx->i32, args, 9,
-				   LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
+				   LLVMReadOnlyAttribute);
 	if (tgsi_type_is_64bit(type)) {
 		LLVMValueRef value2;
 		args[2] = lp_build_const_int32(gallivm, (param * 4 + swizzle + 1) * 256);
 		value2 = lp_build_intrinsic(gallivm->builder,
 					    "llvm.SI.buffer.load.dword.i32.i32",
 					    ctx->i32, args, 9,
-					    LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
+					    LLVMReadOnlyAttribute);
 		return radeon_llvm_emit_fetch_64bit(bld_base, type,
 						    value, value2);
 	}
@@ -1388,12 +1386,12 @@
 			args[1] = attr_number;
 			front = lp_build_intrinsic(gallivm->builder, intr_name,
 						ctx->f32, args, args[3] ? 4 : 3,
-						LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+						LLVMReadNoneAttribute);

 			args[1] = back_attr_number;
 			back = lp_build_intrinsic(gallivm->builder, intr_name,
 					       ctx->f32, args, args[3] ? 4 : 3,
-					       LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+					       LLVMReadNoneAttribute);

 			result[chan] = LLVMBuildSelect(gallivm->builder,
 						is_face_positive,
@@ -1410,7 +1408,7 @@
 		args[3] = interp_param;
 		result[0] = lp_build_intrinsic(gallivm->builder, intr_name,
 					ctx->f32, args, args[3] ? 4 : 3,
-					LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+					LLVMReadNoneAttribute);
 		result[1] =
 		result[2] = lp_build_const_float(gallivm, 0.0f);
 		result[3] = lp_build_const_float(gallivm, 1.0f);
@@ -1425,7 +1423,7 @@
 			args[3] = interp_param;
 			result[chan] = lp_build_intrinsic(gallivm->builder, intr_name,
 						ctx->f32, args, args[3] ? 4 : 3,
-						LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+						LLVMReadNoneAttribute);
 		}
 	}
 }
@@ -1597,7 +1595,7 @@
 	LLVMValueRef args[2] = {resource, offset};

 	return lp_build_intrinsic(builder, "llvm.SI.load.const", return_type, args, 2,
-			       LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+			       LLVMReadNoneAttribute);
 }

 static LLVMValueRef load_sample_position(struct radeon_llvm_context *radeon_bld, LLVMValueRef sample_id)
@@ -1816,7 +1814,7 @@
 		value = lp_build_intrinsic(gallivm->builder,
 					   "llvm.amdgcn.ps.live",
 					   ctx->i1, NULL, 0,
-					   LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+					   LLVMReadNoneAttribute);
 		value = LLVMBuildNot(gallivm->builder, value, "");
 		value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, "");
 		break;
@@ -2031,7 +2029,7 @@
 			packed = lp_build_intrinsic(base->gallivm->builder,
 						    "llvm.SI.packf16",
 						    ctx->i32, pack_args, 2,
-						    LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+						    LLVMReadNoneAttribute);
 			args[chan + 5] =
 				LLVMBuildBitCast(base->gallivm->builder,
 						 packed, ctx->f32, "");
@@ -2828,7 +2826,7 @@
 	args[0] = lp_build_const_int32(gallivm,	SENDMSG_GS_OP_NOP | SENDMSG_GS_DONE);
 	args[1] = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_GS_WAVE_ID);
 	lp_build_intrinsic(gallivm->builder, "llvm.SI.sendmsg",
-			   ctx->voidt, args, 2, LLVMNoUnwindAttribute);
+			   ctx->voidt, args, 2, 0);
 }

 static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
@@ -3318,7 +3316,7 @@
 		lp_build_const_int32(gallivm, 0xf70)
 	};
 	lp_build_intrinsic(builder, "llvm.amdgcn.s.waitcnt",
-			   ctx->voidt, args, 1, LLVMNoUnwindAttribute);
+			   ctx->voidt, args, 1, 0);
 }

 static void membar_emit(
@@ -3620,7 +3618,7 @@
 	emit_data->output[emit_data->chan] = lp_build_intrinsic(
 			builder, intrinsic_name, dst_type,
 			emit_data->args, emit_data->arg_count,
-			LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
+			LLVMReadOnlyAttribute);
 }

 static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx,
@@ -3700,7 +3698,7 @@
 			lp_build_intrinsic(
 				builder, "llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type,
 				emit_data->args, emit_data->arg_count,
-				LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
+				LLVMReadOnlyAttribute);
 	} else {
 		build_int_type_name(LLVMTypeOf(emit_data->args[0]),
 				    coords_type, sizeof(coords_type));
@@ -3712,7 +3710,7 @@
 			lp_build_intrinsic(
 				builder, intrinsic_name, emit_data->dst_type,
 				emit_data->args, emit_data->arg_count,
-				LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
+				LLVMReadOnlyAttribute);
 	}
 }

@@ -3843,8 +3841,7 @@

 		lp_build_intrinsic(
 			builder, intrinsic_name, emit_data->dst_type,
-			emit_data->args, emit_data->arg_count,
-			LLVMNoUnwindAttribute);
+			emit_data->args, emit_data->arg_count, 0);
 	}
 }

@@ -3902,8 +3899,8 @@
 	if (target == TGSI_TEXTURE_BUFFER) {
 		emit_data->output[emit_data->chan] = lp_build_intrinsic(
 			builder, "llvm.amdgcn.buffer.store.format.v4f32",
-			emit_data->dst_type, emit_data->args, emit_data->arg_count,
-			LLVMNoUnwindAttribute);
+			emit_data->dst_type, emit_data->args,
+			emit_data->arg_count, 0);
 	} else {
 		build_int_type_name(LLVMTypeOf(emit_data->args[1]),
 				    coords_type, sizeof(coords_type));
@@ -3913,8 +3910,7 @@
 		emit_data->output[emit_data->chan] =
 			lp_build_intrinsic(
 				builder, intrinsic_name, emit_data->dst_type,
-				emit_data->args, emit_data->arg_count,
-				LLVMNoUnwindAttribute);
+				emit_data->args, emit_data->arg_count, 0);
 	}
 }

@@ -4080,8 +4076,7 @@

 	tmp = lp_build_intrinsic(
 		builder, intrinsic_name, bld_base->uint_bld.elem_type,
-		emit_data->args, emit_data->arg_count,
-		LLVMNoUnwindAttribute);
+		emit_data->args, emit_data->arg_count, 0);
 	emit_data->output[emit_data->chan] =
 		LLVMBuildBitCast(builder, tmp, bld_base->base.elem_type, "");
 }
@@ -4138,7 +4133,7 @@
 		out = lp_build_intrinsic(
 			builder, "llvm.SI.getresinfo.i32", emit_data->dst_type,
 			emit_data->args, emit_data->arg_count,
-			LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+			LLVMReadNoneAttribute);

 		/* Divide the number of layers by 6 to get the number of cubes. */
 		if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY) {
@@ -4378,7 +4373,7 @@
 	emit_data->output[emit_data->chan] = lp_build_intrinsic(
 		base->gallivm->builder, "llvm.SI.getresinfo.i32",
 		emit_data->dst_type, emit_data->args, emit_data->arg_count,
-		LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+		LLVMReadNoneAttribute);

 	/* Divide the number of layers by 6 to get the number of cubes. */
 	if (target == TGSI_TEXTURE_CUBE_ARRAY ||
@@ -4736,7 +4731,7 @@
 			base->gallivm->builder,
 			"llvm.SI.vs.load.input", emit_data->dst_type,
 			emit_data->args, emit_data->arg_count,
-			LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+			LLVMReadNoneAttribute);
 		return;
 	}

@@ -4790,7 +4785,7 @@
 	emit_data->output[emit_data->chan] = lp_build_intrinsic(
 		base->gallivm->builder, intr_name, emit_data->dst_type,
 		emit_data->args, emit_data->arg_count,
-		LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+		LLVMReadNoneAttribute);
 }

 static void si_llvm_emit_txqs(
@@ -5155,7 +5150,7 @@
 		emit_data->output[chan] =
 			lp_build_intrinsic(gallivm->builder, intr_name,
 					   ctx->f32, args, args[3] ? 4 : 3,
-					   LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+					   LLVMReadNoneAttribute);
 	}
 }

@@ -5247,7 +5242,7 @@
 	args[0] = lp_build_const_int32(gallivm, SENDMSG_GS_OP_EMIT | SENDMSG_GS | (stream << 8));
 	args[1] = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_GS_WAVE_ID);
 	lp_build_intrinsic(gallivm->builder, "llvm.SI.sendmsg",
-			   ctx->voidt, args, 2, LLVMNoUnwindAttribute);
+			   ctx->voidt, args, 2, 0);
 }

 /* Cut one primitive from the geometry shader */
@@ -5266,7 +5261,7 @@
 	args[0] = lp_build_const_int32(gallivm,	SENDMSG_GS_OP_CUT | SENDMSG_GS | (stream << 8));
 	args[1] = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_GS_WAVE_ID);
 	lp_build_intrinsic(gallivm->builder, "llvm.SI.sendmsg",
-			   ctx->voidt, args, 2, LLVMNoUnwindAttribute);
+			   ctx->voidt, args, 2, 0);
 }

 static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
@@ -5287,7 +5282,7 @@
 	lp_build_intrinsic(gallivm->builder,
 			   HAVE_LLVM >= 0x0309 ? "llvm.amdgcn.s.barrier"
 					       : "llvm.AMDGPU.barrier.local",
-			   ctx->voidt, NULL, 0, LLVMNoUnwindAttribute);
+			   ctx->voidt, NULL, 0, 0);
 }

 static const struct lp_build_tgsi_action tex_action = {
@@ -6387,7 +6382,7 @@
 						 lp_build_intrinsic(gallivm->builder,
 								 "llvm.SI.buffer.load.dword.i32.i32",
 								 ctx->i32, args, 9,
-								 LLVMReadOnlyAttribute | LLVMNoUnwindAttribute),
+								 LLVMReadOnlyAttribute),
 						 ctx->f32, "");
 		}
 	}


Update bmp085.h

Update bmp085.h

--- firmware/examples/bmp085.h
+++ firmware/examples/bmp085.h
@@ -23,16 +23,16 @@
 Adafruit_BMP085 bmp;

 // Publish Pressure, Altitude
-char              BMP085info[256];
+char              info_BMP085[256];
 //#ifdef BMP_PUBLISH
-char              BMP085infoS[62];
+char              infoS_BMP085[62];
 //#endif

-unsigned long   BMP085interval = 10000;
+//unsigned long   BMP085interval = 10000;
 //unsigned long   BMP085interval = 30000;
-//unsigned long     BMP085interval = 60000;
+unsigned long     interval_BMP085 = 60000;
 //unsigned long     BMP085altDiff  = 101500;
-unsigned long     BMP085lastTime;
+unsigned long     lastTime_BMP085;

@@ -41,7 +41,7 @@
 //

 // Initialize BMP085
-void InitializeBMP085(){
+void Initialize_BMP085(){
 	if (!bmp.begin()) {
 	    RGB.control(true);
 	    RGB.color(255, 255, 255);
@@ -51,25 +51,19 @@

 		while (1) {}
 	}
-
-	RGB.control(false);
 }

-int getBMP085info(String command){
-    //    Spark.publish("neoUpdate", "updating", publishTTL, PRIVATE);
-
+int getinfo_BMP085(String command){
     float   temp     = bmp.readTemperature();
-    int32_t pressure = bmp.readPressure();
+    float   pressure = bmp.readPressure() / 100.0;
     float   alt      = bmp.readAltitude();
     //float ralt     = bmp.readAltitude(BMP085altDiff);

-
-    sprintf(BMP085info , "{\"temperature\": %.5f, \"pressure\": %.5f, \"altitude\": %.5f}", temp, pressure/100.0, alt );
-    //sprintf(BMP085info , "{\"temperature\": %.5f, \"pressure\": %.5f, \"altitude\": %.5f}", bmp.readTemperature(), bmp.readPressure()/100.0, bmp.readAltitude() );
-
-    //#ifdef BMP_PUBLISH
-        sprintf(BMP085infoS, "{\"t\":%.5f,\"p\":%.5f,\"a\":%.5f,\"ra\":%.5f}", temp, pressure/100.0, alt );
-    //#endif
+    sprintf(info_BMP085 , "{\"temperature\": %.5f, \"pressure\": %.5f, \"altitude\": %.5f}", temp, pressure, alt );
+
+    #ifdef BMP_PUBLISH
+        sprintf(infoS_BMP085, "{\"t\":%.5f,\"p\":%.5f,\"a\":%.5f,\"ra\":%.5f}", temp, pressure, alt );
+    #endif

     #ifdef BMP_SERIAL
         Serial.print("Temperature = ");
@@ -94,67 +88,61 @@
         //Serial.print(ralt);
         //Serial.println(" meters");
     #endif
-    //Spark.publish("neoUpdate", "updated" , publishTTL, PRIVATE);
-
+
     return 1;
 }

 #ifdef BMP_PUBLISH
-void publishBMP085info(){
-    if ( (millis()-BMP085lastTime) < BMP085interval ) {
+void publishinfo_BMP085(){
+    if ( (millis()-lastTime_BMP085) < interval_BMP085 ) {
         return;
     }

-    //Spark.publish("neoUpdate"   , "publish update", publishTTL, PRIVATE);
+    getinfo_BMP085("");

-    getBMP085info("");
+    Spark.publish("BMP085infoEv", infoS_BMP085, publishTTL, PRIVATE);

-    //Spark.publish("neoUpdate"   , "publish updated", publishTTL, PRIVATE);
-
-    Spark.publish("BMP085infoEv", BMP085infoS, publishTTL, PRIVATE);
-    //Spark.publish("BMP085infoEv", "pubishing actual results", publishTTL, PRIVATE);
-
-    BMP085lastTime = millis();
+    lastTime_BMP085 = millis();
 }
 #endif

-void updateBMP085info(){
-    if ( (millis()-BMP085lastTime) < BMP085interval ) {
+void updateinfo_BMP085(){
+    if ( (millis()-lastTime_BMP085) < interval_BMP085 ) {
         return;
     }

-    //Spark.publish("neoUpdate", "function", publishTTL, PRIVATE);
+    getinfo_BMP085("");

-    getBMP085info("");
-
-    BMP085lastTime = millis();
+    lastTime_BMP085 = millis();
 }

 void InitializeApplication_BMP085() {
+    Initialize_BMP085();
+
     #ifdef BMP_SERIAL
         Serial.begin(9600);
     #endif

     #ifdef BMP_VARIABLE
-        Spark.variable( "BMP085"   , &BMP085info   , STRING );
+        Spark.variable( "BMP085"   , &info_BMP085   , STRING );
     #endif

     #ifdef BMP_FUNCTION
-        Spark.function( "getBMP085",  getBMP085info         );
+        Spark.function( "getBMP085",  getinfo_BMP085         );
     #endif

-    getBMP085info("");
+    getinfo_BMP085("");

-    BMP085lastTime = millis();
+    lastTime_BMP085 = millis();
 }

-void runBMP085() {
+void run_BMP085() {
     #ifdef BMP_PUBLISH
-        publishBMP085info();
+        publishinfo_BMP085();
     #else

         #ifdef BMP_VARIABLE
-            updateBMP085info();
+            updateinfo_BMP085();
         #endif

     #endif


removed useless comment, added explanation comment in search_frame_dts

--- search_idx.c
+++ search_idx.c
@@ -93,7 +93,7 @@
     while (i < search->size) {
         url_fseek(seek_pb, i, SEEK_SET);
         compute_idx(read_idx, seek_pb);
-        printf("read_idx->dts %lld, tmp_pts %lld\n",read_idx->dts, tmp_pts );
+        // looks for the frame that has the dts we're looking for, it's located after the frame with that value as pts
         if (read_idx->dts == tmp_pts) {
             search->index_binary_offset = i;
             return 1;
@@ -134,8 +134,6 @@
     SearchContext search;
     Index read_idx;
     Index key_frame;
-//    ByteIOContext pb1;
-    //search.pb = &pb1;

     if (argc < 4) {
         printf("usage: search_idx <parameter type> <index file> <hhmmssff>\n");


Added an option to display sub paths

Added an option to display sub paths

--- src/examples/mpls_dump.c
+++ src/examples/mpls_dump.c
@@ -116,6 +116,12 @@
     {0, NULL}
 };

+VALUE_MAP subpath_type_map[] = {
+  {3, "Interactive Graphics presentation menu"},
+  {4, "Text Subtitle"},
+  {0,NULL}
+};
+
 const char*
 _lookup_str(VALUE_MAP *map, int val)
 {
@@ -319,6 +325,44 @@
             }
         }
     }
+    printf("\n");
+}
+
+static void
+_show_sub_paths(MPLS_PL *pl, int level)
+{
+    int ss, ii;
+
+    for (ss = 0; ss < pl->sub_count; ss++) {
+        MPLS_SUB *sub;
+
+        sub = &pl->sub_path[ii];
+
+        indent_printf(level,   "Sub Path %d:", ss);
+        indent_printf(level+1, "Type: %d (%s)", sub->type, _lookup_str(subpath_type_map, sub->type));
+        indent_printf(level+1, "Repeat: %d", sub->is_repeat);
+        indent_printf(level+1, "Sub playitem count: %d", sub->sub_playitem_count);
+
+        for (ii = 0; ii < sub->sub_playitem_count; ii++) {
+            MPLS_SUB_PI *pi;
+
+            pi = &sub->sub_play_item[ii];
+
+            if (verbose) {
+                indent_printf(level+1, "Sub playitem %d", ii);
+                indent_printf(level+2, "Clip Id %s", pi->clip[0].clip_id);
+                indent_printf(level+2, "Multi clip: %d", pi->is_multi_clip);
+                indent_printf(level+2, "Clip count: %d", pi->clip_count);
+                indent_printf(level+2, "Connection Condition: %02x", pi->connection_condition);
+                indent_printf(level+2, "In-Time: %d", pi->in_time);
+                indent_printf(level+2, "Out-Time: %d", pi->out_time);
+                indent_printf(level+2, "Sync playitem Id: %d", pi->sync_play_item_id);
+                indent_printf(level+2, "Sync PTS: %d", pi->sync_pts);
+            } else {
+                indent_printf(level+1, "%s.m2ts", pi->clip[0].clip_id);
+            }
+        }
+    }
 }

 static uint32_t
@@ -409,7 +453,7 @@
     return 1;
 }

-static int clip_list = 0, playlist_info = 0, chapter_marks = 0;
+static int clip_list = 0, playlist_info = 0, chapter_marks = 0, sub_paths = 0;
 static int repeats = 0, seconds = 0, dups = 0;

 static MPLS_PL*
@@ -462,6 +506,9 @@
     if (clip_list) {
         _show_clip_list(pl, 1);
     }
+    if (sub_paths) {
+        _show_sub_paths(pl, 1);
+    }
     return pl;
 }

@@ -476,6 +523,7 @@
 "    l             - Produces a list of the m2ts clips\n"
 "    i             - Dumps detailed information about each clip\n"
 "    c             - Show chapter marks\n"
+"    p             - Show sub paths\n"
 "    r <N>         - Filter out titles that have >N repeating clips\n"
 "    d             - Filter out duplicate titles\n"
 "    s <seconds>   - Filter out short titles\n"
@@ -485,7 +533,7 @@
     exit(EXIT_FAILURE);
 }

-#define OPTS "vlicfr:ds:"
+#define OPTS "vlicpfr:ds:"

 static int
 _qsort_str_cmp(const void *a, const void *b)
@@ -527,6 +575,10 @@

             case 'c':
                 chapter_marks = 1;
+                break;
+
+            case 'p':
+                sub_paths = 1;
                 break;

             case 'd':


radeonsi: don't set CB_SHADER_MASK=1 if there are no color outputs

This hack isn't needed anymore because of the previous u_blitter commit.

Reviewed-by: Michel Dänzer <242b79f0804cf52679d58f27ed754158c1323c75@amd.com>

--- src/gallium/drivers/radeonsi/si_shader.c
+++ src/gallium/drivers/radeonsi/si_shader.c
@@ -1514,10 +1514,6 @@
 		last_args[6]= uint->zero;
 		last_args[7]= uint->zero;
 		last_args[8]= uint->zero;
-
-		si_shader_ctx->shader->spi_shader_col_format |=
-			V_028714_SPI_SHADER_32_ABGR;
-		si_shader_ctx->shader->cb_shader_mask |= S_02823C_OUTPUT0_ENABLE(0xf);
 	}

 	/* Specify whether the EXEC mask represents the valid mask */


radeonsi: implement shared memory load/store

v2: - Use single region
    - Combine address calculation

Signed-off-by: Bas Nieuwenhuizen <1d31d94f30d40df7951505d1034e1e923d02ec49@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <8c7344a1abdb103e79ecfd488098373070c3c70e@amd.com>
Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>
Reviewed-by: Edward O'Callaghan <117173807d5a49976a891944633465c0daea7f98@alterapraxis.com>

--- src/gallium/drivers/radeonsi/si_shader.c
+++ src/gallium/drivers/radeonsi/si_shader.c
@@ -3071,7 +3071,7 @@

 		buffer_append_args(ctx, emit_data, rsrc, bld_base->uint_bld.zero,
 				   offset, false);
-	} else {
+	} else if (inst->Src[0].Register.File == TGSI_FILE_IMAGE) {
 		LLVMValueRef coords;

 		image_fetch_rsrc(bld_base, &inst->Src[0], false, &rsrc);
@@ -3124,6 +3124,53 @@
 			LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
 }

+static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx,
+                                   const struct tgsi_full_instruction *inst,
+                                   LLVMTypeRef type, int arg)
+{
+	struct gallivm_state *gallivm = &ctx->radeon_bld.gallivm;
+	LLVMBuilderRef builder = gallivm->builder;
+	LLVMValueRef offset, ptr;
+	int addr_space;
+
+	offset = lp_build_emit_fetch(&ctx->radeon_bld.soa.bld_base, inst, arg, 0);
+	offset = LLVMBuildBitCast(builder, offset, ctx->i32, "");
+
+	ptr = ctx->shared_memory;
+	ptr = LLVMBuildGEP(builder, ptr, &offset, 1, "");
+	addr_space = LLVMGetPointerAddressSpace(LLVMTypeOf(ptr));
+	ptr = LLVMBuildBitCast(builder, ptr, LLVMPointerType(type, addr_space), "");
+
+	return ptr;
+}
+
+static void load_emit_memory(
+		struct si_shader_context *ctx,
+		struct lp_build_emit_data *emit_data)
+{
+	const struct tgsi_full_instruction *inst = emit_data->inst;
+	struct lp_build_context *base = &ctx->radeon_bld.soa.bld_base.base;
+	struct gallivm_state *gallivm = &ctx->radeon_bld.gallivm;
+	LLVMBuilderRef builder = gallivm->builder;
+	unsigned writemask = inst->Dst[0].Register.WriteMask;
+	LLVMValueRef channels[4], ptr, derived_ptr, index;
+	int chan;
+
+	ptr = get_memory_ptr(ctx, inst, base->elem_type, 1);
+
+	for (chan = 0; chan < 4; ++chan) {
+		if (!(writemask & (1 << chan))) {
+			channels[chan] = LLVMGetUndef(base->elem_type);
+			continue;
+		}
+
+		index = lp_build_const_int32(gallivm, chan);
+		derived_ptr = LLVMBuildGEP(builder, ptr, &index, 1, "");
+		channels[chan] = LLVMBuildLoad(builder, derived_ptr, "");
+	}
+	emit_data->output[emit_data->chan] = lp_build_gather_values(gallivm, channels, 4);
+}
+
 static void load_emit(
 		const struct lp_build_tgsi_action *action,
 		struct lp_build_tgsi_context *bld_base,
@@ -3135,6 +3182,11 @@
 	const struct tgsi_full_instruction * inst = emit_data->inst;
 	char intrinsic_name[32];
 	char coords_type[8];
+
+	if (inst->Src[0].Register.File == TGSI_FILE_MEMORY) {
+		load_emit_memory(ctx, emit_data);
+		return;
+	}

 	if (inst->Memory.Qualifier & TGSI_MEMORY_VOLATILE)
 		emit_optimization_barrier(ctx);
@@ -3201,7 +3253,7 @@

 		buffer_append_args(ctx, emit_data, rsrc, bld_base->uint_bld.zero,
 				   offset, false);
-	} else {
+	} else if (inst->Dst[0].Register.File == TGSI_FILE_IMAGE) {
 		unsigned target = inst->Memory.Texture;
 		LLVMValueRef coords;

@@ -3297,6 +3349,31 @@
 	}
 }

+static void store_emit_memory(
+		struct si_shader_context *ctx,
+		struct lp_build_emit_data *emit_data)
+{
+	const struct tgsi_full_instruction *inst = emit_data->inst;
+	struct gallivm_state *gallivm = &ctx->radeon_bld.gallivm;
+	struct lp_build_context *base = &ctx->radeon_bld.soa.bld_base.base;
+	LLVMBuilderRef builder = gallivm->builder;
+	unsigned writemask = inst->Dst[0].Register.WriteMask;
+	LLVMValueRef ptr, derived_ptr, data, index;
+	int chan;
+
+	ptr = get_memory_ptr(ctx, inst, base->elem_type, 0);
+
+	for (chan = 0; chan < 4; ++chan) {
+		if (!(writemask & (1 << chan))) {
+			continue;
+		}
+		data = lp_build_emit_fetch(&ctx->radeon_bld.soa.bld_base, inst, 1, chan);
+		index = lp_build_const_int32(gallivm, chan);
+		derived_ptr = LLVMBuildGEP(builder, ptr, &index, 1, "");
+		LLVMBuildStore(builder, data, derived_ptr);
+	}
+}
+
 static void store_emit(
 		const struct lp_build_tgsi_action *action,
 		struct lp_build_tgsi_context *bld_base,
@@ -3311,6 +3388,9 @@

 	if (inst->Dst[0].Register.File == TGSI_FILE_BUFFER) {
 		store_emit_buffer(si_shader_context(bld_base), emit_data);
+		return;
+	} else if (inst->Dst[0].Register.File == TGSI_FILE_MEMORY) {
+		store_emit_memory(si_shader_context(bld_base), emit_data);
 		return;
 	}


Map all low memory.

Map all low memory.

--- kernel/arch/x86/memory.c
+++ kernel/arch/x86/memory.c
@@ -1,21 +1,25 @@
+#include <utility.h>
+#include <debug.h>
+
 #include <arch/x86/memory.h>
-#include <utility.h>
+#include <arch/x86/cpu.h>
+
 #include "memblock.h"
 #include "multiboot.h"
-#include "io.h"

 unsigned long __heap_end = phys_addr(__heap_begin);

-static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
+static inline void clone_pgd_range(pde_t *dst, pde_t *src, int count)
 {
-	memcpy(dst, src, count * sizeof(pgd_t));
+	memcpy(dst, src, count * sizeof(pde_t));
 }

-static void fill_memblock(struct multiboot_info *mbi)
+static void fill_memory_map(struct multiboot_info *mbi)
 {
 	unsigned long mmap_entry = mbi->mmap_addr;
 	unsigned long mmap_end = mmap_entry + mbi->mmap_length;

+	debug("Physical memory map:\n");
 	while (mmap_entry < mmap_end) {
 		struct multiboot_mmap_entry *entry = (void *)mmap_entry;
 		unsigned long long addr = entry->addr;
@@ -28,7 +32,7 @@
 		if (type == MULTIBOOT_AVAILABLE)
 			memblock_add(addr, size);

-		printf("memory region: 0x%x-0x%x type=%u\n",
+		debug("memory region: 0x%x-0x%x type=%u\n",
 			(unsigned long)addr,
 			(unsigned long)(addr + size - 1),
 			type);
@@ -36,19 +40,54 @@
 	}
 }

-void setup_memory(struct multiboot_info *mbi)
+static unsigned long alloc_low_page(void)
+{
+	unsigned long addr = memblock_alloc_range(PAGE_SIZE, PAGE_SIZE,
+					__heap_end, phys_addr(__kernel_end));
+
+	if (!addr)
+		panic("Cannot allocate page!");
+
+	return addr;
+}
+
+static void map_lower_memory(void)
+{
+	static unsigned long KERN_PTE_FLAGS = X86_PTE_PRESENT | X86_PTE_WRITE;
+	static unsigned long KERN_PDE_FLAGS = X86_PDE_PRESENT | X86_PDE_WRITE;
+
+	clone_pgd_range(swapper_page_dir + KERNEL_PGD_BOUNDARY,
+			initial_page_dir + KERNEL_PGD_BOUNDARY,
+			KERNEL_PGD_PTRS);
+
+	unsigned long pde_begin = pgd_index(__kernel_end);
+	unsigned long pde_end = PTRS_PER_PGD;
+	for (unsigned long i = pde_begin; i != pde_end; ++i) {
+		unsigned long addr = phys_addr(i << PGDIR_SHIFT);
+		pte_t *pt = virt_addr(alloc_low_page());
+
+		for (unsigned long j = 0; j != PTRS_PER_PT; ++j) {
+			pt[j] = page_table_entry(addr, KERN_PTE_FLAGS);
+			addr += PAGE_SIZE;
+		}
+		swapper_page_dir[i] = page_dir_entry(pt, KERN_PDE_FLAGS);
+	}
+}
+
+static void reserve_kernel_memory(void)
 {
 	unsigned long kern_addr = phys_addr(__kernel_begin);
 	unsigned long kern_end = __heap_end;
 	unsigned long kern_size = kern_end - kern_addr;

-	fill_memblock(mbi);
+	debug("Reserve kernel memory 0x%x-0x%x\n", kern_addr, kern_end - 1);
+	memblock_reserve(kern_addr, kern_size);
+}

-	printf("reserve kernel memory: 0x%x-0x%x\n", kern_addr, kern_end - 1);
-	memblock_reserve(kern_addr, kern_size);
-
-	clone_pgd_range(swapper_page_dir + KERNEL_PGD_BOUNDARY,
-			initial_page_dir + KERNEL_PGD_BOUNDARY,
-			KERNEL_PGD_PTRS);
+void setup_memory(struct multiboot_info *mbi)
+{
+	fill_memory_map(mbi);
+	reserve_kernel_memory();
+	map_lower_memory();
 	load_cr3(phys_addr(swapper_page_dir));
 }


Fixes use of invalid header data

Fixes use of invalid header data

Fixes a bug when MCUBOOT_VALIDATE_SLOT0 is enabled which caused the
header in Slot 1 to be used for calculating the bootstrap offset. This
bug is masked when MCUBOOT_OVERWRITE_ONLY is not enabled because both
slots have the same header size (usually!). With MCUBOOT_OVERWRITE_ONLY
Slot 1 was erased and the header size would be read as 0xffff resulting
in a jump to the wrong address.

Signed-off-by: Fabio Utzig <66676b1ceaf93296e098708c09494361103aa635@apache.org>

--- boot/bootutil/src/loader.c
+++ boot/bootutil/src/loader.c
@@ -1339,10 +1339,16 @@

 #ifdef MCUBOOT_VALIDATE_SLOT0
     if (reload_headers) {
-            rc = boot_read_image_headers();
-            if (rc != 0) {
-                    goto out;
-            }
+        rc = boot_read_image_headers();
+        if (rc != 0) {
+            goto out;
+        }
+        /* Since headers were reloaded, it can be assumed we just performed a
+         * swap or overwrite. Now the header info that should be used to
+         * provide the data for the bootstrap, which previously was at Slot 1,
+         * was updated to Slot 0.
+         */
+        slot = 0;
     }

     rc = boot_validate_slot(0);


radeonsi: clean up shader value metadata code

No change in behavior.
BTW, tbaa_md_kind == 1, which was the magic number in the code.

Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>

--- src/gallium/drivers/radeonsi/si_shader.c
+++ src/gallium/drivers/radeonsi/si_shader.c
@@ -100,9 +100,12 @@

 	LLVMTargetMachineRef tm;

+	unsigned range_md_kind;
+	unsigned tbaa_md_kind;
 	unsigned uniform_md_kind;
-	LLVMValueRef const_md;
+	LLVMValueRef tbaa_const_md;
 	LLVMValueRef empty_md;
+
 	LLVMValueRef const_buffers[SI_NUM_CONST_BUFFERS];
 	LLVMValueRef lds;
 	LLVMValueRef *constants[SI_NUM_CONST_BUFFERS];
@@ -414,7 +417,7 @@
 	LLVMValueRef base_ptr, LLVMValueRef index)
 {
 	LLVMValueRef result = build_indexed_load(ctx, base_ptr, index, true);
-	LLVMSetMetadata(result, 1, ctx->const_md);
+	LLVMSetMetadata(result, ctx->tbaa_md_kind, ctx->tbaa_const_md);
 	return result;
 }

@@ -1547,19 +1550,17 @@
  * \p lo is the minimum value inclusive.
  * \p hi is the maximum value exclusive.
  */
-static void set_range_metadata(LLVMValueRef value, unsigned lo, unsigned hi)
-{
-	const char *range_md_string = "range";
+static void set_range_metadata(struct si_shader_context *ctx,
+			       LLVMValueRef value, unsigned lo, unsigned hi)
+{
 	LLVMValueRef range_md, md_args[2];
 	LLVMTypeRef type = LLVMTypeOf(value);
 	LLVMContextRef context = LLVMGetTypeContext(type);
-	unsigned md_range_id = LLVMGetMDKindIDInContext(context,
-				range_md_string, strlen(range_md_string));

 	md_args[0] = LLVMConstInt(type, lo, false);
 	md_args[1] = LLVMConstInt(type, hi, false);
 	range_md = LLVMMDNodeInContext(context, md_args, 2);
-	LLVMSetMetadata(value, md_range_id, range_md);
+	LLVMSetMetadata(value, ctx->range_md_kind, range_md);
 }

 static LLVMValueRef get_thread_id(struct si_shader_context *ctx)
@@ -1582,7 +1583,7 @@
 					"llvm.amdgcn.mbcnt.hi", ctx->i32,
 					tid_args, 2, LLVMReadNoneAttribute);
 	}
-	set_range_metadata(tid, 0, 64);
+	set_range_metadata(ctx, tid, 0, 64);
 	return tid;
 }

@@ -5338,18 +5339,21 @@
 static void create_meta_data(struct si_shader_context *ctx)
 {
 	struct gallivm_state *gallivm = ctx->radeon_bld.soa.bld_base.base.gallivm;
-	LLVMValueRef args[3];
-
-	args[0] = LLVMMDStringInContext(gallivm->context, "const", 5);
-	args[1] = 0;
-	args[2] = lp_build_const_int32(gallivm, 1);
-
-	ctx->const_md = LLVMMDNodeInContext(gallivm->context, args, 3);
-
+	LLVMValueRef tbaa_const[3];
+
+	ctx->range_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
+						     "range", 5);
+	ctx->tbaa_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
+						     "tbaa", 4);
 	ctx->uniform_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
 							"amdgpu.uniform", 14);

 	ctx->empty_md = LLVMMDNodeInContext(gallivm->context, NULL, 0);
+
+	tbaa_const[0] = LLVMMDStringInContext(gallivm->context, "const", 5);
+	tbaa_const[1] = 0;
+	tbaa_const[2] = lp_build_const_int32(gallivm, 1);
+	ctx->tbaa_const_md = LLVMMDNodeInContext(gallivm->context, tbaa_const, 3);
 }

 static void declare_streamout_params(struct si_shader_context *ctx,


sers_linux: use an effective NCCS of 19 on platforms that set it to 32.

--- sers_linux.c
+++ sers_linux.c
@@ -32,9 +32,9 @@

 #if NCCS == 32
 // i have not seen a platform with NCCS == 32 in the kernel header files. i saw
-// NCCS == 32 On My Machine where it should have been 23, so we're using that.
-// Getting this wrong will most likely in a ioctl that returns an error.
-#define NCCS_K 23
+// NCCS == 32 On My Machine where it should have been 19, so we're using that.
+// Getting this wrong will most likely result in a ioctl that returns an error.
+#define NCCS_K 19
 #else
 #define NCCS_K NCCS
 #endif


fixed type mismatch

fixed type mismatch

--- keyvi/src/cpp/dictionary/fsa/internal/bit_vector_64.h
+++ keyvi/src/cpp/dictionary/fsa/internal/bit_vector_64.h
@@ -43,7 +43,7 @@
 struct BitVector
 final {
    public:
-    template<std::size_t TsizeOther> friend class BitVector;
+    template<std::size_t TsizeOther> friend struct BitVector;

     BitVector():bits_() {
       Clear();


branches/zip: lock_update_discard(): Fix a bug introduced in r949: Compare heap_no against PAGE_HEAP_NO_SUPREMUM instead of PAGE_NEW_SUPREMUM or PAGE_OLD_SUPREMUM.

--- lock/lock0lock.c
+++ lock/lock0lock.c
@@ -3217,7 +3217,7 @@
 			lock_rec_reset_and_release_wait(block, heap_no);

 			rec = page + rec_get_next_offs(rec, TRUE);
-		} while (heap_no != PAGE_NEW_SUPREMUM);
+		} while (heap_no != PAGE_HEAP_NO_SUPREMUM);
 	} else {
 		rec = page + PAGE_OLD_INFIMUM;

@@ -3230,7 +3230,7 @@
 			lock_rec_reset_and_release_wait(block, heap_no);

 			rec = page + rec_get_next_offs(rec, FALSE);
-		} while (heap_no != PAGE_OLD_SUPREMUM);
+		} while (heap_no != PAGE_HEAP_NO_SUPREMUM);
 	}

 	lock_rec_free_all_from_discard_page(block);


st/vdpau: fix chroma_format handling in VideoSurfaceQueryGetPutBitsYCbCrCapabilities

Signed-off-by: Christian König <6000eae0bbe6bd1545a6e60916fedb2a5946bdd4@vodafone.de>

--- src/gallium/state_trackers/vdpau/query.c
+++ src/gallium/state_trackers/vdpau/query.c
@@ -87,9 +87,6 @@

    /* XXX: Current limits */
    *is_supported = true;
-   if (surface_chroma_type != VDP_CHROMA_TYPE_420)
-      *is_supported = false;
-
    max_2d_texture_level = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
    pipe_mutex_unlock(dev->mutex);
    if (!max_2d_texture_level)
@@ -124,7 +121,24 @@
       return VDP_STATUS_RESOURCES;

    pipe_mutex_lock(dev->mutex);
-   *is_supported = pscreen->is_video_format_supported
+
+   switch(bits_ycbcr_format) {
+   case VDP_YCBCR_FORMAT_UYVY:
+   case VDP_YCBCR_FORMAT_YUYV:
+      *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_422;
+      break;
+
+   case VDP_YCBCR_FORMAT_Y8U8V8A8:
+   case VDP_YCBCR_FORMAT_V8U8Y8A8:
+      *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_444;
+      break;
+
+   default:
+      *is_supported = true;
+      break;
+   }
+
+   *is_supported &= pscreen->is_video_format_supported
    (
       pscreen,
       FormatYCBCRToPipe(bits_ycbcr_format),


tree/link: allow classes derived from hard_link to access data member

--- kernel/include/bs/link.h
+++ kernel/include/bs/link.h
@@ -171,7 +171,7 @@

 	sp_node data_node() const override;

-private:
+protected:
 	sp_obj data_;
 };


r600g: add multi-buffer flush support properly.

--- src/gallium/winsys/r600/drm/r600_state.c
+++ src/gallium/winsys/r600/drm/r600_state.c
@@ -308,7 +308,7 @@
 	return r;
 }

-static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags)
+static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int bufs_are_cbs)
 {
 	unsigned i, j, add, size;

@@ -327,6 +327,8 @@
 	for (i = 0; i < state->nreloc; i++) {
 		size = (state->bo[state->reloc_bo_id[i]]->size + 255) >> 8;
 		state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3);
+		if (bufs_are_cbs)
+			flags |= S_0085F0_CB0_DEST_BASE_ENA(1 << i);
 		state->pm4[state->cpm4++] = flags;
 		state->pm4[state->cpm4++] = size;
 		state->pm4[state->cpm4++] = 0x00000000;
@@ -425,7 +427,7 @@

 static int r600_state_pm4_shader(struct radeon_state *state)
 {
-	r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1));
+	r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1), 0);
 	return r600_state_pm4_generic(state);
 }

@@ -508,8 +510,7 @@
 	if (!state->nbo)
 		return 0;

-	r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) |
-				  S_0085F0_CB0_DEST_BASE_ENA(1));
+	r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1), 1);

 	return 0;
 }
@@ -520,7 +521,7 @@
 		return 0;

 	r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) |
-				S_0085F0_DB_DEST_BASE_ENA(1));
+				  S_0085F0_DB_DEST_BASE_ENA(1), 0);

 	return 0;
 }
@@ -553,7 +554,7 @@
 		fprintf(stderr, "%s need %d bo got %d\n", __func__, nbo, state->nbo);
 		return -EINVAL;
 	}
-	r600_state_pm4_with_flush(state, flags);
+	r600_state_pm4_with_flush(state, flags, 0);
 	offset = regs[0].offset + soffset;
 	if (state->radeon->family >= CHIP_CEDAR)
 		nres = 8;


mdbox: Fixed rebuilding mdbox storage.

mdbox: Fixed rebuilding mdbox storage.

--- src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
+++ src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
@@ -128,41 +128,17 @@
 	return 0;
 }

-static int rebuild_add_file(struct mdbox_storage_rebuild_context *ctx,
-			    const char *path)
-{
-	struct dbox_file *file;
-	const char *fname, *guid;
+static int rebuild_file_mails(struct mdbox_storage_rebuild_context *ctx,
+			      struct dbox_file *file)
+{
+	const char *guid;
 	struct mdbox_rebuild_msg *rec;
-	uint32_t file_id;
 	uoff_t offset, prev_offset, size;
 	bool last, first, fixed = FALSE;
-	unsigned int len;
-	int ret = 0;
-
-	fname = strrchr(path, '/');
-	i_assert(fname != NULL);
-	fname += strlen(MDBOX_MAIL_FILE_PREFIX) + 1;
-
-	file_id = strtoul(fname, NULL, 10);
-	if (!is_numeric(fname, '\0') || file_id == 0) {
-		len = strlen(fname);
-		if (len > 7 && strcmp(fname + len - 7, ".broken") != 0) {
-			i_warning("dbox rebuild: File name is missing ID: %s",
-				  path);
-		}
-		return 0;
-	}
-
-	/* small optimization: typically files are returned sorted. in that
-	   case we don't need to sort them ourself. */
-	if (file_id < ctx->prev_file_id)
-		ctx->msgs_unsorted = TRUE;
-	ctx->prev_file_id = file_id;
-
-	file = mdbox_file_init(ctx->storage, file_id);
+	int ret;
+
+	dbox_file_seek_rewind(file);
 	prev_offset = 0;
-	dbox_file_seek_rewind(file);
 	while ((ret = dbox_file_seek_next(file, &offset, &last)) >= 0) {
 		if (ret > 0) {
 			if ((ret = dbox_file_metadata_read(file)) < 0)
@@ -203,7 +179,7 @@
 		}

 		rec = p_new(ctx->pool, struct mdbox_rebuild_msg, 1);
-		rec->file_id = file_id;
+		rec->file_id = ctx->prev_file_id;
 		rec->offset = offset;
 		rec->size = file->input->v_offset - offset;
 		mail_generate_guid_128_hash(guid, rec->guid_128);
@@ -217,7 +193,48 @@
 			hash_table_insert(ctx->guid_hash, rec->guid_128, rec);
 		}
 	}
-	if (ret == 0 && !last)
+	if (ret < 0)
+		return -1;
+	else if (ret == 0 && !last)
+		return 0;
+	else
+		return 1;
+}
+
+static int rebuild_add_file(struct mdbox_storage_rebuild_context *ctx,
+			    const char *path)
+{
+	struct dbox_file *file;
+	uint32_t file_id;
+	const char *fname;
+	unsigned int len;
+	bool deleted;
+	int ret = 0;
+
+	fname = strrchr(path, '/');
+	i_assert(fname != NULL);
+	fname += strlen(MDBOX_MAIL_FILE_PREFIX) + 1;
+
+	file_id = strtoul(fname, NULL, 10);
+	if (!is_numeric(fname, '\0') || file_id == 0) {
+		len = strlen(fname);
+		if (len > 7 && strcmp(fname + len - 7, ".broken") != 0) {
+			i_warning("dbox rebuild: File name is missing ID: %s",
+				  path);
+		}
+		return 0;
+	}
+
+	/* small optimization: typically files are returned sorted. in that
+	   case we don't need to sort them ourself. */
+	if (file_id < ctx->prev_file_id)
+		ctx->msgs_unsorted = TRUE;
+	ctx->prev_file_id = file_id;
+
+	file = mdbox_file_init(ctx->storage, file_id);
+	if ((ret = dbox_file_open(file, &deleted)) > 0 && !deleted)
+		ret = rebuild_file_mails(ctx, file);
+	if (ret == 0)
 		i_error("dbox rebuild: Failed to fix file %s", path);
 	dbox_file_unref(&file);
 	return ret < 0 ? -1 : 0;


Eliminated env. var. "SBOX_ARGVENVP_MODE"; The value was not used at all

--- luaif/argvenvp.c
+++ luaif/argvenvp.c
@@ -15,8 +15,6 @@
 #include <lualib.h>
 #include <lauxlib.h>

-static char *argvenvp_mode;
-
 /* Convert a vector of strings to a lua table, leaves that table to
  * lua's stack.
 */
@@ -79,10 +77,6 @@
 	int res, new_argc, new_envc;

 	if (!luaif) return(0);
-
-	if (!(argvenvp_mode = getenv("SBOX_ARGVENVP_MODE"))) {
-		argvenvp_mode = "simple";
-	}

 	if (!argv || !envp) {
 		SB_LOG(SB_LOGLEVEL_ERROR,


GabbleMucChannel: consistently give all properties static name, nick and blurb flags

20080606085512-53eee-472543591cd05162df6eb5aceb98bcca6a288c61.gz

--- src/gabble-muc-channel.c
+++ src/gabble-muc-channel.c
@@ -863,6 +863,7 @@
                                     GABBLE_TYPE_CONNECTION,
                                     G_PARAM_CONSTRUCT_ONLY |
                                     G_PARAM_READWRITE |
+                                    G_PARAM_STATIC_NAME |
                                     G_PARAM_STATIC_NICK |
                                     G_PARAM_STATIC_BLURB);
   g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
@@ -872,13 +873,14 @@
                                   0, G_MAXUINT32, 0,
                                   G_PARAM_READWRITE |
                                   G_PARAM_STATIC_NAME |
+                                  G_PARAM_STATIC_NICK |
                                   G_PARAM_STATIC_BLURB);
   g_object_class_install_property (object_class, PROP_STATE, param_spec);

   param_spec = g_param_spec_boolean ("invite-self", "Invite self",
       "Whether the user should be added to members list.", FALSE,
       G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_BLURB);
+      G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);
   g_object_class_install_property (object_class, PROP_INVITE_SELF, param_spec);

   param_spec = g_param_spec_boxed ("interfaces", "Extra D-Bus interfaces",


There is no need to make the fp16 full reduction kernel a static function.

--- unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h
+++ unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h
@@ -159,7 +159,7 @@

 template <int BlockSize, int NumPerThread, typename Self,
           typename Reducer, typename Index>
-static __global__ void FullReductionKernelHalfFloat(Reducer reducer, const Self input, Index num_coeffs,
+__global__ void FullReductionKernelHalfFloat(Reducer reducer, const Self input, Index num_coeffs,
                                     half* output, half2* scratch) {
   eigen_assert(NumPerThread % 2 == 0);


*improved compatibility with TCC.

*improved compatibility with TCC.

--- shell/main.c
+++ shell/main.c
@@ -33,7 +33,7 @@
 #ifdef _MSC_VER
 #	include <crtdbg.h>
 #	include <conio.h>
-#elif !defined __BORLANDC__
+#elif !defined __BORLANDC__ && !defined __TINYC__
 #	include <unistd.h>
 #endif /* _MSC_VER */
 #include <assert.h>


Spelling.

Spelling.

--- usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swrun_tbl.c
+++ usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swrun_tbl.c
@@ -319,7 +319,7 @@
 }

 /**
- * Get all visible proceses including the kernel visible threads
+ * Get all visible processes including the kernel visible threads
  */
 static void
 swrun_OS_get_procs(void)


Disable SGI_swap_control extension for DRI2

We currently don't have support for SGI_swap_control for direct
contexts with DRI2, so disable reporting the extension. Reporting
the extension, and then having glXSwapIntervalSGI() "succeed"
but do nothing can confuse applications.

https://bugs.freedesktop.org/show_bug.cgi?id=22123

--- src/glx/x11/dri_common.c
+++ src/glx/x11/dri_common.c
@@ -345,7 +345,9 @@
 #endif

 #ifdef __DRI_SWAP_CONTROL
-	if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
+	/* No DRI2 support for swap_control at the moment, since SwapBuffers
+	 * is done by the X server */
+	if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0 && !dri2) {
 	    psc->swapControl = (__DRIswapControlExtension *) extensions[i];
 	    __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
 	    __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6@9372 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- magick/enhance.c
+++ magick/enhance.c
@@ -3887,7 +3887,7 @@
       :
       ( argument > 1-MagickEpsilon ? 1-MagickEpsilon : argument )
     );
-  return(b-(1.0/a)*log(1.0/clamped-1.0));
+  return(b-log(1.0/clamped-1.0)/a);
 #endif
 }


Removed script parameters for Gyrate

Removed script parameters for Gyrate

--- src/gromacs_objectives.c
+++ src/gromacs_objectives.c
@@ -360,38 +360,16 @@

 }

-static void build_gromacs_command_for_gyrate(char *command,
-		const char *local_execute, const char *computed_g_gyrate_program,
-		const char *path_gromacs_programs, const char *pdbfile,
-		const char *computed_g_gyrate_value_file){
-	char space [] = " ";
-
-	strcpy(command,computed_g_gyrate_program);
-	strcat(command,space);
-	strcat(command,path_gromacs_programs);
-	strcat(command,space);
-	strcat(command,local_execute);
-	strcat(command,space);
-	strcat(command,pdbfile);
-	strcat(command,space);
-	strcat(command,computed_g_gyrate_value_file);
-}
-
-
-
+
 /** runs g_gyrate program and evaluates the radius of gyration of the protein
  * based on alpha-carbons only
  */
-int compute_gyrate_mono(solution_t *sol, const char *local_execute,
+static int compute_gyrate(solution_t *sol, const int *fit, const char *local_execute,
 		const char *path_gromacs_programs, const char *pdbfile,
-		const option_g_energy *opt_fitness,
-		const char *computed_g_gyrate_program,
-		const char *path_program_read_g_gyrate,
-		const char *computed_g_gyrate_value_file,
+		const option_g_energy *opt_fitness, const char *computed_g_gyrate_value_file,
 		const char *path_program_clean_simulation){
 	int ret;
-	int fit = 0;
-	char *command;
+
 	char *last_line, *line_splited;
 	char *value;
 	char *opt_f;
@@ -402,12 +380,8 @@
 	opt_f = Malloc(char,2);
 	opt_s = Malloc(char,2);
 	opt_o = Malloc(char,2);
-
-	command = Malloc(char,MAX_COMMAND);
+
 	value = Malloc(char,MAX_VALUE);
-	build_gromacs_command_for_gyrate(command, local_execute, computed_g_gyrate_program,
-			path_gromacs_programs, pdbfile, computed_g_gyrate_value_file);
-	ret = system(command); //calls to run g_gyrate

 	//Setting variables to use
 	strcpy(opt_f, "-f");
@@ -452,19 +426,18 @@
     		line_splited = strtok(NULL, " ");
   		}
 		//Set the value of radius option in solution
-	    set_objective_from_gromacs_in_solution(sol,value, &fit);
+	    set_objective_from_gromacs_in_solution(sol,value, fit);
 	    free(line_splited);
 	    free(last_line);
 	    free(value);
 	}else{
-		sol->obj_values[fit] = MAX_ENERGY; //MAX energy value
+		sol->obj_values[*fit] = MAX_ENERGY; //MAX energy value
 	}

 	clean_gromacs_simulation(path_program_clean_simulation);
 	free(opt_f);
 	free(opt_s);
 	free(opt_o);
-	free(command);
 }

 static void build_pdb_file_name(char *pdb_file_name, const char *aux_name,
@@ -497,14 +470,12 @@
     	int2str(aux_ind,&ind);
     	build_pdb_file_name(pdbfile_aux, aux_ind, PREFIX_PDB_FILE_NAME_EA);
    	    save_pdb_file(in_para->path_local_execute, pdbfile_aux,
-   	    	&population_aux->p_topol->numatom, population_aux->p_atoms, NULL);
+   	    	&population_aux->p_topol->numatom, population_aux->p_atoms, NULL);
    	    // obtaing the values of objectivies
    	    for (int ob = 0; ob < in_para->number_fitness; ob++){
 	   	    if (opt_objective[ob] == gmx_gyrate) {
-   		    	compute_gyrate_mono(&solutions[ind],in_para->path_local_execute,
-   	    				in_para->path_gromacs_programs,pdbfile_aux,opt_objective,
-   	    				in_para->path_program_g_gyrate,
-   	    				in_para->path_program_read_g_gyrate,
+   		    	compute_gyrate(&solutions[ind], &ob, in_para->path_local_execute,
+   	    				in_para->path_gromacs_programs, pdbfile_aux, opt_objective,
    	    				in_para->computed_radius_g_gyrate_file,
    	    				in_para->path_program_clean_simulation);
    	    	}
@@ -512,5 +483,4 @@
 	}

 	free(opt_objective);
-
 }


exit(0) instead of exit(1).  Check if 'moving' before setting idle func

--- progs/atlantis/atlantis.c
+++ progs/atlantis/atlantis.c
@@ -179,7 +179,7 @@
     switch (key)
     {
     case 27:           /* Esc will quit */
-        exit(1);
+        exit(0);
         break;
     case 's':
 	screenshot++;
@@ -414,7 +414,8 @@
     glutReshapeFunc(Reshape);
     glutKeyboardFunc(Key);
     moving = GL_TRUE;
-    glutIdleFunc(Animate);
+    if (moving)
+       glutIdleFunc(Animate);
     glutVisibilityFunc(Visible);
     glutCreateMenu(menuSelect);
     glutAddMenuEntry("Start motion", 1);


Minor bug fix.

Minor bug fix.

git-svn-id: a8f9614472f28b8bd9e7327bebe96da7876ff1b0@13255 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- magick/nt-base.c
+++ magick/nt-base.c
@@ -1607,9 +1607,7 @@
   if (handle == (HMODULE) NULL)
     return SetErrorMode(mode);

-  if (getErrorMode == (GETERRORMODE) NULL)
-    getErrorMode=(GETERRORMODE) NTGetLibrarySymbol(handle,"GetErrorMode");
-
+  getErrorMode=(GETERRORMODE) NTGetLibrarySymbol(handle,"GetErrorMode");
   if (getErrorMode != (GETERRORMODE) NULL)
     mode=getErrorMode() | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX;


Fixes an uninitialized field in class OsStackTraceGetter.

--- src/gtest-internal-inl.h
+++ src/gtest-internal-inl.h
@@ -606,7 +606,7 @@
 // A working implementation of the OsStackTraceGetterInterface interface.
 class OsStackTraceGetter : public OsStackTraceGetterInterface {
  public:
-  OsStackTraceGetter() {}
+  OsStackTraceGetter() : caller_frame_(NULL) {}
   virtual String CurrentStackTrace(int max_depth, int skip_count);
   virtual void UponLeavingGTest();