Handle additional token types, including the final stored proc done messages.

--- tds_tokens.c
+++ tds_tokens.c
@@ -25,6 +25,7 @@
 #include "tds_types.h"
 #include "utils.h"

+#define TOKEN_RETURNSTATUS 0x79
 #define TOKEN_COLMETADATA 0x81
 #define TOKEN_ERROR 0xaa
 #define TOKEN_INFO 0xab
@@ -32,6 +33,7 @@
 #define TOKEN_ROW 0xd1
 #define TOKEN_ENVCHANGE 0xe3
 #define TOKEN_DONE 0xfd
+#define TOKEN_DONEPROC 0xfe
 #define TOKEN_DONEINPROC 0xff

 enum {
@@ -46,20 +48,22 @@
 static void handle_loginack(struct connection *conn, uint16_t token_len);
 static void handle_done(struct connection *conn);

-/* Token: DONE (2.2.7.4) */
+/* Token: DONE (2.2.7.5) */
 static void
 handle_done(struct connection *conn)
 {
 	uint16_t status;
-	uint16_t current_command;
 	uint32_t row_count;

 	status = buf_get16_le(conn);
-	current_command = buf_get16_le(conn);
+	/* The next unsigned short (16 bits) contains a token of the current
+	 * SQL statement, but we don't use it yet. */
+	buf_get16_le(conn);
+
 	row_count = buf_get32_le(conn);
-	tds_debug(0, "Done (CurCmd: %d)\n", current_command);
 	tds_debug(0, "Done, status %d, %d rows affected\n", status, row_count);

+	/* Check if this is the final done before calling any callbacks */
 	if (status == 0) {
 		if (conn->stage == TDS_LOGGING_IN) {
 			conn->stage = TDS_LOGGED_IN;
@@ -292,6 +296,8 @@
 void
 handle_tokens(struct connection *conn, size_t nread)
 {
+	uint32_t ret;
+
 	dump_hex(conn->buffer, nread);

 	/* Start at 0x08 */
@@ -325,13 +331,18 @@
 			handle_loginack(conn, token_len);
 			break;
 		case TOKEN_DONE:
+		case TOKEN_DONEINPROC:
+		case TOKEN_DONEPROC:
 			handle_done(conn);
+			break;
+		case TOKEN_RETURNSTATUS:
+			ret = buf_get32_le(conn);
+			if (ret != 0) {
+				tds_debug(0, "RPC returned %d\n", ret);
+			}
 			break;
 		case TOKEN_ROW:
 			handle_row(conn);
-			break;
-		case TOKEN_DONEINPROC:
-			handle_done(conn);
 			break;
 		default:
 			tds_debug(0, "unknown type %d\n", token_type);


Fix QuadTree compiler warning for isSplit() method

--- 2D-Game-Engine/QuadTree.h
+++ 2D-Game-Engine/QuadTree.h
@@ -29,7 +29,7 @@
 	virtual ~QuadTree();

 	const Rectangle& getBounds() const { return m_bounds; };
-	bool isSplit() const { return m_northWest; };
+	bool isSplit() const { return m_northWest != nullptr; };

 	void insert(const Rectangle& rect);
 	void retrieve(const Rectangle& rect, std::vector<Rectangle>& list) const;


Voronoi has a minimum cell size of 4 blocks now, to avoid some extreme corner-cases

git-svn-id: ffe80d23790c2318db4f9b6ad70c6163efa9c8e4@512 0a769ca7-a7f5-676a-18bf-c427514a06d6

--- source/BioGen.h
+++ source/BioGen.h
@@ -108,7 +108,7 @@
 public:
 	cBioGenVoronoi(int a_Seed, int a_CellSize, const AString & a_Biomes) :
 		cBiomeGenList(a_Biomes),
-		m_CellSize(a_CellSize),
+		m_CellSize((a_CellSize > 4) ? a_CellSize : 4),
 		m_Noise(a_Seed)
 	{
 	}


Add C++ implementation

Add C++ implementation

Signed-off-by: begeekmyfriend <a53a317c6ef26cd024d51182ec568f98d2cd3f6e@gmail.com>

--- 460_lfu_cache/lfu_cache.c
+++ 460_lfu_cache/lfu_cache.c
@@ -197,8 +197,10 @@
         parent = *rover;
         if (freq < (*rover)->freq) {
             rover = &((*rover)->children[0]);
+        } else if (freq > (*rover)->freq) {
+            rover = &((*rover)->children[1]);
         } else {
-            rover = &((*rover)->children[1]);
+            return *rover;
         }
     }

@@ -312,17 +314,16 @@

 static void freq_incr(FreqAVLTree* tree, LFUNode *lfu, int key)
 {
+    /* New frequency */
     list_del(&lfu->dlink);
+    int freq = ++lfu->freq;
+    FreqAVLNode *node = avl_tree_insert(tree, freq);
     if (list_empty(&lfu->node->dhead)) {
+        if (lfu->node == tree->min_freq_node) {
+            tree->min_freq_node = node;
+        }
         /* we must erase the empty node to rearrange the AVL tree */
         avl_node_erase(tree, lfu->node);
-    }
-
-    /* New frequency */
-    int freq = ++lfu->freq;
-    FreqAVLNode *node = avl_tree_insert(tree, freq);
-    if (lfu->node == tree->min_freq_node) {
-        tree->min_freq_node = node;
     }
     lfu->node = node;
     list_add(&lfu->dlink, &lfu->node->dhead);
@@ -379,10 +380,7 @@
         lfu = list_last_entry(&node->dhead, LFUNode, dlink);
         list_del(&lfu->dlink);
         list_del(&lfu->key_link);
-        if (list_empty(&node->dhead)) {
-            /* we must erase the empty node to rearrange the AVL tree */
-            avl_node_erase(obj->tree, node);
-        }
+        /* NOTE: we DO NOT need to erase the empty AVL node since the min freq node would be update immediately */
     } else {
         /* new LFU */
         obj->size++;
@@ -428,7 +426,7 @@
 int main(void)
 {
     LFUCache* obj = lFUCacheCreate(2);
-#if 0
+#if 1
     lFUCachePut(obj, 1, 1);
     printf("Put 1 1\n");
     lFUCachePut(obj, 2, 2);


Return when HAL_JPEG_Encode is aborted.

Return when HAL_JPEG_Encode is aborted.

--- src/sthal/h7/src/stm32h7xx_hal_jpeg.c
+++ src/sthal/h7/src/stm32h7xx_hal_jpeg.c
@@ -3440,6 +3440,10 @@
     return JPEG_PROCESS_DONE;
   }

+  if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_COF) == RESET)
+  {
+    return JPEG_PROCESS_DONE;
+  }

   return JPEG_PROCESS_ONGOING;
 }


storage_file: Compute QCOW2 cluster size as ULL

While the QCOW2 cluster size is represented in only 4 bits in the QCOW2
header and thus 1 << cluster_size cannot overflow int,
qcow2GetClusterSize is supposed to return unsigned long long so we can
just compute the result as ULL rather than computing it as int and
promoting to unsigned long long.

Signed-off-by: Jiri Denemark <62bdf77dc47919a4d59a91822129d14633cfca81@redhat.com>
Reviewed-by: Pavel Hrdina <d4772d05997b8abf035041e3b4f4996380ea7e7a@redhat.com>

--- src/storage_file/storage_file_probe.c
+++ src/storage_file/storage_file_probe.c
@@ -487,7 +487,7 @@
     clusterBits = virReadBufInt32BE(buf + QCOWX_HDR_CLUSTER_BITS_OFFSET);

     if (clusterBits > 0)
-        return 1 << clusterBits;
+        return 1ULL << clusterBits;

     return 0;
 }


quota-fs: Added support for NFSv4 rquota. Based on patch by Martin Schanzenbach, which also borrowed comment from linuxquota.

--- src/plugins/quota/quota-fs.c
+++ src/plugins/quota/quota-fs.c
@@ -47,6 +47,10 @@
 #ifndef _LINUX_QUOTA_VERSION
 #  define _LINUX_QUOTA_VERSION 1
 #endif
+
+#define mount_type_is_nfs(mount) \
+	(strcmp((mount)->type, "nfs") == 0 || \
+	 strcmp((mount)->type, "nfs4") == 0)

 struct fs_quota_mountpoint {
 	int refcount;
@@ -179,7 +183,7 @@
 	mount->fd = -1;
 #endif

-	if (strcmp(mount->type, "nfs") == 0) {
+	if (mount_type_is_nfs(mount)) {
 		if (strchr(mount->device_path, ':') == NULL) {
 			i_error("quota-fs: %s is not a valid NFS device path",
 				mount->device_path);
@@ -225,7 +229,7 @@

 #ifdef FS_QUOTA_SOLARIS
 #ifdef HAVE_RQUOTA
-	if (strcmp(mount->type, "nfs") == 0) {
+	if (mount_type_is_nfs(mount)) {
 		/* using rquota for this mount */
 	} else
 #endif
@@ -334,6 +338,14 @@

 	host = t_strdup_until(mount->device_path, path);
 	path++;
+
+	/* For NFSv4, we send the filesystem path without initial /. Server
+	   prepends proper NFS pseudoroot automatically and uses this for
+	   detection of NFSv4 mounts. */
+	if (strcmp(root->mount->type, "nfs4") == 0) {
+		while (*path == '/')
+			path++;
+	}

 	if (root->root.quota->set->debug) {
 		i_debug("quota-fs: host=%s, path=%s, uid=%s, %s",
@@ -773,7 +785,7 @@
 	bytes = strcasecmp(name, QUOTA_NAME_STORAGE_BYTES) == 0;

 #ifdef HAVE_RQUOTA
-	if (strcmp(root->mount->type, "nfs") == 0) {
+	if (mount_type_is_nfs(root->mount)) {
 		T_BEGIN {
 			ret = !root->user_disabled ?
 				do_rquota_user(root, bytes, value_r, &limit) :


Add explicit defaults/deletes for copy/move ctor/assign

--- source/Stream.h
+++ source/Stream.h
@@ -174,6 +174,12 @@
     Stream()
         : source_(make_stream_provider<provider::Empty, T>()) {}

+    Stream(Stream<T>&& other) = default;
+    Stream<T>& operator= (Stream<T>&& other) = default;
+
+    Stream(const Stream<T>& other) = delete;
+    Stream<T>& operator= (const Stream<T>& other) = default;
+
     Stream(StreamProviderPtr<T> source)
         : source_(std::move(source)) {}


quota-fs: Improved debug logging.

quota-fs: Improved debug logging.

--HG--
branch : HEAD

--- src/plugins/quota/quota-fs.c
+++ src/plugins/quota/quota-fs.c
@@ -315,8 +315,9 @@
 	path++;

 	if (root->root.quota->set->debug) {
-		i_info("quota-fs: host=%s, path=%s, uid=%s",
-			host, path, dec2str(root->uid));
+		i_info("quota-fs: host=%s, path=%s, uid=%s, %s",
+		       host, path, dec2str(root->uid),
+		       bytes ? "bytes" : "files");
 	}

 	/* clnt_create() polls for a while to establish a connection */
@@ -414,8 +415,9 @@
 	path++;

 	if (root->root.quota->set->debug) {
-		i_info("quota-fs: host=%s, path=%s, gid=%s",
-			host, path, dec2str(root->gid));
+		i_info("quota-fs: host=%s, path=%s, gid=%s, %s",
+		       host, path, dec2str(root->gid),
+		       bytes ? "bytes" : "files");
 	}

 	/* clnt_create() polls for a while to establish a connection */


the tnt::Job do not need to be atomic ref counted; making it simple ref counted speeds up tntnet for about 1%

--- framework/common/tnt/job.h
+++ framework/common/tnt/job.h
@@ -71,7 +71,7 @@
   class Tntnet;

   /** Job - one per request */
-  class Job : public cxxtools::AtomicRefCounted
+  class Job : public cxxtools::RefCounted
   {
       unsigned keepAliveCounter;


Moar aliens

Moar aliens

--- source/global.h
+++ source/global.h
@@ -8,7 +8,7 @@
 #include <wiisprite.h>
 #include <fat.h>

-#define NUM_ALIENS 		 	 5
+#define NUM_ALIENS 		 	10
 #define NUM_ALIEN_TYPES  	 1
 #define NUM_PLAYERS 	 	 2
 #define NUM_SHOTS			50


stdio.h needs to be included before mntent.h or sys/mnttab.h

--- src/plugins/quota/quota-fs.h
+++ src/plugins/quota/quota-fs.h
@@ -20,8 +20,10 @@
 #  include <sys/param.h> /* BSDs */
 #  include <sys/mount.h>
 #elif defined(HAVE_MNTENT_H)
+#  include <stdio.h>
 #  include <mntent.h> /* Linux */
 #elif defined(HAVE_SYS_MNTTAB_H)
+#  include <stdio.h>
 #  include <sys/mnttab.h> /* Solaris */
 #else
 #  undef HAVE_FS_QUOTA


Include libasnd and libmad

Include libasnd and libmad

--- source/global.h
+++ source/global.h
@@ -7,6 +7,8 @@
 #include <wiiuse/wpad.h>
 #include <wiisprite.h>
 #include <fat.h>
+#include <asndlib.h>
+#include <mp3player.h>

 #define NUM_ALIENS 		 	10
 #define NUM_ALIEN_TYPES  	 1


Fixes #11

Fixes #11

--- nginx_dlg_auth.c
+++ nginx_dlg_auth.c
@@ -72,6 +72,7 @@
 static ngx_int_t ngx_http_dlg_auth_init(ngx_conf_t *cf);
 static void *ngx_http_dlg_auth_create_loc_conf(ngx_conf_t *cf);
 static char *ngx_http_dlg_auth_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child);
+static int is_digits_only(ngx_str_t *str);
 /*
  * Functions for request processing
  */
@@ -287,6 +288,7 @@
 static char * ngx_http_dlg_auth_merge_loc_conf(ngx_conf_t *cf, void *vparent, void *vchild) {
     ngx_http_dlg_auth_loc_conf_t  *parent = (ngx_http_dlg_auth_loc_conf_t*)vparent;
     ngx_http_dlg_auth_loc_conf_t  *child = (ngx_http_dlg_auth_loc_conf_t*)vchild;
+
     /* Merge realm */
     if (child->realm.len == 0) {
         child->realm.len = parent->realm.len;
@@ -310,6 +312,9 @@
     	child->pwd_table.nentries = parent->pwd_table.nentries;
     }

+
+
+
     /*
      * Inherit or set default allowed clock skew of 1s.
      */
@@ -326,8 +331,31 @@
         child->port.len = parent->port.len;
         child->port.data = parent->port.data;
     }
+
+    /*
+     * If dlg_auth module applies to this location, perform some config sanity checks.
+     */
+
+    if(child->realm.len != 0) {
+        /* We need iron password or password table */
+        if(child->iron_password.len == 0 && child->pwd_table.nentries == 0) {
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "Neither iron password nor iron password table configured");
+       	    return NGX_CONF_ERROR;
+        }
+        /* Check that explicit port is a number value
+         * (nginx int value support is not used for easier use of Hawk libs)
+         */
+        if(child->port.len > 0) {
+            if( ! is_digits_only(&(child->port))) {
+                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V is not a valid port number" , &(child->port));
+       	        return NGX_CONF_ERROR;
+       	    }
+        }
+    }
     return NGX_CONF_OK;
 }
+
+

 /*
  * The actual handler - this is called during access phase.
@@ -886,4 +914,20 @@
 	 return NGX_OK;
 }

-
+/*
+ * Check whether a string represents a number greater or equal to 0.
+ * Returns 1 if string is number greater or equal to 0, 0 otherwise.
+ */
+static int is_digits_only(ngx_str_t *str) {
+    int i=0;
+    while(i < str->len ) {
+        char c = str->data[i];
+        if( c < '0' || c > '9') {
+            return 0;
+        }
+        i++;
+    }
+    return 1;
+}
+
+


Add MDString to minidump_format.h (#59).  r=bryner

http://groups.google.com/group/airbag-dev/browse_thread/thread/599a47765598cf34

git-svn-id: a14e546401035be51a469fbea25ecce70a1a22f2@50 4c0a9323-5329-0410-9bdc-e9ce6186880e

--- src/processor/minidump_format.h
+++ src/processor/minidump_format.h
@@ -488,6 +488,13 @@

 typedef struct {
+  u_int32_t length;     /* Length of buffer in bytes (not characters),
+                         * excluding 0-terminator */
+  u_int16_t buffer[0];  /* UTF-16-encoded, 0-terminated */
+} MDString;  /* MINIDUMP_STRING */
+
+
+typedef struct {
   u_int32_t            thread_id;
   u_int32_t            suspend_count;
   u_int32_t            priority_class;
@@ -509,7 +516,7 @@
   u_int32_t            size_of_image;
   u_int32_t            checksum;         /* 0 if unknown */
   u_int32_t            time_date_stamp;  /* time_t */
-  MDRVA                module_name_rva;  /* Pathname or filename, UTF-16 */
+  MDRVA                module_name_rva;  /* MDString, pathname or filename */
   MDVSFixedFileInfo    version_info;

   /* The next field stores a CodeView record and is populated when a module's
@@ -863,7 +870,7 @@
   u_int32_t        minor_version;
   u_int32_t        build_number;
   u_int32_t        platform_id;
-  MDRVA            csd_version_rva;  /* UTF-16 string further identifying the
+  MDRVA            csd_version_rva;  /* MDString further identifying the
                                       * host OS.
                                       * Windows: name of the installed OS
                                       *          service pack.


Set allowed sensor at the only time that it makes sense

--- src/tasks/train_master.c
+++ src/tasks/train_master.c
@@ -562,7 +562,6 @@
             else // we have a stopping point
                 ctxt->next_stop.action = step;

-            master_set_allowed_sensor(ctxt);
             return;
         }
     }
@@ -684,6 +683,8 @@
         const int delay = (ctxt->next_stop.offset - offset) / velocity;

         master_set_speed(ctxt, 0, time + delay);
+        master_set_allowed_sensor(ctxt);
+
         ctxt->path_stopping = true;

         // if this is the last stop, then we are done
@@ -1093,7 +1094,6 @@
                                              && !ctxt->path_completed) {
             log("[%s] Hit reversing point!", ctxt->name);
             master_set_reverse(ctxt, time); // TROLOLO magic number
-            master_set_allowed_sensor(ctxt);
             master_setup_next_short_move(ctxt, offset, time + 10);
             ctxt->path_stopping = false;
         }


remove tb_file_full interfaces

remove tb_file_full interfaces

--- src/tbox/platform/file.h
+++ src/tbox/platform/file.h
@@ -295,16 +295,6 @@
  */
 tb_bool_t               tb_file_rename(tb_char_t const* path, tb_char_t const* dest);

-/*! the file full path
- *
- * @param path          the file path
- * @param full          the full path
- * @param maxn          the path maxn
- *
- * @return              the full path
- */
-tb_char_t const*        tb_file_full(tb_char_t const* path, tb_char_t* full, tb_size_t maxn);
-
 /*! link the file
  *
  * @param path          the source file path


Call pthread_mutex_init on the host table's mutex

--- src/tcsd_api/hosttable.c
+++ src/tcsd_api/hosttable.c
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <pthread.h>

 #include "trousers/tss.h"
 #include "trousers_types.h"
@@ -29,6 +30,8 @@
 		LogError("malloc of %d bytes failed.", sizeof(struct host_table));
 		return TSPERR(TSS_E_OUTOFMEMORY);
 	}
+
+	pthread_mutex_init(&ht->lock, NULL);

 	return TSS_SUCCESS;
 }


erm.. forgot to test after previous commit. Now it's ok (tm).

--- unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
+++ unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
@@ -176,8 +176,9 @@
         )
 {
     Status status = minimizeInit(x, mode);
-    while (status==Running)
+    do {
         status = minimizeOneStep(x, mode);
+    } while (status==Running);
     return status;
 }

@@ -719,8 +720,9 @@
         )
 {
     Status status = minimizeOptimumStorageInit(x, mode);
-    while (status==Running)
+    do {
         status = minimizeOptimumStorageOneStep(x, mode);
+    } while (status==Running);
     return status;
 }


Fix build break on FreeBSD (#326)

Fix build break on FreeBSD (#326)

--- src/tape_drivers/freebsd/cam/cam_tc.c
+++ src/tape_drivers/freebsd/cam/cam_tc.c
@@ -283,7 +283,7 @@
 	while(*cur) {
 		if ((! strncmp((char*)softc->cd->inq_data.vendor, (*cur)->vendor_id, strlen((*cur)->vendor_id)) ) &&
 			(! strncmp((char*)softc->cd->inq_data.product, (*cur)->product_id, strlen((*cur)->product_id)) ) ) {
-			priv->vendor = (*cur)->vendor_type;
+			softc->vendor = (*cur)->vendor_type;
 			drive_type = (*cur)->drive_type;
 			break;
 		}


Use actual macros from GCC docs.

Use actual macros from GCC docs.

--- source/module.h
+++ source/module.h
@@ -9,7 +9,7 @@
 typedef
     union {
         struct {
-#if __BIG_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
             unsigned int major: 3;
             unsigned int subtype: 5;
 #else


removed debug printing (for real)

removed debug printing (for real)

--- source/parser.c
+++ source/parser.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include "parser.h"

-#define PARSE_DEBUG_PRINT 0
+//#define PARSE_DEBUG_PRINT 1

 // =====================================================
 // Abstract Syntax Tree


pprint.c: fix missing declarations

pprint.c: fix missing declarations

--- source/pprint.c
+++ source/pprint.c
@@ -84,6 +84,8 @@
 		 struct clast_for *f);
 static void pprint_stmt_list(struct cloogoptions *options, FILE *dst, int indent,
 		       struct clast_stmt *s);
+static int pprint_osl_body(struct cloogoptions *options, FILE *dst,
+    struct clast_user_stmt *u);

 void pprint_name(FILE *dst, struct clast_name *n)


convert/tconv_convert_ICU.c: ICU-21267 removal of TRUE and FALSE

--- src/tconv/convert/tconv_convert_ICU.c
+++ src/tconv/convert/tconv_convert_ICU.c
@@ -14,6 +14,18 @@

 #include "tconv/convert/ICU.h"
 #include "tconv_config.h"
+
+/* ICU-21267 */
+#ifdef TRUE
+#define ICU_TRUE TRUE
+#else
+#define ICU_TRUE 1
+#endif
+#ifdef FALSE
+#define ICU_FALSE FALSE
+#else
+#define ICU_FALSE 1
+#endif

 #define TCONV_ICU_IGNORE   "//IGNORE"
 #define TCONV_ICU_TRANSLIT "//TRANSLIT"
@@ -71,8 +83,8 @@
 {
   static const char            funcs[]          = "tconv_convert_ICU_new";
   tconv_convert_ICU_option_t  *optionp          = (tconv_convert_ICU_option_t *) voidp;
-  UBool                        ignoreb          = FALSE;
-  UBool                        translitb        = FALSE;
+  UBool                        ignoreb          = ICU_FALSE;
+  UBool                        translitb        = ICU_FALSE;
   char                        *realToCodes      = NULL;
   tconv_convert_ICU_context_t *contextp         = NULL;
   char                        *ignorep          = NULL;
@@ -95,7 +107,7 @@
   const void                  *fromUContextp    = NULL;
   UConverterToUCallback        toUCallbackp     = NULL;
   const void                  *toUContextp      = NULL;
-  UBool                        fallbackb        = FALSE;
+  UBool                        fallbackb        = ICU_FALSE;
   int8_t                       signaturei       = 0;
   int32_t                      uSetPatternTol   = 0;
   UChar                       *uSetPatternTos   = NULL;
@@ -130,21 +142,21 @@
   if (ignorep != NULL) {
     endIgnorep = ignorep + strlen(TCONV_ICU_IGNORE);
     if ((*endIgnorep == '\0') || (*(endIgnorep + 1) == '/')) {
-      ignoreb = TRUE;
+      ignoreb = ICU_TRUE;
     }
   }
   if (translitp != NULL) {
     endTranslitp = translitp + strlen(TCONV_ICU_TRANSLIT);
     if ((*endTranslitp == '\0') || (*(endTranslitp + 1) == '/')) {
-      translitb = TRUE;
+      translitb = ICU_TRUE;
     }
   }
   /* ... Remove options from realToCodes  */
   for (p = q = realToCodes; *p != '\0'; ++p) {    /* Note that a valid charset cannot contain \0 */
-    if ((ignoreb == TRUE) && ((p >= ignorep) && (p < endIgnorep))) {
+    if ((ignoreb == ICU_TRUE) && ((p >= ignorep) && (p < endIgnorep))) {
       continue;
     }
-    if ((translitb == TRUE) && ((p >= translitp) && (p < endTranslitp))) {
+    if ((translitb == ICU_TRUE) && ((p >= translitp) && (p < endTranslitp))) {
       continue;
     }
     if (p != q) {
@@ -154,7 +166,7 @@
     }
   }
   *q = '\0';
-  TCONV_TRACE(tconvp, "%s - \"%s\" gives {codeset=\"%s\", ignore=%s translit=%s}", funcs, tocodes, realToCodes, (ignoreb == TRUE) ? "TRUE" : "FALSE", (translitb == TRUE) ? "TRUE" : "FALSE");
+  TCONV_TRACE(tconvp, "%s - \"%s\" gives {codeset=\"%s\", ignore=%s translit=%s}", funcs, tocodes, realToCodes, (ignoreb == ICU_TRUE) ? "true" : "false", (translitb == ICU_TRUE) ? "true" : "false");

   /* ----------------------------------------------------------- */
   /* Get options                                                 */
@@ -163,7 +175,7 @@
     TCONV_TRACE(tconvp, "%s - getting uChar capacity level from option", funcs);
     uCharCapacityl = optionp->uCharCapacityl;
     TCONV_TRACE(tconvp, "%s - getting fallback option from option", funcs);
-    fallbackb      = (optionp->fallbackb !=0 ) ? TRUE : FALSE;
+    fallbackb      = (optionp->fallbackb !=0 ) ? ICU_TRUE : ICU_FALSE;
     TCONV_TRACE(tconvp, "%s - getting signature option from option", funcs);
     signaturei     = (optionp->signaturei < 0) ? -1 : ((optionp->signaturei > 0) ? 1 : 0);
   } else {
@@ -181,10 +193,10 @@
     p = getenv(TCONV_ENV_CONVERT_ICU_FALLBACK);
     if (p != NULL) {
       TCONV_TRACE(tconvp, "%s - getting fallback option from environment: \"%s\"", funcs, p);
-      fallbackb = (atoi(p) != 0) ? TRUE : FALSE;
+      fallbackb = (atoi(p) != 0) ? ICU_TRUE : ICU_FALSE;
     } else {
       TCONV_TRACE(tconvp, "%s - getting fallback option from default", funcs);
-      fallbackb = (tconv_convert_icu_option_default.fallbackb != 0) ? TRUE : FALSE;
+      fallbackb = (tconv_convert_icu_option_default.fallbackb != 0) ? ICU_TRUE : ICU_FALSE;
     }

     TCONV_TRACE(tconvp, "%s - getenv(\"%s\")", funcs, TCONV_ENV_CONVERT_ICU_SIGNATURE);
@@ -205,12 +217,12 @@
     goto err;
   }

-  TCONV_TRACE(tconvp, "%s - options are {uCharCapacityl=%lld, fallbackb=%s, signaturei=%d}", funcs, (unsigned long long) uCharCapacityl, (fallbackb == TRUE) ? "TRUE" : "FALSE", signaturei);
+  TCONV_TRACE(tconvp, "%s - options are {uCharCapacityl=%lld, fallbackb=%s, signaturei=%d}", funcs, (unsigned long long) uCharCapacityl, (fallbackb == ICU_TRUE) ? "true" : "false", signaturei);

   /* ----------------------------------------------------------- */
   /* Setup the from converter: handles the //IGNORE              */
   /* ----------------------------------------------------------- */
-  toUCallbackp   = (ignoreb == TRUE) ? UCNV_TO_U_CALLBACK_SKIP : UCNV_TO_U_CALLBACK_STOP;
+  toUCallbackp   = (ignoreb == ICU_TRUE) ? UCNV_TO_U_CALLBACK_SKIP : UCNV_TO_U_CALLBACK_STOP;
   toUContextp    = NULL;

   uErrorCode = U_ZERO_ERROR;
@@ -245,7 +257,7 @@
   /* ---------------------------------------------- */
   /* Setup the to converter: handles the //TRANSLIT */
   /* ---------------------------------------------- */
-  fromUCallbackp = (translitb == TRUE) ? UCNV_FROM_U_CALLBACK_SUBSTITUTE : UCNV_FROM_U_CALLBACK_STOP;
+  fromUCallbackp = (translitb == ICU_TRUE) ? UCNV_FROM_U_CALLBACK_SUBSTITUTE : UCNV_FROM_U_CALLBACK_STOP;
   fromUContextp  = NULL;

   uErrorCode = U_ZERO_ERROR;
@@ -287,13 +299,13 @@
   /* ----------------------------------------------------------- */
   /* Setup the transliterator                                    */
   /* ----------------------------------------------------------- */
-  if (translitb == TRUE) {
+  if (translitb == ICU_TRUE) {
 #if UCONFIG_NO_TRANSLITERATION
     TCONV_TRACE(tconvp, "%s - translitb is TRUE but config says UCONFIG_NO_TRANSLITERATION - falling back to normal substitution character", funcs);
 #else

     /* We want to know the exact pattern set of the destination charset */
-    whichSet = (fallbackb == TRUE) ? UCNV_ROUNDTRIP_AND_FALLBACK_SET : UCNV_ROUNDTRIP_SET;
+    whichSet = (fallbackb == ICU_TRUE) ? UCNV_ROUNDTRIP_AND_FALLBACK_SET : UCNV_ROUNDTRIP_SET;

     uSetTop = uset_openEmpty();
     if (uSetTop == NULL) { /* errno ? */
@@ -313,7 +325,7 @@

     /* Get the string representation of the set */
     uErrorCode = U_ZERO_ERROR;
-    uSetPatternTol = uset_toPattern(uSetTop, NULL, 0, TRUE, &uErrorCode);
+    uSetPatternTol = uset_toPattern(uSetTop, NULL, 0, ICU_TRUE, &uErrorCode);
     if (uErrorCode != U_BUFFER_OVERFLOW_ERROR) {
       errno = ENOSYS;
       goto err;
@@ -323,7 +335,7 @@
       goto err;
     }
     uErrorCode = U_ZERO_ERROR;
-    uset_toPattern(uSetTop, uSetPatternTos, uSetPatternTol, TRUE, &uErrorCode);
+    uset_toPattern(uSetTop, uSetPatternTos, uSetPatternTol, ICU_TRUE, &uErrorCode);
     if (U_FAILURE(uErrorCode)) {
       errno = ENOSYS;
       goto err;
@@ -583,9 +595,9 @@
   inbytesleftl  = (inbytesleftlp != NULL)                        ? *inbytesleftlp  : 0;
   outbufp       = *outbufpp;
   outbytesleftl = (outbytesleftlp != NULL)                       ? *outbytesleftlp : 0;
-  flushb        = ((inbufpp == NULL) || (*inbufpp == NULL))      ? TRUE            : FALSE;
-
-  if ((flushb == TRUE) && (inbytesleftl != 0)) {
+  flushb        = ((inbufpp == NULL) || (*inbufpp == NULL))      ? ICU_TRUE        : ICU_FALSE;
+
+  if ((flushb == ICU_TRUE) && (inbytesleftl != 0)) {
     /* make sure no byte is read in any case if this is a flush */
     inbytesleftl = 0;
   }
@@ -645,7 +657,7 @@
 	      funcs,
 	      (unsigned long long) *inbytesleftlp,
 	      (unsigned long long) *outbytesleftlp,
-	      (flushb == TRUE) ? "TRUE" : "FALSE");
+	      (flushb == ICU_TRUE) ? "true" : "false");

   /* --------------------------------------------------------------------- */
   /* The following is an exact replication of uconv.cpp algorithm but in C */
@@ -690,7 +702,7 @@
 		funcs,
 		(unsigned long long) (*inbufpp - inbufOrigp),
 		(unsigned long long) *uLengthlp,
-		(fromSawEndOfBytesb == TRUE) ? "TRUE" : "FALSE");
+		(fromSawEndOfBytesb == ICU_TRUE) ? "true" : "false");

     /* --------------------------------------------------------------------- */
     /* Eventually remove signature                                           */
@@ -722,7 +734,7 @@
                                         contextp->chunkUsedl,
                                         *upp,
                                         *uLengthlp);
-        if ((chunkl < 0) && (flushb == TRUE) && (fromSawEndOfBytesb == TRUE)) {
+        if ((chunkl < 0) && (flushb == ICU_TRUE) && (fromSawEndOfBytesb == ICU_TRUE)) {
 	  /* ------------------------------------------ */
 	  /* use all of the rest at the end of the text */
 	  /* ------------------------------------------ */
@@ -744,7 +756,7 @@

             int32_t newchunkused = contextp->chunkUsedl + chunkl;
             if (newchunkused > contextp->chunkCapacityl) {
-              if (_increaseChunkBuffer(contextp, newchunkused) == FALSE) {
+              if (_increaseChunkBuffer(contextp, newchunkused) == ICU_FALSE) {
                 goto err;
               }
             }
@@ -779,7 +791,7 @@
                              &uErrorCode);
           if (uErrorCode == U_BUFFER_OVERFLOW_ERROR) {
             /* Voila... Increase chunk allocated size */
-            if (_increaseChunkBuffer(contextp, textLengthl) == FALSE) {
+            if (_increaseChunkBuffer(contextp, textLengthl) == ICU_FALSE) {
               goto err;
             }
             /* Restore chunk data */
@@ -810,7 +822,7 @@
           if (textLengthl > 0) {
             int32_t newoutused = contextp->outUsedl + textLengthl;
             if (newoutused > contextp->outCapacityl) {
-              if (_increaseOutBuffer(contextp, newoutused) == FALSE) {
+              if (_increaseOutBuffer(contextp, newoutused) == ICU_FALSE) {
                 goto err;
               }
             }
@@ -828,7 +840,7 @@
           if (*uLengthlp > 0) {
             int32_t newchunkused = contextp->chunkUsedl + *uLengthlp;
             if (newchunkused > contextp->chunkCapacityl) {
-              if (_increaseChunkBuffer(contextp, newchunkused) == FALSE) {
+              if (_increaseChunkBuffer(contextp, newchunkused) == ICU_FALSE) {
                 goto err;
               }
             }
@@ -928,7 +940,7 @@
       goto err;
     }

-  } while (fromSawEndOfBytesb == FALSE);
+  } while (fromSawEndOfBytesb == ICU_FALSE);

  overflow:

@@ -1044,7 +1056,7 @@
                      &in,
 		     a + 1,
                      NULL,
-		     TRUE,
+		     ICU_TRUE,
 		     &uErrorCode);
     ucnv_resetFromUnicode(uConverterp);

@@ -1132,13 +1144,13 @@
   chunkCopyp = (chunkCopyp == NULL) ? (UChar *) malloc(chunkSizel) : (UChar *) realloc(chunkCopyp, chunkSizel);

   if (TCONV_UNLIKELY((chunkp == NULL) || (chunkCopyp == NULL))) {
-    return FALSE;
+    return ICU_FALSE;
   }
   contextp->chunkp         = chunkp;
   contextp->chunkCopyp     = chunkCopyp;
   contextp->chunkCapacityl = chunkCapacityl;

-  return TRUE;
+  return ICU_TRUE;
 }

 /*****************************************************************************/
@@ -1152,12 +1164,12 @@
   outp = (outp == NULL) ? (UChar *) malloc(outSizel) : (UChar *) realloc(outp, outSizel);

   if (TCONV_UNLIKELY(outp == NULL)) {
-    return FALSE;
+    return ICU_FALSE;
   }
   contextp->outp         = outp;
   contextp->outCapacityl = outCapacityl;

-  return TRUE;
+  return ICU_TRUE;
 }

 #endif /* !UCONFIG_NO_TRANSLITERATION */


Fix warning (set but unused)

Fix warning (set but unused)

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@44795 27541ba8-7e3a-0410-8455-c3a389f83636

--- build/rmkdepend/ifparser.c
+++ build/rmkdepend/ifparser.c
@@ -256,7 +256,6 @@
       case '_':
          if (strncmp(cp, "__has_feature", 13) == 0 && !isalnum(cp[13])) {
             int paren = 0;
-            int len;

             cp += 13;
             SKIPSPACE(cp);
@@ -265,7 +264,6 @@
                cp++;
             }
             DO(cp = parse_variable(g, cp, &var));
-            len = cp - var;
             SKIPSPACE(cp);
             if (paren && *cp != ')')
                return CALLFUNC(g, handle_error)(g, cp, ")");


* updated pwmout_api.c for KnR coding standards.

--- libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0+/pwmout_api.c
+++ libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0+/pwmout_api.c
@@ -86,7 +86,7 @@
     PinName pin;
     uint32_t ch_index = NC;
     struct tcc_config config_tcc;
-	uint32_t tcc_channel = NC;
+    uint32_t tcc_channel = NC;

     /* Sanity check arguments */
     MBED_ASSERT(obj);
@@ -101,18 +101,15 @@
         /* Pin not supported */
         return 0;
     }
-	if ((ch_index == 0) || (ch_index == 4)) {
-		tcc_channel = 0;
-	}
-	else if ((ch_index == 1) || (ch_index == 5)) {
-		tcc_channel = 1;
-	}
-	else if ((ch_index == 2) || (ch_index == 6)) {
-		tcc_channel = 2;
-	}
-	else if ((ch_index == 3) || (ch_index == 7)) {
-		tcc_channel = 3;
-	}
+    if ((ch_index == 0) || (ch_index == 4)) {
+        tcc_channel = 0;
+    } else if ((ch_index == 1) || (ch_index == 5)) {
+        tcc_channel = 1;
+    } else if ((ch_index == 2) || (ch_index == 6)) {
+        tcc_channel = 2;
+    } else if ((ch_index == 3) || (ch_index == 7)) {
+        tcc_channel = 3;
+    }

     tcc_get_config_defaults(&config_tcc, (Tcc*)pwm);


Fix stupid logical bug

Fix stupid logical bug

--- source/sender.c
+++ source/sender.c
@@ -206,7 +206,7 @@

             if(data->state != STATE_IDLE) svcBreak(USERBREAK_PANIC);

-            if(!(serviceId == 0 && (cmdbuf[0] >> 16) != 5)) //if not pxi:mc 5
+            if(!(serviceId == 0 && (cmdbuf[0] >> 16) == 5)) //if not pxi:mc 5
                 sessionManager.latest_PXI_MC5_val = 0;
             else if((u8)(cmdbuf[1]) != 0)
             {


Removed unused variable

Removed unused variable

--- interface/io.c
+++ interface/io.c
@@ -46,7 +46,6 @@
 int IO_read_input(char *command_buffer, int max_size)
 {
     char *p;
-    int has_input = 0;

     /* Poll for input on STDIN */
     if(IO_ready()) {


Handling sizeof in intermediate code generation

--- intermediate.c
+++ intermediate.c
@@ -237,6 +237,46 @@
 	case UNARY_EXPR2: {
 		n->place = get_place(t, 1);
 		push_op(n, op_new(map_code(n->rule), NULL, n->place, one, e));
+		break;
+	}
+	case UNARY_EXPR7:
+	case UNARY_EXPR8: { /* sizeof(symbol) */
+		/* obtain size as a const int */
+		struct address size;
+		size.region = CONST_R;
+		size.type = &int_type;
+
+		struct typeinfo *type = NULL;
+
+		char *k = get_identifier(t);
+		if (k) {
+			/* perform symbol lookup if possible */
+			type = typeinfo_copy(scope_search(k));
+			/* if dereferencing, use size of value */
+			if (get_pointer(t))
+				type->pointer = false;
+			/* if accessing an index, use size of array element */
+			if (get_array(t) > 0) {
+				struct typeinfo *temp = typeinfo_copy(type->array.type);
+				free(type);
+				type = temp;
+			}
+		} else {
+			/* get type specifier */
+			struct tree *type_spec = get_production(t, TYPE_SPEC_SEQ);
+			if (type_spec == NULL)
+				log_semantic(t, "sizeof operator missing type spec");
+			type = typeinfo_copy(type_check(tree_index(type_spec, 0)));
+			/* check if given a pointer type */
+			if (get_pointer(t))
+				type->pointer = true;
+		}
+		if (type == NULL) /* still a semantic error */
+			log_semantic(t, "sizeof operator missing type");
+
+		size.offset = typeinfo_size(type);
+		free(type);
+		n->place = size;
 		break;
 	}
 	case POSTFIX_EXPR9:


R3Frustum

--- pkgs/R3Shapes/R3Frustum.h
+++ pkgs/R3Shapes/R3Frustum.h
@@ -53,8 +53,8 @@
   virtual void SetHalfspace(int dir, int dim, const R3Halfspace& halfspace);

   // Draw function
-  void Draw(void) const;
-  void Outline(void) const;
+  virtual void Draw(void) const;
+  virtual void Outline(void) const;

   // Standard shape definitions
   RN_CLASS_TYPE_DECLARATIONS(R3Frustum);


remove const from wtxid in gentxid

remove const from wtxid in gentxid

Former-commit-id: 06243df9fd63003c31c09b1ce4f179db7f13aa26

--- src/primitives/transaction.h
+++ src/primitives/transaction.h
@@ -782,7 +782,7 @@
 // SYSCOIN
 class GenTxid
 {
-    const bool m_is_wtxid;
+    bool m_is_wtxid;
     uint256 m_hash;
     uint32_t m_type;
 public:


Update comment.

Update comment.

--- src/primitives/transaction.h
+++ src/primitives/transaction.h
@@ -417,7 +417,7 @@
     }

     /** Compute the hash of this CMutableTransaction. This is computed on the
-     * fly, as opposed to GetHash() in CTransaction, which uses a cached result.
+     * fly, as opposed to GetSerializeHash() in CTransaction, which uses a cached result.
      */
     uint256 GetSerializeHash() const;


TCPMv2: Use ErrorRecovery rather than hard reset during FRS

While in the middle of an FRS, we should not allow any hard resets.  If
a hard reset is performed, we may mistake our own FRS Vbus for the
partner and end up stuck in Attached.SNK.

BRANCH=guybrush
BUG=b:230494120
TEST=on nipperkin, observe that ErrorRecovery is performed after RCP
event on FRS dongle unplug.  Observe that power loss to the FRS dongle
still results in a successful FRS

Signed-off-by: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>
Change-Id: I081b27ec9552b15c2061fa97b57e8e6eb1552236
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3671454
Reviewed-by: Aseda Aboagye <12c9b286316a940fd31c24070da5ab64cdd4d0e7@chromium.org>
Commit-Queue: Aseda Aboagye <12c9b286316a940fd31c24070da5ab64cdd4d0e7@chromium.org>

--- common/usbc/usb_pe_drp_sm.c
+++ common/usbc/usb_pe_drp_sm.c
@@ -839,8 +839,21 @@
 		 * Reset path depending on current power role.
 		 */
 		if (PE_CHK_DPM_REQUEST(port, DPM_REQUEST_HARD_RESET_SEND)) {
-			pe_set_dpm_curr_request(port, DPM_REQUEST_HARD_RESET_SEND);
-			pe_set_hard_reset(port);
+			/*
+			 * If a hard reset condition came up during FRS, we must
+			 * go into ErrorRecovery.  Performing a hard reset could
+			 * leave us assuming our own FRS Vbus is coming from the
+			 * partner and leave the port stuck as Attached.SNK
+			 */
+			if (pe_in_frs_mode(port)) {
+				PE_CLR_DPM_REQUEST(port,
+						   DPM_REQUEST_HARD_RESET_SEND);
+				set_state_pe(port, PE_WAIT_FOR_ERROR_RECOVERY);
+			} else {
+				pe_set_dpm_curr_request(port,
+						DPM_REQUEST_HARD_RESET_SEND);
+				pe_set_hard_reset(port);
+			}
 		}

 		/*


adding foo for david

adding foo for david

error: pathspec 'semantics/foo/stdarg.h' did not match any file(s) known to git

--- semantics/foo/stdarg.h
+++ semantics/foo/stdarg.h
@@ -0,0 +1,26 @@
+// #undef va_arg
+// #undef va_start
+// #undef va_end
+// #undef va_copy
+// #undef __va_copy
+// typedef void* myva_list;
+// #define va_list myva_list
+
+typedef void* va_list;
+
+#define __va_argsiz(t)  ((sizeof(t)))
+va_list __va_arg(va_list* ap, long long size);
+#define va_arg(ap, t) \
+    (*((t*)(__va_arg((&(ap)), (__va_argsiz(t))))))
+
+void __va_start(va_list* ap, void* pN);
+#define va_start(ap, pN) \
+    (__va_start((&(ap)), ((void*)(&(pN)))))
+
+void __va_end(va_list* ap);
+#define va_end(ap) \
+    (__va_end(&(ap)))
+
+void __va_copy(va_list* dst, va_list src);
+#define va_copy(dst, src) \
+    (__va_copy((&(dst)), (src)))


fix install link

fix install link

--- noun/manage.c
+++ noun/manage.c
@@ -1484,7 +1484,7 @@
                    -1, 0);

       fprintf(stderr, "boot: mapping %dMB failed\r\n", (len_w / (1024 * 1024)));
-      fprintf(stderr, "see urbit.org/docs/user/install for adding swap space\r\n");
+      fprintf(stderr, "see urbit.org/docs/using/install for adding swap space\r\n");
       if ( -1 != (c3_ps)map_v ) {
         fprintf(stderr,
                 "if porting to a new platform, try U3_OS_LoomBase %p\r\n",


print green message if wlandump forced handshakes inside the cap

--- wlancap2hcx.c
+++ wlancap2hcx.c
@@ -856,21 +856,14 @@
 	{
 	pcapdh = pcap_open_dead(DLT_IEEE802_11, 65535);
 	if ((pcapout = pcap_dump_open(pcapdh, pcapoutname)) == NULL)
-		{
-		fprintf(stderr, "error creating dump file %s\n", pcapoutname);
-		exit(EXIT_FAILURE);
-		}
+		fprintf(stderr, "\x1B[31merror creating dump file %s\x1B[0m\n", pcapoutname);
 	}

 for (index = optind; index < argc; index++)
 	{
 	if(processcap(argv[index], essidoutname, essidunicodeoutname) == FALSE)
-		{
-		fprintf(stderr, "error processing records from %s\n", (argv[index]));
-//		exit(EXIT_FAILURE);
-		}
-	}
-
+		fprintf(stderr, "\x1B[31merror processing records from %s\x1B[0m\n", (argv[index]));
+	}

 if(pcapout != NULL)
 	pcap_dump_close(pcapout);


get_pkg_dir: properly exit upon error.

get_pkg_dir: properly exit upon error.

--- get_pkg_dir.c
+++ get_pkg_dir.c
@@ -19,10 +19,13 @@
 	path_len = srcpkgdir_len+dir_len+2;
 	path = malloc(sizeof(char)*(path_len));
 	ret = snprintf(path, path_len, "%s/%s", srcpkgs, dir_name);
+
+	if (ret < 1) {
+		fprintf(stderr, "Error: %s.\n", strerror(errno));
+		exit(EXIT_FAILURE);
+	}
+
 	path[path_len] = '\0';
-
-	if (ret < 1)
-		fprintf(stderr, "Error: %s.\n", strerror(errno));

 	return path;
 }


[cpu_features] Refactoring get_cpu_features()

--- common/arch/generic_x86/cpu_features.c
+++ common/arch/generic_x86/cpu_features.c
@@ -11,6 +11,9 @@

 void get_cpu_features(void)
 {
+   STATIC_ASSERT(sizeof(x86_cpu_features.edx1) == 32);
+   STATIC_ASSERT(sizeof(x86_cpu_features.ecx1) == 32);
+
    u32 a = 0, b = 0, c = 0, d = 0;
    struct x86_cpu_features *f = (void *)&x86_cpu_features;

@@ -22,6 +25,7 @@
    memcpy(f->vendor_id + 4, &d, 4);
    memcpy(f->vendor_id + 8, &c, 4);

+   /* If CPUID is supported, CPUID[1] is always supported */
    cpuid(1, &a, &b, &c, &d);

    for (u32 bit = 0; bit < 32; bit++)
@@ -30,25 +34,34 @@
    for (u32 bit = 0; bit < 32; bit++)
       ((bool *)&f->ecx1)[bit] = !!(c & (1u << bit));

-   if (f->max_basic_cpuid_cmd >= 7) {
-      if (f->ecx1.avx) {
-         cpuid(7, &a, &b, &c, &d);
-         f->avx2 = !!(b & (1 << 5)) && !!(b & (1 << 3)) && !!(b & (1 << 8));
-      }
+   if (f->max_basic_cpuid_cmd < 7)
+      goto ext_features;
+
+   /* CPUID[7] supported */
+   if (f->ecx1.avx) {
+      cpuid(7, &a, &b, &c, &d);
+      f->avx2 = !!(b & (1 << 5)) && !!(b & (1 << 3)) && !!(b & (1 << 8));
    }
+
+ext_features:

    cpuid(0x80000000, &a, &b, &c, &d);
    f->max_ext_cpuid_cmd = a;

-   if (f->max_ext_cpuid_cmd >= 0x80000008) {
+   if (f->max_ext_cpuid_cmd < 0x80000007)
+      return;

-      cpuid(0x80000007, &a, &b, &c, &d);
-      f->invariant_TSC = !!(d & (1 << 8));
+   /* CPUID[0x80000007] supported */
+   cpuid(0x80000007, &a, &b, &c, &d);
+   f->invariant_TSC = !!(d & (1 << 8));

-      cpuid(0x80000008, &a, &b, &c, &d);
-      f->phys_addr_bits = a & 0xff;
-      f->virt_addr_bits = (a >> 8) & 0xff;
-   }
+   if (f->max_ext_cpuid_cmd < 0x80000008)
+      return;
+
+   /* CPUID[0x80000008] supported */
+   cpuid(0x80000008, &a, &b, &c, &d);
+   f->phys_addr_bits = a & 0xff;
+   f->virt_addr_bits = (a >> 8) & 0xff;
 }

 #ifdef __TILCK_KERNEL__


*** empty log message ***

*** empty log message ***

--- gridftp/client/source/globus_ftp_client_perf_plugin.c
+++ gridftp/client/source/globus_ftp_client_perf_plugin.c
@@ -201,10 +201,9 @@

     if(ps->use_data && !error)
     {
+        globus_mutex_lock(&ps->lock);
+
         time_now = time(NULL);
-
-        globus_mutex_lock(&ps->lock);
-
         ps->nbytes += length;

         if(ps->marker_cb && time_now > ps->last_time)


Add first unit test for `digger_dig_area()` function.

Test digging a 10x10 chamber.

--- src/dungeon/digger_test.c
+++ src/dungeon/digger_test.c
@@ -418,7 +418,7 @@
     assert(box_equals(expected_box, generator->areas[0]->box));

     // 1  f  f  f  f  .
-    // 0  f  s  s  f  .
+    // 0  f  u  u  f  .
     //-1  .  f  f  f  .
     //   -2 -1  0  1  2
     assert(11 == generator->tiles_count);
@@ -446,11 +446,13 @@

     assert(point_equals(point_make(-1, 0, 1), generator->tiles[4]->point));
     assert(tile_type_stairs_up == generator->tiles[4]->type);
+    assert(direction_east == generator->tiles[4]->direction);
     assert(wall_type_solid == generator->tiles[4]->walls.south);
     assert(wall_type_none == generator->tiles[4]->walls.west);

     assert(point_equals(point_make(0, 0, 1), generator->tiles[5]->point));
     assert(tile_type_stairs_up == generator->tiles[5]->type);
+    assert(direction_east == generator->tiles[5]->direction);
     assert(wall_type_solid == generator->tiles[5]->walls.south);
     assert(wall_type_none == generator->tiles[5]->walls.west);

@@ -479,6 +481,81 @@
     assert(tile_type_filled == generator->tiles[10]->type);
     assert(wall_type_none == generator->tiles[10]->walls.south);
     assert(wall_type_none == generator->tiles[10]->walls.west);
+
+    digger_free(digger);
+    generator_free(generator);
+    dungeon_options_free(dungeon_options);
+    dungeon_free(dungeon);
+}
+
+
+static void
+digger_dig_area_test(void)
+{
+    struct dungeon *dungeon = dungeon_alloc();
+    struct dungeon_options *dungeon_options = dungeon_options_alloc_default();
+    struct generator *generator = generator_alloc(dungeon, global_rnd, dungeon_options, NULL, NULL);
+    struct digger *digger = digger_alloc(generator, point_make(0, 0, 1), direction_west);
+
+    assert(0 == generator->areas_count);
+    assert(0 == generator->tiles_count);
+
+    digger_dig_area(digger, 1, 1, 0, wall_type_door, area_type_chamber);
+
+    assert(1 == generator->areas_count);
+    assert(area_type_chamber == generator->areas[0]->type);
+    assert(area_features_none == generator->areas[0]->features);
+    assert(direction_west == generator->areas[0]->direction);
+    struct box expected_box = box_make(point_make(0, 0, 1), size_make(1, 1, 1));
+    assert(box_equals(expected_box, generator->areas[0]->box));
+
+    // 1  f  f  f
+    // 0  f  e  f
+    //-1  .  f  f
+    //   -1  0  1
+    assert(8 == generator->tiles_count);
+
+    assert(point_equals(point_make(0, -1, 1), generator->tiles[0]->point));
+    assert(tile_type_filled == generator->tiles[0]->type);
+    assert(wall_type_none == generator->tiles[0]->walls.south);
+    assert(wall_type_none == generator->tiles[0]->walls.west);
+
+    assert(point_equals(point_make(1, -1, 1), generator->tiles[1]->point));
+    assert(tile_type_filled == generator->tiles[1]->type);
+    assert(wall_type_none == generator->tiles[1]->walls.south);
+    assert(wall_type_none == generator->tiles[1]->walls.west);
+
+
+    assert(point_equals(point_make(-1, 0, 1), generator->tiles[2]->point));
+    assert(tile_type_filled == generator->tiles[2]->type);
+    assert(wall_type_none == generator->tiles[2]->walls.south);
+    assert(wall_type_none == generator->tiles[2]->walls.west);
+
+    assert(point_equals(point_make(0, 0, 1), generator->tiles[3]->point));
+    assert(tile_type_empty == generator->tiles[3]->type);
+    assert(wall_type_solid == generator->tiles[3]->walls.south);
+    assert(wall_type_solid == generator->tiles[3]->walls.west);
+
+    assert(point_equals(point_make(1, 0, 1), generator->tiles[4]->point));
+    assert(tile_type_filled == generator->tiles[4]->type);
+    assert(wall_type_none == generator->tiles[4]->walls.south);
+    assert(wall_type_door == generator->tiles[4]->walls.west);
+
+
+    assert(point_equals(point_make(-1, 1, 1), generator->tiles[5]->point));
+    assert(tile_type_filled == generator->tiles[5]->type);
+    assert(wall_type_none == generator->tiles[5]->walls.south);
+    assert(wall_type_none == generator->tiles[5]->walls.west);
+
+    assert(point_equals(point_make(0, 1, 1), generator->tiles[6]->point));
+    assert(tile_type_filled == generator->tiles[6]->type);
+    assert(wall_type_solid == generator->tiles[6]->walls.south);
+    assert(wall_type_none == generator->tiles[6]->walls.west);
+
+    assert(point_equals(point_make(1, 1, 1), generator->tiles[7]->point));
+    assert(tile_type_filled == generator->tiles[7]->type);
+    assert(wall_type_none == generator->tiles[7]->walls.south);
+    assert(wall_type_none == generator->tiles[7]->walls.west);

     digger_free(digger);
     generator_free(generator);
@@ -504,4 +581,5 @@
     digger_turn_90_degrees_left_test();
     digger_turn_90_degrees_right_test();
     digger_dig_starting_stairs_test();
-}
+    digger_dig_area_test();
+}


Remove friend function in FFTServer.

Remove friend function in FFTServer.

--- inc/fftw_hao.h
+++ inc/fftw_hao.h
@@ -5,6 +5,7 @@

 class FFTServer
 {
+ public:
     int  dimen;
     int* n;
     int  L;
@@ -14,7 +15,7 @@
     std::complex<double>* outback;
     fftw_plan planforw;
     fftw_plan planback;
- public:
+
     FFTServer();
     FFTServer(int Dc, const int* Nc, char format); //'C' Column-major: fortran style; 'R' Row-major: c style;
     FFTServer(const FFTServer& x);
@@ -24,11 +25,6 @@

     std::complex<double>* fourier_forw(const std::complex<double>* inarray);
     std::complex<double>* fourier_back(const std::complex<double>* inarray);
-
-    friend void FFTServer_void_construction_test();
-    friend void FFTServer_param_construction_test();
-    friend void FFTServer_equal_construction_test();
-    friend void FFTServer_equal_test();
 };

 #endif


KroneckerProduct: we have const_cast_derived so why not use it?

--- unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
+++ unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
@@ -31,6 +31,8 @@
                      Ac = A.cols(),
                      Br = B.rows(),
                      Bc = B.cols();
+  AB.resize(Ar*Br,Ac*Bc);
+
   for (unsigned int i=0; i<Ar; ++i)
     for (unsigned int j=0; j<Ac; ++j)
       AB.block(i*Br,j*Bc,Br,Bc) = A(i,j)*B;
@@ -78,22 +80,6 @@

 } // end namespace internal

-
-
-/*!
- * Computes Kronecker tensor product of two dense matrices
- *
- * \param a  Dense matrix a
- * \param b  Dense matrix b
- * \param c  Kronecker tensor product of a and b
- */
-template<typename A,typename B,typename CScalar,int CRows,int CCols, int COptions, int CMaxRows, int CMaxCols>
-void kroneckerProduct(const MatrixBase<A>& a, const MatrixBase<B>& b, Matrix<CScalar,CRows,CCols,COptions,CMaxRows,CMaxCols>& c)
-{
-  c.resize(a.rows()*b.rows(),a.cols()*b.cols());
-  internal::kroneckerProduct_full(a.derived(), b.derived(), c);
-}
-
 /*!
  * Computes Kronecker tensor product of two dense matrices
  *
@@ -107,10 +93,9 @@
  * \param c  Kronecker tensor product of a and b
  */
 template<typename A,typename B,typename C>
-void kroneckerProduct(const MatrixBase<A>& a, const MatrixBase<B>& b, MatrixBase<C> const & c_)
+void kroneckerProduct(const MatrixBase<A>& a, const MatrixBase<B>& b, const MatrixBase<C>& c)
 {
-  MatrixBase<C>& c = const_cast<MatrixBase<C>& >(c_);
-  internal::kroneckerProduct_full(a.derived(), b.derived(), c.derived());
+  internal::kroneckerProduct_full(a.derived(), b.derived(), c.const_cast_derived());
 }

 /*!


Added more tests for digger movement functions.

New tests for `digger_ascend()`, `digger_descend()` and
`digger_spin_180_degrees()`.

--- src/dungeon/digger_test.c
+++ src/dungeon/digger_test.c
@@ -208,6 +208,79 @@
     digger_move_right(digger, 1);
     assert(point_equals(point_make(3, 3, 1), digger->point));
     assert(direction_northeast == digger->direction);
+
+    digger_free(digger);
+    generator_free(generator);
+    dungeon_options_free(dungeon_options);
+    dungeon_free(dungeon);
+}
+
+
+static void
+digger_ascend_test(void)
+{
+    struct dungeon *dungeon = dungeon_alloc();
+    struct dungeon_options *dungeon_options = dungeon_options_alloc_default();
+    struct generator *generator = generator_alloc(dungeon, global_rnd, dungeon_options, NULL, NULL);
+
+    struct digger *digger = digger_alloc(generator, point_make(0, 0, 4), direction_west);
+
+    digger_ascend(digger, 1);
+    assert(point_equals(point_make(0, 0, 3), digger->point));
+    assert(direction_west == digger->direction);
+
+    digger_ascend(digger, 2);
+    assert(point_equals(point_make(0, 0, 1), digger->point));
+    assert(direction_west == digger->direction);
+
+    digger_free(digger);
+    generator_free(generator);
+    dungeon_options_free(dungeon_options);
+    dungeon_free(dungeon);
+}
+
+
+static void
+digger_descend_test(void)
+{
+    struct dungeon *dungeon = dungeon_alloc();
+    struct dungeon_options *dungeon_options = dungeon_options_alloc_default();
+    struct generator *generator = generator_alloc(dungeon, global_rnd, dungeon_options, NULL, NULL);
+
+    struct digger *digger = digger_alloc(generator, point_make(0, 0, 1), direction_west);
+
+    digger_descend(digger, 1);
+    assert(point_equals(point_make(0, 0, 2), digger->point));
+    assert(direction_west == digger->direction);
+
+    digger_descend(digger, 3);
+    assert(point_equals(point_make(0, 0, 5), digger->point));
+    assert(direction_west == digger->direction);
+
+    digger_free(digger);
+    generator_free(generator);
+    dungeon_options_free(dungeon_options);
+    dungeon_free(dungeon);
+}
+
+
+static void
+digger_spin_180_degrees_test(void)
+{
+    struct dungeon *dungeon = dungeon_alloc();
+    struct dungeon_options *dungeon_options = dungeon_options_alloc_default();
+    struct generator *generator = generator_alloc(dungeon, global_rnd, dungeon_options, NULL, NULL);
+
+    struct digger *digger = digger_alloc(generator, point_make(0, 0, 1), direction_west);
+
+    digger_spin_180_degrees(digger);
+    assert(point_equals(point_make(0, 0, 1), digger->point));
+    assert(direction_east == digger->direction);
+
+    digger->direction = direction_southeast;
+    digger_spin_180_degrees(digger);
+    assert(point_equals(point_make(0, 0, 1), digger->point));
+    assert(direction_northwest == digger->direction);

     digger_free(digger);
     generator_free(generator);
@@ -225,4 +298,7 @@
     digger_move_backward_test();
     digger_move_left_test();
     digger_move_right_test();
-}
+    digger_ascend_test();
+    digger_descend_test();
+    digger_spin_180_degrees_test();
+}


Fixing doxygen comment (remark by Milton Soares Filho).

--- inc/gcontact.h
+++ inc/gcontact.h
@@ -153,7 +153,7 @@

-/** Creates a new contact.
+/** Modify an existing contact.
  *
  * You need to first succeed to get an authorization token using
  * \ref gcal_get_authentication with mode set using


drqs-142948762: bslstl_boyermoorehorspoolsearcher': Needle opt. doc update.

--- groups/bsl/bslstl/bslstl_boyermoorehorspoolsearcher.h
+++ groups/bsl/bslstl/bslstl_boyermoorehorspoolsearcher.h
@@ -106,9 +106,9 @@
 ///------------------------------------------------------
 // This implementation handles needle metadata using a fixed size array when
 // the 'value_type' is 'char' (either 'signed' or 'unsigned' flavors).  For
-// needles of typical size, this choice results in a larger searcher object
-// footprint than it would have if some dynamically sized container were used;
-// however, the faster access during searches warrants the tradeoff.
+// needles of typical size, this choice results in somewhat more memory use
+// than it would have if some dynamically sized container were used; however,
+// the faster access during searches warrants the tradeoff.
 //
 ///Usage
 ///-----
@@ -713,10 +713,11 @@
                           BloombergLP::bslma::Allocator       *basicAllocator);
         // Create a 'BoyerMooreHorspoolSearcher_CharImp' object having the same
         // state as the specified 'original' object and that uses
-        // 'basicAllocator' to supply memory.  If 'basicAllocator' is 0, the
-        // currently installed default allocator is used.  The 'original'
-        // object is left in an unspecified (valid) state.  Note that this
-        // implementation does not allocate memory.
+        // 'basicAllocator' to supply memory.  The state of 'original' are
+        // moved (in constant time) to the new searcher if
+        // 'basicAllocator == original.allocator()', and are copied using
+        // 'basicAllocator' otherwise.  The 'original' object is left in an
+        // unspecified (valid) state.

     // MANIPULATORS
     BoyerMooreHorspoolSearcher_CharImp& operator=(
@@ -829,9 +830,9 @@
                        BoyerMooreHorspoolSearcher_GeneralImp>  original,
                        BloombergLP::bslma::Allocator          *basicAllocator);
         // Create a 'BoyerMooreHorspoolSearcher_GeneralImp' object having same
-        // state as the specified 'original' object.  Optionally specify a
-        // 'basicAllocator' used to supply memory.  If 'basicAllocator' is 0,
-        // the currently installed default allocator is used.  The state of
+        // state as the specified 'original' object.  The specified
+        // 'basicAllocator' is used to supply memory.  If 'basicAllocator' is
+        // 0, the currently installed default allocator is used.  The state of
         // 'original' is moved (in constant time) to the new searcher if
         // 'basicAllocator == original.allocator()', and is move-inserted (in
         // linear time) using 'basicAllocator' otherwise.  The 'original'


builder: Do not repeat the separate locales path

These changes replace all occurrences of 'share/runtime/locale' with a
define so it will avoid possible mistakes when having to be replaced
one day.

--- builder/builder-manifest.c
+++ builder/builder-manifest.c
@@ -33,6 +33,8 @@

 #include "libgsystem.h"
 #include "libglnx/libglnx.h"
+
+#define LOCALES_SEPARATE_DIR "share/runtime/locale"

 struct BuilderManifest {
   GObject parent;
@@ -1625,12 +1627,12 @@
       if (self->build_runtime)
         {
           debuginfo_dir = g_file_resolve_relative_path (app_dir, "usr/lib/debug");
-          locale_parent_dir = g_file_resolve_relative_path (app_dir, "usr/share/runtime/locale");
+          locale_parent_dir = g_file_resolve_relative_path (app_dir, "usr/" LOCALES_SEPARATE_DIR);
         }
       else
         {
           debuginfo_dir = g_file_resolve_relative_path (app_dir, "files/lib/debug");
-          locale_parent_dir = g_file_resolve_relative_path (app_dir, "files/share/runtime/locale");
+          locale_parent_dir = g_file_resolve_relative_path (app_dir, "files/" LOCALES_SEPARATE_DIR);
         }

       if (self->separate_locales && g_file_query_exists (locale_parent_dir, NULL))
@@ -1645,9 +1647,10 @@

           extension_contents = g_strdup_printf("\n"
                                                "[Extension %s.Locale]\n"
-                                               "directory=share/runtime/locale\n"
+                                               "directory=%s\n"
                                                "subdirectories=true\n",
-                                               self->id);
+                                               self->id,
+                                               LOCALES_SEPARATE_DIR);

           output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, error);
           if (output == NULL)
@@ -1781,7 +1784,7 @@
           if (!builder_migrate_locale_dirs (root_dir, error))
             return FALSE;

-          locale_dir = g_file_resolve_relative_path (root_dir, "share/runtime/locale");
+          locale_dir = g_file_resolve_relative_path (root_dir, LOCALES_SEPARATE_DIR);
         }

       if (self->metadata_platform)
@@ -1899,9 +1902,10 @@

           extension_contents = g_strdup_printf("\n"
                                                "[Extension %s.Locale]\n"
-                                               "directory=share/runtime/locale\n"
+                                               "directory=%s\n"
                                                "subdirectories=true\n",
-                                               self->id_platform);
+                                               self->id_platform,
+                                               LOCALES_SEPARATE_DIR);

           output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, error);
           if (output == NULL)


add missing include guard

add missing include guard

--- include/Cuti.h
+++ include/Cuti.h
@@ -20,6 +20,9 @@
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
+
+#ifndef CPP_UNIT_TEST_INTEGRATED
+#define CPP_UNIT_TEST_INTEGRATED

 #ifdef CUTI_USES_MSVC_UNIT_BACKEND
 #ifdef WIN32
@@ -230,3 +233,5 @@
 */
 #define CUTI_TEAR_DOWN() virtual void tearDown() override
 #endif
+
+#endif


Added fallback for gemv.

Added fallback for gemv.

--- include/blas.h
+++ include/blas.h
@@ -26,6 +26,28 @@
 	{
 		for(size_t i = 0; i < N; ++i)
 			Y[i * strideY] += alpha * X[i * strideX];
+	}
+
+	static void gemv(CBLAS_ORDER order, CBLAS_TRANSPOSE transA, size_t rows, size_t cols, T alpha, T *A, size_t lda, T *X, size_t strideX, T beta, T *Y, size_t strideY)
+	{
+		if(transA == CblasNoTrans)
+		{
+			for(size_t i = 0; i < rows; ++i)
+			{
+				Y[i * strideY] *= beta;
+				for(size_t j = 0; j < cols; ++j)
+					Y[i * strideY] += alpha * A[i * lda + j] * X[j * strideX];
+			}
+		}
+		else
+		{
+			for(size_t i = 0; i < cols; ++i)
+			{
+				Y[i * strideY] *= beta;
+				for(size_t j = 0; j < rows; ++j)
+					Y[i * strideY] += alpha * A[j * lda + i] * X[j * strideX];
+			}
+		}
 	}
 };


tidy comments

tidy comments

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@15040 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- include/bmap.h
+++ include/bmap.h
@@ -198,14 +198,14 @@
 #define bmap_foff(b)		((b)->bcm_bmapno * SLASH_BMAP_SIZE)

 /* bmap per-replica states */
-#define BREPLST_INVALID		0	/* no data present */
+#define BREPLST_INVALID		0	/* no data present (zeros) */
 #define BREPLST_REPL_SCHED	1	/* replica is being made */
 #define BREPLST_REPL_QUEUED	2	/* replica needs to be made */
 #define BREPLST_VALID		3	/* replica is active */
 #define BREPLST_TRUNCPNDG	4	/* partial truncation in bmap */
-#define BREPLST_TRUNCPNDG_SCHED	5	/* checksum error */
-#define BREPLST_GARBAGE		6	/* marked for deletion */
-#define BREPLST_GARBAGE_SCHED	7	/* being deleted */
+#define BREPLST_TRUNCPNDG_SCHED	5	/* ptrunc resolving CRCs recomp */
+#define BREPLST_GARBAGE		6	/* marked for reclamation */
+#define BREPLST_GARBAGE_SCHED	7	/* being reclaimed */
 #define NBREPLST		8

 #define BMAP_NULL_CRC		UINT64_C(0x436f5d7c450ed606)


double, missplaced strnlen removed from defs.h

git-svn-id: 0634bf30b6d7a21f2003d4a9f34c102a3ffa6fda@734 34602234-ff1f-0410-a465-ea8f3b77ab7f

--- include/defs.h
+++ include/defs.h
@@ -38,19 +38,6 @@

-#if (defined(WIN32) && (!defined(_MSC_VER) || _MSC_VER <= 1200)) || defined(MACOSX)
-#include <stddef.h> // for size_t
-// TODO: remove this from whole code! (we use std::string now)
-inline size_t strnlen(const char *str, size_t maxlen)  {
-	register unsigned int i=0;
-	for (;i<maxlen && str[i];i++) {}
-	return i;
-}
-#endif
-
-
-
-
 void d_printf(char *fmt, ...);


Rename h_exec_query_sqlite to h_execute_query_sqlite, add h_exec_query_sqlite

--- include/hoel.h
+++ include/hoel.h
@@ -525,6 +525,16 @@

 /**
  * h_exec_query_sqlite
+ * legacy function name, didn't realize the typo until now...
+ * redirect to h_execute_query_sqlite
+ * @param conn the connection to the database
+ * @param query the SQL query to execute
+ * @return H_OK on success
+ */
+int h_exec_query_sqlite(const struct _h_connection * conn, const char * query);
+
+/**
+ * h_execute_query_sqlite
  * Execute a query on a sqlite connection
  * This is an internal function, you should use h_exec_query instead
  * Should not be executed by the user because all parameters are supposed to be correct
@@ -533,7 +543,7 @@
  * @param query the SQL query to execute
  * @return H_OK on success
  */
-int h_exec_query_sqlite(const struct _h_connection * conn, const char * query);
+int h_execute_query_sqlite(const struct _h_connection * conn, const char * query);

 /**
  * h_execute_query_json_sqlite


init: add SYS_GET_DEVICE() macro to bury &__initconfig_* names usage.

Add a macro to retrieve the device structure for a config structure by
name.  This avoids the very error prone activity of the developer
having to *know* the way the internal object is named.

Change-Id: I1d7857d5aad6dfd4b1b46f63b946aad1ae3a6dc4
Signed-off-by: Dirk Brandewie <90b1bc8a6ba9849b6d077cb338e79c4550ccbc5f@intel.com>

--- include/init.h
+++ include/init.h
@@ -83,6 +83,24 @@
 		 .config = &(config_##name),\
 		 .driver_data = data}

+/**
+ * @def SYS_GET_DEVICE
+ *
+ * @brief Obtain a pointer to a device object by name
+ *
+ * @details Return the address of a device object created by
+ * SYS_DEFINE_DEVICE(), using the @name provided to SYS_DEFINE_DEVICE().
+ *
+ * @param name The same name provided to SYS_DEFINE_DEVICE()
+ *
+ * @return A pointer to the device object created by SYS_DEFINE_DEVICE()
+ */
+
+#define _PASTE2(a, b) a##b
+#define _PASTE(a, b) _PASTE2(a, b)
+
+#define SYS_GET_DEVICE(name) (&(_PASTE(__initconfig_, name)))
+
 /* The following legacy APIs are provided for backwards compatibility */

 #define pre_kernel_core_init(cfg, data)	\


use version if from generated file

use version if from generated file

--- include/mega.h
+++ include/mega.h
@@ -25,10 +25,6 @@
 #ifndef MEGA_SDK
 #define MEGA_SDK
 #endif
-
-#define MEGA_MAJOR_VERSION 1
-#define MEGA_MINOR_VERSION 1
-#define MEGA_MICRO_VERSION 0

 // project types
 #include "mega/types.h"


tcpmv2: Add AutoDischarge for CT connections

Added AutoDischarge to CT.SNK connections.

BUG=none
BRANCH=none
TEST=Verify USBC is still working

Signed-off-by: Denis Brockus <6b21e8190fb5e373363fb95271367073a16474ef@google.com>
Change-Id: Ida3ce6b13d8e922034087b5d07db04191efc7127
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2194264
Commit-Queue: Denis Brockus <6b21e8190fb5e373363fb95271367073a16474ef@chromium.org>
Commit-Queue: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>
Tested-by: Denis Brockus <6b21e8190fb5e373363fb95271367073a16474ef@chromium.org>
Reviewed-by: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>
Auto-Submit: Denis Brockus <6b21e8190fb5e373363fb95271367073a16474ef@chromium.org>

--- common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -3184,6 +3184,9 @@

 	/* The port shall reject a VCONN swap request. */
 	TC_SET_FLAG(port, TC_FLAGS_REJECT_VCONN_SWAP);
+
+	/* Enable AutoDischargeDisconnect */
+	tcpm_enable_auto_discharge_disconnect(port, 1);
 }

 static void tc_ct_attached_snk_run(int port)


npu2: Remove unused npu2_dev struct members

There's a few members of struct npu2_dev that are completely unused. Remove
them.

Cc: Alistair Popple <e9adbcf81c8a36ccc628e09bc92d0e25e1c8e501@popple.id.au>
Cc: Reza Arbab <4c896a97e6b998365c2d50a267b0f1ca5f7995de@linux.vnet.ibm.com>
Cc: Frederic Barrat <c90240987c583ac0802fbeb88cb1684edc683e18@linux.vnet.ibm.com>
Signed-off-by: Andrew Donnellan <efc2d7c347a094a6ec1d918179e819039044c564@au1.ibm.com>
Acked-by: Reza Arbab <4c896a97e6b998365c2d50a267b0f1ca5f7995de@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com>

--- include/npu2.h
+++ include/npu2.h
@@ -78,10 +78,7 @@
 struct npu2;
 struct npu2_dev {
 	uint32_t		index;
-	uint32_t                flags;
-	uint64_t                xscom;
 	uint64_t		pl_xscom_base;
-	void			*regs;
 	struct dt_node		*dt_node;
 	struct npu2_pcie_bar	bars[2];
 	struct npu2		*npu;


updated header files for the i2c firmware, fixed bug in controller addressing

--- includes/I2C.h
+++ includes/I2C.h
@@ -6,7 +6,8 @@
 #define ARMC_KERNEL_I2C_H

 #define BSC0  0x3F205000UL          /*( 0x3F000000UL + 0x205000 ) The address to the BSC register set 1 */
-#define BSC2  0x3F805000UL          /* ( 0x3F000000UL + 0x805000 ) The address to the BSC register set 2 */
+#define BSC1  0x3F804000UL          /* ( 0x3F000000UL + 0x804000 ) The address to the BSC register set 2 */
+#define BSC2  0x3F805000UL

 /*Broadcom Serial Controller Structure, these
@@ -14,7 +15,7 @@
  * I2C on the Raspberry PI2
  */

-struct bsc_i2c_t{
+typedef struct {
     volatile int control; /* used to enable interrupts, clear the FIFO, define a R/W operation */
     volatile int  status;  /* status register is used to record activity status, errors and interrupt requests*/
     volatile int  dlen;    /*defines the number of bytes of data to transmit or receive I2C transfer */
@@ -23,7 +24,7 @@
     volatile int  clk_div; /*Used to specify the clock speed */
     volatile int  dat_delay; /*Fine controll over sampling and launching of data*/
     volatile int  clkt; /*Clock stretch time out */
-};
+}bsc_i2c_t;

 /* Control register attributes locations*/
@@ -53,4 +54,42 @@
 #define DONE      (1) /*Transfer Complete - 1, not complete - 0, cleared by writing 1*/
 #define TA        (0) /*Transfer Active  - 1, not active = 0*/

+
+
+/*DLEN data length allocation*/
+/* 15:0 is the DATA length of the packet*/
+#define DLEN_SHFT (16) /*DLEN BIT SHIFT*/
+#define DLEN_MSK  (0xFFFF << DLEN_SHFT)
+
+
+
+/*A Register is the Slave Address and cycle type*/
+
+#define SLV_SHFT (6)
+#define SLV_MSK  (0x3F << SLV_SHFT)
+
+
+/*Clock Divider bits*/
+
+#define CDIV_SHFT (16)
+#define CDIV_MSK (0xFFFF << CDIV_SHFT)
+
+
+/*DEL Register */
+
+#define FEDL_SHFT (32) /*Falling Edge Delay*/
+#define REDL_SHFT (16) /*Rising Edge Delay*/
+
+
+#define FEDL_MSK (0xFFFF << FEDL_SHFT)
+#define REDL_MSK (0xFFFF << REDL_SHFT)
+
+/*Clock stretch timeout*/
+#define TOUT_SHFT (16)
+#define TOUT_MSK (0xFFFF << TOUT_SHFT)
+
+
+
+
+
 #endif //ARMC_KERNEL_I2C_H


Use form answers from gconf

Use form answers from gconf

Signed-off-by: David Woodhouse <b460d66aaf00c296a3db1c1d9eeafc081d5f7d70@intel.com>

--- nm-auth-dialog.c
+++ nm-auth-dialog.c
@@ -447,6 +447,15 @@
 	return 0;
 }

+char *find_form_answer(struct oc_auth_form *form, struct oc_form_opt *opt)
+{
+	char *key, *result;
+	key = g_strdup_printf("%s/vpn/form:%s:%s", config_path,
+			      form->auth_id, opt->name);
+	result = gconf_client_get_string(gcl, key, NULL);
+	g_free(key);
+	return result;
+}

 /* This part for processing forms from openconnect directly, rather than
    through the SSL UI abstraction (which doesn't allow 'select' options) */
@@ -479,12 +488,15 @@
 			g_mutex_lock (ui_data->form_mutex);
 			g_queue_push_head(ui_data->form_entries, data);
 			g_mutex_unlock (ui_data->form_mutex);
+			if (opt->type != OC_FORM_OPT_PASSWORD)
+				data->entry_text = find_form_answer(form, opt);

 			ui_write_prompt(data);
 		} else if (opt->type == OC_FORM_OPT_SELECT) {
 			g_mutex_lock (ui_data->form_mutex);
 			g_queue_push_head(ui_data->form_entries, data);
 			g_mutex_unlock (ui_data->form_mutex);
+			data->entry_text = find_form_answer(form, opt);

 			ui_add_select(data);
 		} else


usage for scan

usage for scan

git-svn-id: 793bb72743a407948e3701719c462b6a765bc435@1149 35dc7657-300d-0410-a2e5-dc2837fedb53

--- doc/examples/scan.c
+++ doc/examples/scan.c
@@ -17,6 +17,12 @@
 {
 	mpg123_handle *m;
 	int i;
+	if(argc < 2)
+	{
+		fprintf(stderr, "I will give you the estimated and exact sample lengths of MPEG audio files.\n");
+		fprintf(stderr, "\nUsage: %s <mpeg audio file list>\n", argv[0]);
+		return -1;
+	}
 	mpg123_init();
 	m = mpg123_new(NULL, NULL);
 	for(i = 1; i < argc; ++i)


qemu: cap: Refactor access to array in virQEMUCapsProbeQMPMachineTypes

Use a temporary pointer rather than always recalculating the index in a
very verbose way.

--- src/qemu/qemu_capabilities.c
+++ src/qemu/qemu_capabilities.c
@@ -2486,18 +2486,20 @@
         goto cleanup;

     for (i = 0; i < nmachines; i++) {
+        struct virQEMUCapsMachineType *mach;
         if (STREQ(machines[i]->name, "none"))
             continue;
-        qemuCaps->nmachineTypes++;
-        if (VIR_STRDUP(qemuCaps->machineTypes[qemuCaps->nmachineTypes -1].alias,
-                       machines[i]->alias) < 0 ||
-            VIR_STRDUP(qemuCaps->machineTypes[qemuCaps->nmachineTypes - 1].name,
-                       machines[i]->name) < 0)
+
+        mach = &(qemuCaps->machineTypes[qemuCaps->nmachineTypes++]);
+
+        if (VIR_STRDUP(mach->alias, machines[i]->alias) < 0 ||
+            VIR_STRDUP(mach->name, machines[i]->name) < 0)
             goto cleanup;
+
+        mach->maxCpus = machines[i]->maxCpus;
+
         if (machines[i]->isDefault)
             defIdx = qemuCaps->nmachineTypes - 1;
-        qemuCaps->machineTypes[qemuCaps->nmachineTypes - 1].maxCpus =
-            machines[i]->maxCpus;
     }

     if (defIdx)


Reverting back using standart solution for crc32 proposed by Madler

Using various CRC32 calculation techniques and algorithms didn't allow
 to achieve required compression ratio(to be investigated after).

--- builtins/zlib/deflate_cf.c
+++ builtins/zlib/deflate_cf.c
@@ -1131,16 +1131,18 @@
 	return ~crc; // same as crc ^ 0xFFFFFFFF
 }

+// Solution to be used on Mac OS X (it gives better preciseness of data compression
+// as in case of zlib-cf)
+/*
 static uint32_t hash_func_default(deflate_state *s, uint32_t UNUSED(h), void* str) {
 	return crc32_8bytes(str, 32, 0) & s->hash_mask;
 }
+*/

 // CRC32 calculation from zlib 1.2.8 - Madler
-/*
 static uint32_t hash_func_default(deflate_state *s, uint32_t h, void* str) {
     return ((h << s->hash_shift) ^ (*(uint32_t*)str)) & s->hash_mask;
 }
-*/

 #if defined (__aarch64__)


qemu: monitor: Convert common code to a macro

The function that is extracting block stats data from the QMP monitor
reply contains a lot of repeated code. Since I'd be changing each of the
copies in the next patch, lets convert it to a macro right away.

--- src/qemu/qemu_monitor_json.c
+++ src/qemu/qemu_monitor_json.c
@@ -1789,66 +1789,23 @@
         goto cleanup;
     }

-    if (virJSONValueObjectGetNumberLong(stats, "rd_bytes",
-                                        &bstats->rd_bytes) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "rd_bytes");
-        goto cleanup;
-    }
-    if (virJSONValueObjectGetNumberLong(stats, "rd_operations",
-                                        &bstats->rd_req) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "rd_operations");
-        goto cleanup;
-    }
-    if (virJSONValueObjectHasKey(stats, "rd_total_time_ns") &&
-        (virJSONValueObjectGetNumberLong(stats, "rd_total_time_ns",
-                                         &bstats->rd_total_times) < 0)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "rd_total_time_ns");
-        goto cleanup;
-    }
-    if (virJSONValueObjectGetNumberLong(stats, "wr_bytes",
-                                        &bstats->wr_bytes) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "wr_bytes");
-        goto cleanup;
-    }
-    if (virJSONValueObjectGetNumberLong(stats, "wr_operations",
-                                        &bstats->wr_req) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "wr_operations");
-        goto cleanup;
-    }
-    if (virJSONValueObjectHasKey(stats, "wr_total_time_ns") &&
-        (virJSONValueObjectGetNumberLong(stats, "wr_total_time_ns",
-                                         &bstats->wr_total_times) < 0)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "wr_total_time_ns");
-        goto cleanup;
-    }
-    if (virJSONValueObjectHasKey(stats, "flush_operations") &&
-        (virJSONValueObjectGetNumberLong(stats, "flush_operations",
-                                         &bstats->flush_req) < 0)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "flush_operations");
-        goto cleanup;
-    }
-    if (virJSONValueObjectHasKey(stats, "flush_total_time_ns") &&
-        (virJSONValueObjectGetNumberLong(stats, "flush_total_time_ns",
-                                         &bstats->flush_total_times) < 0)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("cannot read %s statistic"),
-                       "flush_total_time_ns");
-        goto cleanup;
-    }
+#define QEMU_MONITOR_BLOCK_STAT_GET(NAME, VAR, MANDATORY)                      \
+    if (MANDATORY || virJSONValueObjectHasKey(stats, NAME)) {                  \
+        if (virJSONValueObjectGetNumberLong(stats, NAME, &VAR) < 0) {          \
+            virReportError(VIR_ERR_INTERNAL_ERROR,                             \
+                           _("cannot read %s statistic"), NAME);               \
+            goto cleanup;                                                      \
+        }                                                                      \
+    }
+     QEMU_MONITOR_BLOCK_STAT_GET("rd_bytes", bstats->rd_bytes, true);
+     QEMU_MONITOR_BLOCK_STAT_GET("wr_bytes", bstats->wr_bytes, true);
+     QEMU_MONITOR_BLOCK_STAT_GET("rd_operations", bstats->rd_req, true);
+     QEMU_MONITOR_BLOCK_STAT_GET("wr_operations", bstats->wr_req, true);
+     QEMU_MONITOR_BLOCK_STAT_GET("rd_total_time_ns", bstats->rd_total_times, false);
+     QEMU_MONITOR_BLOCK_STAT_GET("wr_total_time_ns", bstats->wr_total_times, false);
+     QEMU_MONITOR_BLOCK_STAT_GET("flush_operations", bstats->flush_req, false);
+     QEMU_MONITOR_BLOCK_STAT_GET("flush_total_time_ns", bstats->flush_total_times, false);
+#undef QEMU_MONITOR_BLOCK_STAT_GET

     /* it's ok to not have this information here. Just skip silently. */
     qemuMonitorJSONDevGetBlockExtent(dev, &bstats->wr_highest_offset);


dnsqr: addrs_to_bpf(): null-terminate return string

--- nmsg/isc/dnsqr.c
+++ nmsg/isc/dnsqr.c
@@ -763,6 +763,7 @@
 	} while ((addr = strtok_r(NULL, ",", &saveptr)) != NULL);

 	free(tok_addrs);
+	ubuf_cterm(bpf);
 	ubuf_detach(bpf, (uint8_t **) &ret, &retsz);
 	ubuf_destroy(&bpf);
 	return (ret);


qemu: fix hotplug of udp device with no connect host

Use an empty string to let qemu fill out the default.
This matches what's done in qemuBuildChrChardevStr.

https://bugzilla.redhat.com/show_bug.cgi?id=1454671

Signed-off-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>
Reviewed-by: John Ferlan <87558058f6f829e5ec976c8ef960720af4ff9c7d@redhat.com>

--- src/qemu/qemu_monitor_json.c
+++ src/qemu/qemu_monitor_json.c
@@ -6522,7 +6522,10 @@

     case VIR_DOMAIN_CHR_TYPE_UDP:
         backend_type = "udp";
-        addr = qemuMonitorJSONBuildInetSocketAddress(chr->data.udp.connectHost,
+        host = chr->data.udp.connectHost;
+        if (!host)
+            host = "";
+        addr = qemuMonitorJSONBuildInetSocketAddress(host,
                                                      chr->data.udp.connectService);
         if (!addr ||
             virJSONValueObjectAppend(data, "remote", addr) < 0)


add flag to ignore local publications

add flag to ignore local publications

--- rcl/include/rcl/rcl.h
+++ rcl/include/rcl/rcl.h
@@ -57,7 +57,8 @@
   const rcl_node_t * node,
   const rosidl_message_type_support_t * type_support,
   const char * topic_name,
-  size_t queue_size);
+  size_t queue_size,
+  bool ignore_local_publications);

 /// Destroys a rcl_subscription_t.
 rcl_ret_t


[v2] qemu: Retry JSON monitor cont cmd on MigrationExpected error

When restoring a saved qemu instance via JSON monitor, the vm is
left in a paused state.  Turns out the 'cont' cmd was failing with
"MigrationExpected" error class and "An incoming migration is
expected before this command can be executed" error description
due to migration (restore) not yet complete.

Detect if 'cont' cmd fails with "MigrationExpecte" error class and
retry 'cont' cmd.

V2: Fix potential double-free noted by Laine Stump
(cherry picked from commit 4301b95af7f554700de8e69ecf3f3bb3148b1d44)

Signed-off-by: Steve Hodgson <eb20a6615749cf04ff61aa37e18f749ed6d01446@solarflare.com>

--- src/qemu/qemu_monitor_json.c
+++ src/qemu/qemu_monitor_json.c
@@ -741,13 +741,29 @@
     int ret;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("cont", NULL);
     virJSONValuePtr reply = NULL;
-    if (!cmd)
-        return -1;
-
-    ret = qemuMonitorJSONCommand(mon, cmd, &reply);
-
-    if (ret == 0)
-        ret = qemuMonitorJSONCheckError(cmd, reply);
+    int i = 0, timeout = 3;
+    if (!cmd)
+        return -1;
+
+    do {
+        ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+
+        if (ret != 0)
+            break;
+
+        /* If no error, we're done */
+        if ((ret = qemuMonitorJSONCheckError(cmd, reply)) == 0)
+            break;
+
+        /* If error class is not MigrationExpected, we're done.
+         * Otherwise try 'cont' cmd again */
+        if (!qemuMonitorJSONHasError(reply, "MigrationExpected"))
+            break;
+
+        virJSONValueFree(reply);
+        reply = NULL;
+        usleep(250000);
+    } while (++i <= timeout);

     virJSONValueFree(cmd);
     virJSONValueFree(reply);


fix bug in deleting method

fix bug in deleting method

当被删除二叉排序树的节点有左右子树时，中序遍历得到右子树的最小节点minp，将其替代被删除节点。但是在free节点minp前应考虑该节点可能存在右子树，应使其父节点minpp左指针指向minp的右子树。

--- c-cpp/24_tree/binarysearchtree.c
+++ c-cpp/24_tree/binarysearchtree.c
@@ -88,8 +88,8 @@
             minP = minP->lchild;
         }
         p->data = minP->data;
