Added a program for performing various Windows dialog units calculations to test against the Layout page on MSDN. I'm guessing they never updated the Button entry for Segoe UI...

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

--- windlgunits.c
+++ windlgunits.c
@@ -0,0 +1,395 @@
+// 4 june 2014
+// scratch Windows program by pietro gagliardi 17 april 2014
+// fixed typos and added toWideString() 1 may 2014
+// borrows code from the scratch GTK+ program (16-17 april 2014) and from code written 31 march 2014 and 11-12 april 2014
+#define _UNICODE
+#define UNICODE
+#define STRICT
+#define _GNU_SOURCE		// needed to declare asprintf()/vasprintf()
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <getopt.h>
+#include <windows.h>
+#include <commctrl.h>		// needed for InitCommonControlsEx() (thanks Xeek in irc.freenode.net/#winapi for confirming)
+
+#ifdef  _MSC_VER
+#error sorry! the scratch windows program relies on mingw-only functionality! (specifically: asprintf(), getopt_long_only())
+#endif
+
+// cheating: we store the help string in the flag argument, collect them, then overwrite them with NULL in init() so getopt_long_only() will return val and not overwrite a string (apparently I'm not the first to think of this: GerbilSoft says GNU tools do this too)
+#define flagBool(name, help, short) { name, no_argument, (int *) help, short }
+#define flagString(name, help, short) { name, required_argument, (int *) help, short }
+static struct option flags[] = {
+	// place other options here
+	flagBool("help", "show help and quit", 'h'),
+	{ 0, 0, 0, 0 },
+};
+
+HMODULE hInstance;
+HICON hDefaultIcon;
+HCURSOR hDefaultCursor;
+HFONT controlfont;
+
+void panic(char *fmt, ...);
+TCHAR *toWideString(char *what);
+
+void init(int argc, char *argv[]);
+
+char *args = "";		// other command-line arguments here, if any
+
+BOOL parseArgs(int argc, char *argv[])
+{
+	// parse arguments here, if any; use optind
+	// return TRUE if parsed successfully; FALSE otherwise
+	// (returning FALSE will show usage and quit)
+	return TRUE;
+}
+
+LOGFONT clf;
+
+void printfont(HDC dc, LOGFONT clf)
+{
+	LONG h;
+
+	printf("%S ", clf.lfFaceName);
+	h = clf.lfHeight;
+	if (h < 0) {
+		// solve height = -MulDiv(points, base, 72dpi) for points to get this
+		h = -h;
+		h = MulDiv(h, 72, GetDeviceCaps(dc, LOGPIXELSY));
+	} else if (h > 0) {
+		// TODO
+	} else
+		panic("not sure how to convert %d from height to points", h);
+	printf("%d", h);
+}
+
+typedef void (*dlgfn)(int, int, double, double, int *, int *);
+
+void printdlgunits(char *what, HDC dc, dlgfn f, double arg1, double arg2)
+{
+	int res1, res2;
+
+#define BUTTON_SIZE_X 50
+#define BUTTON_SIZE_Y 14
+	printf(what);
+	printfont(dc, clf);
+	(*f)(BUTTON_SIZE_X, BUTTON_SIZE_Y, arg1, arg2, &res1, &res2);
+	printf(" | baseX %g baseY %g | button %d x %d -> %d x %d\n",
+		arg1, arg2,
+		BUTTON_SIZE_X, BUTTON_SIZE_Y,
+		res1, res2);
+}
+
+void dlg_nosys(int w, int h, double baseX, double baseY, int *resX, int *resY)
+{
+	*resX = MulDiv(w, baseX, 4);
+	*resY = MulDiv(h, baseY, 8);
+}
+
+void dlg_sys(int w, int h, double baseX, double baseY, int *resX, int *resY)
+{
+	*resX = 2 * w * baseX;
+	*resY = 2 * h * baseY;
+}
+
+void getAverages(HDC dc, int *xGTEP32, int *xTM, int *y)
+{
+	SIZE extents;
+	TEXTMETRIC tm;
+
+#define GTEP32STR L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+	if (GetTextExtentPoint32(dc, GTEP32STR, 52, &extents) == 0)
+		panic("error calling GetTextExtents32()");
+	*xGTEP32 = (extents.cx / 26 + 1) / 2;
+	if (GetTextMetrics(dc, &tm) == 0)
+		panic("error calling GetTextMetrics()");
+	*xTM = tm.tmAveCharWidth;
+	*y = tm.tmHeight;
+}
+
+void paint(HDC dc)
+{
+	HFONT prev;		// holds the System font
+	int cXG, cXT, cY;
+	int sysXG, sysXT, sysY;
+	LOGFONT syslf;
+
+	getAverages(dc, &sysXG, &sysXT, &sysY);
+	prev = SelectObject(dc, controlfont);
+	if (prev == NULL)
+		panic("error calling SelectObject()");
+	if (GetObject(prev, sizeof (LOGFONT), &syslf) == 0)
+		panic("error getting LOGFONT for the System font");
+	getAverages(dc, &cXG, &cXT, &cY);
+
+	printdlgunits("GetTextExtentPoint32: ", dc, dlg_nosys, cXG, cY);
+	printdlgunits("tm.tmAveCharWidth:    ", dc, dlg_nosys, cXT, cY);
+	printf("with system font: ");
+	printfont(dc, syslf);
+	printf("\n");
+#define d(x,y) (((double)(x)) / ((double)(y)))
+	printdlgunits("GetTextExtentPoint32: ", dc, dlg_sys, d(cXG, sysXG), d(cY, sysY));
+	printdlgunits("tm.tmAveCharWidth:    ", dc, dlg_sys, d(cXT, sysXT), d(cY, sysY));
+#undef d
+
+	if (SelectObject(dc, prev) == NULL)
+		panic("error returning font to normal");
+}
+
+LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+	PAINTSTRUCT ps;
+	HDC dc;
+
+	switch (msg) {
+	case WM_PAINT:
+		dc = BeginPaint(hwnd, &ps);
+		if (dc == NULL)
+			panic("error calling BeginPaint()");
+		paint(dc);
+		EndPaint(hwnd, &ps);
+		return 0;
+	case WM_CLOSE:
+		PostQuitMessage(0);
+		return 0;
+	default:
+		return DefWindowProc(hwnd, msg, wparam, lparam);
+	}
+	panic("oops: message %ud does not return anything; bug in wndproc()", msg);
+}
+
+HWND makeMainWindow(void)
+{
+	WNDCLASS cls;
+	HWND hwnd;
+
+	ZeroMemory(&cls, sizeof (WNDCLASS));
+	cls.lpszClassName = L"mainwin";
+	cls.lpfnWndProc = wndproc;
+	cls.hInstance = hInstance;
+	cls.hIcon = hDefaultIcon;
+	cls.hCursor = hDefaultCursor;
+	cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+	if (RegisterClass(&cls) == 0)
+		panic("error registering window class");
+	hwnd = CreateWindowEx(0,
+		L"mainwin", L"Main Window",
+		WS_OVERLAPPEDWINDOW,
+		CW_USEDEFAULT, CW_USEDEFAULT,
+		CW_USEDEFAULT, CW_USEDEFAULT,
+		NULL, NULL, hInstance, NULL);
+	if (hwnd == NULL)
+		panic("opening main window failed");
+	return hwnd;
+}
+
+void buildUI(HWND mainwin)
+{
+#define CSTYLE (WS_CHILD | WS_VISIBLE)
+#define CXSTYLE (0)
+#define SETFONT(hwnd) SendMessage(hwnd, WM_SETFONT, (WPARAM) controlfont, (LPARAM) TRUE);
+	// build GUI here; use CSTYLE and CXSTYLE in CreateWindowEx() and call SETFONT() on each new widget
+}
+
+void firstShowWindow(HWND hwnd);
+
+int main(int argc, char *argv[])
+{
+	HWND mainwin;
+	MSG msg;
+
+	init(argc, argv);
+
+	mainwin = makeMainWindow();
+	buildUI(mainwin);
+	firstShowWindow(mainwin);
+
+	for (;;) {
+		BOOL gmret;
+
+		gmret = GetMessage(&msg, NULL, 0, 0);
+		if (gmret == -1)
+			panic("error getting message");
+		if (gmret == 0)
+			break;
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+	return 0;
+}
+
+DWORD iccFlags =
+//	ICC_ANIMATE_CLASS |			// animation control
+//	ICC_BAR_CLASSES |				// toolbar, statusbar, trackbar, tooltip
+//	ICC_COOL_CLASSES |			// rebar
+//	ICC_DATE_CLASSES |			// date and time picker
+//	ICC_HOTKEY_CLASS |			// hot key
+//	ICC_INTERNET_CLASSES |		// IP address entry field
+//	ICC_LINK_CLASS |				// hyperlink
+//	ICC_LISTVIEW_CLASSES |			// list-view, header
+//	ICC_NATIVEFNTCTL_CLASS |		// native font
+//	ICC_PAGESCROLLER_CLASS |		// pager
+//	ICC_PROGRESS_CLASS |			// progress bar
+//	ICC_STANDARD_CLASSES |		// "one of the intrinsic User32 control classes"
+//	ICC_TAB_CLASSES |				// tab, tooltip
+//	ICC_TREEVIEW_CLASSES |		// tree-view, tooltip
+//	ICC_UPDOWN_CLASS |			// up-down
+//	ICC_USEREX_CLASSES |			// ComboBoxEx
+//	ICC_WIN95_CLASSES |			// some of the above
+	0;
+
+void initwin(void)
+{
+	INITCOMMONCONTROLSEX icc;
+	NONCLIENTMETRICS ncm;
+
+	hInstance = GetModuleHandle(NULL);
+	if (hInstance == NULL)
+		panic("error getting hInstance");
+	hDefaultIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
+	if (hDefaultIcon == NULL)
+		panic("error getting default window class icon");
+	hDefaultCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
+	if (hDefaultCursor == NULL)
+		panic("error getting default window cursor");
+	icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
+	icc.dwICC = iccFlags;
+	if (InitCommonControlsEx(&icc) == FALSE)
+		panic("error initializing Common Controls");
+	ncm.cbSize = sizeof (NONCLIENTMETRICS);
+	if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
+		sizeof (NONCLIENTMETRICS), &ncm, 0) == 0)
+		panic("error getting non-client metrics for getting control font");
+	controlfont = CreateFontIndirect(&ncm.lfMessageFont);
+	if (controlfont == NULL)
+		panic("error getting control font");
+	clf = ncm.lfMessageFont;
+}
+
+void init(int argc, char *argv[])
+{
+	int usageExit = 1;
+	char *opthelp[512];		// more than enough
+	int i;
+
+	for (i = 0; flags[i].name != 0; i++) {
+		opthelp[i] = (char *) flags[i].flag;
+		flags[i].flag = NULL;
+	}
+
+	for (;;) {
+		int c;
+
+		c = getopt_long_only(argc, argv, "", flags, NULL);
+		if (c == -1)
+			break;
+		switch (c) {
+		case 'h':		// -help
+			usageExit = 0;
+			goto usage;
+		case '?':
+			// getopt_long_only() should have printed something since we did not set opterr to 0
+			goto usage;
+		default:
+			fprintf(stderr, "internal error: getopt_long_only() returned %d\n", c);
+			exit(1);
+		}
+	}
+
+	if (parseArgs(argc, argv) != TRUE)
+		goto usage;
+
+	initwin();
+	return;
+
+usage:
+	fprintf(stderr, "usage: %s [options]", argv[0]);
+	if (args != NULL && *args != '\0')
+		fprintf(stderr, " %s", args);
+	fprintf(stderr, "\n");
+	for (i = 0; flags[i].name != 0; i++)
+		fprintf(stderr, "\t-%s%s - %s\n",
+			flags[i].name,
+			(flags[i].has_arg == required_argument) ? " string" : "",
+			opthelp[i]);
+	exit(usageExit);
+}
+
+void panic(char *fmt, ...)
+{
+	char *msg;
+	TCHAR *lerrmsg;
+	char *fullmsg;
+	va_list arg;
+	DWORD lasterr;
+	DWORD lerrsuccess;
+
+	lasterr = GetLastError();
+	va_start(arg, fmt);
+	if (vasprintf(&msg, fmt, arg) == -1) {
+		fprintf(stderr, "critical error: vasprintf() failed in panic() preparing panic message; fmt = \"%s\"\n", fmt);
+		abort();
+	}
+	// according to http://msdn.microsoft.com/en-us/library/windows/desktop/ms680582%28v=vs.85%29.aspx
+	lerrsuccess = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+		NULL, lasterr,
+		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+		(LPTSTR) &lerrmsg, 0, NULL);
+	if (lerrsuccess == 0) {
+		fprintf(stderr, "critical error: FormatMessage() failed in panic() preparing GetLastError() string; panic message = \"%s\", last error in panic(): %ld, last error from FormatMessage(): %ld\n", msg, lasterr, GetLastError());
+		abort();
+	}
+	// note to self: use %ws instead of %S (thanks jon_y in irc.oftc.net/#mingw-w64)
+	if (asprintf(&fullmsg, "panic: %s\nlast error: %ws\n", msg, lerrmsg) == -1) {
+		fprintf(stderr, "critical error: asprintf() failed in panic() preparing full report; panic message = \"%s\", last error message: \"%ws\"\n", msg, lerrmsg);
+		abort();
+	}
+	fprintf(stderr, "%s\n", fullmsg);
+	va_end(arg);
+	exit(1);
+}
+
+void firstShowWindow(HWND hwnd)
+{
+	// we need to get nCmdShow
+	int nCmdShow;
+	STARTUPINFO si;
+
+	nCmdShow = SW_SHOWDEFAULT;
+	GetStartupInfo(&si);
+	if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
+		nCmdShow = si.wShowWindow;
+	ShowWindow(hwnd, nCmdShow);
+	if (UpdateWindow(hwnd) == 0)
+		panic("UpdateWindow(hwnd) failed in first show");
+}
+
+TCHAR *toWideString(char *what)
+{
+	TCHAR *buf;
+	int n;
+	size_t len;
+
+	len = strlen(what);
+	if (len == 0) {
+		buf = (TCHAR *) malloc(sizeof (TCHAR));
+		if (buf == NULL)
+			goto mallocfail;
+		buf[0] = L'\0';
+	} else {
+		n = MultiByteToWideChar(CP_UTF8, 0, what, -1, NULL, 0);
+		if (n == 0)
+			panic("error getting number of bytes to convert \"%s\" to UTF-16", what);
+		buf = (TCHAR *) malloc((n + 1) * sizeof (TCHAR));
+		if (buf == NULL)
+			goto mallocfail;
+		if (MultiByteToWideChar(CP_UTF8, 0, what, -1, buf, n) == 0)
+			panic("erorr converting \"%s\" to UTF-16", what);
+	}
+	return buf;
+mallocfail:
+	panic("error allocating memory for UTF-16 version of \"%s\"", what);
+}


