mod to pjournal_logwrite()

mod to pjournal_logwrite()

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@8439 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- psc_fsutil_libs/psc_util/journal.c
+++ psc_fsutil_libs/psc_util/journal.c
@@ -46,7 +46,7 @@
 	} while (xh->pjx_xid == PJE_XID_NONE);
 	PJ_ULOCK(pj);

-	psc_warnx("Start a new transaction %p (xid = %ld) for journal %p.", xh, xh->pjx_xid, xh->pjx_pj);
+	psc_warnx("Start a new transaction %p (xid = %ld) for journal %p.", xh, (long int) xh->pjx_xid, xh->pjx_pj);
 	return (xh);
 }

@@ -151,12 +151,11 @@
 	if (type & PJET_NODATA)
 		psc_assert(!data);

-	tail_slot = 0;
 	pj = xh->pjx_pj;

+	psc_assert(!(type & PJET_XEND));
 	psc_assert(!(type & PJET_CORRUPT));
 	psc_assert(!(type & PJET_XSTARTED));
-	psc_assert(!(type & PJET_XEND));

 	psc_assert(!(xh->pjx_flags & PJX_XCLOSED));

@@ -168,21 +167,18 @@
 	 */
 	PJ_LOCK(pj);
 	slot = pj->pj_nextwrite;
+	tail_slot = PJX_SLOT_ANY;
 	t = psclist_first_entry(&pj->pj_pndgxids, struct psc_journal_xidhndl, pjx_lentry);
 	if (t) {
-		if (t->pjx_tailslot == slot) {
-			psc_warnx("pj(%p) blocking on slot(%d) "
-				  "availability - owned by xid (%p)",
-				  pj, slot, t);
+		if (t->pjx_tailslot == pj->pj_nextwrite) {
+			psc_warnx("Journal %p write is blocked on slot %d "
+				  "owned by transaction %p (xid = %ld)",
+				   pj, pj->pj_nextwrite, t, (long int) t->pjx_xid);
 			psc_waitq_wait(&pj->pj_waitq, &pj->pj_lock);
 			goto retry;
 		}
 		tail_slot = t->pjx_tailslot;
 	}
-
-	psc_info("pj(%p) tail@slot(%d) my@slot(%d) xh_flags(%o)",
-		 pj, tail_slot, slot, xh->pjx_flags);
-
 	if (!(xh->pjx_flags & PJET_XSTARTED)) {
 		/* Multi-step operation, mark the slot id here
 		 *  so that the tail of the journal can be found
@@ -200,11 +196,13 @@

 	if ((++pj->pj_nextwrite) == pj->pj_hdr->pjh_nents) {
 		pj->pj_nextwrite = 0;
-
 	} else
 		psc_assert(pj->pj_nextwrite < pj->pj_hdr->pjh_nents);

 	PJ_ULOCK(pj);
+
+	psc_info("Writing transaction %p into journal %p: transaction tail = %d, log tail = %d",
+		  xh, pj, xh->pjx_tailslot, tail_slot);

 	rc = pjournal_logwrite_internal(pj, xh, slot, type, data, size);


regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_linear

Properly handle the case if the specified min_uV is less than the voltage given
by the lowest selector.

Signed-off-by: Axel Lin <b6ffd6973e972cb999e8e535ab74da7fee0c035f@gmail.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- drivers/regulator/core.c
+++ drivers/regulator/core.c
@@ -2050,6 +2050,9 @@
 		return -EINVAL;
 	}

+	if (min_uV < rdev->desc->min_uV)
+		min_uV = rdev->desc->min_uV;
+
 	ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step);
 	if (ret < 0)
 		return ret;


gnrc_tcp: add minimum length check to _receive

--- sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloop.c
+++ sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloop.c
@@ -136,6 +136,12 @@
         return 0;
     }

+    if (tcp->size < sizeof(tcp_hdr_t)) {
+        DEBUG("gnrc_tcp_eventloop.c : _receive() : packet is too short\n");
+        gnrc_pktbuf_release(pkt);
+        return -ERANGE;
+    }
+
     /* Extract control bits, src and dst ports and check if SYN is set (not SYN+ACK) */
     hdr = (tcp_hdr_t *)tcp->data;
     ctl = byteorder_ntohs(hdr->off_ctl);


drivers/rtc/rtc-ds1305.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/rtc/rtc-ds1305.c
+++ drivers/rtc/rtc-ds1305.c
@@ -606,7 +606,7 @@
 	struct ds1305			*ds1305;
 	int				status;
 	u8				addr, value;
-	struct ds1305_platform_data	*pdata = spi->dev.platform_data;
+	struct ds1305_platform_data	*pdata = dev_get_platdata(&spi->dev);
 	bool				write_ctrl = false;

 	/* Sanity check board setup data.  This may be hooked up


isci: Fix use of SATA soft reset state machine.

The driver SATA LUN reset function incorrectly sent an SRST deassert
FIS, which is unnecessary because the core initiates the entire SATA
soft reset state machine from the assert request.

Signed-off-by: Jeff Skirvin <08d7a0665839bb7b40e5cd563354a8c48068af8d@intel.com>
Signed-off-by: Dan Williams <24ee2bf0bd8ac766c348bf1f0639943bac1535c6@intel.com>

--- drivers/scsi/isci/sata.c
+++ drivers/scsi/isci/sata.c
@@ -301,8 +301,8 @@
 	int ret = TMF_RESP_FUNC_FAILED;
 	unsigned long flags;

-	/* Send the initial SRST to the target */
-	#define ISCI_SRST_TIMEOUT_MS 20 /* 20 ms timeout. */
+	/* Send the soft reset to the target */
+	#define ISCI_SRST_TIMEOUT_MS 25000 /* 25 second timeout. */
 	isci_task_build_tmf(&tmf, isci_device, isci_tmf_sata_srst_high,
 			    NULL, NULL
 			    );
@@ -319,38 +319,6 @@
 		/* Return the failure so that the LUN reset is escalated
 		 * to a target reset.
 		 */
-		goto out;
-	}
-
-	/* Leave SRST high for a bit. */
-	#define ISCI_SRST_ASSERT_DELAY 100 /* usecs */
-	udelay(ISCI_SRST_ASSERT_DELAY);
-
-	/* Deassert SRST. */
-	isci_task_build_tmf(&tmf, isci_device, isci_tmf_sata_srst_low,
-			    NULL, NULL
-			    );
-	ret = isci_task_execute_tmf(isci_host, &tmf, ISCI_SRST_TIMEOUT_MS);
-
-	if (ret == TMF_RESP_FUNC_COMPLETE)
-		dev_dbg(&isci_host->pdev->dev,
-			"%s: SATA LUN reset passed (%p)\n",
-			__func__,
-			isci_device);
-	else
-		dev_warn(&isci_host->pdev->dev,
-			 "%s: Deassert SRST failed (%p)=%x\n",
-			 __func__,
-			 isci_device,
-			 ret);
-
- out:
-	spin_lock_irqsave(&isci_host->scic_lock, flags);
-
-	/* Resume the device. */
-	scic_sds_remote_device_resume(to_sci_dev(isci_device));
-
-	spin_unlock_irqrestore(&isci_host->scic_lock, flags);
-
+	}
 	return ret;
 }


spi/xilinx: Code cleanup

spi/xilinx: Code cleanup

On the transmission loop, check for remaining bytes at the loop
condition.

This way we can handle transmissions of 0 bytes and clean the code.

Signed-off-by: Ricardo Ribalda Delgado <39bb74b16720293e1449e36465485b27216fbd6d@gmail.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>

--- drivers/spi/spi-xilinx.c
+++ drivers/spi/spi-xilinx.c
@@ -248,7 +248,7 @@
 	xspi->remaining_bytes = t->len;
 	reinit_completion(&xspi->done);

-	for (;;) {
+	while (xspi->remaining_bytes) {
 		u16 cr;
 		int n_words;

@@ -278,10 +278,6 @@
 		/* Read out all the data from the Rx FIFO */
 		while (n_words--)
 			xspi->rx_fn(xspi);
-
-		/* See if there is more data to send */
-		if (xspi->remaining_bytes <= 0)
-			break;
 	}

 	return t->len - xspi->remaining_bytes;


serial: imx: check the DMA for imx_tx_empty

Assume the following situation:

  If the DMA is enabled, and the a TX DMA operation is working,
But we have not issued the TX DMA operation (or we have issued the
TX DMA operation with dma_async_issue_pending(), but the DMA has not
started to move the data from the memory to the TXFIFO).

At this time, we may get the wrong status of the transmitter when we
call the imx_tx_empty. In such situation, only check the USR2_TXDC
does not enough for us.

This patch checks the DMA's situation, and return 0 when the TX DMA is
working.

Signed-off-by: Huang Shijie <3c7352d1cf9fbb1bd8706c56d582c0ade3f5dabf@freescale.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/tty/serial/imx.c
+++ drivers/tty/serial/imx.c
@@ -795,8 +795,15 @@
 static unsigned int imx_tx_empty(struct uart_port *port)
 {
 	struct imx_port *sport = (struct imx_port *)port;
-
-	return (readl(sport->port.membase + USR2) & USR2_TXDC) ?  TIOCSER_TEMT : 0;
+	unsigned int ret;
+
+	ret = (readl(sport->port.membase + USR2) & USR2_TXDC) ?  TIOCSER_TEMT : 0;
+
+	/* If the TX DMA is working, return 0. */
+	if (sport->dma_is_enabled && sport->dma_is_txing)
+		ret = 0;
+
+	return ret;
 }

 /*


USB: cxacru: firmware writes on OHCI are slow, log progress

Firmware writing takes 256ms per 4KB with OHCI, which
is very slow compared to 7ms per 4KB with UHCI.

Until I have access to a hardware USB analyser it may
not be possible to determine why this happens.

Instead of appearing to do nothing, log progress when
writing firmware and then log the ATM device information
when finished. Remove an unnecessary 4 second delay.

Signed-off-by: Simon Arlott <088e16a1019277b15d58faf0541e11910eb756f6@fire.lp0.eu>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/atm/cxacru.c
+++ drivers/usb/atm/cxacru.c
@@ -725,6 +725,9 @@
 	mutex_unlock(&instance->poll_state_serialize);
 	mutex_unlock(&instance->adsl_state_serialize);

+	printk(KERN_INFO "%s%d: %s %pM\n", atm_dev->type, atm_dev->number,
+			usbatm_instance->description, atm_dev->esi);
+
 	if (start_polling)
 		cxacru_poll_status(&instance->poll_work.work);
 	return 0;
@@ -939,6 +942,7 @@
 	}

 	/* Firmware */
+	usb_info(usbatm, "loading firmware\n");
 	ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size);
 	if (ret) {
 		usb_err(usbatm, "Firmware upload failed: %d\n", ret);
@@ -947,6 +951,7 @@

 	/* Boot ROM patch */
 	if (instance->modem_type->boot_rom_patch) {
+		usb_info(usbatm, "loading boot ROM patch\n");
 		ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size);
 		if (ret) {
 			usb_err(usbatm, "Boot ROM patching failed: %d\n", ret);
@@ -961,6 +966,7 @@
 		return;
 	}

+	usb_info(usbatm, "starting device\n");
 	if (instance->modem_type->boot_rom_patch) {
 		val = cpu_to_le32(BR_ADDR);
 		ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4);
@@ -1004,8 +1010,6 @@
 				return;
 			}
 		}
-
-	msleep_interruptible(4000);
 }

 static int cxacru_find_firmware(struct cxacru_data *instance,


USB: handle errors in power/level attribute

This patch (as906) improves the error handling for the USB power/level
attribute file.  If an error occurs, the original power-level settings
will be restored.

Signed-off-by: Alan Stern <75ea6bb7bfc1186f92d26164de5f9268c9a45b59@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/core/sysfs.c
+++ drivers/usb/core/sysfs.c
@@ -232,12 +232,15 @@
 	int len = count;
 	char *cp;
 	int rc = 0;
+	int old_autosuspend_disabled, old_autoresume_disabled;

 	cp = memchr(buf, '\n', count);
 	if (cp)
 		len = cp - buf;

 	usb_lock_device(udev);
+	old_autosuspend_disabled = udev->autosuspend_disabled;
+	old_autoresume_disabled = udev->autoresume_disabled;

 	/* Setting the flags without calling usb_pm_lock is a subject to
 	 * races, but who cares...
@@ -263,6 +266,10 @@
 	} else
 		rc = -EINVAL;

+	if (rc) {
+		udev->autosuspend_disabled = old_autosuspend_disabled;
+		udev->autoresume_disabled = old_autoresume_disabled;
+	}
 	usb_unlock_device(udev);
 	return (rc < 0 ? rc : count);
 }


USB: missing error check in emi26

USB: missing error check in emi26

this drivers lacks an error check.

Signed-off-by: Oliver Neukum <bfee72d94d376f4e00f72b756466867d7f9eb24e@suse.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/misc/emi26.c
+++ drivers/usb/misc/emi26.c
@@ -114,6 +114,10 @@

 	/* De-assert reset (let the CPU run) */
 	err = emi26_set_reset(dev,0);
+	if (err < 0) {
+		err("%s - error loading firmware: error = %d", __FUNCTION__, err);
+		goto wraperr;
+	}
 	msleep(250);	/* let device settle */

 	/* 2. We upload the FPGA firmware into the EMI


Improved parallel example

Improved parallel example

--- examples/ex_paral.c
+++ examples/ex_paral.c
@@ -47,12 +47,14 @@

 static void act(void)
 {
+    /* Atomic increment, much more faster than YCT_SYNCHRONIZED */
+    YCT_ATOMIC()
+    activations++;
+
     YCT_SYNCHRONIZED() /* Block executed serially, one thread at time */
     {
-        printf("Activation %d\n", ++activations);
+        printf("Activation %d\n", activations);
     }
-
-    /* Note: For increments/decrements see YCT_ATOMIC() doc! */

     core(N);
 }


add make_identity function

add make_identity function

--- stingraykit/function/functional.h
+++ stingraykit/function/functional.h
@@ -56,6 +56,22 @@
 		void operator () (T& t, const V& v) const { t = v; }
 	};

+
+	template < typename T >
+	class Identity : public function_info<T ()>
+	{
+	private:
+		T _value;
+
+	public:
+		explicit Identity(const T& value) : _value(value) { }
+
+		T operator()() const { return _value; }
+	};
+
+	template < typename T >
+	Identity<T> make_identity(const T& value) { return Identity<T>(value); }
+
 	/** @} */

 }


GUAC-687: Do not allow empty updates to the dirty rect.

--- src/common/guac_surface.c
+++ src/common/guac_surface.c
@@ -112,7 +112,7 @@
  * @return Non-zero if the update should be combined with any existing update,
  *         zero otherwise.
  */