+        minpp->lchild = minpp->rchild;
         free(minP);
-        minPP->lchild = NULL;

         return TRUE;
     }


getters for requestSerializer and responseSerializer in COOLAPIClient protocol

--- COOLKit/COOLNetworkStack/Protocols/COOLAPIClient.h
+++ COOLKit/COOLNetworkStack/Protocols/COOLAPIClient.h
@@ -22,4 +22,7 @@
                                       success:(COOLAPIClientSuccessBlock)success
                                       failure:(COOLAPIClientFailureBlock)failure;

+- (id<COOLAPIRequestSerialization>)requestSerializer;
+- (id<COOLAPIResponseSerialization>)responseSerializer;
+
 @end


Added some NV20 support - nv_30_tris.c should probably be renamed again.

--- src/mesa/drivers/dri/nouveau/nv30_tris.c
+++ src/mesa/drivers/dri/nouveau/nv30_tris.c
@@ -673,18 +673,38 @@
 	/*
 	 * Tell the hardware about the vertex format
 	 */
-	BEGIN_RING_SIZE(channel,0x1740,slots);
-	for(i=0;i<slots;i++)
+	switch(nmesa->screen->card_type)
 	{
-		int size=attr_size[i];
-		OUT_RING(0x00000002|(size*0x10));
-	}
-	BEGIN_RING_SIZE(channel,0x1718,1);
-	OUT_RING(0);
-	BEGIN_RING_SIZE(channel,0x1718,1);
-	OUT_RING(0);
-	BEGIN_RING_SIZE(channel,0x1718,1);
-	OUT_RING(0);
+		case NV_20:
+			{
+				for(i=0;i<16;i++)
+				{
+					int size=attr_size[i];
+					BEGIN_RING_SIZE(channel,0x1760+i*4,1);
+					OUT_RING(0x00000002|(size*0x10));
+				}
+			}
+			break;
+		case NV_30:
+		case NV_40:
+		case G_70:
+			{
+				BEGIN_RING_SIZE(channel,0x1740,slots);
+				for(i=0;i<slots;i++)
+				{
+					int size=attr_size[i];
+					OUT_RING(0x00000002|(size*0x10));
+				}
+				BEGIN_RING_SIZE(channel,0x1718,1);
+				OUT_RING(0);
+				BEGIN_RING_SIZE(channel,0x1718,1);
+				OUT_RING(0);
+				BEGIN_RING_SIZE(channel,0x1718,1);
+				OUT_RING(0);
+			}
+			break;
+
+	}
 }


