Fix bugs in locating header from mmap base for mmapped malloc chunks

SVN-Revision: 1341

--- common/alloc_replace.c
+++ common/alloc_replace.c
@@ -695,6 +695,24 @@
     }
 }

+static inline chunk_header_t *
+header_from_mmap_base(void *map)
+{
+    if (alloc_ops.external_headers) {
+        /* XXX i#879: hashtable lookup */
+        ASSERT(false, "NYI");
+        return NULL;
+    } else {
+        if ((ptr_uint_t)map < header_size)
+            return NULL;
+        else {
+            return (chunk_header_t *) ((byte *)map + alloc_ops.redzone_size +
+                                       header_beyond_redzone - redzone_beyond_header -
+                                       header_size);
+        }
+    }
+}
+
 /* Distance from the end of one chunk (its start pointer plus alloc_size) to
  * the start of the user memory for the subsequent chunk
  */
@@ -1490,9 +1508,7 @@
             goto replace_alloc_common_done;
         }
         ASSERT(!alloc_ops.external_headers, "NYI");
-        head = (chunk_header_t *) (map + alloc_ops.redzone_size +
-                                   header_beyond_redzone - redzone_beyond_header -
-                                   header_size);
+        head = header_from_mmap_base(map);
         head->flags |= CHUNK_MMAP;
         head->magic = HEADER_MAGIC;
         head->alloc_size = map_size - alloc_ops.redzone_size*2 - header_beyond_redzone;
@@ -1914,7 +1930,7 @@
      */
     /* We rely on the heap region lock to avoid races accessing this */
     if (TEST(HEAP_MMAP, flags)) {
-        chunk_header_t *head = (chunk_header_t *) iter_arena_start;
+        chunk_header_t *head = header_from_mmap_base(iter_arena_start);
         header_to_info(head, &info, NULL);
         ASSERT(TEST(CHUNK_MMAP, head->flags), "mmap chunk inconsistent");
         LOG(2, "%s: "PFX"-"PFX"\n", __FUNCTION__, info.base,
@@ -2105,7 +2121,7 @@
             /* i#1210: the large malloc tree stores only the requested size, so
              * a padding-size overlap will end up here.
              */
-            chunk_header_t *head = (chunk_header_t *) found_arena_start;
+            chunk_header_t *head = header_from_mmap_base(found_arena_start);
             found = overlap_helper(head, info, positive_flags, negative_flags);
         } else
             ASSERT(false, "large lookup should have found it");


usb: Avoid creating duplicate OUT transfers.

This commit fixes an issue when more than one USB transfer is
reserved for same OUT endpoint.

There are 2 scenarios when this could happen:
- The Host sends SET_CONFIGURATION(1) request twice.
- The Host triggers Suspend->Resume->Configured
  event sequence for the device.

USB tranfers are not canceled on SUSPEND event
when the device was not configred previously.

Because of that USB transfer slot is reserved twice
for the same OUT endpoint and lead to shortage of USB
transfer slots quickly.

Without this patch CDC ACM class reserves duplicated USB
transfer slots for one transfer. The sequence of
Suspend->Resume events is genereted alongside with
Configured and the stack will shortly run out of transfer
slots.

If the Host, for some reason, decides to send
SET_CONFIGURATION request twice the same issue is seen.
This patch prevents from reserving additional USB transfer
slots twice.

Signed-off-by: Emil Obalski <a38006c9a9911dcd7c7e26537de6a2fa1043ca9e@nordicsemi.no>

--- subsys/usb/class/cdc_acm.c
+++ subsys/usb/class/cdc_acm.c
@@ -170,8 +170,6 @@

 /* Device data structure */
 struct cdc_acm_dev_data_t {
-	/* USB device status code */
-	enum usb_dc_status_code usb_status;
 	/* Callback function pointer/arg */
 	uart_irq_callback_user_data_t cb;
 	void *cb_data;
@@ -197,6 +195,10 @@
 	uint8_t serial_state;
 	/* CDC ACM notification sent status */
 	uint8_t notification_sent;
+	/* CDC ACM configured flag */
+	bool configured;
+	/* CDC ACM suspended flag */
+	bool suspended;

 	struct usb_dev_data common;
 };
@@ -398,6 +400,8 @@
 static void cdc_acm_reset_port(struct cdc_acm_dev_data_t *dev_data)
 {
 	k_sem_give(&poll_wait_sem);
+	dev_data->configured = false;
+	dev_data->suspended = false;
 	dev_data->rx_ready = false;
 	dev_data->tx_ready = false;
 	dev_data->tx_irq_ena = false;
@@ -424,35 +428,38 @@
 	case USB_DC_RESET:
 		LOG_DBG("Device reset detected");
 		cdc_acm_reset_port(dev_data);
-		dev_data->usb_status = status;
 		break;
 	case USB_DC_CONNECTED:
 		LOG_DBG("Device connected");
 		break;
 	case USB_DC_CONFIGURED:
-		cdc_acm_read_cb(cfg->endpoint[ACM_OUT_EP_IDX].ep_addr, 0,
-				dev_data);
+		LOG_INF("Device configured");
+		if (!dev_data->configured) {
+			cdc_acm_read_cb(cfg->endpoint[ACM_OUT_EP_IDX].ep_addr, 0,
+					dev_data);
+		}
+		dev_data->configured = true;
 		dev_data->tx_ready = true;
 		dev_data->tx_irq_ena = true;
 		dev_data->rx_irq_ena = true;
-		dev_data->usb_status = status;
-		LOG_INF("Device configured");
 		break;
 	case USB_DC_DISCONNECTED:
 		LOG_INF("Device disconnected");
 		cdc_acm_reset_port(dev_data);
-		dev_data->usb_status = status;
 		break;
 	case USB_DC_SUSPEND:
 		LOG_INF("Device suspended");
-		dev_data->usb_status = status;
+		dev_data->suspended = true;
 		break;
 	case USB_DC_RESUME:
-		if (dev_data->usb_status == USB_DC_SUSPEND) {
-			cdc_acm_read_cb(cfg->endpoint[ACM_OUT_EP_IDX].ep_addr,
+		LOG_INF("Device resumed");
+		if (dev_data->suspended) {
+			LOG_INF("from suspend");
+			dev_data->suspended = false;
+			if (dev_data->configured) {
+				cdc_acm_read_cb(cfg->endpoint[ACM_OUT_EP_IDX].ep_addr,
 					0, dev_data);
-			dev_data->usb_status = USB_DC_CONFIGURED;
-			LOG_INF("Define resumed");
+			}
 		} else {
 			LOG_DBG("Spurious resume event");
 		}
@@ -568,8 +575,9 @@
 	LOG_DBG("dev_data %p len %d tx_ringbuf space %u",
 		dev_data, len, ring_buf_space_get(dev_data->tx_ringbuf));

-	if (dev_data->usb_status != USB_DC_CONFIGURED) {
-		LOG_WRN("Device not configured, drop %d bytes", len);
+	if (!dev_data->configured || dev_data->suspended) {
+		LOG_WRN("Device not configured or suspended, drop %d bytes",
+			len);
 		return 0;
 	}

@@ -1092,7 +1100,6 @@
 	RING_BUF_DECLARE(tx_ringbuf_##x,				\
 			 CONFIG_USB_CDC_ACM_RINGBUF_SIZE);		\
 	static struct cdc_acm_dev_data_t cdc_acm_dev_data_##x = {	\
-		.usb_status = USB_DC_UNKNOWN,				\
 		.line_coding = CDC_ACM_DEFAULT_BAUDRATE,		\
 		.rx_ringbuf = &rx_ringbuf_##x,				\
 		.tx_ringbuf = &tx_ringbuf_##x,				\


Improvements of sparrowFont. In textblocks the last lines was ignored for specific cases

--- sparrowFont.c
+++ sparrowFont.c
@@ -869,7 +869,7 @@
 					newLine->text = (char*)malloc(newLine->count+1);
 					memcpy(newLine->text,&buffer[start],newLine->count+1);
 					buffer[last_space] = c;
-					if (buffer[pos] == 0)
+					if (buffer[last_space] == 0)
 						break;
 					pos = last_space+1;
 				}


[cogl-material] Fix some brackets in _layer_flush_gl_sampler_state

The wrong part of an expression was bracketed in the test to determine
when a new texture matrix needed to be loaded which resulted in the
first pass through _cogl_material_layer_flush_gl_sampler_state
not uploading any user matrix.

--- common/cogl-material.c
+++ common/cogl-material.c
@@ -1179,7 +1179,7 @@
 #ifndef DISABLE_MATERIAL_CACHE
   if (!(gl_layer_info &&
         gl_layer_info->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE &&
-        layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE))
+       (layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE)))
 #endif
     {
       GE (glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE));
@@ -1247,9 +1247,9 @@
     }

 #ifndef DISABLE_MATERIAL_CACHE
-  if (gl_layer_info &&
-      (gl_layer_info->flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX ||
-       layer->flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX))
+  if ((gl_layer_info &&
+       gl_layer_info->flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX) ||
+      (layer->flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX))
 #endif
     {
       _cogl_set_current_matrix (COGL_MATRIX_TEXTURE);


Make svnadmin print log messages attached to revisions and
transactions.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@839859 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnadmin/main.c
+++ subversion/svnadmin/main.c
@@ -209,10 +209,13 @@
           svn_fs_root_t *this_root;
           svn_stringbuf_t *datestamp;
           svn_stringbuf_t *author;
+          svn_stringbuf_t *log;
           svn_string_t date_prop = {SVN_PROP_REVISION_DATE,
                                     strlen(SVN_PROP_REVISION_DATE)};
           svn_string_t auth_prop = {SVN_PROP_REVISION_AUTHOR,
                                     strlen(SVN_PROP_REVISION_AUTHOR)};
+          svn_string_t log_prop = {SVN_PROP_REVISION_LOG,
+                                   strlen(SVN_PROP_REVISION_LOG)};
           apr_pool_t *this_pool = svn_pool_create (pool);

           err = svn_fs_open_txn (&txn, fs, txn_name, this_pool);
@@ -226,11 +229,17 @@
           err = svn_fs_txn_prop (&author, txn, &auth_prop, this_pool);
           if (err) goto error;
           if (! author)
-            author = svn_stringbuf_create ("<none>", this_pool);
+            author = svn_stringbuf_create ("", this_pool);
+          err = svn_fs_txn_prop (&log, txn, &log_prop, this_pool);
+          if (err) goto error;
+          if (! log)
+            log = svn_stringbuf_create ("", this_pool);

           printf ("Txn %s:\n", txn_name);
+          printf ("Created: %s\n", datestamp->data);
           printf ("Author: %s\n", author->data);
-          printf ("Created: %s\n", datestamp->data);
+          printf ("Log (%lu bytes):\n%s\n",
+                  (unsigned long int) log->len, log->data);
           printf ("==========================================\n");
           print_tree (this_root, "", 1, this_pool);
           printf ("\n");
@@ -271,11 +280,14 @@
           svn_fs_root_t *this_root;
           svn_stringbuf_t *datestamp;
           svn_stringbuf_t *author;
+          svn_stringbuf_t *log;
           apr_pool_t *this_pool = svn_pool_create (pool);
           svn_string_t date_prop = {SVN_PROP_REVISION_DATE,
                                     strlen(SVN_PROP_REVISION_DATE)};
           svn_string_t auth_prop = {SVN_PROP_REVISION_AUTHOR,
                                     strlen(SVN_PROP_REVISION_AUTHOR)};
+          svn_string_t log_prop = {SVN_PROP_REVISION_LOG,
+                                   strlen(SVN_PROP_REVISION_LOG)};

           err = svn_fs_revision_root (&this_root, fs, this, this_pool);
           if (err) goto error;
@@ -283,15 +295,25 @@
           err = svn_fs_revision_prop (&datestamp, fs, this,
                                       &date_prop, this_pool);
           if (err) goto error;
+
           err = svn_fs_revision_prop (&author, fs, this,
                                       &auth_prop, this_pool);
           if (err) goto error;
           if (! author)
-            author = svn_stringbuf_create ("<none>", this_pool);
+            author = svn_stringbuf_create ("", this_pool);
+
+          err = svn_fs_revision_prop (&log, fs, this,
+                                      &log_prop, this_pool);
+          if (err) goto error;
+          if (! log)
+            log = svn_stringbuf_create ("", this_pool);
+

           printf ("Revision %ld\n", (long int) this);
+          printf ("Created: %s\n", datestamp->data);
           printf ("Author: %s\n", author->data);
-          printf ("Created: %s\n", datestamp->data);
+          printf ("Log (%lu bytes):\n%s\n",
+                  (unsigned long int) log->len, log->data);
           printf ("==========================================\n");
           print_tree (this_root, "", 1, this_pool);
           printf ("\n");


common: Make autorun.inf parsing less strict

Make the parsing of autorun.inf less strict by ignoring whitespace
around "=".

Tweaked by Ross Lagerwall to prevent a match occurring if the part after
the "=" contains only whitespace.

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

--- common/gvfsmountinfo.c
+++ common/gvfsmountinfo.c
@@ -107,7 +107,7 @@
       /* [^,] is because sometimes the icon= line
        * has a comma at the end
        **/
-      icon_regex = g_regex_new ("icon=([^,\\r\\n]+)",
+      icon_regex = g_regex_new ("icon\\s*=\\s*+([^,\\r\\n]+)",
                                 G_REGEX_CASELESS, 0, NULL);
       g_regex_match (icon_regex, content, 0,
                      &match_info);


* subversion/svnserve/main.c
  (main): Don't declare or set a variable which is only used for IPv6 support,
    if such support isn't available.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1294271 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnserve/main.c
+++ subversion/svnserve/main.c
@@ -429,7 +429,9 @@
   const char *host = NULL;
   int family = APR_INET;
   apr_int32_t sockaddr_info_flags = 0;
+#if APR_HAVE_IPV6
   svn_boolean_t prefer_v6 = FALSE;
+#endif
   svn_boolean_t quiet = FALSE;
   svn_boolean_t is_version = FALSE;
   int mode_opt_count = 0;
@@ -487,7 +489,10 @@
       switch (opt)
         {
         case '6':
+#if APR_HAVE_IPV6
           prefer_v6 = TRUE;
+#endif
+          /* ### Maybe error here if we don't have IPV6 support? */
           break;

         case 'h':


Insert a '\n' into the tail of a message. This is a follow-up to r11862,
in which puts is replaced by svn_cmdline_fputs.

* subversion/svnserve/main.c
  (help): Insert a newline into the tail of a message string.

Approved by: julianfoad, lundblad, kfogel

--- subversion/svnserve/main.c
+++ subversion/svnserve/main.c
@@ -137,7 +137,7 @@

   svn_error_clear (svn_cmdline_fputs("Usage: svnserve [options]\n"
                                      "\n"
-                                     "Valid options:",
+                                     "Valid options:\n",
                                      stdout, pool));
   for (i = 0; svnserve__options[i].name && svnserve__options[i].optch; i++)
     {


UsbDk: Make WDFMEMORY accessor class type-aware

Signed-off-by: Dmitry Fleytman <f50f56ffad4b379c2a89812e98b14900ef87e9ea@redhat.com>

--- UsbDk/MemoryBuffer.h
+++ UsbDk/MemoryBuffer.h
@@ -45,25 +45,29 @@
     size_t m_Size;
 };

-class CPreAllocatedWdfMemoryBuffer
+template<typename T>
+class CPreAllocatedWdfMemoryBufferT
 {
 public:
-    CPreAllocatedWdfMemoryBuffer(WDFMEMORY MemObj)
+    CPreAllocatedWdfMemoryBufferT(WDFMEMORY MemObj)
         : m_MemObj(MemObj)
-    { m_Ptr = WdfMemoryGetBuffer(MemObj, &m_Size); }
+    { m_Ptr = reinterpret_cast<T*>(WdfMemoryGetBuffer(MemObj, &m_Size)); }

-    operator PVOID () const { return m_Ptr; }
-    PVOID Ptr() const { return m_Ptr; }
+    operator T* () const { return m_Ptr; }
+    T *operator ->() { return m_Ptr; }
+    T* Ptr() const { return m_Ptr; }
     size_t Size() const { return m_Size; }

-    CPreAllocatedWdfMemoryBuffer(const CPreAllocatedWdfMemoryBuffer&) = delete;
-    CPreAllocatedWdfMemoryBuffer& operator= (const CPreAllocatedWdfMemoryBuffer&) = delete;
+    CPreAllocatedWdfMemoryBufferT(const CPreAllocatedWdfMemoryBufferT&) = delete;
+    CPreAllocatedWdfMemoryBufferT& operator= (const CPreAllocatedWdfMemoryBufferT&) = delete;

 private:
     WDFMEMORY m_MemObj;
-    PVOID m_Ptr;
+    T* m_Ptr;
     size_t m_Size;
 };
+
+typedef CPreAllocatedWdfMemoryBufferT<void> CPreAllocatedWdfMemoryBuffer;

 class CWdfMemoryBuffer : public CMemoryBuffer
 {


* svnserve/main.c (main): Remove the comment claiming that our libraries aren't thread-safe; the only non-thread-safe area of our library we know about is the collection of file and line data in errors, and a race there just means we report inaccurate file and line information in maintainer-mode error messages.

--- subversion/svnserve/main.c
+++ subversion/svnserve/main.c
@@ -190,12 +190,9 @@
           exit(0);
         }

-#if APR_HAS_FORK
-      /* This definitely won't work on Windows, which doesn't have the
-       * concept of forking a process at all.  I'm not sure how to
-       * structure a forking daemon process under Windows.  (Threads?
-       * Our library code isn't perfectly thread-safe at the
-       * moment.) -ghudson */
+      /* ### We should try to use threads when APR_HAS_FORK isn't
+       * defined (such as on Windows). */
+#if APR_HAS_FORK
       status = apr_proc_fork(&proc, connection_pool);
       if (status == APR_INCHILD)
         {


Domashno 02

Domashno 02


important fix for broken move prev

important fix for broken move prev

--- cmd/wm/client.c
+++ cmd/wm/client.c
@@ -645,6 +645,7 @@
 			if(!(to = new_left_column(v)))
 				return;
 		}
+		else
 			return;
 	}
 	else if(!strncmp(arg, "next", 5) && i) {


respect min_height in the frame rescaling mechanism in column-default too

--- cmd/wm/column.c
+++ cmd/wm/column.c
@@ -108,6 +108,8 @@
 {
 	unsigned int i, yoff = a->rect.y, h, dy = 0;
 	float scale = 1.0;
+	unsigned int min_height = 2 * height_of_bar();
+	int hdiff = 0;

 	if(!a->frame.size)
 		return;
@@ -130,6 +132,10 @@
 			f->rect.y = yoff;
 			f->rect.width = a->rect.width;
 			f->rect.height *= scale;
+			if(f->rect.height < min_height)
+				f->rect.height = min_height;
+			else if((hdiff = f->rect.y + f->rect.height - a->rect.height + (a->frame.size - i) * min_height) > 0)
+				f->rect.height -= hdiff;
 			if(i == a->frame.size - 1)
 				f->rect.height = a->rect.height - f->rect.y + a->rect.y;
 			yoff += f->rect.height;


Fix issue #96

Fix issue #96

--- cmd/wmii/area.c
+++ cmd/wmii/area.c
@@ -204,6 +204,8 @@
 		return;

 	from = f->area;
+	if (from == to)
+		return;

 	area_detach(f);


waidpid() child after double fork hack.

waidpid() child after double fork hack.

--- cmd/wmii/main.c
+++ cmd/wmii/main.c
@@ -291,13 +291,14 @@
 static void
 init_traps(void) {
 	char buf[1];
-	int fd[2];
+	pid_t pid;
+	int fd[2], status;

 	if(pipe(fd) != 0)
 		fatal("Can't pipe(): %r");

 	/* Double fork hack */
-	switch(fork()) {
+	switch(pid = fork()) {
 	case -1:
 		fatal("Can't fork(): %r");
 		break; /* not reached */
@@ -326,6 +327,7 @@
 			exit(0);
 		}
 	default:
+		waitpid(pid, &status, 0);
 		break;
 	}


fixed off-by-one bug in polynomial evaluation where a variable has degree > 1

--- AERN-RmToRn-Poly/cbits/GenericCoeff/evaluation.c
+++ AERN-RmToRn-Poly/cbits/GenericCoeff/evaluation.c
@@ -4,18 +4,23 @@

 #include "GenericCoeff/poly.h"
 #include "EvalExport_stub.h"
+
+#define DEBUG_EVAL(x) x;
+//#define DEBUG_EVAL(x)

 Value
 ADD_COEFF_CODE(evalAtPtChebBasis)(Poly * p, Value * values, Value one,
     BinaryOp add, BinaryOp subtr, BinaryOp mult, ConversionOp cf2val)
 {
-  //  printf("evalAtPtChebBasis: starting\n");
+  DEBUG_EVAL(printf("evalAtPtChebBasis: starting\n"));
   Var maxArity = p -> maxArity;
   Var psize = p -> psize;
   Term * terms = p -> terms;

   // initialise the result variable using the constant term:
+  DEBUG_EVAL(printf("evalAtPtChebBasis: converting the constant term\n"));
   Value result = eval_convert_hs(cf2val, p -> constTerm);
+  DEBUG_EVAL(printf("evalAtPtChebBasis: converted the constant term\n"));

   // return if this is a constant polynomial:
   if (psize == 0)
@@ -37,13 +42,17 @@
             }
         }
     }
+  DEBUG_EVAL(printf("evalAtPtChebBasis: computed power limits for all variables\n"));

   // compute Chebyshev powers for all values up to the variable's maximum power:
   Value ** varPowers = malloc(maxArity * sizeof(Value *));
   FOREACH_VAR_ARITY(var, maxArity)
     {
       Power varMaxN = maxPowers[var];
+      DEBUG_EVAL(printf("evalAtPtChebBasis: computing powers of var %d up to %d\n", var, varMaxN));
+
       Value x = values[var];
+

       // allocate space for powers of x using the maximum N:
       varPowers[var] = malloc((1 + varMaxN) * sizeof(Value));
@@ -59,7 +68,7 @@
         }

       // compute powers 2 and onwards using the iterative formula T_n(x) = 2*x*T_{n-1}(x) - T_{n-2}(x)
-      for (Power n = 2; n < varMaxN; ++n)
+      for (Power n = 2; n <= varMaxN; ++n)
         {
           Value temp1 = eval_binary_hs(mult, x, varPowers[var][n - 1]);
           Value temp2 = eval_binary_hs(add, temp1, temp1);
@@ -69,6 +78,7 @@
           free_SP_hs(temp2);
         }
     }
+  DEBUG_EVAL(printf("evalAtPtChebBasis: computed value powers for all variables\n"));

   // scan the polynomial terms, cumulatively computing the result:
   for (Size termNo = 0; termNo < psize; ++termNo)
@@ -94,6 +104,7 @@
       free_SP_hs(temp);
       free_SP_hs(termValue);
     }
+  DEBUG_EVAL(printf("evalAtPtChebBasis: computed the polynomial's value\n"));

   // free pre-computed Chebyshev powers:
   FOREACH_VAR_ARITY(var, maxArity)
@@ -111,7 +122,7 @@
   // free the array with maximum powers for each variable:
   free(maxPowers);

-  //  printf("evalAtPtChebBasis: returning\n");
+  DEBUG_EVAL(printf("evalAtPtChebBasis: finished, returning result\n"));
   return result;
 }

@@ -170,7 +181,7 @@
         }

       // compute powers 2 and onwards from lower powers:
-      for (Power n = 2; n < varMaxN; ++n)
+      for (Power n = 2; n <= varMaxN; ++n)
         {
           /*
            * for even n: x^n = x^(n/2) * x^(n/2)


兼容无config包的rtmp流

兼容无config包的rtmp流

--- src/Rtmp/RtmpMediaSource.h
+++ src/Rtmp/RtmpMediaSource.h
@@ -100,6 +100,13 @@
 				_bRegisted = true;
 			}
 		} else{
+			if(!_bRegisted){
+				//强制在3秒后注册，不管是否有metedata或config包
+				if(_ticker.createdTime() > 3 * 1000){
+					MediaSource::regist();
+					_bRegisted = true;
+				}
+			}
 			_mapStamp[pkt->typeId] = pkt->timeStamp;
 			_pRing->write(pkt,pkt->isVideoKeyFrame());
 		}
@@ -130,6 +137,7 @@
 	int _iCfgFrameSize = -1;
 	bool _bAsyncRegist = false;
 	bool _bRegisted = false;
+	Ticker _ticker;
 };

 } /* namespace mediakit */


add class hint

add class hint

--- spectrogram.c
+++ spectrogram.c
@@ -349,6 +349,7 @@
 	Atom		delwin;
 	Atom		nhints;
 	XSizeHints	*hints;
+	XClassHint	*class;
 	int		scr;

 	struct		panel *left, *right;
@@ -397,6 +398,13 @@
 		0, 0, width, height, 0, white, black);

 	XStoreName(dsp, win, __progname);
+	class = XAllocClassHint();
+	if (class) {
+		class->res_name = __progname;
+		class->res_class = __progname;
+		XSetClassHint(dsp, win, class);
+		XFree(class);
+	}
 	XSelectInput(dsp, win, KeyPressMask|StructureNotifyMask);

 	/* catch delete window */


tests: remove leaks from queue-test

tests: remove leaks from queue-test

Destroy all objects that we have created

Signed-off-by: Marek Chalupa <a05df156a69ad59faa9af9b666ef78009594c145@gmail.com>
Reviewed-by: Pekka Paalanen <0f6ae7001e34c37b02fb2c1c2573ddf8f442136a@collabora.co.uk>

--- tests/queue-test.c
+++ tests/queue-test.c
@@ -86,6 +86,8 @@

 	client_assert(counter == 1);

+	/* don't destroy the registry, we have already destroyed them
+	 * in the global handler */
 	wl_display_disconnect(display);

 	return 0;
@@ -152,6 +154,7 @@
 	while (!state.done && !ret)
 		ret = wl_display_dispatch_queue(state.display, queue);

+	wl_event_queue_destroy(queue);
 	wl_display_disconnect(state.display);

 	return ret == -1 ? -1 : 0;
@@ -221,6 +224,8 @@

 	wl_callback_destroy(callback1);
 	wl_callback_destroy(callback2);
+	wl_event_queue_destroy(queue);
+
 	wl_display_disconnect(display);

 	return 0;


queue-test: WEXITSTATUS() is undefined if WIFEXITED() is false

If a child process dies from a signal, WIFEXITED() returns false and
WEXITSTATUS() isn't well-defined.  In this case, if the client segfaults,
the status is 134 and WEXITSTATUS(134) is EXIT_SUCCESS, so we mask the error.

--- tests/queue-test.c
+++ tests/queue-test.c
@@ -212,7 +212,7 @@
 	int status;

 	waitpid(-1, &status, 0);
-	display->child_exit_status = WEXITSTATUS(status);
+	display->child_exit_status = status;

 	wl_display_terminate(display->display);

