isalnum()

isalnum()

--- string/isalnum.c
+++ string/isalnum.c
@@ -10,38 +10,55 @@
 /*isalnum*/

 int main(void) {
-    unsigned char c = '\xdf'; // ISO-8859-1 中的德文字母 ß
-    printf("isalnum('\\xdf') in default C locale returned %d\n", c, !!isalnum(c));
-    if (setlocale(LC_CTYPE, "de_DE.iso88591"))
-        printf("isalnum('\\xdf') in ISO-8859-1 locale returned %d\n", !!isalnum(c));
-    if (setlocale(LC_CTYPE, "en_US.UTF-8"))
-        //isalnum('\xdf') in UTF-8 locale returned 0
-        printf("isalnum('\\xdf') in UTF-8 locale returned %d\n", !!isalnum(c));

-    int var1 = 'd';
-    int var2 = '2';
-    int var3 = '\t';
-    int var4 = ' ';
+  ///////////////////////////////////////////////////////////////////////////////////
+  unsigned char c = '\xdf'; // ISO-8859-1 中的德文字母 ß
+  printf("isalnum('\\xdf') in default C locale returned %d\n", c, !!isalnum(c));
+  if (setlocale(LC_CTYPE, "de_DE.iso88591"))
+    printf("isalnum('\\xdf') in ISO-8859-1 locale returned %d\n", !!isalnum(c));
+  if (setlocale(LC_CTYPE, "en_US.UTF-8"))
+    //isalnum('\xdf') in UTF-8 locale returned 0
+    printf("isalnum('\\xdf') in UTF-8 locale returned %d\n", !!isalnum(c));

-    if (isalnum(var1)) {
-        printf("var1 = |%c| 是字母数字\n", var1);
-    } else {
-        printf("var1 = |%c| 不是字母数字\n", var1);
-    }
-    if (isalnum(var2)) {
-        printf("var2 = |%c| 是字母数字\n", var2);
-    } else {
-        printf("var2 = |%c| 不是字母数字\n", var2);
-    }
-    if (isalnum(var3)) {
-        printf("var3 = |%c| 是字母数字\n", var3);
-    } else {
-        printf("var3 = |%c| 不是字母数字\n", var3);
-    }
-    if (isalnum(var4)) {
-        printf("var4 = |%c| 是字母数字\n", var4);
-    } else {
-        printf("var4 = |%c| 不是字母数字\n", var4);
-    }
+
+  ///////////////////////////////////////////////////////////////////////////////////
+  int var1 = 'd';
+  int var2 = '2';
+  int var3 = '\t';
+  int var4 = ' ';
+
+  if (isalnum(var1)) {
+    printf("var1 = |%c| 是字母数字\n", var1);
+  } else {
+    printf("var1 = |%c| 不是字母数字\n", var1);
+  }
+  if (isalnum(var2)) {
+    printf("var2 = |%c| 是字母数字\n", var2);
+  } else {
+    printf("var2 = |%c| 不是字母数字\n", var2);
+  }
+  if (isalnum(var3)) {
+    printf("var3 = |%c| 是字母数字\n", var3);
+  } else {
+    printf("var3 = |%c| 不是字母数字\n", var3);
+  }
+  if (isalnum(var4)) {
+    printf("var4 = |%c| 是字母数字\n", var4);
+  } else {
+    printf("var4 = |%c| 不是字母数字\n", var4);
+  }
+//  var1 = |d| 是字母数字
+//  var2 = |2| 是字母数字
+//  var3 = |	| 不是字母数字
+//  var4 = | | 不是字母数字
+
+  ///////////////////////////////////////////////////////////////////////////////////
+  int i;
+  char str[] = "c3po...";
+  i = 0;
+  while (isalnum(str[i])) i++;
+  //The first 4 characters are alphanumeric.
+  printf("The first %d characters are alphanumeric.\n", i);
+  return 0;

 }


BAVL: make some functions take const pointers

--- structure/BAVL.h
+++ structure/BAVL.h
@@ -60,9 +60,6 @@
     BAVL_comparator comparator;
     void *user;
     struct BAVLNode *root;
-    #ifndef NDEBUG
-    int in_handler;
-    #endif
 } BAVL;

 /**
@@ -115,7 +112,7 @@
  * @param o the tree
  * @return 1 if empty, 0 if not
  */
-static int BAVL_IsEmpty (BAVL *o);
+static int BAVL_IsEmpty (const BAVL *o);

 /**
  * Looks for a value in the tree.
@@ -129,7 +126,7 @@
  *           - the smallest node greater than the given value.
  *         NULL if the tree is empty.
  */
-static BAVLNode * BAVL_Lookup (BAVL *o, void *val);
+static BAVLNode * BAVL_Lookup (const BAVL *o, void *val);

 /**
  * Looks for a value in the tree.
@@ -140,7 +137,7 @@
  * @return If a node is in the thee with an equal value, that node.
  *         Else NULL.
  */
-static BAVLNode * BAVL_LookupExact (BAVL *o, void *val);
+static BAVLNode * BAVL_LookupExact (const BAVL *o, void *val);

 /**
  * Returns the smallest node in the tree, or NULL if the tree is empty.
@@ -148,7 +145,7 @@
  * @param o the tree
  * @return smallest node or NULL
  */
-static BAVLNode * BAVL_GetFirst (BAVL *o);
+static BAVLNode * BAVL_GetFirst (const BAVL *o);

 /**
  * Returns the greatest node in the tree, or NULL if the tree is empty.
@@ -156,7 +153,7 @@
  * @param o the tree
  * @return greatest node or NULL
  */
-static BAVLNode * BAVL_GetLast (BAVL *o);
+static BAVLNode * BAVL_GetLast (const BAVL *o);

 /**
  * Returns the node that follows the given node, or NULL if it's the
@@ -166,7 +163,7 @@
  * @param n node
  * @return next node, or NULL
  */
-static BAVLNode * BAVL_GetNext (BAVL *o, BAVLNode *n);
+static BAVLNode * BAVL_GetNext (const BAVL *o, BAVLNode *n);

 /**
  * Returns the node that precedes the given node, or NULL if it's the
@@ -176,27 +173,19 @@
  * @param n node
  * @return previous node, or NULL
  */
-static BAVLNode * BAVL_GetPrev (BAVL *o, BAVLNode *n);
+static BAVLNode * BAVL_GetPrev (const BAVL *o, BAVLNode *n);

 #define BAVL_MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
 #define BAVL_OPTNEG(_a, _neg) ((_neg) ? -(_a) : (_a))

-static void * _BAVL_node_value (BAVL *o, BAVLNode *n)
+static void * _BAVL_node_value (const BAVL *o, BAVLNode *n)
 {
     return ((uint8_t *)n + o->offset);
 }

-static int _BAVL_compare_values (BAVL *o, void *v1, void *v2)
-{
-    #ifndef NDEBUG
-    o->in_handler = 1;
-    #endif
-
+static int _BAVL_compare_values (const BAVL *o, void *v1, void *v2)
+{
     int res = o->comparator(o->user, v1, v2);
-
-    #ifndef NDEBUG
-    o->in_handler = 0;
-    #endif

     ASSERT(res == -1 || res == 0 || res == 1)

@@ -461,17 +450,11 @@
     o->user = user;
     o->root = NULL;

-    #ifndef NDEBUG
-    o->in_handler = 0;
-    #endif
-
     BAVL_ASSERT(o)
 }

 int BAVL_Insert (BAVL *o, BAVLNode *node, BAVLNode **ref)
 {
-    ASSERT(!o->in_handler)
-
     // insert to root?
     if (!o->root) {
         o->root = node;
@@ -533,8 +516,6 @@

 void BAVL_Remove (BAVL *o, BAVLNode *node)
 {
-    ASSERT(!o->in_handler)
-
     // if we have both subtrees, swap the node and the largest node
     // in the left subtree, so we have at most one subtree
     if (node->link[0] && node->link[1]) {
@@ -565,17 +546,13 @@
     BAVL_ASSERT(o)
 }

-int BAVL_IsEmpty (BAVL *o)
-{
-    ASSERT(!o->in_handler)
-
+int BAVL_IsEmpty (const BAVL *o)
+{
     return (!o->root);
 }

-BAVLNode * BAVL_Lookup (BAVL *o, void *val)
-{
-    ASSERT(!o->in_handler)
-
+BAVLNode * BAVL_Lookup (const BAVL *o, void *val)
+{
     if (!o->root) {
         return NULL;
     }
@@ -601,10 +578,8 @@
     }
 }

-BAVLNode * BAVL_LookupExact (BAVL *o, void *val)
-{
-    ASSERT(!o->in_handler)
-
+BAVLNode * BAVL_LookupExact (const BAVL *o, void *val)
+{
     if (!o->root) {
         return NULL;
     }
@@ -630,10 +605,8 @@
     }
 }

-BAVLNode * BAVL_GetFirst (BAVL *o)
-{
-    ASSERT(!o->in_handler)
-
+BAVLNode * BAVL_GetFirst (const BAVL *o)
+{
     if (!o->root) {
         return NULL;
     }
@@ -646,10 +619,8 @@
     return n;
 }

-BAVLNode * BAVL_GetLast (BAVL *o)
-{
-    ASSERT(!o->in_handler)
-
+BAVLNode * BAVL_GetLast (const BAVL *o)
+{
     if (!o->root) {
         return NULL;
     }
@@ -662,10 +633,8 @@
     return n;
 }

-BAVLNode * BAVL_GetNext (BAVL *o, BAVLNode *n)
-{
-    ASSERT(!o->in_handler)
-
+BAVLNode * BAVL_GetNext (const BAVL *o, BAVLNode *n)
+{
     if (n->link[1]) {
         n = n->link[1];
         while (n->link[0]) {
@@ -681,10 +650,8 @@
     return n;
 }

-BAVLNode * BAVL_GetPrev (BAVL *o, BAVLNode *n)
-{
-    ASSERT(!o->in_handler)
-
+BAVLNode * BAVL_GetPrev (const BAVL *o, BAVLNode *n)
+{
     if (n->link[0]) {
         n = n->link[0];
         while (n->link[1]) {


Cope with svn_stream_create failures.

Cope with svn_stream_create failures.

--- subvertpy/util.c
+++ subvertpy/util.c
@@ -439,8 +439,13 @@
 svn_stream_t *new_py_stream(apr_pool_t *pool, PyObject *py)
 {
 	svn_stream_t *stream;
+	stream = svn_stream_create((void *)py, pool);
+	if (stream == NULL) {
+		PyErr_SetString(PyExc_RuntimeError,
+						"Unable to create a Subversion stream");
+		return NULL;
+	}
 	Py_INCREF(py);
-	stream = svn_stream_create((void *)py, pool);
 	svn_stream_set_read(stream, py_stream_read);
 	svn_stream_set_write(stream, py_stream_write);
 	svn_stream_set_close(stream, py_stream_close);


BLD: fix include order of headers, otherwise AIX build fails.  See gh-5474.

--- numpy/fft/fftpack.c
+++ numpy/fft/fftpack.c
@@ -6,9 +6,9 @@

 /* isign is +1 for backward and -1 for forward transforms */

+#include <Python.h>
 #include <math.h>
 #include <stdio.h>
-#include <Python.h>
 #include <numpy/ndarraytypes.h>

 #define DOUBLE


added q-gram counting example

added q-gram counting example

[git-p4: depot-paths = "//sw/gpgpu/nvbio/main/": change = 18223414]

--- nvbio/qgram/qgram.h
+++ nvbio/qgram/qgram.h
@@ -59,7 +59,7 @@
 /// The following graph shows the performance of NVBIO's q-gram counting queries. The benchmark
 /// consists in building a q-gram index on the 22-mers obtained sampling a set of 1M x 150bp reads (SRR493095)
 /// every 10 bases, and streaming the whole human genome hg19 against it to find all matching q-grams.
-/// Specifically, the graph shows throughput of the following three stages:
+/// Specifically, the graph shows the throughput of the following three stages:
 ///\par
 ///  - ranking: the process of finding the range of hits matching each query q-gram in the q-gram index
 ///  - locating: the process of enumerating all found hits as (read-id,text-diagonal) pairs
@@ -237,7 +237,7 @@
 /// This of course was just a toy example; in reality, you'll want to this kind of operations with much
 /// larger q-gram indices and much larger batches of queries.
 ///
-///\section QGramFilterSection Q-Gram Filtering
+///\section QGramCountingSection Q-Gram Counting
 ///\par
 /// The previous example was only showing how to get the ranges of matching q-grams inside an index: it didn't
 /// show how to get the actual list of hits.
@@ -269,6 +269,17 @@
 ///   // where qgram-pos is the index of the hit into the string used to build,
 ///   // qgram-index and query-pos corresponds to one of the input query q-gram
 ///   // indices.
+///\endcode
+///
+/// Finally, the generated hits can be sorted and merged by diagonal bucket, effectively
+/// performing so called q-gram counting:
+///\code
+/// // sort all hits and merge them by closest diagonal
+/// qgram_filter.merge( 16u );  // the merging interval defining the size of each bucket
+///
+/// const uint32  n_hits   = qgram_filter.n_hits(); // the number of merged hits
+/// const uint2*  d_hits   = qgram_filter.hits();   // a device pointer to the hits merged by diagonal
+/// const uint16* d_counts = qgram_filter.counts(); // a device pointer to the hit counts by diagonal
 ///\endcode
 ///
 /// \section TechnicalOverviewSection Technical Overview


Test deleting root.

Test deleting root.

--- src/tests/test_type_base_lookup.c
+++ src/tests/test_type_base_lookup.c
@@ -1549,6 +1549,63 @@
     ASSERT1( false,  lookup_max_capacity(lookup) );

     retrieve = 9; ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), -1 );
+
+    /* Delete root. */
+    value    = *(const int *) LOOKUP_NODE_CVALUE(lookup, LOOKUP_ROOT_CNODE(lookup));
+    retrieve = value;
+
+    ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), value );
+
+    ++num_deletions;
+    ASSERT2( objpeq, LOOKUP_DELETE(lookup, val,  cmp, nd), lookup_val_ref );
+    ASSERT2( inteq,  num_deleted, 1 );
+    ASSERT2( inteq,  CHECKED_LOOKUP_INT_LEN(lookup), 9 + LOOKUP_INSERT_TESTS_NUM_ADDITIONAL_VALUES - num_deletions );
+    ASSERT1( false,  lookup_max_capacity(lookup) );
+
+    ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), -1 );
+
+
+    /* Delete 10. */
+    retrieve = 10; ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), 10 );
+
+    value = 10;
+    ++num_deletions;
+    ASSERT2( objpeq, LOOKUP_DELETE(lookup, val,  cmp, nd), lookup_val_ref );
+    ASSERT2( inteq,  num_deleted, 1 );
+    ASSERT2( inteq,  CHECKED_LOOKUP_INT_LEN(lookup), 9 + LOOKUP_INSERT_TESTS_NUM_ADDITIONAL_VALUES - num_deletions );
+    ASSERT1( false,  lookup_max_capacity(lookup) );
+
+    retrieve = 10; ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), -1 );
+
+
+    /* Delete root. */
+    value    = *(const int *) LOOKUP_NODE_CVALUE(lookup, LOOKUP_ROOT_CNODE(lookup));
+    retrieve = value;
+
+    ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), value );
+
+    ++num_deletions;
+    ASSERT2( objpeq, LOOKUP_DELETE(lookup, val,  cmp, nd), lookup_val_ref );
+    ASSERT2( inteq,  num_deleted, 1 );
+    ASSERT2( inteq,  CHECKED_LOOKUP_INT_LEN(lookup), 9 + LOOKUP_INSERT_TESTS_NUM_ADDITIONAL_VALUES - num_deletions );
+    ASSERT1( false,  lookup_max_capacity(lookup) );
+
+    ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), -1 );
+
+
+    /* Delete root. */
+    value    = *(const int *) LOOKUP_NODE_CVALUE(lookup, LOOKUP_ROOT_CNODE(lookup));
+    retrieve = value;
+
+    ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), value );
+
+    ++num_deletions;
+    ASSERT2( objpeq, LOOKUP_DELETE(lookup, val,  cmp, nd), lookup_val_ref );
+    ASSERT2( inteq,  num_deleted, 1 );
+    ASSERT2( inteq,  CHECKED_LOOKUP_INT_LEN(lookup), 9 + LOOKUP_INSERT_TESTS_NUM_ADDITIONAL_VALUES - num_deletions );
+    ASSERT1( false,  lookup_max_capacity(lookup) );
+
+    ASSERT2( inteq, val_or_m1(lookup_retrieve(lookup, ret, cmp)), -1 );
   }

   LOOKUP_DEINIT(lookup);


