n_tty: Factor flagged char handling into separate fn

Prepare for modal receive_buf() handling; factor handling for
TTY_BREAK, TTY_PARITY, TTY_FRAME and TTY_OVERRUN into
n_tty_receive_char_flagged().

Signed-off-by: Peter Hurley <4b8373d016f277527198385ba72fda0feb5da015@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/tty/n_tty.c
+++ drivers/tty/n_tty.c
@@ -1468,6 +1468,29 @@
 	put_tty_queue(c, ldata);
 }

+static void
+n_tty_receive_char_flagged(struct tty_struct *tty, unsigned char c, char flag)
+{
+	char buf[64];
+
+	switch (flag) {
+	case TTY_BREAK:
+		n_tty_receive_break(tty);
+		break;
+	case TTY_PARITY:
+	case TTY_FRAME:
+		n_tty_receive_parity_error(tty, c);
+		break;
+	case TTY_OVERRUN:
+		n_tty_receive_overrun(tty);
+		break;
+	default:
+		printk(KERN_ERR "%s: unknown flag %d\n",
+		       tty_name(tty, buf), flag);
+		break;
+	}
+}
+
 /**
  *	n_tty_receive_buf	-	data receive
  *	@tty: terminal device
@@ -1511,34 +1534,19 @@
 			  char *fp, int count)
 {
 	struct n_tty_data *ldata = tty->disc_data;
-	char	flags = TTY_NORMAL;
-	char	buf[64];

 	if (ldata->real_raw)
 		n_tty_receive_buf_real_raw(tty, cp, fp, count);
 	else {
+		char flag = TTY_NORMAL;
+
 		while (count--) {
 			if (fp)
-				flags = *fp++;
-			switch (flags) {
-			case TTY_NORMAL:
+				flag = *fp++;
+			if (likely(flag == TTY_NORMAL))
 				n_tty_receive_char(tty, *cp++);
-				break;
-			case TTY_BREAK:
-				n_tty_receive_break(tty);
-				break;
-			case TTY_PARITY:
-			case TTY_FRAME:
-				n_tty_receive_parity_error(tty, *cp++);
-				break;
-			case TTY_OVERRUN:
-				n_tty_receive_overrun(tty);
-				break;
-			default:
-				printk(KERN_ERR "%s: unknown flag %d\n",
-				       tty_name(tty, buf), flags);
-				break;
-			}
+			else
+				n_tty_receive_char_flagged(tty, *cp++, flag);
 		}

 		flush_echoes(tty);


vfb: use display information in info not in var for panning

We must not use any information in the passed var besides xoffset,
yoffset and vmode as otherwise applications might abuse it.

Signed-off-by: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>
Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>

--- drivers/video/vfb.c
+++ drivers/video/vfb.c
@@ -395,8 +395,8 @@
 		    || var->xoffset)
 			return -EINVAL;
 	} else {
-		if (var->xoffset + var->xres > info->var.xres_virtual ||
-		    var->yoffset + var->yres > info->var.yres_virtual)
+		if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+		    var->yoffset + info->var.yres > info->var.yres_virtual)
 			return -EINVAL;
 	}
 	info->var.xoffset = var->xoffset;


i#287: disable -syscall_sentinels by default until win7 fixes
are in as it causes too many win7 app errors

SVN-Revision: 217

--- drmemory/optionsx.h
+++ drmemory/optionsx.h
@@ -274,9 +274,9 @@
 OPTION_CLIENT_STRING(drmemscope, auxlib, "",
                      "Load auxiliary system call handling library",
                      "This option should specify the basename of an auxiliary system call handling library found in the same directory as the Dr. Memory client library.")
-OPTION_CLIENT_BOOL(drmemscope, syscall_sentinels, true,
+OPTION_CLIENT_BOOL(drmemscope, syscall_sentinels, false,
                    "Use sentinels to detect writes on unknown syscalls",
-                   "Use sentinels to detect writes on unknown syscalls.  Can potentially result in incorrect behavior if definedness information is incorrect or application threads read syscall param info simultaneously.")
+                   "Use sentinels to detect writes on unknown syscalls and reduce false positives, in particular for uninitialized reads.  Can potentially result in incorrect behavior if definedness information is incorrect or application threads read syscall parameter info simultaneously.")
 /* for chromium we need to ignore malloc_usable_size, and for most windows
  * uses it doesn't exist, so we have this on by default (xref i#314, i#320)
  */


Added _noise field to Pot class.

Added _noise field to Pot class.

--- src/app/ui.h
+++ src/app/ui.h
@@ -116,6 +116,7 @@
     Pot();
     ~Pot()=default;

+    void set_noise(uint32_t noise) { _noise = noise; }
     void set_hysteresis(uint32_t percent);

     uint32_t process(uint32_t value);
@@ -128,6 +129,7 @@
     MovingAverage<32> _avg;
     RingBuffer<uint16_t, 128> _history;
     uint32_t _hysteresis;
+    uint32_t _noise;
 };

 /*!


applet.c: Update includes

applet.c: Update includes

--- src/applet.c
+++ src/applet.c
@@ -22,20 +22,22 @@
 #endif

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

 #include <glib.h>
 #include <gtk/gtk.h>
+#include <gdk/gdk.h>

 #include <libwnck/libwnck.h>

 #include <panel-applet.h>
-#include <panel-applet-gconf.h>
 #include <gconf/gconf-client.h>

 #include "task-list.h"
 #include "task-title.h"

 #define SHOW_WIN_KEY "show_all_windows"
+#define WNCK_MENU_UI_DIR "data/menu.xml"

 typedef struct {
     GtkWidget    *tasks;


testopt: could assign type and refine help message

--- msgq/testopt.c
+++ msgq/testopt.c
@@ -5,7 +5,7 @@
 #include <sys/ipc.h>
 #include <sys/msg.h>

-#define MAX_SEND_SIZE           1024
+#define MAX_SEND_SIZE           64
 #define YOSE_MESSAGE_TYPE       9
 #define DEFAULT_INVALID_KEY     0xDEADBEEF

@@ -14,13 +14,13 @@
     char mtext[MAX_SEND_SIZE];
 };

-int send_msgq(int key, const char* str)
+int send_msgq(int key, int type, const char* str)
 {
     int msqid;
     struct mymsgbuf buf;
     int sendlength;

-    printf("key: 0x%08X\nstr: %s\n", key, str);
+    printf("send_msgq(): key: 0x%08X\ntype: %d\nstr: %s\n", key, type, str);
     msqid = msgget( key, 0660 | IPC_CREAT );
     if ( msqid < 0 ) {
         perror("msgsnd: create message queue error");
@@ -29,7 +29,7 @@
         printf("msgsnd: msqid: %d\n", msqid);
     }

-    buf.mtype = YOSE_MESSAGE_TYPE;
+    buf.mtype = type;
     sendlength = sizeof(struct mymsgbuf) - sizeof(long);
     strncpy(buf.mtext, str, MAX_SEND_SIZE - 32);

@@ -37,7 +37,7 @@
         perror("msgsnd: send message error");
         return -1;
     }
-    printf("sendMyMessage: %s\n", buf.mtext);
+    //printf("sendMyMessage: %s\n", buf.mtext);
     return 0;
 }

@@ -45,14 +45,16 @@
 {
     int cmd_opt = 0;
     int msgq_key = DEFAULT_INVALID_KEY;
+    int msgq_type = YOSE_MESSAGE_TYPE;  // default value
     int tmp_key = 0;
+    int tmp_type = 0;
     int res = 0;
     int r;

     //fprintf(stderr, "argc: %d\n", argc);
     while(1) {
         //fprintf(stderr, "process index: %d\n", optind);
-        cmd_opt = getopt(argc, argv, "hk:vycq");
+        cmd_opt = getopt(argc, argv, "hk:t:vycq");

         /* End condition always first */
         if (cmd_opt == -1) {
@@ -68,23 +70,28 @@
         switch (cmd_opt) {

             case 'h':
-                printf("-h  help message\n"
+                fprintf(stderr,
+                    "testopt [options] <message>\n"
+                    "-h  help message\n"
                     "-k  assign key\n"
+                    "-t  assign type (default:9)\n"
                     "-v  videocontrol to yoseui key\n"
                     "-y  yoseui to videocontrol key\n"
-                    "-c  yoseui to clock key\n"
-                    );
+                    "-c  yoseui to clock key\n");
                 break;
             /* Single arg */
             case 'k':
                 //fprintf(stderr, "option arg: %s\n", optarg);
                 tmp_key = strtol(optarg, NULL, 16);
-                //printf("tmp_key = 0x%08X\n", tmp_key);
+                fprintf(stderr, "assign key = 0x%08X\n", tmp_key);
                 if (tmp_key > 0) {
                     msgq_key = tmp_key;
                 }
                 break;
-
+            case 't':
+                tmp_type = strtol(optarg, NULL, 10);
+                fprintf(stderr, "assign type = %d\n", tmp_type);
+                msgq_type = tmp_type;
             case 'v':
                 msgq_key = 0x600DFEA6;
                 break;
@@ -124,7 +131,7 @@
     }

     if (msgq_key != DEFAULT_INVALID_KEY) {
-        res = send_msgq(msgq_key, msg_str);
+        res = send_msgq(msgq_key, msgq_type, msg_str);
     }

     return res;


lib/tpm2_eventlog.c: Fix for illegal pointer cast

Fixes #1959

Signed-off-by: Imran Desai <d01faadd01d89088a38277c634ffb396f2b368f8@intel.com>

--- lib/tpm2_eventlog_yaml.c
+++ lib/tpm2_eventlog_yaml.c
@@ -148,9 +148,8 @@
     }

     char *var_data = calloc (1, VAR_DATA_HEX_SIZE(data));
