use delayed calback in video activity.

use delayed calback in video activity.

--- src/modules/activity/video/video.c
+++ src/modules/activity/video/video.c
@@ -636,6 +636,30 @@
     free (ev);
 }

+
+static void
+browser_cb_delay_hilight (void *data, Evas_Object *obj, void *event_info)
+{
+    Browser_Selected_File_Data *ev = event_info;
+    Enna_Metadata *m = NULL;
+
+    if (!ev || !ev->file)
+        return;
+
+    if (!ev->file->is_directory && !ev->file->is_menu)
+         m = enna_metadata_meta_new (ev->file->uri);
+
+    backdrop_show (m);
+    snapshot_show (m);
+    infos_flags_set (m);
+
+    enna_panel_infos_set_cover(mod->o_panel_infos, m);
+    enna_panel_infos_set_text(mod->o_panel_infos, m);
+    enna_panel_infos_set_rating(mod->o_panel_infos, m);
+
+    enna_metadata_meta_free (m);
+}
+
 static void
 browser_cb_hilight (void *data, Evas_Object *obj, void *event_info)
 {
@@ -650,6 +674,8 @@

     if (!ev->file->is_directory && !ev->file->is_menu)
         m = enna_metadata_meta_new (ev->file->uri);
+    else
+        return;

     title = enna_metadata_meta_get (m, "title", 1);
     label = title ? title : ev->file->label;
@@ -663,13 +689,7 @@
     edje_object_part_text_set (mod->o_edje, "synopsis.textblock",
                                synopsis ? synopsis : "");

-    backdrop_show (m);
-    snapshot_show (m);
-    infos_flags_set (m);
-
-    enna_panel_infos_set_cover(mod->o_panel_infos, m);
-    enna_panel_infos_set_text(mod->o_panel_infos, m);
-    enna_panel_infos_set_rating(mod->o_panel_infos, m);
+

     ENNA_FREE (title);
     ENNA_FREE (categories);
@@ -693,6 +713,8 @@
                                     "selected", browser_cb_select, NULL);
     evas_object_smart_callback_add (mod->o_browser, "hilight",
                                     browser_cb_hilight, NULL);
+    evas_object_smart_callback_add (mod->o_browser, "delay,hilight",
+                                    browser_cb_delay_hilight, NULL);

     edje_object_part_swallow (mod->o_edje,
                               "browser.swallow", mod->o_browser);


fix zoom level 2

fix zoom level 2

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

--- src/modules/everything/evry_view.c
+++ src/modules/everything/evry_view.c
@@ -364,13 +364,23 @@
 	double col;

 	if (sd->view->zoom == 0)
+	  {
+
 	  size = 96;
+	  aspect_w *= 1 + (sd->h / size);
+	  }
+
 	else if (sd->view->zoom == 1)
-	  size = 128;
-	else if (sd->view->zoom == 2)
-	  size = 256;
-
-	aspect_w *= 1 + (sd->h / size);
+	  {
+	     size = 128;
+	     aspect_w *= 1 + (sd->h / size);
+	  }
+
+	else /* if (sd->view->zoom == 2) */
+	  {
+	     size = 256;
+	     aspect_w *= (sd->h / size);
+	  }

 	if (cnt < 3)
 	  col = 2;


fix ASCONF implicit success/error handling case.  "flag" parameter is a 1/0:TRUE/FALSE param, not a indication type

--- KERN/netinet/sctp_asconf.c
+++ KERN/netinet/sctp_asconf.c
@@ -925,7 +925,8 @@
  * for add.  If a duplicate operation is found, ignore the new one.
  */
 static uint32_t
-sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sctp_ifa *ifa, uint16_t type)
+sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sctp_ifa *ifa,
+		      uint16_t type)
 {
 	struct sctp_asconf_addr *aa, *aa_next;
 	struct sockaddr *sa;
@@ -947,10 +948,10 @@
 		}
 		/* is the negative request already in queue, and not sent */
 		if (aa->sent == 0 &&
-		/* add requested, delete already queued */
+		    /* add requested, delete already queued */
 		    ((type == SCTP_ADD_IP_ADDRESS &&
 		    aa->ap.aph.ph.param_type == SCTP_DEL_IP_ADDRESS) ||
-		/* delete requested, add already queued */
+		     /* delete requested, add already queued */
 		    (type == SCTP_DEL_IP_ADDRESS &&
 		    aa->ap.aph.ph.param_type == SCTP_ADD_IP_ADDRESS))) {
 			/* delete the existing entry in the queue */
@@ -1099,7 +1100,7 @@
 			SCTP_FREE(aa, SCTP_M_ASC_ADDR);
 			return (-1);
 		}