radeon: drop assert accessing cref which is meant to be hidden

--- src/mesa/drivers/dri/radeon/radeon_dma.c
+++ src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -205,7 +205,6 @@
 		   counter on unused buffers for later freeing them from
 		   begin of list */
 		dma_bo = last_elem(&rmesa->dma.free);
-		assert(dma_bo->bo->cref == 1);
 		remove_from_list(dma_bo);
 		insert_at_head(&rmesa->dma.reserved, dma_bo);
 	}


st/mesa: ask pipe driver to recreate derived internal resources when (re-)binding external textures

Use the resource_changed callback to invalidate internal resources
derived from external textures when they are (re-)bound. This is needed
to comply with the requirement from the GL_OES_EGL_image_external
extension that a call to glBindTexture guarantees that all further
sampling will return values that correspond to the values in the
external texture at or after the time that glBindTexture was called.

Signed-off-by: Philipp Zabel <db7328bbf81a38b011e8d0f5302fd54c788d0608@pengutronix.de>
Reviewed-by: Marek Olšák <8c7344a1abdb103e79ecfd488098373070c3c70e@amd.com>
Signed-off-by: Lucas Stach <48c9e973d8f86eb0cdae200124c5925db7587c4e@pengutronix.de>

--- src/mesa/state_tracker/st_atom_texture.c
+++ src/mesa/state_tracker/st_atom_texture.c
@@ -90,6 +90,10 @@
       stObj->prev_glsl_version = glsl_version;
       stObj->prev_sRGBDecode = samp->sRGBDecode;
    }