-    uint8_t *variable_data = (uint8_t*)((uintptr_t)data->UnicodeName +
-                                        data->UnicodeNameLength *
-                                        sizeof(char16_t));
+    uint8_t *variable_data = (uint8_t*)&data->UnicodeName[
+        data->UnicodeNameLength];
     if (var_data == NULL) {
         LOG_ERR("failled to allocate data: %s\n", strerror(errno));
         return false;


convert tabs to space

convert tabs to space

joys of using multiple editors from multiple environments ...

--- programs/bench.c
+++ programs/bench.c
@@ -239,28 +239,28 @@
         const char* const marks[NB_MARKS] = { " |", " /", " =",  "\\" };
         U32 markNb = 0;

-		UTIL_initTimer(&coolTick);
-		UTIL_getTime(&coolTime);
+        UTIL_initTimer(&coolTick);
+        UTIL_getTime(&coolTime);
         DISPLAYLEVEL(2, "\r%79s\r", "");
         while (!cCompleted || !dCompleted) {

             /* overheat protection */
-			if (UTIL_clockSpanMicro(coolTime, coolTick) > ACTIVEPERIOD_MICROSEC) {
+            if (UTIL_clockSpanMicro(coolTime, coolTick) > ACTIVEPERIOD_MICROSEC) {
                 DISPLAYLEVEL(2, "\rcooling down ...    \r");
                 UTIL_sleep(COOLPERIOD_SEC);
                 UTIL_getTime(&coolTime);
             }

             if (!g_decodeOnly) {
-				UTIL_time_t clockTick, clockStart;
+                UTIL_time_t clockTick, clockStart;
                 /* Compression */
                 DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->\r", marks[markNb], displayName, (U32)srcSize);
                 if (!cCompleted) memset(compressedBuffer, 0xE5, maxCompressedSize);  /* warm up and erase result buffer */

                 UTIL_sleepMilli(1);  /* give processor time to other processes */
                 UTIL_waitForNextTick(ticksPerSecond);
-				UTIL_initTimer(&clockTick);
-				UTIL_getTime(&clockStart);
+                UTIL_initTimer(&clockTick);
+                UTIL_getTime(&clockStart);

                 if (!cCompleted) {   /* still some time to do compression tests */
                     ZSTD_parameters zparams = ZSTD_getParams(cLevel, avgSize, dictBufferSize);
@@ -301,9 +301,9 @@
                             blockTable[blockNb].cSize = rSize;
                         }
                         nbLoops++;
-					} while (UTIL_clockSpanMicro(clockStart, clockTick) < clockLoop);
+                    } while (UTIL_clockSpanMicro(clockStart, clockTick) < clockLoop);
                     ZSTD_freeCDict(cdict);
-					{   U64 const clockSpanMicro = UTIL_clockSpanMicro(clockStart, clockTick);
+                    {   U64 const clockSpanMicro = UTIL_clockSpanMicro(clockStart, clockTick);
                         if (clockSpanMicro < fastestC*nbLoops) fastestC = clockSpanMicro / nbLoops;
                         totalCTime += clockSpanMicro;
                         cCompleted = (totalCTime >= maxTime);
@@ -336,8 +336,8 @@
                 UTIL_time_t clockStart, clockTick;
                 ZSTD_DDict* const ddict = ZSTD_createDDict(dictBuffer, dictBufferSize);
                 if (!ddict) EXM_THROW(2, "ZSTD_createDDict() allocation failure");
-				UTIL_initTimer(&clockTick);
-				UTIL_getTime(&clockStart);
+                UTIL_initTimer(&clockTick);
+                UTIL_getTime(&clockStart);
                 do {
                     U32 blockNb;
                     for (blockNb=0; blockNb<nbBlocks; blockNb++) {
@@ -354,7 +354,7 @@
                         blockTable[blockNb].resSize = regenSize;
                     }
                     nbLoops++;
-				} while (UTIL_clockSpanMicro(clockStart, clockTick) < clockLoop);
+                } while (UTIL_clockSpanMicro(clockStart, clockTick) < clockLoop);
                 ZSTD_freeDDict(ddict);
                 {   U64 const clockSpanMicro = UTIL_clockSpanMicro(clockStart, clockTick);
                     if (clockSpanMicro < fastestD*nbLoops) fastestD = clockSpanMicro / nbLoops;


fixed : shadow global variable on gcc 4.4 (minor)

--- programs/lz4io.c
+++ programs/lz4io.c
@@ -853,17 +853,17 @@
 static unsigned long long LZ4IO_passThrough(FILE* finput, FILE* foutput, unsigned char MNstore[MAGICNUMBER_SIZE])
 {
 	size_t buffer[PTSIZET];
-    size_t read = 1;
+    size_t readBytes = 1;
     unsigned long long total = MAGICNUMBER_SIZE;
     unsigned storedSkips = 0;

     size_t const sizeCheck = fwrite(MNstore, 1, MAGICNUMBER_SIZE, foutput);
     if (sizeCheck != MAGICNUMBER_SIZE) EXM_THROW(50, "Pass-through write error");

-    while (read) {
-        read = fread(buffer, 1, PTSIZE, finput);
-        total += read;
-        storedSkips = LZ4IO_fwriteSparse(foutput, buffer, read, storedSkips);
+    while (readBytes) {
+        readBytes = fread(buffer, 1, PTSIZE, finput);
+        total += readBytes;
+        storedSkips = LZ4IO_fwriteSparse(foutput, buffer, readBytes, storedSkips);
     }
     if (ferror(finput)) EXM_THROW(51, "Read Error")


gssapi: Apparently all usernames end with NUL. Allow it.

--- src/auth/mech-gssapi.c
+++ src/auth/mech-gssapi.c
@@ -218,6 +218,10 @@
 {
 	const unsigned char *c = data;
 	unsigned int i;
+
+	/* apparently all names end with NUL? */
+	if (len > 0 && c[len-1] == '\0')
+		len--;

 	for (i = 0; i < len; i++) {
 		if (c[i] == '\0')


Move to stable 2.7

Move to stable 2.7

--- src/QGCConfig.h
+++ src/QGCConfig.h
@@ -19,7 +19,7 @@
 #define QGC_ORG_DOMAIN "org.qgroundcontrol"

 #define QGC_APPLICATION_VERSION_MAJOR 2
-#define QGC_APPLICATION_VERSION_MINOR 6
+#define QGC_APPLICATION_VERSION_MINOR 7

 // The following #definess can be overriden from the command line so that automated build systems can
 // add additional build identification.


Don't crash if doing non-plaintext ldap passdb lookup for unknown user.

--HG--
branch : HEAD

--- src/auth/passdb-ldap.c
+++ src/auth/passdb-ldap.c
@@ -173,7 +173,12 @@
 		}
 	}

-	request->callback.verify_plain(passdb_result, auth_request);
+	if (auth_request->credentials != -1) {
+		request->callback.lookup_credentials(passdb_result, NULL,
+						     auth_request);
+	} else {
+		request->callback.verify_plain(passdb_result, auth_request);
+	}
 	auth_request_unref(&auth_request);
 	return NULL;
 }


Send event downstream to request a new key frame when valves are opened

Change-Id: Id80b60d38ca97ca9d93c6083d10f3626a682b56f

--- src/kmsrecorderendpoint.c
+++ src/kmsrecorderendpoint.c
@@ -332,17 +332,34 @@
 }

 static void
+kms_recorder_end_point_send_force_key_unit_event (GstElement * valve)
+{
+  GstStructure *s;
+  GstEvent *force_key_unit_event;
+
+  GST_DEBUG ("Sending key ");
+  s = gst_structure_new ("GstForceKeyUnit",
+      "all-headers", G_TYPE_BOOLEAN, TRUE, NULL);
+  force_key_unit_event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, s);
+  gst_element_send_event (valve, force_key_unit_event);
+}
+
+static void
 kms_recorder_end_point_open_valves (KmsRecorderEndPoint * self)
 {
   GstElement *valve;

   valve = kms_element_get_audio_valve (KMS_ELEMENT (self));
-  if (valve != NULL)
+  if (valve != NULL) {
+    kms_recorder_end_point_send_force_key_unit_event (valve);
     g_object_set (valve, "drop", FALSE, NULL);
+  }

   valve = kms_element_get_video_valve (KMS_ELEMENT (self));
-  if (valve != NULL)
+  if (valve != NULL) {
+    kms_recorder_end_point_send_force_key_unit_event (valve);
     g_object_set (valve, "drop", FALSE, NULL);
+  }
 }

 static void


recorderendpoint: Reconfigure pipeline from external thread

Change-Id: I95ba669ab2413af2c66a158f0a15d549be82f65a

--- src/kmsrecorderendpoint.c
+++ src/kmsrecorderendpoint.c
@@ -71,12 +71,6 @@

 static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };

-struct remove_data
-{
-  KmsRecorderEndPoint *recorder;
-  GstElement *element;
-};
-
 struct config_valve
 {
   GstElement *valve;
@@ -947,28 +941,6 @@
 }

 static void
-remove_element_from_pipeline (gpointer user_data)
-{
-  struct remove_data *data = user_data;
-
-  GST_DEBUG ("Remove element %" GST_PTR_FORMAT, data->element);
-
-  KMS_ELEMENT_LOCK (KMS_ELEMENT (data->recorder));
-
-  gst_element_set_locked_state (data->element, TRUE);
-  gst_element_set_state (data->element, GST_STATE_NULL);
-  gst_bin_remove (GST_BIN (data->recorder->priv->pipeline), data->element);
-
-  KMS_ELEMENT_UNLOCK (KMS_ELEMENT (data->recorder));
-}
-
-static void
-destroy_remove_data (gpointer data)
-{
-  g_slice_free (struct remove_data, data);
-}
-
-static void
 add_pending_appsinks (gpointer data, gpointer user_data)
 {
   KmsRecorderEndPoint *recorder = KMS_RECORDER_END_POINT (user_data);
@@ -1007,8 +979,8 @@
 static void
 kms_recorder_end_point_reconfigure_pipeline (KmsRecorderEndPoint * recorder)
 {
-  struct remove_data *data;
   GstPad *srcpad, *sinkpad;
+  GstElement *sink;

   /* Unlink encodebin from sinkapp */
   srcpad = gst_element_get_static_pad (recorder->priv->encodebin, "src");
@@ -1021,21 +993,16 @@
   g_object_unref (srcpad);

   /* Remove old encodebin and sink elements */
-  data = g_slice_new0 (struct remove_data);
-
-  data->recorder = recorder;
-  data->element = gst_pad_get_parent_element (sinkpad);
-  kms_recorder_end_point_add_action (recorder, remove_element_from_pipeline,
-      data, destroy_remove_data);
-  g_object_unref (data->element);
-  g_object_unref (sinkpad);
-
-  data = g_slice_new0 (struct remove_data);
-
-  data->recorder = recorder;
-  data->element = recorder->priv->encodebin;
-  kms_recorder_end_point_add_action (recorder, remove_element_from_pipeline,
-      data, destroy_remove_data);
+  sink = gst_pad_get_parent_element (sinkpad);
+  gst_element_set_locked_state (sink, TRUE);
+  gst_element_set_state (sink, GST_STATE_NULL);
+  gst_bin_remove (GST_BIN (recorder->priv->pipeline), sink);
+  g_object_unref (sink);
+
+  gst_element_set_locked_state (recorder->priv->encodebin, TRUE);
+  gst_element_set_state (recorder->priv->encodebin, GST_STATE_NULL);
+  gst_bin_remove (GST_BIN (recorder->priv->pipeline),
+      recorder->priv->encodebin);

   /* Add the new encodebin to the pipeline */
   recorder->priv->encodebin = gst_element_factory_make ("encodebin", NULL);
@@ -1068,6 +1035,19 @@
   kms_recorder_end_point_free_config_data (recorder);
 }

+static void
+kms_recorder_end_point_do_reconfiguration (gpointer user_data)
+{
+  KmsRecorderEndPoint *recorder = KMS_RECORDER_END_POINT (user_data);
+
+  KMS_ELEMENT_LOCK (KMS_ELEMENT (recorder));
+
+  kms_recorder_end_point_reconfigure_pipeline (recorder);
+  recorder->priv->state = CONFIGURED;
+
+  KMS_ELEMENT_UNLOCK (KMS_ELEMENT (recorder));
+}
+
 static GstPadProbeReturn
 event_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
 {
@@ -1090,8 +1070,8 @@
     GST_DEBUG ("No pad in blocking state");
     /* No more pending valves in blocking state */
     /* so we can remove probes to unlock pads */
-    kms_recorder_end_point_reconfigure_pipeline (recorder);
-    recorder->priv->state = CONFIGURED;
+    kms_recorder_end_point_add_action (recorder,
+        kms_recorder_end_point_do_reconfiguration, recorder, NULL);
   } else {
     GST_DEBUG ("Waiting for pads to block");
     recorder->priv->state = WAIT_PENDING;
@@ -1293,8 +1273,8 @@
     goto end;
   }

-  kms_recorder_end_point_reconfigure_pipeline (recorder);
-  recorder->priv->state = CONFIGURED;
+  kms_recorder_end_point_add_action (recorder,
+      kms_recorder_end_point_do_reconfiguration, recorder, NULL);

 end:
   KMS_ELEMENT_UNLOCK (KMS_ELEMENT (recorder));


Evas tests: Added more textblock tests, including one to verify my last fix.

git-svn-id: 6d771e449150288cc513807b7f4d2af31e9482bd@61233 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/tests/evas_test_textblock.c
+++ src/tests/evas_test_textblock.c
@@ -313,6 +313,34 @@
           }
      }

+   /* Format positions */
+   const Evas_Object_Textblock_Node_Format *fnode;
+   fnode = evas_textblock_node_format_first_get(tb);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   evas_textblock_cursor_copy(cur, main_cur);
+   fail_if(evas_textblock_cursor_pos_get(cur) != 9);
+   fail_if(evas_textblock_cursor_format_get(cur) != fnode);
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(evas_textblock_cursor_pos_get(cur) != 16);
+   fail_if(evas_textblock_cursor_format_get(cur) != fnode);
+   evas_textblock_cursor_format_next(main_cur);
+   fail_if(evas_textblock_cursor_compare(main_cur, cur));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(evas_textblock_cursor_pos_get(cur) != 9);
+   fail_if(evas_textblock_cursor_format_get(cur) != fnode);
+   evas_textblock_cursor_format_prev(main_cur);
+   fail_if(evas_textblock_cursor_compare(main_cur, cur));
+
+   evas_textblock_cursor_char_next(main_cur);
+   evas_textblock_cursor_format_prev(main_cur);
+   fail_if(evas_textblock_cursor_compare(main_cur, cur));

    /* FIXME: There is a lot more to be done. */
    END_TB_TEST();
@@ -409,6 +437,150 @@
    evas_textblock_cursor_text_prepend(main_cur, "aaa");
    fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
             EVAS_TEXTBLOCK_TEXT_MARKUP), "aaa"));
+
+   END_TB_TEST();
+}
+END_TEST
+
+/* Formats */
+START_TEST(evas_textblock_formats)
+{
+   START_TB_TEST();
+   const char *buf = "Th<b>i<font_size=15 wrap=none>s i</font_size=13>s</> a <br> te<ps>st<item></>.";
+   const Evas_Object_Textblock_Node_Format *fnode;
+   evas_object_textblock_text_markup_set(tb, buf);
+
+   /* Walk from the start */
+   fnode = evas_textblock_node_format_first_get(tb);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "+ b"));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode),
+            "+ font_size=15 wrap=none"));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode),
+            "- font_size=13"));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "- "));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "\n"));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "ps"));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "+ item"));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "- "));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(fnode);
+
+   /* Walk backwards */
+   fnode = evas_textblock_node_format_last_get(tb);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "- "));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "+ item"));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "ps"));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "\n"));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "- "));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode),
+            "- font_size=13"));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode),
+            "+ font_size=15 wrap=none"));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(!fnode);
+   fail_if(strcmp(evas_textblock_node_format_text_get(fnode), "+ b"));
+
+   fnode = evas_textblock_node_format_prev_get(fnode);
+   fail_if(fnode);
+
+   /* Cursor and format detection */
+   fnode = evas_textblock_node_format_first_get(tb);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(evas_textblock_cursor_format_is_visible_get(cur));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(evas_textblock_cursor_format_is_visible_get(cur));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(evas_textblock_cursor_format_is_visible_get(cur));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(evas_textblock_cursor_format_is_visible_get(cur));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(!evas_textblock_cursor_format_is_visible_get(cur));
+
+   fnode = evas_textblock_node_format_next_get(fnode);
+   fail_if(!fnode);
+   evas_textblock_cursor_at_format_set(cur, fnode);
+   fail_if(!evas_textblock_cursor_format_is_visible_get(cur));
+
+   size_t i = 0;
+   evas_textblock_cursor_paragraph_first(cur);
+   do
+     {
+        switch (i)
+          {
+           case 2:
+           case 3:
+           case 6:
+           case 7:
+           case 10:
+           case 14:
+           case 17:
+           case 18:
+              fail_if(!evas_textblock_cursor_is_format(cur));
+              break;
+           default:
+              fail_if(evas_textblock_cursor_is_format(cur));
+              fail_if(evas_textblock_cursor_format_is_visible_get(cur));
+              break;
+          }
+        i++;
+     }
+   while (evas_textblock_cursor_char_next(cur));

    END_TB_TEST();
 }
@@ -487,5 +659,6 @@
    tcase_add_test(tc, evas_textblock_style);
    tcase_add_test(tc, evas_textblock_aux);
    tcase_add_test(tc, evas_textblock_text_getters);
-}
-
+   tcase_add_test(tc, evas_textblock_formats);
+}
+


Fixed bug #570

Fixed bug #570

SDL_SemWaitTimeout in src/thread/generic/SDL_syssem.c line 179 (SVN trunk):

--sem->count;

should be

if (retval == 0) {
    --sem->count;
}

Without this, sem->count will underflow on timeout effectively breaking the
semaphore. It appears that the implementation has been wrong since the initial
revision.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403844

--- src/thread/generic/SDL_syssem.c
+++ src/thread/generic/SDL_syssem.c
@@ -176,7 +176,9 @@
                                      sem->count_lock, timeout);
     }
     --sem->waiters_count;
-    --sem->count;
+    if (retval == 0) {
+        --sem->count;
+    }
     SDL_UnlockMutex(sem->count_lock);

     return retval;


modify assert of htable_delete_list