@@ -282,5 +282,6 @@
 	wl_event_source_remove(signal_source);
 	wl_display_destroy(display.display);

-	assert(display.child_exit_status == EXIT_SUCCESS);
-}
+	assert(WIFEXITED(display.child_exit_status) &&
+	       WEXITSTATUS(display.child_exit_status) == EXIT_SUCCESS);
+}


Wrote a highly optimized version of "IDirectFBFont_GetStringWidth()". The previous version used the bloated "IDirectFBFont_GetStringExtents()".

--- src/media/idirectfbfont.c
+++ src/media/idirectfbfont.c
@@ -42,6 +42,7 @@

 #include <direct/interface.h>
 #include <direct/mem.h>
+#include <direct/tree.h>
 #include <direct/utf8.h>

 #include "misc/util.h"
@@ -219,22 +220,20 @@
      if (bytes < 0)
           bytes = strlen (text);

-     for (offset = 0; offset < bytes; offset += direct_utf8_skip[(__u8)text[offset]]) {
-          unsigned char c = text[offset];
+     for (offset = 0; offset < bytes; offset += DIRECT_UTF8_SKIP(text[offset])) {
+          unsigned int c = text[offset];

           if (c < 128)
                current = c;
           else
-               current = direct_utf8_get_char( &text[offset] );
+               current = DIRECT_UTF8_GET_CHAR( &text[offset] );

           if (dfb_font_get_glyph_data (font, current, &glyph) == DFB_OK) {
                kern_y = 0;

-               if (prev && font->GetKerning &&
-                   font->GetKerning (font, prev, current, &kern_x, &kern_y) == DFB_OK)
-               {
+               if (prev && font->GetKerning && font->GetKerning( font, prev, current,
+                                                                 &kern_x, &kern_y ) == DFB_OK)
                     width += kern_x;
-               }

                if (ink_rect) {
                     DFBRectangle glyph_rect = { width + glyph->left,
@@ -274,21 +273,67 @@
  */
 static DFBResult
 IDirectFBFont_GetStringWidth( IDirectFBFont *thiz,
-                              const char *text, int bytes,
-                              int *width )
-{
-     DFBRectangle rect;
-     DFBResult    result;
-
-     if (!width)
-          return DFB_INVARG;
-
-     result = thiz->GetStringExtents (thiz, text, bytes, &rect, NULL);
-
-     if (result == DFB_OK)
-          *width = rect.w;
-
-     return result;
+                              const char    *text,
+                              int            bytes,
+                              int           *ret_width )
+{
+     CoreFont      *font;
+     DirectTree    *glyphs;
+     const __u8    *string;
+     const __u8    *end;
+     CoreGlyphData *glyph;
+     int            kern_x;
+     int            width = 0;
+     unichar        prev  = 0;
+     unichar        current;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (!text || !ret_width)
+          return DFB_INVARG;
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (!bytes) {
+          *ret_width = 0;
+
+          return DFB_OK;
+     }
+
+     font   = data->font;
+     glyphs = font->glyph_infos;
+     string = text;
+     end    = string + bytes;
+
+     dfb_font_lock( font );
+
+     do {
+          current = DIRECT_UTF8_GET_CHAR( string );
+
+          if (current >= 32 && current < 128)
+               glyph = glyphs->fast_keys[current-32];
+          else
+               glyph = direct_tree_lookup( glyphs, (void *) current );
+
+          if (glyph || dfb_font_get_glyph_data( font, current, &glyph ) == DFB_OK) {
+               width += glyph->advance;
+
+               if (prev && font->GetKerning && font->GetKerning( font, prev,
+                                                                 current, &kern_x, NULL ) == DFB_OK)
+                    width += kern_x;
+          }
+
+          prev = current;
+
+          string += DIRECT_UTF8_SKIP( current );
+     } while (string < end);
+
+     dfb_font_unlock( font );
+
+     *ret_width = width;
+
+     return DFB_OK;
 }

 /*


mesa: Unbind uniform buffer bindings on glDeleteBuffers().

Fixes piglit GL_ARB_uniform_buffer_object/deletebuffers.

Reviewed-by: Kenneth Graunke <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>

--- src/mesa/main/bufferobj.c
+++ src/mesa/main/bufferobj.c
@@ -886,6 +886,13 @@
             }
          }

+         /* unbind UBO binding points */
+         for (j = 0; j < ctx->Const.MaxUniformBufferBindings; j++) {
+            if (ctx->UniformBufferBindings[j].BufferObject == bufObj) {
+               _mesa_BindBufferBase( GL_UNIFORM_BUFFER, j, 0 );
+            }
+         }
+
          if (ctx->UniformBuffer == bufObj) {
             _mesa_BindBufferARB( GL_UNIFORM_BUFFER, 0 );
          }


Added the function st_room_set_background

--- spritetools.h
+++ spritetools.h
@@ -1106,6 +1106,13 @@
 	return room.entities[index];
 }

+//Returns a room's background
+void st_room_set_background(st_room *proom, st_anim background){
+	room = *proom;
+	room.background = background;
+	*proom = room;
+}
+
 //Sets an entity in a room's entity array
 void st_room_set_entity(st_room room, st_ent entity, int index){
 	room.entities[index] = entity;


cr50: add tpm response processing.

cr50: add tpm response processing.

This patch closes the loop of processing TPM commands, the response
generated by ExecCommand() is placed in the buffer to be returned
through FIFO read accesses.

State machine and register states are updated as per TCG Platform
Specification. A lot of debug output is generated, this is useful for
debugging, will be filtered eventually.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=with the appropriate tpm2 and trunks patches in place trunksd
     successfully initializes the CR50, sending such commands as
     Startup, GetCapability (three times) and SelfTest.

Change-Id: Ibbd952b53930e4530461db7dcdbc510a8022412c
Signed-off-by: Vadim Bendebury <5515d6d2d0829cbe0dd0dcf2094aaded06d58514@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/293910
Reviewed-by: Utkarsh Sanghi <5d1ef26cef3405de5c4b1c57d52b193b4e288080@chromium.org>

--- common/tpm_registers.c
+++ common/tpm_registers.c
@@ -99,6 +99,18 @@
 	response_retry = (1 << 1),
 };

+static void set_tpm_state(enum tpm_states state)
+{
+	CPRINTF("state transition from %d to %d\n", tpm_.state, state);
+	tpm_.state = state;
+
+	if (state == tpm_state_idle) {
+		/* Make sure FIFO is empty. */
+		tpm_.fifo_read_index = 0;
+		tpm_.fifo_write_index = 0;
+	}
+}
+
 /*
  * Some TPM registers allow writing of only exactly one bit. This helper
  * function allows to verify that a value is compliant with this
@@ -160,9 +172,7 @@
 		}
 		tpm_.regs.access &= ~active_locality;
 		/* No matter what we do, fall into idle state. */
-		tpm_.state = tpm_state_idle;
-		tpm_.fifo_read_index = 0;
-		tpm_.fifo_write_index = 0;
+		set_tpm_state(tpm_state_idle);
 		break;

 	default:
@@ -180,7 +190,7 @@
 {
 	switch (tpm_.state) {
 	case tpm_state_idle:
-		tpm_.state = tpm_state_ready;
+		set_tpm_state(tpm_state_ready);
 		tpm_.regs.sts |= command_ready;
 		break;
 	case tpm_state_ready:
@@ -189,7 +199,7 @@
 	case tpm_state_completing_cmd:
 	case tpm_state_executing_cmd:
 	case tpm_state_receiving_cmd:
-		tpm_.state = tpm_state_idle;
+		set_tpm_state(tpm_state_idle);
 		tpm_.regs.sts &= ~command_ready;
 		break;
 	}
@@ -206,7 +216,7 @@
 	case tpm_state_receiving_cmd:
 		if (!(tpm_.state & expect)) {
 			/* This should trigger actual command execution. */
-			tpm_.state = tpm_state_executing_cmd;
+			set_tpm_state(tpm_state_executing_cmd);
 			task_set_event(TASK_ID_TPM, TASK_EVENT_WAKE, 0);
 		}
 		break;
@@ -284,7 +294,7 @@
 	 * access.
 	 */
 	if ((tpm_.state == tpm_state_ready) && (tpm_.fifo_write_index == 0))
-		tpm_.state = tpm_state_receiving_cmd;
+		set_tpm_state(tpm_state_receiving_cmd);

 	if (tpm_.state != tpm_state_receiving_cmd) {
 		CPRINTF("%s: ignoring data in state %d\n",
@@ -296,7 +306,7 @@
 		CPRINTF("%s: receive buffer overflow: %d in addition to %d\n",
 			__func__, data_size, tpm_.fifo_write_index);
 		tpm_.fifo_write_index = 0;
-		tpm_.state = tpm_state_ready;
+		set_tpm_state(tpm_state_ready);
 		return;
 	}

@@ -325,6 +335,11 @@
 void tpm_register_put(uint32_t regaddr, const uint8_t *data, uint32_t data_size)
 {
 	uint32_t i;
+	uint32_t idata;
+
+	memcpy(&idata, data, 4);
+	CPRINTF("%s(0x%06x, %d %x)\n", __func__, regaddr, data_size, idata);
+
 	switch (regaddr) {
 	case TPM_ACCESS:
 		/* This is a one byte register, ignore extra data, if any */
@@ -346,8 +361,24 @@

 }

+void fifo_reg_read(uint8_t *dest, uint32_t data_size)
+{
+	uint32_t still_in_fifo = tpm_.fifo_write_index -
+		tpm_.fifo_read_index;
+
+	data_size = MIN(data_size, still_in_fifo);
+	memcpy(dest,
+	       tpm_.regs.data_fifo + tpm_.fifo_read_index,
+	       data_size);
+
+	tpm_.fifo_read_index += data_size;
+	if (tpm_.fifo_write_index == tpm_.fifo_read_index)
+		tpm_.regs.sts &= ~(data_avail | command_ready);
+}
+
 void tpm_register_get(uint32_t regaddr, uint8_t *dest, uint32_t data_size)
 {
+	CPRINTF("%s(0x%06x, %d)", __func__, regaddr, data_size);
 	switch (regaddr) {
 	case TPM_DID_VID:
 		copy_bytes(dest, data_size, (GOOGLE_DID << 16) | GOOGLE_VID);
@@ -362,18 +393,23 @@
 		copy_bytes(dest, data_size, tpm_.regs.access);
 		break;
 	case TPM_STS:
+		CPRINTF(" %x", tpm_.regs.sts);
 		copy_bytes(dest, data_size, tpm_.regs.sts);
+		break;
+	case TPM_DATA_FIFO:
+		fifo_reg_read(dest, data_size);
 		break;
 	default:
 		CPRINTS("%s(0x%06x, %d) => ??", __func__, regaddr, data_size);
 		return;
 	}
+	CPRINTF("\n");
 }

 static void tpm_init(void)
 {
-	tpm_.state = tpm_state_idle;
+	set_tpm_state(tpm_state_idle);
 	tpm_.regs.access = tpm_reg_valid_sts;
 	tpm_.regs.sts = (tpm_family_tpm2 << tpm_family_shift) |
 		(64 << burst_count_shift) | sts_valid;
@@ -401,5 +437,14 @@
 			       tpm_.regs.data_fifo,
 			       &response_size,
 			       &response);
-	}
-}
+		CPRINTF("got %d bytes in response\n", response_size);
+		if (response_size &&
+		    (response_size <= sizeof(tpm_.regs.data_fifo))) {
+			memcpy(tpm_.regs.data_fifo, response, response_size);
+			tpm_.fifo_read_index = 0;
+			tpm_.fifo_write_index = response_size;
+			tpm_.regs.sts |= data_avail;
+			set_tpm_state(tpm_state_completing_cmd);
+		}
+	}
+}


Used #ifndef in a few places per gbatemp user catlover007's suggestion

--- spritetools.h
+++ spritetools.h
@@ -1,7 +1,17 @@
+#ifndef SPRITETOOLS_H
+
+#ifndef STDLIB_H
 #include <stdlib.h>
+#endif
+#ifndef SF2D_H
 #include <sf2d.h>
+#endif
+#ifndef MATH_H
 #include <math.h>
+#endif
+#ifndef STDIO_H
 #include <stdio.h>
+#endif

 typedef struct {
 	unsigned int frames;      //number of frames in the animation
@@ -1167,4 +1177,6 @@
 	st_cam cam = room.cameras[index];
 	st_animation_play(&room.background, -st_screen_width_current() - cam.xPos, -st_screen_height_current() - cam.yPos);
 	st_entity_render_camera(room.entities, 1024, cam);
-}+}
+
+#endif


tpm: fire watchdog before executing commands

In certain test scenarios the tpm task is hogging all resource and
causes watchdog resets. Let's kick the watchdog in every loop, Long
calculations already have watchdog kicking in place.

BRANCH=ToT
BUG=none
TEST=tests executed in rapid succession do not cause watchdog resets
     any more.

(cherry picked from commit de8fb11bfd07d3fea2048b6848b8a183c31e2580)
Signed-off-by: Vadim Bendebury <5515d6d2d0829cbe0dd0dcf2094aaded06d58514@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360229
Reviewed-by: Marius Schilder <d423f2980be0298efdef7df239b147d21d472f26@chromium.org>
Tested-by: Marius Schilder <d423f2980be0298efdef7df239b147d21d472f26@chromium.org>
Change-Id: Ifaad6f9b4af2218f601412a36a075b4b4275d56f
Reviewed-on: https://chromium-review.googlesource.com/362170

--- common/tpm_registers.c
+++ common/tpm_registers.c
@@ -19,6 +19,7 @@
 #include "task.h"
 #include "tpm_registers.h"
 #include "util.h"
+#include "watchdog.h"

 /* TPM2 library includes. */
 #include "ExecCommand_fp.h"
@@ -541,6 +542,8 @@
 		command_code = be32toh(tpmh->command_code);
 		CPRINTF("%s: received fifo command 0x%04x\n",
 			__func__, command_code);
+
+		watchdog_reload();

 #ifdef CONFIG_EXTENSION_COMMAND
 		if (command_code == CONFIG_EXTENSION_COMMAND) {


mesa: pass 'mask', not NULL to renderbuffer->Put functions

Fixes bug 17800.

--- src/mesa/swrast/s_depth.c
+++ src/mesa/swrast/s_depth.c
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  7.2.1
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -534,15 +534,15 @@
       if (rb->DataType == GL_UNSIGNED_SHORT) {
          GLushort zbuffer[MAX_WIDTH];
          rb->GetRow(ctx, rb, count, x, y, zbuffer);
-         passed = depth_test_span16(ctx, count, zbuffer, zValues, mask );
-         rb->PutRow(ctx, rb, count, x, y, zbuffer, NULL);
+         passed = depth_test_span16(ctx, count, zbuffer, zValues, mask);
+         rb->PutRow(ctx, rb, count, x, y, zbuffer, mask);
       }
       else {
          GLuint zbuffer[MAX_WIDTH];
          ASSERT(rb->DataType == GL_UNSIGNED_INT);
          rb->GetRow(ctx, rb, count, x, y, zbuffer);
-         passed = depth_test_span32(ctx, count, zbuffer, zValues, mask );
-         rb->PutRow(ctx, rb, count, x, y, zbuffer, NULL);
+         passed = depth_test_span32(ctx, count, zbuffer, zValues, mask);
+         rb->PutRow(ctx, rb, count, x, y, zbuffer, mask);
       }
    }

@@ -1080,15 +1080,15 @@
       if (rb->DataType == GL_UNSIGNED_SHORT) {
          GLushort zbuffer[MAX_WIDTH];
          _swrast_get_values(ctx, rb, count, x, y, zbuffer, sizeof(GLushort));
-         depth_test_span16(ctx, count, zbuffer, z, mask );
-         rb->PutValues(ctx, rb, count, x, y, zbuffer, NULL);
+         depth_test_span16(ctx, count, zbuffer, z, mask);
+         rb->PutValues(ctx, rb, count, x, y, zbuffer, mask);
       }
       else {
          GLuint zbuffer[MAX_WIDTH];
          ASSERT(rb->DataType == GL_UNSIGNED_INT);
          _swrast_get_values(ctx, rb, count, x, y, zbuffer, sizeof(GLuint));
-         depth_test_span32(ctx, count, zbuffer, z, mask );
-         rb->PutValues(ctx, rb, count, x, y, zbuffer, NULL);
+         depth_test_span32(ctx, count, zbuffer, z, mask);
+         rb->PutValues(ctx, rb, count, x, y, zbuffer, mask);
       }
    }


One more const method.

One more const method.

--- sql/handler.h
+++ sql/handler.h
@@ -465,7 +465,7 @@
   { return min(MAX_REF_PARTS, max_supported_key_parts()); }
   uint max_key_length() const
   { return min(MAX_KEY_LENGTH, max_supported_key_length()); }
-  uint max_key_part_length()
+  uint max_key_part_length() const
   { return min(MAX_KEY_LENGTH, max_supported_key_part_length()); }

   virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }


appstream: Add runtime, sdk and tags to appstream xml

--- common/xdg-app-utils.c
+++ common/xdg-app-utils.c
@@ -1529,10 +1529,14 @@
 static gboolean
 validate_component (XdgAppXml *component,
                     const char *ref,
-                    const char *id)
-{
-  XdgAppXml *bundle, *text, *prev, *id_node, *id_text_node;
+                    const char *id,
+                    char **tags,
+                    const char *runtime,
+                    const char *sdk)
+{
+  XdgAppXml *bundle, *text, *prev, *id_node, *id_text_node, *metadata, *value;
   g_autofree char *id_text = NULL;
+  int i;

   if (g_strcmp0 (component->element_name, "component") != 0)
     return FALSE;
@@ -1557,19 +1561,62 @@
     xdg_app_xml_free (xdg_app_xml_unlink (component, bundle));

   bundle = xdg_app_xml_new ("bundle");
-  bundle->attribute_names = g_new0 (char *, 2);
-  bundle->attribute_values = g_new0 (char *, 2);
+  bundle->attribute_names = g_new0 (char *, 2 * 4);
+  bundle->attribute_values = g_new0 (char *, 2 * 4);
   bundle->attribute_names[0] = g_strdup ("type");
   bundle->attribute_values[0] = g_strdup ("xdg-app");
+
+  i = 1;
+  if (runtime)
+    {
+      bundle->attribute_names[i] = g_strdup ("runtime");
+      bundle->attribute_values[i] = g_strdup (runtime);
+      i++;
+    }
+
+  if (sdk)
+    {
+      bundle->attribute_names[i] = g_strdup ("sdk");
+      bundle->attribute_values[i] = g_strdup (sdk);
+      i++;
+    }
+
+  text = xdg_app_xml_new (NULL);
+  text->text = g_strdup (ref);
+  xdg_app_xml_add (bundle, text);

   xdg_app_xml_add (component, xdg_app_xml_new_text ("  "));
   xdg_app_xml_add (component, bundle);
   xdg_app_xml_add (component, xdg_app_xml_new_text ("\n  "));

-  text = xdg_app_xml_new (NULL);
-  text->text = g_strdup (ref);
-
-  xdg_app_xml_add (bundle, text);
+  if (tags != NULL && tags[0] != NULL)
+    {
+      metadata = xdg_app_xml_find (component, "metadata", NULL);
+      if (metadata == NULL)
+        {
+          metadata = xdg_app_xml_new ("metadata");
+          metadata->attribute_names = g_new0 (char *, 1);
+          metadata->attribute_values = g_new0 (char *, 1);
+
+          xdg_app_xml_add (component, xdg_app_xml_new_text ("  "));
+          xdg_app_xml_add (component, metadata);
+          xdg_app_xml_add (component, xdg_app_xml_new_text ("\n  "));
+        }
+
+      value = xdg_app_xml_new ("value");
+      value->attribute_names = g_new0 (char *, 2);
+      value->attribute_values = g_new0 (char *, 2);
+      value->attribute_names[0] = g_strdup ("key");
+      value->attribute_values[0] = g_strdup ("X-XdgApp-Tags");
+      xdg_app_xml_add (metadata, xdg_app_xml_new_text ("\n       "));
+      xdg_app_xml_add (metadata, value);
+      xdg_app_xml_add (metadata, xdg_app_xml_new_text ("\n    "));
+
+      text = xdg_app_xml_new (NULL);
+      text->text = g_strjoinv (",", tags);
+      xdg_app_xml_add (value, text);
+
+    }

   return TRUE;
 }