+
+   if (texObj->TargetIndex == TEXTURE_EXTERNAL_INDEX &&
+       stObj->pt->screen->resource_changed)
+         stObj->pt->screen->resource_changed(stObj->pt->screen, stObj->pt);

    *sampler_view =
       st_get_texture_sampler_view_from_stobj(st, stObj, samp, glsl_version);


Avoid a LOR (sleepable after non-sleepable) in
fasttrap_tracepoint_enable().

Sponsored by:	The FreeBSD Foundation

--- sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
+++ sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
@@ -591,7 +591,9 @@
 	 * Before we make any modifications, make sure we've imposed a barrier
 	 * on the generation in which this probe was last modified.
 	 */
+	PROC_UNLOCK(p);
 	fasttrap_mod_barrier(probe->ftp_gen);
+	PROC_LOCK(p);

 	bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];


Automated merge with ssh://eaburns.mooo.com/mid

--- cmd/mid/game.h
+++ cmd/mid/game.h
@@ -1,7 +1,7 @@
 enum { Scrnw = 512, Scrnh = 512 };

 /* Buffer from side of screen at which to begin scrolling. */
-enum { Scrlbuf = 100 };
+enum { Scrlbuf = 192 };

 enum Action{
 	Mvleft,


CallWindow: make the rectangles have rounded corners

https://bugzilla.gnome.org/show_bug.cgi?id=656576

--- src/empathy-call-window.c
+++ src/empathy-call-window.c
@@ -65,6 +65,7 @@
 #include "empathy-mic-menu.h"
 #include "empathy-preferences.h"
 #include "empathy-rounded-actor.h"
+#include "empathy-rounded-rectangle.h"
 #include "empathy-rounded-texture.h"
 #include "empathy-camera-menu.h"

@@ -635,11 +636,9 @@

   *box = box1;

-  rectangle = clutter_rectangle_new_with_color (
-      CLUTTER_COLOR_Transparent);
-
-  clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle),
-      1);
+  rectangle = empathy_rounded_rectangle_new (
+      SELF_VIDEO_SECTION_WIDTH + 5,
+      SELF_VIDEO_SECTION_HEIGHT + 5);

   clutter_actor_set_size (box1,
       SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN,
@@ -657,9 +656,6 @@
   clutter_actor_set_size (box2,
       SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN,
       SELF_VIDEO_SECTION_HEIGHT + 2 * SELF_VIDEO_SECTION_MARGIN);
-
-  clutter_actor_set_size (rectangle,
-      SELF_VIDEO_SECTION_WIDTH + 5, SELF_VIDEO_SECTION_HEIGHT + 5);

   clutter_container_add_actor (CLUTTER_CONTAINER (box1), box2);
   clutter_container_add_actor (CLUTTER_CONTAINER (box2), rectangle);
@@ -824,18 +820,20 @@

   rectangle = empathy_call_window_get_preview_rectangle (self, pos);

-  clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 3);
-  clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle),
-      CLUTTER_COLOR_Red);
+  empathy_rounded_rectangle_set_border_width (
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), 5);
+  empathy_rounded_rectangle_set_border_color (
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), CLUTTER_COLOR_Red);
 }

 static void
 empathy_call_window_darken_preview_rectangle (EmpathyCallWindow *self,
     ClutterActor *rectangle)
 {
-  clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 1);
-  clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle),
-      CLUTTER_COLOR_Black);
+  empathy_rounded_rectangle_set_border_width (
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), 1);
+  empathy_rounded_rectangle_set_border_color (
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), CLUTTER_COLOR_Black);
 }

 static void