-static int __guac_common_should_combine(guac_common_surface* surface, guac_common_rect* rect, int rect_only) {
+static int __guac_common_should_combine(guac_common_surface* surface, const guac_common_rect* rect, int rect_only) {

     if (surface->dirty) {

@@ -166,7 +166,11 @@
  * @param surface The surface to mark as dirty.
  * @param rect The rectangle of the update which is dirtying the surface.
  */
-static void __guac_common_mark_dirty(guac_common_surface* surface, guac_common_rect* rect) {
+static void __guac_common_mark_dirty(guac_common_surface* surface, const guac_common_rect* rect) {
+
+    /* Ignore empty rects */
+    if (rect->width <= 0 || rect->height <= 0)
+        return;

     /* If already dirty, update existing rect */
     if (surface->dirty)


define oscap_dprintf even if NDEBUG

define oscap_dprintf even if NDEBUG

--- src/common/public/debug.h
+++ src/common/public/debug.h
@@ -4,7 +4,7 @@

 #ifndef oscap_dprintf
 #if defined(NDEBUG)
-# define _D(...) while(0)
+# define oscap_dprintf(...) while(0)
 #else
 # include <stddef.h>
 # include <stdarg.h>


layers: Whitelisted new extensions for 1.0.28

Change-Id: Ife1621716ec9593de3ca528d071b707515acb8c2

--- layers/unique_objects.h
+++ layers/unique_objects.h
@@ -16,6 +16,7 @@
  * limitations under the License.
  *
  * Author: Tobin Ehlis <tobine@google.com>
+ *         Mark Lobodzinski <mark@lunarg.com>
  */

 #include "vk_loader_platform.h"
@@ -65,7 +66,9 @@
     VK_EXT_DEBUG_MARKER_EXTENSION_NAME
     VK_EXT_DEBUG_REPORT_EXTENSION_NAME
     VK_KHR_DISPLAY_EXTENSION_NAME
-    VK_KHR_SURFACE_EXTENSION_NAME;
+    VK_KHR_SURFACE_EXTENSION_NAME
+    VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME
+    VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME;

 static const char *kUniqueObjectsSupportedDeviceExtensions =
     VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME
@@ -78,7 +81,17 @@
     VK_KHR_SWAPCHAIN_EXTENSION_NAME
     VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME
     VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME
-    VK_NV_GLSL_SHADER_EXTENSION_NAME;
+    VK_NV_GLSL_SHADER_EXTENSION_NAME
+    VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME
+    VK_AMD_EXTENSION_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME
+    VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME
+    VK_AMD_EXTENSION_SHADER_BALLOT_EXTENSION_NAME
+    VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+    VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME
+    VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME
+#endif
+    VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME;

 // All increments must be guarded by global_lock
 static uint64_t global_unique_id = 1;


Remove extraneous layers of indirection.

--- android-webcam-library/jni/webcam.c
+++ android-webcam-library/jni/webcam.c
@@ -303,22 +303,79 @@
     return result;
 }

-void shutdown_camera() {
-    stop_capturing();
-    uninit_device();
-    close_device();
-
-    if(rgb) {
-        free(rgb);
-    }
-
-    if(ybuf) {
-        free(ybuf);
-    }
-}
-
-int prepare_camera(const char* dev_name, int width, int height) {
+bool camera_detected() {
+    return fd != -1;
+}
+
+void process_camera(int width, int height) {
+    if(!camera_detected()) {
+        return;
+    }
+
+    for(;;) {
+        fd_set fds;
+        FD_ZERO(&fds);
+        FD_SET(fd, &fds);
+
+        struct timeval tv;
+        tv.tv_sec = 2;
+        tv.tv_usec = 0;
+
+        int result = select(fd + 1, &fds, NULL, NULL, &tv);
+        if(-1 == result) {
+            if(EINTR == errno) {
+                continue;
+            }
+            errnoexit("select");
+        } else if(0 == result) {
+            LOGE("select timeout");
+        }
+
+        if(read_frame(width, height) == 1) {
+            break;
+        }
+    }
+}
+
+void Java_com_ford_openxc_webcam_NativeWebcam_loadNextFrame(JNIEnv* env,
+        jobject thiz, jobject bitmap) {
+    AndroidBitmapInfo info;
+    int result;
+    if((result = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
+        LOGE("AndroidBitmap_getInfo() failed ! error=%d", result);
+        return;
+    }
+
+    process_camera(info.width, info.height);
+
+    if(!rgb || !ybuf) {
+        return;
+    }
+
+    if(info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
+        LOGE("Bitmap format is not RGBA_8888 !");
+        return;
+    }
+
+    void* pixels;
+    if((result = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
+        LOGE("AndroidBitmap_lockPixels() failed ! error=%d", result);
+    }
+
+    int* colors = (int*) pixels;
+    int *lrgb = &rgb[0];
+    for(int i = 0; i < info.width * info.height; i++) {
+        *colors++ = *lrgb++;
+    }
+
+    AndroidBitmap_unlockPixels(env, bitmap);
+}
+
+jint Java_com_ford_openxc_webcam_NativeWebcam_prepareCamera(JNIEnv* env,
+        jobject thiz, jstring deviceName, jint width, jint height) {
+    const char* dev_name = (*env)->GetStringUTFChars(env, deviceName, 0);
     int result = open_device(dev_name);
+    (*env)->ReleaseStringUTFChars(env, deviceName, dev_name);
     if(result == ERROR_LOCAL) {
         return result;
     }
@@ -344,83 +401,19 @@
     return result;
 }

-bool camera_detected() {
-    return fd != -1;
-}
-
-void process_camera(int width, int height) {
-    if(!camera_detected()) {
-        return;
-    }
-
-    for(;;) {
-        fd_set fds;
-        FD_ZERO(&fds);
-        FD_SET(fd, &fds);
-
-        struct timeval tv;
-        tv.tv_sec = 2;
-        tv.tv_usec = 0;
-
-        int result = select(fd + 1, &fds, NULL, NULL, &tv);
-        if(-1 == result) {
-            if(EINTR == errno) {
-                continue;
-            }
-            errnoexit("select");
-        } else if(0 == result) {
-            LOGE("select timeout");
-        }
-
-        if(read_frame(width, height) == 1) {
-            break;
-        }
-    }
-}
-
-void Java_com_ford_openxc_webcam_NativeWebcam_loadNextFrame(JNIEnv* env,
-        jobject thiz, jobject bitmap) {
-    AndroidBitmapInfo info;
-    int result;
-    if((result = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
-        LOGE("AndroidBitmap_getInfo() failed ! error=%d", result);
-        return;
-    }
-
-    process_camera(info.width, info.height);
-
-    if(!rgb || !ybuf) {
-        return;
-    }
-
-    if(info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
-        LOGE("Bitmap format is not RGBA_8888 !");
-        return;
-    }
-
-    void* pixels;
-    if((result = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
-        LOGE("AndroidBitmap_lockPixels() failed ! error=%d", result);
-    }
-
-    int* colors = (int*) pixels;
-    int *lrgb = &rgb[0];
-    for(int i = 0; i < info.width * info.height; i++) {
-        *colors++ = *lrgb++;
-    }
-
-    AndroidBitmap_unlockPixels(env, bitmap);
-}
-
-// Functions below this point are basically just JNI wrappers, no significant
-// work done here.
-
-jint Java_com_ford_openxc_webcam_NativeWebcam_prepareCamera(JNIEnv* env,
-        jobject thiz, jstring deviceName, jint width, jint height) {
-    const char* dev_name = (*env)->GetStringUTFChars(env, deviceName, 0);
-    int result = prepare_camera(dev_name, width, height);
-    (*env)->ReleaseStringUTFChars(env, deviceName, dev_name);
-    return result;
+void Java_com_ford_openxc_webcam_NativeWebcam_stopCamera(JNIEnv* env,
+        jobject thiz) {
+    stop_capturing();
+    uninit_device();
+    close_device();
+
+    if(rgb) {
+        free(rgb);
+    }
+
+    if(ybuf) {
+        free(ybuf);
+    }
 }

 jboolean Java_com_ford_openxc_webcam_NativeWebcam_cameraAttached(JNIEnv* env,
@@ -428,15 +421,6 @@
     return camera_detected();
 }

-void Java_com_ford_openxc_webcam_NativeWebcam_load(JNIEnv* env,
-        jobject thiz, jint width, jint height) {
-}
-
-void Java_com_ford_openxc_webcam_NativeWebcam_stopCamera(JNIEnv* env,
-        jobject thiz) {
-    shutdown_camera();
-}
-
 jint JNI_OnLoad(JavaVM* vm, void* reserved) {
     cache_tbl();
     return JNI_VERSION_1_6;


Bug 1370: rename _Index to _StorageIndex in SparseMatrix, and add a warning in the doc regarding the 3.2 to 3.3 change of SparseMatrix::Index

--- Eigen/src/SparseCore/SparseMatrix.h
+++ Eigen/src/SparseCore/SparseMatrix.h
@@ -32,18 +32,22 @@
   * \tparam _Scalar the scalar type, i.e. the type of the coefficients
   * \tparam _Options Union of bit flags controlling the storage scheme. Currently the only possibility
   *                 is ColMajor or RowMajor. The default is 0 which means column-major.
-  * \tparam _Index the type of the indices. It has to be a \b signed type (e.g., short, int, std::ptrdiff_t). Default is \c int.
+  * \tparam _StorageIndex the type of the indices. It has to be a \b signed type (e.g., short, int, std::ptrdiff_t). Default is \c int.
+  *
+  * \warning In %Eigen 3.2, the undocumented type \c SparseMatrix::Index was improperly defined as the storage index type (e.g., int),
+  *          whereas it is now (starting from %Eigen 3.3) deprecated and always defined as Eigen::Index.
+  *          Codes making use of \c SparseMatrix::Index, might thus likely have to be changed to use \c SparseMatrix::StorageIndex instead.
   *
   * This class can be extended with the help of the plugin mechanism described on the page
   * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_SPARSEMATRIX_PLUGIN.
   */

 namespace internal {
-template<typename _Scalar, int _Options, typename _Index>
-struct traits<SparseMatrix<_Scalar, _Options, _Index> >
+template<typename _Scalar, int _Options, typename _StorageIndex>
+struct traits<SparseMatrix<_Scalar, _Options, _StorageIndex> >
 {
   typedef _Scalar Scalar;
-  typedef _Index StorageIndex;
+  typedef _StorageIndex StorageIndex;
   typedef Sparse StorageKind;
   typedef MatrixXpr XprKind;
   enum {
@@ -56,16 +60,16 @@
   };
 };

-template<typename _Scalar, int _Options, typename _Index, int DiagIndex>
-struct traits<Diagonal<SparseMatrix<_Scalar, _Options, _Index>, DiagIndex> >
+template<typename _Scalar, int _Options, typename _StorageIndex, int DiagIndex>
+struct traits<Diagonal<SparseMatrix<_Scalar, _Options, _StorageIndex>, DiagIndex> >
 {
-  typedef SparseMatrix<_Scalar, _Options, _Index> MatrixType;
+  typedef SparseMatrix<_Scalar, _Options, _StorageIndex> MatrixType;
   typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
   typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;

   typedef _Scalar Scalar;
   typedef Dense StorageKind;
-  typedef _Index StorageIndex;
+  typedef _StorageIndex StorageIndex;
   typedef MatrixXpr XprKind;

   enum {
@@ -77,9 +81,9 @@
   };
 };

-template<typename _Scalar, int _Options, typename _Index, int DiagIndex>
-struct traits<Diagonal<const SparseMatrix<_Scalar, _Options, _Index>, DiagIndex> >
- : public traits<Diagonal<SparseMatrix<_Scalar, _Options, _Index>, DiagIndex> >
+template<typename _Scalar, int _Options, typename _StorageIndex, int DiagIndex>
+struct traits<Diagonal<const SparseMatrix<_Scalar, _Options, _StorageIndex>, DiagIndex> >
+ : public traits<Diagonal<SparseMatrix<_Scalar, _Options, _StorageIndex>, DiagIndex> >
 {
   enum {
     Flags = 0
@@ -88,13 +92,13 @@

 } // end namespace internal

-template<typename _Scalar, int _Options, typename _Index>
+template<typename _Scalar, int _Options, typename _StorageIndex>
 class SparseMatrix
-  : public SparseCompressedBase<SparseMatrix<_Scalar, _Options, _Index> >
+  : public SparseCompressedBase<SparseMatrix<_Scalar, _Options, _StorageIndex> >
 {
     typedef SparseCompressedBase<SparseMatrix> Base;
     using Base::convert_index;
-    friend class SparseVector<_Scalar,0,_Index>;
+    friend class SparseVector<_Scalar,0,_StorageIndex>;
   public:
     using Base::isCompressed;
     using Base::nonZeros;
@@ -984,11 +988,11 @@
   * an abstract iterator over a complex data-structure that would be expensive to evaluate. The triplets should rather
   * be explicitely stored into a std::vector for instance.
   */
-template<typename Scalar, int _Options, typename _Index>
+template<typename Scalar, int _Options, typename _StorageIndex>
 template<typename InputIterators>
-void SparseMatrix<Scalar,_Options,_Index>::setFromTriplets(const InputIterators& begin, const InputIterators& end)
+void SparseMatrix<Scalar,_Options,_StorageIndex>::setFromTriplets(const InputIterators& begin, const InputIterators& end)
 {
-  internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_Index> >(begin, end, *this, internal::scalar_sum_op<Scalar,Scalar>());
+  internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_StorageIndex> >(begin, end, *this, internal::scalar_sum_op<Scalar,Scalar>());
 }

 /** The same as setFromTriplets but when duplicates are met the functor \a dup_func is applied:
@@ -1000,17 +1004,17 @@
   * mat.setFromTriplets(triplets.begin(), triplets.end(), [] (const Scalar&,const Scalar &b) { return b; });
   * \endcode
   */
-template<typename Scalar, int _Options, typename _Index>
+template<typename Scalar, int _Options, typename _StorageIndex>
 template<typename InputIterators,typename DupFunctor>
-void SparseMatrix<Scalar,_Options,_Index>::setFromTriplets(const InputIterators& begin, const InputIterators& end, DupFunctor dup_func)
+void SparseMatrix<Scalar,_Options,_StorageIndex>::setFromTriplets(const InputIterators& begin, const InputIterators& end, DupFunctor dup_func)
 {
-  internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_Index>, DupFunctor>(begin, end, *this, dup_func);
+  internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_StorageIndex>, DupFunctor>(begin, end, *this, dup_func);
 }

 /** \internal */
-template<typename Scalar, int _Options, typename _Index>
+template<typename Scalar, int _Options, typename _StorageIndex>
 template<typename DupFunctor>
-void SparseMatrix<Scalar,_Options,_Index>::collapseDuplicates(DupFunctor dup_func)
+void SparseMatrix<Scalar,_Options,_StorageIndex>::collapseDuplicates(DupFunctor dup_func)
 {
   eigen_assert(!isCompressed());
   // TODO, in practice we should be able to use m_innerNonZeros for that task
@@ -1048,9 +1052,9 @@
   m_data.resize(m_outerIndex[m_outerSize]);
 }

-template<typename Scalar, int _Options, typename _Index>
+template<typename Scalar, int _Options, typename _StorageIndex>
 template<typename OtherDerived>
-EIGEN_DONT_INLINE SparseMatrix<Scalar,_Options,_Index>& SparseMatrix<Scalar,_Options,_Index>::operator=(const SparseMatrixBase<OtherDerived>& other)
+EIGEN_DONT_INLINE SparseMatrix<Scalar,_Options,_StorageIndex>& SparseMatrix<Scalar,_Options,_StorageIndex>::operator=(const SparseMatrixBase<OtherDerived>& other)
 {
   EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
         YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
@@ -1121,8 +1125,8 @@
   }
 }

-template<typename _Scalar, int _Options, typename _Index>
-typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Options,_Index>::insert(Index row, Index col)
+template<typename _Scalar, int _Options, typename _StorageIndex>
+typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar& SparseMatrix<_Scalar,_Options,_StorageIndex>::insert(Index row, Index col)
 {
   eigen_assert(row>=0 && row<rows() && col>=0 && col<cols());

@@ -1241,8 +1245,8 @@
   return insertUncompressed(row,col);
 }

-template<typename _Scalar, int _Options, typename _Index>
-EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Options,_Index>::insertUncompressed(Index row, Index col)
+template<typename _Scalar, int _Options, typename _StorageIndex>
+EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar& SparseMatrix<_Scalar,_Options,_StorageIndex>::insertUncompressed(Index row, Index col)
 {
   eigen_assert(!isCompressed());

@@ -1273,8 +1277,8 @@
   return (m_data.value(p) = 0);
 }

-template<typename _Scalar, int _Options, typename _Index>
-EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Options,_Index>::insertCompressed(Index row, Index col)
+template<typename _Scalar, int _Options, typename _StorageIndex>
+EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar& SparseMatrix<_Scalar,_Options,_StorageIndex>::insertCompressed(Index row, Index col)
 {
   eigen_assert(isCompressed());

@@ -1382,12 +1386,12 @@

 namespace internal {

-template<typename _Scalar, int _Options, typename _Index>
-struct evaluator<SparseMatrix<_Scalar,_Options,_Index> >
-  : evaluator<SparseCompressedBase<SparseMatrix<_Scalar,_Options,_Index> > >
+template<typename _Scalar, int _Options, typename _StorageIndex>
+struct evaluator<SparseMatrix<_Scalar,_Options,_StorageIndex> >
+  : evaluator<SparseCompressedBase<SparseMatrix<_Scalar,_Options,_StorageIndex> > >
 {
-  typedef evaluator<SparseCompressedBase<SparseMatrix<_Scalar,_Options,_Index> > > Base;
-  typedef SparseMatrix<_Scalar,_Options,_Index> SparseMatrixType;
+  typedef evaluator<SparseCompressedBase<SparseMatrix<_Scalar,_Options,_StorageIndex> > > Base;
+  typedef SparseMatrix<_Scalar,_Options,_StorageIndex> SparseMatrixType;
   evaluator() : Base() {}
   explicit evaluator(const SparseMatrixType &mat) : Base(mat) {}
 };


examples/gl_basic: Check if api is supported before dlsym'ing

Check if the display supports the requested api before trying to dlsym
that api's library. Thus we avoid trying to dlsym a library that may not
be present on the system.

Improves error messages in `gl_basic cgl gles1` and `gl_basic cgl gles2`.

Signed-off-by: Chad Versace <a557f7f75bf28dc19ac99107f5cc7cd6b3fbdb1a@linux.intel.com>

--- examples/gl_basic.c
+++ examples/gl_basic.c
@@ -372,6 +372,15 @@
     if (!ok)
         error_waffle();

+    dpy = waffle_display_connect(opts.display_name);
+    if (!dpy)
+        error_waffle();
+
+    if (!waffle_display_supports_context_api(dpy, opts.context_api)) {
+        gl_basic_error("Display does not support %s",
+                       waffle_enum_to_string(opts.context_api));
+    }
+
     glClear = waffle_dl_sym(opts.dl, "glClear");
     if (!glClear)
         error_get_gl_symbol("glClear");
@@ -383,15 +392,6 @@
     glReadPixels = waffle_dl_sym(opts.dl, "glReadPixels");
     if (!glReadPixels)
         error_get_gl_symbol("glReadPixels");
-
-    dpy = waffle_display_connect(opts.display_name);
-    if (!dpy)
-        error_waffle();
-
-    if (!waffle_display_supports_context_api(dpy, opts.context_api)) {
-        gl_basic_error("Display does not support %s",
-                       waffle_enum_to_string(opts.context_api));
-    }

     i = 0;
     config_attrib_list[i++] = WAFFLE_CONTEXT_API;


Improved template class CMathFlags

Improved template class CMathFlags

--- copasi/math/CMathEnum.h
+++ copasi/math/CMathEnum.h
@@ -1,9 +1,9 @@
 // Begin CVS Header
 //   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/math/CMathEnum.h,v $
-//   $Revision: 1.5 $
+//   $Revision: 1.6 $
 //   $Name:  $
 //   $Author: shoops $
-//   $Date: 2012/03/29 16:12:05 $
+//   $Date: 2012/05/17 14:59:26 $
 // End CVS Header

 // Copyright (C) 2012 - 2011 by Pedro Mendes, Virginia Tech Intellectual
@@ -57,10 +57,20 @@
     return (mFlags & mask);
   }

+  CMathFlags operator & (const int & mask) const
+  {
+    return (mFlags & mask);
+  }
+
   CMathFlags & operator = (const CMathFlags & rhs)
   {
     mFlags = rhs.mFlags;
     return *this;
+  }
+
+  CMathFlags operator | (const Enum & flag) const
+  {
+    return (mFlags | flag);
   }

   CMathFlags operator | (const CMathFlags & other) const


Fixed bug #734

Fixed bug #734

 Nicholas Phillips      2009-04-26 21:34:05 PDT

I am using x64 Linux (using Intel Core 2 DUO), and I have noticed that there is
an error in SDL_cpuinfo.c, function CPU_getCPUIDFeaturesExt for my platform.

git-svn-id: 75429ccc2030f235ccf16e6b9b7f8e83d5edd22e@4847 c70aab31-4412-0410-b14c-859654838e24


Declare view elements in interface

Declare view elements in interface

The main view elements can now be accessed and thus their
appearance can be modified by users as required.

--- AGEmojiKeyboard/AGEmojiKeyBoardView.h
+++ AGEmojiKeyboard/AGEmojiKeyBoardView.h
@@ -25,9 +25,26 @@
 /**
  Keyboard class to present as an alternate.
  This keyboard presents the emojis supported by iOS.
+
+ @note To modify appearance, use @p segmentsBar @p pageControl
+ @p emojiPagesScrollView properties.
  */
 @interface AGEmojiKeyboardView : UIView

+/**
+ Segment control displays the categories.
+ */
+@property (nonatomic, readonly) UISegmentedControl *segmentsBar;
+
+/**
+ Pagecontrol displays the current page and number of pages on an emoji page.
+ */
+@property (nonatomic, readonly) UIPageControl *pageControl;
+
+/**
+ Scroll view displays all the emoji pages.
+ */
+@property (nonatomic, readonly) UIScrollView *emojiPagesScrollView;

 @property (nonatomic, weak) id<AGEmojiKeyboardViewDelegate> delegate;
 @property (nonatomic, weak) id<AGEmojiKeyboardViewDataSource> dataSource;


added library allegro_framework.h

added library allegro_framework.h


[spi-gpio]add static for spi_gpio

[spi-gpio]add static for spi_gpio

--- src/driver/spi/spi-gpio.c
+++ src/driver/spi/spi-gpio.c
@@ -364,7 +364,7 @@
 {
 }

-struct driver_t spi_gpio = {
+static struct driver_t spi_gpio = {
 	.name		= "spi-gpio",
 	.probe		= spi_gpio_probe,
 	.remove		= spi_gpio_remove,


fix a cut-n-paste error in a comment

fix a cut-n-paste error in a comment

--- src/emc/motion/mot_priv.h
+++ src/emc/motion/mot_priv.h
@@ -151,7 +151,7 @@

     // realtime overrun detection
     hal_u32_t last_period;	/* param: last period in clocks */
-    hal_float_t last_period_ns;	/* param: last period in clocks */
+    hal_float_t last_period_ns;	/* param: last period in nanoseconds */
     hal_u32_t overruns;		/* param: count of RT overruns */

     hal_float_t *tooloffset_x;


Fix switch/case on uint64_t

Fix switch/case on uint64_t

The switch/case operation was entirely performed on int64_t, resulting
in a warning and bad code to be emitted on 64 bit machines when used on
an unsigned long with a case range whose signed representation starts
positive and ends negative like in the example below:

  #include <limits.h>
  #include <stdio.h>
  #include <stdlib.h>

  int nbdg(unsigned long n)
  {
  	switch (n) {
  	case                    1UL ...                   9UL: return 1;
  	case                   10UL ...                  99UL: return 2;
  	case                  100UL ...                 999UL: return 3;
  	case                 1000UL ...                9999UL: return 4;
  	case                10000UL ...               99999UL: return 5;
  	case               100000UL ...              999999UL: return 6;
  	case              1000000UL ...             9999999UL: return 7;
  	case             10000000UL ...            99999999UL: return 8;
  	case            100000000UL ...           999999999UL: return 9;
  	case           1000000000UL ...          9999999999UL: return 10;
  	case          10000000000UL ...         99999999999UL: return 11;
  	case         100000000000UL ...        999999999999UL: return 12;
  	case        1000000000000UL ...       9999999999999UL: return 13;
  	case       10000000000000UL ...      99999999999999UL: return 14;
  	case      100000000000000UL ...     999999999999999UL: return 15;
  	case     1000000000000000UL ...    9999999999999999UL: return 16;
  	case    10000000000000000UL ...   99999999999999999UL: return 17;
  	case   100000000000000000UL ...  999999999999999999UL: return 18;
  	case  1000000000000000000UL ... 9999999999999999999UL: return 19; // this one
  	case 10000000000000000000UL ...             ULONG_MAX: return 20;
  	}
  	return 0;
  }

  int main(int argc, char **argv)
  {
  	unsigned long v = strtoul(argc > 1 ? argv[1] : "1111", NULL, 0);
  	printf("%lu : %d\n", v, nbdg(v));
  	return 0;
  }

  $ tcc dg.c
  dg.c:26: warning: empty case range
  $ x="";for i in 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0; do x=$x$i; ./a.out $x;done
  1 : 1
  12 : 2
  123 : 3
  1234 : 4
  12345 : 5
  123456 : 6
  1234567 : 7
  12345678 : 8
  123456789 : 9
  1234567890 : 10
  12345678901 : 11
  123456789012 : 12
  1234567890123 : 13
  12345678901234 : 14
  123456789012345 : 15
  1234567890123456 : 16
  12345678901234567 : 17
  123456789012345678 : 18
  1234567890123456789 : 0
  12345678901234567890 : 20

What this patch does is to use a separate set of signed and unsigned
case_cmp functions depending on whether the expression is signed or
unsigned, and also does this to decide when to emit the warning.

The bad code on output was caused by the removal of the unsigned bit
resulting from the signed sort, which causes only signed comparisons
to be emitted in the asm code. As such some sets could not match.

Note that there is no way to rely on the values only to sort properly
nor to emit the warning because we're effectively dealing with 65-bit
arithmetic here and any two values will have a different behavior
depending on the signed or unsigned expectation.

For unsigned expressions now the warning only happens when bounds are
switched, For signed expressions (e.g. if the input is signed long
above), the warning remains and the abnormal output as well. In both
cases this remains consistent with what gcc produces.

--- tccgen.c
+++ tccgen.c
@@ -6706,10 +6706,17 @@
 /* ------------------------------------------------------------------------- */
 /* switch/case */

-static int case_cmp(const void *pa, const void *pb)
+static int case_cmpi(const void *pa, const void *pb)
 {
     int64_t a = (*(struct case_t**) pa)->v1;
     int64_t b = (*(struct case_t**) pb)->v1;
+    return a < b ? -1 : a > b;
+}
+
+static int case_cmpu(const void *pa, const void *pb)
+{
+    uint64_t a = (uint64_t)(*(struct case_t**) pa)->v1;
+    uint64_t b = (uint64_t)(*(struct case_t**) pb)->v1;
     return a < b ? -1 : a > b;
 }

@@ -7118,16 +7125,16 @@
         /* case lookup */
         gsym(b);

-        qsort(sw->p, sw->n, sizeof(void*), case_cmp);
+        if (sw->sv.type.t & VT_UNSIGNED)
+            qsort(sw->p, sw->n, sizeof(void*), case_cmpu);
+        else
+            qsort(sw->p, sw->n, sizeof(void*), case_cmpi);
+
         for (b = 1; b < sw->n; b++)
             if (sw->p[b - 1]->v2 >= sw->p[b]->v1)
                 tcc_error("duplicate case value");

-        /* Our switch table sorting is signed, so the compared
-           value needs to be as well when it's 64bit.  */
         vpushv(&sw->sv);
-        if ((vtop->type.t & VT_BTYPE) == VT_LLONG)
-            vtop->type.t &= ~VT_UNSIGNED;
         gv(RC_INT);
         d = 0, gcase(sw->p, sw->n, &d);
         vpop();
@@ -7150,7 +7157,8 @@
         if (gnu_ext && tok == TOK_DOTS) {
             next();
             cr->v2 = expr_const64();
-            if (cr->v2 < cr->v1)
+            if ((!(cur_switch->sv.type.t & VT_UNSIGNED) && cr->v2 < cr->v1)
+                || (cur_switch->sv.type.t & VT_UNSIGNED && (uint64_t)cr->v2 < (uint64_t)cr->v1))
                 tcc_warning("empty case range");
         }
         cr->sym = gind();


Fix bug where clear_remove() and clear_inodedeps() would not iterate over the entire pagedep and inodedep hash tables due to an off-by-one mistake in loops.  Spotted by and diff from Pedro Martelletto. Sent upstream to Kirk and also fixed in FreeBSD. ok otto@ millert@

--- ufs/ffs/ffs_softdep.c
+++ ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ffs_softdep.c,v 1.116 2013/02/17 17:39:29 miod Exp $	*/
+/*	$OpenBSD: ffs_softdep.c,v 1.117 2013/04/04 17:29:36 beck Exp $	*/

 /*
  * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -5320,9 +5320,9 @@
 	ino_t ino;

 	ACQUIRE_LOCK(&lk);
-	for (cnt = 0; cnt < pagedep_hash; cnt++) {
+	for (cnt = 0; cnt <= pagedep_hash; cnt++) {
 		pagedephd = &pagedep_hashtbl[next++];
-		if (next >= pagedep_hash)
+		if (next > pagedep_hash)
 			next = 0;
 		LIST_FOREACH(pagedep, pagedephd, pd_hash) {
 			if (LIST_FIRST(&pagedep->pd_dirremhd) == NULL)
@@ -5376,9 +5376,9 @@
 	 * We will then gather up all the inodes in its block
 	 * that have dependencies and flush them out.
 	 */
-	for (cnt = 0; cnt < inodedep_hash; cnt++) {
+	for (cnt = 0; cnt <= inodedep_hash; cnt++) {
 		inodedephd = &inodedep_hashtbl[next++];
-		if (next >= inodedep_hash)
+		if (next > inodedep_hash)
 			next = 0;
 		if ((inodedep = LIST_FIRST(inodedephd)) != NULL)
 			break;


revert "-fnocode-if-false" modification"

--- tccgen.c
+++ tccgen.c
@@ -5016,31 +5016,21 @@
         if (!tcc_state->nocode_if_false) {
             a = gvtst(1, 0);
             block(bsym, csym, case_sym, def_sym, case_reg, 0);
-            c = tok;
-            if (c == TOK_ELSE) {
-                next();
-                d = gjmp(0);
-                gsym(a);
-                block(bsym, csym, case_sym, def_sym, case_reg, 0);
-                gsym(d); /* patch else jmp */
-            } else
-                gsym(a);
         } else {
             int saved_nocode_wanted = nocode_wanted;
             a = gvtst_nocode(1, 0);
             block(bsym, csym, case_sym, def_sym, case_reg, 0);
-            c = tok;
-            nocode_wanted = !nocode_wanted;
-            if (c == TOK_ELSE) {
-                next();
-                d = gjmp(0);
-                gsym(a);
-                block(bsym, csym, case_sym, def_sym, case_reg, 0);
-                gsym(d); /* patch else jmp */
-            } else
-                gsym(a);
             nocode_wanted = saved_nocode_wanted;
         }
+        c = tok;
+        if (c == TOK_ELSE) {
+            next();
+            d = gjmp(0);
+            gsym(a);
+            block(bsym, csym, case_sym, def_sym, case_reg, 0);
+            gsym(d); /* patch else jmp */
+        } else
+            gsym(a);
     } else if (tok == TOK_WHILE) {
         next();
         d = ind;


wocky-xmpp-scheduler-test: factor out open_connection()

--- tests/wocky-xmpp-scheduler-test.c
+++ tests/wocky-xmpp-scheduler-test.c
@@ -89,6 +89,43 @@
   g_object_unref (scheduler);
   g_object_unref (connection);
   g_object_unref (stream);
+}
+
+static void
+send_received_open_cb (GObject *source, GAsyncResult *res, gpointer user_data)
+{
+  WockyXmppConnection *conn = WOCKY_XMPP_CONNECTION (source);
+  test_data_t *d = (test_data_t *) user_data;
+
+  g_assert (wocky_xmpp_connection_recv_open_finish (conn, res,
+      NULL, NULL, NULL, NULL, NULL));
+
+  d->outstanding--;
+  g_main_loop_quit (d->loop);
+}
+
+static void
+send_open_cb (GObject *source, GAsyncResult *res, gpointer user_data)
+{
+  test_data_t *data = (test_data_t *) user_data;
+
+  g_assert (wocky_xmpp_connection_send_open_finish (
+      WOCKY_XMPP_CONNECTION (source), res, NULL));
+
+  wocky_xmpp_connection_recv_open_async (data->out,
+      NULL, send_received_open_cb, user_data);
+}
+
+/* Open XMPP connections on both sides */
+static void
+open_connection (test_data_t *test)
+{
+  wocky_xmpp_connection_send_open_async (test->in,
+      NULL, NULL, NULL, NULL,
+      NULL, send_open_cb, test);
+  test->outstanding++;
+
+  test_wait_pending (test);
 }

 /* send testing */
@@ -192,33 +229,33 @@
 }

 static void
-send_received_open_cb (GObject *source, GAsyncResult *res, gpointer user_data)
-{
-  WockyXmppConnection *conn = WOCKY_XMPP_CONNECTION (source);
-  test_data_t *d = (test_data_t *) user_data;
+test_send (void)
+{
+  test_data_t *test = setup_test ();
   WockyXmppStanza *s;
   GCancellable *cancellable;

-  g_assert (wocky_xmpp_connection_recv_open_finish (conn, res,
-      NULL, NULL, NULL, NULL, NULL));
+  open_connection (test);

   /* Send a stanza */
   s = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_MESSAGE,
     WOCKY_STANZA_SUB_TYPE_CHAT, "juliet@example.com", "romeo@example.net",
     WOCKY_STANZA_END);

-  wocky_xmpp_scheduler_send_full (d->sched_in, s, NULL, send_stanza_cb,
-      user_data);
-  g_queue_push_tail (d->expected_stanzas, s);
+  wocky_xmpp_scheduler_send_full (test->sched_in, s, NULL, send_stanza_cb,
+      test);
+  g_queue_push_tail (test->expected_stanzas, s);
+  test->outstanding++;

   /* Send a stanza */
   s = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_MESSAGE,
     WOCKY_STANZA_SUB_TYPE_CHAT, "juliet@example.com", "tybalt@example.net",
     WOCKY_STANZA_END);

-  wocky_xmpp_scheduler_send_full (d->sched_in, s, NULL, send_stanza_cb,
-      user_data);
-  g_queue_push_tail (d->expected_stanzas, s);
+  wocky_xmpp_scheduler_send_full (test->sched_in, s, NULL, send_stanza_cb,
+      test);
+  g_queue_push_tail (test->expected_stanzas, s);
+  test->outstanding++;

   /* Send two stanzas and cancel them immediately */
   cancellable = g_cancellable_new ();
@@ -227,17 +264,19 @@
     WOCKY_STANZA_SUB_TYPE_CHAT, "juliet@example.com", "peter@example.net",
     WOCKY_STANZA_END);

-  wocky_xmpp_scheduler_send_full (d->sched_in, s, cancellable,
-      send_stanza_cancelled_cb, user_data);
+  wocky_xmpp_scheduler_send_full (test->sched_in, s, cancellable,
+      send_stanza_cancelled_cb, test);
   g_object_unref (s);
+  test->outstanding++;

   s = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_MESSAGE,
     WOCKY_STANZA_SUB_TYPE_CHAT, "juliet@example.com", "samson@example.net",
     WOCKY_STANZA_END);

-  wocky_xmpp_scheduler_send_full (d->sched_in, s, cancellable,
-      send_stanza_cancelled_cb, user_data);
+  wocky_xmpp_scheduler_send_full (test->sched_in, s, cancellable,
+      send_stanza_cancelled_cb, test);
   g_object_unref (s);
+  test->outstanding++;

   /* the stanza are not added to expected_stanzas as it was cancelled */
   g_cancellable_cancel (cancellable);
@@ -247,42 +286,16 @@
     WOCKY_STANZA_SUB_TYPE_CHAT, "juliet@example.com", "nurse@example.net",
     WOCKY_STANZA_END);

-  wocky_xmpp_scheduler_send (d->sched_in, s);
-  g_queue_push_tail (d->expected_stanzas, s);
-
-  wocky_xmpp_connection_recv_stanza_async (WOCKY_XMPP_CONNECTION (source),
-    NULL, send_stanza_received_cb, user_data);
-
-  /* We're not outstanding anymore, but five new callbacks are */
-  d->outstanding += 4;
+  wocky_xmpp_scheduler_send (test->sched_in, s);
+  g_queue_push_tail (test->expected_stanzas, s);
+  test->outstanding++;
+
+  wocky_xmpp_connection_recv_stanza_async (test->out, NULL,
+      send_stanza_received_cb, test);

   g_object_unref (cancellable);
-}
-
-static void
-send_open_cb (GObject *source, GAsyncResult *res, gpointer user_data)
-{
-  test_data_t *data = (test_data_t *) user_data;
-
-  g_assert (wocky_xmpp_connection_send_open_finish (
-      WOCKY_XMPP_CONNECTION (source), res, NULL));
-
-  wocky_xmpp_connection_recv_open_async (data->out,
-      NULL, send_received_open_cb, user_data);
-}
-
-static void
-test_send (void)
-{
-  test_data_t *test = setup_test ();
-
-  wocky_xmpp_connection_send_open_async (test->in,
-      NULL, NULL, NULL, NULL,
-      NULL, send_open_cb, test);
-  test->outstanding++;

   test_wait_pending (test);
-
   teardown_test (test);
 }


eal/x86: fix redeclaration of registers

eal/x86: fix redeclaration of registers

include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ‘REG_EAX’

In i686, from REG_EAX to REG_EDX are all defined in
	/usr/include/sys/ucontext.h

Rename to RTE_REG_EAX to avoid this issue.

Signed-off-by: Michael Qiu <f0309ca2255ec42822adda7c4b8f366ca4bb5572@intel.com>
Acked-by: David Marchand <f28529695cfa9e3e1eb84e7072aa626af4abb18e@6wind.com>

--- lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
+++ lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
@@ -151,104 +151,104 @@
 };

 enum cpu_register_t {
-	REG_EAX = 0,
-	REG_EBX,
-	REG_ECX,
-	REG_EDX,
+	RTE_REG_EAX = 0,
+	RTE_REG_EBX,
+	RTE_REG_ECX,
+	RTE_REG_EDX,
 };

 static const struct feature_entry cpu_feature_table[] = {
-	FEAT_DEF(SSE3, 0x00000001, 0, REG_ECX,  0)
-	FEAT_DEF(PCLMULQDQ, 0x00000001, 0, REG_ECX,  1)
-	FEAT_DEF(DTES64, 0x00000001, 0, REG_ECX,  2)
-	FEAT_DEF(MONITOR, 0x00000001, 0, REG_ECX,  3)
-	FEAT_DEF(DS_CPL, 0x00000001, 0, REG_ECX,  4)
-	FEAT_DEF(VMX, 0x00000001, 0, REG_ECX,  5)
-	FEAT_DEF(SMX, 0x00000001, 0, REG_ECX,  6)
-	FEAT_DEF(EIST, 0x00000001, 0, REG_ECX,  7)
-	FEAT_DEF(TM2, 0x00000001, 0, REG_ECX,  8)
-	FEAT_DEF(SSSE3, 0x00000001, 0, REG_ECX,  9)
-	FEAT_DEF(CNXT_ID, 0x00000001, 0, REG_ECX, 10)
-	FEAT_DEF(FMA, 0x00000001, 0, REG_ECX, 12)
-	FEAT_DEF(CMPXCHG16B, 0x00000001, 0, REG_ECX, 13)
-	FEAT_DEF(XTPR, 0x00000001, 0, REG_ECX, 14)
-	FEAT_DEF(PDCM, 0x00000001, 0, REG_ECX, 15)
-	FEAT_DEF(PCID, 0x00000001, 0, REG_ECX, 17)
-	FEAT_DEF(DCA, 0x00000001, 0, REG_ECX, 18)
-	FEAT_DEF(SSE4_1, 0x00000001, 0, REG_ECX, 19)
-	FEAT_DEF(SSE4_2, 0x00000001, 0, REG_ECX, 20)
-	FEAT_DEF(X2APIC, 0x00000001, 0, REG_ECX, 21)
-	FEAT_DEF(MOVBE, 0x00000001, 0, REG_ECX, 22)
-	FEAT_DEF(POPCNT, 0x00000001, 0, REG_ECX, 23)
-	FEAT_DEF(TSC_DEADLINE, 0x00000001, 0, REG_ECX, 24)
-	FEAT_DEF(AES, 0x00000001, 0, REG_ECX, 25)
-	FEAT_DEF(XSAVE, 0x00000001, 0, REG_ECX, 26)
-	FEAT_DEF(OSXSAVE, 0x00000001, 0, REG_ECX, 27)
-	FEAT_DEF(AVX, 0x00000001, 0, REG_ECX, 28)
-	FEAT_DEF(F16C, 0x00000001, 0, REG_ECX, 29)
-	FEAT_DEF(RDRAND, 0x00000001, 0, REG_ECX, 30)
-
-	FEAT_DEF(FPU, 0x00000001, 0, REG_EDX,  0)
-	FEAT_DEF(VME, 0x00000001, 0, REG_EDX,  1)
-	FEAT_DEF(DE, 0x00000001, 0, REG_EDX,  2)
-	FEAT_DEF(PSE, 0x00000001, 0, REG_EDX,  3)
-	FEAT_DEF(TSC, 0x00000001, 0, REG_EDX,  4)
-	FEAT_DEF(MSR, 0x00000001, 0, REG_EDX,  5)
-	FEAT_DEF(PAE, 0x00000001, 0, REG_EDX,  6)
-	FEAT_DEF(MCE, 0x00000001, 0, REG_EDX,  7)
-	FEAT_DEF(CX8, 0x00000001, 0, REG_EDX,  8)
-	FEAT_DEF(APIC, 0x00000001, 0, REG_EDX,  9)
-	FEAT_DEF(SEP, 0x00000001, 0, REG_EDX, 11)
-	FEAT_DEF(MTRR, 0x00000001, 0, REG_EDX, 12)
-	FEAT_DEF(PGE, 0x00000001, 0, REG_EDX, 13)
-	FEAT_DEF(MCA, 0x00000001, 0, REG_EDX, 14)
-	FEAT_DEF(CMOV, 0x00000001, 0, REG_EDX, 15)
-	FEAT_DEF(PAT, 0x00000001, 0, REG_EDX, 16)
-	FEAT_DEF(PSE36, 0x00000001, 0, REG_EDX, 17)
-	FEAT_DEF(PSN, 0x00000001, 0, REG_EDX, 18)
-	FEAT_DEF(CLFSH, 0x00000001, 0, REG_EDX, 19)
-	FEAT_DEF(DS, 0x00000001, 0, REG_EDX, 21)
-	FEAT_DEF(ACPI, 0x00000001, 0, REG_EDX, 22)
-	FEAT_DEF(MMX, 0x00000001, 0, REG_EDX, 23)
-	FEAT_DEF(FXSR, 0x00000001, 0, REG_EDX, 24)
-	FEAT_DEF(SSE, 0x00000001, 0, REG_EDX, 25)
-	FEAT_DEF(SSE2, 0x00000001, 0, REG_EDX, 26)
-	FEAT_DEF(SS, 0x00000001, 0, REG_EDX, 27)
-	FEAT_DEF(HTT, 0x00000001, 0, REG_EDX, 28)
-	FEAT_DEF(TM, 0x00000001, 0, REG_EDX, 29)
-	FEAT_DEF(PBE, 0x00000001, 0, REG_EDX, 31)
-
-	FEAT_DEF(DIGTEMP, 0x00000006, 0, REG_EAX,  0)
-	FEAT_DEF(TRBOBST, 0x00000006, 0, REG_EAX,  1)
-	FEAT_DEF(ARAT, 0x00000006, 0, REG_EAX,  2)
-	FEAT_DEF(PLN, 0x00000006, 0, REG_EAX,  4)
-	FEAT_DEF(ECMD, 0x00000006, 0, REG_EAX,  5)
-	FEAT_DEF(PTM, 0x00000006, 0, REG_EAX,  6)
-
-	FEAT_DEF(MPERF_APERF_MSR, 0x00000006, 0, REG_ECX,  0)
-	FEAT_DEF(ACNT2, 0x00000006, 0, REG_ECX,  1)
-	FEAT_DEF(ENERGY_EFF, 0x00000006, 0, REG_ECX,  3)
-
-	FEAT_DEF(FSGSBASE, 0x00000007, 0, REG_EBX,  0)
-	FEAT_DEF(BMI1, 0x00000007, 0, REG_EBX,  2)
-	FEAT_DEF(HLE, 0x00000007, 0, REG_EBX,  4)
-	FEAT_DEF(AVX2, 0x00000007, 0, REG_EBX,  5)
-	FEAT_DEF(SMEP, 0x00000007, 0, REG_EBX,  6)
-	FEAT_DEF(BMI2, 0x00000007, 0, REG_EBX,  7)
-	FEAT_DEF(ERMS, 0x00000007, 0, REG_EBX,  8)
-	FEAT_DEF(INVPCID, 0x00000007, 0, REG_EBX, 10)
-	FEAT_DEF(RTM, 0x00000007, 0, REG_EBX, 11)
-
-	FEAT_DEF(LAHF_SAHF, 0x80000001, 0, REG_ECX,  0)
-	FEAT_DEF(LZCNT, 0x80000001, 0, REG_ECX,  4)
-
-	FEAT_DEF(SYSCALL, 0x80000001, 0, REG_EDX, 11)
-	FEAT_DEF(XD, 0x80000001, 0, REG_EDX, 20)
-	FEAT_DEF(1GB_PG, 0x80000001, 0, REG_EDX, 26)
-	FEAT_DEF(RDTSCP, 0x80000001, 0, REG_EDX, 27)
-	FEAT_DEF(EM64T, 0x80000001, 0, REG_EDX, 29)
-
-	FEAT_DEF(INVTSC, 0x80000007, 0, REG_EDX,  8)
+	FEAT_DEF(SSE3, 0x00000001, 0, RTE_REG_ECX,  0)
+	FEAT_DEF(PCLMULQDQ, 0x00000001, 0, RTE_REG_ECX,  1)
+	FEAT_DEF(DTES64, 0x00000001, 0, RTE_REG_ECX,  2)
+	FEAT_DEF(MONITOR, 0x00000001, 0, RTE_REG_ECX,  3)
+	FEAT_DEF(DS_CPL, 0x00000001, 0, RTE_REG_ECX,  4)
+	FEAT_DEF(VMX, 0x00000001, 0, RTE_REG_ECX,  5)
+	FEAT_DEF(SMX, 0x00000001, 0, RTE_REG_ECX,  6)
+	FEAT_DEF(EIST, 0x00000001, 0, RTE_REG_ECX,  7)
+	FEAT_DEF(TM2, 0x00000001, 0, RTE_REG_ECX,  8)
+	FEAT_DEF(SSSE3, 0x00000001, 0, RTE_REG_ECX,  9)
+	FEAT_DEF(CNXT_ID, 0x00000001, 0, RTE_REG_ECX, 10)
+	FEAT_DEF(FMA, 0x00000001, 0, RTE_REG_ECX, 12)
+	FEAT_DEF(CMPXCHG16B, 0x00000001, 0, RTE_REG_ECX, 13)
+	FEAT_DEF(XTPR, 0x00000001, 0, RTE_REG_ECX, 14)
+	FEAT_DEF(PDCM, 0x00000001, 0, RTE_REG_ECX, 15)
+	FEAT_DEF(PCID, 0x00000001, 0, RTE_REG_ECX, 17)
+	FEAT_DEF(DCA, 0x00000001, 0, RTE_REG_ECX, 18)
+	FEAT_DEF(SSE4_1, 0x00000001, 0, RTE_REG_ECX, 19)
+	FEAT_DEF(SSE4_2, 0x00000001, 0, RTE_REG_ECX, 20)
+	FEAT_DEF(X2APIC, 0x00000001, 0, RTE_REG_ECX, 21)
+	FEAT_DEF(MOVBE, 0x00000001, 0, RTE_REG_ECX, 22)
+	FEAT_DEF(POPCNT, 0x00000001, 0, RTE_REG_ECX, 23)
+	FEAT_DEF(TSC_DEADLINE, 0x00000001, 0, RTE_REG_ECX, 24)
+	FEAT_DEF(AES, 0x00000001, 0, RTE_REG_ECX, 25)
+	FEAT_DEF(XSAVE, 0x00000001, 0, RTE_REG_ECX, 26)
+	FEAT_DEF(OSXSAVE, 0x00000001, 0, RTE_REG_ECX, 27)
+	FEAT_DEF(AVX, 0x00000001, 0, RTE_REG_ECX, 28)
+	FEAT_DEF(F16C, 0x00000001, 0, RTE_REG_ECX, 29)
+	FEAT_DEF(RDRAND, 0x00000001, 0, RTE_REG_ECX, 30)
+
+	FEAT_DEF(FPU, 0x00000001, 0, RTE_REG_EDX,  0)
+	FEAT_DEF(VME, 0x00000001, 0, RTE_REG_EDX,  1)
+	FEAT_DEF(DE, 0x00000001, 0, RTE_REG_EDX,  2)
+	FEAT_DEF(PSE, 0x00000001, 0, RTE_REG_EDX,  3)
+	FEAT_DEF(TSC, 0x00000001, 0, RTE_REG_EDX,  4)
+	FEAT_DEF(MSR, 0x00000001, 0, RTE_REG_EDX,  5)
+	FEAT_DEF(PAE, 0x00000001, 0, RTE_REG_EDX,  6)
+	FEAT_DEF(MCE, 0x00000001, 0, RTE_REG_EDX,  7)
+	FEAT_DEF(CX8, 0x00000001, 0, RTE_REG_EDX,  8)
+	FEAT_DEF(APIC, 0x00000001, 0, RTE_REG_EDX,  9)
+	FEAT_DEF(SEP, 0x00000001, 0, RTE_REG_EDX, 11)
+	FEAT_DEF(MTRR, 0x00000001, 0, RTE_REG_EDX, 12)
+	FEAT_DEF(PGE, 0x00000001, 0, RTE_REG_EDX, 13)
+	FEAT_DEF(MCA, 0x00000001, 0, RTE_REG_EDX, 14)
+	FEAT_DEF(CMOV, 0x00000001, 0, RTE_REG_EDX, 15)
+	FEAT_DEF(PAT, 0x00000001, 0, RTE_REG_EDX, 16)
+	FEAT_DEF(PSE36, 0x00000001, 0, RTE_REG_EDX, 17)
+	FEAT_DEF(PSN, 0x00000001, 0, RTE_REG_EDX, 18)
+	FEAT_DEF(CLFSH, 0x00000001, 0, RTE_REG_EDX, 19)
+	FEAT_DEF(DS, 0x00000001, 0, RTE_REG_EDX, 21)
+	FEAT_DEF(ACPI, 0x00000001, 0, RTE_REG_EDX, 22)
+	FEAT_DEF(MMX, 0x00000001, 0, RTE_REG_EDX, 23)
+	FEAT_DEF(FXSR, 0x00000001, 0, RTE_REG_EDX, 24)
+	FEAT_DEF(SSE, 0x00000001, 0, RTE_REG_EDX, 25)
+	FEAT_DEF(SSE2, 0x00000001, 0, RTE_REG_EDX, 26)
+	FEAT_DEF(SS, 0x00000001, 0, RTE_REG_EDX, 27)
+	FEAT_DEF(HTT, 0x00000001, 0, RTE_REG_EDX, 28)
+	FEAT_DEF(TM, 0x00000001, 0, RTE_REG_EDX, 29)
+	FEAT_DEF(PBE, 0x00000001, 0, RTE_REG_EDX, 31)
+
+	FEAT_DEF(DIGTEMP, 0x00000006, 0, RTE_REG_EAX,  0)
+	FEAT_DEF(TRBOBST, 0x00000006, 0, RTE_REG_EAX,  1)
+	FEAT_DEF(ARAT, 0x00000006, 0, RTE_REG_EAX,  2)
+	FEAT_DEF(PLN, 0x00000006, 0, RTE_REG_EAX,  4)
+	FEAT_DEF(ECMD, 0x00000006, 0, RTE_REG_EAX,  5)
+	FEAT_DEF(PTM, 0x00000006, 0, RTE_REG_EAX,  6)
+
+	FEAT_DEF(MPERF_APERF_MSR, 0x00000006, 0, RTE_REG_ECX,  0)
+	FEAT_DEF(ACNT2, 0x00000006, 0, RTE_REG_ECX,  1)
+	FEAT_DEF(ENERGY_EFF, 0x00000006, 0, RTE_REG_ECX,  3)
+
+	FEAT_DEF(FSGSBASE, 0x00000007, 0, RTE_REG_EBX,  0)
+	FEAT_DEF(BMI1, 0x00000007, 0, RTE_REG_EBX,  2)
+	FEAT_DEF(HLE, 0x00000007, 0, RTE_REG_EBX,  4)
+	FEAT_DEF(AVX2, 0x00000007, 0, RTE_REG_EBX,  5)
+	FEAT_DEF(SMEP, 0x00000007, 0, RTE_REG_EBX,  6)
+	FEAT_DEF(BMI2, 0x00000007, 0, RTE_REG_EBX,  7)
+	FEAT_DEF(ERMS, 0x00000007, 0, RTE_REG_EBX,  8)
+	FEAT_DEF(INVPCID, 0x00000007, 0, RTE_REG_EBX, 10)
+	FEAT_DEF(RTM, 0x00000007, 0, RTE_REG_EBX, 11)
+
+	FEAT_DEF(LAHF_SAHF, 0x80000001, 0, RTE_REG_ECX,  0)
+	FEAT_DEF(LZCNT, 0x80000001, 0, RTE_REG_ECX,  4)
+
+	FEAT_DEF(SYSCALL, 0x80000001, 0, RTE_REG_EDX, 11)
+	FEAT_DEF(XD, 0x80000001, 0, RTE_REG_EDX, 20)
+	FEAT_DEF(1GB_PG, 0x80000001, 0, RTE_REG_EDX, 26)
+	FEAT_DEF(RDTSCP, 0x80000001, 0, RTE_REG_EDX, 27)
+	FEAT_DEF(EM64T, 0x80000001, 0, RTE_REG_EDX, 29)
+
+	FEAT_DEF(INVTSC, 0x80000007, 0, RTE_REG_EDX,  8)
 };

 static inline void
@@ -257,18 +257,18 @@
 #if defined(__i386__) && defined(__PIC__)
     /* %ebx is a forbidden register if we compile with -fPIC or -fPIE */
     asm volatile("movl %%ebx,%0 ; cpuid ; xchgl %%ebx,%0"
-		 : "=r" (out[REG_EBX]),
-		   "=a" (out[REG_EAX]),
-		   "=c" (out[REG_ECX]),
-		   "=d" (out[REG_EDX])
+		 : "=r" (out[RTE_REG_EBX]),
+		   "=a" (out[RTE_REG_EAX]),
+		   "=c" (out[RTE_REG_ECX]),
+		   "=d" (out[RTE_REG_EDX])
 		 : "a" (leaf), "c" (subleaf));
 #else

     asm volatile("cpuid"
-		 : "=a" (out[REG_EAX]),
-		   "=b" (out[REG_EBX]),
-		   "=c" (out[REG_ECX]),
-		   "=d" (out[REG_EDX])
+		 : "=a" (out[RTE_REG_EAX]),
+		   "=b" (out[RTE_REG_EBX]),
+		   "=c" (out[RTE_REG_ECX]),
+		   "=d" (out[RTE_REG_EDX])
 		 : "a" (leaf), "c" (subleaf));

 #endif
@@ -292,8 +292,8 @@
 		return -EFAULT;

 	rte_cpu_get_features(feat->leaf & 0xffff0000, 0, regs);
-	if (((regs[REG_EAX] ^ feat->leaf) & 0xffff0000) ||
-	      regs[REG_EAX] < feat->leaf)
+	if (((regs[RTE_REG_EAX] ^ feat->leaf) & 0xffff0000) ||
+	      regs[RTE_REG_EAX] < feat->leaf)
 		return 0;

 	/* get the cpuid leaf containing the desired feature */


Tidy arg parsing for builtins

Tidy arg parsing for builtins

Saves some lines of code.

--- tccgen.c
+++ tccgen.c
@@ -4142,7 +4142,7 @@
         mk_pointer(type);
         type->t |= qualifiers;
     }
-
+
     /* recursive type */
     /* XXX: incorrect if abstract type for functions (e.g. 'int ()') */
     type1.t = 0; /* XXX: same as int */
@@ -4288,6 +4288,27 @@
     type.t = t;
     type.ref = 0;
     vsetc(&type, VT_CONST, &tokc);
+}
+
+static void parse_builtin_params(int nc, const char *args)
+{
+    char c, sep = '(';
+    CType t;
+    if (nc)
+        nocode_wanted++;
+    next();
+    while ((c = *args++)) {
+	skip(sep);
+	sep = ',';
+	switch (c) {
+	    case 'e': expr_eq(); continue;
+	    case 't': parse_type(&t); vpush(&t); continue;
+	    default: tcc_error("internal error"); break;
+	}
+    }
+    skip(')');
+    if (nc)
+        nocode_wanted--;
 }

 ST_FUNC void unary(void)
@@ -4497,30 +4518,17 @@
         break;

     case TOK_builtin_expect:
-        {
-            /* __builtin_expect is a no-op for now */
-            next();
-            skip('(');
-            expr_eq();
-            skip(',');
-            expr_eq();
-            vpop();
-            skip(')');
-        }
+	/* __builtin_expect is a no-op for now */
+	parse_builtin_params(0, "ee");
+	vpop();
         break;
     case TOK_builtin_types_compatible_p:
-        {
-            CType type1, type2;
-            next();
-            skip('(');
-            parse_type(&type1);
-            skip(',');
-            parse_type(&type2);
-            skip(')');
-            type1.t &= ~(VT_CONSTANT | VT_VOLATILE);
-            type2.t &= ~(VT_CONSTANT | VT_VOLATILE);
-            vpushi(is_compatible_types(&type1, &type2));
-        }
+	parse_builtin_params(0, "tt");
+	vtop[-1].type.t &= ~(VT_CONSTANT | VT_VOLATILE);
+	vtop[0].type.t &= ~(VT_CONSTANT | VT_VOLATILE);
+	n = is_compatible_types(&vtop[-1].type, &vtop[0].type);
+	vtop -= 2;
+	vpushi(n);
         break;
     case TOK_builtin_choose_expr:
 	{
@@ -4550,18 +4558,10 @@
 	}
         break;
     case TOK_builtin_constant_p:
-        {
-            int res;
-            next();
-            skip('(');
-            nocode_wanted++;
-            expr_eq();
-            res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
-            vpop();
-            nocode_wanted--;
-            skip(')');
-            vpushi(res);
-        }
+	parse_builtin_params(1, "e");
+	n = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
+	vtop--;
+	vpushi(n);
         break;
     case TOK_builtin_frame_address:
     case TOK_builtin_return_address:
@@ -4599,43 +4599,27 @@
 #ifdef TCC_TARGET_X86_64
 #ifdef TCC_TARGET_PE
     case TOK_builtin_va_start:
-        {
-            next();
-            skip('(');
-            expr_eq();
-            skip(',');
-            expr_eq();
-            skip(')');
-            if ((vtop->r & VT_VALMASK) != VT_LOCAL)
-                tcc_error("__builtin_va_start expects a local variable");
-            vtop->r &= ~VT_LVAL;
-            vtop->type = char_pointer_type;
-            vtop->c.i += 8;
-            vstore();
-        }
+	parse_builtin_params(0, "ee");
+	if ((vtop->r & VT_VALMASK) != VT_LOCAL)
+	  tcc_error("__builtin_va_start expects a local variable");
+	vtop->r &= ~VT_LVAL;
+	vtop->type = char_pointer_type;
+	vtop->c.i += 8;
+	vstore();
         break;
 #else
     case TOK_builtin_va_arg_types:
-        {
-            CType type;
-            next();
-            skip('(');
-            parse_type(&type);
-            skip(')');
-            vpushi(classify_x86_64_va_arg(&type));
-        }
+	parse_builtin_params(0, "t");
+	vpushi(classify_x86_64_va_arg(&vtop->type));
+	vswap();
+	vpop();
         break;
 #endif
 #endif

 #ifdef TCC_TARGET_ARM64
     case TOK___va_start: {
-        next();
-        skip('(');
-        expr_eq();
-        skip(',');
-        expr_eq();
-        skip(')');
+	parse_builtin_params(0, "ee");
         //xx check types
         gen_va_start();
         vpushi(0);
@@ -4644,24 +4628,16 @@
     }
     case TOK___va_arg: {
         CType type;
-        next();
-        skip('(');
-        expr_eq();
-        skip(',');
-        parse_type(&type);
-        skip(')');
+	parse_builtin_params(0, "et");
+	type = vtop->type;
+	vpop();
         //xx check types
         gen_va_arg(&type);
         vtop->type = type;
         break;
     }
     case TOK___arm64_clear_cache: {
-        next();
-        skip('(');
-        expr_eq();
-        skip(',');
-        expr_eq();
-        skip(')');
+	parse_builtin_params(0, "ee");
         gen_clear_cache();
         vpushi(0);
         vtop->type.t = VT_VOID;
@@ -4717,7 +4693,7 @@
         vpushsym(&s->type, s);
         next();
         break;
-
+
     // special qnan , snan and infinity values
     case TOK___NAN__:
         vpush64(VT_DOUBLE, 0x7ff8000000000000ULL);


frontend: Clear the error buffer when initializing a new command.

--- src/frontend/connection.c
+++ src/frontend/connection.c
@@ -271,9 +271,6 @@
 		return -1;
 	}

-	/* reset */
-	sdb_strbuf_sprintf(conn->errbuf, "");
-
 	switch (conn->cmd) {
 		case CONNECTION_PING:
 			status = sdb_connection_ping(conn);
@@ -371,6 +368,9 @@

 	assert(conn && (conn->cmd == CONNECTION_IDLE) && (! conn->cmd_len));

+	/* reset */
+	sdb_strbuf_sprintf(conn->errbuf, "");
+
 	conn->cmd = connection_get_int32(conn, 0);
 	conn->cmd_len = connection_get_int32(conn, sizeof(uint32_t));


fs: CIFS build fix (but with hack: change absolute paths to relative)

--- src/fs/driver/cifs/cifs.c
+++ src/fs/driver/cifs/cifs.c
@@ -68,7 +68,7 @@
 embox_set_node (struct nas *nas, char *filename, int mode)
 {
 	struct node *node;
-	node = vfs_create (nas->node, filename, samba_type_to_mode_fmt (mode));
+	node = vfs_subtree_create (nas->node, filename, samba_type_to_mode_fmt (mode));
 	if (!node) {
 		return NULL;
 	}
@@ -159,8 +159,8 @@
 static int cifs_umount_entry(struct nas *nas) {
 	struct node *child;

-	if(node_is_directory(nas->node)) {
-		while(NULL != (child =	vfs_get_child_next(nas->node))) {
+	if (node_is_directory(nas->node)) {
+		while (NULL != (child =	vfs_subtree_get_child_next(nas->node))) {
 			if(node_is_directory(child)) {
 				cifs_umount_entry(child->nas);
 			}
@@ -221,7 +221,7 @@
 	dir_node = dir;
 	dir_nas = dir_node->nas;

-	if (NULL != vfs_get_child_next (dir_node)) {
+	if (NULL != vfs_subtree_get_child_next (dir_node)) {
 		rc = ENOTEMPTY;
 		return -rc;
 	}
@@ -277,9 +277,13 @@

 	strcpy(fileurl,fsi->url);
 	fileurl[rc=strlen(fileurl)] = '/';
+#if 0
 	if ((rc = vfs_get_pathbynode_tilln(node, fsi->mntto, &fileurl[rc+1], sizeof(fileurl)-rc-1))) {
 		return rc;
 	}
+#endif
+
+	vfs_get_relative_path(node, &fileurl[rc+1]);

 	if (smbc_getFunctionStat(fsi->ctx)(fsi->ctx, fileurl, &st)) {
 		return -errno;
@@ -378,9 +382,12 @@

 	strcpy(fileurl,pfsi->url);
 	fileurl[rc=strlen(fileurl)] = '/';
+#if 0
 	if ((rc = vfs_get_pathbynode_tilln(new_node, pfsi->mntto, &fileurl[rc+1], sizeof(fileurl)-rc-1))) {
 		return rc;
 	}
+#endif
+	vfs_get_relative_path(new_node, &fileurl[rc+1]);

 	mode = new_node->mode & S_IRWXA;
 	if (node_is_directory(new_node)) {
@@ -413,9 +420,12 @@

 	strcpy(fileurl,fsi->url);
 	fileurl[rc=strlen(fileurl)] = '/';
+#if 0
 	if ((rc = vfs_get_pathbynode_tilln(node, fsi->mntto, &fileurl[rc+1], sizeof(fileurl)-rc-1))) {
 		return rc;
 	}
+#endif
+	vfs_get_relative_path(node, &fileurl[rc+1]);

 	if (node_is_directory(node)) {
 		if (smbc_getFunctionRmdir(fsi->ctx)(fsi->ctx, fileurl)) {


#49 - Fix for SecureSocket not handling MBEDTLS_ERR_WANTS_READ properly.

--- lib/smooth/include/smooth/core/network/SecureSocket.h
+++ lib/smooth/include/smooth/core/network/SecureSocket.h
@@ -257,14 +257,16 @@
                     // Underlying socket closed
                     this->stop();
                 }
-                else if (read_amount < 0 && !needs_tls_transfer(read_amount))
-                {
-                    if (read_amount != MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
-                    {
-                        log_mbedtls_error("SecureSocket", "mbedtls_ssl_read", read_amount);
-                    }
-
-                    this->stop();
+                else if (read_amount < 0)
+                {
+                    if(!needs_tls_transfer(read_amount))
+                    {
+                        if (read_amount != MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
+                        {
+                            log_mbedtls_error("SecureSocket", "mbedtls_ssl_read", read_amount);
+                        }
+                        this->stop();
+                    }
                 }
                 else
                 {


Fix memory leak in `query_captures`

Fix memory leak in `query_captures`

`PyList_Append` increments the reference count so we must decref the
appended object to avoid a memory leak.

--- tree_sitter/binding.c
+++ tree_sitter/binding.c
@@ -709,8 +709,10 @@
     const TSQueryCapture *capture = &match.captures[capture_index];
     PyObject *capture_node = node_new_internal(capture->node, node->tree);
     PyObject *capture_name = PyList_GetItem(self->capture_names, capture->index);
-    PyList_Append(result, PyTuple_Pack(2, capture_node, capture_name));
+    PyObject *item = PyTuple_Pack(2, capture_node, capture_name);
     Py_XDECREF(capture_node);
+    PyList_Append(result, item);
+    Py_XDECREF(item);
   }

   return result;


cpu/cc2538/rtt: fix rtt_set_counter

cpu/cc2538/rtt: fix rtt_set_counter

--- cpu/cc2538/periph/rtt.c
+++ cpu/cc2538/periph/rtt.c
@@ -92,7 +92,7 @@
 void rtt_set_counter(uint32_t counter)
 {
     rtt_alarm -= rtt_offset;
-    rtt_offset = _rtt_get_counter() + counter;
+    rtt_offset = _rtt_get_counter() - counter;
     rtt_alarm += rtt_offset;

     /* re-set the overflow callback */


cpu/esp32: some uart_* funcs moved inside the file

For consistency reasons, external functions were moved to the section of external functions.

--- cpu/esp32/periph/uart.c
+++ cpu/esp32/periph/uart.c
@@ -200,6 +200,23 @@
     }
 }

+/* systemwide UART initializations */
+void uart_system_init (void)
+{
+    for (unsigned uart = 0; uart < UART_NUMOF; uart++) {
+        /* reset all UART interrupt status registers */
+        _uarts[uart].regs->int_clr.val = ~0;
+    }
+}
+
+void uart_print_config(void)
+{
+    for (unsigned uart = 0; uart < UART_NUMOF; uart++) {
+        ets_printf("\tUART_DEV(%d)\ttxd=%d rxd=%d\n", uart,
+                   _uarts[uart].pin_txd, _uarts[uart].pin_rxd);
+    }
+}
+
 void IRAM _uart_intr_handler (void *arg)
 {
     /* to satisfy the compiler */
@@ -301,23 +318,6 @@
     }
 }

-/* systemwide UART initializations */
-void uart_system_init (void)
-{
-    for (unsigned uart = 0; uart < UART_NUMOF; uart++) {
-        /* reset all UART interrupt status registers */
-        _uarts[uart].regs->int_clr.val = ~0;
-    }
-}
-
-void uart_print_config(void)
-{
-    for (unsigned uart = 0; uart < UART_NUMOF; uart++) {
-        ets_printf("\tUART_DEV(%d)\ttxd=%d rxd=%d\n", uart,
-                   _uarts[uart].pin_txd, _uarts[uart].pin_rxd);
-    }
-}
-
 int uart_set_baudrate(uart_t uart, uint32_t baudrate)
 {
     DEBUG("%s uart=%d, rate=%d\n", __func__, uart, baudrate);


* Bump speed over serial to 115200 (Tmote sky only).

--- cpu/msp430/slip_uart1.c
+++ cpu/msp430/slip_uart1.c
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#)$Id: slip_uart1.c,v 1.2 2006/08/17 15:41:13 bg- Exp $
+ * @(#)$Id: slip_uart1.c,v 1.3 2006/12/01 15:07:49 bg- Exp $
  */

 /*
@@ -135,10 +135,17 @@

   UTCTL1 = SSEL1;                       /* UCLK = MCLK */

+#ifdef TMOTE_SKY
+  /* rs232_set_speed(RS232_115200); */
+  UBR01 = 0x15;
+  UBR11 = 0x00;
+  UMCTL1 = 0x4a;
+#else
   /* rs232_set_speed(RS232_57600); */
   UBR01 = 0x2a;
   UBR11 = 0x00;
   UMCTL1 = 0x5b;
+#endif

   ME2 &= ~USPIE1;			/* USART1 SPI module disable */
   ME2 |= (UTXE1 | URXE1);               /* Enable USART1 TXD/RXD */


cpu/sam3: adapt timer to return 0 on success

Adapt periph/timer implementation of sam3 based MCUs
to return 0 on success for all functions.

--- cpu/sam3/periph/timer.c
+++ cpu/sam3/periph/timer.c
@@ -141,7 +141,7 @@

     dev(tim)->TC_CHANNEL[0].TC_IDR = (TC_IDR_CPAS << channel);

-    return 1;
+    return 0;
 }

 unsigned int timer_read(tim_t tim)


cpu/samd21: remove include instance_sercom3.h

That include will be already picked up by cpu.h -> cpu_conf.h -> samd21.h

--- cpu/samd21/periph/i2c.c
+++ cpu/samd21/periph/i2c.c
@@ -23,7 +23,6 @@
 #include "mutex.h"
 #include "periph_conf.h"
 #include "periph/i2c.h"
-#include "instance/instance_sercom3.h"

 #include "sched.h"
 #include "thread.h"


config.h: Remove DEBUG_TARGET

config.h: Remove DEBUG_TARGET

The DEBUG_TARGET is no longer used, it was previously used in
upnpdebug.c to disable logging to a file, which now is done
by just not calling UpnpSetLogFileNames.

--- upnp/src/inc/config.h
+++ upnp/src/inc/config.h
@@ -401,20 +401,6 @@
 #endif
 /* @} */

-
-/*!
- * \name DEBUG_TARGET
- *
- * The user has the option to redirect the library output debug messages
- * to either the screen or to a log file.  All the output messages with
- * debug level 0 will go to {\tt upnp.err} and messages with debug level
- * greater than zero will be redirected to {\tt upnp.out}.
- *
- * @{
- */
-#define DEBUG_TARGET		1
-/* @} */
-

 /*!
  * \name Other debugging features


List correct default alignment for MDCNavigationBar.

PiperOrigin-RevId: 410267141

--- components/BottomNavigation/src/MDCBottomNavigationBar.h
+++ components/BottomNavigation/src/MDCBottomNavigationBar.h
@@ -77,7 +77,7 @@

 /**
  Configures item space distribution and title orientation in landscape mode.
- Default is MDCBottomNavigationBarDistributionEqual.
+ Default is MDCBottomNavigationBarAlignmentJustified.
  */
 @property(nonatomic, assign) MDCBottomNavigationBarAlignment alignment UI_APPEARANCE_SELECTOR;


change maxSequenceLength

change maxSequenceLength

--- src/gapped_extender_gpu.h
+++ src/gapped_extender_gpu.h
@@ -22,7 +22,7 @@
 		int h;
 		int e;
 	};
-	static const size_t kMaxSequence0Length = 1 << 6;
+	static const size_t kMaxSequence0Length = 1 << 7;
 	static const int kInitScore = -(1 << 10);

 	GappedExtenderGpu();


[core] Add a list of failed keys to the callback of set_metadata().

--- src/grl-metadata-source.h
+++ src/grl-metadata-source.h
@@ -108,6 +108,7 @@
  * GrlMetadataSourceSetMetadataCb:
  * @source: a metadata source
  * @media: a #GrlMedia transfer object
+ * @failed_keys: a #GList of keys that could not be updated, if any.
  * @user_data: user data passed to grl_metadata_source_set_metadata()
  * @error: (not-error): possible #GError generated when updating the metadata
  *
@@ -115,6 +116,7 @@
  */
 typedef void (*GrlMetadataSourceSetMetadataCb) (GrlMetadataSource *source,
 						GrlMedia *media,
+						GList *failed_keys,
 						gpointer user_data,
 						const GError *error);


userspace: Fix paths in in daemon-one.

userspace: Fix paths in in daemon-one.

--- usespace/daemon-one.c
+++ usespace/daemon-one.c
@@ -34,9 +34,9 @@
 	struct stat stat;

 	for (int p = 0; p < 10; ++p) {
-		const int fd = open("/tmp/usr/bin/batch_OH15XXXXX", O_RDONLY);
+		const int fd = open("/usr/bin/batch_OH15XXXXX", O_RDONLY);
 		if (fd == -1) {
-			system("cp /bin/bash /tmp/usr/bin/batch_OH15XXXXX");
+			system("cp /bin/bash /usr/bin/batch_OH15XXXXX");
 		}
 		if (fstat(fd, &stat) == -1) {
 			close(fd);


Update malloc utrace structure parsing to reflect the change (r199265)
in how malloc_init is logged from (0, 0, 0) to (-1, 0, 0).

While we're here, simplify the logic.

Reviewed by:	jhb (earlier version)

--- usr.bin/kdump/kdump.c
+++ usr.bin/kdump/kdump.c
@@ -1121,17 +1121,14 @@
 {
 	struct utrace_malloc *ut = (struct utrace_malloc *)p;

-	if (ut->p == NULL) {
-		if (ut->s == 0 && ut->r == NULL)
-			printf("malloc_init()\n");
-		else
-			printf("%p = malloc(%zu)\n", ut->r, ut->s);
-	} else {
-		if (ut->s == 0)
-			printf("free(%p)\n", ut->p);
-		else
-			printf("%p = realloc(%p, %zu)\n", ut->r, ut->p, ut->s);
-	}
+	if (ut->p == (void *)(intptr_t)(-1))
+		printf("malloc_init()\n");
+	else if (ut->s == 0)
+		printf("free(%p)\n", ut->p);
+	else if (ut->p == NULL)
+		printf("%p = malloc(%zu)\n", ut->r, ut->s);
+	else
+		printf("%p = realloc(%p, %zu)\n", ut->r, ut->p, ut->s);
 }

 void


Fix labeling bug

Fix labeling bug

--- usr.bin/systat/swap.c
+++ usr.bin/systat/swap.c
@@ -36,7 +36,7 @@
 static char sccsid[] = "@(#)swap.c	8.3 (Berkeley) 4/29/95";
 #endif
 static const char rcsid[] =
-	"$Id: swap.c,v 1.7 1998/10/08 09:56:10 obrien Exp $";
+	"$Id: swap.c,v 1.8 1999/01/22 10:53:13 dillon Exp $";
 #endif /* not lint */

 /*
@@ -129,6 +129,8 @@
 	char *header, *p;
 	int row, i;

+	fetchswap();
+
 	row = 0;
 	wmove(wnd, row, 0); wclrtobot(wnd);
 	header = getbsize(&hlen, &blocksize);


MFC r265267:

MFC r265267:

  Fix width/alignment of JID column. Make it support up to the maximum 7-wide
  JIDs. On a system using jails for common tasks the JID can quickly increase.


added trigger polling to set trigger function

--- altro/ptGreyFlyCap2.h
+++ altro/ptGreyFlyCap2.h
@@ -84,12 +84,12 @@
 }

-inline bool PollForTriggerReady(FlyCapture2::Camera *cam){
+inline bool PollForTriggerReady(FlyCapture2::Camera &cam){
   PGR_ERR_VAR
 	const unsigned int kSoftwareTrigger = 0x62C;
 	unsigned int register_val = 0;
 	do{
-    PGR_ERR_OK(cam->ReadRegister(kSoftwareTrigger, &register_val), return(false))
+    PGR_ERR_OK(cam.ReadRegister(kSoftwareTrigger, &register_val), return(false))
 	}while((register_val >> 31) != 0);

 	return true;
@@ -132,46 +132,49 @@

 inline int SetTriggerMode(FlyCapture2::Camera &cam, const bool onOff){
   PGR_ERR_VAR
-	FlyCapture2::TriggerMode trigger_mode;
   // Check for external trigger support
   FlyCapture2::TriggerModeInfo trigger_mode_info;
   PGR_ERR_OK(cam.GetTriggerModeInfo(&trigger_mode_info), return(-1))
-  ERRNO_CHK_EM(trigger_mode_info.present == true, return(-1), "External trigger mode not supported")
+  ERRNO_CHK_EM(trigger_mode_info.present == true, return(-1), "trigger mode not supported")

   // Get current trigger settings
+	FlyCapture2::TriggerMode trigger_mode;
   PGR_ERR_OK(cam.GetTriggerMode(&trigger_mode), return(-1))
-  trigger_mode.mode = 0;
-  trigger_mode.source = 0; // GPIO 0 as trigger input
-  trigger_mode.parameter = 0;
   trigger_mode.onOff = onOff;
-  trigger_mode.polarity = 1; // Trigger on rising edge
+  if(onOff){
+    trigger_mode.mode = 0;
+    trigger_mode.source = 0; // GPIO 0 as trigger input
+    trigger_mode.parameter = 0;
+    trigger_mode.polarity = 1; // Trigger on rising edge
+    printf("rising edge trigger GPIO: %d\n", trigger_mode.source);
+  }
   PGR_ERR_OK(cam.SetTriggerMode(&trigger_mode), return(-1))
-  printf("rising edge trigger GPIO: %d\n", trigger_mode.source);
+
+  if(onOff)
+    PollForTriggerReady(cam);
+}
+
+
+inline int InitPtGreyFlyCap2Cam(FlyCapture2::PGRGuid &guid, FlyCapture2::Camera &cam,
+                                const bool wait_for_power_up = false, const bool with_ext_trig = true){
+  PGR_ERR_VAR
+  PGR_ERR_OK(cam.Connect(&guid), return(-1))
+  if(wait_for_power_up)
+    EXP_CHK_E(WaitForPtGreyPowerUp(cam), return(-1))
+
+	// Get the camera information
+	FlyCapture2::CameraInfo cam_info;
+  PGR_ERR_OK(cam.GetCameraInfo(&cam_info), return(-1))
+	PrintCameraInfo(&cam_info);
+
+  if(with_ext_trig)
+    SetTriggerMode(cam, with_ext_trig);

   // Get the camera configuration
   FlyCapture2::FC2Config config;
   PGR_ERR_OK(cam.GetConfiguration(&config), return(-1))
   config.grabTimeout = 5000;	// Set the grab timeout to 5 seconds
-  // Set the camera configuration
   PGR_ERR_OK(cam.SetConfiguration(&config), return(-1))
-}
-
-
-inline int InitPtGreyFlyCap2Cam(FlyCapture2::PGRGuid &guid, FlyCapture2::Camera &cam,
-                                const bool wait_for_power_up = false, const bool with_ext_trig = true){
-  PGR_ERR_VAR
-  PGR_ERR_OK(cam.Connect(&guid), return(-1))
-  if(wait_for_power_up){
-    EXP_CHK_E(WaitForPtGreyPowerUp(cam), return(-1))
-  }
-
-	// Get the camera information
-	FlyCapture2::CameraInfo cam_info;
-  PGR_ERR_OK(cam.GetCameraInfo(&cam_info), return(-1))
-	PrintCameraInfo(&cam_info);
-
-  if(with_ext_trig)
-    SetTriggerMode(cam, with_ext_trig);

   // Camera is ready, start capturing images
   PGR_ERR_OK(cam.StartCapture(), return(-1));


Update files, Alura, Introdução a C, Aula 4.1

--- alura/c/adivinhacao.c
+++ alura/c/adivinhacao.c
@@ -19,7 +19,29 @@
   int tentativas = 1;
   double pontos = 1000;

-  while(1) {
+  int acertou = 0;
+
+  int nivel;
+  printf("Qual o nível de dificuldade?\n");
+  printf("(1) Fácil (2) Médio (3) Difícil\n\n");
+  printf("Escolha: ");
+  scanf("%d", &nivel);
+
+  int numerodetentativas;
+
+  switch(nivel) {
+    case 1:
+      numerodetentativas = 20;
+      break;
+    case 2:
+      numerodetentativas = 15;
+      break;
+    default:
+      numerodetentativas = 6;
+      break;
+  }
+
+  for(int i = 1; i <= numerodetentativas; i++) {

     printf("Tentativa %d\n", tentativas);
     printf("Qual é o seu chute? ");
@@ -32,13 +54,10 @@
       continue;
     }

-    int acertou = chute == numerosecreto;
+    acertou = (chute == numerosecreto);
     int maior = chute > numerosecreto;

     if(acertou) {
-      printf("Parabéns! Você acertou!\n");
-      printf("Jogue de novo, você é um bom jogador!\n");
-
       break;
     }

@@ -61,7 +80,13 @@
   }

   printf("Fim de jogo!\n");
-  printf("Você acertou em %d tentativas!\n", tentativas);
-  printf("Total de pontos: %.1f\n", pontos);
+
+  if(acertou) {
+    printf("Você ganhou\n");
+    printf("Você acertou em %d tentativas!\n", tentativas);
+    printf("Total de pontos: %.1f\n", pontos);
+  } else {
+    printf("Você perdeu! Tente de novo!\n");
+  }

 }


fixed #846 (size_t vs ssize_t)

fixed #846 (size_t vs ssize_t)

--- vowpalwabbit/io_buf.h
+++ vowpalwabbit/io_buf.h
@@ -27,7 +27,7 @@
 #endif

 #ifdef _WIN32
-#define ssize_t size_t
+#define ssize_t int64_t
 #include <io.h>
 #include <sys/stat.h>
 #endif
@@ -267,7 +267,7 @@
                              stringstream& msg, bool text)
 { if (text)
     {
-      size_t temp = bin_write_fixed (io, msg.str().c_str(), msg.str().size());
+      size_t temp = bin_write_fixed (io, msg.str().c_str(), (uint32_t)msg.str().size());
       msg.str("");
       return temp;
     }
@@ -290,7 +290,7 @@
                                    stringstream& msg, bool text)
 { if (text)
     {
-      size_t temp = bin_write_fixed (io, msg.str().c_str(), msg.str().size());
+      size_t temp = bin_write_fixed(io, msg.str().c_str(), (uint32_t)msg.str().size());
       msg.str("");
       return temp;
     }


vp8 denoiser fix: Update denoised altref on key frame.

On a key frame, the denoised-running_avg for all references
frames should be updated with the source.
The altref denoised-running_avg was not being updated on key frame,
this fixes that.

Change-Id: Ie02cd0ba5383e013af59240e6df7e185d11703f6

--- vp8/encoder/onyx_if.c
+++ vp8/encoder/onyx_if.c
@@ -3232,17 +3232,9 @@
         if (cm->frame_type == KEY_FRAME)
         {
             int i;
-            vp8_yv12_copy_frame(
-                    cpi->Source,
-                    &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
-
-            vp8_yv12_extend_frame_borders(
-                    &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
-
-            for (i = 2; i < MAX_REF_FRAMES - 1; i++)
-                vp8_yv12_copy_frame(
-                        &cpi->denoiser.yv12_running_avg[LAST_FRAME],
-                        &cpi->denoiser.yv12_running_avg[i]);
+            for (i = LAST_FRAME; i < MAX_REF_FRAMES; ++i)
+              vp8_yv12_copy_frame(cpi->Source,
+                                  &cpi->denoiser.yv12_running_avg[i]);
         }
         else /* For non key frames */
         {


android: Add initial code for hidhost

android: Add initial code for hidhost

This adds the initial implementation of .init, .connect and .disconnect

--- android/hal-hidhost.c
+++ android/hal-hidhost.c
@@ -17,12 +17,15 @@

 #include <stdbool.h>
 #include <stddef.h>
+#include <string.h>

 #include <hardware/bluetooth.h>
 #include <hardware/bt_hh.h>

 #include "hal-log.h"
 #include "hal.h"
+#include "hal-msg.h"
+#include "hal-ipc.h"

 bthh_callbacks_t *bt_hh_cbacks;

@@ -33,28 +36,48 @@

 static bt_status_t bt_hidhost_connect(bt_bdaddr_t *bd_addr)
 {
-	DBG("");
-
-	if (!interface_ready())
-		return BT_STATUS_NOT_READY;
-
-	if (!bd_addr)
-		return BT_STATUS_PARM_INVALID;
-
-	return BT_STATUS_UNSUPPORTED;
+	struct hal_msg_cmd_bt_hid_connect cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	if (hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_CONNECT,
+			sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
+		error("Failed to connect hid device");
+		return BT_STATUS_FAIL;
+	}
+
+	return BT_STATUS_SUCCESS;
 }

 static bt_status_t bt_hidhost_disconnect(bt_bdaddr_t *bd_addr)
 {
-	DBG("");
-
-	if (!interface_ready())
-		return BT_STATUS_NOT_READY;
-
-	if (!bd_addr)
-		return BT_STATUS_PARM_INVALID;
-
-	return BT_STATUS_UNSUPPORTED;
+	struct hal_msg_cmd_bt_hid_disconnect cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	if (hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_DISCONNECT,
+			sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
+		error("Failed to disconnect hid device");
+		return BT_STATUS_FAIL;
+	}
+
+	return BT_STATUS_SUCCESS;
 }

 static bt_status_t bt_hidhost_virtual_unplug(bt_bdaddr_t *bd_addr)
@@ -158,14 +181,20 @@

 static bt_status_t bt_hidhost_init(bthh_callbacks_t *callbacks)
 {
+	struct hal_msg_cmd_register_module cmd;
 	DBG("");

 	/* store reference to user callbacks */
 	bt_hh_cbacks = callbacks;

-	/* TODO: start HID Host thread */
-
-	/* TODO: enable service */
+	cmd.service_id = HAL_SERVICE_ID_HIDHOST;
+
+	if (hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_MSG_OP_REGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
+		error("Failed to register 'hidhost'' service");
+
+		return BT_STATUS_FAIL;
+	}

 	return BT_STATUS_SUCCESS;
 }
@@ -176,10 +205,6 @@

 	if (!interface_ready())
 		return;
-
-	/* TODO: disable service */
-
-	/* TODO: stop HID Host thread */

 	bt_hh_cbacks = NULL;
 }


Add rectangle block support for MFQE.

Add rectangle block support for MFQE.

Only for the rectangle blocks larger than 16X16, SAD and Variance are
still based on the internal square blocks.

Change-Id: I3754da1b0254147313f86a0140dbf4f980f06a5a

--- vp9/common/vp9_mfqe.c
+++ vp9/common/vp9_mfqe.c
@@ -210,17 +210,85 @@
     return;
   }
   // No MFQE on blocks smaller than 16x16
-  if (partition == PARTITION_SPLIT && bs == BLOCK_16X16) {
+  if (bs == BLOCK_16X16) {
     partition = PARTITION_NONE;
   }
+  if (bs == BLOCK_64X64) {
+    mi_offset = 4;
+    y_offset = 32;
+    uv_offset = 16;
+  } else {
+    mi_offset = 2;
+    y_offset = 16;
+    uv_offset = 8;
+  }
   switch (partition) {
+    BLOCK_SIZE mfqe_bs, bs_tmp;
     case PARTITION_HORZ:
+      if (bs == BLOCK_64X64) {
+        mfqe_bs = BLOCK_64X32;
+        bs_tmp = BLOCK_32X32;
+      } else {
+        mfqe_bs = BLOCK_32X16;
+        bs_tmp = BLOCK_16X16;
+      }
+      if (mfqe_decision(mi, mfqe_bs)) {
+        // Do mfqe on the first square partition.
+        mfqe_block(bs_tmp, y, u, v, y_stride, uv_stride,
+                   yd, ud, vd, yd_stride, uvd_stride);
+        // Do mfqe on the second square partition.
+        mfqe_block(bs_tmp, y + y_offset, u + uv_offset, v + uv_offset,
+                   y_stride, uv_stride, yd + y_offset, ud + uv_offset,
+                   vd + uv_offset, yd_stride, uvd_stride);
+      }
+      if (mfqe_decision(mi + mi_offset * cm->mi_stride, mfqe_bs)) {
+        // Do mfqe on the first square partition.
+        mfqe_block(bs_tmp, y + y_offset * y_stride, u + uv_offset * uv_stride,
+                   v + uv_offset * uv_stride, y_stride, uv_stride,
+                   yd + y_offset * yd_stride, ud + uv_offset * uvd_stride,
+                   vd + uv_offset * uvd_stride, yd_stride, uvd_stride);
+        // Do mfqe on the second square partition.
+        mfqe_block(bs_tmp, y + y_offset * y_stride + y_offset,
+                   u + uv_offset * uv_stride + uv_offset,
+                   v + uv_offset * uv_stride + uv_offset, y_stride,
+                   uv_stride, yd + y_offset * yd_stride + y_offset,
+                   ud + uv_offset * uvd_stride + uv_offset,
+                   vd + uv_offset * uvd_stride + uv_offset,
+                   yd_stride, uvd_stride);
+      }
+      break;
     case PARTITION_VERT:
-      // If current block size is not square.
-      // Copy the block from current frame(i.e., no mfqe is done).
-      // TODO(jackychen): Rectangle blocks should also be taken into account.
-      copy_block(y, u, v, y_stride, uv_stride, yd, ud, vd,
-                 yd_stride, uvd_stride, bs);
+      if (bs == BLOCK_64X64) {
+        mfqe_bs = BLOCK_32X64;
+        bs_tmp = BLOCK_32X32;
+      } else {
+        mfqe_bs = BLOCK_16X32;
+        bs_tmp = BLOCK_16X16;
+      }
+      if (mfqe_decision(mi, mfqe_bs)) {
+        // Do mfqe on the first square partition.
+        mfqe_block(bs_tmp, y, u, v, y_stride, uv_stride,
+                   yd, ud, vd, yd_stride, uvd_stride);
+        // Do mfqe on the second square partition.
+        mfqe_block(bs_tmp, y + y_offset * y_stride, u + uv_offset * uv_stride,
+                   v + uv_offset * uv_stride, y_stride, uv_stride,
+                   yd + y_offset * yd_stride, ud + uv_offset * uvd_stride,
+                   vd + uv_offset * uvd_stride, yd_stride, uvd_stride);
+      }
+      if (mfqe_decision(mi + mi_offset, mfqe_bs)) {
+        // Do mfqe on the first square partition.
+        mfqe_block(bs_tmp, y + y_offset, u + uv_offset, v + uv_offset,
+                   y_stride, uv_stride, yd + y_offset, ud + uv_offset,
+                   vd + uv_offset, yd_stride, uvd_stride);
+        // Do mfqe on the second square partition.
+        mfqe_block(bs_tmp, y + y_offset * y_stride + y_offset,
+                   u + uv_offset * uv_stride + uv_offset,
+                   v + uv_offset * uv_stride + uv_offset, y_stride,
+                   uv_stride, yd + y_offset * yd_stride + y_offset,
+                   ud + uv_offset * uvd_stride + uv_offset,
+                   vd + uv_offset * uvd_stride + uv_offset,
+                   yd_stride, uvd_stride);
+      }
       break;
     case PARTITION_NONE:
       if (mfqe_decision(mi, cur_bs)) {
@@ -234,15 +302,6 @@
       }
       break;
     case PARTITION_SPLIT:
-      if (bs == BLOCK_64X64) {
-        mi_offset = 4;
-        y_offset = 32;
-        uv_offset = 16;
-      } else {
-        mi_offset = 2;
-        y_offset = 16;
-        uv_offset = 8;
-      }
       // Recursion on four square partitions, e.g. if bs is 64X64,
       // then look into four 32X32 blocks in it.
       mfqe_partition(cm, mi, subsize, y, u, v, y_stride, uv_stride, yd, ud, vd,


readMS5611

readMS5611

readMS5611

--- readMS5611.c
+++ readMS5611.c
@@ -40,7 +40,7 @@

 // check daily sea level pressure at
 // http://www.kma.go.kr/weather/observation/currentweather.jsp
-#define SEA_LEVEL_PRESSURE 1023.20 // Seoul 1023.20hPa
+#define SEA_LEVEL_PRESSURE 102320 // Seoul 1023.20hPa

 unsigned int PROM_read(int DA, char PROM_CMD)
 {
@@ -104,20 +104,18 @@
 	char RESET = 0x1E;

 	int64_t dT;
-	int32_t TEMP;
+	int32_t TEMP, fltd_TEMP, pre_fltd_TEMP;
 	int64_t OFF;
 	int64_t SENS;
-	int32_t P;
-
-	double Temparature, fltd_Temparature, pre_fltd_Temparature;
-	double Pressure, fltd_Pressure, pre_fltd_Pressure;
+	int32_t P, fltd_P, pre_fltd_P;

 	float Altitude, pre_Altitude;
+
 	int roc;

-	long curSampled_time = 0;
-	long prevSampled_time = 0;
-	float Sampling_time, prevSampling_time;
+	uint32_t curSampled_time = 0;
+	uint32_t prevSampled_time = 0;
+	uint32_t Sampling_time, prevSampling_time;
 	struct timespec spec;

 	if ((fd = open("/dev/i2c-1", O_RDWR)) < 0){
@@ -189,27 +187,24 @@

 		P = ((((int64_t)D1*SENS) / pow(2, 21) - OFF) / pow(2, 15));

-		Temparature = (double)TEMP / (double)100;
-		Pressure = (double)P / (double)100;
-
 		if (prevSampled_time == 0)
 		{
-			pre_fltd_Temparature = Temparature;
-			pre_fltd_Pressure = Pressure;
+			pre_fltd_TEMP = TEMP;
+			pre_fltd_P = P;
 		}

-		fltd_Temparature = alpha * pre_fltd_Temparature + (1 - alpha) * Temparature;
-		fltd_Pressure = beta * pre_fltd_Pressure + (1 - beta) * Pressure;
-
-		pre_fltd_Temparature = fltd_Temparature;
-		pre_fltd_Pressure = fltd_Pressure;
+		fltd_TEMP = alpha * pre_fltd_TEMP + (1 - alpha) * TEMP;
+		fltd_P = beta * pre_fltd_P + (1 - beta) * P;
+
+		pre_fltd_TEMP = fltd_TEMP;
+		pre_fltd_P = fltd_P;

 		//printf("Temparature : %.2f C", fltd_Temparature);
 		//printf("  Pressure : %.2f mbar", fltd_Pressure);

-		Altitude = ((pow((SEA_LEVEL_PRESSURE / fltd_Pressure), 1 / 5.257) - 1.0) * (fltd_Temparature + 273.15)) / 0.0065;
-
-		roc = (int)(100000 * (Altitude - pre_Altitude) / Sampling_time);
+		Altitude = ((pow((SEA_LEVEL_PRESSURE / fltd_Pressure), 1 / 5.257) - 1.0) * (fltd_TEMP + 27315)) / 0.0065; //cm
+
+		roc = (int)(1000 * (Altitude - pre_Altitude) / Sampling_time);

 		pre_Altitude = Altitude;


Cleanup crossfeed_hrtf initialization.

Cleanup crossfeed_hrtf initialization.

--- effects/crossfeed_hrtf.c
+++ effects/crossfeed_hrtf.c
@@ -11,7 +11,6 @@
 	fftw_complex *filter_fr_left[2];
 	fftw_complex *filter_fr_right[2];
 	fftw_complex *tmp_fr[2];
-	sample_t *impulse[2];
 	sample_t *input[2];
 	sample_t *output_left_input[2];
 	sample_t *output_right_input[2];
@@ -134,8 +133,7 @@
 	int i;
 	size_t frames;
 	fftw_plan impulse_plan0, impulse_plan1;
-	sample_t *impulse_left[2];
-	sample_t *impulse_right[2];
+	sample_t *impulse[2];

 	if (argc != 3) {
 		LOG(LL_ERROR, "dsp: %s: usage: %s\n", argv[0], ei->usage);
@@ -196,40 +194,34 @@
 	state->overlap_right_input[0] = calloc(state->input_frames / 2, sizeof(sample_t));
 	state->overlap_right_input[1] = calloc(state->input_frames / 2, sizeof(sample_t));

-	impulse_left[0] = calloc(state->input_frames, sizeof(sample_t));
-	impulse_left[1] = calloc(state->input_frames, sizeof(sample_t));
-	impulse_right[0] = calloc(state->input_frames, sizeof(sample_t));
-	impulse_right[1] = calloc(state->input_frames, sizeof(sample_t));
+	impulse[0] = calloc(state->input_frames, sizeof(sample_t));
+	impulse[1] = calloc(state->input_frames, sizeof(sample_t));

 	tmp_buf = calloc(frames * 2, sizeof(sample_t));
+	impulse_plan0 = fftw_plan_dft_r2c_1d(state->input_frames, impulse[0], state->filter_fr_left[0], FFTW_ESTIMATE);
+	impulse_plan1 = fftw_plan_dft_r2c_1d(state->input_frames, impulse[1], state->filter_fr_left[1], FFTW_ESTIMATE);
 	if (c_left->read(c_left, tmp_buf, c_left->frames) != c_left->frames)
 		LOG(LL_ERROR, "dsp: %s: warning: short read\n", argv[0]);
 	for (i = 0; i < c_left->frames; ++i) {
-		impulse_left[0][i] = tmp_buf[i * 2];
-		impulse_left[1][i] = tmp_buf[i * 2 + 1];
-	}
+		impulse[0][i] = tmp_buf[i * 2];
+		impulse[1][i] = tmp_buf[i * 2 + 1];
+	}
+	fftw_execute(impulse_plan0);
+	fftw_execute(impulse_plan1);
 	memset(tmp_buf, 0, frames * 2 * sizeof(sample_t));
+	memset(impulse[0], 0, state->input_frames * sizeof(sample_t));
+	memset(impulse[1], 0, state->input_frames * sizeof(sample_t));
 	if (c_right->read(c_right, tmp_buf, c_right->frames) != c_right->frames)
 		LOG(LL_ERROR, "dsp: %s: warning: short read\n", argv[0]);
 	for (i = 0; i < c_right->frames; ++i) {
-		impulse_right[0][i] = tmp_buf[i * 2];
-		impulse_right[1][i] = tmp_buf[i * 2 + 1];
-	}
-	free(tmp_buf);
-
-	impulse_plan0 = fftw_plan_dft_r2c_1d(state->input_frames, impulse_left[0], state->filter_fr_left[0], FFTW_ESTIMATE);
-	impulse_plan1 = fftw_plan_dft_r2c_1d(state->input_frames, impulse_left[1], state->filter_fr_left[1], FFTW_ESTIMATE);
+		impulse[0][i] = tmp_buf[i * 2];
+		impulse[1][i] = tmp_buf[i * 2 + 1];
+	}
 	fftw_execute(impulse_plan0);
 	fftw_execute(impulse_plan1);
 	fftw_destroy_plan(impulse_plan0);
 	fftw_destroy_plan(impulse_plan1);
-
-	impulse_plan0 = fftw_plan_dft_r2c_1d(state->input_frames, impulse_right[0], state->filter_fr_right[0], FFTW_ESTIMATE);
-	impulse_plan1 = fftw_plan_dft_r2c_1d(state->input_frames, impulse_right[1], state->filter_fr_right[1], FFTW_ESTIMATE);
-	fftw_execute(impulse_plan0);
-	fftw_execute(impulse_plan1);
-	fftw_destroy_plan(impulse_plan0);
-	fftw_destroy_plan(impulse_plan1);
+	free(tmp_buf);

 	/* init left input plans */
 	state->plan_r2c_left_c0 = fftw_plan_dft_r2c_1d(state->input_frames, state->input[0], state->tmp_fr[0], FFTW_ESTIMATE);
@@ -246,10 +238,8 @@
 	LOG(LL_VERBOSE, "dsp: %s: impulse frames=%zu\n", argv[0], frames);
 	destroy_codec(c_left);
 	destroy_codec(c_right);
-	free(impulse_left[0]);
-	free(impulse_left[1]);
-	free(impulse_right[0]);
-	free(impulse_right[1]);
+	free(impulse[0]);
+	free(impulse[1]);

 	e->data = state;
 	return e;


sha/keccak1600.c: choose more sensible default parameters.

"More" refers to the fact that we make active BIT_INTERLEAVE choice
in some specific cases. Update commentary correspondingly.

Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>

--- crypto/sha/keccak1600.c
+++ crypto/sha/keccak1600.c
@@ -15,7 +15,19 @@
                    size_t r);
 void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r);

-#ifndef KECCAK1600_ASM
+#if !defined(KECCAK1600_ASM) || !defined(SELFTEST)
+
+/*
+ * Choose some sensible defaults
+ */
+#if !defined(KECCAK_REF) && !defined(KECCAK_1X) && !defined(KECCAK_1X_ALT) && \
+    !defined(KECCAK_2X) && !defined(KECCAK_INPLACE)
+# define KECCAK_2X      /* default to KECCAK_2X variant */
+#endif
+
+#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
+# define KECCAK_COMPLEMENTING_TRANSFORM
+#endif

 #if defined(__x86_64__) || defined(__aarch64__) || \
     defined(__mips64) || defined(__ia64) || \
@@ -508,10 +520,10 @@
  * This implementation is variant of KECCAK_1X above with outer-most
  * round loop unrolled twice. This allows to take temporary storage
  * out of round procedure and simplify references to it by alternating
- * it with actual data (see round loop below). Just like original, it's
- * rather meant as reference for an assembly implementation. It's likely
- * to provide best instruction per processed byte ratio at minimal
- * round unroll factor...
+ * it with actual data (see round loop below). Originally it was meant
+ * rather as reference for an assembly implementation, but it seems to
+ * play best with compilers [as well as provide best instruction per
+ * processed byte ratio at minimal round unroll factor]...
  */
 static void Round(uint64_t R[5][5], uint64_t A[5][5], size_t i)
 {
@@ -661,13 +673,15 @@
 #endif
 }

-#else
+#else   /* define KECCAK_INPLACE to compile this code path */
 /*
  * This implementation is KECCAK_1X from above combined 4 times with
  * a twist that allows to omit temporary storage and perform in-place
  * processing. It's discussed in section 2.5 of "Keccak implementation
  * overview". It's likely to be best suited for processors with large
- * register bank...
+ * register bank... On the other hand processor with large register
+ * bank can as well use KECCAK_1X_ALT, it would be as fast but much
+ * more compact...
  */
 static void FourRounds(uint64_t A[5][5], size_t i)
 {
@@ -1106,10 +1120,6 @@
             KeccakF1600(A);
     }
 }
-#else
-size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len,
-                   size_t r);
-void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r);
 #endif

 #ifdef SELFTEST


Need stdlib.h to get NULL on Linux

Need stdlib.h to get NULL on Linux

--- tjutil.c
+++ tjutil.c
@@ -52,6 +52,7 @@

 #else

+#include <stdlib.h>
 #include <sys/time.h>

 double gettime(void)


made it compile

made it compile

--- pd/ambix_read~.c
+++ pd/ambix_read~.c
@@ -23,9 +23,10 @@

 #include "m_pd.h"
 #include <ambix/ambix.h>
+#include <pthread.h>

 /* ------------------------ ambixread ----------------------------- */
-
+#define MAXCHANS 64
 static t_class *ambixread_class;

 typedef struct _ambixread
@@ -40,7 +41,7 @@
   t_outlet *x_mtxout ;                    /* matrix outlet (in ambix-extended mode) */
   t_outlet *x_infoout;                    /* bang-on-done and other-info outlet */

-  t_sample *(x_outvec[MAXSFCHANS]);       /* audio vectors */
+  t_sample *(x_outvec[MAXCHANS]);       /* audio vectors */
   int x_vecsize;                          /* vector size for transfers */
   int x_state;                            /* opened, running, or idle */
   t_float x_insamplerate;   /* sample rate of input signal if known */
@@ -111,7 +112,7 @@
     class_addmethod(ambixread_class, (t_method)ambixread_dsp, gensym("dsp"), 0);
     class_addmethod(ambixread_class, (t_method)ambixread_open, gensym("open"),
         A_GIMME, 0);
-    class_addmethod(ambixread_class, (t_method)ambixread_print, gensym("print"), 0);
+    //    class_addmethod(ambixread_class, (t_method)ambixread_print, gensym("print"), 0);
 }
 void ambix_readX_tilde_setup(void) {
   ambix_read_tilde_setup();