modify assert of htable_delete_list

--- src/author.c
+++ src/author.c
@@ -438,7 +438,7 @@
     id = GET_IDX(idx);
     typeoff = GET_TYPE(idx);
     val = htable_delete_list(author->s->qlist, mbuf->lowerdomain.domain, typeoff, id);
-    assert(val == (void *)mbuf);
+    assert(val == NULL || val == (void *)mbuf);
     mbuf_free(mbuf);

     return 0;


lib-lda: lmtp_client_connect_tcp() shouldn't immediately call callbacks if dns lookup fails.

--- src/lib-lda/lmtp-client.c
+++ src/lib-lda/lmtp-client.c
@@ -69,6 +69,7 @@
 	struct istream *data_input;
 	unsigned char output_last;

+	unsigned int running:1;
 	unsigned int xclient_sent:1;
 	unsigned int rcpt_to_successes:1;
 	unsigned int output_finished:1;
@@ -617,11 +618,13 @@
 	if (result->ret != 0) {
 		i_error("lmtp client: DNS lookup of %s failed: %s",
 			client->host, result->error);
-		lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
-				 " (DNS lookup)");
+		if (client->running) {
+			lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
+					 " (DNS lookup)");
+		}
 	} else {
 		client->ip = result->ips[0];
-		if (lmtp_client_connect(client) < 0) {
+		if (lmtp_client_connect(client) < 0 && client->running) {
 			lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
 					 " (connect)");
 		}
@@ -668,6 +671,7 @@
 			       lmtp_client_dns_done, client,
 			       &client->dns_lookup) < 0)
 			return -1;
+		client->running = TRUE;
 		return 0;
 	}


lib-lda: If DATA input stream read fails, return error instead of truncating the mail.

--- src/lib-lda/lmtp-client.c
+++ src/lib-lda/lmtp-client.c
@@ -286,7 +286,7 @@
 	return -1;
 }

-static void lmtp_client_send_data(struct lmtp_client *client)
+static int lmtp_client_send_data(struct lmtp_client *client)
 {
 	const unsigned char *data;
 	unsigned char add;
@@ -295,7 +295,7 @@
 	int ret;

 	if (client->output_finished)
-		return;
+		return 0;

 	while ((ret = i_stream_read_data(client->data_input,
 					 &data, &size, 0)) > 0) {
@@ -331,7 +331,7 @@
 			if (ret == 0) {
 				/* continue later */
 				o_stream_set_flush_pending(client->output, TRUE);
-				return;
+				return 0;
 			}
 		}

@@ -342,12 +342,20 @@
 			client->output_last = add;
 		}
 	}
+	if (client->data_input->stream_errno != 0) {
+		i_error("lmtp client: read(%s) failed: %s",
+			i_stream_get_name(client->data_input),
+			i_stream_get_error(client->data_input));
+		lmtp_client_fail(client,
+			"451 4.3.0 Internal failure while reading DATA input");
+		return -1;
+	}
 	if (sent_bytes && client->data_output_callback != NULL)
 		client->data_output_callback(client->data_output_context);

 	if (ret == 0 || ret == -2) {
 		/* -2 can happen with tee istreams */
-		return;
+		return 0;
 	}

 	if (client->output_last != '\n') {
@@ -356,6 +364,7 @@
 	}
 	o_stream_nsend(client->output, ".\r\n", 3);
 	client->output_finished = TRUE;
+	return 0;
 }

 static void lmtp_client_send_handshake(struct lmtp_client *client)
@@ -526,7 +535,8 @@
 		client->input_state++;
 		if (client->data_header != NULL)
 			o_stream_nsend_str(client->output, client->data_header);
-		lmtp_client_send_data(client);
+		if (lmtp_client_send_data(client) < 0)
+			return -1;
 		break;
 	case LMTP_INPUT_STATE_DATA:
 		/* DATA replies */
@@ -600,7 +610,7 @@
 		lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
 				 " (disconnected in output)");
 	else if (client->input_state == LMTP_INPUT_STATE_DATA)
-		lmtp_client_send_data(client);
+		(void)lmtp_client_send_data(client);
 	o_stream_uncork(client->output);
 	lmtp_client_unref(&client);
 	return ret;
@@ -748,7 +758,7 @@
 {
 	if (client->input_state == LMTP_INPUT_STATE_DATA) {
 		o_stream_cork(client->output);
-		lmtp_client_send_data(client);
+		(void)lmtp_client_send_data(client);
 		o_stream_uncork(client->output);
 	}
 }


Last checkin this year: happy new year!

Last checkin this year: happy new year!

git-svn-id: 0e1153e6534495dc57987e8ae99aae841c146be6@1161 1f819a86-672b-0410-b5ed-9de735de380c

--- protocol/video.h
+++ protocol/video.h
@@ -1,4 +1,4 @@
-/* $chaos: $ */
+/* $chaos: video.h,v 1.1 2002/12/03 14:45:42 johannes Exp $ */
 /* Abstract: Video protocol defines. */
 /* Author: Per Lundberg <per@chaosdev.org> */

@@ -6,24 +6,48 @@
 /* Use freely under the terms listed in the file LICENSE. */

 /**
- * @file             video.h
+ * @file             protocol/video.h
  * @brief            Definition of the video protocol.
  */

 #ifndef __PROTOCOL_VIDEO_H__
 #define __PROTOCOL_VIDEO_H__

-/* The version of the video service. Increase when you make
-   binary-incompatible changes. That way, all clients trying to
-   connect to your service will fail. */
+/**
+ * @brief               Video protocol major version.
+ *
+ * The version of the video service. Increase when you make
+ * binary-incompatible changes. That way, all clients trying to
+ * connect to your service will fail.
+ */
 #define VIDEO_PROTOCOL_MAJOR_VERSION \
                         (0)

-/* The minor version is used for handling dependencies when adding
-   binary-compatible changes (like adding a new function). A program
-   using the new function needs to have a new minor version to depend
-   on. */
+/**
+ * @brief               Video protocol minor version.
+ *
+ * The minor version is used for handling dependencies when adding
+ * binary-compatible changes (like adding a new function). A program
+ * using the new function needs to have a new minor version to depend
+ * on.
+ */
 #define VIDEO_PROTOCOL_MINOR_VERSION \
                         (1)

+/**
+ * @brief               Video mode types.
+ */
+enum video_mode_t
+{
+    /**
+     * @brief           Text-based video modes.
+     */
+    VIDEO_MODE_TYPE_TEXT,
+
+    /**
+     * @brief           Graphical video modes.
+     */
+    VIDEO_MODE_TYPE_GRAPHIC,
+};
+
 #endif /* !__PROTCOL_VIDEO_H__ */


advance file position on lexing errors so we dont loop forever

--- mupdf/repair.c
+++ mupdf/repair.c
@@ -65,7 +65,7 @@
 		}

 		stmofs = fz_tell(file);
-
+
 		length = fz_dictgets(dict, "Length");
 		if (fz_isint(length))
 		{
@@ -76,17 +76,17 @@
 			fz_seek(file, stmofs);
 		}

-		fz_read(file, buf, 8);
-		while (memcmp(buf, "endstream", 8) != 0)
+		fz_read(file, buf, 9);
+		while (memcmp(buf, "endstream", 9) != 0)
 		{
 			c = fz_readbyte(file);
 			if (c == EOF)
 				break;
-			memmove(buf, buf + 1, 7);
-			buf[7] = c;
-		}
-
-		*stmlen = fz_tell(file) - stmofs - 8;
+			memmove(buf, buf + 1, 8);
+			buf[8] = c;
+		}
+
+		*stmlen = fz_tell(file) - stmofs - 9;

 atobjend:
 		tok = pdf_lex(file, buf, cap, &len);
@@ -162,7 +162,6 @@

 		if (tok == PDF_TOBJ)
 		{
-
 			error = parseobj(file, buf, sizeof buf, &stmlen, &isroot, &isinfo);
 			if (error)
 				goto cleanup;
@@ -199,6 +198,9 @@
 				maxoid = oid;
 		}

+		if (tok == PDF_TERROR)
+			fz_readbyte(file);
+
 		if (tok == PDF_TEOF)
 			break;
 	}


set scrollbar policy for status entry

set scrollbar policy for status entry

--- src/bin/contact_list.c
+++ src/bin/contact_list.c
@@ -690,7 +690,7 @@
    cl->status_entry = obj = elm_entry_add(scr);
    elm_entry_line_wrap_set(obj, ELM_WRAP_MIXED);
    elm_entry_single_line_set(obj, 1);
-   elm_entry_scrollable_set(obj, 1);
+   elm_entry_scrollbar_policy_set(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
    elm_entry_select_all(obj);
    EXPAND(obj);
    FILL(obj);


woops, forgot to commit...

woops, forgot to commit...

git-svn-id: 6ac5796aeae0cef97fb47bcc287d4ce899c6fa6e@51928 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/bin/e_eap_editor.h
+++ src/bin/e_eap_editor.h
@@ -20,7 +20,8 @@
    Evas_Object *img_widget;
    Evas_Object *icon_fsel;
    E_Dialog    *icon_fsel_dia;
-   Evas_Object *entry_widget;
+   Evas_Object *entry_widget_exec;
+   Evas_Object *entry_widget_url;
    Evas_Object *exec_fsel;
    E_Dialog    *exec_fsel_dia;
    //int          img_set;


fixed test issue

fixed test issue

--- nc_test4/tst_files.c
+++ nc_test4/tst_files.c
@@ -82,7 +82,6 @@
       /* Check the contents. Then define a new variable. Since it's
        * netcdf-4, nc_enddef isn't required - it's called
        * automatically. */
-      hdf5_set_log_level(3);
       if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
       if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
       if (ndims != 2 || nvars != 2 || natts != 0 || unlimdimid != -1) ERR;


ncd: NCDInterpreter: only use process state member in debug mode

--- ncd/NCDInterpreter.c
+++ ncd/NCDInterpreter.c
@@ -72,8 +72,10 @@
     int ap;
     int fp;
     int num_statements;
-    unsigned int state:2;
-    unsigned int error:1;
+    int error;
+#ifndef NDEBUG
+    int state;
+#endif
     struct statement statements[];
 };

@@ -82,6 +84,7 @@
 static int alloc_base_type_strings (NCDInterpreter *interp, const struct NCDModuleGroup *g);
 static int process_new (NCDInterpreter *interp, NCDInterpProcess *iprocess, NCDModuleProcess *module_process);
 static void process_free (struct process *p, NCDModuleProcess **out_mp);
+static void process_set_state (struct process *p, int state);
 static void process_start_terminating (struct process *p);
 static int process_have_child (struct process *p);
 static void process_assert_pointers (struct process *p);
@@ -466,7 +469,6 @@
     p->ap = 0;
     p->fp = 0;
     p->num_statements = num_statements;
-    p->state = PSTATE_WORKING;
     p->error = 0;

     // set module process handlers
@@ -489,7 +491,8 @@
     // init timer
     BSmallTimer_Init(&p->wait_timer, process_wait_timer_handler);

-    // init work job
+    // set state, init work job
+    process_set_state(p, PSTATE_WORKING);
     BSmallPending_Init(&p->work_job, BReactor_PendingGroup(interp->params.reactor), (BSmallPending_handler)process_work_job_handler_working, p);

     // insert to processes list
@@ -502,6 +505,13 @@
 fail0:
     BLog(BLOG_ERROR, "failed to allocate memory for process %s", NCDInterpProcess_Name(iprocess));
     return 0;
+}
+
+void process_set_state (struct process *p, int state)
+{
+#ifndef NDEBUG
+    p->state = state;
+#endif
 }

 void process_free (struct process *p, NCDModuleProcess **out_mp)
@@ -537,7 +547,7 @@
 void process_start_terminating (struct process *p)
 {
     // set state terminating
-    p->state = PSTATE_TERMINATING;
+    process_set_state(p, PSTATE_TERMINATING);
     BSmallPending_SetHandler(&p->work_job, (BSmallPending_handler)process_work_job_handler_terminating, p);

     // schedule work
@@ -648,7 +658,7 @@
     process_log(p, BLOG_INFO, "victory");

     // set state up
-    p->state = PSTATE_UP;
+    process_set_state(p, PSTATE_UP);
     BSmallPending_SetHandler(&p->work_job, (BSmallPending_handler)process_work_job_handler_up, p);

     // set module process up
@@ -667,7 +677,7 @@
     // if we have module process, wait for its permission to continue
     if (p->module_process) {
         // set state waiting
-        p->state = PSTATE_WAITING;
+        process_set_state(p, PSTATE_WAITING);
         BSmallPending_SetHandler(&p->work_job, (BSmallPending_handler)process_work_job_handler_waiting, p);

         // set module process down
@@ -676,7 +686,7 @@
     }

     // set state working
-    p->state = PSTATE_WORKING;
+    process_set_state(p, PSTATE_WORKING);
     BSmallPending_SetHandler(&p->work_job, (BSmallPending_handler)process_work_job_handler_working, p);

     // delegate the rest to the working handler
@@ -1192,7 +1202,7 @@
             ASSERT(p->state == PSTATE_WAITING)

             // set state working
-            p->state = PSTATE_WORKING;
+            process_set_state(p, PSTATE_WORKING);
             BSmallPending_SetHandler(&p->work_job, (BSmallPending_handler)process_work_job_handler_working, p);

             // schedule work


Bluetooth: Fix requesting high security level

If high security is required but keys are unauthenticated start
pairing instead of encrypting with too weak keys.

Change-Id: I35e5f0c1ab86660479288908152d61823ffb102e
Signed-off-by: Szymon Janc <b8f563e108973ccd513fe259bc96c595c4d39939@tieto.com>

--- net/bluetooth/conn.c
+++ net/bluetooth/conn.c
@@ -497,11 +497,17 @@

 	keys = bt_keys_find(BT_KEYS_LTK, &conn->dst);
 	if (keys) {
+		if (sec > BT_SECURITY_MEDIUM &&
+		    keys->ltk.type != BT_KEYS_AUTHENTICATED) {
+			goto pair;
+		}
+
 		return bt_conn_le_start_encryption(conn, keys->ltk.rand,
 						   keys->ltk.ediv,
 						   keys->ltk.val);
 	}

+pair:
 	return bt_smp_send_pairing_req(conn);
 }