CallWindow: go to the Calls tab when opening the preferences

https://bugzilla.gnome.org/show_bug.cgi?id=655884

--- src/empathy-call-window.c
+++ src/empathy-call-window.c
@@ -734,7 +734,7 @@
 empathy_call_window_settings_cb (GtkAction *action,
     EmpathyCallWindow *self)
 {
-  empathy_launch_program (BIN_DIR, "empathy", "-p");
+  empathy_launch_program (BIN_DIR, "empathy", "-p 3");
 }

 static void


chat-window: update the contact menu when folks is loaded

--- src/empathy-chat-window.c
+++ src/empathy-chat-window.c
@@ -1914,6 +1914,13 @@
   return FALSE;
 }

+static void
+contacts_loaded_cb (EmpathyIndividualManager *mgr,
+    EmpathyChatWindow *self)
+{
+  chat_window_contact_menu_update (self);
+}
+
 static gboolean
 chat_window_focus_out_event_cb (GtkWidget *widget,
     GdkEvent *event,
@@ -1938,6 +1945,15 @@
    *   with the ID we received from the DnD in order to invite him.
    */
   self->priv->individual_mgr = empathy_individual_manager_dup_singleton ();
+
+  if (!empathy_individual_manager_get_contacts_loaded (
+      self->priv->individual_mgr))
+    {
+      /* We want to update the contact menu when Folks is loaded so we can
+       * list all the personas of the contact. */
+      tp_g_signal_connect_object (self->priv->individual_mgr, "contacts-loaded",
+          G_CALLBACK (contacts_loaded_cb), self, 0);
+    }

   return FALSE;
 }