Added CGFloat versions of standard "math.h" M_* values like M_PI.

--- src/Foundation/IBAMath.h
+++ src/Foundation/IBAMath.h
@@ -16,6 +16,8 @@
 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 //  See the License for the specific language governing permissions and
 //  limitations under the License.
+
+#import <math.h>

 /*!
  \def       IBA_DEG_TO_RAD
@@ -49,6 +51,97 @@

 #import "../Foundation/IBACommon.h"

+/*!
+ \def       IBA_E
+ \brief     The mathmatical constant e
+ \details   M_E from math.h cast to CGFloat.
+ */
+#define IBA_E         ((CGFloat)M_E)
+
+/*!
+ \def       IBA_LOG2E
+ \brief     The mathmatical constant log2(e).
+ \details   M_LOG2E from math.h cast to CGFloat.
+ */
+#define IBA_LOG2E     ((CGFloat)M_LOG2E)
+
+/*!
+ \def       IBA_LOG10E
+ \brief     The mathmatical constant log10(e).
+ \details   M_LOG2E cast to CGFloat.
+ */
+#define IBA_LOG10E      ((CGFloat)M_LOG10E)
+
+/*!
+ \def       IBA_LN2
+ \brief     The mathmatical constant loge(2).
+ \details   M_LN2 cast to CGFloat.
+ */
+#define IBA_LN2         ((CGFloat)M_LN2)
+
+/*!
+ \def       IBA_LN10
+ \brief     The mathmatical constant loge(10).
+ \details   M_LN10 cast to CGFloat.
+ */
+#define IBA_LN10        ((CGFloat)M_LN10)
+
+/*!
+ \def       IBA_PI
+ \brief     The mathmatical constant pi.
+ \details   M_PI cast to CGFloat.
+ */
+#define IBA_PI          ((CGFloat)M_PI)
+
+/*!
+ \def       IBA_PI_2
+ \brief     The mathmatical constant pi/2.
+ \details   M_PI_2 cast to CGFloat.
+ */
+#define IBA_PI_2        ((CGFloat)M_PI_2)
+
+/*!
+ \def       IBA_PI_4
+ \brief     The mathmatical constant pi/4.
+ \details   M_PI_4 cast to CGFloat.
+ */
+#define IBA_PI_4        ((CGFloat)M_PI_4)
+
+/*!
+ \def       IBA_1_PI
+ \brief     The mathmatical constant 1/pi.
+ \details   M_1_PI cast to CGFloat.
+ */
+#define IBA_1_PI        ((CGFloat)M_1_PI)
+
+/*!
+ \def       IBA_2_PI
+ \brief     The mathmatical constant 2/pi.
+ \details   M_2_PI cast to CGFloat.
+ */
+#define IBA_2_PI        ((CGFloat)M_2_PI)
+
+/*!
+ \def       IBA_2_SQRTPI
+ \brief     The mathmatical constant 2/sqrt(pi).
+ \details   M_2_SQRTPI cast to CGFloat.
+ */
+#define IBA_2_SQRTPI    ((CGFloat)M_2_SQRTPI)
+
+/*!
+ \def       IBA_SQRT2
+ \brief     The mathmatical constant sqrt(2).
+ \details   M_SQRT2 cast to CGFloat.
+ */
+#define IBA_SQRT2       ((CGFloat)M_SQRT2)
+
+/*!
+ \def       IBA_SQRT1_2
+ \brief     The mathmatical constant 1/sqrt(2).
+ \details   M_SQRT1_2 cast to CGFloat.
+ */
+#define IBA_SQRT1_2     ((CGFloat)M_SQRT1_2)
+
 IBA_EXTERN_C_BEGIN

 float IBAClampFloatValue(float val, float minval, float maxval);


bugfix: worker messages not freed properly

--- src/ngx_http_push_module_proletariat.c
+++ src/ngx_http_push_module_proletariat.c
@@ -145,45 +145,47 @@
 	ngx_http_push_msg_t            *msg;

 	sentinel = &worker_messages[ngx_process_slot];