@@ -1578,18 +1625,32 @@
 migrate_xml (XdgAppXml *root,
              XdgAppXml *appstream,
              const char *ref,
-             const char *id)
+             const char *id,
+             GKeyFile *metadata)
 {
   XdgAppXml *components;
   XdgAppXml *component;
   XdgAppXml *prev_component;
   gboolean migrated = FALSE;
+  g_auto(GStrv) tags = NULL;
+  g_autofree const char *runtime = NULL;
+  g_autofree const char *sdk = NULL;
+  const char *group;

   if (root->first_child == NULL ||
       root->first_child->next_sibling != NULL ||
       g_strcmp0 (root->first_child->element_name, "components") != 0)
     return FALSE;

+  if (g_str_has_prefix (ref, "app/"))
+    group = "Application";
+  else
+    group = "Runtime";
+
+  tags = g_key_file_get_string_list (metadata, group, "tags", NULL, NULL);
+  runtime = g_key_file_get_string (metadata, group, "runtime", NULL);
+  sdk = g_key_file_get_string (metadata, group, "sdk", NULL);
+
   components = root->first_child;

   component = components->first_child;
@@ -1598,7 +1659,7 @@
     {
       XdgAppXml *next = component->next_sibling;

-      if (validate_component (component, ref, id))
+      if (validate_component (component, ref, id, tags, runtime, sdk))
         {
           xdg_app_xml_add (appstream, xdg_app_xml_unlink (component, prev_component));
           migrated = TRUE;
@@ -1666,12 +1727,28 @@
   g_autoptr(GFile) root = NULL;
   g_autoptr(GFile) xmls_dir = NULL;
   g_autoptr(GFile) appstream_file = NULL;
+  g_autoptr(GFile) metadata = NULL;
   g_autofree char *appstream_basename = NULL;
   g_autoptr(GInputStream) in = NULL;
   g_autoptr(XdgAppXml) xml_root = NULL;
+  g_autoptr(GKeyFile) keyfile = NULL;

   if (!ostree_repo_read_commit (repo, ref, &root, NULL, NULL, error))
     return FALSE;
+
+  keyfile = g_key_file_new ();
+  metadata = g_file_get_child (root, "metadata");
+  if (g_file_query_exists (metadata, cancellable))
+    {
+      g_autofree char *content = NULL;
+      gsize len;
+
+      if (!g_file_load_contents (metadata, cancellable, &content, &len, NULL, error))
+        return FALSE;
+
+      if (!g_key_file_load_from_data (keyfile, content, len, G_KEY_FILE_NONE, error))
+        return FALSE;
+    }

   xmls_dir = g_file_resolve_relative_path (root, "files/share/app-info/xmls");
   appstream_basename = g_strconcat (id, ".xml.gz", NULL);
@@ -1685,7 +1762,7 @@
   if (xml_root == NULL)
     return FALSE;

-  if (migrate_xml (xml_root, appstream_components, ref, id))
+  if (migrate_xml (xml_root, appstream_components, ref, id, keyfile))
     {
       g_autoptr(GError) my_error = NULL;
       if (!copy_icon (id, root, dest, "64x64", &my_error))


Remove redundant headers

Remove redundant headers

PiperOrigin-RevId: 265085177
Change-Id: I3eeeae422332d13598a01847d87ec8128c6925d2

--- asylo/platform/primitives/util/dispatch_table.h
+++ asylo/platform/primitives/util/dispatch_table.h
@@ -19,7 +19,6 @@
 #ifndef ASYLO_PLATFORM_PRIMITIVES_UTIL_DISPATCH_TABLE_H_
 #define ASYLO_PLATFORM_PRIMITIVES_UTIL_DISPATCH_TABLE_H_

-#include "absl/base/thread_annotations.h"
 #include "absl/container/flat_hash_map.h"
 #include "asylo/platform/primitives/untrusted_primitives.h"
 #include "asylo/platform/primitives/util/message.h"


cleanup: unused handler::check_if_supported_virtual_columns()

--- sql/handler.h
+++ sql/handler.h
@@ -3863,18 +3863,6 @@
   }

   LEX_STRING *engine_name() { return hton_name(ht); }
-
-  /*
-    @brief
-    Check whether the engine supports virtual columns
-
-    @retval
-      FALSE   if the engine does not support virtual columns
-    @retval
-      TRUE    if the engine supports virtual columns
-  */
-
-  virtual bool check_if_supported_virtual_columns(void) { return FALSE;}

   TABLE* get_table() { return table; }
   TABLE_SHARE* get_table_share() { return table_share; }


Don't sync prefs::kPerHostZoomLevels

Don't sync prefs::kPerHostZoomLevels

BUG=47359
TEST=verify that page zoom level sync no longer works.

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

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

--- chrome/browser/sync/glue/synchronized_preferences.h
+++ chrome/browser/sync/glue/synchronized_preferences.h
@@ -84,7 +84,8 @@
   prefs::kExtensionsUIDeveloperMode,  // no live update

   // Document menu -> Zoom.
-  prefs::kPerHostZoomLevels,
+  //   prefs::kPerHostZoomLevels creates bad UX when synced, see
+  //   http://crbug.com/47359.

   // Document menu -> Encoding -> Auto Detect.
   prefs::kWebKitUsesUniversalDetector,


add unidirectional function

add unidirectional function

--- cnn/expr-xtra.h
+++ cnn/expr-xtra.h
@@ -109,6 +109,74 @@
     source_embeddings.push_back(concatenate(std::vector<Expression>({ src_fwd[slen-1], src_bwd[slen-1] })));

     Expression src = concatenate_cols(source_embeddings);
+
+    return src;
+}
+
+template<class Builder>
+Expression forward_directional(unsigned & slen, const vector<vector<int>>& source, ComputationGraph& cg, LookupParameters* p_cs, vector<cnn::real>& zero,
+    Builder & encoder_fwd, size_t feat_dim)
+{
+    size_t nutt = source.size();
+    /// get the maximum length of utternace from all speakers
+    slen = 0;
+    for (auto p : source)
+        slen = (slen < p.size()) ? p.size() : slen;
+
+    std::vector<Expression> source_embeddings;
+
+    std::vector<Expression> src_fwd(slen);
+
+    Expression i_x_t;
+
+    for (int t = 0; t < slen; ++t) {
+        vector<Expression> vm;
+        for (size_t k = 0; k < nutt; k++)
+        {
+            if (source[k].size() > t)
+                vm.push_back(lookup(cg, p_cs, source[k][t]));
+            else
+                vm.push_back(input(cg, { (long)feat_dim }, &zero));
+        }
+        i_x_t = concatenate_cols(vm);
+        src_fwd[t] = encoder_fwd.add_input(i_x_t);
+    }
+
+    Expression src = concatenate_cols(src_fwd);
+
+    return src;
+}
+
+template<class Builder>
+Expression backward_directional(unsigned & slen, const vector<vector<int>>& source, ComputationGraph& cg, LookupParameters* p_cs, vector<cnn::real>& zero,
+    Builder& encoder_bwd, size_t feat_dim)
+{
+    size_t nutt = source.size();
+    /// get the maximum length of utternace from all speakers
+    slen = 0;
+    for (auto p : source)
+        slen = (slen < p.size()) ? p.size() : slen;
+
+    std::vector<Expression> source_embeddings;
+
+    std::vector<Expression> src_bwd(slen);
+
+    Expression i_x_t;
+
+    for (int t = slen - 1; t >= 0; --t) {
+        vector<Expression> vm;
+        for (size_t k = 0; k < nutt; k++)
+        {
+            if (source[k].size() > t)
+                vm.push_back(lookup(cg, p_cs, source[k][t]));
+            else
+                vm.push_back(input(cg, { (long)feat_dim }, &zero));
+        }
+        i_x_t = concatenate_cols(vm);
+        src_bwd[t] = encoder_bwd.add_input(i_x_t);
+    }
+
+    Expression src = concatenate_cols(src_bwd);

     return src;
 }


Address another Windows issue.

Address another Windows issue.

--- programs/daytime_server.c
+++ programs/daytime_server.c
@@ -101,7 +101,7 @@
 		}
 		time(&now);
 #ifdef _WIN32
-		_snprintf(buffer, sizeof(buffer), _TRUNCATE, "%s", ctime(&now));
+		_snprintf(buffer, sizeof(buffer), "%s", ctime(&now));
 #else
 		snprintf(buffer, sizeof(buffer), "%s", ctime(&now));
 #endif


tests/getteximage: test more texture sizes, including npot

--- progs/tests/getteximage.c
+++ progs/tests/getteximage.c
@@ -15,7 +15,7 @@

 static void
-TestGetTexImage(void)
+TestGetTexImage(GLboolean npot)
 {
    GLuint iter;
    GLubyte *data = (GLubyte *) malloc(1024 * 1024 * 4);
@@ -27,8 +27,8 @@

    for (iter = 0; iter < 8; iter++) {
       GLint p = (iter % 8) + 3;
-      GLint w = (1 << p);
-      GLint h = (1 << p);
+      GLint w = npot ? (p * 20) : (1 << p);
+      GLint h = npot ? (p * 10) : (1 << p);
       GLuint i;
       GLint level = 0;

@@ -83,63 +83,94 @@

 static void
-TestGetTexImageRTT(void)
+TestGetTexImageRTT(GLboolean npot)
 {
    GLuint iter;
-   GLuint fb, tex;
-   GLint w = 512;
-   GLint h = 256;
-   GLint level = 0;
-
-   glGenTextures(1, &tex);
-   glGenFramebuffersEXT(1, &fb);
-
-   glBindTexture(GL_TEXTURE_2D, tex);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0,
-                GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
-   glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
-                             GL_TEXTURE_2D, tex, level);

    printf("Render to texture + glGetTexImage:\n");
-   printf("  Testing %d x %d tex image\n", w, h);
+
    for (iter = 0; iter < 8; iter++) {
-      GLubyte color[4];
-      GLubyte *data2 = (GLubyte *) malloc(w * h * 4);
-      GLuint i;
-
-      /* random clear color */
-      for (i = 0; i < 4; i++) {
-         color[i] = rand() % 256;
-      }
-
-      glClearColor(color[0] / 255.0,
-                   color[1] / 255.0,
-                   color[2] / 255.0,
-                   color[3] / 255.0);
-
-      glClear(GL_COLOR_BUFFER_BIT);
-
-      /* get */
-      glGetTexImage(GL_TEXTURE_2D, level, GL_RGBA, GL_UNSIGNED_BYTE, data2);
-
-      /* compare */
-      for (i = 0; i < w * h; i += 4) {
-         if (!ColorsEqual(color, data2 + i * 4)) {
-            printf("Render to texture failure!\n");
-            abort();
+
+      GLuint fb, tex;
+      GLint w, h;
+      GLint level = 0;
+
+      if (npot) {
+         w = 200 + iter * 40;
+         h = 200 + iter * 12;
+      }
+      else {
+         w = 4 << iter;
+         h = 4 << iter;
+      }
+
+      glGenTextures(1, &tex);
+      glGenFramebuffersEXT(1, &fb);
+
+      glBindTexture(GL_TEXTURE_2D, tex);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0,
+                   GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
+      glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+                                GL_TEXTURE_2D, tex, level);
+
+      glViewport(0, 0, w, h);
+
+      printf("  Testing %d x %d tex image\n", w, h);
+      {
+         static const GLubyte blue[4] = {0, 0, 255, 255};
+         GLubyte color[4];
+         GLubyte *data2 = (GLubyte *) malloc(w * h * 4);
+         GLuint i;
+
+         /* random clear color */
+         for (i = 0; i < 4; i++) {
+            color[i] = rand() % 256;
          }
-      }
-
-      free(data2);
-   }
-
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-   glDeleteFramebuffersEXT(1, &fb);
-   glDeleteTextures(1, &tex);
+
+         glClearColor(color[0] / 255.0,
+                      color[1] / 255.0,
+                      color[2] / 255.0,
+                      color[3] / 255.0);
+
+         glClear(GL_COLOR_BUFFER_BIT);
+
+         /* draw polygon over top half, in blue */
+         glColor4ubv(blue);
+         glRectf(0, 0.5, 1.0, 1.0);
+
+         /* get */
+         glGetTexImage(GL_TEXTURE_2D, level, GL_RGBA, GL_UNSIGNED_BYTE, data2);
+
+         /* compare */
+         for (i = 0; i < w * h; i += 4) {
+            if (i < w * h / 2) {
+               /* lower half */
+               if (!ColorsEqual(color, data2 + i * 4)) {
+                  printf("Render to texture failure (expected clear color)!\n");
+                  abort();
+               }
+            }
+            else {
+               /* upper half */
+               if (!ColorsEqual(blue, data2 + i * 4)) {
+                  printf("Render to texture failure (expected blue)!\n");
+                  abort();
+               }
+            }
+         }
+
+         free(data2);
+      }
+
+      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+      glDeleteFramebuffersEXT(1, &fb);
+      glDeleteTextures(1, &tex);
+
+   }

    printf("Passed\n");
 }
@@ -152,11 +183,16 @@
 {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

-   TestGetTexImage();
+   TestGetTexImage(GL_FALSE);
+   if (glutExtensionSupported("GL_ARB_texture_non_power_of_two"))
+      TestGetTexImage(GL_TRUE);

    if (glutExtensionSupported("GL_EXT_framebuffer_object") ||
-       glutExtensionSupported("GL_ARB_framebuffer_object"))
-      TestGetTexImageRTT();
+       glutExtensionSupported("GL_ARB_framebuffer_object")) {
+      TestGetTexImageRTT(GL_FALSE);
+      if (glutExtensionSupported("GL_ARB_texture_non_power_of_two"))
+         TestGetTexImageRTT(GL_TRUE);
+   }

    glutDestroyWindow(Win);
    exit(0);
@@ -171,10 +207,10 @@
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
-   glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+   glOrtho(0, 1, 0, 1, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
-   glTranslatef(0.0, 0.0, -15.0);
+   glTranslatef(0.0, 0.0, 0.0);
 }


remove unused variable from State

remove unused variable from State

--- proxy/http/HttpTransact.h
+++ proxy/http/HttpTransact.h
@@ -915,7 +915,6 @@
     RedirectInfo redirect_info;
     unsigned int updated_server_version;
     bool is_revalidation_necessary;     //Added to check if revalidation is necessary - YTS Team, yamsat
-    int HashTable_Tries;        // To limit hash tries - YTS Team, yamsat
     bool request_will_not_selfloop;     // To determine if process done - YTS Team, yamsat
     ConnectionAttributes client_info;
     ConnectionAttributes icp_info;
@@ -1067,7 +1066,6 @@
     State()
       : m_magic(HTTP_TRANSACT_MAGIC_ALIVE), state_machine(NULL), http_config_param(NULL), force_dns(false),
         updated_server_version(HostDBApplicationInfo::HTTP_VERSION_UNDEFINED), is_revalidation_necessary(false),
-        HashTable_Tries(0),             //YTS Team, yamsat
         request_will_not_selfloop(false),       //YTS Team, yamsat
         source(SOURCE_NONE),
         req_flavor(REQ_FLAVOR_FWDPROXY),


Fixed previous commit

Fixed previous commit

git-svn-id: 5a113f46df058f8047e288f4f3e948d899353d9a@32 410355f2-c4ea-45de-a5b5-301721f902b9

--- prs/src/mixerautomation.h
+++ prs/src/mixerautomation.h
@@ -39,6 +39,7 @@
 typedef struct {
   mixer *m;

+  pthread_mutex_t mut;
   int running;
   pthread_t automation_thread;
   double last_event_time;


add C implementation of Hernquist potential

--- galpy/potential_src/potential_c_ext/galpy_potentials.h
+++ galpy/potential_src/potential_c_ext/galpy_potentials.h
@@ -56,3 +56,12 @@
 				     int, double *);
 double PowerSphericalPotentialPlanarR2deriv(double ,double, double,
 					    int , double *);
+//HernquistPotential
+double HernquistPotentialRforce(double ,double , double, double,
+				     int , double *);
+double HernquistPotentialPlanarRforce(double ,double, double,
+					   int , double *);
+double HernquistPotentialzforce(double,double,double,double,
+				     int, double *);
+double HernquistPotentialPlanarR2deriv(double ,double, double,
+					    int , double *);


debug

debug

--- galpy/potential_src/potential_c_ext/galpy_potentials.h
+++ galpy/potential_src/potential_c_ext/galpy_potentials.h
@@ -7,11 +7,8 @@
 double zeroForce(double,int, double);
 //LogarithmicHaloPotential
 double LogarithmicHaloPotentialRforce(double ,double , double ,
-				      int , double *,
-				      double * );
+				      int , double *);
 double LogarithmicHaloPotentialPlanarRforce(double ,double ,
-					    int , double *,
-					    double * );
+					    int , double *);
 double LogarithmicHaloPotentialzforce(double,double,double,
-				      int, double,
-				      double *);
+				      int, double *);


Reuse the "turn WS into VSB" code.

Reuse the "turn WS into VSB" code.

--- bin/varnishd/cache/cache_vrt_filter.c
+++ bin/varnishd/cache/cache_vrt_filter.c
@@ -219,13 +219,51 @@
 /*--------------------------------------------------------------------
  */