Add missing forward of sliced() method to Buffer.h

Former-commit-id: 88114dbe458988959f3ee2bcee894feb011b3f3b

--- src/Buffer.h
+++ src/Buffer.h
@@ -331,6 +331,7 @@
     HALIDE_BUFFER_FORWARD_CONST(contains)
     HALIDE_BUFFER_FORWARD(crop)
     HALIDE_BUFFER_FORWARD(slice)
+    HALIDE_BUFFER_FORWARD_CONST(sliced)
     HALIDE_BUFFER_FORWARD(embed)
     HALIDE_BUFFER_FORWARD(set_min)
     HALIDE_BUFFER_FORWARD(translate)


Update balance view in roster per feedback

--- src/empathy-main-window.c
+++ src/empathy-main-window.c
@@ -820,6 +820,7 @@
 				    GValueArray *balance)
 {
 	TpAccount *account = g_object_get_data (G_OBJECT (action), "account");
+	GtkWidget *label;
 	int amount = 0;
 	guint scale = G_MAXINT32;
 	const char *currency = "";
@@ -852,8 +853,11 @@
 	gtk_action_set_label (action, str);
 	g_free (str);

-	/* pass ownership of @money to object data */
-	g_object_set_data_full (G_OBJECT (action), "money", money, g_free);
+	/* update the money label in the roster */
+	label = g_object_get_data (G_OBJECT (action), "money-label");
+
+	gtk_label_set_text (GTK_LABEL (label), money);
+	g_free (money);
 }

 static void