-	worker_msg = sentinel;
-	while((worker_msg = (ngx_http_push_worker_msg_t *)ngx_queue_next(&worker_msg->queue)) != sentinel) {
-		if(worker_msg->pid!=ngx_pid) {
+	worker_msg = (ngx_http_push_worker_msg_t *)ngx_queue_next(&sentinel->queue);
+	while(worker_msg != sentinel) {
+		if(worker_msg->pid==ngx_pid) {
+			//everything is okay.
+			status_code = worker_msg->status_code;
+			msg = worker_msg->msg;
+			channel = worker_msg->channel;
+			subscriber_sentinel = worker_msg->subscriber_sentinel;
+			if(msg==NULL) {
+				//just a status line, is all
+				//status code only.
+				switch(status_code) {
+					case NGX_HTTP_CONFLICT:
+						status_line=&NGX_HTTP_PUSH_HTTP_STATUS_409;
+						break;
+
+					case NGX_HTTP_GONE:
+						status_line=&NGX_HTTP_PUSH_HTTP_STATUS_410;
+						break;
+
+					case 0:
+						ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: worker message contains neither a channel message nor a status code");
+						//let's let the subscribers know that something went wrong and they might've missed a message
+						status_code = NGX_HTTP_INTERNAL_SERVER_ERROR;
+						//intentional fall-through
+					default:
+						status_line=NULL;
+				}
+			}
+			ngx_shmtx_unlock(&shpool->mutex);
+			ngx_http_push_respond_to_subscribers(channel, subscriber_sentinel, msg, status_code, status_line);
+			ngx_shmtx_lock(&shpool->mutex);
+		}
+		else {
 			//that's quite bad you see. a previous worker died with an undelivered message.
 			//but all its subscribers' connections presumably got canned, too. so it's not so bad after all.
 			ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: intercepted a message intended for another worker process that probably died");
 		}
-
-		status_code = worker_msg->status_code;
-		msg = worker_msg->msg;
-		channel = worker_msg->channel;
-		subscriber_sentinel = worker_msg->subscriber_sentinel;
 		//It may be worth it to memzero worker_msg for debugging purposes.
-
-		if(msg==NULL) {
-			//just a status line, is all
-			//status code only.
-			switch(status_code) {
-				case NGX_HTTP_CONFLICT:
-					status_line=&NGX_HTTP_PUSH_HTTP_STATUS_409;
-					break;
-
-				case NGX_HTTP_GONE:
-					status_line=&NGX_HTTP_PUSH_HTTP_STATUS_410;
-					break;
-
-				case 0:
-					ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: worker message contains neither a channel message nor a status code");
-					//let's let the subscribers know that something went wrong and they might've missed a message
-					status_code = NGX_HTTP_INTERNAL_SERVER_ERROR;
-
-				default:
-					status_line=NULL;
-			}
-		}
-		ngx_slab_free_locked(shpool, worker_msg);
-		ngx_shmtx_unlock(&shpool->mutex);
-		ngx_http_push_respond_to_subscribers(channel, subscriber_sentinel, msg, status_code, status_line);
-		ngx_shmtx_lock(&shpool->mutex);
+		worker_msg = (ngx_http_push_worker_msg_t *)ngx_queue_next(&worker_msg->queue);
+		ngx_slab_free_locked(shpool, ngx_queue_prev(&worker_msg->queue));
 	}
 	ngx_queue_init(&sentinel->queue); //reset the worker message sentinel
 	ngx_shmtx_unlock(&shpool->mutex);


Volume Rendering: capitalization

Volume Rendering: capitalization

--HG--
branch : v1-9

--- Components/Volume/include/OgreVolumeMeshBuilder.h
+++ Components/Volume/include/OgreVolumeMeshBuilder.h
@@ -145,7 +145,7 @@
     public:
         /** To be called with the callback function of a MeshBuilder.
         @param simpleRenderable
-            Contains the simpleRenderable for which the triangles were built.
+            Contains the SimpleRenderable for which the triangles were built.
         @param vertices
             Contains the vertices of the triangles.
         @param indices
@@ -351,7 +351,7 @@
         @param callback
             The callback to execute.
         @param simpleRenderable
-            Contains the simpleRenderable for which the triangles were built.
+            Contains the SimpleRenderable for which the triangles were built.
         @param level
             The LOD level of this mesh.
         @param inProcess


we know the compiler will be g++ if it's gnu, but don't run for clang

--- components/ospcommon/networking/DataStreaming.h
+++ components/ospcommon/networking/DataStreaming.h
@@ -24,7 +24,7 @@

 // workaround missing "is_trivially_copyable" in g++ < 5.0
 // From: https://stackoverflow.com/questions/25123458/is-trivially-copyable-is-not-a-member-of-std
-#if __GNUG__ && __GNUC__ < 5
+#if !__clang__ && __GNUC__ < 5
 #define OSP_IS_TRIVIALLY_COPYABLE(T) std::has_trivial_copy_constructor<T>::value
 #else
 #define OSP_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value


gnrc_netif_hdr: Fix debug output format of if_pid, rssi and lqi

--- sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c
+++ sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c
@@ -22,9 +22,9 @@
 {
     char addr_str[GNRC_NETIF_HDR_L2ADDR_PRINT_LEN];

-    printf("if_pid: %" PRIkernel_pid "  ", hdr->if_pid);
-    printf("rssi: %" PRIu8 "  ", hdr->rssi);
-    printf("lqi: %" PRIu8 "\n", hdr->lqi);
+    printf("if_pid: %u  ", (unsigned) hdr->if_pid);
+    printf("rssi: %u  ", (unsigned) hdr->rssi);
+    printf("lqi: %u\n", (unsigned) hdr->lqi);
     printf("flags: ");

     if (hdr->flags) {


fix bug 406: Using OpenMP and Eigen causes infinite loop/deadlock (transplanted from 8b1ca56a7cf05183dc0958f155f8e8a1ff9ff97c)

--- Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -30,19 +30,16 @@
 template<typename _LhsScalar, typename _RhsScalar, bool _ConjLhs=false, bool _ConjRhs=false>
 class gebp_traits;

+std::ptrdiff_t manage_caching_sizes_second_if_negative(std::ptrdiff_t a, std::ptrdiff_t b)
+{
+  return a<=0 ? b : a;
+}
+
 /** \internal */
 inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1=0, std::ptrdiff_t* l2=0)
 {
-  static std::ptrdiff_t m_l1CacheSize = 0;
-  static std::ptrdiff_t m_l2CacheSize = 0;
-  if(m_l1CacheSize==0)
-  {
-    m_l1CacheSize = queryL1CacheSize();
-    m_l2CacheSize = queryTopLevelCacheSize();
-
-    if(m_l1CacheSize<=0) m_l1CacheSize = 8 * 1024;
-    if(m_l2CacheSize<=0) m_l2CacheSize = 1 * 1024 * 1024;
-  }
+  static std::ptrdiff_t m_l1CacheSize = manage_caching_sizes_second_if_negative(queryL1CacheSize(),8 * 1024);
+  static std::ptrdiff_t m_l2CacheSize = manage_caching_sizes_second_if_negative(queryTopLevelCacheSize(),1*1024*1024);

   if(action==SetAction)
   {


improve: use etk_name_service_bind() for name binding to use this server

--- doc20141203/echo-server.c
+++ doc20141203/echo-server.c
@@ -1,5 +1,9 @@
-/* echo-server.c */
-/* P4 */
+/* << echo-server.c >>
+ * echo-server program. Hacked from Echo test suite by
+ * <birney@sanger.ac.uk>, ORBit2 udpate by Frank Rehberger
+ * <F.Rehberger@xtradyne.de>
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -21,7 +25,7 @@
     return ref;
 }

-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
     CORBA_Object servant = CORBA_OBJECT_NIL;
     CosNaming_NamingContext name_service = CORBA_OBJECT_NIL;

@@ -39,6 +43,9 @@
     g_print("Binding service reference from name-service with id\"%s\"\n", id[0]);

     name_service = etk_get_name_service(global_orb, ev);
+    etk_abort_if_exception(ev, "failed resolving name-service");
+
+    etk_name_service_bind(name_service, servant, id, ev);
     etk_abort_if_exception(ev, "failed binding of service");

     server_run(global_orb, ev);
@@ -48,4 +55,4 @@
     etk_abort_if_exception(ev, "failed cleanup");

     exit(0);
-}+}


implement an even lower level version of the gebp kernel for MSVC (it seems to be faster with gcc as well)
(transplanted from 9a5643551fe068497f84a81cd8986febf1918382)

--HG--
extra : transplant_source : %9AVCU%1F%E0hI%7F%84%A8%1C%D8%98o%EB%F1%91%83%82

--- Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -76,6 +76,7 @@
         {
           PacketType B0, B1, B2, B3, A0, A1;

+          #if 0
                     A0 = ei_pload(&blA[0*PacketSize]);
                     A1 = ei_pload(&blA[1*PacketSize]);
                     B0 = ei_pload(&blB[0*PacketSize]);
@@ -133,6 +134,73 @@
           if(nr==4) C6 = cj.pmadd(A1, B2, C6);
           if(nr==4) C3 = cj.pmadd(A0, B3, C3);
           if(nr==4) C7 = cj.pmadd(A1, B3, C7);
+
+          #else
+
+          PacketType T0, T1;
+
+          #define MADD(A,B,C,T) { T = A; T = ei_pmul(T,B); C = ei_padd(C,T); }
+
+                    A0 = ei_pload(&blA[0*PacketSize]);
+                    A1 = ei_pload(&blA[1*PacketSize]);
+                    B0 = ei_pload(&blB[0*PacketSize]);
+                    B1 = ei_pload(&blB[1*PacketSize]);
+
+                      MADD(A0,B0,C0,T0);  // C0 = cj.pmadd(A0, B0, C0);
+          if(nr==4)   B2 = ei_pload(&blB[2*PacketSize]);
+                      MADD(A1,B0,C4,T1); // C4 = cj.pmadd(A1, B0, C4);
+          if(nr==4)   B3 = ei_pload(&blB[3*PacketSize]);
+                      B0 = ei_pload(&blB[(nr==4 ? 4 : 2)*PacketSize]);
+                      MADD(A0,B1,C1,T0);  // C1 = cj.pmadd(A0, B1, C1);
+                      MADD(A1,B1,C5,T1);  // C5 = cj.pmadd(A1, B1, C5);
+                      B1 = ei_pload(&blB[(nr==4 ? 5 : 3)*PacketSize]);
+          if(nr==4) { MADD(A0,B2,C2,T0); }// C2 = cj.pmadd(A0, B2, C2);
+          if(nr==4) { MADD(A1,B2,C6,T1); }// C6 = cj.pmadd(A1, B2, C6);
+          if(nr==4)   B2 = ei_pload(&blB[6*PacketSize]);
+          if(nr==4) { MADD(A0,B3,C3,T0); }// C3 = cj.pmadd(A0, B3, C3);
+                      A0 = ei_pload(&blA[2*PacketSize]);
+          if(nr==4) { MADD(A1,B3,C7,T1); }// C7 = cj.pmadd(A1, B3, C7);
+                      A1 = ei_pload(&blA[3*PacketSize]);
+          if(nr==4)   B3 = ei_pload(&blB[7*PacketSize]);
+                      MADD(A0,B0,C0,T0);  // C0 = cj.pmadd(A0, B0, C0);
+                      MADD(A1,B0,C4,T1);  // C4 = cj.pmadd(A1, B0, C4);
+                      B0 = ei_pload(&blB[(nr==4 ? 8 : 4)*PacketSize]);
+                      MADD(A0,B1,C1,T0);  // C1 = cj.pmadd(A0, B1, C1);
+                      MADD(A1,B1,C5,T1);  // C5 = cj.pmadd(A1, B1, C5);
+                      B1 = ei_pload(&blB[(nr==4 ? 9 : 5)*PacketSize]);
+          if(nr==4) { MADD(A0,B2,C2,T0); }// C2 = cj.pmadd(A0, B2, C2);
+          if(nr==4) { MADD(A1,B2,C6,T1); }// C6 = cj.pmadd(A1, B2, C6);
+          if(nr==4)   B2 = ei_pload(&blB[10*PacketSize]);
+          if(nr==4) { MADD(A0,B3,C3,T0); } // C3 = cj.pmadd(A0, B3, C3);
+                      A0 = ei_pload(&blA[4*PacketSize]);
+          if(nr==4) { MADD(A1,B3,C7,T1); }// C7 = cj.pmadd(A1, B3, C7);
+                      A1 = ei_pload(&blA[5*PacketSize]);
+          if(nr==4)   B3 = ei_pload(&blB[11*PacketSize]);
+
+                      MADD(A0,B0,C0,T0);  // C0 = cj.pmadd(A0, B0, C0);
+                      MADD(A1,B0,C4,T1);  // C4 = cj.pmadd(A1, B0, C4);
+                      B0 = ei_pload(&blB[(nr==4 ? 12 : 6)*PacketSize]);
+                      MADD(A0,B1,C1,T0);  // C1 = cj.pmadd(A0, B1, C1);
+                      MADD(A1,B1,C5,T1);  // C5 = cj.pmadd(A1, B1, C5);
+                      B1 = ei_pload(&blB[(nr==4 ? 13 : 7)*PacketSize]);
+          if(nr==4) { MADD(A0,B2,C2,T0); }// C2 = cj.pmadd(A0, B2, C2);
+          if(nr==4) { MADD(A1,B2,C6,T1); }// C6 = cj.pmadd(A1, B2, C6);
+          if(nr==4)   B2 = ei_pload(&blB[14*PacketSize]);
+          if(nr==4) { MADD(A0,B3,C3,T0); } // C3 = cj.pmadd(A0, B3, C3);
+                      A0 = ei_pload(&blA[6*PacketSize]);
+          if(nr==4) { MADD(A1,B3,C7,T1); } // C7 = cj.pmadd(A1, B3, C7);
+                      A1 = ei_pload(&blA[7*PacketSize]);
+          if(nr==4)   B3 = ei_pload(&blB[15*PacketSize]);
+                      MADD(A0,B0,C0,T0);  // C0 = cj.pmadd(A0, B0, C0);
+                      MADD(A1,B0,C4,T1);  // C4 = cj.pmadd(A1, B0, C4);
+                      MADD(A0,B1,C1,T0);  // C1 = cj.pmadd(A0, B1, C1);
+                      MADD(A1,B1,C5,T1);  // C5 = cj.pmadd(A1, B1, C5);
+          if(nr==4) { MADD(A0,B2,C2,T0); }// C2 = cj.pmadd(A0, B2, C2);
+          if(nr==4) { MADD(A1,B2,C6,T1); }//C6 = cj.pmadd(A1, B2, C6);
+          if(nr==4) { MADD(A0,B3,C3,T0); }//C3 = cj.pmadd(A0, B3, C3);
+          if(nr==4) { MADD(A1,B3,C7,T1); }//C7 = cj.pmadd(A1, B3, C7);
+
+          #endif

           blB += 4*nr*PacketSize;
           blA += 4*mr;
@@ -334,7 +402,7 @@
         #endif

         PacketType C0 = ei_ploadu(&res[(j2+0)*resStride + i]);
-
+
         const Scalar* blB = &blockB[j2*strideB*PacketSize+offsetB];
         for(int k=0; k<depth; k++)
         {
@@ -474,7 +542,7 @@
       // skip what we have after
       if(PanelMode) count += PacketSize * nr * (stride-offset-depth);
     }
-
+
     // copy the remaining columns one at a time (nr==1)
     for(int j2=packet_cols; j2<cols; ++j2)
     {


Bug 889: fix protected typedef

Bug 889: fix protected typedef

--- Eigen/src/IterativeLinearSolvers/SolveWithGuess.h
+++ Eigen/src/IterativeLinearSolvers/SolveWithGuess.h
@@ -42,6 +42,7 @@
 {
 public:
   typedef typename RhsType::Index Index;
+  typedef typename internal::traits<SolveWithGuess>::Scalar Scalar;
   typedef typename internal::traits<SolveWithGuess>::PlainObject PlainObject;
   typedef typename internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>, MatrixXpr, typename internal::traits<RhsType>::StorageKind>::type Base;

@@ -60,8 +61,6 @@
   const Decomposition &m_dec;
   const RhsType       &m_rhs;
   const GuessType     &m_guess;
-
-  typedef typename internal::traits<SolveWithGuess>::Scalar Scalar;

 private:
   Scalar coeff(Index row, Index col) const;


Use wi_fsenumerator_t instead of fts directly for lists and indexes

git-svn-id: fa0849429efd6140f8c6b0411d4b758884714b35@6139 94223b32-352b-4d6d-a509-7b239cf53eea

--- wired/files.c
+++ wired/files.c
@@ -56,14 +56,6 @@
 #define WD_FILES_INDEX_VERSION					1

-enum _wd_files_fts_action {
-	WD_FILES_FTS_KEEP,
-	WD_FILES_FTS_IGNORE,
-	WD_FILES_FTS_SKIP,
-	WD_FILES_FTS_ERROR
-};
-typedef enum _wd_files_fts_action				wd_files_fts_action_t;
-
 struct _wd_files_index_header {
 	char										magic[4];
 	uint32_t									version;
@@ -81,8 +73,8 @@
 static void										wd_files_index_update(wi_timer_t *);
 static wi_boolean_t								wd_files_index_update_size(void);
 static void										wd_files_index_thread(wi_runtime_instance_t *);
-static void										wd_files_index_path_to_file(wi_string_t *, wi_file_t *, const char *);
-static void										wd_files_index_write_entry(wi_file_t *, const char *, wi_string_t *, wd_file_type_t, uint64_t, wi_time_interval_t, wi_time_interval_t, wi_boolean_t, wi_boolean_t);
+static void										wd_files_index_path_to_file(wi_string_t *, wi_file_t *, wi_string_t *);
+static void										wd_files_index_write_entry(wi_file_t *, wi_string_t *, wd_file_type_t, uint64_t, wi_time_interval_t, wi_time_interval_t, wi_boolean_t, wi_boolean_t);

 static void										wd_files_fsevents_thread(wi_runtime_instance_t *);
 static void										wd_files_fsevents_callback(wi_string_t *);
@@ -96,10 +88,6 @@
 static wi_boolean_t								wd_files_drop_box_path_is_listable(wi_string_t *, wd_account_t *);
 static wi_string_t *							wd_files_drop_box_path_in_path(wi_string_t *, wd_user_t *);
 static wi_boolean_t								wd_files_name_matches_query(wi_string_t *, wi_string_t *);
-
-static WI_FTS *									wd_files_fts_open(wi_string_t *, wi_boolean_t);
-static wd_files_fts_action_t					wd_files_fts_action(WI_FTSENT *, int *);
-static int										wd_files_fts_namecmp(const WI_FTSENT **, const WI_FTSENT **);

 static wi_string_t								*wd_files;
@@ -165,19 +153,17 @@
 #pragma mark -

 void wd_files_reply_list(wi_string_t *path, wi_boolean_t recursive, wd_user_t *user, wi_p7_message_t *message) {
-	wi_p7_message_t			*reply;
-	WI_FTS					*fts = NULL;
-	WI_FTSENT				*p;
-	wi_string_t				*realpath, *filepath, *virtualpath;
-	wd_account_t			*account;
-	wi_fs_statfs_t			sfb;
-	wi_file_offset_t		size, available;
-	wd_file_type_t			type, pathtype;
-	wd_files_fts_action_t	action;
-	wi_fs_stat_t			sb, lsb;
-	wi_uinteger_t			pathlength, depthlimit;
-	int						error;
-	wi_boolean_t			root, upload, alias, readable;
+	wi_p7_message_t				*reply;
+	wi_string_t					*realpath, *filepath, *resolvedpath, *virtualpath;
+	wi_fsenumerator_t			*fsenumerator;
+	wd_account_t				*account;
+	wi_fs_statfs_t				sfb;
+	wi_fs_stat_t				sb, lsb;
+	wi_fsenumerator_status_t	status;
+	wi_file_offset_t			size, available;
+	wi_uinteger_t				pathlength, depthlimit;
+	wd_file_type_t				type, pathtype;
+	wi_boolean_t				root, upload, alias, readable;

 	root		= wi_is_equal(path, WI_STR("/"));
 	realpath	= wi_string_by_resolving_aliases_in_path(wd_files_real_path(path, user));
@@ -191,78 +177,62 @@
 	}

 	depthlimit = account->file_recursive_list_depth_limit;
-
-	fts = wd_files_fts_open(realpath, true);
-
-	if(!fts) {
-		wi_log_warn(WI_STR("Could not open %@: %s"),
-			realpath, strerror(errno));
+
+	fsenumerator = wi_fs_enumerator_at_path(realpath);
+
+	if(!fsenumerator) {
+		wi_log_warn(WI_STR("Could not open %@: %m"), realpath);
 		wd_user_reply_errno(user, message);
-
-		goto error;
-	}
-
+
+		return;
+	}
+
 	pathlength = wi_string_length(realpath);

 	if(pathlength == 1)
 		pathlength--;

-	while((p = wi_fts_read(fts))) {
-		if(depthlimit > 0 && (wi_uinteger_t) p->fts_level > depthlimit)
-			action = WD_FILES_FTS_SKIP;
-		else
-			action = wd_files_fts_action(p, &error);
-
-		switch(action) {
-			case WD_FILES_FTS_KEEP:
-				break;
-
-			case WD_FILES_FTS_IGNORE:
-				continue;
-				break;
-
-			case WD_FILES_FTS_SKIP:
-				wi_fts_set(fts, p, WI_FTS_SKIP);
-
-				continue;
-				break;
-
-			case WD_FILES_FTS_ERROR:
-				wi_log_warn(WI_STR("Could not list %s: %s"),
-					p->fts_path, strerror(error));
-
-				continue;
-				break;
+	while((status = wi_fsenumerator_get_next_path(fsenumerator, &filepath)) != WI_FSENUMERATOR_EOF) {
+		if(status == WI_FSENUMERATOR_ERROR) {
+			wi_log_warn(WI_STR("Could not list %@: %m"), filepath);
+
+			continue;
+		}
+
+		if(depthlimit > 0 && wi_fsenumerator_level(fsenumerator) > depthlimit) {
+			wi_fsenumerator_skip_descendents(fsenumerator);
+
+			continue;
 		}

 		if(!recursive)
-			wi_fts_set(fts, p, WI_FTS_SKIP);
-
-		filepath = wi_string_with_cstring(p->fts_path);
+			wi_fsenumerator_skip_descendents(fsenumerator);
+
 		virtualpath = wi_string_substring_from_index(filepath, pathlength);

 		if(!root)
 			wi_string_insert_string_at_index(virtualpath, path, 0);

-		alias = wi_fs_is_alias_cpath(p->fts_path);
+		alias = wi_fs_is_alias(filepath);

 		if(alias)
-			wi_string_resolve_aliases_in_path(filepath);
-
-		if(!wi_fs_lstat(filepath, &lsb)) {
-			wi_log_warn(WI_STR("Could not list %@: %m"), filepath);
-			wi_fts_set(fts, p, WI_FTS_SKIP);
+			resolvedpath = wi_string_by_resolving_aliases_in_path(filepath);
+		else
+			resolvedpath = filepath;
+
+		if(!wi_fs_lstat(resolvedpath, &lsb)) {
+			wi_log_warn(WI_STR("Could not list %@: %m"), resolvedpath);

 			continue;
 		}

-		if(!wi_fs_stat(filepath, &sb))
+		if(!wi_fs_stat(resolvedpath, &sb))
 			sb = lsb;

-		type = wd_files_type_with_stat(filepath, &sb);
+		type = wd_files_type_with_stat(resolvedpath, &sb);

 		if(type == WD_FILE_TYPE_DROPBOX)
-			readable = wd_files_drop_box_path_is_listable(filepath, account);
+			readable = wd_files_drop_box_path_is_listable(resolvedpath, account);
 		else
 			readable = true;

@@ -271,7 +241,7 @@
 			case WD_FILE_TYPE_UPLOADS:
 			case WD_FILE_TYPE_DROPBOX:
 				if(readable)
-					size = wd_files_count_path(filepath, user, message);
+					size = wd_files_count_path(resolvedpath, user, message);
 				else
 					size = 0;
 				break;
@@ -294,7 +264,7 @@
 		wi_release(reply);

 		if(recursive && !readable) {
-			wi_fts_set(fts, p, WI_FTS_SKIP);
+			wi_fsenumerator_skip_descendents(fsenumerator);

 			continue;
 		}
@@ -317,10 +287,6 @@
 	wi_p7_message_set_string_for_name(reply, path, WI_STR("wired.file.path"));
 	wi_p7_message_set_uint64_for_name(reply, available, WI_STR("wired.file.available"));
 	wd_user_reply_message(user, reply, message);
-
-error:
-	if(fts)
-		wi_fts_close(fts);
 }

@@ -736,6 +702,8 @@

 		wd_trackers_register();
 	}
+
+	index = true;

 	if(index) {
 		if(!wi_thread_create_thread_with_priority(wd_files_index_thread, wi_number_with_bool(startup), 0.0))
@@ -864,20 +832,18 @@

-static void wd_files_index_path_to_file(wi_string_t *path, wi_file_t *file, const char *pathprefix) {
-	wi_pool_t				*pool;
-	WI_FTS					*fts = NULL;
-	WI_FTSENT				*p;
-	wi_string_t				*filepath, *virtualpath, *resolvedpath;
-	wi_set_t				*set;
-	wi_number_t				*number;
-	wi_file_offset_t		size;
-	wd_file_type_t			type;
-	wd_files_fts_action_t	action;
-	wi_fs_stat_t			sb, lsb;
-	int						error;
-	wi_uinteger_t			i = 0, pathlength;
-	wi_boolean_t			alias, recurse;
+static void wd_files_index_path_to_file(wi_string_t *path, wi_file_t *file, wi_string_t *pathprefix) {
+	wi_pool_t					*pool;
+	wi_fsenumerator_t			*fsenumerator;
+	wi_string_t					*filepath, *virtualpath, *resolvedpath;
+	wi_set_t					*set;
+	wi_number_t					*number;
+	wi_file_offset_t			size;
+	wi_fs_stat_t				sb, lsb;
+	wi_fsenumerator_status_t	status;
+	wi_uinteger_t				i = 0, pathlength;
+	wi_boolean_t				alias, recurse;
+	wd_file_type_t				type;

 	if(wd_files_index_level >= WD_FILES_MAX_LEVEL) {
 		wi_log_warn(WI_STR("Skipping index of %@: %s"),
@@ -885,12 +851,11 @@

 		return;
 	}
-
-	fts = wd_files_fts_open(path, false);
-
-	if(!fts) {
-		wi_log_warn(WI_STR("Could not open %@: %s"),
-			path, strerror(errno));
+
+	fsenumerator = wi_fs_enumerator_at_path(path);
+
+	if(!fsenumerator) {
+		wi_log_warn(WI_STR("Could not open %@: %m"), path);

 		return;
 	}
@@ -903,37 +868,15 @@
 		pathlength--;

 	wd_files_index_level++;
-
-	while((p = wi_fts_read(fts))) {
-		if(++i % 100 == 0)
-			wi_pool_drain(pool);
-
-		action = wd_files_fts_action(p, &error);
-
-		switch(action) {
-			case WD_FILES_FTS_KEEP:
-				break;
+
+	while((status = wi_fsenumerator_get_next_path(fsenumerator, &filepath)) != WI_FSENUMERATOR_EOF) {
+		if(status == WI_FSENUMERATOR_ERROR) {
+			wi_log_warn(WI_STR("Skipping index of %@: %m"), path);

-			case WD_FILES_FTS_IGNORE:
-				continue;
-				break;
-
-			case WD_FILES_FTS_SKIP:
-				wi_fts_set(fts, p, WI_FTS_SKIP);
-
-				continue;
-				break;
-
-			case WD_FILES_FTS_ERROR:
-				wi_log_warn(WI_STR("Skipping index of %s: %s"),
-					p->fts_path, strerror(error));
-
-				continue;
-				break;
-		}
-
-		filepath	= wi_string_init_with_cstring(wi_string_alloc(), p->fts_path);
-		alias		= wi_fs_is_alias(filepath);
+			continue;
+		}
+
+		alias = wi_fs_is_alias(filepath);

 		if(alias)
 			resolvedpath = wi_string_by_resolving_aliases_in_path(filepath);
@@ -942,7 +885,7 @@

 		if(!wi_fs_lstat(resolvedpath, &lsb)) {
 			wi_log_warn(WI_STR("Skipping index of %@: %m"), resolvedpath);
-			wi_fts_set(fts, p, WI_FTS_SKIP);
+			wi_fsenumerator_skip_descendents(fsenumerator);
 		} else {
 			if(!wi_fs_stat(resolvedpath, &sb))
 				sb = lsb;
@@ -983,10 +926,9 @@
 				virtualpath	= wi_string_substring_from_index(filepath, pathlength);

 				if(pathprefix)
-					wi_string_insert_cstring_at_index(virtualpath, pathprefix, 0);
+					wi_string_insert_string_at_index(virtualpath, pathprefix, 0);

 				wd_files_index_write_entry(file,
-										   p->fts_name,
 										   virtualpath,
 										   type,
 										   size,
@@ -1003,32 +945,30 @@
 				}

 				if(type == WD_FILE_TYPE_DROPBOX)
-					wi_fts_set(fts, p, WI_FTS_SKIP);
+					wi_fsenumerator_skip_descendents(fsenumerator);
 				else if(recurse)
-					wd_files_index_path_to_file(resolvedpath, file, p->fts_path + pathlength);
+					wd_files_index_path_to_file(resolvedpath, file, wi_string_substring_from_index(filepath, pathlength));
 			}

 			wi_release(number);
 		}
-
-		wi_release(filepath);
+
+		if(++i % 100 == 0)
+			wi_pool_drain(pool);
 	}

 	wd_files_index_level--;

-	if(fts)
-		wi_fts_close(fts);
-
 	wi_release(pool);
 }

-static void wd_files_index_write_entry(wi_file_t *file, const char *name, wi_string_t *path, wd_file_type_t type, uint64_t size, wi_time_interval_t creationtime, wi_time_interval_t modificationtime, wi_boolean_t link, wi_boolean_t executable) {
+static void wd_files_index_write_entry(wi_file_t *file, wi_string_t *path, wd_file_type_t type, uint64_t size, wi_time_interval_t creationtime, wi_time_interval_t modificationtime, wi_boolean_t link, wi_boolean_t executable) {
 	static char				*buffer;
 	static wi_uinteger_t	bufferlength;
 	static uint32_t			searchlistid, pathid, typeid, sizeid, creationid, modificationid, linkid, executableid;
-	wi_string_t				*creationstring, *modificationstring;
+	wi_string_t				*name, *creationstring, *modificationstring;
 	uint32_t				entrylength, namelength, pathlength, creationlength, modificationlength;
 	char					*p;

@@ -1042,11 +982,12 @@
 		linkid			= wi_p7_spec_field_id(wi_p7_spec_field_with_name(wd_p7_spec, WI_STR("wired.file.link")));
 		executableid	= wi_p7_spec_field_id(wi_p7_spec_field_with_name(wd_p7_spec, WI_STR("wired.file.executable")));
 	}
-
+
+	name				= wi_string_last_path_component(path);
 	creationstring		= wi_time_interval_rfc3339_string(creationtime);
 	modificationstring	= wi_time_interval_rfc3339_string(modificationtime);

-	namelength			= strlen(name) + 1;
+	namelength			= wi_string_length(name) + 1;
 	pathlength			= wi_string_length(path) + 1;
 	creationlength		= wi_string_length(creationstring) + 1;
 	modificationlength	= wi_string_length(modificationstring) + 1;
@@ -1073,7 +1014,7 @@

 	memcpy(p, &entrylength, sizeof(entrylength));							p += sizeof(entrylength);
 	memcpy(p, &namelength, sizeof(namelength));								p += sizeof(namelength);
-	memcpy(p, name, namelength);											p += namelength;
+	memcpy(p, wi_string_cstring(name), namelength);							p += namelength;
 	wi_write_swap_host_to_big_int32(p, 0, searchlistid);					p += sizeof(searchlistid);
 	wi_write_swap_host_to_big_int32(p, 0, pathid);							p += sizeof(pathid);
 	wi_write_swap_host_to_big_int32(p, 0, pathlength);						p += sizeof(pathlength);
@@ -1650,68 +1591,3 @@
 	return (wi_string_index_of_string(name, query, WI_STRING_CASE_INSENSITIVE) != WI_NOT_FOUND);
 #endif
 }
-
-
-
-#pragma mark -
-
-static WI_FTS * wd_files_fts_open(wi_string_t *path, wi_boolean_t sorted) {
-	WI_FTS		*fts;
-	char		*paths[2];
-	int			options;
-
-	paths[0] = (char *) wi_string_cstring(path);
-	paths[1] = NULL;
-
-	options = WI_FTS_NOSTAT | WI_FTS_LOGICAL;
-	errno = 0;
-	fts = wi_fts_open(paths, options, sorted ? wd_files_fts_namecmp : NULL);
-
-	if(fts && errno != 0) {
-		wi_fts_close(fts);
-
-		fts = NULL;
-	}
-
-	return fts;
-}
-
-
-
-static wd_files_fts_action_t wd_files_fts_action(WI_FTSENT *p, int *err) {
-	if(p->fts_level == 0)
-		return WD_FILES_FTS_IGNORE;
-
-	if(p->fts_level > WD_FILES_MAX_LEVEL)
-		return WD_FILES_FTS_SKIP;
-
-	switch(p->fts_info) {
-		case WI_FTS_DC:
-			*err = ELOOP;
-
-			return WD_FILES_FTS_ERROR;
-			break;
-
-		case WI_FTS_DP:
-			return WD_FILES_FTS_SKIP;
-			break;
-
-		case WI_FTS_DNR:
-		case WI_FTS_ERR:
-			*err = p->fts_errno;
-
-			return WD_FILES_FTS_ERROR;
-			break;
-	}
-
-	if(p->fts_name[0] == '.')
-		return WD_FILES_FTS_SKIP;
-
-	return WD_FILES_FTS_KEEP;
-}
-
-
-
-static int wd_files_fts_namecmp(const WI_FTSENT **a, const WI_FTSENT **b) {
-	return strcasecmp((*a)->fts_name, (*b)->fts_name);
-}


word2Phrase modified to optimally choose between multiple phrase possibilities

--- word2phrase.c
+++ word2phrase.c
@@ -1,17 +1,3 @@
-//  Copyright 2013 Google Inc. All Rights Reserved.
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -24,9 +10,9 @@
 #define MAX_STRING 60

-const int vocab_hash_size = 500000000; // Maximum 500M entries in the vocabulary
-
-typedef float real;                    // Precision of float numbers
+const int vocab_hash_size = 500000000;
+
+typedef float real;

 struct vocab_word {
     long long cn;
@@ -40,19 +26,12 @@
 };

-char* strlwr(char str[]){
-    char mychar;
-    int counter=0;
-    char *x=(char *)calloc(strlen(str), sizeof(char));
-    while (str[counter])
-    {
-        mychar=str[counter];
-        x[counter] = tolower(mychar);
-        counter++;
-    }
-    x[counter]=0;
-    return x;
-}
+void strlwr(char *str){
+    char *p = str;
+    for ( ; *p; ++p)
+        *p = tolower(*p);
+};
+
 char train_file[MAX_STRING], output_file[MAX_STRING], formula[MAX_STRING];
 struct vocab_word *vocab;
 struct candidate_word *candidates;
@@ -63,32 +42,6 @@
 real threshold = 8;

 unsigned long long next_random = 1;
-
-
-
-// Reads a single word from a file, assuming space + tab + EOL to be word boundaries
-
-void ReadWordLower(char *word, FILE *fin) {
-    int a = 0, ch;
-    while (!feof(fin)) {
-        ch = fgetc(fin);
-        if (ch == 13) continue;
-        if ((ch == ' ') || (ch == '\t') || (ch == '\n')) {
-            if (a > 0) {
-                if (ch == '\n') ungetc(ch, fin);
-                break;
-            }
-            if (ch == '\n') {
-                strcpy(word, (char *)"</s>");
-                return;
-            } else continue;
-        }
-        word[a] = tolower(ch);
-        a++;
-        if (a >= MAX_STRING - 1) a--;   // Truncate too long words
-    }
-    word[a] = 0;
-}

 void ReadWord(char *word, FILE *fin) {
     int a = 0, ch;
@@ -122,7 +75,7 @@

 // Returns position of a word in the vocabulary; if the word is not found, returns -1
 int SearchVocab(char *word) {
-    word = strlwr(word);
+    strlwr(word);
     unsigned int hash = GetWordHash(word);
     while (1) {
         if (vocab_hash[hash] == -1) return -1;
@@ -160,12 +113,9 @@
 }

-
-
 // Adds a word to the vocabulary
 int AddWordToVocab(char *word) {
-    //word = toLowerCase(word);
-    //char* word2 = strlwr(word);
+    strlwr(word);
     unsigned int hash, length = strlen(word) + 1;
     if (length > MAX_STRING) length = MAX_STRING;
     vocab[vocab_size].word = (char *)calloc(length, sizeof(char));
@@ -242,9 +192,10 @@
         exit(1);
     }
     vocab_size = 0;
-    AddWordToVocab((char *)"</s>");
+    strcpy(word,(char *)"</s>");
+    AddWordToVocab(word);
     while (1) {
-        ReadWordLower(word, fin);
+        ReadWord(word, fin);
         if (feof(fin)) break;
         if (!strcmp(word, "</s>")) {
             start = 1;
@@ -279,10 +230,6 @@
     fclose(fin);
 }

-//bool isInfinite(const double pV)
-//{
-//    return (fabs(pV) == std::numeric_limits::infinity());
-//}
 int isInfinite(const double pV)
 {
     return !finite(pV);
@@ -310,9 +257,23 @@
     return -2*(part1+part2-part3-part4);
 }

-void TrainModel2() {
+static int compar (const void *a, const void *b)
+{
+    int aa = *((int *)a), bb = *((int *)b);
+
+    if (candidates[aa].score < candidates[bb].score) return 1;
+    if (candidates[aa].score == candidates[bb].score) return 0;
+    if (candidates[aa].score < candidates[bb].score) return -1;
+    return 0;
+}
+
+int cmpfunc (const void * a, const void * b)
+{
+    return ( *(int*)a - *(int*)b );
+}
+void TrainModel() {
     long long pa = 0, pb = 0, pab = 0, oov, i, li = -1, cn = 0;
-    char word[MAX_STRING], last_word[MAX_STRING], bigram_word[MAX_STRING * 2];
+    char orgWord[MAX_STRING],orgLastWord[MAX_STRING],word[MAX_STRING], last_word[MAX_STRING], bigram_word[MAX_STRING * 2];
     real score;
     FILE *fo, *fin;
     printf("Starting training using file %s\n", train_file);
@@ -323,10 +284,16 @@

     while (1) {
         strcpy(last_word, word);
+        strcpy(orgLastWord, orgWord);
+
         ReadWord(word, fin);
         if (feof(fin)) break;
         if (!strcmp(word, "</s>")) {
-            fprintf(fo, "\n");
+            fprintf(fo, " \n");
+            continue;
+        }
+        if (!strcmp(word, "\r")) {
+            fprintf(fo, " \r");
             continue;
         }
         cn++;
@@ -335,6 +302,8 @@
             fflush(stdout);
         }
         oov = 0;
+
+        strcpy(orgWord, word);
         i = SearchVocab(word);
         if (i == -1) oov = 1; else pb = vocab[i].cn;
         if (li == -1) oov = 1;
@@ -350,75 +319,8 @@
             else score = (pab - min_count) / (real)pa / (real)pb * (real)train_words;
         }
         if (score > threshold) {
-            fprintf(fo, "_%s", word);
-            pb = 0;
-        } else fprintf(fo, " %s", word);
-        pa = pb;
-    }
-    fclose(fo);
-    fclose(fin);
-}
-static int compar (const void *a, const void *b)
-{
-    int aa = *((int *)a), bb = *((int *)b);
-
-    if (candidates[aa].score < candidates[bb].score) return 1;
-    if (candidates[aa].score == candidates[bb].score) return 0;
-    if (candidates[aa].score < candidates[bb].score) return -1;
-    return 0;
-}
-
-int cmpfunc (const void * a, const void * b)
-{
-    return ( *(int*)a - *(int*)b );
-}
-void TrainModel() {
-    long long pa = 0, pb = 0, pab = 0, oov, i, li = -1, cn = 0;
-    char word[MAX_STRING], last_word[MAX_STRING], bigram_word[MAX_STRING * 2];
-    real score;
-    FILE *fo, *fin;
-    printf("Starting training using file %s\n", train_file);
-    LearnVocabFromTrainFile();
-    fin = fopen(train_file, "rb");
-    fo = fopen(output_file, "wb");
-    word[0] = 0;
-
-    while (1) {
-
-        ReadWord(word, fin);
-        if (feof(fin)) break;
-        if (!strcmp(word, "</s>")) {
-            fprintf(fo, "\n");
-            continue;
-        }
-
-        cn++;
-        if ((debug_mode > 1) && (cn % 100000 == 0)) {
-            printf("Words written: %lldK%c", cn / 1000, 13);
-            fflush(stdout);
-        }
-        oov = 0;
-
-
-
-        //strlwr(word);
-        i = SearchVocab(word);
-        if (i == -1) oov = 1; else pb = vocab[i].cn;
-        if (li == -1) oov = 1;
-        li = i;
-        sprintf(bigram_word, "%s_%s", last_word, word);
-        bigram_word[MAX_STRING - 1] = 0;
-        i = SearchVocab(bigram_word);
-        if (i == -1) oov = 1; else pab = vocab[i].cn;
-        if (pa < min_count) oov = 1;
-        if (pb < min_count) oov = 1;
-        if (oov) score = 0; else {
-            if (formulaFlag) score = calculateLikelihoodRatio(pa,pb,(pab-min_count),train_words);
-            else score = (pab - min_count) / (real)pa / (real)pb * (real)train_words;
-        }
-        if (score > threshold) {
             //fprintf(fo, "_%s", word);
-            AddWordsToCandidateList(last_word,word,score);
+            AddWordsToCandidateList(orgLastWord,orgWord,score);
             //pb = 0;
         } else {
             if (candidates_size>0)
@@ -445,7 +347,7 @@
                 //if (idx2[k]!=(candidates_size-1)) fprintf(fo, " %s", last_word);
                 candidates_size=0;
             }
-            fprintf(fo, " %s", word);
+            fprintf(fo, " %s", orgWord);
         }
         pa = pb;
     }
@@ -464,12 +366,7 @@
     }
     return -1;
 }
-int main2(int argc, char **argv) {
-    char* s = "Hello world\n";
-    s = strlwr(s);
-    printf(s);
-    return 0;
-}
+
 int main(int argc, char **argv) {
     int i;
     if (argc == 1) {


change comment; move comment; delete dead variable.

--- flstats.c
+++ flstats.c
@@ -72,7 +72,7 @@
     u_char
 	flow_type,		/* which flow type is this? */
 	parent_ftype,		/* parent's flow type index */
-	class;			/* where are statistics recorded? */
+	class;			/* class of this flow */
     u_long
 	packets,		/* number of packets received */
 	created_bin,
@@ -705,12 +705,7 @@
     clstats_p cl;

     /* do we need to callout? */
-    if (fe->pkt_recv_cmd && TIME_LT(&curtime, &fe->pkt_recv_cmd_time)) {
-	char buf[60];
-	int n;
-	struct timeval outtime;
-
-	sprintf(buf, " %d %d ", fe->class, fe->flow_type);
+
 	/*
 	 * i can think of a few things this might be good for:
 	 *
@@ -741,15 +736,25 @@
 	 *	this can make the deletion "data driven" (by the
 	 *	*next* packet received in the same flow).
 	 */
+
+    if (fe->pkt_recv_cmd && TIME_LT(&curtime, &fe->pkt_recv_cmd_time)) {
+	char buf[60];
+	int n;
+	struct timeval outtime;
+
+	sprintf(buf, " %d %d ", fe->class, fe->flow_type);
+
 	if (Tcl_VarEval(interp, fe->pkt_recv_cmd,
 		    buf, flow_id_to_string(ft, fe->key), 0) != TCL_OK) {
 	    packet_error = TCL_ERROR;
 	    return;
 	}
+
 	n = sscanf(interp->result, "%d %s %d.%d",
 				    &fe->class, buf,
 				    &fe->pkt_recv_cmd_time.tv_sec,
 				    &fe->pkt_recv_cmd_time.tv_usec);
+
 	if (n >= 2) {
 	    free(fe->pkt_recv_cmd);
 	    if (buf[0] != '-') {
@@ -763,7 +768,6 @@
 	}
     }

-    ft = &ftinfo[fe->flow_type];
     cl = &clstats[fe->class];
     /* update counters (after callout has had a chance to change things) */
     cl->cls_packets++;


clang style plugin fix: Add "virtual" to an overriding method.

BUG=none
TEST=none
TBR=xiyuan

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@78035 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/ui/webui/collected_cookies_ui_delegate.h
+++ chrome/browser/ui/webui/collected_cookies_ui_delegate.h
@@ -61,9 +61,9 @@
                            ContentSetting setting);

   // Notification Observer implementation.
-  void Observe(NotificationType type,
-               const NotificationSource& source,
-               const NotificationDetails& details);
+  virtual void Observe(NotificationType type,
+                       const NotificationSource& source,
+                       const NotificationDetails& details);

   // JS callback to bind cookies tree models with JS trees.
   void BindCookiesTreeModel(const ListValue* args);


no need for BKTR_NO_OPEN_RESET option now that all tuners sw has been fixed; from jakemsr@

--- dev/pci/bktr/bktr_core.c
+++ dev/pci/bktr/bktr_core.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: bktr_core.c,v 1.14 2005/04/14 12:25:31 mickey Exp $	*/
+/*	$OpenBSD: bktr_core.c,v 1.15 2005/05/19 17:43:33 mickey Exp $	*/
 /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */

 /*
@@ -617,15 +617,6 @@

 	/* Initialise any MSP34xx or TDA98xx audio chips */
 	init_audio_devices(bktr);
-
-#ifdef BKTR_NO_OPEN_RESET
-	/* enable drivers on the GPIO port that control the MUXes */
-	OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | bktr->card.gpio_mux_bits);
-
-	/* mute the audio stream */
-	set_audio( bktr, AUDIO_MUTE );
-#endif
-
 }

@@ -1001,7 +992,8 @@

 	}

-	OUTB(bktr, BKTR_IFORM, INB(bktr, BKTR_IFORM) | format_params[bktr->format_params].iform_xtsel);
+	OUTB(bktr, BKTR_IFORM, INB(bktr, BKTR_IFORM) |
+	    format_params[bktr->format_params].iform_xtsel);

 	/* work around for new Hauppauge 878 cards */
 	if ((bktr->card.card_id == CARD_HAUPPAUGE) &&
@@ -1026,7 +1018,8 @@

 	bktr->max_clip_node = 0;

-	OUTB(bktr, BKTR_COLOR_CTL, BT848_COLOR_CTL_GAMMA | BT848_COLOR_CTL_RGB_DED);
+	OUTB(bktr, BKTR_COLOR_CTL,
+	    BT848_COLOR_CTL_GAMMA | BT848_COLOR_CTL_RGB_DED);

 	OUTB(bktr, BKTR_E_HSCALE_LO, 170);
 	OUTB(bktr, BKTR_O_HSCALE_LO, 170);
@@ -1056,9 +1049,9 @@

 	bktr->capture_area_enabled = FALSE;

-	OUTL(bktr, BKTR_INT_MASK, BT848_INT_MYSTERYBIT);	/* if you take this out triton
-                                                   based motherboards will
-						   operate unreliably */
+	/* if you take this out triton-based mobos will operate unreliably */
+	OUTL(bktr, BKTR_INT_MASK, BT848_INT_MYSTERYBIT);
+
 	return( 0 );
 }

@@ -1097,7 +1090,6 @@

 	bktr->tflags |= TUNER_OPEN;

-#ifndef BKTR_NO_OPEN_RESET
 	bktr->tuner.frequency = 0;
 	bktr->tuner.channel = 0;
 	bktr->tuner.chnlset = DEFAULT_CHNLSET;
@@ -1105,14 +1097,14 @@
 	bktr->tuner.radio_mode = 0;

 	/* enable drivers on the GPIO port that control the MUXes */
-	OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | bktr->card.gpio_mux_bits);
+	OUTL(bktr, BKTR_GPIO_OUT_EN,
+	    INL(bktr, BKTR_GPIO_OUT_EN) | bktr->card.gpio_mux_bits);

 	/* unmute the audio stream */
 	set_audio( bktr, AUDIO_UNMUTE );

 	/* Initialise any audio chips, eg MSP34xx or TDA98xx */
 	init_audio_devices( bktr );