-static void
-vbf_default_filter_list(const struct busyobj *bo, struct vsb *vsb)
-{
+typedef void filter_list_t(const void *, struct vsb *vsb);
+
+static const char *
+filter_on_ws(struct ws *ws, filter_list_t *func, const void *arg)
+{
+	unsigned u;
+	struct vsb vsb[1];
+
+	AN(func);
+	AN(arg);
+	u = WS_Reserve(ws, 0);
+	if (u == 0) {
+		WS_Release(ws, 0);
+		WS_MarkOverflow(ws);
+		return (NULL);
+	}
+	AN(VSB_new(vsb, ws->f, u, VSB_FIXEDLEN));
+	func(arg, vsb);
+	if (VSB_finish(vsb)) {
+		WS_Release(ws, 0);
+		WS_MarkOverflow(ws);
+		return (NULL);
+	}
+	if (VSB_len(vsb)) {
+		WS_Release(ws, VSB_len(vsb) + 1);
+		return (VSB_data(vsb) + 1);
+	}
+	WS_Release(ws, 0);
+	return ("");
+}
+
+/*--------------------------------------------------------------------
+ */
+
+static void v_matchproto_(filter_list_t)
+vbf_default_filter_list(const void *arg, struct vsb *vsb)
+{
+	const struct busyobj *bo;
 	const char *p;
-	int do_gzip = bo->do_gzip;
-	int do_gunzip = bo->do_gunzip;
-	int is_gzip = 0, is_gunzip = 0;
+	int do_gzip, do_gunzip, is_gzip = 0, is_gunzip = 0;
+
+	CAST_OBJ_NOTNULL(bo, arg, BUSYOBJ_MAGIC);
+
+	do_gzip = bo->do_gzip;
+	do_gunzip = bo->do_gunzip;

 	/*
 	 * The VCL variables beresp.do_g[un]zip tells us how we want the
@@ -282,36 +320,28 @@
 const char *
 VBF_Get_Filter_List(struct busyobj *bo)
 {
-	unsigned u;
-	struct vsb vsb[1];

 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	u = WS_Reserve(bo->ws, 0);
-	if (u == 0) {
-		WS_Release(bo->ws, 0);
-		WS_MarkOverflow(bo->ws);
-		return (NULL);
-	}
-	AN(VSB_new(vsb, bo->ws->f, u, VSB_FIXEDLEN));
-	vbf_default_filter_list(bo, vsb);
-	if (VSB_finish(vsb)) {
-		WS_Release(bo->ws, 0);
-		WS_MarkOverflow(bo->ws);
-		return (NULL);
-	}
-	if (VSB_len(vsb)) {
-		WS_Release(bo->ws, VSB_len(vsb) + 1);
-		return (VSB_data(vsb) + 1);
-	}
-	WS_Release(bo->ws, 0);
-	return ("");
+	return (filter_on_ws(bo->ws, vbf_default_filter_list, bo));
+}
+
+/*--------------------------------------------------------------------
+ */
+
+static void v_matchproto_(filter_list_t)
+resp_default_filter_list(const void *arg, struct vsb *vsb)
+{
+	const struct req *req;
+
+	CAST_OBJ_NOTNULL(req, arg, REQ_MAGIC);
+	(void)vsb;
 }

 static const char *
 resp_Get_Filter_List(struct req *req)
 {
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	return ("");
+	return (filter_on_ws(req->ws, resp_default_filter_list, req));
 }

 /*--------------------------------------------------------------------*/


notes

notes

--- src/plugins/c/sensors/src/mf_sensors_connector.c
+++ src/plugins/c/sensors/src/mf_sensors_connector.c
@@ -25,6 +25,9 @@

 #define SUCCESS 1
 #define FAILURE 0
+
+// https://searchcode.com/codesearch/view/68001947/#l-290
+// http://dev.man-online.org/man3/libsensors/

 /*******************************************************************************
  * Variable Declarations


* 去掉无用的头文件引用

* 去掉无用的头文件引用

--- content/browser/WebPage.h
+++ content/browser/WebPage.h
@@ -7,7 +7,6 @@
 #include "third_party/WebKit/Source/platform/geometry/IntRect.h"
 #include "third_party/WebKit/Source/wtf/FastAllocBase.h"
 #include "third_party/WebKit/public/web/WebViewClient.h"
-#include "KdPageInfo.h"

 class CefBrowserHostImpl;


Use the 'DenseIterator' class template for the 'StaticVector' iterators

--- blaze/math/dense/StaticVector.h
+++ blaze/math/dense/StaticVector.h
@@ -42,9 +42,9 @@

 #include <algorithm>
 #include <stdexcept>
+#include <blaze/math/dense/DenseIterator.h>
 #include <blaze/math/expressions/DenseVector.h>
 #include <blaze/math/Forward.h>
-#include <blaze/math/Functions.h>
 #include <blaze/math/Intrinsics.h>
 #include <blaze/math/shims/IsDefault.h>
 #include <blaze/math/shims/Reset.h>
@@ -68,11 +68,9 @@
 #include <blaze/util/constraints/Volatile.h>
 #include <blaze/util/DisableIf.h>
 #include <blaze/util/EnableIf.h>
-#include <blaze/util/mpl/If.h>
 #include <blaze/util/StaticAssert.h>
 #include <blaze/util/Template.h>
 #include <blaze/util/Types.h>
-#include <blaze/util/typetraits/IsFloatingPoint.h>
 #include <blaze/util/typetraits/IsNumeric.h>
 #include <blaze/util/typetraits/IsSame.h>
 #include <blaze/util/typetraits/IsVectorizable.h>
@@ -170,17 +168,17 @@

  public:
    //**Type definitions****************************************************************************
-   typedef StaticVector<Type,N,TF>   This;            //!< Type of this StaticVector instance.
-   typedef This                      ResultType;      //!< Result type for expression template evaluations.
-   typedef StaticVector<Type,N,!TF>  TransposeType;   //!< Transpose type for expression template evaluations.
-   typedef Type                      ElementType;     //!< Type of the vector elements.
-   typedef typename IT::Type         IntrinsicType;   //!< Intrinsic type of the vector elements.
-   typedef const Type&               ReturnType;      //!< Return type for expression template evaluations.
-   typedef const StaticVector&       CompositeType;   //!< Data type for composite expression templates.
-   typedef Type&                     Reference;       //!< Reference to a non-constant vector value.
-   typedef const Type&               ConstReference;  //!< Reference to a constant vector value.
-   typedef Type*                     Iterator;        //!< Iterator over non-constant elements.
-   typedef const Type*               ConstIterator;   //!< Iterator over constant elements.
+   typedef StaticVector<Type,N,TF>    This;            //!< Type of this StaticVector instance.
+   typedef This                       ResultType;      //!< Result type for expression template evaluations.
+   typedef StaticVector<Type,N,!TF>   TransposeType;   //!< Transpose type for expression template evaluations.
+   typedef Type                       ElementType;     //!< Type of the vector elements.
+   typedef typename IT::Type          IntrinsicType;   //!< Intrinsic type of the vector elements.
+   typedef const Type&                ReturnType;      //!< Return type for expression template evaluations.
+   typedef const StaticVector&        CompositeType;   //!< Data type for composite expression templates.
+   typedef Type&                      Reference;       //!< Reference to a non-constant vector value.
+   typedef const Type&                ConstReference;  //!< Reference to a constant vector value.
+   typedef DenseIterator<Type>        Iterator;        //!< Iterator over non-constant elements.
+   typedef DenseIterator<const Type>  ConstIterator;   //!< Iterator over constant elements.
    //**********************************************************************************************

    //**Compilation flags***************************************************************************
@@ -827,7 +825,7 @@
         , bool TF >      // Transpose flag
 inline typename StaticVector<Type,N,TF>::Iterator StaticVector<Type,N,TF>::begin()
 {
-   return v_;
+   return Iterator( v_ );
 }
 //*************************************************************************************************

@@ -842,7 +840,7 @@
         , bool TF >      // Transpose flag
 inline typename StaticVector<Type,N,TF>::ConstIterator StaticVector<Type,N,TF>::begin() const
 {
-   return v_;
+   return ConstIterator( v_ );
 }
 //*************************************************************************************************

@@ -857,7 +855,7 @@
         , bool TF >      // Transpose flag
 inline typename StaticVector<Type,N,TF>::ConstIterator StaticVector<Type,N,TF>::cbegin() const
 {
-   return v_;
+   return ConstIterator( v_ );
 }
 //*************************************************************************************************

@@ -872,7 +870,7 @@
         , bool TF >      // Transpose flag
 inline typename StaticVector<Type,N,TF>::Iterator StaticVector<Type,N,TF>::end()
 {
-   return v_ + N;
+   return Iterator( v_ + N );
 }
 //*************************************************************************************************

@@ -887,7 +885,7 @@
         , bool TF >      // Transpose flag
 inline typename StaticVector<Type,N,TF>::ConstIterator StaticVector<Type,N,TF>::end() const
 {
-   return v_ + N;
+   return ConstIterator( v_ + N );
 }
 //*************************************************************************************************

@@ -902,7 +900,7 @@
         , bool TF >      // Transpose flag
 inline typename StaticVector<Type,N,TF>::ConstIterator StaticVector<Type,N,TF>::cend() const
 {
-   return v_ + N;
+   return ConstIterator( v_ + N );
 }
 //*************************************************************************************************


Remove a trailing space

Remove a trailing space

--- Straw/STWCallOperation.h
+++ Straw/STWCallOperation.h
@@ -2,7 +2,7 @@

 /**
  STWCallOperation class performs Straw Service Method Call procedure.
-
+
  The operation is performed in main thread or in background according to Service Method configuration.
  */
 @interface STWCallOperation : NSOperation


changing member variables to protected

changing member variables to protected

--- ANALYSIS/ANALYSISalice/AliAnalysisCuts.h
+++ ANALYSIS/ANALYSISalice/AliAnalysisCuts.h
@@ -33,7 +33,7 @@
     virtual Long64_t Merge(TCollection* /* list */)      { return 0; }
     virtual TList* GetOutput()                { return 0; }
     virtual TObject *GetStatistics(Option_t *) const {return 0;}
- private:
+ protected:
     UInt_t fFilterMask; ///< Mask to use one of the previous decisions inside a filter
     Bool_t fSelected;   ///< Final decision on selction
     ClassDef(AliAnalysisCuts, 5); // Base class for filter decisions on ESD objects


var name fix

var name fix

--- Adapters/MoPub/MPMobFoxNativeAdAdapter.h
+++ Adapters/MoPub/MPMobFoxNativeAdAdapter.h
@@ -30,7 +30,7 @@
  */
 @property (nonatomic, weak) id<MPNativeAdAdapterDelegate> delegate;

-- (instancetype)initWithMobFoxNativeAd:(MobFoxNativeData *)adData;
+- (instancetype)initWithMobFoxNativeAd:(MobFoxNativeData *)ad;

 @end


panel-status: Fix placeholder message

panel-status: Fix placeholder message

Fixes: http://bugs.meego.com/show_bug.cgi?id=1280

--- src/moblin-panel-status.c
+++ src/moblin-panel-status.c
@@ -45,10 +45,10 @@
 #include "mps-view-bridge.h"
 #include "mps-feed-switcher.h"

-#define NEW_PLACEHOLDER_TEXT _("Hello! This is the Status panel." \
-"When you have a web account configured" \
-"(like Twitter) you will be able to view your" \
-"feeds and update your status here")
+#define NEW_PLACEHOLDER_TEXT _( \
+"Hello! This is the Status panel. When you have a web account configured (like Twitter), " \
+"you will be able to view your feeds and update your status here." \
+                              )

 typedef struct _MoblinStatusPanel
 {


each address only handles one connection at a time

git-svn-id: e98c317c6679dcf055eb388f05b44c3a6d6b38c6@1408 152afb58-edef-0310-8abb-c4023f1b3aa9

--- src/mod_proxy_core_pool.c
+++ src/mod_proxy_core_pool.c
@@ -34,7 +34,7 @@
 	 * this should match max-procs if we manage the procs ourself
        	 */

-	pool->max_size = 8;
+	pool->max_size = 1;

 	return pool;
 }


use CheckboxBackgroundView

use CheckboxBackgroundView

--- src/core/server/Classes/Preferences/CheckboxCellView.h
+++ src/core/server/Classes/Preferences/CheckboxCellView.h
@@ -3,9 +3,11 @@
 @import Cocoa;

 @class PreferencesManager;
+@class CheckboxBackgroundView;

 @interface CheckboxCellView : NSTableCellView
 @property(weak) IBOutlet NSButton* checkbox;
+@property(weak) IBOutlet CheckboxBackgroundView* background;
 @property(weak) IBOutlet NSLayoutConstraint* labelLeadingSpace;
 @property(weak) IBOutlet NSLayoutConstraint* labelTopSpace;
 @property(weak) IBOutlet NSLayoutConstraint* labelBottomSpace;


Added Solution

Added Solution

error: pathspec 'Algorithms/Implementation/utopian_tree.c' did not match any file(s) known to git

--- Algorithms/Implementation/utopian_tree.c
+++ Algorithms/Implementation/utopian_tree.c
@@ -0,0 +1,27 @@
+#include<stdio.h>
+
+int main()
+{
+    int j,n,s=1,i,t;
+
+  scanf("%d",&t);
+ for(i=0;i<t;i++)
+  {
+     scanf("%d",&n);
+     //(n==0)
+        //rintf("1\n");
+
+
+       for(j=1;j<=n;j++){
+
+   if(j%2==1)
+       s=2*s;
+       if(j%2==0)
+             s=s+1;
+
+   } printf("%d\n",s);
+     s=1;
+
+ }
+    return 0;
+}


Make --shellvars automatically engage recurse mode

Make recurse mode only recursive if --expand is on

--- uclcmd_get.c
+++ uclcmd_get.c
@@ -220,7 +220,11 @@
 	    command_count);
     }
     if (command_count == 0) {
-	output_chunk(found_object, nodepath, "");
+	if (shvars == 1) {
+		get_cmd_recurse(found_object, "", "recurse", "", 0);
+	} else {
+		output_chunk(found_object, nodepath, "");
+	}
     }
     free(nodepath);
 }
@@ -520,8 +524,8 @@
 	} else {
 	    uclcmd_asprintf(&newkey, "%c%s", output_sepchar, ucl_object_key(cur));
 	}