error: pathspec 'C/CodingStyle/Switch/MesesLacunado.c' did not match any file(s) known to git

--- C/CodingStyle/Switch/MesesLacunado.c
+++ C/CodingStyle/Switch/MesesLacunado.c
@@ -0,0 +1,46 @@
+#include <string.h>
+#include <stdlib.h>
+char *mes(int i) {
+  char *texto = (char *)malloc(10);
+    switch (i) {
+      case 0:
+        strcpy(texto, "janeiro");
+        break;
+      case 10:
+        strcpy(texto, "fevereiro");
+        break;
+      case 24:
+        strcpy(texto, "marco");
+        break;
+      case 39:
+        strcpy(texto, "abril");
+        break;
+      case 412:
+        strcpy(texto, "maio");
+        break;
+      case 529:
+        strcpy(texto, "junho");
+        break;
+      case 678:
+        strcpy(texto, "julho");
+        break;
+      case 1715:
+        strcpy(texto, "agosto");
+        break;
+      case 8234:
+        strcpy(texto, "setembro");
+        break;
+      case 9123:
+        strcpy(texto, "outubro");
+        break;
+      case 10123:
+        strcpy(texto, "novembro");
+        break;
+      case 11:
+        strcpy(texto, "dezembro");
+        break;
+    }
+    return texto;
+}
+
+//http://pt.stackoverflow.com/a/176676/101


send-pack: avoid deadlock when pack-object dies early

Send-pack deadlocks in two ways when pack-object dies early (for example,
because there is some repo corruption).

The first deadlock happens with the smart push protocol (--stateless-rpc).
After the initial rev-exchange, the remote is waiting for the pack data
to arrive, and the sideband demuxer at the local side continues trying to
stream data from the remote repository until it gets EOF. Meanwhile,
send-pack (in function pack_objects()) has noticed that pack-objects did
not produce output and died. Back in send_pack(), it now tries to clean
up the sideband demuxer using finish_async(). The demuxer, however, waits
for the remote end to close down, the remote waits for pack data, and
the reason that it still waits is that send-pack forgot to close the
outgoing channel. Add the missing close() in pack_objects().

The second deadlock happens in a similar constellation when the sideband
demuxer runs in a forked process (rather than in a thread). Again, the
remote end waits for pack data to arrive, the sideband demuxer waits for
the remote to shut down, and send-pack (in the regular clean-up) waits for
the demuxer to terminate. This time, the send-pack parent process closes
the writable end of the outgoing channel (in start_command() that spawned
pack-objects) so that after the death of the pack-objects process all
writable ends should have been closed and the remote repo should see EOF.
This does not happen, however, because when the sideband demuxer was forked
earlier, it also inherited a writable end; it remains open and keeps the
remote repo from seeing EOF. To break this deadlock, close the writable end
in the demuxer.

Analyzed-by: Jeff King <696e3fbcf235d40b6ea1ebd61c87cbea79d444e7@peff.net>
Signed-off-by: Johannes Sixt <fd432345609ae4d58c1aa629cb66ba96d1391622@kdbg.org>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- builtin-send-pack.c
+++ builtin-send-pack.c
@@ -97,6 +97,7 @@
 		free(buf);
 		close(po.out);
 		po.out = -1;
+		close(fd);
 	}

 	if (finish_command(&po))