@@ -964,34 +968,41 @@
 					 GtkAction         *action)
 {
 	EmpathyMainWindowPriv *priv = GET_PRIV (window);
+	TpAccount *account;
 	GtkWidget *hbox, *image, *label, *button;

+	account = g_object_get_data (G_OBJECT (action), "account");
+	g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
+
 	hbox = gtk_hbox_new (FALSE, 6);

+	/* protocol icon */
 	image = gtk_image_new ();
 	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
-	gtk_widget_show (image);
-
+	g_object_bind_property (action, "icon-name", image, "icon-name",
+		G_BINDING_SYNC_CREATE);
+
+	/* account name label */
 	label = gtk_label_new ("");
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 	gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
-	gtk_widget_show (label);
-
+	g_object_bind_property (account, "display-name", label, "label",
+		G_BINDING_SYNC_CREATE);
+
+	/* balance label */
+	label = gtk_label_new ("");
+	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+	g_object_set_data (G_OBJECT (action), "money-label", label);
+
+	/* top up button */
 	button = gtk_button_new_with_label (_("Top Up..."));
 	gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
-	gtk_widget_show (button);
+	g_signal_connect_swapped (button, "clicked",
+		G_CALLBACK (gtk_action_activate), action);

 	gtk_box_pack_start (GTK_BOX (priv->balance_vbox), hbox, FALSE, TRUE, 0);
 	gtk_widget_show_all (hbox);
-
-	/* bind the properties from the action to the widgets -- I could have
-	 * written a widget that implemented GtkActivatable, but effort */
-	g_object_bind_property (action, "label", label, "label",
-		G_BINDING_SYNC_CREATE);
-	g_object_bind_property (action, "icon-name", image, "icon-name",
-		G_BINDING_SYNC_CREATE);
-	g_signal_connect_swapped (button, "clicked",
-		G_CALLBACK (gtk_action_activate), action);

 	/* tie the lifetime of the widget to the lifetime of the action */
 	g_object_weak_ref (G_OBJECT (action),


Mode::gb disabled

Mode::gb disabled

--- src/Common.h
+++ src/Common.h
@@ -153,7 +153,9 @@
   } else if (str == "snes_mode7") {
     return Mode::snes_mode7;
   } else if (str == "gb") {
-    return Mode::gb;
+    //TODO:
+    //return Mode::gb;
+    return Mode::gbc;
   } else if (str == "gbc") {
     return Mode::gbc;
   }
@@ -167,7 +169,8 @@
   case Mode::snes_mode7:
     return std::string("snes_mode7");
   case Mode::gb:
-    return std::string("gb");
+    //TODO:
+    //return std::string("gb");
   case Mode::gbc:
     return std::string("gbc");
   default:


optimize the ARGB->ARGB Import to use memcpy

(instead of the generic VP8PackARGB call)

Change-Id: I86edeb5934e7c062593f0248de7607cca5f1027c

--- src/enc/picture_csp_enc.c
+++ src/enc/picture_csp_enc.c
@@ -1105,9 +1105,14 @@

   if (import_alpha) {
     uint32_t* dst = picture->argb;
+    const int do_copy = !swap_rb && !ALPHA_IS_LAST;
     assert(step == 4);
     for (y = 0; y < height; ++y) {
-      VP8PackARGB(a_ptr, r_ptr, g_ptr, b_ptr, width, dst);
+      if (do_copy) {
+        memcpy(dst, r_ptr, width * sizeof(*dst));
+      } else {
+        VP8PackARGB(a_ptr, r_ptr, g_ptr, b_ptr, width, dst);
+      }
       a_ptr += rgb_stride;
       r_ptr += rgb_stride;
       g_ptr += rgb_stride;


Test and fix /keyx segfault

Test and fix /keyx segfault

--- src/DH1080.c
+++ src/DH1080.c
@@ -43,7 +43,7 @@
     g_dh = DH_new();
     if(g_dh) {
         int codes = 0;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
         g_dh->p = BN_bin2bn(prime1080, DH1080_PRIME_BYTES, NULL);
         g_dh->g = BN_new(); BN_set_word(g_dh->g, 2);
         return DH_check(g_dh, &codes) && codes == 0;
@@ -84,7 +84,7 @@

     DH_generate_key(dh);

-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     memset(w, 0, sizeof w);
     n = BN_bn2bin(dh->priv_key, w);
     htob64((char *)w, priv_key, n);
@@ -93,15 +93,15 @@
     n = BN_bn2bin(dh->pub_key, w);
     htob64((char *)w, pub_key, n);
 #else
-    const BIGNUM **pubkey, **privkey;
-    DH_get0_key(dh, pubkey, privkey);
+    const BIGNUM *pubkey, *privkey;
+    DH_get0_key(dh, &pubkey, &privkey);

     memset(w, 0, sizeof w);
-    n = BN_bn2bin(*privkey, w);
+    n = BN_bn2bin(privkey, w);
     htob64((char *)w, priv_key, n);

     memset(w, 0, sizeof w);
-    n = BN_bn2bin(*pubkey, w);
+    n = BN_bn2bin(pubkey, w);
     htob64((char *)w, pub_key, n);
 #endif

@@ -141,11 +141,12 @@

         len = b64toh(MyPrivKey, (char *)base64_tmp);

-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
         dh->priv_key = BN_bin2bn(base64_tmp, len, NULL);
 #else
+        BIGNUM *temp_pub_key = BN_new();
         BIGNUM *priv_key = BN_bin2bn(base64_tmp, len, NULL);
-        DH_set0_key(dh, NULL, priv_key);
+        DH_set0_key(dh, temp_pub_key, priv_key);
 #endif
         memset(MyPrivKey, 0x20, strlen(MyPrivKey));


Reduced subgraph memory -> we don't need kmermask is >1 colour

--- src/tools/ctx_subgraph.c
+++ src/tools/ctx_subgraph.c
@@ -185,7 +185,7 @@
   //
   // Decide on memory
   //
-  const size_t use_ncols = args->use_ncols;
+  const size_t use_ncols = MIN2(args->use_ncols, total_cols);
   size_t bits_per_kmer, kmers_in_hash, graph_mem;
   size_t num_of_fringe_nodes, fringe_mem;
   char graph_mem_str[100], num_fringe_nodes_str[100], fringe_mem_str[100];
@@ -213,12 +213,13 @@
   if(!futil_is_file_writable(out_path))
     die("Cannot write to output file: %s", out_path);

-  // Create db_graph with one colour
+  // Create db_graph
+  // multiple colours may be useful later in pulling out multiple colours
   db_graph_alloc(&db_graph, files[0].hdr.kmer_size, use_ncols, use_ncols, kmers_in_hash);
   db_graph.col_edges = calloc2(db_graph.ht.capacity*use_ncols, sizeof(Edges));
   db_graph.col_covgs = calloc2(db_graph.ht.capacity*use_ncols, sizeof(Covg));

-  size_t num_words64 = roundup_bits2words64(db_graph.ht.capacity*use_ncols);
+  size_t num_words64 = roundup_bits2words64(db_graph.ht.capacity);
   kmer_mask = calloc2(num_words64, sizeof(uint64_t));

   SeqLoadingStats *stats = seq_loading_stats_create(0);


Tidy a little cvar-setting mostly-duplicate code; fix parameter count handling.

--- src/engine/qcommon/cvar.c
+++ src/engine/qcommon/cvar.c
@@ -983,20 +983,13 @@
 	free( value );
 }

-/*
-============
-Cvar_SetU_f
-
-As Cvar_Set, but also flags it as serverinfo
-============
-*/
-void Cvar_SetU_f( void )
+static void Cvar_Set_Flagged( int flag )
 {
 	cvar_t *v;

-	if ( Cmd_Argc() != 3 && Cmd_Argc() != 4 )
-	{
-		Com_Printf(_( "usage: setu <variable> <value> [unsafe]\n" ));
+	if ( Cmd_Argc() < 3 )
+	{
+		Com_Printf(_( "usage: %s <variable> <value> [unsafe]\n" ), Cmd_Argv( 0 ) );
 		return;
 	}

@@ -1008,7 +1001,19 @@
 		return;
 	}

-	v->flags |= CVAR_USERINFO;
+	v->flags |= flag;
+}
+
+/*
+============
+Cvar_SetU_f
+
+As Cvar_Set, but also flags it as userinfo
+============
+*/
+void Cvar_SetU_f( void )
+{
+	Cvar_Set_Flagged( CVAR_USERINFO );
 }

 /*
@@ -1020,23 +1025,7 @@
 */
 void Cvar_SetS_f( void )
 {
-	cvar_t *v;
-
-	if ( Cmd_Argc() != 3 && Cmd_Argc() != 4 )
-	{
-		Com_Printf(_( "usage: sets <variable> <value> [unsafe]\n" ));
-		return;
-	}
-
-	Cvar_Set_f();
-	v = Cvar_FindVar( Cmd_Argv( 1 ) );
-
-	if ( !v )
-	{
-		return;
-	}
-
-	v->flags |= CVAR_SERVERINFO;
+	Cvar_Set_Flagged( CVAR_SERVERINFO );
 }

 /*
@@ -1048,23 +1037,7 @@
 */
 void Cvar_SetA_f( void )
 {
-	cvar_t *v;
-
-	if ( Cmd_Argc() != 3 && Cmd_Argc() != 4 )
-	{
-		Com_Printf(_( "usage: seta <variable> <value> [unsafe]\n" ));
-		return;
-	}
-
-	Cvar_Set_f();
-	v = Cvar_FindVar( Cmd_Argv( 1 ) );
-
-	if ( !v )
-	{
-		return;
-	}
-
-	v->flags |= CVAR_ARCHIVE;
+	Cvar_Set_Flagged( CVAR_ARCHIVE );
 }

 /*


add a cache level to synthetic topologies

git-svn-id: 14be032f8f42541b1a281b51ae8ea69814daf20e@201 4b44e086-7f34-40ce-a3bd-00e031736276

--- src/topology-synthetic.c
+++ src/topology-synthetic.c
@@ -48,8 +48,10 @@
 	   : (*(level_breadth + 3) == 0
 	     ? TOPO_OBJ_DIE
 	     : (*(level_breadth + 4) == 0
-	       ? TOPO_OBJ_NODE
-	       : TOPO_OBJ_FAKE))));
+	       ? TOPO_OBJ_CACHE
+	       : (*(level_breadth + 5) == 0
+	         ? TOPO_OBJ_NODE
+	         : TOPO_OBJ_FAKE)))));
 }

 /* Allocate COUNT nodes of type TYPE as children of LEVEL, with numbers
@@ -75,6 +77,7 @@
     switch(type) {
     case TOPO_OBJ_PROC:
     case TOPO_OBJ_CORE:
+    case TOPO_OBJ_CACHE:
     case TOPO_OBJ_DIE:
     case TOPO_OBJ_NODE:
       physical_index = first_number + i;
@@ -190,7 +193,7 @@
 topo_synthetic_load (struct topo_topology *topology)
 {
   struct topo_obj *root;
-  unsigned node_level;
+  int node_level, cache_level;

   topo__synthetic_allocate_topology_levels(topology, topology->synthetic_description);

@@ -215,6 +218,16 @@
     topology->nb_nodes = 1;
   }

+  cache_level = topology->type_depth[TOPO_OBJ_CACHE];
+  if (cache_level != -1) {
+    int i;
+
+    for(i=0 ; i<topology->level_nbitems[cache_level] ; i++) {
+      topology->levels[cache_level][i].memory_kB = 4*1024;
+      topology->levels[cache_level][i].cache_depth = 2;
+    }
+  }
+
   topo_debug("synthetic topology: %u levels, %u processors, %u nodes\n",
 	     topology->nb_levels, topology->nb_processors, topology->nb_nodes);
 }