Bluetooth: Enable RPA resolving if mgmt_set_privacy is called

A user space that supports the Set Privacy command is also expected to
be able to handle New IRK events. Therefore, set the HCI_RPA_RESOLVING
flag whenever the Set Privacy command is received.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>
Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>

--- net/bluetooth/mgmt.c
+++ net/bluetooth/mgmt.c
@@ -4257,6 +4257,11 @@

 	hci_dev_lock(hdev);

+	/* If user space supports this command it is also expected to
+	 * handle IRKs. Therefore, set the HCI_RPA_RESOLVING flag.
+	 */
+	set_bit(HCI_RPA_RESOLVING, &hdev->dev_flags);
+
 	if (cp->privacy) {
 		changed = !test_and_set_bit(HCI_PRIVACY, &hdev->dev_flags);
 		memcpy(hdev->irk, cp->irk, sizeof(hdev->irk));


mcaststreamtransmitter: Fix error message

--- transmitters/multicast/fs-multicast-stream-transmitter.c
+++ transmitters/multicast/fs-multicast-stream-transmitter.c
@@ -551,7 +551,9 @@
     {
       g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
           "The remote candidate is not of the right type, it should be"
-          " FS_ERROR_INVALID_ARGUMENTS, but it is %d", candidate->type);
+          " FS_CANDIDATE_TYPE_MULTICAST (%d), but it is %d",
+          FS_CANDIDATE_TYPE_MULTICAST,
+          candidate->type);
       return FALSE;
     }


Bluetooth: Remove redundant hci_dev comparisons in mgmt lookups

Now that pending commands are hci_dev specific there's no need to check
whether a command matches hci_dev when iterating through them.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>
Acked-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>
Signed-off-by: Gustavo F. Padovan <8463bae6aa74c6c37654a5ac7ce3bbb9fe6ffff8@profusion.mobi>

--- net/bluetooth/mgmt.c
+++ net/bluetooth/mgmt.c
@@ -268,9 +268,6 @@
 		if (opcode > 0 && cmd->opcode != opcode)
 			continue;

-		if (hdev && cmd->index != hdev->id)
-			continue;
-
 		cb(cmd, data);
 	}
 }
@@ -280,13 +277,8 @@
 	struct pending_cmd *cmd;

 	list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
-		if (cmd->opcode != opcode)
-			continue;
-
-		if (hdev && cmd->index != hdev->id)
-			continue;
-
-		return cmd;
+		if (cmd->opcode == opcode)
+			return cmd;
 	}

 	return NULL;
@@ -1300,9 +1292,6 @@
 		if (cmd->opcode != MGMT_OP_PAIR_DEVICE)
 			continue;

-		if (cmd->index != hdev->id)
-			continue;
-
 		if (cmd->user_data != conn)
 			continue;


adding some stuff to btree

adding some stuff to btree

--- src/btree_depth_find.c
+++ src/btree_depth_find.c
@@ -1,3 +1,6 @@
+#include <stdlib.h>
+
+#include "../include/util.h"

 struct node {
 	int val;
@@ -5,6 +8,38 @@
 	struct node *left;
 	struct node *right;
 };
+
+static struct node *
+btree_rotate_right(struct node *root)
+{
+	struct node *new_root;
+
+	if (root == NULL) {
+		return root;
+	}
+
+	new_root = root->left;
+	root->left = new_root->right;
+	new_root->right = root;
+
+	return new_root;
+}
+
+static struct node *
+btree_rotate_left(struct node *root)
+{
+	struct node *new_root;
+
+	if (root == NULL) {
+		return root;
+	}
+
+	new_root = root->right;
+	root->right = new_root->left;
+	new_root->left = root;
+
+	return new_root;
+}

 unsigned int
 btree_depth_find(struct node *root)
@@ -19,7 +54,7 @@
 	n_left = btree_depth_find(root->left);
 	n_right = btree_depth_find(root->right);

-	return max(n_left, n_right);
+	return MAX(n_left, n_right);
 }

 struct node *
@@ -35,22 +70,31 @@
 	}

 	if (value < root->val) {
-		return btree_find_node(root->left);
+		return btree_find_node(root->left, value);
 	}

-	return btree_find_node(root->right);
+	return btree_find_node(root->right, value);
 }

 struct node *
 btree_rebalance(struct node *root)
 {
 	/* STUPID NAIVE SOLUTION */
-	unsgined int n_left = btree_depth_find(root->left);
+	unsigned int n_left = btree_depth_find(root->left);
 	unsigned int n_right = btree_depth_find(root->right);
+	unsigned int distance = abs(n_left - n_right);

 	if (n_left > n_right) {
+		for (unsigned int i = 0; i < distance; i++) {
+			root = btree_rotate_right(root);
+		}
 	} else {
+		for (unsigned int i = 0; i < distance; i++) {
+			root = btree_rotate_left(root);
+		}
 	}
+
+	return root;
 }

 struct node *
@@ -98,8 +142,12 @@
 	}

 	for (unsigned int i = 1; i < n_items; i++) {
-		btree_node_Add(root, input[i]);
+		btree_node_add(root, input[i]);
 	}
+
+	root = btree_rebalance(root);
+
+	return root;
 }

 int


libceph: use a flag to indicate a fault has occurred

This just rearranges the logic in con_work() a little bit so that a
flag is used to indicate a fault has occurred.  This allows both the
fault and non-fault case to be handled the same way and avoids a
couple of nearly consecutive gotos.

Signed-off-by: Alex Elder <f429030cf5c0faf36fac3d102073b6e63a647baa@inktank.com>
Reviewed-by: Josh Durgin <51652c783f70f5b272ebd02f1fd20d3af7a2449f@inktank.com>

--- net/ceph/messenger.c
+++ net/ceph/messenger.c
@@ -2387,13 +2387,15 @@
 {
 	struct ceph_connection *con = container_of(work, struct ceph_connection,
 						   work.work);
+	bool fault = false;
 	int ret;

 	mutex_lock(&con->mutex);
 restart:
 	if (con_sock_closed(con)) {
 		dout("%s: con %p SOCK_CLOSED\n", __func__, con);
-		goto fault;
+		fault = true;
+		goto done;
 	}
 	if (con_backoff(con)) {
 		dout("%s: con %p BACKOFF\n", __func__, con);
@@ -2418,7 +2420,8 @@
 		goto restart;
 	if (ret < 0) {
 		con->error_msg = "socket error on read";
-		goto fault;
+		fault = true;
+		goto done;
 	}

 	ret = try_write(con);
@@ -2426,20 +2429,17 @@
 		goto restart;
 	if (ret < 0) {
 		con->error_msg = "socket error on write";
-		goto fault;
-	}
-
+		fault = true;
+	}
 done:
+	if (fault)
+		con_fault(con);
 	mutex_unlock(&con->mutex);
-done_unlocked:
+
+	if (fault)
+		con_fault_finish(con);
+
 	con->ops->put(con);
-	return;
-
-fault:
-	con_fault(con);
-	mutex_unlock(&con->mutex);
-	con_fault_finish(con);
-	goto done_unlocked;
 }


net: hsr: convert to using IFF_NO_QUEUE

net: hsr: convert to using IFF_NO_QUEUE

Signed-off-by: Phil Sutter <e888d2bd6f13f82caa51a37c03d034c76f661ba3@nwl.cc>
Cc: Arvid Brodin <2b30d6d0de09528546960ec210d66f33f3d02353@alten.se>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/hsr/hsr_device.c
+++ net/hsr/hsr_device.c
@@ -392,7 +392,7 @@
 	dev->header_ops = &hsr_header_ops;
 	dev->netdev_ops = &hsr_device_ops;
 	SET_NETDEV_DEVTYPE(dev, &hsr_type);
-	dev->tx_queue_len = 0;
+	dev->priv_flags |= IFF_NO_QUEUE;

 	dev->destructor = hsr_dev_destroy;


ip_tunnel: don't add tunnel twice

ip_tunnel: don't add tunnel twice

When using command "ip tunnel add" to add a tunnel, the tunnel will be added twice,
through ip_tunnel_create() and ip_tunnel_update().

Because the second is unnecessary, so we can just break after adding tunnel
through ip_tunnel_create().

Signed-off-by: Duan Jiong <8328e395f8c1e2c56506478ccd778989e2637711@cn.fujitsu.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/ipv4/ip_tunnel.c
+++ net/ipv4/ip_tunnel.c
@@ -754,10 +754,8 @@

 		if (!t && (cmd == SIOCADDTUNNEL)) {
 			t = ip_tunnel_create(net, itn, p);
-			if (IS_ERR(t)) {
-				err = PTR_ERR(t);
-				break;
-			}
+			err = PTR_ERR_OR_ZERO(t);
+			break;
 		}
 		if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) {
 			if (t != NULL) {


[button] Fix property enumeration names

[button] Fix property enumeration names

Based on patch from: Owen W. Taylor <otaylor@fishsoup.net>

Property enumeration names should correspond exactly to the property names;
in particular the ACTIVE vs :checked disparity was confusing reading the
code.

Fixes http://bugzilla.moblin.org/show_bug.cgi?id=6504

--- mx/mx-button.c
+++ mx/mx-button.c
@@ -58,8 +58,8 @@
   PROP_0,

   PROP_LABEL,
-  PROP_TOGGLE,
-  PROP_ACTIVE
+  PROP_TOGGLE_MODE,
+  PROP_CHECKED
 };

 enum
@@ -437,10 +437,10 @@
     case PROP_LABEL:
       mx_button_set_label (button, g_value_get_string (value));
       break;
-    case PROP_TOGGLE:
+    case PROP_TOGGLE_MODE:
       mx_button_set_toggle_mode (button, g_value_get_boolean (value));
       break;
-    case PROP_ACTIVE:
+    case PROP_CHECKED:
       mx_button_set_checked (button, g_value_get_boolean (value));
       break;

@@ -463,10 +463,10 @@
     case PROP_LABEL:
       g_value_set_string (value, priv->text);
       break;
-    case PROP_TOGGLE:
+    case PROP_TOGGLE_MODE:
       g_value_set_boolean (value, priv->is_toggle);
       break;
-    case PROP_ACTIVE:
+    case PROP_CHECKED:
       g_value_set_boolean (value, priv->is_checked);
       break;

@@ -661,14 +661,14 @@
                                 "Toggle Mode",
                                 "Enable or disable toggling",
                                 FALSE, MX_PARAM_READWRITE);
-  g_object_class_install_property (gobject_class, PROP_TOGGLE, pspec);
+  g_object_class_install_property (gobject_class, PROP_TOGGLE_MODE, pspec);

   pspec = g_param_spec_boolean ("checked",
                                 "Checked",
                                 "Indicates if a toggle button is \"on\""
                                 " or \"off\"",
                                 FALSE, MX_PARAM_READWRITE);
-  g_object_class_install_property (gobject_class, PROP_ACTIVE, pspec);
+  g_object_class_install_property (gobject_class, PROP_CHECKED, pspec);

   /**
    * MxButton::clicked:


add TCollectionClassStreamer::Generate.

add TCollectionClassStreamer::Generate.

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

--- cont/inc/TCollectionProxy.h
+++ cont/inc/TCollectionProxy.h
@@ -1,4 +1,4 @@
-// @(#)root/cont:$Name:  $:$Id: TCollectionProxy.h,v 1.11 2005/09/03 00:45:34 pcanal Exp $
+// @(#)root/cont:$Name:  $:$Id: TCollectionProxy.h,v 1.12 2005/11/16 20:04:47 pcanal Exp $
 // Author: Markus Frank  28/10/04

 /*************************************************************************
@@ -500,6 +500,12 @@
    virtual ~TCollectionClassStreamer()                {                        }
    /// Streamer for I/O handling
    virtual void operator()(TBuffer &buff, void *pObj) { Streamer(buff,pObj,0); }
+
+   /// Virtual copy constructor.
+   virtual TClassStreamer *Generate() {
+      return new TCollectionClassStreamer(*this);
+   }
+
 };

 #include "TMemberStreamer.h"


widget: prevent warning when pointer is leaving the window

--- mx/mx-widget.c
+++ mx/mx-widget.c
@@ -711,7 +711,7 @@
      ignore it so that the actor will retain its hover state until the
      pointer moves to an unrelated actor. For this to work the actual
      leave event from the child needs to bubble up to this actor */
-  if (clutter_actor_contains (actor, event->related))
+  if (event->related && clutter_actor_contains (actor, event->related))
     return FALSE;

   mx_widget_hide_tooltip (widget);


[TCP] cubic: precompute constants

[TCP] cubic: precompute constants

Revised version of patch to pre-compute values for TCP cubic.
  * d32,d64 replaced with descriptive names
  * cube_factor replaces
	 srtt[scaled by count] / HZ * ((1 << (10+2*BICTCP_HZ)) / bic_scale)
  * beta_scale replaces
	8*(BICTCP_BETA_SCALE+beta)/3/(BICTCP_BETA_SCALE-beta);

Signed-off-by: Stephen Hemminger <a072e933f45880fe04500ea083d5c7f6e81a06f0@osdl.org>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/ipv4/tcp_cubic.c
+++ net/ipv4/tcp_cubic.c
@@ -16,7 +16,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <net/tcp.h>
-
+#include <asm/div64.h>

 #define BICTCP_BETA_SCALE    1024	/* Scale factor beta calculation
 					 * max_cwnd = snd_cwnd * beta
@@ -34,15 +34,20 @@
 static int bic_scale = 41;
 static int tcp_friendliness = 1;

+static u32 cube_rtt_scale;
+static u32 beta_scale;
+static u64 cube_factor;
+
+/* Note parameters that are used for precomputing scale factors are read-only */
 module_param(fast_convergence, int, 0644);
 MODULE_PARM_DESC(fast_convergence, "turn on/off fast convergence");
 module_param(max_increment, int, 0644);
 MODULE_PARM_DESC(max_increment, "Limit on increment allowed during binary search");