-#endif

 	return( 0 );
 }
@@ -1155,13 +1147,12 @@
 {
 	bktr->tflags &= ~TUNER_OPEN;

-#ifndef BKTR_NO_OPEN_RESET
 	/* mute the audio by switching the mux */
 	set_audio( bktr, AUDIO_MUTE );

 	/* disable drivers on the GPIO port that control the MUXes */
-	OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) & ~bktr->card.gpio_mux_bits);
-#endif
+	OUTL(bktr, BKTR_GPIO_OUT_EN,
+	    INL(bktr, BKTR_GPIO_OUT_EN) & ~bktr->card.gpio_mux_bits);

 	return( 0 );
 }


Create ex02.c

Create ex02.c

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

--- C/AULA5/Caio/ex02.c
+++ C/AULA5/Caio/ex02.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <string.h>
+
+main () {
+    char frase[30];
+    int j, tam, a = 0, e = 0, i = 0, o = 0, u = 0;
+
+    printf("Entre com uma frase: ");
+    gets(frase);
+
+    tam = strlen(frase) - 1;
+
+    for (j = 0; j <= tam; j++) {
+
+        switch (frase[j]) {
+        case 'a':
+        case 'A':
+            a += 1;
+        break;
+        case 'e':
+        case 'E':
+            e += 1;
+        break;
+        case 'i':
+        case 'I':
+            i += 1;
+        break;
+        case 'o':
+        case 'O':
+            o += 1;
+        break;
+        case 'u':
+        case 'U':
+            u += 1;
+        break;
+        }
+
+    }
+
+    printf("A frase tem %d \"as\", %d \"es\", %d \"is\", %d \"os\", %d \"us\"", a, e, i, o, u);
+}


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