@@ -375,6 +376,9 @@
 static int sideband_demux(int in, int out, void *data)
 {
 	int *fd = data;
+#ifndef WIN32
+	close(fd[1]);
+#endif
 	int ret = recv_sideband("send-pack", fd[0], out);
 	close(out);
 	return ret;


Fibonacci search

Fibonacci search

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

--- Fibonacci_Search/isunitha98selvan.c
+++ Fibonacci_Search/isunitha98selvan.c
@@ -0,0 +1,86 @@
+#include<stdio.h>
+#include<stdlib.h>
+int fibonnaciSearch(int *a,int n,int key)
+{
+
+	int x=0;
+	int y=1;
+	int fibM=x+y;
+	while(fibM<n)
+	{
+		x=y;
+		y=fibM;
+		fibM=x+y;
+	}
+	int i=0;
+	int flag=-1;
+	while(fibM>1)
+	{
+		int p=x+flag;
+		if(p<n-1)
+		{
+			i=p;
+		}
+		else
+		{
+			i=n-1;
+		}
+
+		if(*(a+i)<key)
+		{
+			fibM=y;
+			y=x;
+			x=fibM-y;
+			flag=i;
+
+		}
+		else if (*(a+i)>key)
+		{
+			fibM=x;
+			y=y-x;
+			x=fibM-y;
+		}
+
+		else
+			return i;
+	}
+
+	if (x && *(a+(flag+1))==x)
+		return flag+1;
+	return -1;		//if element is not found
+}
+int main()
+{
+	int *a;
+	int n,i;
+	int x;
+	printf("Enter size of array ");
+	scanf("%d",&n);
+	a=(int*)malloc(n*sizeof(n));
+
+	if(a==NULL)
+	{
+		printf("Error!");
+	}
+	else
+	{
+
+		printf("Enter the elements of the array\n");
+		for(i=0;i<n;i++)
+		{
+			scanf("%d",a+i);
+		}
+		printf("Enter element to be searched for ");
+		scanf("%d",&x);
+		int res=fibonnaciSearch(a,n,x);
+		if(res==-1)
+		{
+			printf("element not found");
+
+		}
+		else
+		{
+			printf("Element found at index %d",res);
+		}
+	}
+}


formatting changes only

formatting changes only

--- src/trspi/crypto/openssl/crypto.c
+++ src/trspi/crypto/openssl/crypto.c
@@ -175,8 +175,8 @@

 TSS_RESULT
 Trspi_Verify(UINT32 HashType, BYTE *pHash, UINT32 iHashLength,
-	   unsigned char *pModulus, int iKeyLength,
-	   BYTE *pSignature, UINT32 sig_len)
+	     unsigned char *pModulus, int iKeyLength,
+	     BYTE *pSignature, UINT32 sig_len)
 {
 	int rv, nid;
 	unsigned char exp[] = { 0x01, 0x00, 0x01 }; /* 65537 hex */


Add missing const &

Add missing const &

--- KTp/Declarative/channel-delegator.h
+++ KTp/Declarative/channel-delegator.h
@@ -34,7 +34,7 @@
 //BODGE class to allow delegating channels before I merge into TpQt properly
 class ChannelDelegator {
 public:
-    static void delegateChannel(const Tp::AccountPtr account, const Tp::ChannelPtr channel, QDateTime userActionTime = QDateTime::currentDateTime()) {
+    static void delegateChannel(const Tp::AccountPtr &account, const Tp::ChannelPtr &channel, const QDateTime &userActionTime = QDateTime::currentDateTime()) {
         static_cast<AccountProxy*>(account.data())->dispatcherInterface()->DelegateChannels(Tp::ObjectPathList() << QDBusObjectPath(channel->objectPath()), userActionTime.toTime_t(), QLatin1String("org.freedesktop.Telepathy.Client.KTp.TextUi"));
     }
 };


add grayscale color map

add grayscale color map

--- shader/include/saiga/colorize.h
+++ shader/include/saiga/colorize.h
@@ -9,6 +9,16 @@

 #include "hsv.h"
 #include "shaderConfig.h"
+
+/**
+ * This is not really a "color" map.
+ * It just converts a float to a vec3.
+ */
+FUNC_DECL vec3 colorizeGray(float alpha)
+{
+    alpha = saturate(alpha);
+    return vec3(alpha,alpha, alpha);
+}

 /**
  * Creates a smooth HSV color transition from Blue(=0) to Red(=1).


lwip: reset rto timer on fast retransmission (see task #13757, patch by Joel Cunningham)

Upstream commit: 5f8b5cbb20e4a3bd1b02c2b9545fad0068a49d20

--- lwip/src/core/tcp_out.c
+++ lwip/src/core/tcp_out.c
@@ -913,7 +913,7 @@

   /* Set retransmission timer running if it is not currently enabled
      This must be set before checking the route. */
-  if (pcb->rtime == -1) {
+  if (pcb->rtime < 0) {
     pcb->rtime = 0;
   }

@@ -1142,6 +1142,9 @@

     pcb->cwnd = pcb->ssthresh + 3 * pcb->mss;
     pcb->flags |= TF_INFR;
+
+    /* Reset the retransmission timer to prevent immediate rto retransmissions */
+    pcb->rtime = 0;
   }
 }


Missing include

Missing include

--- tools/chplvis/Event.h
+++ tools/chplvis/Event.h
@@ -18,6 +18,7 @@
  */

 #include <string>
+#include <stdio.h>

 #ifndef _EVENT_H_
 #define _EVENT_H_


client: lowered reconnect tries to 2

client: lowered reconnect tries to 2

git-svn-id: 4a24f560d5bb049edaa12cbc2145b2f5ee41c6a2@1548 f8528748-c2c0-11dd-ba5c-d3b7c2b3b534

--- share/yield/include/yield/ipc.h
+++ share/yield/include/yield/ipc.h
@@ -138,7 +138,7 @@

       const static uint16_t CONCURRENCY_LEVEL_DEFAULT = 4;
       const static uint64_t OPERATION_TIMEOUT_DEFAULT = 5 * NS_IN_S;
-      const static uint8_t RECONNECT_TRIES_MAX_DEFAULT = 3;
+      const static uint8_t RECONNECT_TRIES_MAX_DEFAULT = 2;

       // YIELD::concurrency::EventHandler
       virtual void handleEvent( YIELD::concurrency::Event& );


Keybindings

Keybindings

--- src/video/toaru/SDL_toaruevents.c
+++ src/video/toaru/SDL_toaruevents.c
@@ -37,6 +37,21 @@

 int mouse_state = 0;

+static SDLMod make_mod(unsigned int m) {
+	SDLMod ret = KMOD_NONE;
+
+	if (m & KEY_MOD_LEFT_CTRL)   ret |= KMOD_LCTRL;
+	if (m & KEY_MOD_LEFT_SHIFT)  ret |= KMOD_LSHIFT;
+	if (m & KEY_MOD_LEFT_ALT)    ret |= KMOD_LALT;
+	if (m & KEY_MOD_LEFT_SUPER)  ret |= KMOD_LMETA;
+	if (m & KEY_MOD_RIGHT_CTRL)  ret |= KMOD_RCTRL;
+	if (m & KEY_MOD_RIGHT_SHIFT) ret |= KMOD_RSHIFT;
+	if (m & KEY_MOD_RIGHT_ALT)   ret |= KMOD_RALT;
+	if (m & KEY_MOD_RIGHT_SUPER) ret |= KMOD_RMETA;
+
+	return ret;
+}
+
 void TOARU_PumpEvents(_THIS) {
 	yutani_msg_t * m;
 	do {
@@ -47,6 +62,71 @@
 		switch (m->type) {
 			case YUTANI_MSG_KEY_EVENT:
 				{
+					struct yutani_msg_key_event * ke = (void*)m->data;
+					if (ke->event.keycode) {
+						SDL_keysym keysym;
+						int action = ke->event.action == KEY_ACTION_DOWN ? SDL_PRESSED : SDL_RELEASED;
+						keysym.scancode = ke->event.keycode;
+						keysym.unicode  = 0;
+						keysym.mod      = make_mod(ke->event.modifiers); /* TODO */
+						switch (ke->event.keycode) {
+							case '\n':
+								keysym.sym      = SDLK_RETURN;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case ' ':
+								keysym.sym      = SDLK_SPACE;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case KEY_ARROW_UP:
+								keysym.sym      = SDLK_UP;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case KEY_ARROW_LEFT:
+								keysym.sym      = SDLK_LEFT;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case KEY_ARROW_RIGHT:
+								keysym.sym      = SDLK_RIGHT;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case KEY_ARROW_DOWN:
+								keysym.sym      = SDLK_DOWN;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case KEY_ESCAPE:
+								keysym.sym      = SDLK_ESCAPE;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case KEY_BACKSPACE:
+								keysym.sym      = SDLK_BACKSPACE;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case '\t':
+								keysym.sym      = SDLK_TAB;
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							case '0': case '1': case '2': case '3': case '4':
+							case '5': case '6': case '7': case '8': case '9':
+							case 'a': case 'b': case 'c': case 'd': case 'e':
+							case 'f': case 'g': case 'h': case 'i': case 'j':
+							case 'k': case 'l': case 'm': case 'n': case 'o':
+							case 'p': case 'q': case 'r': case 's': case 't':
+							case 'u': case 'v': case 'w': case 'x': case 'y':
+							case 'z':
+							case ':': case ';': case '<': case '=': case '>':
+							case '?': case '@': case '[': case ']': case '\\':
+							case '^': case '_': case '`': case '.': case '/':
+							case '*': case '-': case '+': case '#': case '"':
+							case '!': case '&': case '$': case '(': case '\'':
+								keysym.sym      = (ke->event.keycode - 'a' + SDLK_a);
+								SDL_PrivateKeyboard(action, &keysym);
+								break;
+							default:
+								fprintf(stderr, "[SDL] Key press: %d ('%c')\n", ke->event.keycode, ke->event.key);
+								break;
+						}
+					}
 				}
 				break;
 			case YUTANI_MSG_WINDOW_FOCUS_CHANGE:


test: Add test for hosting by user-agent

--- tests/test-context.c
+++ tests/test-context.c
@@ -756,12 +756,99 @@
         g_slist_free_full (uris, (GDestroyNotify) g_uri_unref);

         // Make sure the source teardown handlers get run so we don't confuse valgrind
-        g_timeout_add (500, (GSourceFunc)g_main_loop_quit, d.loop);
+        g_timeout_add (500, (GSourceFunc) g_main_loop_quit, d.loop);
         g_main_loop_run (d.loop);
         g_main_loop_unref (d.loop);
         g_object_unref (session);
 }

+void
+test_gupnp_context_host_for_agent ()
+{
+        GError *error = NULL;
+        GUPnPContext *context = create_context (0, &error);
+        DefaultCallbackData d = { .bytes = NULL, .loop = NULL };
+
+        d.loop = g_main_loop_new (NULL, FALSE);
+
+        GSList *uris =
+                soup_server_get_uris (gupnp_context_get_server (context));
+        GRegex *user_agent =
+                g_regex_new ("GUPnP-Context-Test UA", 0, 0, &error);
+        g_assert_no_error (error);
+        g_assert_nonnull (user_agent);
+
+        // Cannot host path for a user agent if path is not hosted generally
+        g_assert_false (gupnp_context_host_path_for_agent (context,
+                                                           DATA_PATH "/default",
+                                                           "/foo",
+                                                           user_agent));
+
+        gupnp_context_host_path (context, DATA_PATH "/random4k.bin", "/foo");
+        // Hosting agent-specific path must now succeed
+        g_assert_true (gupnp_context_host_path_for_agent (context,
+                                                          DATA_PATH "/default",
+                                                          "/foo",
+                                                          user_agent));
+
+        SoupSession *session = soup_session_new ();
+        char *base = g_uri_to_string (uris->data);
+        char *new_uri =
+                g_uri_resolve_relative (base, "foo", G_URI_FLAGS_NONE, &error);
+        g_free (base);
+
+        // Checking wihtout user agent - should return the 4k file
+        SoupMessage *msg = soup_message_new (SOUP_METHOD_GET, new_uri);
+        soup_session_set_accept_language (session, NULL);
+
+        soup_session_send_and_read_async (session,
+                                          msg,
+                                          G_PRIORITY_DEFAULT,
+                                          NULL,
+                                          soup_message_default_callback,
+                                          &d);
+        g_main_loop_run (d.loop);
+
+        g_assert_cmpint (soup_message_get_status (msg), ==, SOUP_STATUS_OK);
+        g_assert_nonnull (d.bytes);
+        g_assert_nonnull (g_bytes_get_data (d.bytes, NULL));
+        g_assert_cmpint (g_bytes_get_size (d.bytes), ==, 4096);
+        g_bytes_unref (d.bytes);
+
+        // Checking with user agent - should return the small file
+        g_object_unref (msg);
+        msg = soup_message_new (SOUP_METHOD_GET, new_uri);
+        soup_session_set_user_agent (session, "GUPnP-Context-Test UA");
+        soup_session_set_accept_language (session, NULL);
+
+        soup_session_send_and_read_async (session,
+                                          msg,
+                                          G_PRIORITY_DEFAULT,
+                                          NULL,
+                                          soup_message_default_callback,
+                                          &d);
+        g_main_loop_run (d.loop);
+
+        g_assert_cmpint (soup_message_get_status (msg), ==, SOUP_STATUS_OK);
+        g_assert_nonnull (d.bytes);
+        g_assert_cmpmem (g_bytes_get_data (d.bytes, NULL),
+                         g_bytes_get_size (d.bytes),
+                         "default\n",
+                         8);
+        g_bytes_unref (d.bytes);
+
+        g_object_unref (msg);
+        g_slist_free_full (uris, (GDestroyNotify) g_uri_unref);
+        g_free (new_uri);
+        g_object_unref (context);
+        g_regex_unref (user_agent);
+
+        // Make sure the source teardown handlers get run so we don't confuse valgrind
+        g_timeout_add (500, (GSourceFunc)g_main_loop_quit, d.loop);
+        g_main_loop_run (d.loop);
+        g_main_loop_unref (d.loop);
+        g_object_unref (session);
+}

 int main (int argc, char *argv[]) {
         g_test_init (&argc, &argv, NULL);
@@ -782,6 +869,9 @@
         g_test_add_func ("/context/http/language/serve-folder",
                          test_gupnp_context_http_language_serve_folder);

+        g_test_add_func ("/context/http/host-for-agent",
+                         test_gupnp_context_host_for_agent);
+
         g_test_add_func ("/context/utility/rewrite_uri",
                          test_gupnp_context_rewrite_uri);


fixes a build issue introduced in the s/signal/frame/ patch


Fixed a bug that caused all the radio items to be linked into one huge

	* bonobo/bonobo-uih-menu.c (menu_toplevel_create_widgets):
	Fixed a bug that caused all the radio items to be linked into
	one huge radio group. There's still a problem if you remove one
	of the radio items and then try to add more to the same group,
	since the GtkRadioMenuItem class doesn't know to update the
	radio_items list pointer inside the UI handler.

	* bonobo/bonobo-control.c (bonobo_control_construct):
	Sink the widget when we ref it, since the container is going to
	sink it later anyway. This makes things work better in the case
	where we fail before the widget gets added to a container.

	And: Took out lots of excess \n characters in log messages.
	So sue me!

--- tests/test-storage.c
+++ tests/test-storage.c
@@ -42,7 +42,7 @@
 #endif

 	if (bonobo_init (orb, NULL, NULL) == FALSE)
-		g_error (_("Can not bonobo_init\n"));
+		g_error (_("Can not bonobo_init"));

 	unlink (file);
 	storage = bonobo_storage_open("efs", file, BONOBO_SS_RDWR|BONOBO_SS_CREATE,0664);


Missed one.

Missed one.

--- c_src/port_driver.c
+++ c_src/port_driver.c
@@ -386,7 +386,7 @@
     return;
 }

-static void port_driver_smoosh(oleg_data *d) {
+static void port_driver_squish(oleg_data *d) {
     if (d->db == NULL)
         return port_driver_error(d);

@@ -416,7 +416,7 @@
     } else if (fn == 9) {
         /* This is one of the more unique commands in that we don't
          * need a decoded obj and in-fact aren't given one. */
-        return port_driver_smoosh(d);
+        return port_driver_squish(d);
     }

     /* Check to see if someone called ol_init */


Better check on infinity

Better check on infinity

--- LimitCommonCode/limit_output_file.h
+++ LimitCommonCode/limit_output_file.h
@@ -12,9 +12,8 @@
 #include <memory>

 inline double protected_val(double val) {
-	return val > 10000 ? 10000
-		: val < 0.0 ? 10000
-		: val;
+	return std::isfinite(val) ? val
+		: 1000;
 }

 inline void write_limit_output_file(const abcd_limit_config &lconfig, const std::vector<limit_result> &results)


[efi_bootloader][cosmetic] Adding \r\n to error handling macros

--- bootloader/efi/utils.h
+++ bootloader/efi/utils.h
@@ -17,7 +17,7 @@
 #define CHECK(cond)                                  \
    do {                                              \
       if (!(cond)) {                                 \
-         Print(L"CHECK '%a' FAILED\n", #cond);       \
+         Print(L"CHECK '%a' FAILED\r\n", #cond);     \
          status = EFI_LOAD_ERROR;                    \
          goto end;                                   \
       }                                              \
@@ -26,7 +26,7 @@
 #define HANDLE_EFI_ERROR(op)                                 \
     do {                                                     \
        if (EFI_ERROR(status)) {                              \
-          Print(L"[%a] Error: %r ", op, status);             \
+          Print(L"[%a] Error: %r\r\n", op, status);          \
           goto end;                                          \
        }                                                     \
     } while (0)


Make the pyramid correlators progress callback hidden

Kick it on by turning up the logging for the 'stereo' module.

--- src/vw/Stereo/PyramidCorrelator.h
+++ src/vw/Stereo/PyramidCorrelator.h
@@ -138,7 +138,7 @@
       ImageView<PixelMask<Vector2f> > disparity_map;

       // Overall Progress Bar
-      TerminalProgressCallback prog( "stereo", "Pyr Search:");
+      TerminalProgressCallback prog( "stereo", "Pyr Search:", DebugMessage);

       // Refined the disparity map by searching in the local region
       // where the last good disparity value was found.


make it easier to have debugging code typechecked even when debugging is turned off

--- compiler/HsVersions.h
+++ compiler/HsVersions.h
@@ -37,12 +37,14 @@
 #define COMMA ,

 #ifdef DEBUG
+#define debugIsOn True
 #define ASSERT(e) if (not (e)) then (assertPanic __FILE__ __LINE__) else
 #define ASSERT2(e,msg) if (not (e)) then (assertPprPanic __FILE__ __LINE__ (msg)) else
 #define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg))
 #define ASSERTM(mbool) do { bool <- mbool; ASSERT(bool) return () }
 #define ASSERTM2(mbool,msg) do { bool <- mbool; ASSERT2(bool,msg) return () }
 #else
+#define debugIsOn False
 -- We have to actually use all the variables we are given or we may get
 -- unused variable warnings when DEBUG is off.
 #define ASSERT(e)      if False && (not (e)) then panic "ASSERT" else


update-ref --stdin: narrow scope of err strbuf

Making the strbuf local in each function that needs to print errors
saves the reader from having to think about action at a distance,
such as

 * errors piling up and being concatenated with no newline between
   them
 * errors unhandled in one function, to be later handled in another
 * concurrency issues, if this code starts using threads some day

No functional change intended.

Signed-off-by: Jonathan Nieder <b57189c5f2fd5b3daf3350a77fde90def1080fa5@gmail.com>
Reviewed-by: Michael Haggerty <c24c152f145c57791e809b126db9e61bd1c1782d@alum.mit.edu>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- builtin/update-ref.c
+++ builtin/update-ref.c
@@ -16,7 +16,6 @@

 static char line_termination = '\n';
 static int update_flags;
-static struct strbuf err = STRBUF_INIT;

 /*
  * Parse one whitespace- or NUL-terminated, possibly C-quoted argument
@@ -179,6 +178,7 @@

 static const char *parse_cmd_update(struct strbuf *input, const char *next)
 {
+	struct strbuf err = STRBUF_INIT;
 	char *refname;
 	unsigned char new_sha1[20];
 	unsigned char old_sha1[20];
@@ -204,12 +204,14 @@

 	update_flags = 0;
 	free(refname);
+	strbuf_release(&err);

 	return next;
 }

 static const char *parse_cmd_create(struct strbuf *input, const char *next)
 {
+	struct strbuf err = STRBUF_INIT;
 	char *refname;
 	unsigned char new_sha1[20];

@@ -232,12 +234,14 @@

 	update_flags = 0;
 	free(refname);
+	strbuf_release(&err);

 	return next;
 }

 static const char *parse_cmd_delete(struct strbuf *input, const char *next)
 {
+	struct strbuf err = STRBUF_INIT;
 	char *refname;
 	unsigned char old_sha1[20];
 	int have_old;
@@ -264,12 +268,14 @@

 	update_flags = 0;
 	free(refname);
+	strbuf_release(&err);

 	return next;
 }

 static const char *parse_cmd_verify(struct strbuf *input, const char *next)
 {
+	struct strbuf err = STRBUF_INIT;
 	char *refname;
 	unsigned char new_sha1[20];
 	unsigned char old_sha1[20];
@@ -297,6 +303,7 @@

 	update_flags = 0;
 	free(refname);
+	strbuf_release(&err);

 	return next;
 }
@@ -365,6 +372,8 @@
 		die("Refusing to perform update with empty message.");

 	if (read_stdin) {
+		struct strbuf err = STRBUF_INIT;
+
 		transaction = ref_transaction_begin(&err);
 		if (!transaction)
 			die("%s", err.buf);


document horizontal operations

document horizontal operations

--- doc/dox-common-ops.h
+++ doc/dox-common-ops.h
@@ -330,3 +330,23 @@
 VECTOR_TYPE operator&(VECTOR_TYPE x) const;
 VECTOR_TYPE operator^(VECTOR_TYPE x) const;
 //@}
+
+/**
+ * \name Horizontal Operations
+ *
+ * There are four horizontal operations available to reduce the values of a vector to a scalar
+ * value.
+ *
+ * \code
+ * void foo(const float_v &v) {
+ *   float min = v.min(); // smallest value in v
+ *   float sum = v.sum(); // sum of all values in v
+ * }
+ * \endcode
+ */
+//@{
+ENTRY_TYPE min() const;
+ENTRY_TYPE max() const;
+ENTRY_TYPE product() const;
+ENTRY_TYPE sum() const;
+//@}


Add comments

Add comments

--- example/ex11-algo02.c
+++ example/ex11-algo02.c
@@ -17,10 +17,14 @@
 #define M_OPL_vector_employee_t() ARRAY_OPLIST(vector_employee, M_OPL_employee_t())
 ALGO_DEF(vector_employee, vector_employee_t)

-/* Define the function object to select the sort order */
-FUNC_OBJ_INS_DEF(compare_by,
-                 vector_employee_cmp_obj,
-                 (a, b), {
+/* Define the function object to select the sort order
+ * named 'compare_by' which is an instance of the interface
+ * 'vector_employee_cmp_obj' created by ALGO_DEF.
+ */
+FUNC_OBJ_INS_DEF(compare_by /* name of the instance */,
+                 vector_employee_cmp_obj /* name of the interface */,
+                 (a, b) /* name of the input parameters of the function like object. The type are inherited from the interface. */, {
+                   /* code of the function object */
                    if (string_equal_str_p(self->sort_field, "name"))
                      return string_cmp(a->name, b->name);
                    else if (string_equal_str_p(self->sort_field, "age"))
@@ -28,6 +32,7 @@
                    else
                      return a->idnum < b->idnum ? -1 : a->idnum > b->idnum;
                  },
+                 /* Additional fields stored in the function object */
                  (sort_field, string_t) )
 #define M_OPL_compare_by_t() FUNC_OBJ_INS_OPLIST(compare_by, STRING_OPLIST)

@@ -39,19 +44,25 @@
   // Open the file
   FILE *f = fopen(filename, "rt");
   if (!f) {
+    // Handle errors
     fprintf(stderr, "ERROR: Cannot open file '%s'.\n", filename);
     exit(2);
   }
+
   // Initialize the JSON serializer with this file
   M_LET( (in,f), m_serial_json_read_t)
+    // Read the JSON file and fill in 'base' with it.
     ret = vector_employee_in_serial(base, in);
-  // Let's handle errors
+
+  // Let's handle serialization error
   if (ret != M_SERIAL_OK_DONE) {
     fprintf(stderr, "ERROR: Cannot read JSON data from file '%s'.\nParsing stops at:\n", filename);
     while (!feof(f)) { fputc(fgetc(f), stdout); }
     fclose(f);
     exit(2);
   }
+
+  // Close the FILE
   fclose(f);
 }

@@ -67,11 +78,14 @@
     printf("Employees sorted by idnum are: ");
     vector_employee_out_str(stdout, emps);

+    // Sort the database by employee name
     M_LET( (cmp, STRING_CTE("name")), compare_by_t )
       vector_employee_sort_fo(emps, compare_by_as_interface(cmp));
     printf("\nEmployees sorted by name are: ");
     vector_employee_out_str(stdout, emps);
     printf("\n");
+
+    // End
   }
   return 0;
 }


Fix potential integer overflow loading ELF files (#148)

When loading ELF files we calculate the location of a section header in
a way that can overflow a `uint32_t` value producing a wrong result.

This commit fixes the issue by using the fact that section headers are
contiguous in the ELF file.

Signed-off-by: Matthew Gretton-Dann <17bce06e4c7e20e6375a20ae89604c2bf650e2c0@arm.com>

Signed-off-by: Matthew Gretton-Dann <17bce06e4c7e20e6375a20ae89604c2bf650e2c0@arm.com>

--- vm/ubpf_loader.c
+++ vm/ubpf_loader.c
@@ -113,8 +113,10 @@

     /* Parse section headers into an array */
     struct section sections[MAX_SECTIONS];
+    uint64_t shoff = ehdr->e_shoff;
     for (i = 0; i < ehdr->e_shnum; i++) {
-        const Elf64_Shdr *shdr = bounds_check(&b, ehdr->e_shoff + i*ehdr->e_shentsize, sizeof(*shdr));
+        const Elf64_Shdr *shdr = bounds_check(&b, shoff, sizeof(*shdr));
+        shoff += ehdr->e_shentsize;
         if (!shdr) {
             *errmsg = ubpf_error("bad section header offset or size");
             goto error;


ENHANCED: Performance of rdf_unload/1 and rdf_retractall/3 if multiple triples from the same subject are deleted.  Jacco van Ossenbruggen.

--- packages/semweb/rdf_db.c
+++ packages/semweb/rdf_db.c
@@ -2280,20 +2280,26 @@

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-triple *first(atom_t subject)
-    Find the first triple on subject.  The first is marked to generate a
-    unique subjects quickly;
+triple *first(rdf_db *db, atom_t subject, triple *t)
+
+Find the first triple on subject.  The   first  is  marked to generate a
+unique subjects quickly. If triple is given, start searching from there.
+This speeds up deletion of graphs,  where   we  tend  to delete multiple
+triples on the same subject.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 static triple *
-first(rdf_db *db, atom_t subject)
-{ triple *t, tmp;
-  int hash;
-
-  tmp.subject = subject;
-  hash = triple_hash(db, &tmp, BY_S);
-
-  for(t=db->table[ICOL(BY_S)][hash]; t; t = t->tp.next[ICOL(BY_S)])
+first(rdf_db *db, atom_t subject, triple *t)
+{ if ( !t )
+  { triple tmp;
+    int hash;
+
+    tmp.subject = subject;
+    hash = triple_hash(db, &tmp, BY_S);
+    t=db->table[ICOL(BY_S)][hash];
+  }
+
+  for( ; t; t = t->tp.next[ICOL(BY_S)])
   { if ( t->subject == subject && !t->erased )
       return t;
   }
@@ -2386,7 +2392,7 @@
     goto ok;				/* is a duplicate */

 					/* keep track of subjects */
-  one = first(db, t->subject);
+  one = first(db, t->subject, NULL);
   if ( !one->first )
   { one->first = TRUE;
     db->subjects++;
@@ -2628,7 +2634,7 @@
     }

     if ( t->first )
-    { triple *one = first(db, t->subject);
+    { triple *one = first(db, t->subject, t);

       if ( one )
 	one->first = TRUE;
@@ -5904,7 +5910,7 @@
       { atom_t a;

 	if ( get_atom_ex(subject, &a) )
-	{ if ( first(db, a) )
+	{ if ( first(db, a, NULL) )
 	    return TRUE;
 	  return FALSE;
 	}


Display the release statement details.

Display the release statement details.

--- tgt-stub/statement.c
+++ tgt-stub/statement.c
@@ -17,7 +17,7 @@
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 #ifdef HAVE_CVS_IDENT
-#ident "$Id: statement.c,v 1.1 2004/12/12 18:15:06 steve Exp $"
+#ident "$Id: statement.c,v 1.2 2004/12/15 17:11:13 steve Exp $"
 #endif

 # include "config.h"
@@ -93,6 +93,22 @@
 	      ind+4, "", lwid);

       show_expression(ivl_stmt_rval(net), ind+4);
+}
+
+static void show_stmt_release(ivl_statement_t net, unsigned ind)
+{
+      unsigned idx;
+      unsigned lwid = 0;
+
+      fprintf(out, "%*srelease <lwidth=%u>\n", ind, "",
+	      ivl_stmt_lwidth(net));
+
+      for (idx = 0 ;  idx < ivl_stmt_lvals(net) ;  idx += 1) {
+	    lwid += show_assign_lval(ivl_stmt_lval(net, idx), ind+4);
+      }
+
+      fprintf(out, "%*sTotal l-value width: %u bits\n",
+	      ind+4, "", lwid);
 }

 void show_statement(ivl_statement_t net, unsigned ind)
@@ -222,6 +238,10 @@
 	    fprintf(out, "%*s/* noop */;\n", ind, "");
 	    break;

+	  case IVL_ST_RELEASE:
+	    show_stmt_release(net, ind);
+	    break;
+
 	  case IVL_ST_STASK: {
 		fprintf(out, "%*sCall %s(%u parameters);\n", ind, "",
 			ivl_stmt_name(net), ivl_stmt_parm_count(net));


cbits: Bring `v256` closer to `v128`

cbits: Bring `v256` closer to `v128`

Instead of making `v` an alias to plain `__m256i` in the AVX2 case,
create a union similar to `v128` and use it accordingly.

--- cbits/reedsolomon.c
+++ cbits/reedsolomon.c
@@ -50,7 +50,11 @@
 # undef T1

 #ifdef __AVX2__
-typedef __m256i v;
+typedef union {
+        __m256i m256i;
+} v256 __attribute__((aligned(32)));
+
+typedef v256 v;
 #else
 typedef v128 v;
 #endif
@@ -68,9 +72,9 @@

 static ALWAYS_INLINE v loadu_v(const uint8_t *in) {
 #if defined(__AVX2__)
-        const v result = _mm256_loadu_si256((const __m256i *)in);
-#else
-        const v result = loadu_v128(in);
+        const v256 result = { .m256i = _mm256_loadu_si256((const __m256i *)in) };
+#else
+        const v128 result = loadu_v128(in);
 #endif

         return result;
@@ -78,9 +82,9 @@

 static ALWAYS_INLINE CONST_FUNCTION v set1_epi8_v(const uint8_t c) {
 #if defined(__AVX2__)
-        const v result = _mm256_set1_epi8(c);
-#elif defined(__SSE2__)
-        const v result = { .m128i = _mm_set1_epi8(c) };
+        const v256 result = { .m256i = _mm256_set1_epi8(c) };
+#elif defined(__SSE2__)
+        const v128 result = { .m128i = _mm_set1_epi8(c) };
 #else
         uint64_t c2 = c,
                  tmp = (c2 << (7 * 8)) |
@@ -91,7 +95,7 @@
                        (c2 << (2 * 8)) |
                        (c2 << (1 * 8)) |
                        (c2 << (0 * 8));
-        const v result = { .u64 = { tmp, tmp } };
+        const v128 result = { .u64 = { tmp, tmp } };
 #endif

         return result;
@@ -99,12 +103,12 @@

 static ALWAYS_INLINE CONST_FUNCTION v srli_epi64_v(const v in, const unsigned int n) {
 #if defined(__AVX2__)
-        const v result = _mm256_srli_epi64(in, n);
-#elif defined(__SSE2__)
-        const v result = { .m128i = _mm_srli_epi64(in.m128i, n) };
-#else
-        const v result = { .u64 = { in.u64[0] >> n,
-                                    in.u64[1] >> n } };
+        const v256 result = { .m256i = _mm256_srli_epi64(in.m256i, n) };
+#elif defined(__SSE2__)
+        const v128 result = { .m128i = _mm_srli_epi64(in.m128i, n) };
+#else
+        const v128 result = { .u64 = { in.u64[0] >> n,
+                                       in.u64[1] >> n } };
 #endif

         return result;
@@ -112,11 +116,11 @@

 static ALWAYS_INLINE CONST_FUNCTION v and_v(const v a, const v b) {
 #if defined(__AVX2__)
-        const v result = _mm256_and_si256(a, b);
-#elif defined(__SSE2__)
-        const v result = { .m128i = _mm_and_si128(a.m128i, b.m128i) };
-#else
-        const v result = { .v2u64 = a.v2u64 & b.v2u64 };
+        const v256 result = { .m256i = _mm256_and_si256(a.m256i, b.m256i) };
+#elif defined(__SSE2__)
+        const v128 result = { .m128i = _mm_and_si128(a.m128i, b.m128i) };
+#else
+        const v128 result = { .v2u64 = a.v2u64 & b.v2u64 };
 #endif

         return result;
@@ -124,11 +128,11 @@

 static ALWAYS_INLINE CONST_FUNCTION v xor_v(const v a, const v b) {
 #if defined(__AVX2__)
-        const v result = _mm256_xor_si256(a, b);
-#elif defined(__SSE2__)
-        const v result = { .m128i = _mm_xor_si128(a.m128i, b.m128i) };
-#else
-        const v result = { .v2u64 = a.v2u64 ^ b.v2u64 };
+        const v256 result = { .m256i = _mm256_xor_si256(a.m256i, b.m256i) };
+#elif defined(__SSE2__)
+        const v128 result = { .m128i = _mm_xor_si128(a.m128i, b.m128i) };
+#else
+        const v128 result = { .v2u64 = a.v2u64 ^ b.v2u64 };
 #endif

         return result;
@@ -136,11 +140,11 @@

 static ALWAYS_INLINE CONST_FUNCTION v shuffle_epi8_v(const v vec, const v mask) {
 #if defined(__AVX2__)
-        const v result = _mm256_shuffle_epi8(vec, mask);
+        const v256 result = { .m256i = _mm256_shuffle_epi8(vec.m256i, mask.m256i) };
 #elif defined(__SSSE3__)
-        const v result = { .m128i = _mm_shuffle_epi8(vec.m128i, mask.m128i) };
-#else
-        v result = { .u64 = { 0, 0 } };
+        const v128 result = { .m128i = _mm_shuffle_epi8(vec.m128i, mask.m128i) };
+#else
+        v128 result = { .u64 = { 0, 0 } };

 # define DO_BYTE(i) \
         result.u8[i] = mask.u8[i] & 0x80 ? 0 : vec.u8[mask.u8[i] & 0x0F];
@@ -156,7 +160,7 @@

 static ALWAYS_INLINE void storeu_v(uint8_t *out, const v vec) {
 #if defined(__AVX2__)
-        _mm256_storeu_si256((__m256i *)out, vec);
+        _mm256_storeu_si256((__m256i *)out, vec.m256i);
 #elif defined(__SSE2__)
         _mm_storeu_si128((__m128i *)out, vec.m128i);
 #else
@@ -166,10 +170,12 @@

 static ALWAYS_INLINE CONST_FUNCTION v replicate_v128_v(const v128 vec) {
 #if defined(__AVX2__)
-        return _mm256_broadcastsi128_si256(vec.m128i);
-#else
-        return vec;
-#endif
+        const v256 result = { .m256i = _mm256_broadcastsi128_si256(vec.m128i) };
+#else
+        const v128 result = vec;
+#endif
+
+        return result;
 }


Fixed typo that causing segfaults.

Fixed typo that causing segfaults.

Signed-off-by: Gopal, Puunithaaraj <10308ab826b56f8bbce1ec0c10bd609cace363da@intel.com>

--- gst-libs/mfx/gstmfxdisplay.h
+++ gst-libs/mfx/gstmfxdisplay.h
@@ -92,7 +92,7 @@
 #define GST_MFX_TYPE_DISPLAY_TYPE (gst_mfx_display_get_type())

 GType
-gst_mfx_display_type_get_type(void);
+gst_mfx_display_get_type(void);

 /**
  * GstMfxDisplayInfo:


[cc2-qbe] fix unary and binary operators generation

--- cc2/arch/qbe/code.c
+++ cc2/arch/qbe/code.c
@@ -384,7 +384,7 @@
 	strcpy(to, addr2txt(&pc->to));
 	strcpy(from1, addr2txt(&pc->from1));
 	strcpy(from2, addr2txt(&pc->from2));
-	printf("\t%s %c=\t%s\t%s,%s\n", to, p->letter, p->txt, from1, from2);
+	printf("\t%s =%c\t%s\t%s,%s\n", to, p->letter, p->txt, from1, from2);
 }

 static void
@@ -406,7 +406,7 @@

 	strcpy(to, addr2txt(&pc->to));
 	strcpy(from, addr2txt(&pc->from1));
-	printf("\t%s %c=\t%s\t%s\n", to, p->letter, p->txt, from);
+	printf("\t%s =%c\t%s\t%s\n", to, p->letter, p->txt, from);
 }

 static void


vaapipostproc: Correctly detect the caps change

This is a quick fix for regression introuduced by the
commit 757833230bc73b8e3b4e31649e4618ba802bea51

With out this, the gst_vaapipostproc_create() will
never get invoked.

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

--- gst/vaapi/gstvaapipostproc.c
+++ gst/vaapi/gstvaapipostproc.c
@@ -855,14 +855,6 @@
   return FALSE;
 }

-static inline gboolean
-video_info_is_filled (GstVideoInfo * info)
-{
-  return (GST_VIDEO_INFO_FORMAT (info) > GST_VIDEO_FORMAT_UNKNOWN
-          && GST_VIDEO_INFO_WIDTH (info) > 0
-          && GST_VIDEO_INFO_HEIGHT (info) > 0);
-}
-
 static gboolean
 video_info_update (GstCaps * caps, GstVideoInfo * info,
     gboolean * caps_changed_ptr)
@@ -874,7 +866,7 @@

   *caps_changed_ptr = FALSE;
   if (video_info_changed (info, &vi)) {
-    *caps_changed_ptr = video_info_is_filled (info);
+    *caps_changed_ptr = TRUE;
     *info = vi;
   }


videomixer: Fix handling of buffers without a duration

We'll have to pop buffer from collectpads and store it
internally only to get the timestamp of the next buffer.
If we continue to keep it in collectpads, no new buffer
to calculate the end time will ever arrive.

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

--- gst/videomixer/videomixer2.c
+++ gst/videomixer/videomixer2.c
@@ -699,6 +699,8 @@

         if (end_time == -1) {
           mixcol->queued = buf;
+          buf = gst_collect_pads_pop (mix->collect, &mixcol->collect);
+          gst_buffer_unref (buf);
           need_more_data = TRUE;
           continue;
         }


videomixer: Drop custom latency querying logic

This is now implemented in the default latency query handler.

--- gst/videomixer/videomixer2.c
+++ gst/videomixer/videomixer2.c
@@ -1434,91 +1434,6 @@
 }

 static gboolean
-gst_videomixer2_query_latency (GstVideoMixer2 * mix, GstQuery * query)
-{
-  GstClockTime min, max;
-  gboolean live;
-  gboolean res;
-  GstIterator *it;
-  gboolean done;
-  GValue item = { 0 };
-
-  res = TRUE;
-  done = FALSE;
-  live = FALSE;
-  min = 0;
-  max = GST_CLOCK_TIME_NONE;
-
-  /* Take maximum of all latency values */
-  it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (mix));
-  while (!done) {
-    switch (gst_iterator_next (it, &item)) {
-      case GST_ITERATOR_DONE:
-        done = TRUE;
-        break;
-      case GST_ITERATOR_OK:
-      {
-        GstPad *pad = g_value_get_object (&item);
-        GstQuery *peerquery;
-        GstClockTime min_cur, max_cur;
-        gboolean live_cur;
-
-        peerquery = gst_query_new_latency ();
-
-        /* Ask peer for latency */
-        res &= gst_pad_peer_query (pad, peerquery);
-
-        /* take max from all valid return values */
-        if (res) {
-          gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
-
-          if (live_cur) {
-            if (min_cur > min)
-              min = min_cur;
-
-            if (max == GST_CLOCK_TIME_NONE)
-              max = max_cur;
-            else if (max_cur < max)
-              max = max_cur;
-
-            live = TRUE;
-          }
-        }
-
-        gst_query_unref (peerquery);
-        g_value_reset (&item);
-        break;
-      }
-      case GST_ITERATOR_RESYNC:
-        live = FALSE;
-        min = 0;
-        max = GST_CLOCK_TIME_NONE;
-        res = TRUE;
-        gst_iterator_resync (it);
-        break;
-      default:
-        res = FALSE;
-        done = TRUE;
-        break;
-    }
-  }
-  g_value_unset (&item);
-  gst_iterator_free (it);
-
-  mix->live = live;
-
-  if (res) {
-    /* store the results */
-    GST_DEBUG_OBJECT (mix, "Calculated total latency: live %s, min %"
-        GST_TIME_FORMAT ", max %" GST_TIME_FORMAT,
-        (live ? "yes" : "no"), GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-    gst_query_set_latency (query, live, min, max);
-  }
-
-  return res;
-}
-
-static gboolean
 gst_videomixer2_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
 {
   GstVideoMixer2 *mix = GST_VIDEO_MIXER2 (parent);
@@ -1545,9 +1460,6 @@
     }
     case GST_QUERY_DURATION:
       res = gst_videomixer2_query_duration (mix, query);
-      break;
-    case GST_QUERY_LATENCY:
-      res = gst_videomixer2_query_latency (mix, query);
       break;
     case GST_QUERY_CAPS:
       res = gst_pad_query_default (pad, parent, query);


Remove an unnecessary include

Remove an unnecessary include

--- FreeStreamer/astreamer/audio_queue.h
+++ FreeStreamer/astreamer/audio_queue.h
@@ -11,7 +11,6 @@
 #ifndef ASTREAMER_AUDIO_QUEUE_H
 #define ASTREAMER_AUDIO_QUEUE_H

-#include <pthread.h> /* pthread_*() */
 #include <AudioToolbox/AudioToolbox.h> /* AudioFileStreamID */

 namespace astreamer {


Fix floating views in tabbed/stacked workspaces not getting frame events

view_is_visible would return false, which meant the view wouldn't
receive a frame done event. view_is_visible needs to make an exception
for floating containers.

This also moves the workspace_is_visible check to an earlier location
for performance reasons.

--- sway/tree/view.c
+++ sway/tree/view.c
@@ -989,12 +989,16 @@
 		floater = floater->parent;
 	}
 	bool is_sticky = container_is_floating(floater) && floater->is_sticky;
+	if (!is_sticky && !workspace_is_visible(workspace)) {
+		return false;
+	}
 	// Check view isn't in a tabbed or stacked container on an inactive tab
 	struct sway_seat *seat = input_manager_current_seat(input_manager);
 	struct sway_container *con = view->container;
 	while (con) {
 		enum sway_container_layout layout = container_parent_layout(con);
-		if (layout == L_TABBED || layout == L_STACKED) {
+		if ((layout == L_TABBED || layout == L_STACKED)
+				&& !container_is_floating(con)) {
 			struct sway_node *parent = con->parent ?
 				&con->parent->node : &con->workspace->node;
 			if (seat_get_active_tiling_child(seat, parent) != &con->node) {
@@ -1007,10 +1011,6 @@
 	if (workspace->fullscreen &&
 			!container_is_fullscreen_or_child(view->container)) {
 		return false;
-	}
-	// Check the workspace is visible
-	if (!is_sticky) {
-		return workspace_is_visible(workspace);
 	}
 	return true;
 }


made to compile on Xenix

made to compile on Xenix

--- mach/proto/ncg/subr.c
+++ mach/proto/ncg/subr.c
@@ -411,8 +411,12 @@

 save_stack(tp) register token_p tp ; {
 	int i ;
-
-	aside_length = &fakestack[stackheight-1] -tp;
+	token_p tmp = &fakestack[stackheight - 1];
+
+	/*aside_length = &fakestack[stackheight-1] -tp;
+	  This did not compile on Xenix V3.2: CODE GENERATION ERROR!
+	*/
+	aside_length = tmp - tp;
 	assert(aside_length<=MAXSAVE);
 #ifndef NDEBUG
 	if (aside_length!=0 && Debug>1)


Hide address_of

Hide address_of

--- tools/halide_image.h
+++ tools/halide_image.h
@@ -95,22 +95,22 @@

     /** Get the dimensionality of a multi-dimensional C array */
     template<typename Array, size_t N>
-    int dimensionality_of_array(Array (&vals)[N]) {
+    static int dimensionality_of_array(Array (&vals)[N]) {
         return dimensionality_of_array(vals[0]) + 1;
     }

-    int dimensionality_of_array(T &) {
+    static int dimensionality_of_array(T &) {
         return 0;
     }

     /** Check if any args in a parameter pack are zero */
     template<typename ...Args>
-    bool any_zero(int first, Args... rest) {
+    static bool any_zero(int first, Args... rest) {
         if (first == 0) return true;
         return any_zero(rest...);
     }

-    bool any_zero() {
+    static bool any_zero() {
         return false;
     }

@@ -166,15 +166,6 @@
     /** The total number of bytes spanned by the data in memory. */
     size_t size_in_bytes() const {
         return (size_t)(end() - begin());
-    }
-
-    /** A pointer to the element at the given location. */
-    T *address_of(const int *pos) const {
-        T *ptr = (T *)host;
-        for (int i = dimensions-1; i >= 0; i--) {
-            ptr += dim[i].stride * (pos[i] - dim[i].min);
-        }
-        return ptr;
     }

     /** We need custom constructors and assignment operators so that
@@ -334,26 +325,44 @@

 private:
     template<typename ...Args>
-    T *address_of_helper(int d, int first, Args... rest) const {
-        return address_of_helper(d+1, rest...) + stride[d] * (first - min[d]);
+    T *address_of(int d, int first, Args... rest) const {
+        return address_of(d+1, rest...) + stride[d] * (first - min[d]);
     }

-    T *address_of_helper(int d) const {
+    T *address_of(int d) const {
         return (T *)host;
     }

+    T *address_of(const int *pos) const {
+        T *ptr = (T *)host;
+        for (int i = dimensions-1; i >= 0; i--) {
+            ptr += dim[i].stride * (pos[i] - dim[i].min);
+        }
+        return ptr;
+    }
 public:

-    /** Get pixels or their addresses */
-    // @{
-    template<typename ...Args>
-    T *address_of(int first, Args... rest) const {
-        return address_of_helper(0, first, rest...);
+    /** Access pixels. Note that while these methods are marked const,
+     * they return non-const references.
+     */
+    //@{
+    template<typename ...Args>
+    const T &operator()(int first, Args... rest) const {
+        return *(address_of(0, first, rest...));
+    }
+
+    template<typename ...Args>
+    const T &operator()() const {
+        return *((T *)host);
+    }
+
+    const T &operator()(const int *pos) const {
+        return *((T *)address_of(pos));
     }

     template<typename ...Args>
     T &operator()(int first, Args... rest) {
-        return *(address_of(first, rest...));
+        return *(address_of(0, first, rest...));
     }

     template<typename ...Args>
@@ -361,23 +370,9 @@
         return *((T *)host);
     }

-    template<typename ...Args>
-    const T &operator()(int first, Args... rest) const {
-        return *(address_of(first, rest...));
-    }
-
-    template<typename ...Args>
-    const T &operator()() const {
-        return (T *)host;
-    }
-
-    const T &operator()(const int *pos) const {
+    T &operator()(int *pos) {
         return *((T *)address_of(pos));
-    }
-
-    T &operator()(const int *pos) {
-        return *((T *)address_of(pos));
-    }
+    }
     // @}

     /** Conventional names for the first three dimensions. */
@@ -430,7 +425,7 @@
         slice_size *= sizeof(T);
         // Do the memcpys
         src_slice.for_each_element([&](const int *pos) {
-                memcpy(dst_slice.address_of(pos), src_slice.address_of(pos), slice_size);
+                memcpy(&dst_slice(pos), &src_slice(pos), slice_size);
             });

         // Undo the dimension reordering
@@ -686,7 +681,7 @@

 Image<float, 3> im(100, 100, 3);
 for_each_element(im.sliced(0, 0), [&](int y, int c) {
-    memset(im.address_of(0, y, c), 0, sizeof(float) * im.width());
+    memset(&im(0, y, c), 0, sizeof(float) * im.width());
 });


fixed warnings about ignored return value and wrong format code in printf

--- tools/kiss_fastfir.c
+++ tools/kiss_fastfir.c
@@ -362,7 +362,7 @@
     n_samps_buf = 8*4096/sizeof(kffsamp_t);
     n_samps_buf = nfft + 4*(nfft-n_imp_resp+1);

-    if (verbose) fprintf(stderr,"bufsize=%d\n",sizeof(kffsamp_t)*n_samps_buf );
+    if (verbose) fprintf(stderr,"bufsize=%d\n",(int)(sizeof(kffsamp_t)*n_samps_buf) );

     /*allocate space and initialize pointers */
@@ -449,10 +449,12 @@
     }
     fseek(filtfile,0,SEEK_END);
     nh = ftell(filtfile) / sizeof(kffsamp_t);
-    if (verbose) fprintf(stderr,"%d samples in FIR filter\n",nh);
+    if (verbose) fprintf(stderr,"%d samples in FIR filter\n",(int)nh);
     h = (kffsamp_t*)malloc(sizeof(kffsamp_t)*nh);
     fseek(filtfile,0,SEEK_SET);
-    fread(h,sizeof(kffsamp_t),nh,filtfile);
+    if (fread(h,sizeof(kffsamp_t),nh,filtfile) != nh)
+        fprintf(stderr,"short read on filter file\n");
+
     fclose(filtfile);

     if (use_direct)


kmod-modinfo: fix typo and output format.

 * it's parm, not param (does not have the second 'a');
 * output format requires ':' after the name.

--- tools/kmod-modinfo.c
+++ tools/kmod-modinfo.c
@@ -126,7 +126,7 @@

 			name = value;
 			namelen = colon - value;
-			if (strcmp(key, "param") == 0) {
+			if (strcmp(key, "parm") == 0) {
 				param = colon + 1;
 				paramlen = strlen(param);
 				type = NULL;
@@ -169,13 +169,13 @@
 			       p->namelen, p->name, p->typelen, p->type,
 			       separator);
 		else if (p->type != NULL)
-			printf("%-16s%.*s%.*s (%.*s)%c", "parm:",
+			printf("%-16s%.*s:%.*s (%.*s)%c", "parm:",
 			       p->namelen, p->name,
 			       p->paramlen, p->param,
 			       p->typelen, p->type,
 			       separator);
 		else
-			printf("%-16s%.*s%.*s%c",
+			printf("%-16s%.*s:%.*s%c",
 			       "parm:",
 			       p->namelen, p->name,
 			       p->paramlen, p->param,


yanglint BUGFIX clarify ext data param

yanglint BUGFIX clarify ext data param

--- tools/lint/main_ni.c
+++ tools/lint/main_ni.c
@@ -206,7 +206,7 @@

     printf("  -x FILE, --ext-data=FILE\n"
             "                File containing the specific data required by an extension. Required by\n"
-            "                the schema-mount extension, for example, when the mounted data are\n"
+            "                the schema-mount extension, for example, when the operational data are\n"
             "                expected in the file. File format is guessed.\n\n");

     printf("  -n, --not-strict\n"


intel_gpu_top: Print GPU clock information, which seems interesting.

--- tools/intel_gpu_top.c
+++ tools/intel_gpu_top.c
@@ -84,6 +84,98 @@
 	top_bits[num_top_bits].update = update_idle_bit;
 	top_bits_sorted[num_top_bits] = &top_bits[num_top_bits];
 	num_top_bits++;
+}
+
+static void
+print_clock(char *name, int clock) {
+	if (clock == -1)
+		printf("%s clock: unknown", name);
+	else
+		printf("%s clock: %d Mhz", name, clock);
+}
+
+static int
+print_clock_info(void)
+{
+	uint16_t gcfgc;
+
+	if (IS_GM45(devid)) {
+		int core_clock = -1;
+
+		pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC);
+
+		switch (gcfgc & 0xf) {
+		case 8: core_clock = 266;
+		case 9: core_clock = 320;
+		case 11: core_clock = 400;
+		case 13: core_clock = 533;
+		}
+		print_clock("core", core_clock);
+	} else if (IS_965(devid) && IS_MOBILE(devid)) {
+		int render_clock = -1, sampler_clock = -1;
+
+		pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC);
+
+		switch (gcfgc & 0xf) {
+		case 2: render_clock = 250; sampler_clock = 267;
+		case 3: render_clock = 320; sampler_clock = 333;
+		case 4: render_clock = 400; sampler_clock = 444;
+		case 5: render_clock = 500; sampler_clock = 533;
+		}
+
+		print_clock("render", render_clock);
+		printf("  ");
+		print_clock("sampler", sampler_clock);
+	} else if (IS_945(devid) && IS_MOBILE(devid)) {
+		int render_clock = -1, display_clock = -1;
+
+		pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC);
+
+		switch (gcfgc & 0x7) {
+		case 0: render_clock = 166;
+		case 1: render_clock = 200;
+		case 3: render_clock = 250;
+		case 5: render_clock = 400;
+		}
+
+		switch (gcfgc & 0x70) {
+		case 0: display_clock = 200;
+		case 4: display_clock = 320;
+		}
+		if (gcfgc & (1 << 7))
+		    display_clock = 133;
+
+		print_clock("render", render_clock);
+		printf("  ");
+		print_clock("display", display_clock);
+	} else if (IS_915(devid) && IS_MOBILE(devid)) {
+		int render_clock = -1, display_clock = -1;
+
+		pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC);
+
+		switch (gcfgc & 0x7) {
+		case 0: render_clock = 160;
+		case 1: render_clock = 190;
+		case 4: render_clock = 333;
+		}
+		if (gcfgc & (1 << 13))
+		    render_clock = 133;
+
+		switch (gcfgc & 0x70) {
+		case 0: display_clock = 190;
+		case 4: display_clock = 333;
+		}
+		if (gcfgc & (1 << 7))
+		    display_clock = 133;
+
+		print_clock("render", render_clock);
+		printf("  ");
+		print_clock("display", display_clock);
+	}
+
+
+	printf("\n");
+	return -1;
 }

 int main(int argc, char **argv)
@@ -194,6 +286,9 @@
 		      top_bits_sort);

 		printf(clear_screen);
+
+		print_clock_info();
+
 		printf("ring idle: %3d%%  ring space: %d/%d (%d%%)\n",
 		       ring_idle,
 		       total_ring_full / 100, ring_size,


added assertion

added assertion

--- arangod/VocBase/datafile.c
+++ arangod/VocBase/datafile.c
@@ -523,7 +523,7 @@
 #ifdef DEBUG_DATAFILE
     LOG_TRACE("MARKER: size %lu, tick %lx, crc %lx, type %u",
               (unsigned long) marker->_size,
-              (unsigned long) marker->_tick,
+              (unsigned long long) marker->_tick,
               (unsigned long) marker->_crc,
               (unsigned int) marker->_type);
 #endif
@@ -1186,6 +1186,7 @@
                               TRI_df_marker_t const* marker,
                               TRI_voc_size_t markerSize,
                               bool forceSync) {
+  assert(markerSize > 0);

   if (markerSize != marker->_size) {
     LOG_ERROR("marker size is %lu, but size is %lu",


Added implementation caveats warning.

Added implementation caveats warning.

--- VVJSONSchemaValidation/VVJSONSchema.h
+++ VVJSONSchemaValidation/VVJSONSchema.h
@@ -16,6 +16,11 @@
  Basic setup of this class allows validating JSON-decoded objects with schemas authored in JSON Schema, draft 4 format. To create a schema object, use one of the provided factory methods, specifying the root schema object to parse, either JSON-encoded or decoded. Note that creating schema objects is a resource-heavy process, so created schemas should be cached as possible.
  Root schema parsing process uses $schema property to check that specified schema object was created using an expected schema format. If it is not present or not recognized, default (JSON Schema, draft 4) is implied. If an incompatible schema format is encountered, creating the schema instance will fail.
  To extend the functionality of schema validation beyond the standard keywords, users of this class may register validator classes with custom keywords that will be used as necessary. To make sure that custom keywords are processed, specified root schema must contain a $schema property with a value equal to the one specified when the custom validator was registered.
+ @warning
+ There are a few caveats of using this class:
+ * External schema references are not yet supported.
+ * Regular expression patterns are validated using NSRegularExpression, which uses ICU implementation, not ECMA 262. Thus, some features like look-behind are not supported.
+ * 'format' keyword is not supported yet.
  */
 @interface VVJSONSchema : NSObject


Clarify meaning of basic quantities such as x_data

This concerns the most important members of LMsolver.

--- c++/gadfit/lm_solver.h
+++ c++/gadfit/lm_solver.h
@@ -109,9 +109,22 @@
     // variable keeps track of that.
     bool set_par_called { false };

+    // The measured data used in the fitting procedure are stored in
+    // x_data and y_data. x_data stores the independent values
+    // (in a plot these are typically values on the x-axis).
     std::vector<std::vector<double>> x_data {};
+    // y_data stores the dependent values.
     std::vector<std::vector<double>> y_data {};
+    // If specified by the user, these are the errors associated with
+    // the data points. These determine the weights when constructing
+    // the Jacobian. Default is to use the same weight for each data
+    // point.
     std::vector<std::vector<double>> errors {};
+    // Model functions used for fitting. The user only specifies a
+    // single fitting function but it is duplicated over all the data
+    // sets (curves). This is because the fitting parameters
+    // associated with the model function can differ between data
+    // sets.
     std::vector<FitFunction> fit_functions {};
     // Main work arrays. These are all publicly available via getters.
     std::vector<double> Jacobian {};


fix build error"

fix build error"

--- Classes/Core/SimpleLogger/FLLogger.h
+++ Classes/Core/SimpleLogger/FLLogger.h
@@ -9,6 +9,7 @@

 #import "FishLampRequired.h"
 #import "FLStringFormatter.h"
+#import <libkern/OSAtomic.h>

 #define FLLogTypeNone       nil
 #define FLLogTypeLog        @"com.fishlamp.log"


Implement basic key press event support and window close event support on X11.

--- c/demos/utils/window.h
+++ c/demos/utils/window.h
@@ -210,7 +210,7 @@
         exit (1);
     }
     window->ximage = XShmCreateImage (window->display, CopyFromParent, depth, ZPixmap,
-                                     NULL, window->segment, width, height);
+                                      NULL, window->segment, width, height);
     window->x11window = XCreateWindow (window->display, DefaultRootWindow (window->display),
                                        50, 50, width, height, 0, depth, InputOutput,
                                        CopyFromParent, 0, NULL);
@@ -222,6 +222,7 @@
     window->segment->readOnly = True;
     XShmAttach (window->display, window->segment);
     shmctl (window->segment->shmid, IPC_RMID, NULL);
+    XSelectInput (window->display, window->x11window, KeyPressMask);
     atom = XInternAtom (window->display, "WM_DELETE_WINDOW", False);
     XSetWMProtocols (window->display, window->x11window, &atom, 1);
     XMapWindow (window->display, window->x11window);
@@ -247,6 +248,21 @@
                   window->ximage->width, window->ximage->height, False);
     XSync (window->display, False);
     return out;
+}
+
+static char
+gezira_Window_key_pressed (gezira_Window_t *window)
+{
+    char key = -1;
+    XEvent event;
+    if (!XPending (window->display))
+     return key;
+    XNextEvent (window->display, &event);
+    if (event.type == ClientMessage) // just assume the delete window message for now
+        exit (0);
+    if (event.type == KeyPress)
+        XLookupString (&event.xkey, &key, 1, NULL, NULL);
+    return key;
 }

 #else


newton_generic: avoid unnecessary copy of newton_values

--- c/src/newton_generic.h
+++ c/src/newton_generic.h
@@ -235,18 +235,20 @@
     LinEqSolver LinSolver = LinEqSolver(polynomials, variables);
     DeltaGenerator DeltaGen = DeltaGenerator(polynomials, variables);

-    for (int i=0; i<max_iter; ++i) {
-      newton_update = LinSolver.solve_lin_at(newton_values,delta,variables);
-
-      previous_newton_values = newton_values;
-
-      if (!SR::IsIdempotent())
+    for (int i=0; i < max_iter; ++i) {
+      newton_update = LinSolver.solve_lin_at(newton_values, delta, variables);
+
+      /* No need to recompute delta if this is the last iteration... */
+      if (!SR::IsIdempotent() && i + 1 < max_iter) {
+        delta = DeltaGen.delta_at(newton_update, newton_values);
+      }
+
+      if (!SR::IsIdempotent()) {
         newton_values = newton_values + newton_update;
-      else
+      } else {
         newton_values = newton_update;
-
-      if (!SR::IsIdempotent())
-        delta = DeltaGen.delta_at(newton_update, previous_newton_values);
+      }
+
     }

     return newton_values;


Convert Java support to use getThreadSpecificData(). (dm)

--- Programs/system_java.c
+++ Programs/system_java.c
@@ -18,11 +18,10 @@

 #include "prologue.h"

-#include <pthread.h>
-
 #include "log.h"
 #include "system.h"
 #include "system_java.h"
+#include "thread.h"

 static JavaVM *javaVirtualMachine = NULL;

@@ -37,24 +36,23 @@
   javaVirtualMachine = NULL;
 }

-static pthread_once_t threadDetachHandlerOnce = PTHREAD_ONCE_INIT;
-static pthread_key_t threadDetachHandlerKey;
-
-static void
-threadDetachHandler (void *arg) {
-  JavaVM *vm = arg;
-  (*vm)->DetachCurrentThread(vm);
-}
-
-static void
-createThreadDetachHandlerKey (void) {
-  pthread_key_create(&threadDetachHandlerKey, threadDetachHandler);
-}
-
 JavaVM *
 getJavaInvocationInterface (void) {
   return javaVirtualMachine;
 }
+
+THREAD_SPECIFIC_DATA_NEW(tsdJava) {
+  return getJavaInvocationInterface();
+}
+
+THREAD_SPECIFIC_DATA_DESTROY(tsdJava) {
+  JavaVM *vm = data;
+
+  (*vm)->DetachCurrentThread(vm);
+  logMessage(LOG_DEBUG, "thread detached from Java VM");
+}
+
+THREAD_SPECIFIC_DATA_CONTROL(tsdJava);

 JNIEnv *
 getJavaNativeInterface (void) {
@@ -73,11 +71,13 @@
         };

         if ((result = (*vm)->AttachCurrentThread(vm, &env, &args)) < 0) {
+          logMessage(LOG_WARNING, "Java AttachCurrentThread error: %d", result);
         } else {
-          pthread_once(&threadDetachHandlerOnce, createThreadDetachHandlerKey);
-          pthread_setspecific(threadDetachHandlerKey, vm);
+          logMessage(LOG_DEBUG, "thread attached to Java VM");
+          getThreadSpecificData(&tsdJava);
         }
       } else {
+        logMessage(LOG_WARNING, "Java GetEnv error: %d", result);
       }
     }
   }


adjusted some more translatable strings.

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@10556 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/konica/qm150.c
+++ camlibs/konica/qm150.c
@@ -632,13 +632,13 @@
 	if (ack == NACK) {
 		if (buf[CAMERA_MODE_PTR] != REC_MODE)
 			gp_context_error(context, _("You must be in record "
-				"mode to capture image."));
+				"mode to capture images."));
 		else if (!nbr_images)
 			gp_context_error(context, _("No space available "
-				"to capture new image. You must delete some "
+				"to capture new images. You must delete some "
 				"images."));
 		else
-			gp_context_error(context, _("Can't capture new image. "
+			gp_context_error(context, _("Can't capture new images. "
 				"Unknown error"));
 		return (GP_ERROR);
 	}
@@ -934,22 +934,22 @@
        /* Focus */
         gp_widget_new (GP_WIDGET_RADIO, _("Focus"), &widget);
         gp_widget_append (section, widget);
-        gp_widget_add_choice (widget, _("2.0m"));
-	gp_widget_add_choice (widget, _("0.5m"));
-	gp_widget_add_choice (widget, _("0.1m"));
+        gp_widget_add_choice (widget, _("2.0 m"));
+	gp_widget_add_choice (widget, _("0.5 m"));
+	gp_widget_add_choice (widget, _("0.1 m"));
         gp_widget_add_choice (widget, _("Auto"));
         switch (buf[FOCUS_PTR]) {
 		case 0:
 			gp_widget_set_value (widget, _("Auto"));
 			break;
 		case 1:
-	                gp_widget_set_value (widget, _("2.0m"));
+	                gp_widget_set_value (widget, _("2.0 m"));
 	                break;
 	        case 2:
-        	        gp_widget_set_value (widget, _("0.5m"));
+        	        gp_widget_set_value (widget, _("0.5 m"));
                 	break;
 	        case 3:
-        	        gp_widget_set_value (widget, _("0.1m"));
+        	        gp_widget_set_value (widget, _("0.1 m"));
                 	break;
         }


add some "hidden" Nikon opcodes on Nikon D3xxx cameras.

Only D3300 confirmed, the rest "guessed".

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@15229 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -299,6 +299,7 @@
 	 * do that and merge it into the generic PTP deviceinfo. */
 	if (di->VendorExtensionID == PTP_VENDOR_NIKON) {
 		unsigned int i;
+		unsigned int nikond;

 		/* Nikon V* and J* advertise the new Nikon stuff, but only do the generic
 		 * PTP capture. FIXME: could use flags. */
@@ -321,6 +322,62 @@
 				di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_GetVendorPropCodes;
 				/* probably more */
 				di->OperationsSupported_len += 1;
+			}
+		}
+		if (params->deviceinfo.Model && (sscanf(params->deviceinfo.Model,"D%d", &nikond)))
+		{
+			if ((nikond >= 3000) && (nikond < 3199)) {
+				GP_LOG_D("The D3xxx series hides commands from us ... adding all D3000 ones");
+				if (!ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
+					C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 15)));
+					di->OperationsSupported[di->OperationsSupported_len+0]  = PTP_OC_NIKON_GetVendorPropCodes;
+					di->OperationsSupported[di->OperationsSupported_len+1]  = PTP_OC_NIKON_CheckEvent;
+					di->OperationsSupported[di->OperationsSupported_len+2]  = PTP_OC_NIKON_Capture;
+					di->OperationsSupported[di->OperationsSupported_len+3]  = PTP_OC_NIKON_AfDrive;
+					di->OperationsSupported[di->OperationsSupported_len+4]  = PTP_OC_NIKON_SetControlMode;
+					di->OperationsSupported[di->OperationsSupported_len+5]  = PTP_OC_NIKON_DeviceReady;
+					di->OperationsSupported[di->OperationsSupported_len+6]  = PTP_OC_NIKON_AfCaptureSDRAM;
+					di->OperationsSupported[di->OperationsSupported_len+7]  = PTP_OC_NIKON_DelImageSDRAM;
+
+					di->OperationsSupported[di->OperationsSupported_len+8]  = PTP_OC_NIKON_GetPreviewImg;
+					di->OperationsSupported[di->OperationsSupported_len+9]  = PTP_OC_NIKON_StartLiveView;
+					di->OperationsSupported[di->OperationsSupported_len+10] = PTP_OC_NIKON_EndLiveView;
+					di->OperationsSupported[di->OperationsSupported_len+11] = PTP_OC_NIKON_GetLiveViewImg;
+					di->OperationsSupported[di->OperationsSupported_len+12] = PTP_OC_NIKON_MfDrive;
+					di->OperationsSupported[di->OperationsSupported_len+13] = PTP_OC_NIKON_ChangeAfArea;
+					di->OperationsSupported[di->OperationsSupported_len+14] = PTP_OC_NIKON_AfDriveCancel;
+					/* only opcodes up to 9206 ... I think. */
+					di->OperationsSupported_len += 15;
+				}
+			}
+			if ((nikond >= 3200) && (nikond < 3999)) {
+				GP_LOG_D("The D3xxx series hides commands from us ... adding all D7100 ones");
+				if (!ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
+					C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 19)));
+					di->OperationsSupported[di->OperationsSupported_len+0]  = PTP_OC_NIKON_GetVendorPropCodes;
+					di->OperationsSupported[di->OperationsSupported_len+1]  = PTP_OC_NIKON_CheckEvent;
+					di->OperationsSupported[di->OperationsSupported_len+2]  = PTP_OC_NIKON_Capture;
+					di->OperationsSupported[di->OperationsSupported_len+3]  = PTP_OC_NIKON_AfDrive;
+					di->OperationsSupported[di->OperationsSupported_len+4]  = PTP_OC_NIKON_SetControlMode;
+					di->OperationsSupported[di->OperationsSupported_len+5]  = PTP_OC_NIKON_DeviceReady;
+					di->OperationsSupported[di->OperationsSupported_len+6]  = PTP_OC_NIKON_AfCaptureSDRAM;
+					di->OperationsSupported[di->OperationsSupported_len+7]  = PTP_OC_NIKON_DelImageSDRAM;
+
+					di->OperationsSupported[di->OperationsSupported_len+8]  = PTP_OC_NIKON_GetPreviewImg;
+					di->OperationsSupported[di->OperationsSupported_len+9]  = PTP_OC_NIKON_StartLiveView;
+					di->OperationsSupported[di->OperationsSupported_len+10] = PTP_OC_NIKON_EndLiveView;
+					di->OperationsSupported[di->OperationsSupported_len+11] = PTP_OC_NIKON_GetLiveViewImg;
+					di->OperationsSupported[di->OperationsSupported_len+12] = PTP_OC_NIKON_MfDrive;
+					di->OperationsSupported[di->OperationsSupported_len+13] = PTP_OC_NIKON_ChangeAfArea;
+					di->OperationsSupported[di->OperationsSupported_len+14] = PTP_OC_NIKON_InitiateCaptureRecInMedia;
+					di->OperationsSupported[di->OperationsSupported_len+15] = PTP_OC_NIKON_AfDriveCancel;
+					di->OperationsSupported[di->OperationsSupported_len+15] = PTP_OC_NIKON_AfDriveCancel;
+					di->OperationsSupported[di->OperationsSupported_len+16] = PTP_OC_NIKON_StartMovieRecInCard;
+					di->OperationsSupported[di->OperationsSupported_len+17] = PTP_OC_NIKON_EndMovieRec;
+					di->OperationsSupported[di->OperationsSupported_len+18] = PTP_OC_NIKON_TerminateCapture;
+					/* probably more */
+					di->OperationsSupported_len += 19;
+				}
 			}
 		}

@@ -1052,7 +1109,7 @@
 	{"Nikon:DSC D5300",               0x04b0, 0x0431, PTP_CAP|PTP_CAP_PREVIEW},

 	/* https://sourceforge.net/p/gphoto/feature-requests/449/ */
-	{"Nikon:DSC D3300",               0x04b0, 0x0433, PTP_CAP|PTP_CAP_PREVIEW},
+	{"Nikon:DSC D3300",               0x04b0, 0x0433, PTP_CAP|PTP_CAP_PREVIEW|PTP_NIKON_BROKEN_CAP},

 	/* Jeremie FROLI <jfroli@webmail.alten.fr> */
 	{"Nikon:DSC D810",                0x04b0, 0x0436, PTP_CAP|PTP_CAP_PREVIEW},


Add newline to the end of "lib/tag_sizes.h" to fix a Clang error


tools: fix clang problems in scmp_bpf_sim

The clang compiler complains of a potential memory leak, this patch
fixes it.

Acked-by: Tom Hromatka <96b9c1f2c09b98d7a09b4688fc637f1494d8e182@oracle.com>
Signed-off-by: Paul Moore <a027184a55211cd23e3f3094f1fdc728df5e0500@paul-moore.com>

--- tools/scmp_bpf_sim.c
+++ tools/scmp_bpf_sim.c
@@ -289,6 +289,8 @@
 				exit_fault(EINVAL);
 			break;
 		case 'f':
+			if (opt_file)
+				exit_fault(EINVAL);
 			opt_file = strdup(optarg);
 			if (opt_file == NULL)
 				exit_fault(ENOMEM);


fixed: getDeterminant2(..) and getDeterminant3()

--- include/BALL/MATHS/analyticalGeometry.h
+++ include/BALL/MATHS/analyticalGeometry.h
@@ -1,4 +1,4 @@
-// $Id: analyticalGeometry.h,v 1.15 2000/03/26 12:12:20 oliver Exp $
+// $Id: analyticalGeometry.h,v 1.16 2000/03/26 16:24:06 amoll Exp $

 #ifndef BALL_MATHS_ANALYTICALGEOMETRY_H
 #define BALL_MATHS_ANALYTICALGEOMETRY_H
@@ -112,6 +112,7 @@
 	BALL_INLINE
 	T GetDeterminant2(const T* m)
 	{
+		Size dim = 2;
 		return (BALL_CELL(0,0) * BALL_CELL(1,1) - BALL_CELL(0,1) * BALL_CELL(1,0));
 	}
 	/**	Get the determinant of an 2x2 matrix.
@@ -134,6 +135,7 @@
 	BALL_INLINE
 	T GetDeterminant3(const T *m)
 	{
+		Size dim = 3;
 		return (  BALL_CELL(0,0) * BALL_CELL(1,1) * BALL_CELL(2,2)
 						+ BALL_CELL(0,1) * BALL_CELL(1,2) * BALL_CELL(2,0)
 						+ BALL_CELL(0,2) * BALL_CELL(1,0) * BALL_CELL(2,1)


aded sony sx-hx80

aded sony sx-hx80

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -1168,6 +1168,9 @@
 	{"Sony:Alpha-A68 (MTP)",      0x054c, 0x0779, 0},
 	/* https://github.com/gphoto/libgphoto2/issues/70 */
 	{"Sony:Alpha-A6300 (MTP)",    0x054c, 0x077a, 0},
+
+	/* gphoto-devel  email report */
+	{"Sony:DSC-HX80",	      0x054c, 0x0780, 0},

 	/* https://github.com/gphoto/libgphoto2/issues/190 */
 	{"Sony:Alpha-A6500",	      0x054c, 0x0784, 0},


WRJSONRepresentable protocol changed.

WRJSONRepresentable protocol changed.

--- WRService/Classes/WRObjectOperation.h
+++ WRService/Classes/WRObjectOperation.h
@@ -46,7 +46,7 @@

-@protocol WRJSONRepresentable <WRObjectOperationProtocol, WRRequestProtocol>
+@protocol WRJSONRepresentable <WRObjectOperationProtocol>

 @required
 - (NSDictionary*) jsonRepresentation;


crate: Use indices

crate: Use indices

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

Reviewed-by: Robert Bragg <12e9293ec6b30c7fa8a0926af42807e929c1684f@linux.intel.com>

--- examples/cogl-crate.c
+++ examples/cogl-crate.c
@@ -9,6 +9,7 @@

   CoglMatrix view;

+  CoglIndices *indices;
   CoglPrimitive *prim;
   CoglTexture *texture;
   CoglPipeline *crate_pipeline;
@@ -31,62 +32,46 @@
 static CoglColor black;
 static CoglColor white;

-/* A cube modelled as a list of triangles. Potentially this could be
- * done more efficiently as a triangle strip or using a separate index
- * array, but this way is pretty simple, if a little verbose. */
-CoglVertexP3T2 vertices[] =
+/* A cube modelled using 4 vertices for each face.
+ *
+ * We use an index buffer when drawing the cube later so the GPU will
+ * actually read each face as 2 separate triangles.
+ */
+static CoglVertexP3T2 vertices[] =
 {
   /* Front face */
   { /* pos = */ -1.0f, -1.0f,  1.0f, /* tex coords = */ 0.0f, 1.0f},
   { /* pos = */  1.0f, -1.0f,  1.0f, /* tex coords = */ 1.0f, 1.0f},
   { /* pos = */  1.0f,  1.0f,  1.0f, /* tex coords = */ 1.0f, 0.0f},
-
-  { /* pos = */ -1.0f, -1.0f,  1.0f, /* tex coords = */ 0.0f, 1.0f},
-  { /* pos = */  1.0f,  1.0f,  1.0f, /* tex coords = */ 1.0f, 0.0f},
   { /* pos = */ -1.0f,  1.0f,  1.0f, /* tex coords = */ 0.0f, 0.0f},

   /* Back face */
   { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 0.0f},
   { /* pos = */ -1.0f,  1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f},
   { /* pos = */  1.0f,  1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f},
-
-  { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 0.0f},
-  { /* pos = */  1.0f,  1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f},
   { /* pos = */  1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 0.0f},

   /* Top face */
   { /* pos = */ -1.0f,  1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f},
   { /* pos = */ -1.0f,  1.0f,  1.0f, /* tex coords = */ 0.0f, 0.0f},
   { /* pos = */  1.0f,  1.0f,  1.0f, /* tex coords = */ 1.0f, 0.0f},
-
-  { /* pos = */ -1.0f,  1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f},
-  { /* pos = */  1.0f,  1.0f,  1.0f, /* tex coords = */ 1.0f, 0.0f},
   { /* pos = */  1.0f,  1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f},

   /* Bottom face */
   { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f},
   { /* pos = */  1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f},
   { /* pos = */  1.0f, -1.0f,  1.0f, /* tex coords = */ 0.0f, 0.0f},
-
-  { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f},
-  { /* pos = */  1.0f, -1.0f,  1.0f, /* tex coords = */ 0.0f, 0.0f},
   { /* pos = */ -1.0f, -1.0f,  1.0f, /* tex coords = */ 1.0f, 0.0f},

   /* Right face */
   { /* pos = */ 1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 0.0f},
   { /* pos = */ 1.0f,  1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f},
   { /* pos = */ 1.0f,  1.0f,  1.0f, /* tex coords = */ 0.0f, 1.0f},
-
-  { /* pos = */ 1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 0.0f},
-  { /* pos = */ 1.0f,  1.0f,  1.0f, /* tex coords = */ 0.0f, 1.0f},
   { /* pos = */ 1.0f, -1.0f,  1.0f, /* tex coords = */ 0.0f, 0.0f},

   /* Left face */
   { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 0.0f},
   { /* pos = */ -1.0f, -1.0f,  1.0f, /* tex coords = */ 1.0f, 0.0f},
-  { /* pos = */ -1.0f,  1.0f,  1.0f, /* tex coords = */ 1.0f, 1.0f},
-
-  { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 0.0f},
   { /* pos = */ -1.0f,  1.0f,  1.0f, /* tex coords = */ 1.0f, 1.0f},
   { /* pos = */ -1.0f,  1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f}
 };
@@ -217,9 +202,21 @@
   cogl_color_set_from_4ub (&black, 0x00, 0x00, 0x00, 0xff);
   cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);

+  /* rectangle indices allow the GPU to interpret a list of quads (the
+   * faces of our cube) as a list of triangles.
+   *
+   * Since this is a very common thing to do
+   * cogl_get_rectangle_indices() is a convenience function for
+   * accessing internal index buffers that can be shared.
+   */
+  data.indices = cogl_get_rectangle_indices (6 /* n_rectangles */);
   data.prim = cogl_primitive_new_p3t2 (COGL_VERTICES_MODE_TRIANGLES,
                                        G_N_ELEMENTS (vertices),
                                        vertices);
+  /* Each face will have 6 indices so we have 6 * 6 indices in total... */
+  cogl_primitive_set_indices (data.prim,
+                              data.indices,
+                              6 * 6);

   /* Load a jpeg crate texture from a file */
   printf ("crate.jpg (CC by-nc-nd http://bit.ly/9kP45T) ShadowRunner27 http://bit.ly/m1YXLh\n");


Register IssuedDiags with topmost Transaction.

--- include/cling/Interpreter/Transaction.h
+++ include/cling/Interpreter/Transaction.h
@@ -310,9 +310,11 @@
     }

     IssuedDiags getIssuedDiags() const {
-      return static_cast<IssuedDiags>(m_IssuedDiags);
-    }
-    void setIssuedDiags(IssuedDiags val) { m_IssuedDiags = val; }
+      return static_cast<IssuedDiags>(getTopmostParent()->m_IssuedDiags);
+    }
+    void setIssuedDiags(IssuedDiags val) {
+      getTopmostParent()->m_IssuedDiags = val;
+    }

     const CompilationOptions& getCompilationOpts() const { return m_Opts; }
     CompilationOptions& getCompilationOpts() { return m_Opts; }
@@ -367,6 +369,24 @@
     ///
     const Transaction* getParent() const { return m_Parent; }

+    ///\brief If the transaction was nested into another transaction returns
+    /// the topmost transaction, else this.
+    ///
+    Transaction* getTopmostParent() {
+      const Transaction* ConstThis = const_cast<const Transaction*>(this);
+      return const_cast<Transaction*>(ConstThis->getTopmostParent());
+    }
+
+    ///\brief If the transaction was nested into another transaction returns
+    /// the topmost transaction, else this.
+    ///
+    const Transaction* getTopmostParent() const {
+      const Transaction* ret = this;
+      while (ret->getParent())
+        ret = ret->getParent();
+      return ret;
+    }
+
     ///\brief Sets the nesting transaction of a nested transaction.
     ///
     ///\param[in] parent - The nesting transaction.


This patch addresses some issues in destroying an ftmember instance.

Signed-off-by: Ian Bell <0d758edcea1ee41e310557e12912661536d29218@nyx.com>

--- mama/c_cpp/src/c/ft.c
+++ mama/c_cpp/src/c/ft.c
@@ -322,7 +322,11 @@
         return ret;

     /* cancel timer. */
+    if (impl->myHeartbeatTimer)
+    {
     mamaTimer_destroy (impl->myHeartbeatTimer);
+        impl->myHeartbeatTimer=NULL;
+    }
     stopTimeoutTimer (impl);
     impl->myIsActive = 0;
     impl->myIncarnation = 0;
@@ -624,7 +628,7 @@
                          void*              closure)
 {
     mamaFtMemberImpl* impl = (mamaFtMemberImpl*)closure;
-    mama_log (MAMA_LOG_LEVEL_FINE, "MAMA multicast FT: heartbeat timer has fired");
+    mama_log (MAMA_LOG_LEVEL_FINEST, "MAMA multicast FT: heartbeat timer has fired");
     impl->myHeartbeatTick++;
     impl->ftSendHeartbeat (impl);
 }
@@ -666,8 +670,11 @@
 {
     mama_status status;
     mama_log (MAMA_LOG_LEVEL_FINE, "MAMA FT: stopping timeout timer");
-    status = mamaTimer_destroy (impl->myTimeoutTimer);
-    impl->myTimeoutTimer = NULL;
+    if (impl->myTimeoutTimer)
+    {
+        status = mamaTimer_destroy (impl->myTimeoutTimer);
+        impl->myTimeoutTimer = NULL;
+    }
     return status;
 }

@@ -677,6 +684,7 @@
     return mamaTimer_reset (impl->myTimeoutTimer);
 }

+static
 int mamaBetterCredentials (mamaFtMemberImpl*  impl, unsigned int weight,
 					  unsigned int incarnation, in_addr_t ipAddr, int pid)
 {
@@ -729,14 +737,14 @@
     if ((hbPid == impl->myPid) && (hbIpAddr == impl->myIP))
     {
         /* We sent this one ourselves. */
-         mama_log (MAMA_LOG_LEVEL_FINER, "MAMA multicast FT: received own heartbeat");
+         mama_log (MAMA_LOG_LEVEL_FINEST, "MAMA multicast FT: received own heartbeat");
         return;
     }

     if (mamaBetterCredentials(impl, hbWeight,hbIncarnation,hbIpAddr,hbPid) == 0)
     {
-        mama_log (MAMA_LOG_LEVEL_FINER,
+        mama_log (MAMA_LOG_LEVEL_FINEST,
                                   "MAMA NATIVE FT: received heartbeat");

         if (hbIncarnation >= impl->myNextIncarnation)
@@ -751,7 +759,7 @@
     }
     else
     {
-        mama_log (MAMA_LOG_LEVEL_FINER,
+        mama_log (MAMA_LOG_LEVEL_FINEST,
                 "MAMA NATIVE FT: received heartbeat from an instance with lower"
                   " priority (ignored)");
         return ;
@@ -1086,7 +1094,10 @@
     {
         /* unsubscribe from io */
         if (gReadHandler != NULL)
+        {
             mamaIo_destroy (gReadHandler);
+            gReadHandler = NULL;
+        }
     }

     return MAMA_STATUS_OK;


Handle cases where the EOS creates a new directory during capture. addresses https://github.com/gphoto/gphoto2/issues/122

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -3408,9 +3408,8 @@

 				/* just add it to the filesystem, and return in CameraPath */
 				GP_LOG_D ("Found new object! OID 0x%x, name %s", (unsigned int)entry.u.object.oid, entry.u.object.oi.Filename);
-				newobject = entry.u.object.oid;
 				memcpy (&oi, &entry.u.object.oi, sizeof(oi));
-				ret = ptp_object_want (params, newobject, 0, &ob);
+				ret = ptp_object_want (params, entry.u.object.oid, 0, &ob);
 				if (ret != PTP_RC_OK)
 					continue;
 				strcpy  (path->name,  oi.Filename);
@@ -3419,6 +3418,10 @@
 				/* delete last / or we get confused later. */
 				path->folder[ strlen(path->folder)-1 ] = '\0';
 				gp_filesystem_append (camera->fs, path->folder, path->name, context);
+				/* The camera might have rotated the folder from NNNCANON to NNN+1CANON , image probably comes next ... */
+				if  (entry.u.object.oi.ObjectFormat == PTP_OFC_Association)
+					continue;
+				newobject = entry.u.object.oid;
 				break;/* for RAW+JPG mode capture, we just return the first image for now, and
 				       * let wait_for_event get the rest. */
 			default:
@@ -4994,7 +4997,10 @@
 					/* delete last / or we get confused later. */
 					path->folder[ strlen(path->folder)-1 ] = '\0';
 					gp_filesystem_append (camera->fs, path->folder, path->name, context);
-					*eventtype = (entry.type == PTP_CANON_EOS_CHANGES_TYPE_OBJECTINFO) ? GP_EVENT_FILE_ADDED : GP_EVENT_FILE_CHANGED;
+					if (entry.u.object.oi.ObjectFormat == PTP_OFC_Association)	/* not sure if we would get folder changed */
+						*eventtype = GP_EVENT_FOLDER_ADDED;
+					else
+						*eventtype = (entry.type == PTP_CANON_EOS_CHANGES_TYPE_OBJECTINFO) ? GP_EVENT_FILE_ADDED : GP_EVENT_FILE_CHANGED;
 					*eventdata = path;
 					return GP_OK;
 				case PTP_CANON_EOS_CHANGES_TYPE_PROPERTY:


Add downsample to examples.

Add downsample to examples.

Signed-off-by: Nils Homer <03ae843931f6273e8647587fc43a9bf67eb9897b@lifetech.com>

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

--- examples/downsample.c
+++ examples/downsample.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include "sam.h"
+
+struct fetchdata {
+    float sample;
+    long int total, filtered;
+};
+
+// callback for bam_fetch()
+static int fetch_func(const bam1_t *b, void *data)
+{
+        struct fetchdata *d = (struct fetchdata *) data;
+        d->total++;
+
+        // Validate b against criteria
+        uint32_t flag = b->core.flag;
+
+        // If read is not mapped or flaged as duplicate skip
+        if(flag & BAM_FUNMAP || flag & BAM_FDUP) {
+            return 0;
+        }
+
+        // Use only primary alignments
+        if(flag & BAM_FSECONDARY) {
+            return 0; // Don't use secondary alignments
+        }
+
+        d->filtered++;
+
+        if( ( (float)rand() / (float) RAND_MAX ) > d->sample ) return 0;
+
+        return 1;
+}
+
+int main(int argc, char *argv[])
+{
+        /* FIXME - stdin > stdout */
+	if (argc != 3) {
+		fprintf(stderr, "Usage: downsample <in.bam> <out.bam>\n");
+		return 1;
+	}
+
+	float sample = 0.50f;
+
+	samfile_t *in = samopen(argv[1], "rb", 0);
+	if(in == 0) {
+		fprintf(stderr, "Failed to open input BAM file %s\n", argv[1]);
+		return 1;
+	}
+
+	samfile_t *out;
+	/* Provide bam_header_t from source file as header for output */
+	out = samopen(argv[2], "wbh", in->header);
+	if(out == 0) {
+		fprintf(stderr, "Failed to open output file %s\n", argv[1]);
+		return 1;
+	}
+
+        /* NB: rand is seeded with constant - result should be reproducible */
+        srand(42);
+
+        struct fetchdata data = { sample, 0, 0 };
+
+        bam1_t *b = bam_init1();
+        unsigned long count = 0;
+        while(samread(in, b) > 0) {
+            if(fetch_func(b, &data) != 0) continue;
+
+            // Write to out
+            samwrite(out, b);
+            count++;
+        }
+        bam_destroy1(b);
+
+        fprintf(stderr, "Sampled %ld reads out of %ld total, %ld filtered [mapped, primary, non-duplicate]\n",count, data.total, data.filtered);
+
+	samclose(in);
+	samclose(out);
+	return 0;
+}


Set orientation

Set orientation

--- panel-plugin/stopwatch.c
+++ panel-plugin/stopwatch.c
@@ -36,7 +36,6 @@
 {
 	StopwatchPlugin *stopwatch;
 	GtkOrientation orientation;
-	GtkWidget *label;

 	stopwatch = g_slice_new0(StopwatchPlugin);

@@ -51,9 +50,11 @@
 	gtk_widget_show (stopwatch->box);
 	gtk_container_add (GTK_CONTAINER (stopwatch->ebox), stopwatch->box);

-	label = gtk_label_new (_(" 00:00:00 "));
-	gtk_widget_show (label);
-	gtk_box_pack_start (GTK_BOX (stopwatch->box), label, FALSE, FALSE, 0);
+	stopwatch->label = gtk_label_new (_(" 00:00:00 "));
+	gtk_label_set_selectable (GTK_LABEL (stopwatch->label), FALSE);
+	gtk_label_set_angle (GTK_LABEL (stopwatch->label), orientation == GTK_ORIENTATION_HORIZONTAL ? 0 : 270);
+	gtk_widget_show (stopwatch->label);
+	gtk_box_pack_start (GTK_BOX (stopwatch->box), stopwatch->label, FALSE, FALSE, 0);

 	stopwatch->button = gtk_toggle_button_new ();
 	gtk_widget_show (stopwatch->button);
@@ -73,6 +74,32 @@
 }

 static void
+stopwatch_orientation_changed (XfcePanelPlugin *plugin,
+			       GtkOrientation orientation,
+			       StopwatchPlugin *stopwatch)
+{
+	gtk_orientable_set_orientation (GTK_ORIENTABLE (stopwatch->box), orientation);
+	gtk_label_set_angle (GTK_LABEL (stopwatch->label), orientation == GTK_ORIENTATION_HORIZONTAL ? 0 : 270);
+}
+
+static gboolean
+stopwatch_size_changed (XfcePanelPlugin *plugin,
+			gint size,
+			StopwatchPlugin *stopwatch)
+{
+	GtkOrientation orientation;
+	orientation = xfce_panel_plugin_get_orientation (plugin);
+
+	if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+		gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, size);
+	} else {
+		gtk_widget_set_size_request (GTK_WIDGET (plugin), size, -1);
+	}
+
+	return TRUE;
+}
+
+static void
 stopwatch_construct (XfcePanelPlugin *plugin)
 {
 	StopwatchPlugin *stopwatch;
@@ -84,4 +111,6 @@
 	xfce_panel_plugin_add_action_widget (plugin, stopwatch->ebox);

 	g_signal_connect (G_OBJECT (plugin), "free-data", G_CALLBACK (stopwatch_free), stopwatch);
+	g_signal_connect (G_OBJECT (plugin), "orientation-changed", G_CALLBACK (stopwatch_orientation_changed), stopwatch);
+	g_signal_connect (G_OBJECT (plugin), "size-changed", G_CALLBACK (stopwatch_size_changed), stopwatch);
 }