-module_param(beta, int, 0644);
+module_param(beta, int, 0444);
 MODULE_PARM_DESC(beta, "beta for multiplicative increase");
 module_param(initial_ssthresh, int, 0644);
 MODULE_PARM_DESC(initial_ssthresh, "initial value of slow start threshold");
-module_param(bic_scale, int, 0644);
+module_param(bic_scale, int, 0444);
 MODULE_PARM_DESC(bic_scale, "scale (scaled by 1024) value for bic function (bic_scale/1024)");
 module_param(tcp_friendliness, int, 0644);
 MODULE_PARM_DESC(tcp_friendliness, "turn on/off tcp friendliness");
@@ -151,65 +156,13 @@
                 return (u32)end;
 }

-static inline u32 bictcp_K(u32 dist, u32 srtt)
-{
-        u64 d64;
-        u32 d32;
-        u32 count;
-        u32 result;
-
-        /* calculate the "K" for (wmax-cwnd) = c/rtt * K^3
-           so K = cubic_root( (wmax-cwnd)*rtt/c )
-           the unit of K is bictcp_HZ=2^10, not HZ
-
-           c = bic_scale >> 10
-           rtt = (tp->srtt >> 3 ) / HZ
-
-           the following code has been designed and tested for
-           cwnd < 1 million packets
-           RTT < 100 seconds
-           HZ < 1,000,00  (corresponding to 10 nano-second)
-
-        */
-
-        /* 1/c * 2^2*bictcp_HZ */
-        d32 = (1 << (10+2*BICTCP_HZ)) / bic_scale;
-        d64 = (__u64)d32;
-
-        /* srtt * 2^count / HZ
-           1) to get a better accuracy of the following d32,
-           the larger the "count", the better the accuracy
-           2) and avoid overflow of the following d64
-           the larger the "count", the high possibility of overflow
-           3) so find a "count" between bictcp_hz-3 and bictcp_hz
-           "count" may be less than bictcp_HZ,
-           then d64 becomes 0. that is OK
-        */
-        d32 = srtt;
-        count = 0;
-        while (((d32 & 0x80000000)==0) && (count < BICTCP_HZ)){
-                d32 = d32 << 1;
-                count++;
-        }
-        d32 = d32 / HZ;
-
-        /* (wmax-cwnd) * (srtt>>3 / HZ) / c * 2^(3*bictcp_HZ)  */
-        d64 = (d64 * dist * d32) >> (count+3-BICTCP_HZ);
-
-        /* cubic root */
-        d64 = cubic_root(d64);
-
-        result = (u32)d64;
-        return result;
-}
-
 /*
  * Compute congestion window to use.
  */
 static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
 {
-	u64 d64;
-	u32 d32, t, srtt, bic_target, min_cnt, max_cnt;
+	u64 offs;
+	u32 delta, t, bic_target, min_cnt, max_cnt;

 	ca->ack_cnt++;	/* count the number of ACKs */

@@ -219,8 +172,6 @@

 	ca->last_cwnd = cwnd;
 	ca->last_time = tcp_time_stamp;
-
-	srtt = (HZ << 3)/10;	/* use real time-based growth function */

 	if (ca->epoch_start == 0) {
 		ca->epoch_start = tcp_time_stamp;	/* record the beginning of an epoch */
@@ -231,7 +182,11 @@
 			ca->bic_K = 0;
 			ca->bic_origin_point = cwnd;
 		} else {
-			ca->bic_K = bictcp_K(ca->last_max_cwnd-cwnd, srtt);
+			/* Compute new K based on
+			 * (wmax-cwnd) * (srtt>>3 / HZ) / c * 2^(3*bictcp_HZ)
+			 */
+			ca->bic_K = cubic_root(cube_factor
+					       * (ca->last_max_cwnd - cwnd));
 			ca->bic_origin_point = ca->last_max_cwnd;
 		}
 	}
@@ -239,9 +194,9 @@
         /* cubic function - calc*/
         /* calculate c * time^3 / rtt,
          *  while considering overflow in calculation of time^3
-	 * (so time^3 is done by using d64)
+	 * (so time^3 is done by using 64 bit)
 	 * and without the support of division of 64bit numbers
-	 * (so all divisions are done by using d32)
+	 * (so all divisions are done by using 32 bit)
          *  also NOTE the unit of those veriables
          *	  time  = (t - K) / 2^bictcp_HZ
          *	  c = bic_scale >> 10
@@ -255,18 +210,16 @@
 	     << BICTCP_HZ) / HZ;

         if (t < ca->bic_K)		/* t - K */
-                d32 = ca->bic_K - t;
+		offs = ca->bic_K - t;
         else
-                d32 = t - ca->bic_K;
-
-        d64 = (u64)d32;
-        d32 = (bic_scale << 3) * HZ / srtt;			/* 1024*c/rtt */
-        d64 = (d32 * d64 * d64 * d64) >> (10+3*BICTCP_HZ);	/* c/rtt * (t-K)^3 */
-        d32 = (u32)d64;
+                offs = t - ca->bic_K;
+
+	/* c/rtt * (t-K)^3 */
+	delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ);
         if (t < ca->bic_K)                                	/* below origin*/
-                bic_target = ca->bic_origin_point - d32;
+                bic_target = ca->bic_origin_point - delta;
         else                                                	/* above origin*/
-                bic_target = ca->bic_origin_point + d32;
+                bic_target = ca->bic_origin_point + delta;

         /* cubic function - calc bictcp_cnt*/
         if (bic_target > cwnd) {
@@ -288,16 +241,16 @@

 	/* TCP Friendly */
 	if (tcp_friendliness) {
-		u32 scale = 8*(BICTCP_BETA_SCALE+beta)/3/(BICTCP_BETA_SCALE-beta);
-		d32 = (cwnd * scale) >> 3;
-	        while (ca->ack_cnt > d32) {		/* update tcp cwnd */
-	                ca->ack_cnt -= d32;
+		u32 scale = beta_scale;
+		delta = (cwnd * scale) >> 3;
+	        while (ca->ack_cnt > delta) {		/* update tcp cwnd */
+	                ca->ack_cnt -= delta;
         	        ca->tcp_cwnd++;
 		}

 		if (ca->tcp_cwnd > cwnd){	/* if bic is slower than tcp */
-			d32 = ca->tcp_cwnd - cwnd;
-			max_cnt = cwnd / d32;
+			delta = ca->tcp_cwnd - cwnd;
+			max_cnt = cwnd / delta;
 			if (ca->cnt > max_cnt)
 				ca->cnt = max_cnt;
 		}
@@ -428,6 +381,34 @@
 static int __init cubictcp_register(void)
 {
 	BUG_ON(sizeof(struct bictcp) > ICSK_CA_PRIV_SIZE);
+
+	/* Precompute a bunch of the scaling factors that are used per-packet
+	 * based on SRTT of 100ms
+	 */
+
+	beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta);
+
+	cube_rtt_scale = (bic_scale << 3) / 10;	/* 1024*c/rtt */
+
+	/* calculate the "K" for (wmax-cwnd) = c/rtt * K^3
+	 *  so K = cubic_root( (wmax-cwnd)*rtt/c )
+	 * the unit of K is bictcp_HZ=2^10, not HZ
+	 *
+	 *  c = bic_scale >> 10
+	 *  rtt = 100ms
+	 *
+	 * the following code has been designed and tested for
+	 * cwnd < 1 million packets
+	 * RTT < 100 seconds
+	 * HZ < 1,000,00  (corresponding to 10 nano-second)
+	 */
+
+	/* 1/c * 2^2*bictcp_HZ * srtt */
+	cube_factor = 1ull << (10+3*BICTCP_HZ); /* 2^40 */
+
+	/* divide by bic_scale and by constant Srtt (100ms) */
+	do_div(cube_factor, bic_scale * 10);
+
 	return tcp_register_congestion_control(&cubictcp);
 }


window: Use a nicer alpha function for rotation

Use a nicer alpha function for the rotation animation.

--- mx/mx-window.c
+++ mx/mx-window.c
@@ -721,7 +721,7 @@
   priv->orientation = MX_ORIENTATION_VERTICAL;
   priv->rotation_timeline = clutter_timeline_new (400);
   priv->rotation_alpha = clutter_alpha_new_full (priv->rotation_timeline,
-                                                 CLUTTER_LINEAR);
+                                                 CLUTTER_EASE_IN_OUT_QUAD);

   g_signal_connect (priv->rotation_timeline, "new-frame",
                     G_CALLBACK (mx_window_rotation_new_frame_cb), self);


[TCP]: Break out send buffer expansion test.

This makes it easier to understand, and allows easier
tweaking of the heuristic later on.

Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/ipv4/tcp_input.c
+++ net/ipv4/tcp_input.c
@@ -3300,6 +3300,28 @@
 	tp->snd_cwnd_stamp = tcp_time_stamp;
 }

+static inline int tcp_should_expand_sndbuf(struct sock *sk, struct tcp_sock *tp)
+{
+	/* If the user specified a specific send buffer setting, do
+	 * not modify it.
+	 */
+	if (sk->sk_userlocks & SOCK_SNDBUF_LOCK)
+		return 0;
+
+	/* If we are under global TCP memory pressure, do not expand.  */
+	if (tcp_memory_pressure)
+		return 0;
+
+	/* If we are under soft global TCP memory pressure, do not expand.  */
+	if (atomic_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0])
+		return 0;
+
+	/* If we filled the congestion window, do not expand.  */
+	if (tp->packets_out >= tp->snd_cwnd)
+		return 0;
+
+	return 1;
+}

 /* When incoming ACK allowed to free some skb from write_queue,
  * we remember this event in flag SOCK_QUEUE_SHRUNK and wake up socket
@@ -3311,10 +3333,7 @@
 {
 	struct tcp_sock *tp = tcp_sk(sk);

-	if (tp->packets_out < tp->snd_cwnd &&
-	    !(sk->sk_userlocks & SOCK_SNDBUF_LOCK) &&
-	    !tcp_memory_pressure &&
-	    atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) {
+	if (tcp_should_expand_sndbuf(sk, tp)) {
  		int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache_std) +
 			MAX_TCP_HEADER + 16 + sizeof(struct sk_buff),
 		    demanded = max_t(unsigned int, tp->snd_cwnd,


barwin: Add barwin.c

barwin: Add barwin.c

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

--- src/barwin.c
+++ src/barwin.c
@@ -0,0 +1,255 @@
+/*
+*      bar.c
+*      Copyright © 2008 Martin Duquesnoy <xorg62@gmail.com>
+*      All rights reserved.
+*
+*      Redistribution and use in source and binary forms, with or without
+*      modification, are permitted provided that the following conditions are
+*      met:
+*
+*      * Redistributions of source code must retain the above copyright
+*        notice, this list of conditions and the following disclaimer.
+*      * Redistributions in binary form must reproduce the above
+*        copyright notice, this list of conditions and the following disclaimer
+*        in the documentation and/or other materials provided with the
+*        distribution.
+*      * Neither the name of the  nor the names of its
+*        contributors may be used to endorse or promote products derived from
+*        this software without specific prior written permission.
+*
+*      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "wmfs.h"
+
+/** Create a BarWindow
+ * \param parent Parent window of the BarWindow
+ * \param x X position
+ * \param y Y position
+ * \param w BarWindow Width
+ * \param h BarWindow Height
+ * \param color BarWindow color
+ * \param entermask Bool for know if the EnterMask mask is needed
+ * \return The BarWindow pointer
+*/
+BarWindow*
+barwin_create(Window parent,
+           int x, int y, uint w, uint h,
+           uint color, Bool entermask)
+{
+     XSetWindowAttributes at;
+     BarWindow *bw;
+
+     bw = emalloc(1, sizeof(BarWindow));
+
+     at.override_redirect = True;
+     at.background_pixmap = ParentRelative;
+     if(entermask)
+          at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
+               ButtonPressMask | ExposureMask | EnterWindowMask |
+               LeaveWindowMask | StructureNotifyMask;
+     else
+          at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
+               ButtonPressMask | ExposureMask | StructureNotifyMask;
+
+     /* Create window */
+     bw->win = XCreateWindow(dpy, parent, x, y, w, h, 0, DefaultDepth(dpy, screen),
+                             CopyFromParent, DefaultVisual(dpy, screen),
+                             CWOverrideRedirect | CWBackPixmap | CWEventMask, &at);
+     bw->dr = XCreatePixmap(dpy, parent, w, h, DefaultDepth(dpy, screen));
+
+     /* His border */
+     CWIN(bw->border.left,   bw->win, 0, 0, SHADH, h, 0, CWBackPixel, color_enlight(color), &at);
+     CWIN(bw->border.top,    bw->win, 0, 0, w, SHADH, 0, CWBackPixel, color_enlight(color), &at);
+     CWIN(bw->border.bottom, bw->win, 0, h - SHADH, w, SHADH, 0, CWBackPixel, SHADC, &at);
+     CWIN(bw->border.right,  bw->win, w - SHADH, 0, SHADH, h, 0, CWBackPixel, SHADC, &at);
+
+     bw->geo.x = x;
+     bw->geo.y = y;
+     bw->geo.width = w;
+     bw->geo.height = h;
+     bw->color = color;
+     bw->border.light = color_enlight(color);
+     bw->border.dark = SHADC;
+
+     return bw;
+}
+
+/** Delete a BarWindow
+ * \param bw BarWindow pointer
+*/
+void
+barwin_delete(BarWindow *bw)
+{
+     CHECK(bw);
+
+     XSelectInput(dpy, bw->win, NoEventMask);
+     XDestroyWindow(dpy, bw->win);
+     XFreePixmap(dpy, bw->dr);
+     free(bw);
+
+     return;
+}
+
+/** Delete the BarWindow sub windows
+ * \param bw BarWindow pointer
+*/
+void
+barwin_delete_subwin(BarWindow *bw)
+{
+     CHECK(bw);
+
+     XDestroySubwindows(dpy, bw->win);
+
+     return;
+}
+
+/** Map a BarWindow
+ * \param bw BarWindow pointer
+*/
+void
+barwin_map(BarWindow *bw)
+{
+     CHECK(!bw->mapped);
+
+     XMapWindow(dpy, bw->win);
+
+     bw->mapped = True;
+
+     return;
+}
+
+
+/** Map the subwindows of a BarWindow
+ *  Use for the BarWindow special border...
+ * \param bw BarWindow pointer
+ */
+void
+barwin_map_subwin(BarWindow *bw)
+{
+     CHECK(bw);
+
+     XMapSubwindows(dpy, bw->win);
+
+     return;
+}
+
+/** Unmap a BarWindow
+ * \param bw BarWindow pointer
+*/
+void
+barwin_unmap(BarWindow *bw)
+{
+     CHECK(bw->mapped);
+
+     XUnmapWindow(dpy, bw->win);
+
+     bw->mapped = False;
+
+     return;
+}
+
+/** Unmap the BarWindow sub windows
+ * \param bw BarWindow pointer
+*/
+void
+barwin_unmap_subwin(BarWindow *bw)
+{
+     CHECK(bw);
+
+     XUnmapSubwindows(dpy, bw->win);
+
+     return;
+}
+
+/** Move a BarWindow
+ * \param bw BarWindow pointer
+ * \param x X position
+ * \param y Y poistion
+*/
+void
+barwin_move(BarWindow *bw, int x, int y)
+{
+     CHECK(bw);
+
+     bw->geo.x = x;
+     bw->geo.y = y;
+
+     XMoveWindow(dpy, bw->win, x, y);
+
+     return;
+}
+
+/** Resize a BarWindow
+ * \param bw BarWindow pointer
+ * \param w Width
+ * \param h Height
+*/
+void
+barwin_resize(BarWindow *bw, uint w, uint h)
+{
+     CHECK(bw);
+
+     bw->geo.width = w;
+     bw->geo.height = h;
+     XFreePixmap(dpy, bw->dr);
+
+     /* Frame */
+     bw->dr = XCreatePixmap(dpy, root, w - SHADH, h - SHADH, DefaultDepth(dpy, screen));
+     XResizeWindow(dpy, bw->win, w, h);
+
+     /* Border */
+     XResizeWindow(dpy, bw->border.left, SHADH, h);
+     XResizeWindow(dpy, bw->border.top, w, SHADH);
+     XResizeWindow(dpy, bw->border.bottom, w, SHADH);
+     XMoveResizeWindow(dpy, bw->border.right, w - SHADH, 0, SHADH, h);
+
+
+     return;
+}
+
+/** Refresh the BarWindow Color
+ * \param bw BarWindow pointer
+*/
+void
+barwin_refresh_color(BarWindow *bw)
+{
+     CHECK(bw);
+
+     draw_rectangle(bw->dr, 0, 0, bw->geo.width, bw->geo.height, bw->color);
+
+     XSetWindowBackground(dpy, bw->border.left ,   bw->border.light);
+     XSetWindowBackground(dpy, bw->border.top ,    bw->border.light);
+     XSetWindowBackground(dpy, bw->border.bottom , bw->border.dark);
+     XSetWindowBackground(dpy, bw->border.right ,  bw->border.dark);
+
+     XClearWindow(dpy, bw->border.left);
+     XClearWindow(dpy, bw->border.top);
+     XClearWindow(dpy, bw->border.bottom);
+     XClearWindow(dpy, bw->border.right);
+
+     return;
+}
+
+/** Refresh the BarWindow
+ * \param bw BarWindow pointer
+*/
+void
+barwin_refresh(BarWindow *bw)
+{
+     CHECK(bw);
+
+     XCopyArea(dpy, bw->dr, bw->win, gc, 0, 0, bw->geo.width, bw->geo.height, 0, 0);
+
+     return;
+}