--- C/Math/CalcSalary.c
+++ C/Math/CalcSalary.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+int main() {
+    float salario;
+    printf("informe o salario atual: ");
+    scanf("%f", &salario);
+    printf("informe o percentual de reajuste: ");
+    int percentual;
+    scanf("%d", &percentual);
+    printf("o novo salario e:%f\n ", salario + (salario * (percentual / 100.0)));
+}
+
+//https://pt.stackoverflow.com/q/323755/101


Started adding service discovery to C server

--- C/src/PiVisServer.c
+++ C/src/PiVisServer.c
@@ -6,14 +6,22 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <errno.h>
+#include <sys/time.h>

 #define IP_ADDRESS_LENGTH INET_ADDRSTRLEN
 #define INVALID_32_BIT_INT 0xFFFFFFFF
+#define DISCOVER_COLOR_SERVICE (3069)
+#define DISCOVER_COLOR_SERVICE_MESSAGE "WHERE_IS_3070"
+#define DISCOVER_GRAY_SERVICE (3069)
+#define DISCOVER_GRAY_SERVICE_MESSAGE "WHERE_IS_3071"
+#define MULTICAST_GROUP "224.1.1.1"

 static SchdRunFuncEntry funcEntry;
 static char ownIpAddress[IP_ADDRESS_LENGTH];
 static unsigned int servedPortNo;
-static int socketFd;
+static int serverSocket;
+static int serviceDiscoverySocket;
+static struct sockaddr_in addr;

 static void getOwnIpAddress(char* address);
 static void initiateSocket(void);
@@ -54,9 +62,60 @@
 	freeifaddrs(addrs);
 }