-	}			/* for each aa */
+	} /* for each aa */
 	if (stcb) {
 		vrf_id = stcb->asoc.vrf_id;
 	} else {
@@ -1440,7 +1441,7 @@
 	 * at any given time
 	 */
 	if (last_error_id == 0)
-		last_error_id--;/* set to "max" value */
+		last_error_id--;	/* set to "max" value */
 	for (aa = TAILQ_FIRST(&stcb->asoc.asconf_queue); aa != NULL;
 	    aa = aa_next) {
 		aa_next = TAILQ_NEXT(aa, next);
@@ -1450,11 +1451,9 @@
 			 * < last_error_id, then success else, failure
 			 */
 			if (aa->ap.aph.correlation_id < last_error_id)
-				sctp_asconf_process_param_ack(stcb, aa,
-				    SCTP_SUCCESS_REPORT);
+				sctp_asconf_process_param_ack(stcb, aa, 1);
 			else
-				sctp_asconf_process_param_ack(stcb, aa,
-				    SCTP_ERROR_CAUSE_IND);
+				sctp_asconf_process_param_ack(stcb, aa, 0);
 		} else {
 			/*
 			 * since we always process in order (FIFO queue) if


syntax

syntax

--- KERN/netinet/sctp_indata.c
+++ KERN/netinet/sctp_indata.c
@@ -2825,7 +2825,7 @@
 							sctp_log_sack(*biggest_newly_acked_tsn,
 								      last_tsn,
 								      tp1->rec.data.TSN_seq,
-								      frag_start,
+								      frag_strt,
 								      frag_end,
 								      SCTP_LOG_TSN_ACKED);
 #endif


Fix a possible off-by-one bug.

Fix a possible off-by-one bug.

--- src/commands/backup.c
+++ src/commands/backup.c
@@ -27,6 +27,12 @@
 **
 */

+/*
+** Make a backup.
+** Each element of the hash tree is backuped with the corresponding hash_
+** function.
+*/
+
 #include <dirent.h>
 #include <err.h>
 #include <stdio.h>
@@ -166,15 +172,14 @@
   if (options['v'])
     printf("%s\n", path);

-  tmp = buffer_new(PATH_MAX);
-  if ((size = readlink(path, (char *) tmp->data, tmp->size)) == -1)
+  tmp = buffer_new(PATH_MAX + 1);
+  if ((size = readlink(path, (char *) tmp->data, tmp->size - 1)) == -1)
   {
     warn("unable to open %s", path);
     buffer_delete(tmp);
     return NULL;
   }

-  /* XXX: We can exceed the buffer size by 1 here. */
   tmp->data[size++] = '\0';
   tmp->used = size;


Sync with upstream.

Sync with upstream.

--- KERN/netinet/sctp_os_bsd.h
+++ KERN/netinet/sctp_os_bsd.h
@@ -32,7 +32,7 @@

 #ifdef __FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_os_bsd.h 279888 2015-03-11 15:21:39Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_os_bsd.h 279889 2015-03-11 15:40:29Z tuexen $");
 #endif

 #ifndef _NETINET_SCTP_OS_BSD_H_
@@ -462,7 +462,10 @@
 /* get the socket type */
 #define SCTP_SO_TYPE(so)	((so)->so_type)
 #if (__FreeBSD_version >= 1100046)
-/* Use a macro for renaming sb_cc to sb_ccc */
+/* Use a macro for renaming sb_cc to sb_acc.
+ * Initially sb_ccc was used, but this broke select() when used
+ * with SCTP sockets.
+ */
 #define sb_cc sb_acc
 #endif
 /* reserve sb space for a socket */


Wait, can't compile without Andre's m_last()..

--- KERN/netinet/sctp_output.c
+++ KERN/netinet/sctp_output.c
@@ -10539,7 +10539,9 @@
 		 uint32_t *sndout,
 		 struct mbuf **new_tail)
 {
-#if defined(__FreeBSD__) && __FreeBSD_version >= 602000
+
+/*#if defined(__FreeBSD__) && __FreeBSD_version >= 602000*/
+#if defined(_NOT_YET_)

 	struct mbuf *m;
 /* take out max_hdr */
@@ -10608,7 +10610,8 @@
 	      int resv_upfront)
 {
 	int left;
-#if defined(__FreeBSD__) && __FreeBSD_version >= 602000
+/*#if defined(__FreeBSD__) && __FreeBSD_version >= 602000*/
+#if defined(_NOT_YET_)
 	left = sp->length;
 	sp->data = m_uiotombuf(uio, M_WAITOK, 0, resv_upfront, M_PKTHDR);
 	if (sp->data == NULL)


vioserial: Don't set interrupt vectors if MSI is disabled

VirtIOWdfInitQueuesCB introduced in commit 48db3727 attempts to
set config and queue vectors even if they are VIRTIO_MSI_NO_VECTOR.
This may fail because the IO region in QEMU does not necessarily
include the VIRTIO_MSI_CONFIG_VECTOR and VIRTIO_MSI_QUEUE_VECTOR
fields (i.e. it is smaller) so the writes are ignored and reading
the fields back yields 0. This is interpreted as a failure to set
the vector (0 != VIRTIO_MSI_NO_VECTOR).

Signed-off-by: Ladi Prosek <727f16b97cf99ec0710180d99386e4875fb7e2eb@redhat.com>

--- VirtIO/WDF/VirtIOWdf.c
+++ VirtIO/WDF/VirtIOWdf.c
@@ -163,8 +163,10 @@

     /* set up the device config vector */
     msix_vec = PCIGetMSIInterruptVector(pWdfDriver->ConfigInterrupt);
-    if (virtio_set_config_vector(&pWdfDriver->VIODevice, msix_vec) != msix_vec) {
-        return STATUS_DEVICE_BUSY;
+    if (msix_vec != VIRTIO_MSI_NO_VECTOR) {
+        if (virtio_set_config_vector(&pWdfDriver->VIODevice, msix_vec) != msix_vec) {
+            return STATUS_DEVICE_BUSY;
+        }
     }

     /* find and initialize queues */
@@ -181,9 +183,11 @@
         pQueueParamFunc(pWdfDriver, i, &QueueParam);

         msix_vec = PCIGetMSIInterruptVector(QueueParam.Interrupt);
-        if (virtio_set_queue_vector(vq, msix_vec) != msix_vec) {
-            status = STATUS_DEVICE_BUSY;
-            break;
+        if (msix_vec != VIRTIO_MSI_NO_VECTOR) {
+            if (virtio_set_queue_vector(vq, msix_vec) != msix_vec) {
+                status = STATUS_DEVICE_BUSY;
+                break;
+            }
         }

         virtio_set_queue_event_suppression(


Correction d'une faute de frappe

Correction d'une faute de frappe

--- C/03-Menu/menu.c
+++ C/03-Menu/menu.c
@@ -44,7 +44,7 @@

   printf("1-Crème glacée napolitaine 1.00$\n");
   printf("2-Sorbet au durion         9.00$\n");
-  printf("Choisissez un desset>");
+  printf("Choisissez un dessert>");

   scanf("%d", &choix);


Declaration of macros that are to be used only in specific fuction moved inside these fuctions.

--- fixed-math.c
+++ fixed-math.c
@@ -18,64 +18,64 @@
 #error N_PRECALC_FACTOR is expected to be 16 by code in this file. Check if modifications are needed
 #endif

-// No saturation check, no early exit check, expects the arg1 to be bottom 8 bits
-//    C_       arg1[7..0] (being shifted)
-//    B_:D_:E  arg2[23..0] (being shifted)
-//    A_:H_:L  product[23..0]
-#define F_MULT_ITERATION_P_16b(id) asm(\
-"	srl c\n\
-	jr nc,_f_multiply_next_bit"#id"\n\
-._f_multiply_bit_on"#id"\n\
-	add hl,de\n\
-	adc b\n\
-._f_multiply_next_bit"#id"\n\
-	sla e\n\
-	rl d\n\
-	rl b\n");
-
-// Saturation check, early exit check, expects the arg1 to be top 8 bits
-//    B_       arg1[15..8] (being shifted)
-//    C_:D_:E  arg2[23..0] (being shifted)
-//    A_:H_:L  product[31..8]
-#define F_MULT_ITERATION_P_8b(id) asm(\
-"	srl b\n\
-	jr c, _f_multiply_bit_on"#id"\n\
-	jp nz, _f_multiply_next_bit"#id"\n\
-    ; if Z and NC, then exit the loop\n\
-	jp  _f_multiply_exit_hl\n\
-._f_multiply_bit_on"#id"\n\
-	add hl,de\n\
-	adc c\n\
-    ; saturation, if top byte of the 32-bit product is not 0 or 255\n\
-	jp z,_f_multiply_not_satur"#id"\n\
-	cp 255\n\
-	jp nz,_f_multiply_satur_ah\n\
-._f_multiply_not_satur"#id"\n\
-._f_multiply_next_bit"#id"\n\
-	sla e\n\
-	rl d\n\
-	rl c\n");
-
-// No saturation check, early exit check, expects the arg1 to be only 8 bits
-//    C_       arg1[7..0] (being shifted)
-//    B_:D_:E  arg2[23..0] (being shifted)
-//    A_:H_:L  product[23..0]
-#define F_MULT_ITERATION_P_8b_only(id) asm(\
-"	srl c\n\
-	jr c, _f_multiply_bit_on"#id"\n\
-	jp nz, _f_multiply_next_bit"#id"\n\
-	; if Z and NC, then exit the loop\n\
-	jp _f_multiply_exit_ah\n\
-._f_multiply_bit_on"#id"\n\
-	add hl,de\n\
-	adc b\n\
-._f_multiply_next_bit"#id"\n\
-	sla e\n\
-	rl d\n\
-	rl b\n");
-
 int __CALLEE__ f_multiply(int f_a, int f_b)
 {
+	// No saturation check, no early exit check, expects the arg1 to be bottom 8 bits
+	//    C_       arg1[7..0] (being shifted)
+	//    B_:D_:E  arg2[23..0] (being shifted)
+	//    A_:H_:L  product[23..0]
+	#define F_MULT_ITERATION_P_16b(id) asm(\
+	"	srl c\n\
+		jr nc,_f_multiply_next_bit"#id"\n\
+	._f_multiply_bit_on"#id"\n\
+		add hl,de\n\
+		adc b\n\
+	._f_multiply_next_bit"#id"\n\
+		sla e\n\
+		rl d\n\
+		rl b\n");
+
+	// Saturation check, early exit check, expects the arg1 to be top 8 bits
+	//    B_       arg1[15..8] (being shifted)
+	//    C_:D_:E  arg2[23..0] (being shifted)
+	//    A_:H_:L  product[31..8]
+	#define F_MULT_ITERATION_P_8b(id) asm(\
+	"	srl b\n\
+		jr c, _f_multiply_bit_on"#id"\n\
+		jp nz, _f_multiply_next_bit"#id"\n\
+		; if Z and NC, then exit the loop\n\
+		jp  _f_multiply_exit_hl\n\
+	._f_multiply_bit_on"#id"\n\
+		add hl,de\n\
+		adc c\n\
+		; saturation, if top byte of the 32-bit product is not 0 or 255\n\
+		jp z,_f_multiply_not_satur"#id"\n\
+		cp 255\n\
+		jp nz,_f_multiply_satur_ah\n\
+	._f_multiply_not_satur"#id"\n\
+	._f_multiply_next_bit"#id"\n\
+		sla e\n\
+		rl d\n\
+		rl c\n");
+
+	// No saturation check, early exit check, expects the arg1 to be only 8 bits
+	//    C_       arg1[7..0] (being shifted)
+	//    B_:D_:E  arg2[23..0] (being shifted)
+	//    A_:H_:L  product[23..0]
+	#define F_MULT_ITERATION_P_8b_only(id) asm(\
+	"	srl c\n\
+		jr c, _f_multiply_bit_on"#id"\n\
+		jp nz, _f_multiply_next_bit"#id"\n\
+		; if Z and NC, then exit the loop\n\
+		jp _f_multiply_exit_ah\n\
+	._f_multiply_bit_on"#id"\n\
+		add hl,de\n\
+		adc b\n\
+	._f_multiply_next_bit"#id"\n\
+		sla e\n\
+		rl d\n\
+		rl b\n");
+
 #asm
 ;
 ; Registers used:
@@ -243,6 +243,9 @@
    ret

 #endasm
+	#undef F_MULT_ITERATION_P_16b
+	#undef F_MULT_ITERATION_P_8b
+	#undef F_MULT_ITERATION_P_8b_only
 }

 /*
@@ -291,80 +294,78 @@

 #ifdef UGLY_F_SQRT

-/*
- * Generates asm for one iteration of searching in table
- *
- * Params
- *  offset - contains the offset of guess in the table (one bit must be set)
- *  offsetmsb - must be the high byte of offset
- *  offsetlsb - must be the low byte of offset
- *
- * Registers
- *  HL    - pointer to current guess,
- *          if the value of param is higher or equal than a guess at (HL+offset),
- *          sets HL to HL+offset, otherwise leaves HL unchanged.
- *  DE:BC - parameter (value being searched for)
- */
-#define DISTIDX_ITERATION(offset) asm(\
-"	ld  a,d\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_0\n\
-	jr	nz,_f16_stb_higher"#offset"_0\n\
-	ld  a,e\n\
-	dec hl\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_1\n\
-	jr	nz,_f16_stb_higher"#offset"_1\n\
-	ld  a,b\n\
-	dec hl\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_2\n\
-	jr	nz,_f16_stb_higher"#offset"_2\n\
-	ld  a,c\n\
-	dec hl\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_3\n\
-_f16_stb_higher"#offset"_3:\n\
-	inc hl\n\
-_f16_stb_higher"#offset"_2:\n\
-	inc hl\n\
-_f16_stb_higher"#offset"_1:\n\
-	inc hl\n\
-_f16_stb_higher"#offset"_0:\n\
-	jp _f16_stb_next"#offset"\n\
-_f16_stb_lower"#offset"_3:\n\
-	inc hl\n\
-_f16_stb_lower"#offset"_2:\n\
-	inc hl\n\
-_f16_stb_lower"#offset"_1:\n\
-	inc hl\n\
-_f16_stb_lower"#offset"_0:\n\
-")
-
-// Different cases for offset bit in LS byte or MS byte
-// First try to add the offset, and if guess is larger, undo it
-// (this can be speeded up a bit by aligning _f16_sqrs on 2k
-// and using set/res instructions, but complicates things)
-
-#define DISTIDX_ITERATION_MSB(offset, bit) asm(\
-"	set "#bit",h\n"); \
-	DISTIDX_ITERATION(offset);\
-asm(\
-"	res "#bit",h\n\
-_f16_stb_next"#offset":\n\
-")
-
-#define DISTIDX_ITERATION_LSB(offset, bit) asm(\
-"	set "#bit",l\n"); \
-	DISTIDX_ITERATION(offset); \
-asm(\
-"	res "#bit",l\n\
-_f16_stb_next"#offset":\n\
-")
-
-
 uint __FASTCALL__ distidx_sqrt(unsigned long f16_l)
 {
+	/*
+	 * Generates asm for one iteration of searching in table
+	 *
+	 * Params
+	 *  offset - contains the offset of guess in the table (one bit must be set)
+	 *  offsetmsb - must be the high byte of offset
+	 *  offsetlsb - must be the low byte of offset
+	 *
+	 * Registers
+	 *  HL    - pointer to current guess,
+	 *          if the value of param is higher or equal than a guess at (HL+offset),
+	 *          sets HL to HL+offset, otherwise leaves HL unchanged.
+	 *  DE:BC - parameter (value being searched for)
+	 */
+	#define DISTIDX_ITERATION(offset) asm(\
+	"	ld  a,d\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_0\n\
+		jr	nz,_f16_stb_higher"#offset"_0\n\
+		ld  a,e\n\
+		dec hl\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_1\n\
+		jr	nz,_f16_stb_higher"#offset"_1\n\
+		ld  a,b\n\
+		dec hl\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_2\n\
+		jr	nz,_f16_stb_higher"#offset"_2\n\
+		ld  a,c\n\
+		dec hl\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_3\n\
+	_f16_stb_higher"#offset"_3:\n\
+		inc hl\n\
+	_f16_stb_higher"#offset"_2:\n\
+		inc hl\n\
+	_f16_stb_higher"#offset"_1:\n\
+		inc hl\n\
+	_f16_stb_higher"#offset"_0:\n\
+		jp _f16_stb_next"#offset"\n\
+	_f16_stb_lower"#offset"_3:\n\
+		inc hl\n\
+	_f16_stb_lower"#offset"_2:\n\
+		inc hl\n\
+	_f16_stb_lower"#offset"_1:\n\
+		inc hl\n\
+	_f16_stb_lower"#offset"_0:\n\
+	")
+
+	// Different cases for offset bit in LS byte or MS byte
+	// First try to add the offset, and if guess is larger, undo it
+	// (this can be speeded up a bit by aligning _f16_sqrs on 2k
+	// and using set/res instructions, but complicates things)
+
+	#define DISTIDX_ITERATION_MSB(offset, bit) asm(\
+	"	set "#bit",h\n"); \
+		DISTIDX_ITERATION(offset);\
+	asm(\
+	"	res "#bit",h\n\
+	_f16_stb_next"#offset":\n\
+	")
+
+	#define DISTIDX_ITERATION_LSB(offset, bit) asm(\
+	"	set "#bit",l\n"); \
+		DISTIDX_ITERATION(offset); \
+	asm(\
+	"	res "#bit",l\n\
+	_f16_stb_next"#offset":\n\
+	")
 #asm
 ;_distidx_sqrt:

@@ -405,6 +406,9 @@
 	rr  l

 #endasm
+	#undef DISTIDX_ITERATION
+	#undef DISTIDX_ITERATION_MSB
+	#undef DISTIDX_ITERATION_LSB
 }

 void ugly_f_sqrt_init()
@@ -415,93 +419,91 @@

 #else // UGLY_F_SQRT

-/*
- * Generates asm for one iteration of searching in table
- *
- * Params
- *  offset - contains the offset of guess in the table (one bit must be set)
- *  offsetmsb - must be the high byte of offset
- *  offsetlsb - must be the low byte of offset
- *
- * Registers
- *  HL    - pointer to current guess,
- *          if the value of param is higher or equal than a guess at (HL+offset),
- *          sets HL to HL+offset, otherwise leaves HL unchanged.
- *  DE:BC - parameter (value being searched for)
- */
-#define DISTIDX_ITERATION(offset) asm(\
-"	ld  a,d\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_0\n\
-	jr	nz,_f16_stb_higher"#offset"_0\n\
-	ld  a,e\n\
-	dec hl\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_1\n\
-	jr	nz,_f16_stb_higher"#offset"_1\n\
-	ld  a,b\n\
-	dec hl\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_2\n\
-	jr	nz,_f16_stb_higher"#offset"_2\n\
-	ld  a,c\n\
-	dec hl\n\
-	cp  (hl)\n\
-	jr  c,_f16_stb_lower"#offset"_3\n\
-_f16_stb_higher"#offset"_3:\n\
-	inc hl\n\
-_f16_stb_higher"#offset"_2:\n\
-	inc hl\n\
-_f16_stb_higher"#offset"_1:\n\
-	inc hl\n\
-_f16_stb_higher"#offset"_0:\n\
-	jp _f16_stb_next"#offset"\n\
-_f16_stb_lower"#offset"_3:\n\
-	inc hl\n\
-_f16_stb_lower"#offset"_2:\n\
-	inc hl\n\
-_f16_stb_lower"#offset"_1:\n\
-	inc hl\n\
-_f16_stb_lower"#offset"_0:\n\
-")
-
-// Different cases for offset bit in LS byte or MS byte
-// First try to add the offset, and if guess is larger, undo it
-// (this can be speeded up a bit by aligning _f16_sqrs on 2k
-// and using set/res instructions, but complicates things)
-
-#define DISTIDX_ITERATION_MSB(offset, offsetmsb) asm(\
-"	ld  a,"#offsetmsb"\n\
-	add h\n\
-	ld  h,a\n"); \
-	DISTIDX_ITERATION(offset);\
-asm(\
-"	ld  a,h\n\
-	sub "#offsetmsb"\n\
-	ld  h,a\n\
-_f16_stb_next"#offset":\n\
-")
-
-#define DISTIDX_ITERATION_LSB(offset, offsetlsb) asm(\
-"	ld  a,"#offsetlsb"\n\
-	add l\n\
-	ld  l,a\n\
-	jp nc,_f16_stb_1_"#offset"\n\
-	inc h\n\
-_f16_stb_1_"#offset":\n"); \
-	DISTIDX_ITERATION(offset); \
-asm(\
-"	ld  a,l\n\
-	sub "#offsetlsb"\n\
-	ld  l,a\n\
-	jp nc,_f16_stb_next"#offset"\n\
-	dec h\n\
-_f16_stb_next"#offset":\n\
-")
-
-
 uint __FASTCALL__ distidx_sqrt(unsigned long f16_l)
 {
+	/*
+	 * Generates asm for one iteration of searching in table
+	 *
+	 * Params
+	 *  offset - contains the offset of guess in the table (one bit must be set)
+	 *  offsetmsb - must be the high byte of offset
+	 *  offsetlsb - must be the low byte of offset
+	 *
+	 * Registers
+	 *  HL    - pointer to current guess,
+	 *          if the value of param is higher or equal than a guess at (HL+offset),
+	 *          sets HL to HL+offset, otherwise leaves HL unchanged.
+	 *  DE:BC - parameter (value being searched for)
+	 */
+	#define DISTIDX_ITERATION(offset) asm(\
+	"	ld  a,d\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_0\n\
+		jr	nz,_f16_stb_higher"#offset"_0\n\
+		ld  a,e\n\
+		dec hl\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_1\n\
+		jr	nz,_f16_stb_higher"#offset"_1\n\
+		ld  a,b\n\
+		dec hl\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_2\n\
+		jr	nz,_f16_stb_higher"#offset"_2\n\
+		ld  a,c\n\
+		dec hl\n\
+		cp  (hl)\n\
+		jr  c,_f16_stb_lower"#offset"_3\n\
+	_f16_stb_higher"#offset"_3:\n\
+		inc hl\n\
+	_f16_stb_higher"#offset"_2:\n\
+		inc hl\n\
+	_f16_stb_higher"#offset"_1:\n\
+		inc hl\n\
+	_f16_stb_higher"#offset"_0:\n\
+		jp _f16_stb_next"#offset"\n\
+	_f16_stb_lower"#offset"_3:\n\
+		inc hl\n\
+	_f16_stb_lower"#offset"_2:\n\
+		inc hl\n\
+	_f16_stb_lower"#offset"_1:\n\
+		inc hl\n\
+	_f16_stb_lower"#offset"_0:\n\
+	")
+
+	// Different cases for offset bit in LS byte or MS byte
+	// First try to add the offset, and if guess is larger, undo it
+	// (this can be speeded up a bit by aligning _f16_sqrs on 2k
+	// and using set/res instructions, but complicates things)
+
+	#define DISTIDX_ITERATION_MSB(offset, offsetmsb) asm(\
+	"	ld  a,"#offsetmsb"\n\
+		add h\n\
+		ld  h,a\n"); \
+		DISTIDX_ITERATION(offset);\
+	asm(\
+	"	ld  a,h\n\
+		sub "#offsetmsb"\n\
+		ld  h,a\n\
+	_f16_stb_next"#offset":\n\
+	")
+
+	#define DISTIDX_ITERATION_LSB(offset, offsetlsb) asm(\
+	"	ld  a,"#offsetlsb"\n\
+		add l\n\
+		ld  l,a\n\
+		jp nc,_f16_stb_1_"#offset"\n\
+		inc h\n\
+	_f16_stb_1_"#offset":\n"); \
+		DISTIDX_ITERATION(offset); \
+	asm(\
+	"	ld  a,l\n\
+		sub "#offsetlsb"\n\
+		ld  l,a\n\
+		jp nc,_f16_stb_next"#offset"\n\
+		dec h\n\
+	_f16_stb_next"#offset":\n\
+	")
 #asm
 ;_distidx_sqrt:

@@ -542,6 +544,9 @@
 	rr  l

 #endasm
+	#define DISTIDX_ITERATION
+	#define DISTIDX_ITERATION_MSB
+	#define DISTIDX_ITERATION_LSB
 }

 #endif // UGLY_F_SQRT


its  be not  bu

its  be not  bu

--- KERN/netinet/sctp_output.c
+++ KERN/netinet/sctp_output.c
@@ -9933,8 +9933,8 @@
 		s = splnet();
 #endif
 		SCTP_INP_RLOCK(inp);
-		if(bu.error) {
-		  error = bu.error;
+		if(be.error) {
+		  error = be.error;
 		  SCTP_INP_RUNLOCK(inp);
 		  goto clean_up;
 		}
@@ -10050,8 +10050,8 @@
  		s = splnet();
 #endif
 		SCTP_INP_RLOCK(inp);
-		if(bu.error) {
-		  error = bu.error;
+		if(be.error) {
+		  error = be.error;
 		  SCTP_INP_RUNLOCK(inp);
 		  goto temp_clean_up;
 		}


un define si corre dentro del emulador

un define si corre dentro del emulador

Former-commit-id: 5905df328f2f71d2d01e3d010483bfa875e97744

--- VirtualAccelerometer.h
+++ VirtualAccelerometer.h
@@ -48,8 +48,8 @@
 @end

-//#ifdef VirtualUIAccelerometer // running inside the simulator
+#if TARGET_IPHONE_SIMULATOR // running inside the simulator
 #define UIAccelerometer VirtualAccelerometer
 #define UIAcceleration VirtualAcceleration
 #define UIAccelerometerDelegate VirtualAccelerometerDelegate
-//#endif // inside the simulator+#endif // simulator


Create lucifer27899.c

Create lucifer27899.c

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

--- C/lucifer27899.c
+++ C/lucifer27899.c
@@ -0,0 +1,6 @@
+#include<stdio.h>
+void main()
+{
+  printf("Hello World!");
+  }
+


missing error check for sctp_listen

missing error check for sctp_listen

--- KERN/netinet/sctp_usrreq.c
+++ KERN/netinet/sctp_usrreq.c
@@ -4239,6 +4239,13 @@
 	sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK);
 #endif
 	SOCK_LOCK(so);
+#if defined(__FreeBSD__) && __FreeBSD_version > 500000
+	error = solisten_proto_check(so);
+	if(error) {
+		SOCK_UNLOCK(so);
+		return (error);
+	}
+#endif
 	SCTP_INP_RLOCK(inp);
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
@@ -4283,6 +4290,9 @@
 		inp->sctp_socket->so_options &= ~SO_ACCEPTCONN;
 	}
 	SCTP_INP_WUNLOCK(inp);
+#if defined(__FreeBSD__) && __FreeBSD_version > 500000
+	solisten_proto(so);
+#endif
 	SOCK_UNLOCK(so);
 	splx(s);
 	return (error);


tools lib traceevent: test correct variable after allocation

we've tested the wrong variable for allocation failure, fix it to
test the right one.

Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>
Link: 76055711efe94d7d4b6c0fd540481f7575b7c505@oracle.com
Signed-off-by: Sasha Levin <e642b69ed2fc111e09ffdc37feb733a52253340d@oracle.com>
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/lib/traceevent/event-parse.c
+++ tools/lib/traceevent/event-parse.c
@@ -2481,7 +2481,7 @@

 	free_token(token);
 	arg = alloc_arg();
-	if (!field) {
+	if (!arg) {
 		do_warning("%s: not enough memory!", __func__);
 		*tok = NULL;
 		return EVENT_ERROR;


Move standard library inclusions to after internal inclusions.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@332124 91177308-0d34-0410-b5e6-96231b3b80d8

--- tools/llvm-mca/RetireControlUnit.h
+++ tools/llvm-mca/RetireControlUnit.h
@@ -15,11 +15,11 @@
 #ifndef LLVM_TOOLS_LLVM_MCA_RETIRE_CONTROL_UNIT_H
 #define LLVM_TOOLS_LLVM_MCA_RETIRE_CONTROL_UNIT_H

+#include "Instruction.h"
+#include "llvm/MC/MCSchedule.h"
+
 #include <algorithm>
 #include <vector>
-
-#include "Instruction.h"
-#include "llvm/MC/MCSchedule.h"

 namespace mca {


added ASCII char evaluation

added ASCII char evaluation

--- forge/eval.c
+++ forge/eval.c
@@ -1,7 +1,7 @@
 /* simple expression evaluator
  * intended for symbolic miniMoDA
  * (c) 2018 Carlos J. Santisteban
- * last modified 20180424-1209
+ * last modified 20180425-1259
  */
 #define	DEBUG	1

@@ -12,6 +12,7 @@
 #define	STKSIZ	8
 #define	TRUE	-1
 #define	FALSE	0
+#define	COMILLA	39

 /* globals */
 char tx[EXPSIZ];	//input buffer
@@ -170,6 +171,11 @@
 				pt--;
 				operation();	//check whether there was a pending operation
 				break;
+			case COMILLA:
+//character between single-quotes, just take the ASCII value
+				value = tx[++pt];
+				while (tx[++pt] != COMILLA);	//advance to closing quote
+				break;
 			case '+':
 			case '-':
 			case '*':


Fixed work of IconButton with XFT fonts

Fixed work of IconButton with XFT fonts

--- lib/Xm/IconButton.c
+++ lib/Xm/IconButton.c
@@ -1834,7 +1834,7 @@
     Pixmap stipple;
     Arg args[2];
     Cardinal num_args = 0;
-    XFontStruct *fs;
+    XFontStruct *fs = NULL;

     XtSetArg(args[num_args], XmNforeground, &fg); num_args++;
     XtSetArg(args[num_args], XmNbackground, &bg); num_args++;
@@ -1846,13 +1846,17 @@

     values.foreground = fg;
     values.background = bg;
-    values.font = fs->fid;
     values.graphics_exposures = False;
     values.stipple = stipple;
     values.fill_style = FillStippled;

-    mask = GCForeground | GCFont | GCBackground | GCGraphicsExposures;
+    mask = GCForeground | GCBackground | GCGraphicsExposures;
     smask = mask | GCStipple | GCFillStyle;
+
+    if (fs) {
+        values.font = fs->fid;
+        mask |= mask | GCFont;
+    }

     XmIconButton_gc(iw) = XtGetGC(w, mask, &values);
     XmIconButton_stippled_text_gc(iw) = XtGetGC(w, smask, &values);


[PATCH] 9p: fix leak on error path

[PATCH] 9p: fix leak on error path

If register_filesystem() fails mux workqueue must be killed.

Signed-off-by: Alexey Dobriyan <b99bff5923d24d2fb8e844db9dac7cd59203da1d@gmail.com>
Cc: Eric Van Hensbergen <f6aaec02cb2023b586fda1596c965a5752b892b4@gmail.com>
Cc: Ron Minnich <f569d0af9a3481c4007b95c7180d6c41009f2513@lanl.gov>
Cc: Latchesar Ionkov <1cce15653918254946894aae1b185a0680390953@ionkov.net>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- fs/9p/v9fs.c
+++ fs/9p/v9fs.c
@@ -460,8 +460,10 @@

 	ret = v9fs_mux_global_init();
 	if (!ret)
-		ret = register_filesystem(&v9fs_fs_type);
-
+		return ret;
+	ret = register_filesystem(&v9fs_fs_type);
+	if (!ret)
+		v9fs_mux_global_exit();
 	return ret;
 }


fat: fix VFAT compat ioctls on 64-bit systems

If you compile and run the below test case in an msdos or vfat directory on
an x86-64 system with -m32 you'll get garbage in the kernel_dirent struct
followed by a SIGSEGV.

The patch fixes this.

Reported and initial fix by Bart Oldeman

#include <sys/types.h>
#include <sys/ioctl.h>
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
struct kernel_dirent {
         long            d_ino;
         long		d_off;
         unsigned short  d_reclen;
         char            d_name[256]; /* We must not include limits.h! */
};
#define VFAT_IOCTL_READDIR_BOTH  _IOR('r', 1, struct kernel_dirent [2])
#define VFAT_IOCTL_READDIR_SHORT  _IOR('r', 2, struct kernel_dirent [2])

int main(void)
{
         int fd = open(".", O_RDONLY);
         struct kernel_dirent de[2];

         while (1) {
                 int i = ioctl(fd, VFAT_IOCTL_READDIR_BOTH, (long)de);
                 if (i == -1) break;
                 if (de[0].d_reclen == 0) break;
                 printf("SFN: reclen=%2d off=%d ino=%d, %-12s",
 		       de[0].d_reclen, de[0].d_off, de[0].d_ino, de[0].d_name);
 		if (de[1].d_reclen)
 		  printf("\tLFN: reclen=%2d off=%d ino=%d, %s",
 		    de[1].d_reclen, de[1].d_off, de[1].d_ino, de[1].d_name);
 		printf("\n");
         }
         return 0;
}

Signed-off-by: Bart Oldeman <e44083abd7ab52295a71be9b5cc53c15320f0531@users.sourceforge.net>
Signed-off-by: OGAWA Hirofumi <1dd685eef08048be95744a1b104ca593a93cc914@mail.parknet.co.jp>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- fs/fat/dir.c
+++ fs/fat/dir.c
@@ -422,7 +422,7 @@
 EXPORT_SYMBOL_GPL(fat_search_long);

 struct fat_ioctl_filldir_callback {
-	struct dirent __user *dirent;
+	void __user *dirent;
 	int result;
 	/* for dir ioctl */
 	const char *longname;
@@ -647,62 +647,85 @@
 	return __fat_readdir(inode, filp, dirent, filldir, 0, 0);
 }

-static int fat_ioctl_filldir(void *__buf, const char *name, int name_len,
-			     loff_t offset, u64 ino, unsigned int d_type)
-{
-	struct fat_ioctl_filldir_callback *buf = __buf;
-	struct dirent __user *d1 = buf->dirent;
-	struct dirent __user *d2 = d1 + 1;
-
-	if (buf->result)
-		return -EINVAL;
-	buf->result++;
-
-	if (name != NULL) {
-		/* dirent has only short name */
-		if (name_len >= sizeof(d1->d_name))
-			name_len = sizeof(d1->d_name) - 1;
-
-		if (put_user(0, d2->d_name)			||
-		    put_user(0, &d2->d_reclen)			||
-		    copy_to_user(d1->d_name, name, name_len)	||
-		    put_user(0, d1->d_name + name_len)		||
-		    put_user(name_len, &d1->d_reclen))
-			goto efault;
-	} else {
-		/* dirent has short and long name */
-		const char *longname = buf->longname;
-		int long_len = buf->long_len;
-		const char *shortname = buf->shortname;
-		int short_len = buf->short_len;
-
-		if (long_len >= sizeof(d1->d_name))
-			long_len = sizeof(d1->d_name) - 1;
-		if (short_len >= sizeof(d1->d_name))
-			short_len = sizeof(d1->d_name) - 1;
-
-		if (copy_to_user(d2->d_name, longname, long_len)	||
-		    put_user(0, d2->d_name + long_len)			||
-		    put_user(long_len, &d2->d_reclen)			||
-		    put_user(ino, &d2->d_ino)				||
-		    put_user(offset, &d2->d_off)			||
-		    copy_to_user(d1->d_name, shortname, short_len)	||
-		    put_user(0, d1->d_name + short_len)			||
-		    put_user(short_len, &d1->d_reclen))
-			goto efault;
-	}
-	return 0;
-efault:
-	buf->result = -EFAULT;
-	return -EFAULT;
-}
-
-static int fat_dir_ioctl(struct inode * inode, struct file * filp,
-		  unsigned int cmd, unsigned long arg)
+#define FAT_IOCTL_FILLDIR_FUNC(func, dirent_type)			   \
+static int func(void *__buf, const char *name, int name_len,		   \
+			     loff_t offset, u64 ino, unsigned int d_type)  \
+{									   \
+	struct fat_ioctl_filldir_callback *buf = __buf;			   \
+	struct dirent_type __user *d1 = buf->dirent;			   \
+	struct dirent_type __user *d2 = d1 + 1;				   \
+									   \
+	if (buf->result)						   \
+		return -EINVAL;						   \
+	buf->result++;							   \
+									   \
+	if (name != NULL) {						   \
+		/* dirent has only short name */			   \
+		if (name_len >= sizeof(d1->d_name))			   \
+			name_len = sizeof(d1->d_name) - 1;		   \
+									   \
+		if (put_user(0, d2->d_name)			||	   \
+		    put_user(0, &d2->d_reclen)			||	   \
+		    copy_to_user(d1->d_name, name, name_len)	||	   \
+		    put_user(0, d1->d_name + name_len)		||	   \
+		    put_user(name_len, &d1->d_reclen))			   \
+			goto efault;					   \
+	} else {							   \
+		/* dirent has short and long name */			   \
+		const char *longname = buf->longname;			   \
+		int long_len = buf->long_len;				   \
+		const char *shortname = buf->shortname;			   \
+		int short_len = buf->short_len;				   \
+									   \
+		if (long_len >= sizeof(d1->d_name))			   \
+			long_len = sizeof(d1->d_name) - 1;		   \
+		if (short_len >= sizeof(d1->d_name))			   \
+			short_len = sizeof(d1->d_name) - 1;		   \
+									   \
+		if (copy_to_user(d2->d_name, longname, long_len)	|| \
+		    put_user(0, d2->d_name + long_len)			|| \
+		    put_user(long_len, &d2->d_reclen)			|| \
+		    put_user(ino, &d2->d_ino)				|| \
+		    put_user(offset, &d2->d_off)			|| \
+		    copy_to_user(d1->d_name, shortname, short_len)	|| \
+		    put_user(0, d1->d_name + short_len)			|| \
+		    put_user(short_len, &d1->d_reclen))			   \
+			goto efault;					   \
+	}								   \
+	return 0;							   \
+efault:									   \
+	buf->result = -EFAULT;						   \
+	return -EFAULT;							   \
+}
+
+FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, dirent)
+
+static int fat_ioctl_readdir(struct inode *inode, struct file *filp,
+			     void __user *dirent, filldir_t filldir,
+			     int short_only, int both)
 {
 	struct fat_ioctl_filldir_callback buf;
-	struct dirent __user *d1;
-	int ret, short_only, both;
+	int ret;
+
+	buf.dirent = dirent;
+	buf.result = 0;
+	mutex_lock(&inode->i_mutex);
+	ret = -ENOENT;
+	if (!IS_DEADDIR(inode)) {
+		ret = __fat_readdir(inode, filp, &buf, filldir,
+				    short_only, both);
+	}
+	mutex_unlock(&inode->i_mutex);
+	if (ret >= 0)
+		ret = buf.result;
+	return ret;
+}
+
+static int fat_dir_ioctl(struct inode *inode, struct file *filp,
+			 unsigned int cmd, unsigned long arg)
+{
+	struct dirent __user *d1 = (struct dirent __user *)arg;
+	int short_only, both;

 	switch (cmd) {
 	case VFAT_IOCTL_READDIR_SHORT:
@@ -717,7 +740,6 @@
 		return fat_generic_ioctl(inode, filp, cmd, arg);
 	}

-	d1 = (struct dirent __user *)arg;
 	if (!access_ok(VERIFY_WRITE, d1, sizeof(struct dirent[2])))
 		return -EFAULT;
 	/*
@@ -728,69 +750,48 @@
 	if (put_user(0, &d1->d_reclen))
 		return -EFAULT;

-	buf.dirent = d1;
-	buf.result = 0;
-	mutex_lock(&inode->i_mutex);
-	ret = -ENOENT;
-	if (!IS_DEADDIR(inode)) {
-		ret = __fat_readdir(inode, filp, &buf, fat_ioctl_filldir,
-				    short_only, both);
-	}
-	mutex_unlock(&inode->i_mutex);
-	if (ret >= 0)
-		ret = buf.result;
-	return ret;
+	return fat_ioctl_readdir(inode, filp, d1, fat_ioctl_filldir,
+				 short_only, both);
 }

 #ifdef CONFIG_COMPAT
 #define	VFAT_IOCTL_READDIR_BOTH32	_IOR('r', 1, struct compat_dirent[2])
 #define	VFAT_IOCTL_READDIR_SHORT32	_IOR('r', 2, struct compat_dirent[2])

-static long fat_compat_put_dirent32(struct dirent *d,
-				    struct compat_dirent __user *d32)
-{
-        if (!access_ok(VERIFY_WRITE, d32, sizeof(struct compat_dirent)))
-                return -EFAULT;
-
-        __put_user(d->d_ino, &d32->d_ino);
-        __put_user(d->d_off, &d32->d_off);
-        __put_user(d->d_reclen, &d32->d_reclen);
-        if (__copy_to_user(d32->d_name, d->d_name, d->d_reclen))
-		return -EFAULT;
-
-        return 0;
-}
-
-static long fat_compat_dir_ioctl(struct file *file, unsigned cmd,
+FAT_IOCTL_FILLDIR_FUNC(fat_compat_ioctl_filldir, compat_dirent)
+
+static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
 				 unsigned long arg)
 {
-	struct compat_dirent __user *p = compat_ptr(arg);
-	int ret;
-	mm_segment_t oldfs = get_fs();
-	struct dirent d[2];
+	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct compat_dirent __user *d1 = compat_ptr(arg);
+	int short_only, both;

 	switch (cmd) {
+	case VFAT_IOCTL_READDIR_SHORT32:
+		short_only = 1;
+		both = 0;
+		break;
 	case VFAT_IOCTL_READDIR_BOTH32:
-		cmd = VFAT_IOCTL_READDIR_BOTH;
-		break;
-	case VFAT_IOCTL_READDIR_SHORT32:
-		cmd = VFAT_IOCTL_READDIR_SHORT;
+		short_only = 0;
+		both = 1;
 		break;
 	default:
 		return -ENOIOCTLCMD;
 	}

-	set_fs(KERNEL_DS);
-	lock_kernel();
-	ret = fat_dir_ioctl(file->f_path.dentry->d_inode, file,
-			    cmd, (unsigned long) &d);
-	unlock_kernel();
-	set_fs(oldfs);
-	if (ret >= 0) {
-		ret |= fat_compat_put_dirent32(&d[0], p);
-		ret |= fat_compat_put_dirent32(&d[1], p + 1);
-	}
-	return ret;
+	if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2])))
+		return -EFAULT;
+	/*
+	 * Yes, we don't need this put_user() absolutely. However old
+	 * code didn't return the right value. So, app use this value,
+	 * in order to check whether it is EOF.
+	 */
+	if (put_user(0, &d1->d_reclen))
+		return -EFAULT;
+
+	return fat_ioctl_readdir(inode, filp, d1, fat_compat_ioctl_filldir,
+				 short_only, both);
 }
 #endif /* CONFIG_COMPAT */


asset-track-object: Minor doc fixing

asset-track-object: Minor doc fixing

--- ges/ges-asset-track-object.c
+++ ges/ges-asset-track-object.c
@@ -82,11 +82,9 @@
   object_class->set_property = _set_property;

   /**
-   * GESTimelineObject:supported-formats:
+   * GESTimelineObject:track-type:
    *
    * The formats supported by the object.
-   *
-   * Since: 0.10.XX
    */
   properties[PROP_TRACK_TYPE] = g_param_spec_flags ("track-type",
       "Track type", "The GESTrackType in which the object is",


Add comment explaining how queue_empty() is used.

--- gfs2-kernel/src/gfs2/glock.c
+++ gfs2-kernel/src/gfs2/glock.c
@@ -162,6 +162,13 @@
  * queue_empty - check to see if a glock's queue is empty
  * @gl: the glock
  * @head: the head of the queue to check
+ *
+ * This function protects the list in the event that a process already
+ * has a holder on the list and is adding a second holder for itself.
+ * The glmutex lock is what generally prevents processes from working
+ * on the same glock at once, but the special case of adding a second
+ * holder for yourself ("recursive" locking) doesn't involve locking
+ * glmutex, making the spin lock necessary.
  *
  * Returns: 1 if the queue is empty
  */


fixed dasher requesting processing too often

--- src/filters/dasher.c
+++ src/filters/dasher.c
@@ -7960,9 +7960,8 @@
 		dasher_send_manifest(filter, ctx, GF_FALSE);
 	}

-	//still some running streams in period
+	//still some running streams in period - do not ask for reschedule, wait for input packets to be available
 	if (count && (nb_init<count)) {
-		gf_filter_post_process_task(filter);
 		return GF_OK;
 	}


improve assert macro

improve assert macro

--- XVim/XVimTextStoring.h
+++ XVim/XVimTextStoring.h
@@ -253,11 +253,11 @@
 // The following macros asserts the range of index.
 // WITH_EOF permits the index at EOF position.
 // WITHOUT_EOF doesn't permit the index at EOF position.
-#define ASSERT_VALID_RANGE_WITH_EOF(x) NSAssert( x <= [self length] || [self length] == 0, @"index can not exceed the length of string.   TextLength:%lu   SpecifiedIndex:%lu", (long)[self length], x)
+#define ASSERT_VALID_RANGE_WITH_EOF(x) NSAssert( x <= [self length] || [self length] == 0, @"index can not exceed the length of string.   TextLength:%lu   SpecifiedIndex:%lu [%s:%d]", (long)[self length], x, __FILE__, __LINE__)

 // Some methods assume that "index" is at valid cursor position in Normal mode.
 // See isValidCursorPosition's description the condition of the valid cursor position.
-#define ASSERT_VALID_CURSOR_POS(x) NSAssert( [self isValidCursorPosition:x], @"index can not be invalid cursor position" )
+#define ASSERT_VALID_CURSOR_POS(x) NSAssert( [self isValidCursorPosition:x], @"index can not be invalid cursor position [%s:%d]", __FILE__, __LINE__ )
 #else
 #define ASSERT_VALID_RANGE_WITH_EOF(x)
 #define ASSERT_VALID_CURSOR_POS(x)


kernel: dont print message on user page faults

Signed-off-by: Kornilios Kourtis <1e81023a227210c1e97dcf9b05e0a7ed7690d302@inf.ethz.ch>

--- kernel/arch/x86_64/irq.c
+++ kernel/arch/x86_64/irq.c
@@ -782,7 +782,6 @@
     struct dispatcher_shared_generic *disp =
         get_dispatcher_shared_generic(handle);
     uint64_t rip = cpu_save_area[X86_SAVE_RIP];
-    uint64_t rsp = cpu_save_area[X86_SAVE_RSP];
     lvaddr_t fault_address, handler = 0, param = 0;

     assert(vec < NEXCEPTIONS);
@@ -829,10 +828,13 @@
         __asm volatile("mov %%cr2, %[fault_address]"
                        : [fault_address] "=r" (fault_address));

+        #if 0
+        uint64_t rsp = cpu_save_area[X86_SAVE_RSP];
         printk(LOG_WARN, "user page fault%s in '%.*s': addr %lx IP %lx SP %lx "
                          "error 0x%lx\n",
                disabled ? " WHILE DISABLED" : "", DISP_NAME_LEN,
                disp->name, fault_address, rip, rsp, error);
+        #endif

         /* sanity-check that the trap handler saved in the right place */
         assert((disabled && disp_save_area == dispatcher_get_trap_save_area(handle))


x86_64/irq.c: print SP on page fault error message

--- kernel/arch/x86_64/irq.c
+++ kernel/arch/x86_64/irq.c
@@ -625,6 +625,7 @@
     struct dispatcher_shared_generic *disp =
         get_dispatcher_shared_generic(handle);
     uint64_t rip = cpu_save_area[X86_SAVE_RIP];
+    uint64_t rsp = cpu_save_area[X86_SAVE_RSP];
     lvaddr_t fault_address, handler = 0, param = 0;

     assert(vec < NEXCEPTIONS);
@@ -671,9 +672,10 @@
         __asm volatile("mov %%cr2, %[fault_address]"
                        : [fault_address] "=r" (fault_address));

-        printk(LOG_WARN, "user page fault%s in '%.*s': addr %lx IP %lx, error 0x%lx\n",
+        printk(LOG_WARN, "user page fault%s in '%.*s': addr %lx IP %lx SP %lx "
+                         "error 0x%lx\n",
                disabled ? " WHILE DISABLED" : "", DISP_NAME_LEN,
-               disp->name, fault_address, rip, error);
+               disp->name, fault_address, rip, rsp, error);

         /* sanity-check that the trap handler saved in the right place */
         assert((disabled && disp_save_area == dispatcher_get_trap_save_area(handle))


added name string to vfs struct

added name string to vfs struct

--- kernel/include/vfs/vfs.h
+++ kernel/include/vfs/vfs.h
@@ -65,6 +65,7 @@

 typedef struct file_driver {
 	void 	*driver;
+	char 	*name;

 	file_create_fs 	*create;
 	file_remove_fs 	*remove;


using madd in linei.h for time interpolation

--- kernels/geometry/linei.h
+++ kernels/geometry/linei.h
@@ -248,8 +248,8 @@
     gather(a0,a1,geom0,geom1,geom2,geom3,itime);
     Vec4vf4 b0,b1;
     gather(b0,b1,geom0,geom1,geom2,geom3,itime+1);
-    p0 = t0 * a0 + t1 * b0;
-    p1 = t0 * a1 + t1 * b1;
+    p0 = madd(Vec4vf4(t0),a0,t1*b0);
+    p1 = madd(Vec4vf4(t0),a1,t1*b1);
   }

   template<int M>


[project @ 1999-01-29 13:52:09 by simonm] A couple of underscore got lost a long time ago.

--- ghc/lib/misc/cbits/ByteOps.c
+++ ghc/lib/misc/cbits/ByteOps.c
@@ -26,7 +26,7 @@
     /* need the ANSI arg decl, so "short" and "float" args dont get promoted */
 #define X2BYTES(type)				\
 I_						\
-type##2bytes(type in, unsigned char *arr)	\
+type##2bytes__(type in, unsigned char *arr)	\
 { 						\
     union {					\
 	type i;					\
@@ -44,7 +44,7 @@
 #else /* not STDC */
 #define X2BYTES(type)				\
 I_						\
-type##2bytes(type in, unsigned char *arr)	\
+type##2bytes__(type in, unsigned char *arr)	\
 { 						\
     union {					\
 	type i;					\


[project @ 2001-08-15 09:23:25 by rrt] Fake argc & argv

--- ghc/lib/std/cbits/ilxstubs.c
+++ ghc/lib/std/cbits/ilxstubs.c
@@ -1,7 +1,7 @@
 /*
  * (c) The GHC Team 2001
  *
- * $Id: ilxstubs.c,v 1.2 2001/07/16 09:23:24 rrt Exp $
+ * $Id: ilxstubs.c,v 1.3 2001/08/15 09:23:25 rrt Exp $
  *
  * ILX stubs for external function calls
  */
@@ -29,13 +29,26 @@
     /* StgPrimFloat Add to mini-RTS, which is put in a DLL */

     /* Need to be implemented in ILX RTS */
-     /*foreign label "prog_argv" prog_argv_label :: Ptr (Ptr (Ptr CChar))
-foreign label "prog_argc" prog_argc_label :: Ptr CInt
-foreign label "ErrorHdrHook" errorHdrHook :: Ptr ()
-../PrelStable.lhs:37:foreign import unsafe freeStablePtr :: StablePtr a -> IO ()
+/*../PrelStable.lhs:37:foreign import unsafe freeStablePtr :: StablePtr a -> IO ()
 ../PrelTopHandler.lhs:49:foreign import ccall "shutdownHaskellAndExit"
 ../PrelTopHandler.lhs:77:foreign import ccall "stackOverflow" unsafe
 ../PrelTopHandler.lhs:80:foreign import ccall "stg_exit" unsafe */
+
+/* Fake this for now, as a DLL can't refer to main() */
+int argc = 0;
+char **argv = NULL;
+
+int
+prog_argc_addr(void)
+{
+  return &argc;
+}
+
+char ***
+prog_argv_addr(void)
+{
+  return &argv;
+}

 void
 stg_exit(I_ n)


inotify: Add missing commas

inotify: Add missing commas

These were accidentally omitted from commit
748bb24985419d54812f31f549e042dad8619084. My fault.

Signed-off-by: Philip Withnall <29c2a2ac2a854b9cf047275aa9de346d096be2e0@endlessm.com>

--- gio/inotify/inotify-helper.c
+++ gio/inotify/inotify-helper.c
@@ -196,7 +196,7 @@
            * only ever having a single bit set (apart from IN_ISDIR) is false.
            * The kernel documentation is lacking here. */
           g_assert (event_flags != -1);
-          interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags
+          interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags,
                                                             event->name, NULL, other, event->timestamp);

           if (other)
@@ -205,7 +205,7 @@
     }
   else if (event_flags != -1)
     /* unpaired event -- no 'other' field */
-    interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags
+    interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags,
                                                       event->name, NULL, NULL, event->timestamp);

   if (event->mask & IN_CREATE)


GetPot: print to any ostream, not just cout

git-svn-id: e88a1e38e13faf406e05cc89eca8dd613216f6c4@3632 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf

--- trunk/libmesh/include/base/getpot.h
+++ trunk/libmesh/include/base/getpot.h
@@ -198,7 +198,7 @@
     inline STRING_VECTOR   unidentified_nominuses() const;

     // (*) output --------------------------------------------------------------
-    inline int print() const;
+    inline int print(std::ostream &out_stream = std::cout) const;

 private:
     // (*) Type Declaration ----------------------------------------------------
@@ -1395,13 +1395,13 @@
 //.............................................................................
 //
 inline int
-GetPot::print() const
-{
-    std::cout << "argc = " << argv.size() << std::endl;
+GetPot::print(std::ostream &out_stream) const
+{
+    out_stream << "argc = " << argv.size() << std::endl;
     STRING_VECTOR::const_iterator it = argv.begin();
     for(; it != argv.end(); it++)
-	std::cout << *it << std::endl;
-    std::cout << std::endl;
+	out_stream << *it << std::endl;
+    out_stream << std::endl;
     return 1;
 }


Fix a typo attach->detach

Fix a typo attach->detach

git-svn-id: 8d82213adbbc6b1538a984bace977d31fcb31691@241 2f5d681c-ba19-11dd-a503-ed2d4bea8bb5

--- trunk/src/lib/tapcfg_unix_solaris.h
+++ trunk/src/lib/tapcfg_unix_solaris.h
@@ -320,7 +320,7 @@
 	ip_fd = tapcfg->ip_fd;
 	ip6_fd = tapcfg->ip6_fd;

-	if (dlpi_attach(tapcfg->tap_fd)) {
+	if (dlpi_detach(tapcfg->tap_fd)) {
 		taplog_log(TAPLOG_ERR,
 		           "Couldn't detach PPA from the DLPI interface: %s\n",
 		           strerror(errno));


nodedev: Increase the netlink socket buffer size to the one used by udev

When a number of SRIOV VFs (up to 128 on Intel XL710) is created:
for i in `seq 0 1`; do
  echo 63 > /sys/class/net/<interface>/device/sriov_numvfs
done

libvirtd will then report "udev_monitor_receive_device returned NULL"
error because the netlink socket buffer is not big enough (using GDB on
libudev confirmed this with ENOBUFFS) and thus some udev events were
dropped. This results in some devices being missing in the nodedev-list
output. This patch overrides the system's rmem_max limit but for that,
we need to make sure we've got root privileges.

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

Signed-off-by: ning.bo <2d31d0a1306df9728d482e6b1c1ff9b6813ccc6f@zte.com.cn>
Signed-off-by: Erik Skultety <2c14d38fa47c8799f1b9c16280abe27f8edfec6e@redhat.com>

--- src/node_device/node_device_udev.c
+++ src/node_device/node_device_udev.c
@@ -1764,6 +1764,13 @@

     udev_monitor_enable_receiving(priv->udev_monitor);

+    /* mimic udevd's behaviour and override the systems rmem_max limit in case
+     * there's a significant number of device 'add' events
+     */
+    if (geteuid() == 0)
+        udev_monitor_set_receive_buffer_size(priv->udev_monitor,
+                                             128 * 1024 * 1024);
+
     /* We register the monitor with the event callback so we are
      * notified by udev of device changes before we enumerate existing
      * devices because libvirt will simply recreate the device if we


perfs: W-LSB: constify f() functions

perfs: W-LSB: constify f() functions

--- src/common/interval.h
+++ src/common/interval.h
@@ -133,17 +133,17 @@
 struct rohc_interval8 rohc_f_8bits(const uint8_t v_ref,
                                    const size_t k,
                                    const rohc_lsb_shift_t p)
-	__attribute__((warn_unused_result));
+	__attribute__((warn_unused_result, const));

 struct rohc_interval16 rohc_f_16bits(const uint16_t v_ref,
                                      const size_t k,
                                      const rohc_lsb_shift_t p)
-	__attribute__((warn_unused_result));
+	__attribute__((warn_unused_result, const));

 struct rohc_interval32 rohc_f_32bits(const uint32_t v_ref,
                                      const size_t k,
                                      const rohc_lsb_shift_t p)
-	__attribute__((warn_unused_result));
+	__attribute__((warn_unused_result, const));

 /**


rohc_buf: introduce new macro rohc_buf_byte() for getting next byte in the buffer

--- src/common/rohc_buf.h
+++ src/common/rohc_buf.h
@@ -182,6 +182,19 @@
 	((__buf).data)[(__buf).offset + (__offset)]

+/**
+ * @brief Get the next byte in the given network buffer
+ *
+ * @param __buf  The network buffer to get the next byte from
+ * @return       The next byte stored in the network buffer
+ *
+ * @ingroup rohc
+ */
+#define rohc_buf_byte(__buf) \
+	rohc_buf_byte_at((__buf), 0)
+
+
+
 bool rohc_buf_is_malformed(const struct rohc_buf buf)
 	__attribute__((warn_unused_result));


Quit the replug loop on idle

Quit the replug loop on idle

If we wait for the child of a composite device to reappear and *then* go on to
update the replugged parent in the same transaction then we still use the old
GUsbDevice as the add event is still pending when we quit the replug loop.

Just schedule an idle action to quit the loop to allow the child *and* parent
to be added on replug.

Fixes https://github.com/fwupd/fwupd/issues/2376

--- src/fu-device-list.c
+++ src/fu-device-list.c
@@ -567,6 +567,15 @@
 	g_set_object (&item->device, device);
 }

+static gboolean
+fu_device_list_replug_loop_quit_cb (gpointer user_data)
+{
+	FuDeviceList *self = FU_DEVICE_LIST (user_data);
+	g_debug ("quitting replug loop");
+	g_main_loop_quit (self->replug_loop);
+	return G_SOURCE_REMOVE;
+}
+
 static void
 fu_device_list_replace (FuDeviceList *self, FuDeviceItem *item, FuDevice *device)
 {
@@ -644,9 +653,9 @@
 	/* we were waiting for this... */
 	if (fu_device_has_flag (item->device_old, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG) &&
 	    g_main_loop_is_running (self->replug_loop)) {
-		g_debug ("quitting replug loop");
+		g_debug ("schedule quit replug loop in idle");
 		fu_device_remove_flag (item->device_old, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG);
-		g_main_loop_quit (self->replug_loop);
+		g_idle_add (fu_device_list_replug_loop_quit_cb, self);
 	}
 }


add spec for dja_to_json()

add spec for dja_to_json()

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

--- spec/to_x_spec.c
+++ spec/to_x_spec.c
@@ -0,0 +1,33 @@
+
+//
+// specifying djan
+//
+// Thu Oct  2 20:54:34 JST 2014
+//
+
+#include "djan.h"
+
+
+context "fdja_value"
+{
+  before each
+  {
+    fdja_value *v = NULL;
+  }
+  after each
+  {
+    if (v != NULL) fdja_value_free(v);
+  }
+
+  describe "fdja_to_json()"
+  {
+    it "turns a fdja_value to a json string"
+    {
+      v = fdja_v("{ type: car, make: mitsubishi, id: 2 }");
+
+      expect(fdja_to_json(v) ===f ""
+        "{\"type\":\"car\",\"make\":\"mitsubishi\",\"id\":2}");
+    }
+  }
+}
+


agg-2.4.tar.gz-noarch-fixpathstoragewarning.diff [JoeB]

--- deps/agg/include/agg_path_storage.h
+++ deps/agg/include/agg_path_storage.h
@@ -736,7 +736,7 @@
         template<class VertexSource>
         void join_path(VertexSource& vs, unsigned path_id = 0)
         {
-            double x, y;
+            double x=0.0, y=0.0;
             unsigned cmd;
             vs.rewind(path_id);
             cmd = vs.vertex(&x, &y);


Add non-unique version of zstd thread pool for freshness

error: pathspec 'tests/regression/06-symbeq/35-zstd-thread-pool-multi.c' did not match any file(s) known to git

--- tests/regression/06-symbeq/35-zstd-thread-pool-multi.c
+++ tests/regression/06-symbeq/35-zstd-thread-pool-multi.c
@@ -0,0 +1,265 @@
+// PARAM: --set ana.activated[+] symb_locks --set ana.activated[+] mallocFresh
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (c) Facebook, Inc.
+ * All rights reserved.
+ *
+ * This code is a challenging example for race detection extracted from zstd.
+ * Copyright (c) The Goblint Contributors
+ */
+
+#include<stdlib.h>
+#include<pthread.h>
+#define ZSTD_pthread_mutex_t            pthread_mutex_t
+#define ZSTD_pthread_mutex_init(a, b)   pthread_mutex_init((a), (b))
+#define ZSTD_pthread_mutex_destroy(a)   pthread_mutex_destroy((a))
+#define ZSTD_pthread_mutex_lock(a)      pthread_mutex_lock((a))
+#define ZSTD_pthread_mutex_unlock(a)    pthread_mutex_unlock((a))
+
+#define ZSTD_pthread_cond_t             pthread_cond_t
+#define ZSTD_pthread_cond_init(a, b)    pthread_cond_init((a), (b))
+#define ZSTD_pthread_cond_destroy(a)    pthread_cond_destroy((a))
+#define ZSTD_pthread_cond_wait(a, b)    pthread_cond_wait((a), (b))
+#define ZSTD_pthread_cond_signal(a)     pthread_cond_signal((a))
+#define ZSTD_pthread_cond_broadcast(a)  pthread_cond_broadcast((a))
+
+#define ZSTD_pthread_t                  pthread_t
+#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))
+#define ZSTD_pthread_join(a, b)         pthread_join((a),(b))
+
+#define ZSTD_malloc(s) malloc(s)
+#define ZSTD_calloc(n,s) calloc((n), (s))
+#define ZSTD_free(p) free((p))
+#define ZSTD_memset(d,s,n) __builtin_memset((d),(s),(n))
+
+typedef struct POOL_ctx_s POOL_ctx;
+
+typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
+typedef void  (*ZSTD_freeFunction) (void* opaque, void* address);
+typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
+typedef struct POOL_ctx_s ZSTD_threadPool;
+
+
+void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
+{
+    if (customMem.customAlloc)
+        return customMem.customAlloc(customMem.opaque, size);
+    return ZSTD_malloc(size);
+}
+
+void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
+{
+    if (customMem.customAlloc) {
+        /* calloc implemented as malloc+memset;
+         * not as efficient as calloc, but next best guess for custom malloc */
+        void* const ptr = customMem.customAlloc(customMem.opaque, size);
+        ZSTD_memset(ptr, 0, size);
+        return ptr;
+    }
+    return ZSTD_calloc(1, size);
+}
+
+void ZSTD_customFree(void* ptr, ZSTD_customMem customMem)
+{
+    if (ptr!=NULL) {
+        if (customMem.customFree)
+            customMem.customFree(customMem.opaque, ptr);
+        else
+            ZSTD_free(ptr);
+    }
+}
+
+
+
+/*! POOL_create() :
+ *  Create a thread pool with at most `numThreads` threads.
+ * `numThreads` must be at least 1.
+ *  The maximum number of queued jobs before blocking is `queueSize`.
+ * @return : POOL_ctx pointer on success, else NULL.
+*/
+POOL_ctx* POOL_create(size_t numThreads, size_t queueSize);
+
+POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, ZSTD_customMem customMem);
+
+/*! POOL_free() :
+ *  Free a thread pool returned by POOL_create().
+ */
+void POOL_free(POOL_ctx* ctx);
+
+
+/*! POOL_function :
+ *  The function type that can be added to a thread pool.
+ */
+typedef void (*POOL_function)(void*);
+
+
+static
+#ifdef __GNUC__
+__attribute__((__unused__))
+#endif
+ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL };  /**< this constant defers to stdlib's functions */
+
+
+/* A job is a function and an opaque argument */
+typedef struct POOL_job_s {
+    POOL_function function;
+    void *opaque;
+} POOL_job;
+
+struct POOL_ctx_s {
+    ZSTD_customMem customMem;
+    /* Keep track of the threads */
+    ZSTD_pthread_t* threads;
+    size_t threadCapacity;
+    size_t threadLimit;
+
+    /* The queue is a circular buffer */
+    POOL_job *queue;
+    size_t queueHead;
+    size_t queueTail;
+    size_t queueSize;
+
+    /* The number of threads working on jobs */
+    size_t numThreadsBusy;
+    /* Indicates if the queue is empty */
+    int queueEmpty;
+
+    /* The mutex protects the queue */
+    ZSTD_pthread_mutex_t queueMutex;
+    /* Condition variable for pushers to wait on when the queue is full */
+    ZSTD_pthread_cond_t queuePushCond;
+    /* Condition variables for poppers to wait on when the queue is empty */
+    ZSTD_pthread_cond_t queuePopCond;
+    /* Indicates if the queue is shutting down */
+    int shutdown;
+};
+
+/* POOL_thread() :
+ * Work thread for the thread pool.
+ * Waits for jobs and executes them.
+ * @returns : NULL on failure else non-null.
+ */
+static void* POOL_thread(void* opaque) {
+    POOL_ctx* const ctx = (POOL_ctx*)opaque;
+    if (!ctx) { return NULL; }
+    for (;;) {
+        /* Lock the mutex and wait for a non-empty queue or until shutdown */
+        ZSTD_pthread_mutex_lock(&ctx->queueMutex);
+
+        while ( ctx->queueEmpty // RACE! (threadLimit)
+            || (ctx->numThreadsBusy >= ctx->threadLimit) ) {
+            if (ctx->shutdown) {
+                /* even if !queueEmpty, (possible if numThreadsBusy >= threadLimit),
+                 * a few threads will be shutdown while !queueEmpty,
+                 * but enough threads will remain active to finish the queue */
+                ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
+                return opaque;
+            }
+            ZSTD_pthread_cond_wait(&ctx->queuePopCond, &ctx->queueMutex);
+        }
+        /* Pop a job off the queue */
+        {   POOL_job const job = ctx->queue[ctx->queueHead]; //NORACE
+            ctx->queueHead = (ctx->queueHead + 1) % ctx->queueSize; //NORACE
+            ctx->numThreadsBusy++; //NORACE
+            ctx->queueEmpty = (ctx->queueHead == ctx->queueTail); //NORACE
+            /* Unlock the mutex, signal a pusher, and run the job */
+            ZSTD_pthread_cond_signal(&ctx->queuePushCond);
+            ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
+
+            job.function(job.opaque);
+
+            /* If the intended queue size was 0, signal after finishing job */
+            ZSTD_pthread_mutex_lock(&ctx->queueMutex);
+            ctx->numThreadsBusy--; //NORACE
+            ZSTD_pthread_cond_signal(&ctx->queuePushCond);
+            ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
+        }
+    }  /* for (;;) */
+    assert(0);  //NOWARN (unreachable)
+}
+
+POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) {
+    return POOL_create_advanced(numThreads, queueSize, ZSTD_defaultCMem);
+}
+
+POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize,
+                               ZSTD_customMem customMem)
+{
+    POOL_ctx* ctx;
+    /* Check parameters */
+    if (!numThreads) { return NULL; }
+    /* Allocate the context and zero initialize */
+    ctx = (POOL_ctx*)ZSTD_customCalloc(sizeof(POOL_ctx), customMem);
+    if (!ctx) { return NULL; }
+    /* Initialize the job queue.
+     * It needs one extra space since one space is wasted to differentiate
+     * empty and full queues.
+     */
+    ctx->queueSize = queueSize + 1; // NORACE
+    ctx->queue = (POOL_job*)ZSTD_customMalloc(ctx->queueSize * sizeof(POOL_job), customMem); // NORACE
+    ctx->queueHead = 0; // NORACE
+    ctx->queueTail = 0; // NORACE
+    ctx->numThreadsBusy = 0; // NORACE
+    ctx->queueEmpty = 1; // NORACE
+    {
+        int error = 0;
+        error |= ZSTD_pthread_mutex_init(&ctx->queueMutex, NULL); // NORACE
+        error |= ZSTD_pthread_cond_init(&ctx->queuePushCond, NULL); // NORACE
+        error |= ZSTD_pthread_cond_init(&ctx->queuePopCond, NULL); // NORACE
+        if (error) { POOL_free(ctx); return NULL; }
+    }
+    ctx->shutdown = 0; // NORACE
+    /* Allocate space for the thread handles */
+    ctx->threads = (ZSTD_pthread_t*)ZSTD_customMalloc(numThreads * sizeof(ZSTD_pthread_t), customMem); // NORACE
+    ctx->threadCapacity = 0; // NORACE
+    ctx->customMem = customMem; // NORACE
+    /* Check for errors */
+    if (!ctx->threads || !ctx->queue) { POOL_free(ctx); return NULL; } // NORACE
+    /* Initialize the threads */
+    {   size_t i;
+        for (i = 0; i < numThreads; ++i) {
+            if (ZSTD_pthread_create(&ctx->threads[i], NULL, &POOL_thread, ctx)) {
+                ctx->threadCapacity = i;
+                POOL_free(ctx);
+                return NULL;
+        }   }
+        ctx->threadCapacity = numThreads;
+        ctx->threadLimit = numThreads; // RACE!
+    }
+    return ctx;
+}
+
+/*! POOL_join() :
+    Shutdown the queue, wake any sleeping threads, and join all of the threads.
+*/
+static void POOL_join(POOL_ctx* ctx) {
+    /* Shut down the queue */
+    ZSTD_pthread_mutex_lock(&ctx->queueMutex);
+    ctx->shutdown = 1; //NORACE
+    ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
+    /* Wake up sleeping threads */
+    ZSTD_pthread_cond_broadcast(&ctx->queuePushCond);
+    ZSTD_pthread_cond_broadcast(&ctx->queuePopCond);
+    /* Join all of the threads */
+    {   size_t i;
+        for (i = 0; i < ctx->threadCapacity; ++i) {
+            ZSTD_pthread_join(ctx->threads[i], NULL);  /* note : could fail */
+    }   }
+}
+
+void POOL_free(POOL_ctx *ctx) {
+    if (!ctx) { return; }
+    POOL_join(ctx);
+    ZSTD_pthread_mutex_destroy(&ctx->queueMutex);
+    ZSTD_pthread_cond_destroy(&ctx->queuePushCond);
+    ZSTD_pthread_cond_destroy(&ctx->queuePopCond);
+    ZSTD_customFree(ctx->queue, ctx->customMem);
+    ZSTD_customFree(ctx->threads, ctx->customMem);
+    ZSTD_customFree(ctx, ctx->customMem);
+}
+
+int main() {
+    while (1) {
+        POOL_ctx* const ctx = POOL_create(20, 10);
+    }
+}


Fixed a bug in the tensor type converter

--- unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h
+++ unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h
@@ -124,9 +124,12 @@
       return internal::pcast<SrcPacket, TgtPacket>(m_impl.template packet<Unaligned>(index));
     } else {
       const int TgtPacketSize = internal::unpacket_traits<TgtPacket>::size;
+      typedef typename internal::unpacket_traits<SrcPacket>::type SrcType;
+      typedef typename internal::unpacket_traits<TgtPacket>::type TgtType;
+      internal::scalar_cast_op<SrcType, TgtType> converter;
       EIGEN_ALIGN_MAX typename internal::unpacket_traits<TgtPacket>::type values[TgtPacketSize];
       for (int i = 0; i < TgtPacketSize; ++i) {
-        values[i] = m_impl.coeff(index+i);
+        values[i] = converter(m_impl.coeff(index+i));
       }
       TgtPacket rslt = internal::pload<TgtPacket>(values);
       return rslt;


opendp rm unused Opendp::edge_spacing_;

opendp rm unused Opendp::edge_spacing_;

--- src/opendp/include/opendp/Opendp.h
+++ src/opendp/include/opendp/Opendp.h
@@ -266,8 +266,6 @@

   std::map< dbMaster*, Macro > db_master_map_;
   std::map< dbInst*, Cell* > db_inst_map_;
-  /* spacing between edges  1 to 1 , 1 to 2, 2 to 2 */
-  std::map< std::pair< int, int >, double > edge_spacing_;

   adsRect core_;
   power initial_power_;


Write back to GBAThread.audioBuffers if not previously initialized

--- src/gba/gba-thread.c
+++ src/gba/gba-thread.c
@@ -126,6 +126,8 @@

 	if (threadContext->audioBuffers) {
 		GBAAudioResizeBuffer(&gba.audio, threadContext->audioBuffers);
+	} else {
+		threadContext->audioBuffers = GBA_AUDIO_SAMPLES;
 	}

 	if (threadContext->renderer) {


balanced tree

balanced tree

error: pathspec 'LeetCode/remote/balanced.c' did not match any file(s) known to git

--- LeetCode/remote/balanced.c
+++ LeetCode/remote/balanced.c
@@ -0,0 +1,34 @@
+// https://leetcode.com/submissions/detail/34298404/
+
+
+/**
+ * Definition for a binary tree node.
+ * struct TreeNode {
+ *     int val;
+ *     struct TreeNode *left;
+ *     struct TreeNode *right;
+ * };
+ */
+
+bool isBalanced(struct TreeNode* root) {
+    return balanced(root) != -1;
+}
+
+int balanced(struct TreeNode* root) {
+    if (root == NULL) {
+        return 0;
+    }
+
+    int left = balanced(root->left);
+    int right = balanced(root->right);
+
+    if (left == -1 || right == -1 || abs(left - right) > 1) {
+        return -1;
+    }
+
+    if (left > right) {
+        return left + 1;
+    }
+
+    return right + 1;
+}


补上字符串结束符，避免读到错误数据

补上字符串结束符，避免读到错误数据

--- src/gui/css_parser.c
+++ src/gui/css_parser.c
@@ -764,6 +764,7 @@
 /** 从文件中载入CSS样式数据，并导入至样式库中 */
 int LCUI_LoadCSSFile( const char *filepath )
 {
+	int n;
 	FILE *fp;
 	char buff[512];
 	ParserContextPtr ctx;
@@ -773,7 +774,8 @@
 		return -1;
 	}
 	ctx = NewParserContext( 512 );
-	while( fread( buff, 1, 512, fp ) ) {
+	while( n = fread( buff, 1, 511, fp ) ) {
+		buff[n] = 0;
 		LCUI_LoadCSSBlock( ctx, buff );
 	}
 	DeleteParserContext( &ctx );


more doc

more doc

--- mbed-client/m2minterfaceobserver.h
+++ mbed-client/m2minterfaceobserver.h
@@ -34,7 +34,7 @@
 public:

     /**
-     * @brief Callback informing that the bootstap has been done successfully.
+     * @brief Callback indicating that the bootstap has been done successfully.
      * @param server_object Server object that contains information fetched
      * about the LWM2M server from the bootstrap server. This object can be used
      * to register to the LWM2M server. The object ownership is passed.
@@ -42,7 +42,7 @@
     virtual void bootstrap_done(M2MSecurity *server_object) = 0;

     /**
-     * @brief Callback informing that the device object has been registered
+     * @brief Callback indicating that the device object has been registered
      * successfully to the LWM2M server.
      * @param security_object Server object on which the device object is
      * registered. The object ownership is passed.
@@ -52,16 +52,16 @@
     virtual void object_registered(M2MSecurity *security_object, const M2MServer &server_object) = 0;

     /**
-     * @brief Callback informing that the device object has been unregistered
-     * successfully from the LWM2M server.
+     * @brief Callback indicating that the device object has been successfully unregistered
+     * from the LWM2M server.
      * @param server_object Server object from which the device object is
      * unregistered. The object ownership is passed.
      */
     virtual void object_unregistered(M2MSecurity *server_object) = 0;

     /**
-     * @brief Callback informing that the device object registration has been
-     * updated successfully on the LWM2M server.
+     * @brief Callback indicating that the device object registration has been successfully
+     * updated on the LWM2M server.
      * @param security_object Server object on which the device object registration
      * updated. The object ownership is passed.
      * @param server_object, Object containing information about the LWM2M server.
@@ -70,13 +70,13 @@
     virtual void registration_updated(M2MSecurity *security_object, const M2MServer & server_object) = 0;

     /**
-     * @brief Callback informing that there is some error during the operation.
+     * @brief Callback indicating that there is an error during the operation.
      * @param error Error code informing about the error that occured.
      */
     virtual void error(M2MInterface::Error error) = 0;

     /**
-     * @brief Callback informing that the value of the resource object is updated by the server.
+     * @brief Callback indicating that the value of the resource object is updated by the server.
      * @param base Object whose value is updated.
      * @param type Type of object.
      */


Issue #114 fixed plib.h issues

Issue #114 fixed plib.h issues

Former-commit-id: 8ab249f1ac2442c2c470fabe054a20c65c602404


Avoid sqrt of negative with label is bigger than fixed size

--- lib/common/shapes.c
+++ lib/common/shapes.c
@@ -891,7 +891,7 @@
     }

     /* Compute space available for label.  Provides the justification borders */
-    if (!mapbool(late_string(n, N_nojustify, "false"))) {
+    if (!mapbool(late_string(n, N_nojustify, "false")) && (dimen.y < bb.y)) {
 	if (isBox)
 	    temp = bb.x;
 	else


define SEAICE_ZETA_SMOOTHREG for smoother convergence and hopefully better agreement between compilers for JFNK; changes results of dynamical solvers

--- verification/offline_exf_seaice/code/SEAICE_OPTIONS.h
+++ verification/offline_exf_seaice/code/SEAICE_OPTIONS.h
@@ -95,7 +95,7 @@
 C     regularize zeta to zmax with a smooth tanh-function instead
 C     of a min(zeta,zmax). This improves convergence of iterative
 C     solvers (Lemieux and Tremblay 2009, JGR). No effect on EVP
-# undef SEAICE_ZETA_SMOOTHREG
+# define SEAICE_ZETA_SMOOTHREG
 C     allow the truncated ellipse rheology (runtime flag SEAICEuseTEM)
 # undef SEAICE_ALLOW_TEM
 #else /* not SEAICE_CGRID, but old B-grid */


Fix: shape coordinates close to 0 now absolutely 0

Check wether the values are close to zero by checking if it lies between
-0.00001 and 0.00001. If this is the case, set the value to 0. This prevents
coordinates like 7.10543e-15, that are differ by platform.

--- lib/common/shapes.c
+++ lib/common/shapes.c
@@ -2888,7 +2888,18 @@
 	for (i = 0; i < sides; i++) {
 	    P = vertices[i + j * sides];
 	    AF[i].x = P.x * xsize + ND_coord(n).x;
-	    AF[i].y = P.y * ysize + ND_coord(n).y;
+        AF[i].y = P.y * ysize + ND_coord(n).y;
+
+        // Set values that are close to zero, to absolute zero.
+        // This prevents cordinates like 7.10543e-15
+        if (AF[i].x > -0.00001 && AF[i].x < 0.00001)
+        {
+            AF[i].x = 0;
+        }
+        if (AF[i].y > -0.00001 && AF[i].y < 0.00001)
+        {
+            AF[i].y = 0;
+        }
 	}
 	if (sides <= 2) {
 	    if ((style & WEDGED) && (j == 0) && multicolor(fillcolor)) {


define SEAICE_PRECOND_EXTRA_EXCHANGE to reproduce old results

--- verification/offline_exf_seaice/code/SEAICE_OPTIONS.h
+++ verification/offline_exf_seaice/code/SEAICE_OPTIONS.h
@@ -74,6 +74,8 @@
 #ifdef SEAICE_CGRID
 C     enable JFNK code by defining the following flag
 # define SEAICE_ALLOW_JFNK
+C     enable this flag to reproduce old verification results for JFNK
+# define SEAICE_PRECOND_EXTRA_EXCHANGE
 C     enable LSR to use global (multi-tile) tri-diagonal solver
 # define SEAICE_GLOBAL_3DIAG_SOLVER
 C     enable EVP code by defining the following flag


handle case where both `ptls` and `ossl` are NULL (happens when the connection gets closed without receiving anything)

--- lib/common/socket.c
+++ lib/common/socket.c
@@ -368,9 +368,11 @@
         ret = 1; /* close the socket after sending close_notify */
     } else
 #endif
-    {
+    if (sock->ssl->ossl != NULL) {
         if ((ret = SSL_shutdown(sock->ssl->ossl)) == -1)
             goto Close;
+    } else {
+        goto Close;
     }

     if (sock->ssl->output.bufs.size != 0) {
@@ -733,80 +735,83 @@

 const char *h2o_socket_get_ssl_protocol_version(h2o_socket_t *sock)
 {
-    if (sock->ssl == NULL)
-        return NULL;
+    if (sock->ssl != NULL) {
 #if H2O_USE_PICOTLS
-    if (sock->ssl->ptls != NULL)
-        return "TLSv1.3";
-#endif
-    return SSL_get_version(sock->ssl->ossl);
+        if (sock->ssl->ptls != NULL)
+            return "TLSv1.3";
+#endif
+        if (sock->ssl->ossl != NULL)
+            return SSL_get_version(sock->ssl->ossl);
+    }
+    return NULL;
 }

 int h2o_socket_get_ssl_session_reused(h2o_socket_t *sock)
 {
-    if (sock->ssl == NULL)
-        return -1;
+    if (sock->ssl != NULL) {
 #if H2O_USE_PICOTLS
-    if (sock->ssl->ptls != NULL)
-        return ptls_is_psk_handshake(sock->ssl->ptls);
-#endif
-    return (int)SSL_session_reused(sock->ssl->ossl);
+        if (sock->ssl->ptls != NULL)
+            return ptls_is_psk_handshake(sock->ssl->ptls);
+#endif
+        if (sock->ssl->ossl != NULL)
+            return (int)SSL_session_reused(sock->ssl->ossl);
+    }
+    return -1;
 }

 const char *h2o_socket_get_ssl_cipher(h2o_socket_t *sock)
 {
-    if (sock->ssl == NULL)
-        return NULL;
+    if (sock->ssl != NULL) {
 #if H2O_USE_PICOTLS
-    if (sock->ssl->ptls != NULL) {
-        ptls_cipher_suite_t *cipher = ptls_get_cipher(sock->ssl->ptls);
-        if (cipher == NULL)
-            return NULL;
-        return cipher->aead->name;
-    }
-#endif
-    return SSL_get_cipher_name(sock->ssl->ossl);
+        if (sock->ssl->ptls != NULL) {
+            ptls_cipher_suite_t *cipher = ptls_get_cipher(sock->ssl->ptls);
+            if (cipher != NULL)
+                return cipher->aead->name;
+        } else
+#endif
+        if (sock->ssl->ossl != NULL)
+            return SSL_get_cipher_name(sock->ssl->ossl);
+    }
+    return NULL;
 }

 int h2o_socket_get_ssl_cipher_bits(h2o_socket_t *sock)
 {
-    if (sock->ssl == NULL)
-        return 0;
+    if (sock->ssl != NULL) {
 #if H2O_USE_PICOTLS
-    if (sock->ssl->ptls != NULL) {
-        ptls_cipher_suite_t *cipher = ptls_get_cipher(sock->ssl->ptls);
-        if (cipher == NULL)
-            return 0;
-        return (int)cipher->aead->key_size;
-    }
-#endif
-    return SSL_get_cipher_bits(sock->ssl->ossl, NULL);
+        if (sock->ssl->ptls != NULL) {
+            ptls_cipher_suite_t *cipher = ptls_get_cipher(sock->ssl->ptls);
+            if (cipher != NULL)
+                return 0;
+            return (int)cipher->aead->key_size;
+        } else
+#endif
+        if (sock->ssl->ossl != NULL)
+            return SSL_get_cipher_bits(sock->ssl->ossl, NULL);
+    }
+    return 0;
 }

 h2o_iovec_t h2o_socket_get_ssl_session_id(h2o_socket_t *sock)
 {
-    static const h2o_iovec_t nullvec = {NULL};
-
-    if (sock->ssl == NULL)
-        return nullvec;
-
+    if (sock->ssl != NULL) {
 #if H2O_USE_PICOTLS
-    if (sock->ssl->ptls != NULL) {
-        /* FIXME */
-        return nullvec;
-    }
-#endif
-
-    if (sock->ssl->handshake.server.async_resumption.state != ASYNC_RESUMPTION_STATE_COMPLETE)
-        return nullvec;
-
-    SSL_SESSION *session = SSL_get_session(sock->ssl->ossl);
-    if (session == NULL)
-        return nullvec;
-
-    unsigned id_len;
-    const unsigned char *id = SSL_SESSION_get_id(session, &id_len);
-    return h2o_iovec_init(id, id_len);
+        if (sock->ssl->ptls != NULL) {
+            /* FIXME */
+        } else
+#endif
+        if (sock->ssl->ossl != NULL) {
+            SSL_SESSION *session;
+            if (sock->ssl->handshake.server.async_resumption.state == ASYNC_RESUMPTION_STATE_COMPLETE &&
+                (session = SSL_get_session(sock->ssl->ossl)) != NULL) {
+                unsigned id_len;
+                const unsigned char *id = SSL_SESSION_get_id(session, &id_len);
+                return h2o_iovec_init(id, id_len);
+            }
+        }
+    }
+
+    return h2o_iovec_init(NULL, 0);
 }

 h2o_iovec_t h2o_socket_log_ssl_session_id(h2o_socket_t *sock, h2o_mem_pool_t *pool)
@@ -990,7 +995,8 @@
     h2o_socket_cb handshake_cb = sock->ssl->handshake.cb;
     sock->_cb.write = NULL;
     sock->ssl->handshake.cb = NULL;
-    decode_ssl_input(sock);
+    if (err == NULL)
+        decode_ssl_input(sock);
     handshake_cb(sock, err);
 }


added some formatting and clarified some panic error messages

git-svn-id: 9e9401559e51101c165cdce4d49b411eb20436ed@3852 3d70eeeb-363e-0410-a505-8a46323a89f2

--- src/hest/parseHest.c
+++ src/hest/parseHest.c
@@ -199,21 +199,25 @@
     }
     if (airTypeEnum == opt[op].type) {
       if (!(opt[op].enm)) {
-        if (err)
-          sprintf(err, "%s!!!!!! opt[%d] is type \"enum\", but no "
-                  "airEnum pointer given", ME, op);
-        else
+        if (err) {
+          sprintf(err, "%s!!!!!! opt[%d] (%s) is type \"enum\", but no "
+                  "airEnum pointer given", ME, op,
+                  opt[op].flag ? opt[op].flag : "?");
+        } else {
           fprintf(stderr, "%s: panic 3\n", me);
+        }
         return 1;
       }
     }
     if (airTypeOther == opt[op].type) {
       if (!(opt[op].CB)) {
-        if (err)
-          sprintf(err, "%s!!!!!! opt[%d] is type \"other\", but no "
-                  "callbacks given", ME, op);
-        else
+        if (err) {
+          sprintf(err, "%s!!!!!! opt[%d] (%s) is type \"other\", but no "
+                  "callbacks given", ME, op,
+                  opt[op].flag ? opt[op].flag : "?");
+        } else {
           fprintf(stderr, "%s: panic 4\n", me);
+        }
         return 1;
       }
       if (!( opt[op].CB->size > 0 )) {


Linux compile fix.

Linux compile fix.

svn path=/trunk/libavg/; revision=5212

--- src/player/MultitouchEventSource.h
+++ src/player/MultitouchEventSource.h
@@ -27,7 +27,7 @@
 #include "IEventSource.h"

 #include <boost/thread.hpp>
-#include <set>
+#include <map>

 typedef boost::shared_ptr<boost::mutex> MutexPtr;


Create service.c

Create service.c

error: pathspec '15_02/socket_iterative/service.c' did not match any file(s) known to git

--- 15_02/socket_iterative/service.c
+++ 15_02/socket_iterative/service.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#define eerror(msg) { printf("%s\n", msg); exit(1); }
+
+int main() {
+	char buffer[128]; int n,i;
+	n = read(0, buffer, 128);
+	for(i=0; i<n; i++)
+        if(islower(buffer[i]))
+            buffer[i] = buffer[i]-32;
+    if(write(0, buffer, n) < 0 )
+        eerror("write() error");
+	return 0;
+}


Added data passing example.

Added data passing example.

--- uvbook/2-4_idle-basic/idle-basic.c
+++ uvbook/2-4_idle-basic/idle-basic.c
@@ -1,29 +1,36 @@
 #include <stdio.h>
 #include "uv.h"

+typedef struct {
+    const u_int64_t max;
+    u_int64_t counter;
+} user_data_t;
+
 void wait_for_a_while(uv_idle_t* handle) {
-  static int64_t counter = 0;
-
-  if (++counter >= 10e6) {
-    handle->data = &counter; // pass the user data
-    uv_idle_stop(handle);
-  }
+    user_data_t* user_data = (user_data_t *) (handle->data);
+
+    if (++(user_data->counter) >= user_data->max) {
+        uv_idle_stop(handle);
+    }
 }

 int main() {
+    user_data_t user_data = { 10e6, 0 }; // max=2, counter=0
+
     uv_idle_t idler;
-
-    printf("Idling...\n");
-
+    idler.data = &user_data;
+
+    printf("Idling %lld times...\n", user_data.max);
+
     uv_idle_init(uv_default_loop(), &idler);
     uv_idle_start(&idler, wait_for_a_while);
-
+
     uv_run(uv_default_loop(), UV_RUN_DEFAULT);
-
+
     uv_loop_close(uv_default_loop());
-
+
     // print the user data
-    printf("Counter = %lld\n", *(int64_t*)idler.data);
+    printf("Counter = %lld\n", ((user_data_t*) (idler.data))->counter);

     return 0;
 }


nm

nm

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@7045 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- visualization/include/pcl/visualization/pcl_plotter.h
+++ visualization/include/pcl/visualization/pcl_plotter.h
@@ -37,13 +37,13 @@
 #ifndef PCL_VISUALUALIZATION_PCL_PLOTTER_H_
 #define	PCL_VISUALUALIZATION_PCL_PLOTTER_H_

-#include<iostream>
-#include<vector>
-#include<utility>
-#include<cfloat>
+#include <iostream>
+#include <vector>
+#include <utility>
+#include <cfloat>

 //VTK includes
-#include<pcl/visualization/vtk.h>
+#include <pcl/visualization/vtk.h>

 //pcl includes
 #include <pcl/visualization/common/common.h>


cppcheck: The scope of the variable 'fullname' can be reduced.

git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@6557 0ce88b0d-b2fd-0310-8134-9614164e65ea

--- src/hotplug_libusb.c
+++ src/hotplug_libusb.c
@@ -548,7 +548,6 @@
 	if (desc.iSerialNumber)
 	{
 		libusb_device_handle *device;
-		char fullname[MAX_READERNAME];
 		int ret;

 		ret = libusb_open(dev, &device);
@@ -572,6 +571,8 @@
 			}
 			else
 			{
+				char fullname[MAX_READERNAME];
+
 				snprintf(fullname, sizeof(fullname), "%s (%s)",
 					driver->readerName, serialNumber);
 				readerTracker[i].fullName = strdup(fullname);


Added doFunctionList for HproseService

Added doFunctionList for HproseService

--- src/hprose_service.c
+++ src/hprose_service.c
@@ -103,6 +103,14 @@
     hprose_service_do_invoke(getThis(), HPROSE_GET_OBJECT_P(bytes_io, input)->_this, context, return_value TSRMLS_CC);
 }

+ZEND_METHOD(hprose_service, doFunctionList) {
+    zval *context;
+    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &context) == FAILURE) {
+        return;
+    }
+    hprose_service_do_function_list(getThis(), context, return_value TSRMLS_CC);
+}
+
 ZEND_METHOD(hprose_service, getFilter) {
     HPROSE_THIS(service);
     if (Z_ARRLEN_P(_this->filters)) {
@@ -190,6 +198,10 @@
     ZEND_ARG_INFO(0, context)
 ZEND_END_ARG_INFO()

+ZEND_BEGIN_ARG_INFO_EX(hprose_service_do_function_list_arginfo, 0, 0, 1)
+    ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(hprose_service_get_filter_arginfo, 0, 0, 0)
 ZEND_END_ARG_INFO()

@@ -219,6 +231,7 @@
     ZEND_ME(hprose_service, outputFilter, hprose_service_filter_arginfo, ZEND_ACC_PROTECTED)
     ZEND_ME(hprose_service, sendError, hprose_service_send_error_arginfo, ZEND_ACC_PROTECTED)
     ZEND_ME(hprose_service, doInvoke, hprose_service_do_invoke_arginfo, ZEND_ACC_PROTECTED)
+    ZEND_ME(hprose_service, doFunctionList, hprose_service_do_function_list_arginfo, ZEND_ACC_PROTECTED)
     ZEND_ME(hprose_service, getFilter, hprose_service_get_filter_arginfo, ZEND_ACC_PUBLIC)
     ZEND_ME(hprose_service, setFilter, hprose_service_set_filter_arginfo, ZEND_ACC_PUBLIC)
     ZEND_ME(hprose_service, addFilter, hprose_service_add_filter_arginfo, ZEND_ACC_PUBLIC)


pnfs/blocklayout: improve GETDEVICEINFO error reporting

Tell userspace what stage of GETDEVICEINFO failed so that there is a chance
to debug it, especially with the userspace daemon clusterf***k in the block
layout driver.

Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Signed-off-by: Trond Myklebust <cc958843532c615cbd4920e868f78c7985331a5a@primarydata.com>


[CPUFREQ] Longhaul - VT8237 support

[CPUFREQ] Longhaul - VT8237 support

Looks like VT8237 has the same bits which VT8235 has.
Poke registers if it is found.

Signed-off-by: Rafal Bilski <a605e3bd9faf107d004bde2567333dfc4f7ae2c3@interia.pl>
Signed-off-by: Dave Jones <d5ec0d24602845f6f4b6a35ef729998d1fba5507@redhat.com>

--- arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -633,6 +633,10 @@

 	/* Find VT8235 southbridge */
 	dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL);
+	if (dev == NULL)
+	/* Find VT8237 southbridge */
+		dev = pci_get_device(PCI_VENDOR_ID_VIA,
+				     PCI_DEVICE_ID_VIA_8237, NULL);
 	if (dev != NULL) {
 		/* Set transition time to max */
 		pci_read_config_byte(dev, 0xec, &pci_cmd);


[CPUFREQ] longhaul - adjust transition latency.

From patch by: Ken Staton <ken_staton@agilent.com>
Signed-off-by: Dave Jones <d5ec0d24602845f6f4b6a35ef729998d1fba5507@redhat.com>

--- arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -626,7 +626,7 @@
 		longhaul_setup_voltagescaling();

 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
-	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+	policy->cpuinfo.transition_latency = 200000;	/* nsec */
 	policy->cur = calc_speed(longhaul_get_cpu_mult());

 	ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table);


Added doc for some things in HttpFileServer

--- src/httpfileserver.h
+++ src/httpfileserver.h
@@ -33,6 +33,29 @@

 } // namespace Priv

+/*!
+  You can use this class to server static files under Tufão.
+
+  There are two main approaches:
+    - Construct an object and use the AbstractHttpServerRequestHandler API
+    - Use the static methods to serve a file (or set the entity in the response
+      body)
+
+  The algorithm used to serve files will handle the following set of headers:
+    - If-Modified-Since
+    - If-Unmodified-Since
+    - If-Range
+    - Range
+
+  It won't handle:
+    - ETag (If-Match and If-None-Match headers)
+    - Cache-Control response header: Useful for set cache max age
+    - Content-Disposition response header
+    - Content-MD5 response header
+
+  Still, this class provides a robust HTTP file server, supporting conditional
+  and byte-ranges requests.
+  */
 class TUFAO_EXPORT HttpFileServer: public AbstractHttpServerRequestHandler
 {
     Q_OBJECT
@@ -46,15 +69,16 @@
     Headers &customHeaders();

     /*!
-      The two main differences between this static method and the object
-      approaches are:
-        - The object uses the Least-Recently-Used (LRU) cache algo
-        - The object executes a safe (treay .. correctly) search for the file
-          requested
+      Analyze the \p request and serve the file pointed by \p filename.
       */
     static void serveFile(const QString &fileName, HttpServerRequest *request,
                           HttpServerResponse *response);

+    /*!
+      This member function doesn't serve any file, just set the response body to
+      the file pointed by \p filename. It's useful in some scenarios, like
+      404-pages.
+      */
     static bool serveFile(const QString &fileName, HttpServerResponse *response,
                           int statusCode);

@@ -62,6 +86,14 @@
     static void setBufferSize(qint64 size);

 public slots:
+    /*!
+      It handles the request search and serving the desired file, if the file is
+      found.
+
+      \note
+      This method won't let requests access files outside the root dir folder
+      and should be prefered over self-made implementations.
+      */
     bool handleRequest(Tufao::HttpServerRequest *request,
                        Tufao::HttpServerResponse *response,
                        const QStringList & = QStringList());


[POWERPC] PS3: System-bus modinfo attribute

Add modinfo attribute to ps3_system_bus devices.  Also make them all
children of the same ps3_system_bus 'device' so they appear in a
corresponding subdirectory under /sys/devices.

Signed-off-by: David Woodhouse <97b3379caa91f4ee97e44013ae4dc6350540fa9d@infradead.org>
Signed-off-by: Geoff Levand <058b6ffe73540731b6df5cbcf27480d0bdbf7afb@am.sony.com>
Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>

--- arch/powerpc/platforms/ps3/system-bus.c
+++ arch/powerpc/platforms/ps3/system-bus.c
@@ -452,6 +452,20 @@
 	return 0;
 }

+static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
+	char *buf)
+{
+	struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
+	int len = snprintf(buf, PAGE_SIZE, "ps3:%d\n", dev->match_id);
+
+	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
+}
+
+static struct device_attribute ps3_system_bus_dev_attrs[] = {
+	__ATTR_RO(modalias),
+	__ATTR_NULL,
+};
+
 struct bus_type ps3_system_bus_type = {
 	.name = "ps3_system_bus",
 	.match = ps3_system_bus_match,
@@ -459,6 +473,7 @@
 	.probe = ps3_system_bus_probe,
 	.remove = ps3_system_bus_remove,
 	.shutdown = ps3_system_bus_shutdown,
+	.dev_attrs = ps3_system_bus_dev_attrs,
 };

 static int __init ps3_system_bus_init(void)


Implementation for i965_SyncSurface and i965_QuerySurfaceStatus (cherry picked from commit 25673c458932caa09ae3f47c6dbe7e040dbae032)

--- src/i965_drv_video.c
+++ src/i965_drv_video.c
@@ -1871,6 +1871,9 @@

     assert(obj_surface);

+    if(obj_surface->bo)
+        drm_intel_bo_wait_rendering(obj_surface->bo);
+
     return VA_STATUS_SUCCESS;
 }

@@ -1884,15 +1887,16 @@

     assert(obj_surface);

-    /* Usually GEM will handle synchronization with the graphics hardware */
-#if 0
     if (obj_surface->bo) {
-        dri_bo_map(obj_surface->bo, 0);
-        dri_bo_unmap(obj_surface->bo);
-    }
-#endif
-
-    *status = obj_surface->status;
+        if (drm_intel_bo_busy(obj_surface->bo)){
+            *status = VASurfaceRendering;
+        }
+        else {
+            *status = VASurfaceReady;
+        }
+    } else {
+        *status = VASurfaceReady;
+    }

     return VA_STATUS_SUCCESS;
 }


convert-tool returned inverted exit status.

--HG--
branch : HEAD

--- src/plugins/convert/convert-tool.c
+++ src/plugins/convert/convert-tool.c
@@ -70,5 +70,5 @@
 	mail_storage_deinit();
 	lib_signals_deinit();
 	lib_deinit();
-	return ret;
+	return ret <= 0 ? 1 : 0;
 }


compat: Improve alloca.h (alloca definition)

--- src/include/alloca.h
+++ src/include/alloca.h
@@ -10,6 +10,15 @@

 #include <stddef.h> /* size_t in standard library */

+#include <sys/cdefs.h>
+__BEGIN_DECLS
+
 extern void * alloca(size_t size);

+#ifdef        __GNUC__
+# define alloca(size)        __builtin_alloca (size)
+#endif /* GCC.  */
+
+__END_DECLS
+
 #endif /* ALLOCA_H_ */


buffer: add malloc raw buffer type

buffer: add malloc raw buffer type

--- src/include/buffer.h
+++ src/include/buffer.h
@@ -121,6 +121,24 @@
     }
     raw* clone_empty() {
       return new raw_char(len);
+    }
+  };
+
+  class raw_malloc : public raw {
+  public:
+    raw_malloc(unsigned l) : raw(l) {
+      if (len)
+	data = (char *)malloc(len);
+      else
+	data = 0;
+      inc_total_alloc(len);
+    }
+    ~raw_malloc() {
+      free(data);
+      dec_total_alloc(len);
+    }
+    raw* clone_empty() {
+      return new raw_malloc(len);
     }
   };

@@ -213,6 +231,9 @@
   }
   static raw* create(unsigned len) {
     return new raw_char(len);
+  }
+  static raw* create_malloc(unsigned len) {
+    return new raw_malloc(len);
   }

   static raw* create_page_aligned(unsigned len) {


Fix build with USE_TBB off (on Windows).

--- src/include/thread.h
+++ src/include/thread.h
@@ -252,7 +252,7 @@
 {
 #if defined(__GNUC__) && defined(_GLIBCXX_ATOMIC_BUILTINS)
     return __sync_fetch_and_add ((int *)at, x);
-#elif defined(USE_TBB)
+#elif USE_TBB
     atomic<int> *a = (atomic<int> *)at;
     return a->fetch_and_add (x);
 #elif defined(__APPLE__)
@@ -273,7 +273,7 @@
 {
 #if defined(__GNUC__) && defined(_GLIBCXX_ATOMIC_BUILTINS)
     return __sync_fetch_and_add (at, x);
-#elif defined(USE_TBB)
+#elif USE_TBB
     atomic<long long> *a = (atomic<long long> *)at;
     return a->fetch_and_add (x);
 #elif defined(__APPLE__)
@@ -300,7 +300,7 @@
 {
 #if defined(__GNUC__) && defined(_GLIBCXX_ATOMIC_BUILTINS)
     return __sync_bool_compare_and_swap (at, compareval, newval);
-#elif defined(USE_TBB)
+#elif USE_TBB
     atomic<int> *a = (atomic<int> *)at;
     return a->compare_and_swap (newval, compareval) == newval;
 #elif defined(__APPLE__)
@@ -319,7 +319,7 @@
 {
 #if defined(__GNUC__) && defined(_GLIBCXX_ATOMIC_BUILTINS)
     return __sync_bool_compare_and_swap (at, compareval, newval);
-#elif defined(USE_TBB)
+#elif USE_TBB
     atomic<long long> *a = (atomic<long long> *)at;
     return a->compare_and_swap (newval, compareval) == newval;
 #elif defined(__APPLE__)


libdirect: Fix type cast in MIPS' atomic code.

--- lib/direct/atomic.h
+++ lib/direct/atomic.h
@@ -308,7 +308,7 @@
 }

 #define D_SYNC_ADD_AND_FETCH( ptr, value )                                           \
-     (_D__atomic_add_return( (int) (value), (void*) (ptr) ))
+     (_D__atomic_add_return( (int) (value), (volatile int*) (ptr) ))

 #endif


RJH: inclusion of symmetry library?

RJH: inclusion of symmetry library?

--- src/config/makefile.h
+++ src/config/makefile.h
@@ -1,5 +1,5 @@

-# $Id: makefile.h,v 1.75 1994-11-05 03:41:51 og845 Exp $
+# $Id: makefile.h,v 1.76 1994-11-10 17:59:38 d3g681 Exp $

 # Common definitions for all makefiles ... these can be overridden
 # either in each makefile by putting additional definitions below the
@@ -16,7 +16,7 @@
 error1:
 	@echo You must define NWCHEM_TOP in your environment to be the path
 	@echo of the top level nwchem directory ... something like
-	@echo     setenv NWCHEM_TOP /msrc/home/bill_clinton/nwchem
+	@echo     setenv NWCHEM_TOP /msrc/home/orrin_hatch/nwchem
 	@exit 1
 endif

@@ -159,7 +159,7 @@
   MAKEFLAGS = -j2
     INSTALL = @echo $@ is built

-   FOPTIONS = -Nl99
+   FOPTIONS = -Nl199
    COPTIONS = -Wall
   FOPTIMIZE = -O3
   COPTIMIZE = -g -O2
@@ -168,7 +168,7 @@

        LIBS = -ltest -lddscf -lriscf -lrimp2 -lnwdft -lgradients -lutil -lnwints \
               -lstepper -lmoints \
-              -lguess -lglobal -lutil -lglobal \
+              -lguess -lglobal -lutil -lnwints  -lglobal \
 	      -ltcgmsg -llapack -lblas

   EXPLICITF = FALSE


cleanup of LINUX target

cleanup of LINUX target

--- src/config/makefile.h
+++ src/config/makefile.h
@@ -1358,6 +1358,15 @@

   DEFINES = -DLINUX

+      ifeq ($(FC),gfortran)
+        FOPTIONS   = -Wextra -ffast-math #-Wunused
+        FOPTIMIZE  = -O2 -ffast-math -Wuninitialized
+        _FC=gfortran
+        DEFINES  += -DGFORTRAN
+      endif
+      COPTIONS   = -Wall
+      COPTIMIZE  = -g -O2
+
 ifeq ($(LINUXCPU),x86)
   ifeq ($(TARGET),CYGNUS)
     DEFINES += -DCYGNUS
@@ -1373,7 +1382,6 @@

     ifeq ($(_CPU),i686)
      _GOTSSE2= $(shell cat /proc/cpuinfo | egrep sse2 | tail -n 1 | awk ' /sse2/  {print "Y"}')
-     _PENTIUM_M= $(shell cat /proc/cpuinfo | egrep " M processor" | tail -n 1 | awk ' /M/  {print "Y"}')
       ifeq ($(_GOTSSE2),Y)
         _CPU=i786
       endif
@@ -1448,10 +1456,6 @@
  ifeq ($(FC),ifort)
      _FC=ifc
  endif
- ifeq ($(FC),gfortran)
-   _FC=gfortran
-       DEFINES  += -DGFORTRAN
-  endif
   ifeq ($(_FC),ifc)
   FOPTIONS   =  -align    -mp1 -w -g -vec-report1
   ifdef  USE_GPROF
@@ -1476,15 +1480,7 @@
       FOPTIMIZE +=  -tpp6 -xK   # this are for PentiumIII
     endif
     ifeq ($(_CPU),i786)
-      ifeq ($(_PENTIUM_M),Y)
-        ifneq ($(_IFCV7),Y)
-          FOPTIMIZE +=  -tpp7 -xB    # this are for Pentium M (aka Centrino)
-        else
-          FOPTIMIZE +=  -tpp7 -xW    # this are for PentiumIV
-        endif
-      else
-        FOPTIMIZE +=  -tpp7 -xW    # this are for PentiumIV
-      endif
+      FOPTIMIZE +=  -tpp7 -xW    # this are for PentiumIV
     endif
     DEFINES   += -DIFCLINUX
     ifneq ($(_IFCV7),Y)
@@ -1494,8 +1490,6 @@
       ifeq ($(_FC),gfortran)
 #gcc version 4.1.0 20050525 (experimental)
         LINK.f = gfortran  $(LDFLAGS)
-        FOPTIONS   = -Wextra -ffast-math #-Wunused
-        FOPTIMIZE  = -O2 -ffast-math -Wuninitialized
         ifeq ($(_CPU),i786)
           FOPTIONS += -march=pentium4 -mtune=pentium4
           FVECTORIZE = $(FOPTIMIZE) -O3 -ftree-vectorize