l2tp: fix a lockdep splat

l2tp: fix a lockdep splat

Fixes following lockdep splat :

[ 1614.734896] =============================================
[ 1614.734898] [ INFO: possible recursive locking detected ]
[ 1614.734901] 3.6.0-rc3+ #782 Not tainted
[ 1614.734903] ---------------------------------------------
[ 1614.734905] swapper/11/0 is trying to acquire lock:
[ 1614.734907]  (slock-AF_INET){+.-...}, at: [<ffffffffa0209d72>] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
[ 1614.734920]
[ 1614.734920] but task is already holding lock:
[ 1614.734922]  (slock-AF_INET){+.-...}, at: [<ffffffff815fce23>] tcp_v4_err+0x163/0x6b0
[ 1614.734932]
[ 1614.734932] other info that might help us debug this:
[ 1614.734935]  Possible unsafe locking scenario:
[ 1614.734935]
[ 1614.734937]        CPU0
[ 1614.734938]        ----
[ 1614.734940]   lock(slock-AF_INET);
[ 1614.734943]   lock(slock-AF_INET);
[ 1614.734946]
[ 1614.734946]  *** DEADLOCK ***
[ 1614.734946]
[ 1614.734949]  May be due to missing lock nesting notation
[ 1614.734949]
[ 1614.734952] 7 locks held by swapper/11/0:
[ 1614.734954]  #0:  (rcu_read_lock){.+.+..}, at: [<ffffffff81592801>] __netif_receive_skb+0x251/0xd00
[ 1614.734964]  #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff815d319c>] ip_local_deliver_finish+0x4c/0x4e0
[ 1614.734972]  #2:  (rcu_read_lock){.+.+..}, at: [<ffffffff8160d116>] icmp_socket_deliver+0x46/0x230
[ 1614.734982]  #3:  (slock-AF_INET){+.-...}, at: [<ffffffff815fce23>] tcp_v4_err+0x163/0x6b0
[ 1614.734989]  #4:  (rcu_read_lock){.+.+..}, at: [<ffffffff815da240>] ip_queue_xmit+0x0/0x680
[ 1614.734997]  #5:  (rcu_read_lock_bh){.+....}, at: [<ffffffff815d9925>] ip_finish_output+0x135/0x890
[ 1614.735004]  #6:  (rcu_read_lock_bh){.+....}, at: [<ffffffff81595680>] dev_queue_xmit+0x0/0xe00
[ 1614.735012]
[ 1614.735012] stack backtrace:
[ 1614.735016] Pid: 0, comm: swapper/11 Not tainted 3.6.0-rc3+ #782
[ 1614.735018] Call Trace:
[ 1614.735020]  <IRQ>  [<ffffffff810a50ac>] __lock_acquire+0x144c/0x1b10
[ 1614.735033]  [<ffffffff810a334b>] ? check_usage+0x9b/0x4d0
[ 1614.735037]  [<ffffffff810a6762>] ? mark_held_locks+0x82/0x130
[ 1614.735042]  [<ffffffff810a5df0>] lock_acquire+0x90/0x200
[ 1614.735047]  [<ffffffffa0209d72>] ? l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
[ 1614.735051]  [<ffffffff810a69ad>] ? trace_hardirqs_on+0xd/0x10
[ 1614.735060]  [<ffffffff81749b31>] _raw_spin_lock+0x41/0x50
[ 1614.735065]  [<ffffffffa0209d72>] ? l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
[ 1614.735069]  [<ffffffffa0209d72>] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
[ 1614.735075]  [<ffffffffa014f7f2>] l2tp_eth_dev_xmit+0x32/0x60 [l2tp_eth]
[ 1614.735079]  [<ffffffff81595112>] dev_hard_start_xmit+0x502/0xa70
[ 1614.735083]  [<ffffffff81594c6e>] ? dev_hard_start_xmit+0x5e/0xa70
[ 1614.735087]  [<ffffffff815957c1>] ? dev_queue_xmit+0x141/0xe00
[ 1614.735093]  [<ffffffff815b622e>] sch_direct_xmit+0xfe/0x290
[ 1614.735098]  [<ffffffff81595865>] dev_queue_xmit+0x1e5/0xe00
[ 1614.735102]  [<ffffffff81595680>] ? dev_hard_start_xmit+0xa70/0xa70
[ 1614.735106]  [<ffffffff815b4daa>] ? eth_header+0x3a/0xf0
[ 1614.735111]  [<ffffffff8161d33e>] ? fib_get_table+0x2e/0x280
[ 1614.735117]  [<ffffffff8160a7e2>] arp_xmit+0x22/0x60
[ 1614.735121]  [<ffffffff8160a863>] arp_send+0x43/0x50
[ 1614.735125]  [<ffffffff8160b82f>] arp_solicit+0x18f/0x450
[ 1614.735132]  [<ffffffff8159d9da>] neigh_probe+0x4a/0x70
[ 1614.735137]  [<ffffffff815a191a>] __neigh_event_send+0xea/0x300
[ 1614.735141]  [<ffffffff815a1c93>] neigh_resolve_output+0x163/0x260
[ 1614.735146]  [<ffffffff815d9cf5>] ip_finish_output+0x505/0x890
[ 1614.735150]  [<ffffffff815d9925>] ? ip_finish_output+0x135/0x890
[ 1614.735154]  [<ffffffff815dae79>] ip_output+0x59/0xf0
[ 1614.735158]  [<ffffffff815da1cd>] ip_local_out+0x2d/0xa0
[ 1614.735162]  [<ffffffff815da403>] ip_queue_xmit+0x1c3/0x680
[ 1614.735165]  [<ffffffff815da240>] ? ip_local_out+0xa0/0xa0
[ 1614.735172]  [<ffffffff815f4402>] tcp_transmit_skb+0x402/0xa60
[ 1614.735177]  [<ffffffff815f5a11>] tcp_retransmit_skb+0x1a1/0x620
[ 1614.735181]  [<ffffffff815f7e93>] tcp_retransmit_timer+0x393/0x960
[ 1614.735185]  [<ffffffff815fce23>] ? tcp_v4_err+0x163/0x6b0
[ 1614.735189]  [<ffffffff815fd317>] tcp_v4_err+0x657/0x6b0
[ 1614.735194]  [<ffffffff8160d116>] ? icmp_socket_deliver+0x46/0x230
[ 1614.735199]  [<ffffffff8160d19e>] icmp_socket_deliver+0xce/0x230
[ 1614.735203]  [<ffffffff8160d116>] ? icmp_socket_deliver+0x46/0x230
[ 1614.735208]  [<ffffffff8160d464>] icmp_unreach+0xe4/0x2c0
[ 1614.735213]  [<ffffffff8160e520>] icmp_rcv+0x350/0x4a0
[ 1614.735217]  [<ffffffff815d3285>] ip_local_deliver_finish+0x135/0x4e0
[ 1614.735221]  [<ffffffff815d319c>] ? ip_local_deliver_finish+0x4c/0x4e0
[ 1614.735225]  [<ffffffff815d3ffa>] ip_local_deliver+0x4a/0x90
[ 1614.735229]  [<ffffffff815d37b7>] ip_rcv_finish+0x187/0x730
[ 1614.735233]  [<ffffffff815d425d>] ip_rcv+0x21d/0x300
[ 1614.735237]  [<ffffffff81592a1b>] __netif_receive_skb+0x46b/0xd00
[ 1614.735241]  [<ffffffff81592801>] ? __netif_receive_skb+0x251/0xd00
[ 1614.735245]  [<ffffffff81593368>] process_backlog+0xb8/0x180
[ 1614.735249]  [<ffffffff81593cf9>] net_rx_action+0x159/0x330
[ 1614.735257]  [<ffffffff810491f0>] __do_softirq+0xd0/0x3e0
[ 1614.735264]  [<ffffffff8109ed24>] ? tick_program_event+0x24/0x30
[ 1614.735270]  [<ffffffff8175419c>] call_softirq+0x1c/0x30
[ 1614.735278]  [<ffffffff8100425d>] do_softirq+0x8d/0xc0
[ 1614.735282]  [<ffffffff8104983e>] irq_exit+0xae/0xe0
[ 1614.735287]  [<ffffffff8175494e>] smp_apic_timer_interrupt+0x6e/0x99
[ 1614.735291]  [<ffffffff81753a1c>] apic_timer_interrupt+0x6c/0x80
[ 1614.735293]  <EOI>  [<ffffffff810a14ad>] ? trace_hardirqs_off+0xd/0x10
[ 1614.735306]  [<ffffffff81336f85>] ? intel_idle+0xf5/0x150
[ 1614.735310]  [<ffffffff81336f7e>] ? intel_idle+0xee/0x150
[ 1614.735317]  [<ffffffff814e6ea9>] cpuidle_enter+0x19/0x20
[ 1614.735321]  [<ffffffff814e7538>] cpuidle_idle_call+0xa8/0x630
[ 1614.735327]  [<ffffffff8100c1ba>] cpu_idle+0x8a/0xe0
[ 1614.735333]  [<ffffffff8173762e>] start_secondary+0x220/0x222

Signed-off-by: Eric Dumazet <312c7d941f03386814be517ffdb3e0eb6624e275@google.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/l2tp/l2tp_core.c
+++ net/l2tp/l2tp_core.c
@@ -1501,6 +1501,8 @@
 	return err;
 }

+static struct lock_class_key l2tp_socket_class;
+
 int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp)
 {
 	struct l2tp_tunnel *tunnel = NULL;
@@ -1605,6 +1607,8 @@
 	tunnel->old_sk_destruct = sk->sk_destruct;
 	sk->sk_destruct = &l2tp_tunnel_destruct;
 	tunnel->sock = sk;
+	lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class, "l2tp_sock");
+
 	sk->sk_allocation = GFP_ATOMIC;

 	/* Add tunnel to our list */


vaapidecode: output all decoded frames as soon as possible.

Make sure to push all decoded frames downstream as soon as possible.
This makes sure we don't need to wait for a new frame to be ready to
be decoded before receiving new decoded frames.

This also separates the decode process and the output process. The latter
could be moved to a specific GstTask later on.

--- gst/vaapi/gstvaapidecode.c
+++ gst/vaapi/gstvaapidecode.c
@@ -186,6 +186,7 @@
     GstFlowReturn ret;
     gint64 end_time;