+static void initiateSocket(void)
+{
+    int nbytes;
+	int addrlen;
+    struct ip_mreq mreq;
+	serviceDiscoverySocket = socket(AF_INET, SOCK_DGRAM, 0);
+	unsigned int yes = 1;
+    if(0 > setsockopt(serviceDiscoverySocket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)))
+    {
+    	perror("setsockopt 1");
+    	exit(1);
+    }
+
+    memset(&addr, 0, sizeof(addr));
+    addr.sin_family = AF_INET;
+    addr.sin_addr.s_addr = htonl(INADDR_ANY);
+    addr.sin_port = htons(DISCOVER_COLOR_SERVICE);
+
+    if(0 > bind(serviceDiscoverySocket, (struct sockaddr*)&addr, sizeof(addr)))
+    {
+    	perror("bind");
+    	exit(1);
+    }
+
+    mreq.imr_multiaddr.s_addr = inet_addr(MULTICAST_GROUP);
+    mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+
+    setsockopt(serviceDiscoverySocket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
+
+	struct timeval timeout;
+	timeout.tv_sec = 0;
+	timeout.tv_usec = 1000;
+
+	setsockopt(serviceDiscoverySocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout));
+}
+
 static void run()
 {
 	(void) printf("Server run called\n");
+	handleNewServiceDiscoveryRequests();
+}
+
+static void handleNewServiceDiscoveryRequests()
+{
+	char messageBuf[50];
+	unsigned int addrLen = sizeof(addr);
+	int bytesReceived = recvfrom(serviceDiscoverySocket,
+								 messageBuf,
+								 sizeof(messageBuf),
+								 0,
+								 (struct sockaddr *) &addr,
+								 &addrLen);
+
+	printf("messageBuf: %s\n", messageBuf);
 }

 void SERVER_init()
@@ -67,6 +126,8 @@
 	getOwnIpAddress(ownIpAddress);

 	servedPortNo = (INVALID_32_BIT_INT);
+
+	initiateSocket();

 	SCHED_registerCallback(&funcEntry);
 }


usbd_cdc_if change buffer resize rx buffer remove tx buffer

--- bcl/stm/src/usbd_cdc_if.c
+++ bcl/stm/src/usbd_cdc_if.c
@@ -72,8 +72,6 @@
 /* USER CODE BEGIN PRIVATE_DEFINES */
 /* Define size for the receive and transmit buffer over CDC */
 /* It's up to user to redefine and/or remove those define */
-#define APP_RX_DATA_SIZE  1024
-#define APP_TX_DATA_SIZE  1024
 /* USER CODE END PRIVATE_DEFINES */
 /**
   * @}
@@ -95,10 +93,7 @@
 /* Create buffer for reception and transmission           */
 /* It's up to user to redefine and/or remove those define */
 /* Received Data over USB are stored in this buffer       */
-uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
-
-/* Send Data over USB CDC are stored in this buffer       */
-uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
+uint8_t UserRxBufferFS[CDC_DATA_HS_MAX_PACKET_SIZE];

 /* USER CODE BEGIN PRIVATE_VARIABLES */
 /* USER CODE END PRIVATE_VARIABLES */
@@ -154,7 +149,7 @@
 {
   /* USER CODE BEGIN 3 */
   /* Set Application Buffers */
-  USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
+//  USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
   USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
   return (USBD_OK);
   /* USER CODE END 3 */
@@ -299,9 +294,7 @@
     return USBD_BUSY;
   }

-  memcpy(UserTxBufferFS, Buf, Len);
-
-  USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, Len);
+  USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);

   result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);


Removed an errant fprintf when deleting files.

--- Frameworks/SnoizeMIDISpy/Framework/FSCopyObject.c
+++ Frameworks/SnoizeMIDISpy/Framework/FSCopyObject.c
@@ -1458,8 +1458,7 @@
                         CFRelease(url);
                     }
                     // delete the item
-						theGlobals->result = FSDeleteObject(&itemToDelete);
-                    fprintf(stderr, "result of deleting: %d\n", theGlobals->result);
+                    theGlobals->result = FSDeleteObject(&itemToDelete);
                 }
 			}
 		} while ( theGlobals->result == noErr );


fixed EEPROM pointers

fixed EEPROM pointers

--- content/OTRadioLink/utility/OTV0P2BASE_EEPROM.h
+++ content/OTRadioLink/utility/OTV0P2BASE_EEPROM.h
@@ -106,12 +106,12 @@

 //TODO-793
 // 16 Byte primary building key (secret key)
-static const uint16_t VOP2BASE_EE_START_16BYTE_PRIMARY_BUILDING_KEY = 112;
+static const uint8_t *VOP2BASE_EE_START_16BYTE_PRIMARY_BUILDING_KEY = 112;
 static const uint8_t VOP2BASE_EE_LEN_16BYTE_PRIMARY_BUILDING_KEY  = 16;

 // Start area of radio config mem
-static const uint16_t V0P2BASE_EE_START_RADIO = 128; // INCLUSIVE START OF RADIO CONFIG AREA. // FIXME should this be a uint8_t? (technically a pointer to a 1 KiB eeprom)
+static const uint8_t *V0P2BASE_EE_START_RADIO = 128; // INCLUSIVE START OF RADIO CONFIG AREA. // FIXME should this be a uint8_t? (technically a pointer to a 1 KiB eeprom)
 static const uint8_t V0P2BASE_EE_LEN_RADIO  = 128; // SIZE OF RADIO CONFIG AREA.
 static const uint8_t V0P2BASE_EE_END_RADIO  = 255;

@@ -158,20 +158,20 @@

 // TODO-793
 // Node associations memory. Should fit 16 nodes within 256 bytes of EEPROM
-static const uint16_t V0P2BASE_EE_START_NODE_ASSOCIATIONS = 768; // Inclusive start of node associations
+static const uint8_t *V0P2BASE_EE_START_NODE_ASSOCIATIONS = 768; // Inclusive start of node associations
 static const uint8_t V0P2BASE_EE_NODE_ASSOCIATIONS_SET_SIZE  = 16;              // Size in entries/bytes of one Node association entry

 // Node association fields, 0 upwards, contiguous.
 static const uint8_t V0P2BASE_EE_NODE_ASSOCIATIONS_8B_ID_OFFSET  = 0;  // 8 Byte node ID.
 static const uint8_t V0P2BASE_EE_NODE_ASSOCIATIONS_8B_ID_LENGTH  = 8;  // 8 Byte node ID.
-static const uint8_t V0P2BASE_EE_NODE_ASSOCIATIONS_RESERVED      = 8;  // Reserved
+static const uint8_t V0P2BASE_EE_NODE_ASSOCIATIONS_RESERVED_OFFSET = 8;  // Reserved

 static const uint8_t V0P2BASE_EE_NODE_ASSOCIATIONS_MAX_SETS      = 16; // Maximum possible node associations

 // Compute start of node association set (in range [0,V0P2BASE_EE_NODE_ASSOCIATIONS_SETS-1]) in EEPROM.
 // static const uint16_t V0P2BASE_EE_NODE_ASSOCIATIONS_START_ADDR
 // INCLUSIVE END OF NODE ASSOCIATIONS AREA: must point to last byte used.
-static const uint16_t V0P2BASE_EE_END_NODE_ASSOCIATIONS = (V0P2BASE_EE_NODE_ASSOCIATIONS_MAX_SETS * V0P2BASE_EE_NODE_ASSOCIATIONS_SET_SIZE)-1; //
+static const uint8_t *V0P2BASE_EE_END_NODE_ASSOCIATIONS = (V0P2BASE_EE_NODE_ASSOCIATIONS_MAX_SETS * V0P2BASE_EE_NODE_ASSOCIATIONS_SET_SIZE)-1; //

 // Updates an EEPROM byte iff not currently at the specified target value.
 // May be able to selectively erase or write (ie reduce wear) to reach the desired value.


Fix comment about when the delegate is released.

--- SPDY/SPDY/SPDY.h
+++ SPDY/SPDY/SPDY.h
@@ -46,7 +46,7 @@

 + (SPDY *)sharedSPDY;

-// A reference to delegate is kept until the stream is closed.  The caller will get an onError or onResponseBody before the stream is closed.
+// A reference to delegate is kept until the stream is closed.  The caller will get an onError or onStreamClose before the stream is closed.
 - (void)fetch:(NSString *)path delegate:(RequestCallback *)delegate;
 - (void)fetchFromMessage:(CFHTTPMessageRef)request delegate:(RequestCallback *)delegate;


[ALSA] hda-intel - Switch to polling mode for CORB/RIRB communication

Automatically switch to polling mode for CORB/RIRB communication
if the irq-driven mode seems not working well.  If the polling
mode still doesn't work, switch to single_cmd mode as fallback.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>
Signed-off-by: Jaroslav Kysela <72edd5e1a572f82f059ccbb83c92b74d6cb051ff@suse.cz>

--- sound/pci/hda/hda_intel.c
+++ sound/pci/hda/hda_intel.c
@@ -332,6 +332,7 @@
 	int position_fix;
 	unsigned int initialized: 1;
 	unsigned int single_cmd: 1;
+	unsigned int polling_mode: 1;
 };

 /* driver types */
@@ -518,8 +519,23 @@
 	struct azx *chip = codec->bus->private_data;
 	int timeout = 50;

-	while (chip->rirb.cmds) {
+	for (;;) {
+		if (chip->polling_mode) {
+			spin_lock_irq(&chip->reg_lock);
+			azx_update_rirb(chip);
+			spin_unlock_irq(&chip->reg_lock);
+		}
+		if (! chip->rirb.cmds)
+			break;
 		if (! --timeout) {
+			if (! chip->polling_mode) {
+				snd_printk(KERN_WARNING "hda_intel: "
+					   "azx_get_response timeout, "
+					   "switching to polling mode...\n");
+				chip->polling_mode = 1;
+				timeout = 50;
+				continue;
+			}
 			snd_printk(KERN_ERR
 				   "hda_intel: azx_get_response timeout, "
 				   "switching to single_cmd mode...\n");


ALSA: hda - Define the DCAPS preset for the old Intel chipsets

Just for improving readability.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>


ALSA: hdspm - Add firmware revision ID for RME MADI PCI version

The PCI version of the RME HDSP MADI card uses 0xcf as revision ID. Just
add this to the list of supported cards.

Signed-off-by: Adrian Knoth <b3e8ff7ac1c7e75661e16152a5dce1ff36a3e140@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/rme9652/hdspm.c
+++ sound/pci/rme9652/hdspm.c
@@ -521,6 +521,7 @@
 #define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024)

 /* revisions >= 230 indicate AES32 card */
+#define HDSPM_MADI_OLD_REV	207
 #define HDSPM_MADI_REV		210
 #define HDSPM_RAYDAT_REV	211
 #define HDSPM_AIO_REV		212
@@ -6379,6 +6380,7 @@

 	switch (hdspm->firmware_rev) {
 	case HDSPM_MADI_REV:
+	case HDSPM_MADI_OLD_REV:
 		hdspm->io_type = MADI;
 		hdspm->card_name = "RME MADI";
 		hdspm->midiPorts = 3;


perf: Make cmd_to_page() function more compact

Remove branch for is_perf_command.

Signed-off-by: Wenji Huang <8292ae49217b25322b6733efc03e93d03677338d@oracle.com>
Cc: e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com
Cc: dae4bd386fd4c6474c13eecbb94aa6e9e7589534@redhat.com
Cc: 293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com
LKML-Reference: <1263373298-13282-1-git-send-email-8292ae49217b25322b6733efc03e93d03677338d@oracle.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- tools/perf/builtin-help.c
+++ tools/perf/builtin-help.c
@@ -313,8 +313,6 @@
 		return "perf";
 	else if (!prefixcmp(perf_cmd, "perf"))
 		return perf_cmd;
-	else if (is_perf_command(perf_cmd))
-		return prepend("perf-", perf_cmd);
 	else
 		return prepend("perf-", perf_cmd);
 }


pthread/mutex: fix a compilation error

pthread/mutex: fix a compilation error

This patch fixes a compilation error below:

    CC:  pthread/pthread_mutexlock.c
    pthread/pthread_mutexlock.c:254:2: error: expected identifier or '(' before 'return'
      return ret;
      ^
    pthread/pthread_mutexlock.c:255:1: error: expected identifier or '(' before '}' token
     }
     ^
    /home/ebsong/tizenrt/os/include/pthread.h: In function 'pthread_mutex_lock':
    pthread/pthread_mutexlock.c:251:2: error: control reaches end of non-void function [-Werror=return-type]
      }
      ^
    cc1: all warnings being treated as errors

Change-Id: I183a97f0cad5a865ec474a73fc525a68766c827b
Signed-off-by: EunBong Song <1a7e7e98e070490e67aa35ab67fbf9fdda8f48ac@samsung.com>

--- os/kernel/pthread/pthread_mutexlock.c
+++ os/kernel/pthread/pthread_mutexlock.c
@@ -224,8 +224,9 @@

 			mutex->flags |= _PTHREAD_MFLAGS_INCONSISTENT;
 			ret = EOWNERDEAD;
-		} else {
+		} else
 #endif /* !CONFIG_PTHREAD_MUTEX_UNSAFE */
+		{

 			/* Take the underlying semaphore, waiting if necessary.  NOTE that
 			 * is required to deadlock for the case of the non-robust NORMAL or


ALSA: hdspm - Report external rate in slave mode on PCI MADI

As a follow-up to a97bda7d29d02a2e9c6609d0947b15e55f5200e5, report the
external sample rate as system_sample_rate when in slave mode.

For PCIe MADI cards, the DDS value automatically contains the external
sample rate, but the PCI version needs this manual workaround.

Signed-off-by: Adrian Knoth <b3e8ff7ac1c7e75661e16152a5dce1ff36a3e140@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/rme9652/hdspm.c
+++ sound/pci/rme9652/hdspm.c
@@ -971,6 +971,7 @@
 static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm);
 static int hdspm_autosync_ref(struct hdspm *hdspm);
 static int snd_hdspm_set_defaults(struct hdspm *hdspm);
+static int hdspm_system_clock_mode(struct hdspm *hdspm);
 static void hdspm_set_sgbuf(struct hdspm *hdspm,
 			    struct snd_pcm_substream *substream,
 			     unsigned int reg, int channels);
@@ -1989,10 +1990,14 @@
 	rate = hdspm_calc_dds_value(hdspm, period);

 	if (rate > 207000) {
-		/* Unreasonable high sample rate as seen on PCI MADI cards.
-		 * Use the cached value instead.
-		 */
-		rate = hdspm->system_sample_rate;
+		/* Unreasonable high sample rate as seen on PCI MADI cards. */
+		if (0 == hdspm_system_clock_mode(hdspm)) {
+			/* master mode, return internal sample rate */
+			rate = hdspm->system_sample_rate;
+		} else {
+			/* slave mode, return external sample rate */
+			rate = hdspm_external_sample_rate(hdspm);
+		}
 	}

 	return rate;


perf gtk/hists: Add a double-click handler for callchains

If callchain is displayed, add "row-activated" signal handler for
handling double-click or pressing ENTER key action.