-	if (ucl_object_type(cur) == UCL_OBJECT ||
-		ucl_object_type(cur) == UCL_ARRAY) {
+	if (expand == 1 && (ucl_object_type(cur) == UCL_OBJECT ||
+		ucl_object_type(cur) == UCL_ARRAY)) {
 	    it2 = NULL;
 	    while ((cur2 = ucl_iterate_object(cur, &it2, false))) {
 		if (nodepath != NULL && strlen(nodepath) > 0) {


Remove conflicting extern decralaration for mboxfile variable. It is defined as static in implementation file.

--- contrib/amd/hlfsd/hlfsd.h
+++ contrib/amd/hlfsd/hlfsd.h
@@ -143,7 +143,6 @@
 extern char *mailbox(int, char *);
 extern char *passwdfile;
 extern char *slinkname;
-extern char mboxfile[];
 extern gid_t hlfs_gid;
 extern int cache_interval;
 extern int noverify;


de-interleave audio, grabbing only the first channel (closes #13)

--- ugen/sndin.c
+++ ugen/sndin.c
@@ -73,6 +73,7 @@
 sndin_get_samples(SndIn *sndin)
 {
 	AVPacket packet;
+	int i, chans, frames;

 	if(sndin->closed || sndin->eof)
 		return;
@@ -97,6 +98,17 @@
 			/* got buf_size bytes! */
 			/* format is int16_t (signed short) */
 			sndin->curr_buf_count = buf_size/sizeof(sndin->audio_buf[0]);
+
+			if(sndin->pCodecCtx->channels > 1) {
+				/* take the first channel */
+				chans = sndin->pCodecCtx->channels;
+				frames = sndin->curr_buf_count / chans;
+				for(i = 0; i < frames; i++)
+					sndin->audio_buf[i] = sndin->audio_buf[i * chans];
+
+				sndin->curr_buf_count = frames;
+			}
+
 			sndin->audio_buf_ptr = 0;
 			return;
 		}


Add a specialization of the 'IsPadded' type trait for the 'HermitianMatrix' class template


popsbr.c: Remove impossible case from switch statement.

Actually, just convert the overkill switch statement into a couple of
if-statements as it's a lot less lines.

--- uip/popsbr.c
+++ uip/popsbr.c
@@ -56,23 +56,16 @@
 	return NOTOK;
     }

-    while ((status = multiline()) != DONE)
-	switch (status) {
-	case NOTOK:
-	    return NOTOK;
-	    break;
-	case DONE:	/* Shouldn't be possible, but just in case */
-	    break;
-	case OK:
-	    if (strncasecmp(response, "SASL ", 5) == 0) {
-		/*
-		 * We've seen the SASL capability.  Grab the mech list
-		 */
-		sasl_capability++;
-		strncpy(server_mechs, response + 5, server_mechs_size);
-	    }
-	    break;
-	}
+    while ((status = multiline()) != DONE) {
+        if (status == NOTOK)
+	    return NOTOK;
+
+        if (strncasecmp(response, "SASL ", 5) == 0) {
+            /* We've seen the SASL capability.  Grab the mech list. */
+            sasl_capability++;
+            strncpy(server_mechs, response + 5, server_mechs_size);
+        }
+    }

     if (!sasl_capability) {
 	snprintf(response, sizeof(response), "POP server does not support "


hide details in macro

hide details in macro

--- bottleneck/src/move2_template.c
+++ bottleneck/src/move2_template.c
@@ -55,11 +55,12 @@
     return _y;

 #define  WHILE   while (_index < _size)
-#define  WHILE0  while (_i < min_count - 1)
+#define  WHILE0  _i = 0; while (_i < min_count - 1)
 #define  WHILE1  while (_i < window)
 #define  WHILE2  while (_i < length)

 #define  AI(dt)    *(dt *)(_pa + _i * stride)
+#define  A0(dt)    *(dt *)(_pa)
 #define  AOLD(dt)  *(dt *)(_pa + (_i - window) * stride)
 #define  YI(dt)    *(dt *)(_py + _i++ * _ystride)

@@ -98,7 +99,7 @@
     Py_ssize_t count;
     npy_DTYPE0 asum, ai, aold;
     WHILE {
-        asum = count = _i = 0;
+        asum = count = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             if (ai == ai) {
@@ -151,7 +152,7 @@
     INIT(NPY_DTYPE1)
     npy_DTYPE1 asum;
     WHILE {
-        asum = _i = 0;
+        asum = 0;
         WHILE0 {
             asum += AI(npy_DTYPE0);
             YI(npy_DTYPE1) = BN_NAN;
@@ -196,7 +197,7 @@
     Py_ssize_t count;
     npy_DTYPE0 asum, ai, aold, count_inv;
     WHILE {
-        asum = count = _i = 0;
+        asum = count = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             if (ai == ai) {
@@ -251,7 +252,7 @@
     INIT(NPY_DTYPE1)
     npy_DTYPE1 asum, window_inv = 1.0 / window;
     WHILE {
-        asum = _i = 0;
+        asum = 0;
         WHILE0 {
             asum += AI(npy_DTYPE0);
             YI(npy_DTYPE1) = BN_NAN;
@@ -297,7 +298,7 @@
     Py_ssize_t count;
     npy_DTYPE0 delta, amean, assqdm, ai, aold, yi, count_inv, ddof_inv;
     WHILE {
-        amean = assqdm = count = _i = 0;
+        amean = assqdm = count = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             if (ai == ai) {
@@ -393,7 +394,7 @@
     npy_DTYPE1 delta, amean, assqdm, yi, ai, aold;
     npy_DTYPE1 window_inv = 1.0 / window, winddof_inv = 1.0 / winddof;
     WHILE {
-        amean = assqdm = _i = 0;
+        amean = assqdm = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             delta = ai - amean;
@@ -453,7 +454,7 @@
     Py_ssize_t count;
     npy_DTYPE0 delta, amean, assqdm, ai, aold, yi, count_inv, ddof_inv;
     WHILE {
-        amean = assqdm = count = _i = 0;
+        amean = assqdm = count = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             if (ai == ai) {
@@ -549,7 +550,7 @@
     npy_DTYPE1 delta, amean, assqdm, yi, ai, aold;
     npy_DTYPE1 window_inv = 1.0 / window, winddof_inv = 1.0 / winddof;
     WHILE {
-        amean = assqdm = _i = 0;
+        amean = assqdm = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             delta = ai - amean;
@@ -636,11 +637,11 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        count = _i = 0;
+        count = 0;
         end = ring + window;
         last = ring;
         minpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         minpair->value = ai == ai ? ai : BN_INFINITY;
         minpair->death = window;
         WHILE0 {
@@ -706,11 +707,10 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        _i = 0;
         end = ring + window;
         last = ring;
         minpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         minpair->value = ai;
         minpair->death = window;
         WHILE0 {
@@ -793,11 +793,11 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        count = _i = 0;
+        count = 0;
         end = ring + window;
         last = ring;
         maxpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         maxpair->value = ai == ai ? ai : -BN_INFINITY;
         maxpair->death = window;
         WHILE0 {
@@ -863,11 +863,10 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        _i = 0;
         end = ring + window;
         last = ring;
         maxpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         maxpair->value = ai;
         maxpair->death = window;
         WHILE0 {
@@ -928,11 +927,11 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        count = _i = 0;
+        count = 0;
         end = ring + window;
         last = ring;
         minpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         minpair->value = ai == ai ? ai : BN_INFINITY;
         minpair->death = window;
         WHILE0 {
@@ -977,11 +976,10 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        _i = 0;
         end = ring + window;
         last = ring;
         minpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         minpair->value = ai;
         minpair->death = window;
         WHILE0 {
@@ -1042,11 +1040,11 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        count = _i = 0;
+        count = 0;
         end = ring + window;
         last = ring;
         maxpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         maxpair->value = ai == ai ? ai : -BN_INFINITY;
         maxpair->death = window;
         WHILE0 {
@@ -1091,11 +1089,10 @@
     pairs *last;
     ring = (pairs *)malloc(window * sizeof(pairs));
     WHILE {
-        _i = 0;
         end = ring + window;
         last = ring;
         maxpair = ring;
-        ai = AI(npy_DTYPE0);
+        ai = A0(npy_DTYPE0);
         maxpair->value = ai;
         maxpair->death = window;
         WHILE0 {
@@ -1155,7 +1152,6 @@
         MEMORY_ERR("Could not allocate memory for move_median");
     }
     WHILE {
-        _i = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             YI(npy_DTYPE0) = mm_update_init_nan(mm, ai);
@@ -1194,7 +1190,6 @@
         MEMORY_ERR("Could not allocate memory for move_median");
     }
     WHILE {
-        _i = 0;
         WHILE0 {
             ai = AI(npy_DTYPE0);
             YI(npy_DTYPE1) = mm_update_init(mm, ai);


[x2t] Fix writing corrupted xlsx

[x2t] Fix writing corrupted xlsx

--- Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h
+++ Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h
@@ -149,11 +149,10 @@
 					m_oDefinedNames->toXML(writer);
 				if(m_oCalcPr.IsInit())
 					m_oCalcPr->toXML(writer);
+				if(m_oPivotCachesXml.IsInit())
+					writer.WriteString(m_oPivotCachesXml.get());
 				if(m_oExtLst.IsInit())
 					writer.WriteString(m_oExtLst->toXMLWithNS(L""));
-
-				if(m_oPivotCachesXml.IsInit())
-					writer.WriteString(m_oPivotCachesXml.get());
 				writer.WriteString(L"</workbook>");
 			}
 			virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)


drbd: Fix the WO=drain implementation for multiple volumes

Wait until IO is drained in all volumes.

Signed-off-by: Philipp Reisner <35a55a4ac466b5abd81eb66f3f7d6a972dd0dc24@linbit.com>
Signed-off-by: Lars Ellenberg <31df9cacdc65c624cc60c2dcd22bbf92dc230e16@linbit.com>

--- drivers/block/drbd/drbd_receiver.c
+++ drivers/block/drbd/drbd_receiver.c
@@ -1334,6 +1334,22 @@
 		wake_up(&mdev->misc_wait);
 }

+void conn_wait_active_ee_empty(struct drbd_tconn *tconn)
+{
+	struct drbd_conf *mdev;
+	int vnr;
+
+	rcu_read_lock();
+	idr_for_each_entry(&tconn->volumes, mdev, vnr) {
+		kref_get(&mdev->kref);
+		rcu_read_unlock();
+		drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
+		kref_put(&mdev->kref, &drbd_minor_destroy);
+		rcu_read_lock();
+	}
+	rcu_read_unlock();
+}
+
 static int receive_Barrier(struct drbd_tconn *tconn, struct packet_info *pi)
 {
 	struct drbd_conf *mdev;
@@ -1372,7 +1388,7 @@

 	case WO_bdev_flush:
 	case WO_drain_io:
-		drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
+		conn_wait_active_ee_empty(tconn);
 		drbd_flush(tconn);

 		if (atomic_read(&tconn->current_epoch->epoch_size)) {


Revert "change the private data member in  LaplacianInferenceMethod"

This reverts commit 1fa15175c10b53a5e4066035e139fd8358d70343.

--- src/shogun/machine/gp/LaplacianInferenceMethod.h
+++ src/shogun/machine/gp/LaplacianInferenceMethod.h
@@ -283,6 +283,8 @@

 private:
 	void init();
+
+protected:
 	/** amount of tolerance for Newton's iterations */
 	float64_t m_tolerance;

@@ -295,7 +297,6 @@
 	/** max iterations for Brent's minimization method */
 	float64_t m_opt_max;

-protected:
 	/** mean vector of the approximation to the posterior */
 	SGVector<float64_t> m_mu;


It's called pure virtual for a reason. (Fingers crossed.)

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@12184 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- WebCore/page/Frame.h
+++ WebCore/page/Frame.h
@@ -807,7 +807,7 @@
   virtual WebCore::BrowserExtension* createBrowserExtension() = 0;
   virtual void setTitle(const DOM::DOMString &) = 0;
   virtual void handledOnloadEvents() = 0;
-  virtual QString userAgent() const;
+  virtual QString userAgent() const = 0;
   virtual QString incomingReferrer() const = 0;
   virtual QString mimeTypeForFileName(const QString &) const = 0;
   virtual void clearRecordedFormValues() = 0;
@@ -820,7 +820,7 @@
   virtual void addMessageToConsole(const DOM::DOMString& message,  unsigned int lineNumber, const DOM::DOMString& sourceID) = 0;
   virtual void runJavaScriptAlert(const DOM::DOMString& message) = 0;
   virtual bool runJavaScriptConfirm(const DOM::DOMString& message) = 0;
-  virtual bool runJavaScriptPrompt(const DOM::DOMString& message, const DOM::DOMString& defaultValue, DOM::DOMString& result);
+  virtual bool runJavaScriptPrompt(const DOM::DOMString& message, const DOM::DOMString& defaultValue, DOM::DOMString& result) = 0;
   virtual bool locationbarVisible() = 0;
   virtual bool menubarVisible() = 0;
   virtual bool personalbarVisible() = 0;
@@ -849,7 +849,7 @@
   virtual bool canGoBackOrForward(int distance) const = 0;
   virtual void openURLRequest(const KURL &, const WebCore::URLArgs &) = 0;
   virtual void submitForm(const KURL &, const WebCore::URLArgs &) = 0;
-  virtual void urlSelected(const KURL &url, int button, int state, const WebCore::URLArgs &args);
+  virtual void urlSelected(const KURL &url, int button, int state, const WebCore::URLArgs &args) = 0;
   virtual ObjectContents *createPart(const khtml::ChildFrame &child, const KURL &url, const QString &mimeType) = 0;
   virtual bool passSubframeEventToSubframe(DOM::NodeImpl::MouseEvent &) = 0;
   virtual bool passWheelEventToChildWidget(DOM::NodeImpl *) = 0;


clk: spear3xx: Use proper control register offset

The control register is at offset 0x10, not 0x0. This is wreckaged
since commit 5df33a62c (SPEAr: Switch to common clock framework).

Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Acked-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@linaro.org>
Signed-off-by: Mike Turquette <6dab61939fc5e23761050a66932f032dceda5ebf@linaro.org>

--- drivers/clk/spear/spear3xx_clock.c
+++ drivers/clk/spear/spear3xx_clock.c
@@ -211,7 +211,7 @@
 /* array of all spear 320 clock lookups */
 #ifdef CONFIG_MACH_SPEAR320

-#define SPEAR320_CONTROL_REG		(soc_config_base + 0x0000)
+#define SPEAR320_CONTROL_REG		(soc_config_base + 0x0010)
 #define SPEAR320_EXT_CTRL_REG		(soc_config_base + 0x0018)

 	#define SPEAR320_UARTX_PCLK_MASK		0x1


fix WIN32

fix WIN32

git-svn-id: bd6e61130530ab01186c33a20f55445ba6f1e843@59203 954022d7-b5bf-4e40-9824-e11837661b57

--- ASCOfficePPTXFile/ASCOfficePPTXFileComInterface.h
+++ ASCOfficePPTXFile/ASCOfficePPTXFileComInterface.h
@@ -6,7 +6,7 @@

 #include "../Common/OfficeFileTemplate.h"
 #include "ASCOfficePPTXFile.h"
-
+#include "../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
 #include "../Common/DocxFormat/Source/SystemUtility/File.h"

 void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder);
@@ -194,38 +194,40 @@
 }
 bool comExtractFile(void* pArg, CString& sFile, CString& sDir)
 {
-	OfficeUtils::IOfficeUtils* pOfficeUtils	= NULL;
-
-	if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
-		return false;
+	COfficeUtils *pOfficeUtils = new COfficeUtils(NULL);
+	if (pOfficeUtils == NULL) return false;

 	BSTR bsFile = sFile.AllocSysString();
 	BSTR bsDir = sDir.AllocSysString();
+
 	HRESULT hr = pOfficeUtils->ExtractToDirectory( bsFile, bsDir, NULL, 0);
+
 	SysFreeString(bsFile);
 	SysFreeString(bsDir);
+
+	delete pOfficeUtils;
 	if(hr != S_OK)
 		return false;

-	RELEASEINTERFACE(pOfficeUtils);
 	return true;
 }
 bool comCompressFile(void* pArg, CString& sDir, CString& sFile)
 {
-	OfficeUtils::IOfficeUtils* pOfficeUtils	= NULL;
-
-	if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
-		return false;
-
+	COfficeUtils *pOfficeUtils = new COfficeUtils(NULL);
+	if (pOfficeUtils == NULL) return false;
+
 	BSTR bsDir = sDir.AllocSysString();
 	BSTR bsFile = sFile.AllocSysString();
+
 	HRESULT hr = pOfficeUtils->CompressFileOrDirectory( bsDir, bsFile, -1 );
+
 	SysFreeString(bsDir);
 	SysFreeString(bsFile);
+
+	delete pOfficeUtils;
+
 	if(hr != S_OK)
 		return false;
-
-	RELEASEINTERFACE(pOfficeUtils);
 	return true;
 }
 bool comProgress(void* pArg, long ID, long Percent)


drivers: counter: Modify set top value api.

patch modifies the set top value api to return error only
when ticks passed from application is not equal top value
supported by hardware.

Signed-off-by: Savinay Dharmappa <b9bdbfc60b49ae384b99e3313b3f20d055baeacb@intel.com>

--- drivers/counter/counter_rtc_qmsi.c
+++ drivers/counter/counter_rtc_qmsi.c
@@ -94,7 +94,17 @@
 			     counter_top_callback_t callback,
 			     void *user_data)
 {
-	return -ENODEV;
+	const struct counter_config_info *info = dev->config->config_info;
+
+	ARG_UNUSED(dev);
+	ARG_UNUSED(callback);
+	ARG_UNUSED(user_data);
+
+	if (ticks != info->max_top_value) {
+		return -ENOTSUP;
+	} else {
+		return 0;
+	}
 }

 static int rtc_qmsi_set_alarm(struct device *dev, u8_t chan_id,


[PATCH] cpufreq_ondemand: Warn if it cannot run due to too long transition latency

Display a warning if the ondemand governor can not be selected due to a
transition latency of the cpufreq driver which is too long.

Signed-off-by: Eric Piel <ad57e93856f954923ffcaaaf48c591840edd8ae8@tremplin-utc.net>
Acked-by: Venkatesh Pallipadi <6b7ddbe82beec4500037cfc9bc14de0a76fca340@intel.com>
Signed-off-by: Dominik Brodowski <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@dominikbrodowski.net>

--- drivers/cpufreq/cpufreq_ondemand.c
+++ drivers/cpufreq/cpufreq_ondemand.c
@@ -395,8 +395,11 @@
 			return -EINVAL;

 		if (policy->cpuinfo.transition_latency >
-				(TRANSITION_LATENCY_LIMIT * 1000))
+				(TRANSITION_LATENCY_LIMIT * 1000)) {
+			printk(KERN_WARNING "ondemand governor failed to load "
+			       "due to too long transition latency\n");
 			return -EINVAL;
+		}
 		if (this_dbs_info->enable) /* Already enabled */
 			break;


crypto/dpaa_sec: fix auth-cipher check for AEAD

The code shall also check aead as non auth-cipher case

Fixes: 1f14d500bce1 ("crypto/dpaa_sec: support IPsec protocol offload")
Cc: stable@dpdk.org

Signed-off-by: Vakul Garg <f516ce29719b5820d33bb10d114ab6dad5fab601@nxp.com>
Acked-by: Akhil Goyal <74d7c4c993a22c1d4f60c46ff3d95c969a24a25c@nxp.com>

--- drivers/crypto/dpaa_sec/dpaa_sec.c
+++ drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -266,7 +266,8 @@
 	return ((ses->cipher_alg != RTE_CRYPTO_CIPHER_NULL) &&
 		(ses->auth_alg != RTE_CRYPTO_AUTH_NULL) &&
 		(ses->proto_alg != RTE_SECURITY_PROTOCOL_PDCP) &&
-		(ses->proto_alg != RTE_SECURITY_PROTOCOL_IPSEC));
+		(ses->proto_alg != RTE_SECURITY_PROTOCOL_IPSEC) &&
+		(ses->aead_alg == 0));
 }

 static inline int is_proto_ipsec(dpaa_sec_session *ses)


drm/radeon: gcc fixes for rv6xx dpm

drm/radeon: gcc fixes for rv6xx dpm

Newer versions of gcc seem to wander off into the
weeds when dealing with variable sizes arrays in
structs.  Rather than indexing the arrays, use
pointer arithmetic.

See bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=66932
https://bugs.freedesktop.org/show_bug.cgi?id=66972
https://bugs.freedesktop.org/show_bug.cgi?id=66945

Signed-off-by: Alex Deucher <08dc22c6156113f2deff178e35e3ed9b24d6af9e@amd.com>

--- drivers/gpu/drm/radeon/rv6xx_dpm.c
+++ drivers/gpu/drm/radeon/rv6xx_dpm.c
@@ -1918,6 +1918,7 @@
 			 (power_state->v1.ucNonClockStateIndex *
 			  power_info->pplib.ucNonClockSize));
 		if (power_info->pplib.ucStateEntrySize - 1) {
+			u8 *idx;
 			ps = kzalloc(sizeof(struct rv6xx_ps), GFP_KERNEL);
 			if (ps == NULL) {
 				kfree(rdev->pm.dpm.ps);
@@ -1926,12 +1927,12 @@
 			rdev->pm.dpm.ps[i].ps_priv = ps;
 			rv6xx_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i],
 							 non_clock_info);
+			idx = (u8 *)&power_state->v1.ucClockStateIndices[0];
 			for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) {
 				clock_info = (union pplib_clock_info *)
 					(mode_info->atom_context->bios + data_offset +
 					 le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) +
-					 (power_state->v1.ucClockStateIndices[j] *
-					  power_info->pplib.ucClockInfoSize));
+					 (idx[j] * power_info->pplib.ucClockInfoSize));
 				rv6xx_parse_pplib_clock_info(rdev,
 							     &rdev->pm.dpm.ps[i], j,
 							     clock_info);


[media] it913x v1.25 support different for remotes

Support for different types of remote.

ITE remotes share common device IDs with differently assigned keys.

Two versions of remote maps have been created there are likely to be more.
v1 for all other IDs
v2 for USB_PID_ITETECH_IT9135_9005.

This patch also separates the configuration parts from it913x_identify_state function.

TODO
remotes for HID interfaces.

Signed-off-by: Malcolm Priestley <123fd39c698f702285d09eaebae85efdff081c95@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>

--- drivers/media/dvb/dvb-usb/it913x.c
+++ drivers/media/dvb/dvb-usb/it913x.c
@@ -429,24 +429,74 @@
 	return 0;
 }

+static void it913x_select_remote(struct usb_device *udev,
+	struct dvb_usb_device_properties *props)
+{
+	switch (le16_to_cpu(udev->descriptor.idProduct)) {
+	case USB_PID_ITETECH_IT9135_9005:
+		props->rc.core.rc_codes = RC_MAP_IT913X_V2;
+		return;
+	default:
+		props->rc.core.rc_codes = RC_MAP_IT913X_V1;
+	}
+	return;
+}
+
 #define TS_MPEG_PKT_SIZE	188
 #define EP_LOW			21
 #define TS_BUFFER_SIZE_PID	(EP_LOW*TS_MPEG_PKT_SIZE)
 #define EP_HIGH			348
 #define TS_BUFFER_SIZE_MAX	(EP_HIGH*TS_MPEG_PKT_SIZE)

-static int it913x_identify_state(struct usb_device *udev,
-		struct dvb_usb_device_properties *props,
-		struct dvb_usb_device_description **desc,
-		int *cold)
-{
-	int ret = 0, firm_no;
-	u8 reg, remote;
-
-	firm_no = it913x_return_status(udev);
-
-	/* checnk for dual mode */
-	it913x_config.dual_mode =  it913x_read_reg(udev, 0x49c5);
+static int it913x_select_config(struct usb_device *udev,
+	struct dvb_usb_device_properties *props)
+{
+	int ret = 0, reg;
+	bool proprietary_ir = false;
+
+	if (it913x_config.chip_ver == 0x02
+			&& it913x_config.chip_type == 0x9135)
+		reg = it913x_read_reg(udev, 0x461d);
+	else
+		reg = it913x_read_reg(udev, 0x461b);
+
+	if (reg < 0)
+		return reg;
+
+	if (reg == 0) {
+		it913x_config.dual_mode = 0;
+		it913x_config.tuner_id_0 = IT9135_38;
+		proprietary_ir = true;
+	} else {
+		/* TS mode */
+		reg =  it913x_read_reg(udev, 0x49c5);
+		if (reg < 0)
+			return reg;
+		it913x_config.dual_mode = reg;
+
+		/* IR mode type */
+		reg = it913x_read_reg(udev, 0x49ac);
+		if (reg < 0)
+			return reg;
+		if (reg == 5) {
+			info("Remote propriety (raw) mode");
+			proprietary_ir = true;
+		} else if (reg == 1) {
+			info("Remote HID mode NOT SUPPORTED");
+			proprietary_ir = false;
+			props->rc.core.rc_codes = NULL;
+		} else
+			props->rc.core.rc_codes = NULL;
+
+		/* Tuner_id */
+		reg = it913x_read_reg(udev, 0x49d0);
+		if (reg < 0)
+			return reg;
+		it913x_config.tuner_id_0 = reg;
+	}
+
+	if (proprietary_ir)
+		it913x_select_remote(udev, props);

 	if (udev->speed != USB_SPEED_HIGH) {
 		props->adapter[0].fe[0].pid_filter_count = 5;
@@ -461,17 +511,6 @@
 		if(props->adapter[0].fe[0].pid_filter_count == 5)
 			props->adapter[0].fe[0].pid_filter_count = 31;

-	/* TODO different remotes */
-	remote = it913x_read_reg(udev, 0x49ac); /* Remote */
-	if (remote == 0)
-		props->rc.core.rc_codes = NULL;
-
-	/* TODO at the moment tuner_id is always assigned to 0x38 */
-	it913x_config.tuner_id_0 = it913x_read_reg(udev, 0x49d0);
-
-	info("Dual mode=%x Remote=%x Tuner Type=%x", it913x_config.dual_mode
-		, remote, it913x_config.tuner_id_0);
-
 	/* Select Stream Buffer Size and pid filter option*/
 	if (pid_filter) {
 		props->adapter[0].fe[0].stream.u.bulk.buffersize =
@@ -492,7 +531,28 @@
 	} else
 		props->num_adapters = 1;

+	info("Dual mode=%x Tuner Type=%x", it913x_config.dual_mode,
+		it913x_config.tuner_id_0);
+
 	ret = ite_firmware_select(udev, props);
+
+	return ret;
+}
+
+static int it913x_identify_state(struct usb_device *udev,
+		struct dvb_usb_device_properties *props,
+		struct dvb_usb_device_description **desc,
+		int *cold)
+{
+	int ret = 0, firm_no;
+	u8 reg;
+
+	firm_no = it913x_return_status(udev);
+
+	/* Read and select config */
+	ret = it913x_select_config(udev, props);
+	if (ret < 0)
+		return ret;

 	if (firm_no > 0) {
 		*cold = 0;
@@ -791,7 +851,7 @@
 		.rc_query	= it913x_rc_query,
 		.rc_interval	= IT913X_POLL,
 		.allowed_protos	= RC_TYPE_NEC,
-		.rc_codes	= RC_MAP_MSI_DIGIVOX_III,
+		.rc_codes	= RC_MAP_IT913X_V1,
 	},
 	.i2c_algo         = &it913x_i2c_algo,
 	.num_device_descs = 5,
@@ -825,5 +885,5 @@

 MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
 MODULE_DESCRIPTION("it913x USB 2 Driver");
-MODULE_VERSION("1.24");
+MODULE_VERSION("1.25");
 MODULE_LICENSE("GPL");


mmc: sdhci-esdhc-imx: fix mmc ddr mode regression issue

It's caused by the platform driver was still using MMC_TIMING_UHS_DDR50
for MMC DDR mode which needs update too.

Reported-by: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
Reported-by: Shawn Guo <912cf7eb7d8018e2943586ae6657d21fd4e38239@freescale.com>
Signed-off-by: Dong Aisheng <f8b72116bf80189a70941b53a10a3d3b2650c711@freescale.com>
Tested-by: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
[Ulf Hansson] Resolved conflict
Signed-off-by: Ulf Hansson <fe47b31f388f85ce6ddf64bf3a0cf6b46077d0e6@linaro.org>
Signed-off-by: Chris Ball <711c73f64afdce07b7e38039a96d2224209e9a6c@printf.net>

--- drivers/mmc/host/sdhci-esdhc-imx.c
+++ drivers/mmc/host/sdhci-esdhc-imx.c
@@ -852,6 +852,7 @@
 	case MMC_TIMING_MMC_HS200:
 		break;
 	case MMC_TIMING_UHS_DDR50:
+	case MMC_TIMING_MMC_DDR52:
 		writel(readl(host->ioaddr + ESDHC_MIX_CTRL) |
 				ESDHC_MIX_CTRL_DDREN,
 				host->ioaddr + ESDHC_MIX_CTRL);