+    /* Decode current frame */
     for (;;) {
         end_time = decode->render_time_base;
         if (!end_time)
@@ -193,7 +194,7 @@
         end_time += GST_TIME_AS_USECONDS(decode->last_buffer_time);
         end_time += G_TIME_SPAN_SECOND;

-        status = gst_vaapi_decoder_decode(decode->decoder, frame, &proxy);
+        status = gst_vaapi_decoder_decode(decode->decoder, frame);
         if (status == GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE) {
             gboolean was_signalled;
             g_mutex_lock(&decode->decoder_mutex);
@@ -209,12 +210,16 @@
         }
         if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
             goto error_decode;
-
-        /* Current frame was decoded but no surface was output */
-        if (!proxy)
-            break;
-
-        out_frame = gst_vaapi_surface_proxy_get_user_data(proxy);
+        break;
+    }
+
+    /* Output all decoded frames */
+    for (;;) {
+        status = gst_vaapi_decoder_get_frame(decode->decoder, &out_frame);
+        if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
+            return GST_FLOW_OK;
+
+        proxy = gst_video_codec_frame_get_user_data(out_frame);

         gst_vaapi_surface_proxy_set_user_data(proxy,
             decode, (GDestroyNotify)gst_vaapidecode_release);
@@ -223,22 +228,13 @@
         if (!out_frame->output_buffer)
             goto error_create_buffer;

-        out_frame->pts      = GST_VAAPI_SURFACE_PROXY_TIMESTAMP(proxy);
-        out_frame->duration = GST_VAAPI_SURFACE_PROXY_DURATION(proxy);
-
-        if (GST_VAAPI_SURFACE_PROXY_TFF(proxy))
-            GST_VIDEO_CODEC_FRAME_FLAG_SET(out_frame,
-                GST_VIDEO_CODEC_FRAME_FLAG_TFF);
-
         gst_vaapi_video_buffer_set_surface_proxy(
             GST_VAAPI_VIDEO_BUFFER(out_frame->output_buffer), proxy);
-        gst_vaapi_surface_proxy_unref(proxy);

         ret = gst_video_decoder_finish_frame(vdec, out_frame);
         if (ret != GST_FLOW_OK)
             goto error_commit_buffer;
-        break;
-    }
+    };
     return GST_FLOW_OK;

     /* ERRORS */


Added ability to get the nth element from an abstract array type.

--- unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
+++ unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
@@ -181,6 +181,15 @@
   return array;
 }

+template<std::size_t I, class Head, class Tail>
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename Head::type array_get(type_list<Head, Tail>& a) {
+  return get<I, type_list<Head, Tail> >::value;
+}
+template<std::size_t I, class Head, class Tail>
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename Head::type array_get(const type_list<Head, Tail>& a) {
+  return get<I, type_list<Head, Tail> >::value;
+}
+
 template<std::size_t n, typename t>
 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const array<t, n>& a) {
   t prod = 1;
@@ -196,8 +205,8 @@
 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& array_get(array<T,N>& a) {
   return a[I];
 }
-template<std::size_t I, class T, std::size_t N> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
-const T& array_get(const array<T,N>& a) {
+template<std::size_t I, class T, std::size_t N>
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& array_get(const array<T,N>& a) {
   return a[I];
 }


riff.h is in a different directory

riff.h is in a different directory

Original commit message from CVS:
riff.h is in a different directory

--- gst/wavparse/gstwavparse.h
+++ gst/wavparse/gstwavparse.h
@@ -24,7 +24,7 @@

 #include <config.h>
 #include <gst/gst.h>
-#include <gst-libs/gst/riff/riff.h>
+#include <gst/riff/riff.h>

 #ifdef __cplusplus


add #include <stdarg.h>

add #include <stdarg.h>

--- gtparser/gtparser_config.h
+++ gtparser/gtparser_config.h
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdarg.h>

 #ifdef _DEBUG
 #include <assert.h>


Converted mysys/base64.c into C code (not C++).

mysys/base64.c:
  Converted into C code (not C++).

--- mysys/base64.c
+++ mysys/base64.c
@@ -56,13 +56,14 @@

   for (; i < src_len; len += 4)
   {
+    unsigned c;
+
     if (len == 76)
     {
       len= 0;
       *dst++= '\n';
     }

-    unsigned c;
     c= s[i++];
     c <<= 8;

@@ -216,6 +217,8 @@

     char * src= (char *) malloc(src_len);
     char * s= src;
+    char * str;
+    char * dst;

     for (j= 0; j<src_len; j++)
     {
@@ -224,11 +227,11 @@
     }

     /* Encode */
-    char * str= (char *) malloc(base64_needed_encoded_length(src_len));
+    str= (char *) malloc(base64_needed_encoded_length(src_len));
     require(base64_encode(src, src_len, str) == 0);

     /* Decode */
-    char * dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
+    dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
     dst_len= base64_decode(str, strlen(str), dst);
     require(dst_len == src_len);


Add a method for toggling bitcoin addresses between testnet and mainnet. Useful for hard-coded addresses which need to be used in either case.

--- src/base58.h
+++ src/base58.h
@@ -388,6 +388,23 @@
         default: return false;
         }
     }
+
+    void ToggleTestnet() {
+        switch (nVersion) {
+            case PUBKEY_ADDRESS:
+                nVersion = PUBKEY_ADDRESS_TEST;
+                break;
+            case SCRIPT_ADDRESS:
+                nVersion = SCRIPT_ADDRESS_TEST;
+                break;
+            case PUBKEY_ADDRESS_TEST:
+                nVersion = PUBKEY_ADDRESS;
+                break;
+            case SCRIPT_ADDRESS_TEST:
+                nVersion = SCRIPT_ADDRESS;
+                break;
+        }
+    }
 };

 bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const         { return addr->Set(id); }


fix stupid problem in base64

fix stupid problem in base64

--- src/base64.c
+++ src/base64.c
@@ -21,6 +21,7 @@
   char *valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
   char decoded[256] = { 0 };
   int c, count = 0, equal = 0;
+  memset(decoded, -1, sizeof(decoded));
   for (char *ptr = valid; *ptr; ptr++) decoded[(int)*ptr] = count++;
   count = 0;
   char old = 0, cur = 0;
@@ -28,7 +29,7 @@
   if (flag('d')) {
     while ((c = fgetc_unlocked(file)) != EOF) {
       if (c == '\n') continue;
-      if (!decoded[c]) {
+      if (decoded[c] == -1) {
         if (!flag('i')) return -1;
         else continue;
       }


my bad

my bad

--- LTN/src/File.h
+++ LTN/src/File.h
@@ -24,6 +24,7 @@
     string path;
 	vector<vector<string>> parsedFiles;
 	void procTest();
+	void cleaning();
 };

 #endif // FILE_H


[PATCH] cfg80211: fix signed macaddress in sysfs

Fix signedness mixup making mac addresses show up strangely
(like 00:11:22:33:44:ffffffaa) in /sys/class/ieee80211/*/macaddress.

Signed-off-by: David Lamparter <1cde1b88ee2fe60281a0368d4a670a19474cb07a@diac24.net>
Acked-by: Johannes Berg <8398eb9892c5ab2ff439ca0b5e4b0706dd9ebef9@sipsolutions.net>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- net/wireless/sysfs.c
+++ net/wireless/sysfs.c
@@ -33,7 +33,7 @@
 			      struct device_attribute *attr,
 			      char *buf)
 {
-	char *addr = dev_to_rdev(dev)->wiphy.perm_addr;
+	unsigned char *addr = dev_to_rdev(dev)->wiphy.perm_addr;

 	return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
 		       addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);


exec protection logging

exec protection logging

--- src/trusted/service_runtime/nacl_syscall_common.c
+++ src/trusted/service_runtime/nacl_syscall_common.c
@@ -4288,13 +4288,17 @@
   }

   /* reset permissions to executable */
-  NaClLog(2, "Setting permissions to executable\n");
-
+  NaClLog(2, "Setting child permissions to executable\n");
   NaClVmmapChangeProt(&nap_child->mem_map, tramp_pnum, tramp_npages, PROT_RX);
+  NaClLog(2, "Setting parent permissions to executable\n");
   NaClVmmapChangeProt(&nap->mem_map, tramp_pnum, tramp_npages, PROT_RX);
+
+  NaClLog(2, "Child mprotect\n");
   if (NaClMprotect((void *)child_start_addr, tramp_size, PROT_RX) == -1) {
     NaClLog(LOG_FATAL, "%s\n", "child vmmap page NaClMprotect failed!");
   }
+  NaClLog(2, "Parent mprotect\n");
+
   if (NaClMprotect((void *)parent_start_addr, tramp_size, PROT_RX) == -1) {
     NaClLog(LOG_FATAL, "%s\n", "parent vmmap page NaClMprotect failed!");
   }


Whitspac changes.

Whitspac changes.

--- netinet/sctp_input.h
+++ netinet/sctp_input.h
@@ -60,8 +60,7 @@
 sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries,
                      uint16_t *list);

-int
-sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked);
+int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked);

 #endif
 #endif


exec: zero "->running" members when inside execve()

Signed-off-by: Joey Pabalinas <1140aba59ea685f414bfdf5c263f34bcec3b5f4c@gmail.com>

--- src/trusted/service_runtime/nacl_syscall_common.c
+++ src/trusted/service_runtime/nacl_syscall_common.c
@@ -4110,7 +4110,8 @@
   /* initialize child from parent state */
   NaClLogThreadContext(natp);
   nap_child = NaClChildNapCtor(nap);
-  nap_child->running = 1;
+  nap_child->running = 0;
+  nap->running = 0;
   /* TODO: fix dynamic text validation -jp */
   nap_child->skip_validator = 1;
   nap_child->main_exe_prevalidated = 1;


change tcpdrop to require newp instead of oldp; suggested by otto

--- netinet/tcp_usrreq.c
+++ netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: tcp_usrreq.c,v 1.83 2004/04/25 04:34:05 markus Exp $	*/
+/*	$OpenBSD: tcp_usrreq.c,v 1.84 2004/04/26 18:16:09 markus Exp $	*/
 /*	$NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $	*/

 /*
@@ -790,22 +790,23 @@
 	struct sockaddr_in6 *fin6, *lin6;
 	struct in6_addr f6, l6;
 #endif
-
 	if (oldp == NULL)
 		return (EINVAL);
+	if (*oldlenp < sizeof(tir))
+		return (ENOMEM);
 	if (dodrop) {
-		/*
-		 * XXX stupid permission hack:
-		 * only root may set newp, so we require newp for tcp_drop()
-		 */
 		if (newp == NULL)
 			return (EPERM);