Reviewed-by: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org>
Signed-off-by: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>
Cc: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org>
Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Link: http://lkml.kernel.org/r/1370337737-30812-6-git-send-email-5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/ui/gtk/hists.c
+++ tools/perf/ui/gtk/hists.c
@@ -185,6 +185,18 @@
 		perf_gtk__add_callchain(&node->rb_root, store, &iter, col,
 					child_total);
 	}
+}
+
+static void on_row_activated(GtkTreeView *view, GtkTreePath *path,
+			     GtkTreeViewColumn *col __maybe_unused,
+			     gpointer user_data __maybe_unused)
+{
+	bool expanded = gtk_tree_view_row_expanded(view, path);
+
+	if (expanded)
+		gtk_tree_view_collapse_row(view, path);
+	else
+		gtk_tree_view_expand_row(view, path, FALSE);
 }

 static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
@@ -314,6 +326,8 @@
 		}
 	}

+	g_signal_connect(view, "row-activated",
+			 G_CALLBACK(on_row_activated), NULL);
 	gtk_container_add(GTK_CONTAINER(window), view);
 }


Fix creating of sibling floating/children

If we want to add a sibling of different type than current
container it failed. Because we add it to the wrong list

--- sway/layout.c
+++ sway/layout.c
@@ -99,11 +99,20 @@

 swayc_t *add_sibling(swayc_t *fixed, swayc_t *active) {
 	swayc_t *parent = fixed->parent;
-	int i = index_child(fixed);
 	if (fixed->is_floating) {
-		list_insert(parent->floating, i + 1, active);
+		if (active->is_floating) {
+			int i = index_child(fixed);
+			list_insert(parent->floating, i + 1, active);
+		} else {
+			list_add(parent->children, active);
+		}
 	} else {
-		list_insert(parent->children, i + 1, active);
+		if (active->is_floating) {
+			list_add(parent->floating, active);
+		} else {
+			int i = index_child(fixed);
+			list_insert(parent->children, i + 1, active);
+		}
 	}
 	active->parent = parent;
 	// focus new child


Make Linux happy (#263).

Make Linux happy (#263).

--- src/api/libcellml/namespaces.h
+++ src/api/libcellml/namespaces.h
@@ -20,8 +20,8 @@

 namespace libcellml {

-static const char *CELLML_2_0_NS = "http://www.cellml.org/cellml/2.0#";
-static const char *MATHML_NS = "http://www.w3.org/1998/Math/MathML";
-static const char *XLINK_NS = "http://www.w3.org/1999/xlink";
+const char * const CELLML_2_0_NS = "http://www.cellml.org/cellml/2.0#";
+const char * const MATHML_NS     = "http://www.w3.org/1998/Math/MathML";
+const char * const XLINK_NS      = "http://www.w3.org/1999/xlink";

 }


Fix typo

Fix typo

--- example_callbacks/oauth2_bearer/glewlwyd_resource.c
+++ example_callbacks/oauth2_bearer/glewlwyd_resource.c
@@ -174,7 +174,7 @@
   time_t now;
   json_int_t expiration;
   int res;
-  (void)(config); // Avoid coompiler warning
+  (void)(config); // Avoid compiler warning

   if (j_access_token != NULL) {
     // Token is valid, check type and expiration date


* remove test trap code for TravisCI

* remove test trap code for TravisCI

--- deps/leveldb/leveldb-1.18/port/port.h
+++ deps/leveldb/leveldb-1.18/port/port.h
@@ -12,16 +12,14 @@
 // of what the new port_<platform>.h file must provide.
 #if defined(LEVELDB_PLATFORM_UV)
 #  include "port_uv.h"
+#elif defined(LEVELDB_PLATFORM_POSIX)
+#  include "port/port_posix.h"
 #elif defined(LEVELDB_PLATFORM_CHROMIUM)
 #  include "port/port_chromium.h"
-why_should_chrome
-#else
-//#elif defined(LEVELDB_PLATFORM_POSIX)
-#  include "port/port_posix.h"
 #endif

 #ifndef UINT32_MAX
-#  define UINT32_MAX   0xffffffff [exact]
+#  define UINT32_MAX   0xffffffff
 #endif

 #ifndef SIZE_MAX


Minor prettification of comments

Minor prettification of comments

--- implementations/MaxMSP/jcom.parameter/jcom.parameter.h
+++ implementations/MaxMSP/jcom.parameter/jcom.parameter.h
@@ -59,7 +59,7 @@
 	SymbolPtr		attr_dataspace;				///< The dataspace that this parameter uses (default is 'none')
 	TTObjectPtr		dataspace_override2unit;	///< Pointer to dataspace used to convert values from override to active unit
 	TTObjectPtr		dataspace_unit2override;	///< Pointer to dataspace used to convert values from active to override unit
-	SymbolPtr		attr_unit;			///< The active (input/output) unit within the dataspace: the type of values a user is sending and receiving.
+	SymbolPtr		attr_unit;					///< The active (input/output) unit within the dataspace: the type of values a user is sending and receiving.
 	SymbolPtr		attr_unitOverride;			///< An internal unit conversion that is used temporarily when the parameter's value is set with a non-active unit.
 	TTBoolean		isOverriding;				///< flag indicating if we are currently overriding the active unit.
 	method			callback;					///< A callback method that is used to pass output to an object that encapsulates this parameter (such as the jcom.ui)


Added missing inline statements in order to prevent linker errors.

--- unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
+++ unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
@@ -66,7 +66,7 @@
 }

 /* \brief Get suitable degree for Pade approximation. (specialized for RealScalar = float) */
-int matrix_log_get_pade_degree(float normTminusI)
+inline int matrix_log_get_pade_degree(float normTminusI)
 {
   const float maxNormForPade[] = { 2.5111573934555054e-1 /* degree = 3 */ , 4.0535837411880493e-1,
             5.3149729967117310e-1 };
@@ -80,7 +80,7 @@
 }

 /* \brief Get suitable degree for Pade approximation. (specialized for RealScalar = double) */
-int matrix_log_get_pade_degree(double normTminusI)
+inline int matrix_log_get_pade_degree(double normTminusI)
 {
   const double maxNormForPade[] = { 1.6206284795015624e-2 /* degree = 3 */ , 5.3873532631381171e-2,
             1.1352802267628681e-1, 1.8662860613541288e-1, 2.642960831111435e-1 };
@@ -94,7 +94,7 @@
 }

 /* \brief Get suitable degree for Pade approximation. (specialized for RealScalar = long double) */
-int matrix_log_get_pade_degree(long double normTminusI)
+inline int matrix_log_get_pade_degree(long double normTminusI)
 {
 #if   LDBL_MANT_DIG == 53         // double precision
   const long double maxNormForPade[] = { 1.6206284795015624e-2L /* degree = 3 */ , 5.3873532631381171e-2L,


GridIndex unstead of unsigned int

GridIndex unstead of unsigned int

--- src/algo/voronoidiagram.h
+++ src/algo/voronoidiagram.h
@@ -261,15 +261,15 @@
         GridIndex col = get_grid_index( p.y );
         //std::cout << "closest cell is ( " << row << " , " << col << " ) \n" ;
         insert_faces_from_bucket( fset, row, col ); // the closest bucket
-        unsigned int dist = 0;
+        GridIndex dist = 0;
         do {
             dist++;
             insert_faces_from_neighbors( fset, row, col , dist );
             //assert( dist < nbins );
         } while (fset.empty());
         //std::cout << " fset.size() = " << fset.size() << "  at dist= " << dist << "\n";
-        unsigned int max_dist = (int)( ceil( sqrt(2)*dist ) ); // expand up to this radius, to be sure to find the closest point
-        for (unsigned int d = dist; d<=max_dist;d++)
+        GridIndex max_dist = (int)( ceil( sqrt(2)*dist ) ); // expand up to this radius, to be sure to find the closest point
+        for (GridIndex d = dist; d<=max_dist;d++)
             insert_faces_from_neighbors( fset, row, col , d );
         //std::cout << " fset.size() = " << fset.size() << "  at dist= " << dist << "\n";

@@ -296,7 +296,7 @@
         return closest_face;
     }

-    void insert_faces_from_neighbors( std::set<FaceIdx>& set, GridIndex row, GridIndex col , unsigned int dist ) {
+    void insert_faces_from_neighbors( std::set<FaceIdx>& set, GridIndex row, GridIndex col , GridIndex dist ) {
         // insert faces from neighbors of (row,col) at distance dist

         GridIndex min_row;


ASoC: da7219: Improve error handling for regulator supplies

Currently if bulk_enable() of supplies fails, the code still goes on
to try and put the device into active state, and set expected IO
voltage of the device. This doesn't really make sense so code now
returns on bulk_enable() failure, with an error message. Also,
to help with debug, failure to get supplies also provides an error
message.

Signed-off-by: Adam Thomson <313e0c15281ce7d11de2ea6827bd342763ae0515@diasemi.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


use window over renderbuffer

use window over renderbuffer

--- irc.c
+++ irc.c
@@ -9,6 +9,7 @@
 #include <stdatomic.h>
 #include <errno.h>
 #include <ctype.h>
+#include <assert.h>

 #include <unistd.h>
 #include <netdb.h>
@@ -78,8 +79,20 @@

 struct message {
     time_t timestamp;
-    char *channel;
-    char *text;
+    enum { MSG_NORMAL, MSG_NOTIFICATION, MSG_SERVER, MSG_ACTION } type;
+    union {
+        struct {
+            char *target;
+            char *nick;
+            char *text;
+        };
+        struct {
+            char *notification;
+        };
+        struct {
+            char *server_message;
+        };
+    };
 };

 typedef void (*command_function)(char *);
@@ -136,7 +149,8 @@
 static size_t room_count;
 static size_t room_alloc;

-static atomic_bool should_render;
+static atomic_bool should_render_input_line = true;
+static atomic_bool should_render_messages = true;
 static atomic_bool should_pong;

 static FILE *log_file;
@@ -166,8 +180,6 @@
     va_list ap;
     va_start(ap, fmt);
     va_end(ap);
-
-    return;
 }

 static char *duplicate(char const *s)
@@ -204,7 +216,15 @@
         while (idx && s[idx] && !isspace(s[idx]))
             idx -= 1;

-        return idx;
+        if (idx)
+            return idx;
+        else
+            return result.bytes;
+}
+
+static bool should_display(struct message const *message)
+{
+    return true;
 }

 static void unknown_command(char const *command)
@@ -215,6 +235,74 @@
 static void ambiguous_command(char const *command)
 {
     return;
+}
+
+static int expose_messages(TickitWindow *w, TickitEventType e, void *_info, void *data)
+{
+    static size_t const offset = 12;
+    static char timestamp_buffer[16];
+
+    if (!atomic_exchange(&should_render_messages, false))
+        return 1;
+
+    TickitExposeEventInfo *info = _info;
+    TickitRenderBuffer *buffer = info->rb;
+    TickitRect rect = info->rect;
+
+    /* Go backwards rendering the as many messages as can fit on the screen */
+    size_t row = 0;
+    size_t idx = 0;
+    while (idx < message_count && row < rect.lines) {
+        struct message msg = messages[message_count - idx - 1];
+
+        if (!should_display(&msg))
+            continue;
+
+        struct tm *time_info = localtime(&msg.timestamp);
+        strftime(timestamp_buffer, sizeof timestamp_buffer, "%H:%M:%S", time_info);
+
+        size_t lines = column_count(msg.text) / (rect.cols - offset) + 1;
+
+        tickit_renderbuffer_goto(buffer, rect.lines - row - lines - 1, 0);
+        tickit_renderbuffer_textf(buffer, "[%s]", timestamp_buffer);
+
+        size_t to_write = strlen(msg.text);
+        while (to_write > 0) {
+            size_t n = fit_in_columns(msg.text, rect.cols - offset);
+            tickit_renderbuffer_goto(buffer, rect.lines - row - lines - 1, offset);
+            tickit_renderbuffer_textn(buffer, msg.text, n);
+            msg.text += n;
+            to_write -= n;
+            row -= 1;
+        }
+        idx += 1;
+        row += 2 * lines;
+    }
+
+    return 1;
+}
+
+static int expose_input_line(TickitWindow *w, TickitEventType e, void *_info, void *data)
+{
+    if (!atomic_exchange(&should_render_input_line, false))
+        return 1;
+
+    TickitExposeEventInfo *info = _info;
+    TickitRenderBuffer *buffer = info->rb;
+    TickitRect rect = info->rect;
+
+    tickit_renderbuffer_goto(buffer, 0, 0);
+    tickit_renderbuffer_erase(buffer, rect.cols);
+    tickit_renderbuffer_goto(buffer, 0, 0);
+    tickit_renderbuffer_textf(buffer, "[%s]: %s", nick, input_buffer);
+
+    int line;
+    int col;
+
+    tickit_renderbuffer_get_cursorpos(buffer, &line, &col);
+    tickit_window_cursor_at(w, line, col);
+
+    return 1;
 }

 static void irc_message_record(struct irc_reply const *reply)
@@ -508,6 +596,22 @@
     return true;
 }

+static struct message *new_message(void)
+{
+    if (message_count == message_alloc) {
+        message_alloc = message_alloc ? message_alloc * 2 : 1;
+        messages = realloc(messages, message_alloc * sizeof *messages);
+        if (!messages)
+            fatal("Out of memory...");
+    }
+
+    struct message *result = messages + message_count;
+
+    message_count += 1;
+
+    return result;
+}
+
 /* Helper functions for handling various
  * events that occur throughout an IRC
  * session. e.g.: incoming PRIVMSG or NOTICE,
@@ -518,23 +622,12 @@
     static time_t timestamp;

     time(&timestamp);
-
-    if (message_count == message_alloc) {
-        message_alloc = message_alloc ? message_alloc * 2 : 1;
-        messages = realloc(messages, message_alloc * sizeof *messages);
-        if (!messages)
-            fatal("Out of memory...");
-    }
-
-    char buffer[1024];
-
-    snprintf(buffer, 1024, "<%s>: %s", nick, text);
-
-    messages[message_count].channel = channel;
-    messages[message_count].text = duplicate(buffer);
-    messages[message_count].timestamp = timestamp;
-
-    message_count += 1;
+
+    struct message *message = new_message();
+
+    message->channel = channel;
+    message->text = duplicate(buffer);
+    message->timestamp = timestamp;
 }

 void handle_outbound_message(char *message)
@@ -559,7 +652,7 @@
     struct irc_reply msg = irc_reply_parse(message);
     free(message);

-    atomic_store(&should_render, true);
+    atomic_store(&should_render_messages, true);

 #ifdef DEBUG
     irc_message_record(&msg);
@@ -581,7 +674,7 @@

     record("INPUT EVENT: %s\n", info->str);

-    atomic_store(&should_render, true);
+    atomic_store(&should_render_input_line, true);

     if (info->type == TICKIT_KEYEV_KEY) {
         if (!strcmp(info->str, "Enter")) {
@@ -633,49 +726,6 @@
     return NULL;
 }

-void render_screen(TickitTerm *t)
-{
-    TickitRenderBuffer *buffer = tickit_renderbuffer_new(rows, columns);
-
-    static size_t const offset = 12;
-    static char timestamp_buffer[16];
-
-    record("=== DRAWING ===\n");
-
-    /* Go backwards rendering the as many messages as can fit on the screen */
-    size_t row = 2;
-    size_t idx = 0;
-    while (idx < message_count && row < rows) {
-        record("=== ROW: %zu ===\n", row);
-        record("=== IDX: %zu ===\n", idx);
-        struct message msg = messages[message_count - idx - 1];
-        struct tm *time_info = localtime(&msg.timestamp);
-        strftime(timestamp_buffer, sizeof timestamp_buffer, "%H:%M:%S", time_info);
-        size_t lines = column_count(msg.text) / (columns - offset) + 1;
-        record("=== LINES: %zu ===\n", lines);
-        tickit_renderbuffer_goto(buffer, rows - row - lines - 1, 0);
-        tickit_renderbuffer_textf(buffer, "[%s]", timestamp_buffer);
-        size_t to_write = strlen(msg.text);
-        while (to_write > 0) {
-            size_t n = fit_in_columns(msg.text, columns - offset);
-            tickit_renderbuffer_goto(buffer, rows - row - lines - 1, offset);
-            tickit_renderbuffer_textn(buffer, msg.text, n);
-            msg.text += n;
-            to_write -= n;
-            row -= 1;
-        }
-        idx += 1;
-        row += 2 * lines;
-    }
-
-    /* Render input line at the bottom of the terminal */
-    tickit_renderbuffer_goto(buffer, rows - 1, 0);
-    tickit_renderbuffer_textf(buffer, "[%s]: %s", nick, input_buffer);
-
-    tickit_term_clear(t);
-    tickit_renderbuffer_flush_to_term(buffer, t);
-}
-
 void run_command(char const *command, char *parameter)
 {
     void (*f)(char *) = NULL;
@@ -739,14 +789,30 @@
     tickit_term_bind_event(t, TICKIT_EV_KEY, handle_input, NULL);
     tickit_term_bind_event(t, TICKIT_EV_RESIZE, handle_resize, NULL);

+    TickitWindow *root_window = tickit_window_new_root(t);
+    TickitWindow *message_window = tickit_window_new_subwindow(root_window, 0, 0, rows - 1, columns);
+    TickitWindow *input_window = tickit_window_new_subwindow(root_window, rows - 1, 0, 1, columns);
+
+    assert(root_window);
+    assert(message_window);
+    assert(input_window);
+
+    assert(tickit_window_is_visible(root_window));
+    assert(tickit_window_is_visible(message_window));
+    assert(tickit_window_is_visible(input_window));
+
+    tickit_window_bind_event(message_window, TICKIT_EV_EXPOSE, expose_messages, NULL);
+    tickit_window_bind_event(input_window, TICKIT_EV_EXPOSE, expose_input_line, NULL);
+
     for (;;) {
         tickit_term_input_wait_msec(t, 100);
         tickit_term_refresh_size(t);

         pthread_mutex_lock(&lock);

-        if (atomic_exchange(&should_render, false))
-            render_screen(t);
+        tickit_window_tick(root_window);
+        tickit_window_expose(root_window, NULL);
+        tickit_window_take_focus(input_window);

         pthread_mutex_unlock(&lock);


ASoC: da732x: Remove unused codec field form da732x_priv struct

The field is initialized in the probe callback, but never used again. So it
can be removed.

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>


ASoC: rt5645: Add struct dmi_system_id "Google Edgar" for Chrome OS

Add platform specific data for Edgar project.

Signed-off-by: John Lin <8a81b8566f52dcc2bf003ea1ff66de336523b474@realtek.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


ASoC: rt5677: Revise the filter powers

ASoC: rt5677: Revise the filter powers

Add the filter powers of the dac mono3 and mono4, and remove the connection
of dac stereo1 filter that connect to DAC1 MIX.

Signed-off-by: Oder Chiou <81d54fb0f3a9e1168f5ac492a462b8d0a59a67f4@realtek.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


ASoC: rt5677: Modify the voltage level in the BIAS OFF stage

The patch modifies the voltage level in the BIAS OFF stage

Signed-off-by: Oder Chiou <81d54fb0f3a9e1168f5ac492a462b8d0a59a67f4@realtek.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>


ASoC: wm8400: Remove the set_cache_io() entirely from ASoC probe.

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <cf2f21a5d63bafab3dac1a48e01d31cd0b77ab89@freescale.com>
Acked-by: Charles Keepax <8e4aa0015eb43ed5ca66aaca3fb498609e1e427c@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>


ASoC: wm8510: Replace direct snd_soc_codec dapm field access

The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level().

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Acked-by: Charles Keepax <8e4aa0015eb43ed5ca66aaca3fb498609e1e427c@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


ASoC: wm8900: Convert to direct regmap API usage

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>


x64: Define kernelBase for breakpoint code

--- include/plat/pc99/plat/64/plat_mode/machine/hardware.h
+++ include/plat/pc99/plat/64/plat_mode/machine/hardware.h
@@ -49,6 +49,7 @@

 #define PPTR_USER_TOP KERNEL_BASE
 #define KERNEL_BASE_OFFSET (KERNEL_BASE - PADDR_BASE)
+#define kernelBase KERNEL_BASE

 /* The maximum physical address for device untypeds that we export to
  * the user */


ASoC: wm8904: Convert to module_i2c_driver()

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/codecs/wm8904.c
+++ sound/soc/codecs/wm8904.c
@@ -2313,23 +2313,7 @@
 	.id_table = wm8904_i2c_id,
 };

-static int __init wm8904_modinit(void)
-{
-	int ret = 0;
-	ret = i2c_add_driver(&wm8904_i2c_driver);
-	if (ret != 0) {
-		printk(KERN_ERR "Failed to register wm8904 I2C driver: %d\n",
-		       ret);
-	}
-	return ret;
-}
-module_init(wm8904_modinit);
-
-static void __exit wm8904_exit(void)
-{
-	i2c_del_driver(&wm8904_i2c_driver);
-}
-module_exit(wm8904_exit);
+module_i2c_driver(wm8904_i2c_driver);

 MODULE_DESCRIPTION("ASoC WM8904 driver");
 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");


ASoC: wm8990: Don't use range container for TLV with one entry

For TLVs with only a single entry it is not necessary to use a range
container. Use DECLARE_TLV_DB_SCALE() directly instead of a combination of
TLV_DB_RANGE_HEAD() and TLV_DB_SCALE_ITEM().

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


wifi_prov_mgr: Fix comments

wifi_prov_mgr: Fix comments

--- examples/provisioning/wifi_prov_mgr/main/app_main.c
+++ examples/provisioning/wifi_prov_mgr/main/app_main.c
@@ -336,12 +336,9 @@
          *      - NULL if not used
          */
         const char *pop = "abcd1234";
-        /* If the pop is allocated dynamically, then it should be valid till the provisioning process is running.
-         * it can be only freed when the WIFI_PROV_END event is triggered */

         /* This is the structure for passing security parameters
          * for the protocomm security 1.
-         * This does not need not be static i.e. could be dynamically allocated
          */
         wifi_prov_security1_params_t *sec_params = pop;

@@ -366,7 +363,8 @@
 #endif
         /* This is the structure for passing security parameters
          * for the protocomm security 2.
-         * This does not need not be static i.e. could be dynamically allocated
+         * If dynamically allocated, sec2_params pointer and its content
+         * must be valid till WIFI_PROV_END event is triggered.
          */
         wifi_prov_security2_params_t sec2_params = {};


ASoC: wm8994: Fix AIF2ADC power down

ASoC: wm8994: Fix AIF2ADC power down

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org

--- sound/soc/codecs/wm8994.c
+++ sound/soc/codecs/wm8994.c
@@ -1144,7 +1144,7 @@
 		snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
 				    WM8994_AIF2DACL_ENA |
 				    WM8994_AIF2DACR_ENA, 0);
-		snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
+		snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
 				    WM8994_AIF2ADCL_ENA |
 				    WM8994_AIF2ADCR_ENA, 0);


feat(ex): Use afterWrite callback at Subscriber

Show usage of afterWrite subscribe callback to be able to verify that
subscribing works.

--- examples/pubsub/server_pubsub_subscriber_rt_level.c
+++ examples/pubsub/server_pubsub_subscriber_rt_level.c
@@ -65,6 +65,29 @@
                                      void *nodeContext, const UA_NumericRange *range){
     //allow read without any preparation
     return UA_STATUSCODE_GOOD;
+}
+
+static void
+SubscribeAfterWriteCallback(
+   UA_Server *ipServer,
+   const UA_NodeId *ipDataSetReaderId,
+   const UA_NodeId *ipReaderGroupId,
+   const UA_NodeId *ipTargetVariableId,
+   void *ipTargetVariableContext,
+   UA_DataValue **ippExternalValueSource) { // received value has already been copied to ippExternalValueSource
+
+    (void) ipServer;
+    (void) ipDataSetReaderId;
+    (void) ipReaderGroupId;
+    (void) ipTargetVariableContext;
+
+    UA_String strId;
+    UA_String_init(&strId);
+    UA_NodeId_print(ipTargetVariableId, &strId);
+    UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "SubscribeAfterWriteCallback(): "
+        "WriteUpdate() for node Id = '%.*s'. New Value = %u", (UA_Int32) strId.length, strId.data,
+        *((UA_UInt32*) (**ippExternalValueSource).value.data));
+    UA_String_clear(&strId);
 }

 /* Define MetaData for TargetVariables */
@@ -206,6 +229,7 @@
         UA_FieldTargetDataType_init(&readerConfig.subscribedDataSet.subscribedDataSetTarget.targetVariables[i].targetVariable);
         readerConfig.subscribedDataSet.subscribedDataSetTarget.targetVariables[i].targetVariable.attributeId  = UA_ATTRIBUTEID_VALUE;
         readerConfig.subscribedDataSet.subscribedDataSetTarget.targetVariables[i].targetVariable.targetNodeId = newnodeId;
+        readerConfig.subscribedDataSet.subscribedDataSetTarget.targetVariables[i].afterWrite = SubscribeAfterWriteCallback;
     }

     return retval;


ASoC: Added a missing 32-bit PCM format, to the wm8994 codec.

Signed-off-by: Ian Lartey <57a33a5496950fec8433e4dd83347673459dcdfc@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <a57ef363056e61beffa2efa59c68550d40db03b0@slimlogic.co.uk>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/codecs/wm8994.c
+++ sound/soc/codecs/wm8994.c
@@ -3519,7 +3519,7 @@
 #define WM8994_RATES SNDRV_PCM_RATE_8000_96000

 #define WM8994_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
-			SNDRV_PCM_FMTBIT_S24_LE)
+			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)

 static struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
 	.set_sysclk	= wm8994_set_dai_sysclk,


ASoC: wm9712: Fix funky indentation

ASoC: wm9712: Fix funky indentation

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/codecs/wm9712.c
+++ sound/soc/codecs/wm9712.c
@@ -684,8 +684,8 @@

 static struct platform_driver wm9712_codec_driver = {
 	.driver = {
-			.name = "wm9712-codec",
-			.owner = THIS_MODULE,
+		.name = "wm9712-codec",
+		.owner = THIS_MODULE,
 	},

 	.probe = wm9712_probe,


Fix UUIDs for DfRobotBle

Fix UUIDs for DfRobotBle


have the route match something fq_sndr sends

--- fq_rcvr.c
+++ fq_rcvr.c
@@ -63,7 +63,7 @@
   memcpy(breq->exchange.name, "maryland", 8);
   breq->exchange.len = 8;
   breq->peermode = 0;
-  breq->program = strdup("prefix:\"check.\" sample(1)");
+  breq->program = strdup("prefix:\"test.\" sample(1)");
   fq_client_bind(c, breq);
 }


ACPICA: Abort downward walk on temporary node detection.

Enhancement to code that ignores temporary  namespace nodes

Signed-off-by: Alexey Starikovskiy <382bb4749d2aa361992b48e59d0a71acb3e5043b@intel.com>
Signed-off-by: Len Brown <b060cfa1096cc6e8be83699ddb4ed8a77dd63af5@intel.com>

--- drivers/acpi/namespace/nswalk.c
+++ drivers/acpi/namespace/nswalk.c
@@ -194,24 +194,28 @@
 					  child_node);
 		if (child_node) {

-			/* Found node, Get the type if we are not searching for ANY */
+			/* Found next child, get the type if we are not searching for ANY */

 			if (type != ACPI_TYPE_ANY) {
 				child_type = child_node->type;
 			}

 			/*
-			 * 1) Type must match
-			 * 2) Permanent namespace nodes are OK
-			 * 3) Ignore temporary nodes unless told otherwise. Typically,
-			 *    the temporary nodes can cause a race condition where they can
-			 *    be deleted during the execution of the user function. Only the
-			 *    debugger namespace dump will examine the temporary nodes.
+			 * Ignore all temporary namespace nodes (created during control
+			 * method execution) unless told otherwise. These temporary nodes
+			 * can cause a race condition because they can be deleted during the
+			 * execution of the user function (if the namespace is unlocked before
+			 * invocation of the user function.) Only the debugger namespace dump
+			 * will examine the temporary nodes.
 			 */
-			if ((child_type == type) &&
-			    (!(child_node->flags & ANOBJ_TEMPORARY) ||
-			     (child_node->flags & ANOBJ_TEMPORARY)
-			     && (flags & ACPI_NS_WALK_TEMP_NODES))) {
+			if ((child_node->flags & ANOBJ_TEMPORARY) &&
+			    !(flags & ACPI_NS_WALK_TEMP_NODES)) {
+				status = AE_CTRL_DEPTH;
+			}
+
+			/* Type must match requested type */
+
+			else if (child_type == type) {
 				/*
 				 * Found a matching node, invoke the user callback function.
 				 * Unlock the namespace if flag is set.