-	} else if (newp != NULL || newlen != 0)
-		return (EINVAL);
-	if  (*oldlenp < sizeof(tir))
-		return (ENOMEM);
-	if ((error = copyin(oldp, &tir, sizeof (tir))) != 0 )
-		return (error);
+		if (newlen < sizeof(tir))
+			return (ENOMEM);
+		if ((error = copyin(newp, &tir, sizeof (tir))) != 0 )
+			return (error);
+	} else {
+		if (newp != NULL || newlen != 0)
+			return (EINVAL);
+		if ((error = copyin(oldp, &tir, sizeof (tir))) != 0 )
+			return (error);
+	}
 	switch (tir.faddr.ss_family) {
 #ifdef INET6
 	case AF_INET6:


link udp pcbs to pf states, same as done for tcp already ok markus, also tested david sthen

--- netinet/udp_usrreq.c
+++ netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: udp_usrreq.c,v 1.123 2008/06/14 22:15:30 jsing Exp $	*/
+/*	$OpenBSD: udp_usrreq.c,v 1.124 2008/07/16 09:00:44 henning Exp $	*/
 /*	$NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $	*/

 /*
@@ -105,6 +105,11 @@

 #include "faith.h"

+#include "pf.h"
+#if NPF > 0
+#include <net/pfvar.h>
+#endif
+
 /*
  * UDP protocol implementation.
  * Per RFC 768, August, 1980.
@@ -163,7 +168,7 @@
 {
 	struct ip *ip;
 	struct udphdr *uh;
-	struct inpcb *inp;
+	struct inpcb *inp = NULL;
 	struct mbuf *opts = NULL;
 	struct ip save_ip;
 	int iphlen, len;
@@ -529,14 +534,27 @@
 	/*
 	 * Locate pcb for datagram.
 	 */
-#ifdef INET6
-	if (ip6)
-		inp = in6_pcbhashlookup(&udbtable, &ip6->ip6_src, uh->uh_sport,
-		    &ip6->ip6_dst, uh->uh_dport);
-	else
-#endif /* INET6 */
-	inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport,
-	    ip->ip_dst, uh->uh_dport);
+#if NPF > 0
+	if (m->m_pkthdr.pf.statekey)
+		inp = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp;
+#endif
+	if (inp == NULL) {
+#ifdef INET6
+		if (ip6)
+			inp = in6_pcbhashlookup(&udbtable, &ip6->ip6_src,
+			    uh->uh_sport, &ip6->ip6_dst, uh->uh_dport);
+		else
+#endif /* INET6 */
+		inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport,
+		    ip->ip_dst, uh->uh_dport);
+#if NPF > 0
+		if (m->m_pkthdr.pf.statekey && inp) {
+			((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp =
+			    inp;
+			inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
+		}
+#endif
+	}
 	if (inp == 0) {
 		int	inpl_reverse = 0;
 		if (m->m_pkthdr.pf.flags & PF_TAG_TRANSLATE_LOCALHOST)
@@ -970,6 +988,7 @@
 	((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl;
 	((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos;

+	m->m_pkthdr.pf.statekey = inp->inp_pf_sk;
 	udpstat.udps_opackets++;
 	error = ip_output(m, inp->inp_options, &inp->inp_route,
 	    inp->inp_socket->so_options &


Provide callback-based stream parser.

Provide callback-based stream parser.

error: pathspec 'src/vast/util/parser/streamer.h' did not match any file(s) known to git

--- src/vast/util/parser/streamer.h
+++ src/vast/util/parser/streamer.h
@@ -0,0 +1,66 @@
+#ifndef VAST_UTIL_PARSER_STREAMER_H
+#define VAST_UTIL_PARSER_STREAMER_H
+
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/support_multi_pass.hpp>
+
+namespace vast {
+namespace util {
+namespace parser {
+
+typedef std::istream_iterator<char> istream_iterator;
+typedef boost::spirit::multi_pass<
+    istream_iterator
+  , boost::spirit::iterator_policies::default_policy<
+        boost::spirit::iterator_policies::first_owner
+      , boost::spirit::iterator_policies::no_check
+      , boost::spirit::iterator_policies::buffering_input_iterator
+      , boost::spirit::iterator_policies::split_std_deque
+    >
+> multi_pass_iterator;
+
+/// A stream parser that performs a one-time pass over the input and invokes a
+/// user-provided callback for each parsed object.
+template <
+    template <typename> class Grammar
+  , template <typename> class Skipper
+  , typename Attribute>
+class streamer
+{
+public:
+    typedef Attribute attribute;
+    typedef std::function<void(Attribute const&)> callback_type;
+
+    streamer(callback_type callback)
+      : callback_(callback)
+    {
+    }
+
+    bool extract(std::istream& in)
+    {
+        auto f = multi_pass_iterator(istream_iterator(in));
+        auto l = multi_pass_iterator(istream_iterator());
+        auto action =
+            [&](Attribute const& x, qi::unused_type, qi::unused_type)
+            {
+                callback_(x);
+            };
+
+        Grammar<multi_pass_iterator> grammar;
+        Skipper<multi_pass_iterator> skipper;
+        bool success = true;
+        while (success && f != l)
+            success = qi::phrase_parse(f, l, +grammar[action], skipper);
+
+        return success;
+    }
+
+private:
+    callback_type callback_;
+};
+
+} // namespace parser
+} // namespace util
+} // namespace vast
+
+#endif


move pf_test6() call slightly up, so pf gets called for incoming packets on loopback interfaces, and IPv6 behaves like IPv4 in this regard. only affects packets on loopback. ok itojun@

--- netinet6/ip6_input.c
+++ netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ip6_input.c,v 1.60 2004/10/18 03:59:34 itojun Exp $	*/
+/*	$OpenBSD: ip6_input.c,v 1.61 2005/03/06 16:27:01 dhartmei Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/

 /*
@@ -292,6 +292,20 @@
 	}
 #endif

+#if NPF > 0
+        /*
+         * Packet filter
+         */
+	odst = ip6->ip6_dst;
+	if (pf_test6(PF_IN, m->m_pkthdr.rcvif, &m, NULL) != PF_PASS)
+		goto bad;
+	if (m == NULL)
+		return;
+
+	ip6 = mtod(m, struct ip6_hdr *);
+	srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst);
+#endif
+
 	if (IN6_IS_ADDR_LOOPBACK(&ip6->ip6_src) ||
 	    IN6_IS_ADDR_LOOPBACK(&ip6->ip6_dst)) {
 		if (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) {
@@ -318,20 +332,6 @@
 			goto bad;
 		}
 	}
-
-#if NPF > 0
-        /*
-         * Packet filter
-         */
-	odst = ip6->ip6_dst;
-	if (pf_test6(PF_IN, m->m_pkthdr.rcvif, &m, NULL) != PF_PASS)
-		goto bad;
-	if (m == NULL)
-		return;
-
-	ip6 = mtod(m, struct ip6_hdr *);
-	srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst);
-#endif

 	if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src))
 		ip6->ip6_src.s6_addr16[1]


Fix issue with empty arrays

Fix issue with empty arrays

--- src/libmare/Tools/Array.h
+++ src/libmare/Tools/Array.h
@@ -75,7 +75,7 @@
       T* oldData = data;
       this->capacity = capacity + 16 + (capacity >> 1);
       data = new T[this->capacity];
-      for(T* pos = data, * end = data + size, * oldPos = oldData; pos < end;)
+      for(T* pos = data, * end = data + this->size, * oldPos = oldData; pos < end;)
         *(pos++) = *(oldPos++);
       if(oldData)
         delete[] oldData;


GDK W32: add environment variable to override system font scaling

Support environment variable GDK_WIN32_FONT_RESOLUTION that can be set to
a desired dpi (72, 96, 130, etc) to override system settings. Useful for
debugging, since changing system font scaling requires the user to log off
and log on again.

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

--- gdk/win32/gdkscreen-win32.c
+++ gdk/win32/gdkscreen-win32.c
@@ -39,6 +39,7 @@
   GdkScreen *screen = GDK_SCREEN (display);
   HDC screen_dc;
   int logpixelsx = -1;
+  const gchar *font_resolution;

   screen_dc = GetDC (NULL);

@@ -46,6 +47,14 @@
     {
       logpixelsx = GetDeviceCaps(screen_dc, LOGPIXELSX);
       ReleaseDC (NULL, screen_dc);
+    }
+
+  font_resolution = g_getenv ("GDK_WIN32_FONT_RESOLUTION");
+  if (font_resolution)
+    {
+      int env_logpixelsx = atol (font_resolution);
+      if (env_logpixelsx > 0)
+        logpixelsx = env_logpixelsx;
     }

   if (logpixelsx > 0)


Revert "gdk3 rbgdkwindow.c:  suppress deprecation warnings"

This reverts commit eeeccc927147af47458a102af08e5786e0ad27be.

--- gdk3/ext/gdk3/rbgdkwindow.c
+++ gdk3/ext/gdk3/rbgdkwindow.c
@@ -60,8 +60,7 @@
 rg_s_at_pointer(G_GNUC_UNUSED VALUE self)
 {
     gint x, y;
-    GdkDevice *device = _DEVICE(self);
-    GdkWindow *win = gdk_device_get_window_at_position(device, &x ,&y);
+    GdkWindow* win = gdk_window_at_pointer(&x, &y);
     return rb_ary_new3(3, GOBJ2RVAL(win), INT2FIX(x), INT2FIX(y));
 }

@@ -636,8 +635,7 @@
 {
     gint x, y;
     GdkModifierType state;
-    GdkDevice *device = _DEVICE(self);
-    GdkWindow *ret = gdk_window_get_device_position(_SELF(self), device, &x, &y, &state);
+    GdkWindow* ret = gdk_window_get_pointer(_SELF(self), &x, &y, &state);
     return rb_ary_new3(4, GOBJ2RVAL(ret), INT2NUM(x), INT2NUM(y), GDKMODIFIERTYPE2RVAL(state));
 }


A li'l attempt to detect misaligned stack in debug build.

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

--- src/libmpg123/libmpg123.c
+++ src/libmpg123/libmpg123.c
@@ -507,6 +507,17 @@
 */
 int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
 {
+#ifdef DEBUG
+#ifdef CCALIGN
+	double ALIGNED(16) altest[4];
+	if(((size_t)altest) % 16 != 0)
+	{
+		error("Stack variable is not aligned! Your combination of compiler/library is dangerous!");
+		if(mh != NULL) mh->err = MPG123_BAD_ALIGN;
+		return MPG123_ERR;
+	}
+#endif
+#endif
 	if(bytes != NULL) *bytes = 0;
 	if(mh == NULL) return MPG123_ERR;
 	if(mh->buffer.size < mh->outblock) return MPG123_NO_SPACE;
@@ -568,6 +579,17 @@
 {
 	int ret = MPG123_OK;
 	size_t mdone = 0;
+#ifdef DEBUG
+#ifdef CCALIGN
+	double ALIGNED(16) altest[4];
+	if((size_t)altest % 16 != 0)
+	{
+		error("Stack variable is not aligned! Your combination of compiler/library is dangerous!");
+		if(mh != NULL) mh->err = MPG123_BAD_ALIGN;
+		return MPG123_ERR;
+	}
+#endif
+#endif
 	if(done != NULL) *done = 0;
 	if(mh == NULL) return MPG123_ERR;
 	if(inmemsize > 0)
@@ -1008,7 +1030,8 @@
 	"Invalid parameter addresses for index retrieval. (code 26)",
 	"Lost track in the bytestream and did not attempt resync. (code 27)",
 	"Failed to find valid MPEG data within limit on resync. (code 28)",
-	"No 8bit encoding possible. (code 29)"
+	"No 8bit encoding possible. (code 29)",
+	"Stack alignment is not good. (code 30)"
 };

 const char* attribute_align_arg mpg123_plain_strerror(int errcode)


Fix EstEID 3.4 signing

Fix EstEID 3.4 signing

opensc master requires now SC_ALGORITHM_RSA_HASH_NONE

Signed-off-by: Raul Metsma <8b52b6b714585648fd300da0dbc0fa0678553280@metsma.ee>

--- src/libopensc/card-mcrd.c
+++ src/libopensc/card-mcrd.c
@@ -82,14 +82,14 @@

 struct rule_record_s {
 	struct rule_record_s *next;
-	int recno;
+	unsigned int recno;
 	size_t datalen;
 	u8 data[1];
 };

 struct keyd_record_s {
 	struct keyd_record_s *next;
-	int recno;
+	unsigned int recno;
 	size_t datalen;
 	u8 data[1];
 };
@@ -307,58 +307,46 @@
 	LOG_FUNC_CALLED(card->ctx);
 	r = gp_select_aid(card, &EstEID_v35_AID);
 	if (r >= 0) {
-	        sc_log(card->ctx, "AID found");
-	        card->type = SC_CARD_TYPE_MCRD_ESTEID_V30;
-	        return 1;
+		sc_log(card->ctx, "AID found");
+		card->type = SC_CARD_TYPE_MCRD_ESTEID_V30;
+		return 1;
 	}
 	return 0;
 }

 static int mcrd_init(sc_card_t * card)
 {
-	unsigned long flags, ext_flags;
-	struct mcrd_priv_data *priv;
-	int r;
-
-	priv = calloc(1, sizeof *priv);
+	unsigned long flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE, ext_flags;
+	struct mcrd_priv_data *priv = calloc(1, sizeof *priv);
 	if (!priv)
 		return SC_ERROR_OUT_OF_MEMORY;
 	card->drv_data = priv;
 	card->cla = 0x00;
 	card->caps = SC_CARD_CAP_RNG;

-
-	if (is_esteid_card(card)) {
-		/* Select the EstEID AID to get to a known state.
-		 * For some reason a reset is required as well... */
-		sc_reset(card, 0);
-
-		flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_SHA1 | SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_SHA256;
-		if ((r = gp_select_aid(card, &EstEID_v3_AID)) >= 0) {
-			/* EstEID v3.0 has 2048 bit keys */
-			_sc_card_add_rsa_alg(card, 2048, flags, 0);
-		} else if ((r = gp_select_aid(card, &EstEID_v35_AID)) >= 0) {
-			/* EstEID v3.5 has 2048 bit keys or EC 384 */
-			_sc_card_add_rsa_alg(card, 2048, flags, 0);
-			flags = SC_ALGORITHM_ECDSA_RAW | SC_ALGORITHM_ECDH_CDH_RAW | SC_ALGORITHM_ECDSA_HASH_NONE;
-			ext_flags = SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES;
-			_sc_card_add_ec_alg(card, 384, flags, ext_flags, NULL);
-			// Force EstEID 3.5 card recv size 255 with T=0 to avoid recursive read binary
-			// sc_read_binary cannot handle recursive 61 00 calls
-			if (card->reader && card->reader->active_protocol == SC_PROTO_T0)
-				card->max_recv_size = 255;
-		} else if ((r = gp_select_aid(card, &AzeDIT_v35_AID)) >= 0) {
-			_sc_card_add_rsa_alg(card, 2048, flags, 0);
-		} else {
-			free(card->drv_data);
-			card->drv_data = NULL;
-			SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_CARD);
-		}
-	} else {
-		flags = SC_ALGORITHM_RSA_RAW |SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE;
+	if (!is_esteid_card(card)) {
 		_sc_card_add_rsa_alg(card, 512, flags, 0);
 		_sc_card_add_rsa_alg(card, 768, flags, 0);
 		_sc_card_add_rsa_alg(card, 1024, flags, 0);
+	} else if (gp_select_aid(card, &EstEID_v3_AID) >= 0) {
+		/* EstEID v3.0 has 2048 bit keys */
+		_sc_card_add_rsa_alg(card, 2048, flags, 0);
+	} else if (gp_select_aid(card, &EstEID_v35_AID) >= 0) {
+		/* EstEID v3.5 has 2048 bit keys or EC 384 */
+		_sc_card_add_rsa_alg(card, 2048, flags, 0);
+		flags = SC_ALGORITHM_ECDSA_RAW | SC_ALGORITHM_ECDH_CDH_RAW | SC_ALGORITHM_ECDSA_HASH_NONE;
+		ext_flags = SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES;
+		_sc_card_add_ec_alg(card, 384, flags, ext_flags, NULL);
+		// Force EstEID 3.5 card recv size 255 with T=0 to avoid recursive read binary
+		// sc_read_binary cannot handle recursive 61 00 calls
+		if (card->reader && card->reader->active_protocol == SC_PROTO_T0)
+			card->max_recv_size = 255;
+	} else if (gp_select_aid(card, &AzeDIT_v35_AID) >= 0) {
+		_sc_card_add_rsa_alg(card, 2048, flags, 0);
+	} else {
+		free(card->drv_data);
+		card->drv_data = NULL;
+		SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_CARD);
 	}

 	priv->curpath[0] = MFID;
@@ -394,7 +382,8 @@
 static int load_special_files(sc_card_t * card)
 {
 	sc_context_t *ctx = card->ctx;
-	int r, recno;
+	int r;
+	unsigned int recno;
 	struct df_info_s *dfi;
 	struct rule_record_s *rule;
 	struct keyd_record_s *keyd;
@@ -759,7 +748,7 @@
 		if (!*file)
 			LOG_FUNC_RETURN(card->ctx, SC_ERROR_OUT_OF_MEMORY);
 		if (apdu.resp[1] <= apdu.resplen)
-		process_fcp(card, *file, apdu.resp + 2, apdu.resp[1]);
+			process_fcp(card, *file, apdu.resp + 2, apdu.resp[1]);
 		return SC_SUCCESS;
 	}
 	return SC_SUCCESS;
@@ -1231,7 +1220,7 @@
 	sc_unlock(card);
 	LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
 	return sc_check_sw(card, apdu.sw1, apdu.sw2);
-      err:
+err:
 	if (locked)
 		sc_unlock(card);
 	return r;