cd finally works

cd finally works

--- src/usch.h
+++ src/usch.h
@@ -171,107 +171,7 @@
     return -1;
 }
 #endif // 0
-/**
- * <A short one line description>
- *
- *  <Longer description>
- *  <May span multiple lines or paragraphs as needed>
- *
- *   @param  Description of method's or function's input parameter
- *   @param  ...
- *   @return Description of the return value
- *   */
-static inline int usch_cd_impl(size_t num_args, char *p_dummy, ...)
-{
-    int error = 0;
-    glob_t glob_data;
-    va_list p_ap;
-    char *p_dir = NULL;
-    char *p_chdir = NULL;
-    char format[] = "%s";
-
-    printf("%d\n", (int)num_args);
-    if (num_args > 1)
-    {
-        p_dummy = format;
-        va_start(p_ap, p_dummy);
-        p_dir = va_arg(p_ap, char *);
-    }
-    else
-    {
-        p_dir = getenv("HOME");
-    }
-
-    if (glob(p_dir, GLOB_MARK | GLOB_NOCHECK | GLOB_TILDE | GLOB_NOMAGIC | GLOB_BRACE, NULL, &glob_data) == 0)
-    {
-        p_chdir = glob_data.gl_pathv[0];
-    }
-    else
-    {
-        p_chdir = p_dir;
-    }
-    error = chdir(p_chdir);
-
-    switch (error)
-    {
-        case EACCES:
-            {
-                perror("Permission denied.");
-                break;
-            }
-        case EFAULT:
-            {
-                perror("Path points outside your accessible address space.");
-                break;
-            }
-
-        case EIO:
-            {
-                perror("An I/O error occurred.");
-                break;
-            }
-        case ELOOP:
-            {
-                perror("Too many symbolic links were encountered in resolving path.");
-                break;
-            }
-        case ENAMETOOLONG:
-            {
-                perror("path is too long.");
-                break;
-            }
-        case ENOENT:
-            {
-                perror("The file does not exist.");
-                break;
-            }
-        case ENOMEM:
-            {
-                perror("Insufficient kernel memory was available.");
-                break;
-            }
-        case ENOTDIR:
-            {
-                perror("A component of path is not a directory.");
-                break;
-            }
-        default:
-            break;
-    }
-    printf("cd: %s\n", p_chdir);
-    globfree(&glob_data);
-    if (num_args > 0)
-    {
-        va_end(p_ap);
-    }
-    return error;
-}
-#define usch_cd(...) usch_cd_impl(USCH_ARGC(__VA_ARGS__), "", ##__VA_ARGS__)
-#ifndef cd
-#define cd(...) usch_cd(__VA_ARGS__)
-#else
-#warning included header defines cd(), usch_cd() must be called directly
-#endif // cd
+
 #if 0
 /**
  * <A short one line description>
@@ -408,173 +308,184 @@

 static inline int usch_cmd_impl(size_t num_args, char *p_name, ...)
 {
-    va_list p_ap;
-    size_t i, j;
-    char *p_actual_format = NULL;
-    char **pp_argv = NULL;
-    char **pp_orig_argv = NULL;
-    char **pp_globbed_argv = NULL;
-    pid_t child_pid;
-    pid_t w;
-    int child_status = -1;
-    int status = 0;
-    struct usch_glob_list_t *p_glob_list = NULL;
-    struct usch_glob_list_t *p_current_glob_item = NULL;
-    int orig_arg_idx = 0;
-    int num_glob_items = 0;
-    if (p_name == NULL)
-    {
-        return -1;
-    }
-
-    pp_orig_argv = calloc(num_args + 1, sizeof(char*));
-    if (pp_orig_argv == NULL)
-    {
-        status = -1;
-        goto end;
-    }
-
-    p_actual_format = calloc(num_args*2, sizeof(char));
-
-    for (i = 0; i < num_args * 2; i += 2)
-    {
-        p_actual_format[i + 0] = '%';
-        p_actual_format[i + 1] = 's';
-    }
-    p_name = p_actual_format;
-
-    va_start(p_ap, p_name);
-
-    for (i = 0; i < num_args; i++)
-    {
-        pp_orig_argv[i] = va_arg(p_ap, char *);
-    }
-
-    for (i = 0; i < num_args; i++)
-    {
-        if (strcmp(pp_orig_argv[i], "--") == 0)
-        {
-            orig_arg_idx++;
-            break;
-        }
-
-        if (p_current_glob_item == NULL)
-        {
-            p_current_glob_item = calloc(1, sizeof(usch_glob_list_t));
-            if (p_current_glob_item == NULL)
-                goto end;
-            p_glob_list = p_current_glob_item;
-        }
-        else
-        {
-            p_current_glob_item->p_next = calloc(1, sizeof(usch_glob_list_t));
-            if (p_current_glob_item->p_next == NULL)
-                goto end;
-            p_current_glob_item = p_current_glob_item->p_next;
-        }
-        if (glob(pp_orig_argv[i], GLOB_MARK | GLOB_NOCHECK | GLOB_TILDE | GLOB_NOMAGIC | GLOB_BRACE, NULL, &p_current_glob_item->glob_data) != 0)
-        {
-            goto end;
-        }
-        num_glob_items += p_current_glob_item->glob_data.gl_pathc;
-        orig_arg_idx++;
-    }
-    pp_argv = calloc(num_glob_items + num_args - orig_arg_idx + 1, sizeof(char*));
-    p_current_glob_item = p_glob_list;
-
-    i = 0;
-    j = 0;
-    while (p_current_glob_item != NULL)
-    {
-        for (j = 0; j < p_current_glob_item->glob_data.gl_pathc; j++, i++)
-        {
-            pp_argv[i] = p_current_glob_item->glob_data.gl_pathv[j];
-        }
-        p_current_glob_item = p_current_glob_item->p_next;
-    }
-
-    for (i = orig_arg_idx; i < num_args; i++)
-    {
-        pp_argv[j + i] = pp_orig_argv[i];
-    }
-
-    child_pid = fork();
-    if ( child_pid == -1 ) {
-        perror("Cannot proceed. fork() error");
-        return 1;
-    }
-    if(child_pid == 0)
-    {
-
-        i = 0;
-        while (pp_argv[i] != NULL)
-        {
-            i++;
-        }
-
-        int execv_status = execvp(pp_argv[0], pp_argv);
-        fprintf(stderr, "usch: no such file or directory; %s\n", pp_argv[0]);
-
-        _exit(execv_status);
-    }
-    else
-    {
-        do
-        {
-            w = waitpid(child_pid, &child_status, WUNTRACED | WCONTINUED);
-            if (w == -1)
-            {
-                perror("waitpid");
-                exit(EXIT_FAILURE);
-            }
-
-            if (WIFEXITED(child_status))
-            {
-                status = WEXITSTATUS(child_status);
-            }
-            else if (WIFSIGNALED(child_status))
-            {
-                printf("killed by signal %d\n", WTERMSIG(child_status));
-            }
-            else if (WIFSTOPPED(child_status))
-            {
-                printf("stopped by signal %d\n", WSTOPSIG(child_status));
-            }
-            else if (WIFCONTINUED(child_status))
-            {
-                printf("continued\n");
-            }
-        } while (!WIFEXITED(child_status) && !WIFSIGNALED(child_status));
-    }
+	va_list p_ap;
+	size_t i, j;
+	char *p_actual_format = NULL;
+	char **pp_argv = NULL;
+	char **pp_orig_argv = NULL;
+	char **pp_globbed_argv = NULL;
+	pid_t child_pid;
+	pid_t w;
+	int child_status = -1;
+	int status = 0;
+	struct usch_glob_list_t *p_glob_list = NULL;
+	struct usch_glob_list_t *p_current_glob_item = NULL;
+	int orig_arg_idx = 0;
+	int num_glob_items = 0;
+	if (p_name == NULL)
+	{
+		return -1;
+	}
+
+	pp_orig_argv = calloc(num_args + 1, sizeof(char*));
+	if (pp_orig_argv == NULL)
+	{
+		status = -1;
+		goto end;
+	}
+
+	p_actual_format = calloc(num_args*2, sizeof(char));
+
+	for (i = 0; i < num_args * 2; i += 2)
+	{
+		p_actual_format[i + 0] = '%';
+		p_actual_format[i + 1] = 's';
+	}
+	p_name = p_actual_format;
+
+	va_start(p_ap, p_name);
+
+	for (i = 0; i < num_args; i++)
+	{
+		pp_orig_argv[i] = va_arg(p_ap, char *);
+	}
+
+	for (i = 0; i < num_args; i++)
+	{
+		if (strcmp(pp_orig_argv[i], "--") == 0)
+		{
+			orig_arg_idx++;
+			break;
+		}
+
+		if (p_current_glob_item == NULL)
+		{
+			p_current_glob_item = calloc(1, sizeof(usch_glob_list_t));
+			if (p_current_glob_item == NULL)
+				goto end;
+			p_glob_list = p_current_glob_item;
+		}
+		else
+		{
+			p_current_glob_item->p_next = calloc(1, sizeof(usch_glob_list_t));
+			if (p_current_glob_item->p_next == NULL)
+				goto end;
+			p_current_glob_item = p_current_glob_item->p_next;
+		}
+		if (glob(pp_orig_argv[i], GLOB_MARK | GLOB_NOCHECK | GLOB_TILDE | GLOB_NOMAGIC | GLOB_BRACE, NULL, &p_current_glob_item->glob_data) != 0)
+		{
+			goto end;
+		}
+		num_glob_items += p_current_glob_item->glob_data.gl_pathc;
+		orig_arg_idx++;
+	}
+	pp_argv = calloc(num_glob_items + num_args - orig_arg_idx + 1, sizeof(char*));
+	p_current_glob_item = p_glob_list;
+
+	i = 0;
+	j = 0;
+	while (p_current_glob_item != NULL)
+	{
+		for (j = 0; j < p_current_glob_item->glob_data.gl_pathc; j++, i++)
+		{
+			pp_argv[i] = p_current_glob_item->glob_data.gl_pathv[j];
+		}
+		p_current_glob_item = p_current_glob_item->p_next;
+	}
+
+	for (i = orig_arg_idx; i < num_args; i++)
+	{
+		pp_argv[j + i] = pp_orig_argv[i];
+	}
+
+	if (strcmp(pp_argv[0], "cd") == 0)
+	{
+		if (pp_argv[1] == NULL)
+			chdir(getenv("HOME"));
+		else
+			chdir(pp_argv[1]);
+	}
+	else
+	{
+		child_pid = fork();
+		if ( child_pid == -1 ) {
+			perror("Cannot proceed. fork() error");
+			return 1;
+		}
+		if(child_pid == 0)
+		{
+
+			i = 0;
+			while (pp_argv[i] != NULL)
+			{
+				i++;
+			}
+
+			int execv_status = execvp(pp_argv[0], pp_argv);
+			fprintf(stderr, "usch: no such file or directory; %s\n", pp_argv[0]);
+
+			_exit(execv_status);
+		}
+		else
+		{
+			do
+			{
+				w = waitpid(child_pid, &child_status, WUNTRACED | WCONTINUED);
+				if (w == -1)
+				{
+					perror("waitpid");
+					exit(EXIT_FAILURE);
+				}
+
+				if (WIFEXITED(child_status))
+				{
+					status = WEXITSTATUS(child_status);
+				}
+				else if (WIFSIGNALED(child_status))
+				{
+					printf("killed by signal %d\n", WTERMSIG(child_status));
+				}
+				else if (WIFSTOPPED(child_status))
+				{
+					printf("stopped by signal %d\n", WSTOPSIG(child_status));
+				}
+				else if (WIFCONTINUED(child_status))
+				{
+					printf("continued\n");
+				}
+			} while (!WIFEXITED(child_status) && !WIFSIGNALED(child_status));
+		}
+	}

 end:
-    if (num_args > 1)
-    {
-        va_end(p_ap);
-    }
-    if (p_glob_list)
-    {
-        p_current_glob_item = p_glob_list;
-        while (p_current_glob_item != NULL)
-        {
-            struct usch_glob_list_t *p_free_glob_item = p_current_glob_item;
-
-            p_current_glob_item = p_current_glob_item->p_next;
-
-            globfree(&p_free_glob_item->glob_data);
-            free(p_free_glob_item);
-        }
-    }
-
-    fflush(stdout);
-    free(pp_globbed_argv);
-    free(pp_orig_argv);
-    free(p_actual_format);
-
-    return status;
+	if (num_args > 1)
+	{
+		va_end(p_ap);
+	}
+	if (p_glob_list)
+	{
+		p_current_glob_item = p_glob_list;
+		while (p_current_glob_item != NULL)
+		{
+			struct usch_glob_list_t *p_free_glob_item = p_current_glob_item;
+
+			p_current_glob_item = p_current_glob_item->p_next;
+
+			globfree(&p_free_glob_item->glob_data);
+			free(p_free_glob_item);
+		}
+	}
+
+	fflush(stdout);
+	free(pp_globbed_argv);
+	free(pp_orig_argv);
+	free(p_actual_format);
+
+	return status;
 }
 #define USCH_COUNT_ARGS(...) usch_cmd_impl(USCH_ARGC(__VA_ARGS__), "", ##__VA_ARGS__)
 #define usch_cmd(cmd, ...) USCH_COUNT_ARGS(cmd, ##__VA_ARGS__)
+#define cd(...) usch_cmd("cd", ##__VA_ARGS__)

 #if NEED_VIM_WORKAROUND
 {


Change fpin to stdin

Change fpin to stdin

svn path=/trunk/vorbis/; revision=2063

--- examples/encoder_example.c
+++ examples/encoder_example.c
@@ -11,7 +11,7 @@
  ********************************************************************

  function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.25 2001/09/17 01:06:18 cwolf Exp $
+ last mod: $Id: encoder_example.c,v 1.26 2001/09/17 01:33:07 cwolf Exp $

  ********************************************************************/

@@ -77,18 +77,18 @@
      example, after all. */

   readbuffer[0] = '\0';
-  for (i=0, founddata=0; i<40 && ! feof(fpin) && ! ferror(fpin); i++)
-  {
-    fread(readbuffer,1,2,fpin);
+  for (i=0, founddata=0; i<40 && ! feof(stdin) && ! ferror(stdin); i++)
+  {
+    fread(readbuffer,1,2,stdin);

     if ( ! strncmp(readbuffer, "da", 2) )
     {
       founddata = 1;
-      fread(readbuffer,1,6,fpin);
+      fread(readbuffer,1,6,stdin);
     }
   }

-  if ( feof(fpin) || ferror(fpin) )
+  if ( feof(stdin) || ferror(stdin) )
   {
     (void)fprintf(stderr, "Error: Input WAV too short, or corrupt.\n");
     return(1);


RSocketClient.h needs to include RSocketResponder.h (#622)

--- rsocket/RSocketClient.h
+++ rsocket/RSocketClient.h
@@ -10,6 +10,7 @@
 #include "rsocket/RSocketConnectionEvents.h"
 #include "rsocket/RSocketParameters.h"
 #include "rsocket/RSocketRequester.h"
+#include "rsocket/RSocketResponder.h"
 #include "rsocket/RSocketStats.h"
 #include "rsocket/ResumeManager.h"


Added function prototype for enforce_limits().

--- src/user.c
+++ src/user.c
@@ -63,8 +63,7 @@
 /* enforce_limits limits any state variables that need to be limited */

   static void
-enforce_limits(state)
-  stateptr state;
+enforce_limits(stateptr state)
 {
   if (state->roomroty > Maxroomroty) state->roomroty = Maxroomroty;
     else if (state->roomroty < Minroomroty) state->roomroty = Minroomroty;


error handling fix

error handling fix

--- source/m3_compile.c
+++ source/m3_compile.c
@@ -1447,10 +1447,10 @@
     if (IsFpType (type))
     {
         // not consuming a fp reg, so preserve
-        if (!IsStackTopMinus1InRegister(o) &&
-            !IsStackTopMinus2InRegister(o))
-        {
-            (PreserveRegisterIfOccupied (o, type));
+        if (not IsStackTopMinus1InRegister(o) and
+            not IsStackTopMinus2InRegister(o))
+        {
+_           (PreserveRegisterIfOccupied (o, type));
         }

         bool selectorInReg = IsStackTopInRegister (o);
@@ -1474,11 +1474,11 @@
     else if (IsIntType (type))
     {
         // 'sss' operation doesn't consume a register, so might have to protected its contents
-        if (!IsStackTopInRegister(o) &&
-            !IsStackTopMinus1InRegister(o) &&
-            !IsStackTopMinus2InRegister(o))
-        {
-            (PreserveRegisterIfOccupied (o, type));
+        if (not IsStackTopInRegister(o) and
+            not IsStackTopMinus1InRegister(o) and
+            not IsStackTopMinus2InRegister(o))
+        {
+_           (PreserveRegisterIfOccupied (o, type));
         }

         u32 opIndex = 3;  // op_Select_*_sss


Removed a useless typedef of _papi_hwd_context_t.

--- src/perfctr-p3.h
+++ src/perfctr-p3.h
@@ -117,12 +117,6 @@
    __asm__ __volatile__ ("xchg %0,%1" : "=r"(res) : "m"(lock[lck]), "0"(MUTEX_OPEN) : "memory");                                \
 } while(0)

-/* Overflow-related defines and declarations */
-typedef struct {
-   siginfo_t *si;
-   struct sigcontext *ucontext;
-} _papi_hwd_context_t;
-
 typedef siginfo_t hwd_siginfo_t;
 typedef ucontext_t hwd_ucontext_t;


Added oseparator(char).

Added oseparator(char).

--- src/util/oseparator.h
+++ src/util/oseparator.h
@@ -37,6 +37,14 @@
    * @param sep The separator string.
    */
   explicit oseparator( char const *sep = ", " ) : sep_( sep ), print_( false ) {
+  }
+
+  /**
+   * Constructs an %oseparator.
+   *
+   * @param sep The separator character.
+   */
+  explicit oseparator( char sep ) : sep_( 1, sep ), print_( false ) {
   }

   /**


FIX: typedef superclass was wrong

FIX: typedef superclass was wrong

--- Code/SpatialObject/itkSpatialObject.h
+++ Code/SpatialObject/itkSpatialObject.h
@@ -63,7 +63,7 @@
   typedef double ScalarType;

   typedef SpatialObject<NDimensions,TTransform,PipelineDimension> Self;
-  typedef Object Superclass;
+  typedef NDimensionalSpatialObject<PipelineDimension> Superclass;

   typedef SmartPointer< Self > Pointer;
   typedef SmartPointer< const Self > ConstPointer;


Fix alsa buffer constraints

Fix alsa buffer constraints

--- audio/pcm_bluetooth.c
+++ audio/pcm_bluetooth.c
@@ -45,7 +45,8 @@

 #define MIN_PERIOD_TIME 1

-#define BUFFER_SIZE 2048
+#define MIN_BUFFER_SIZE 256    /* minimum size of buffer */
+#define MAX_BUFFER_SIZE 16384  /* allocated RAM for buffer */

 #ifdef ENABLE_DEBUG
 #define DBG(fmt, arg...)  printf("DEBUG: %s: " fmt "\n" , __FUNCTION__ , ## arg)
@@ -123,7 +124,7 @@
 	sbc_t sbc;			/* Codec data */
 	int codesize;			/* SBC codesize */
 	int samples;			/* Number of encoded samples */
-	uint8_t buffer[BUFFER_SIZE];	/* Codec transfer buffer */
+	uint8_t buffer[MAX_BUFFER_SIZE];/* Codec transfer buffer */
 	int count;			/* Codec transfer buffer counter */

 	int nsamples;			/* Cumulative number of codec samples */
@@ -137,7 +138,7 @@
 	struct ipc_data_cfg cfg;	/* Bluetooth device config */
 	struct pollfd stream;		/* Audio stream filedescriptor */
 	struct pollfd server;		/* Audio daemon filedescriptor */
-	uint8_t buffer[BUFFER_SIZE];	/* Encoded transfer buffer */
+	uint8_t buffer[MAX_BUFFER_SIZE];/* Encoded transfer buffer */
 	int count;			/* Transfer buffer counter */
 	struct bluetooth_a2dp a2dp;	/* A2DP data */

@@ -938,14 +939,28 @@
 	if (err < 0)
 		return err;

-	/* supported block size */
-	err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES,
-						a2dp->codesize, a2dp->codesize);
+	/* supported block sizes:
+	 *   - lower limit is A2DP codec size
+	 *   - total buffer size is the upper limit (with two periods) */
+	err = snd_pcm_ioplug_set_param_minmax(io,
+						SND_PCM_IOPLUG_HW_PERIOD_BYTES,
+						a2dp->codesize,
+						MAX_BUFFER_SIZE / 2);
 	if (err < 0)
 		return err;

+	/* supported buffer sizes */
+	err = snd_pcm_ioplug_set_param_minmax(io,
+						SND_PCM_IOPLUG_HW_BUFFER_BYTES,
+						MIN_BUFFER_SIZE,
+						MAX_BUFFER_SIZE);
+	if (err < 0)
+		return err;
+
+	/* supported period count:
+	 *   - derived from max buffer size and minimum period size */
 	err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS,
-									2, 50);
+					2, MAX_BUFFER_SIZE / a2dp->codesize);
 	if (err < 0)
 		return err;


member var conversion error that oddly didn't crop up till mac testing.

--- Engine/source/math/mPolyhedron.h
+++ Engine/source/math/mPolyhedron.h
@@ -267,7 +267,7 @@
       Point3F* getPoints() const { return mPointList.address(); }

       /// Return the number of edges that this polyhedron has.
-      U32 getNumEdges() const { return edgeList.size(); }
+      U32 getNumEdges() const { return mEdgeList.size(); }

       ///
       Edge* getEdges() const { return mEdgeList.address(); }


fcmh lock fix

fcmh lock fix

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@24936 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- mount_slash/fidc_cli.c
+++ mount_slash/fidc_cli.c
@@ -148,14 +148,12 @@

 	fci = fcmh_2_fci(f);

-	FCMH_LOCK(f);
 //	if ((f->fcmh_flags & FCMH_CLI_HAVEINODE) == 0) {
 	fci->fci_inode = *ino;
 	for (i = 0; i < fci->fci_inode.nrepls; i++)
 		fci->fcif_idxmap[i] = i;
 	fci->fcif_mapstircnt = MAPSTIR_THRESH;
 	f->fcmh_flags |= FCMH_CLI_HAVEINODE;
-	FCMH_ULOCK(f);
 }

 int
@@ -183,7 +181,9 @@
 	if (rc)
 		goto out;

+	FCMH_LOCK(f);
 	slc_fcmh_load_inode(f, &mp->ino);
+	FCMH_ULOCK(f);

  out:
 	if (rq)


tmpfile: set a more relevant log level

tmpfile: set a more relevant log level

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@4544 63c20433-aa62-49bd-875c-5a186b69a8fb

--- src/utils/os_divers.c
+++ src/utils/os_divers.c
@@ -490,7 +490,7 @@
 	if (res) return res;
 	{
 		u32 err = GetLastError();
-		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Win32] system failure for tmpfile(): %08x\n", err));
+		GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Win32] system failure for tmpfile(): 0x%08x\n", err));
 	}
 	/*tmpfile() may fail under vista ...*/
 	if (!GetEnvironmentVariable("TEMP",tmp,MAX_PATH))


rts/Eventlog: More descriptive error message

--- rts/eventlog/EventLog.c
+++ rts/eventlog/EventLog.c
@@ -511,8 +511,10 @@
     event_log_writer = ev_writer;
     initEventLogWriter();

-    if (sizeof(EventDesc) / sizeof(char*) != NUM_GHC_EVENT_TAGS) {
-        barf("EventDesc array has the wrong number of elements");
+    int num_descs = sizeof(EventDesc) / sizeof(char*);
+    if (num_descs != NUM_GHC_EVENT_TAGS) {
+        barf("EventDesc array has the wrong number of elements (%d, NUM_GHC_EVENT_TAGS=%d)",
+             num_descs, NUM_GHC_EVENT_TAGS);
     }

     /*


Restructured GET_OVERFLOW_ADDRESS for PAPI 4

--- src/perfctr-p3.h
+++ src/perfctr-p3.h
@@ -62,15 +62,29 @@

 /* Overflow macros */
+/* old (PAPI <= 3.2.1) style overflow address:
 #ifdef __x86_64__
   #ifdef __CATAMOUNT__
-    #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&ctx->ucontext->uc_mcontext))->sc_rip)
+  #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&ctx->ucontext->uc_mcontext))->sc_rip)
   #else
-    #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&ctx->ucontext->uc_mcontext))->rip)
+  #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&ctx->ucontext->uc_mcontext))->rip)
   #endif
 #else
   #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&ctx->ucontext->uc_mcontext))->eip)
 #endif
+*/
+
+/* new (PAPI => 3.9.0) style overflow address: */
+#ifdef __x86_64__
+  #ifdef __CATAMOUNT__
+    #define OVERFLOW_PC sc_rip
+  #else
+    #define OVERFLOW_PC rip
+  #endif
+#else
+    #define OVERFLOW_PC eip
+#endif
+#define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&((hwd_ucontext_t *)ctx.ucontext)->uc_mcontext))->OVERFLOW_PC)

 /* Linux DOES support hardware overflow */
 #define HW_OVERFLOW 1
@@ -203,19 +217,6 @@
 extern hwi_search_t *preset_search_map;
 extern caddr_t _start, _init, _etext, _fini, _end, _edata, __bss_start;

-/* Overflow macros */
-#ifdef __x86_64__
-  #ifdef __CATAMOUNT__
-    #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&ctx->ucontext))->sc_rip)
-  #else
-     #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&((hwd_ucontext_t *)ctx.ucontext)->uc_mcontext))->rip)
-  #endif
-#else
-#define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(((struct sigcontext *)(&((hwd_ucontext_t *)ctx.ucontext)->uc_mcontext))->eip)
-#endif
-
-#define HW_OVERFLOW     1
-
 #if defined(PERFCTR26)
 #define PERFCTR_CPU_NAME(pi)    perfctr_info_cpu_name(pi)
 #define PERFCTR_CPU_NRCTRS(pi)  perfctr_info_nrctrs(pi)


Change type signature for pushline

Change type signature for pushline

--- src/util.c
+++ src/util.c
@@ -68,9 +68,9 @@
 }

 /* Push a line to the stack and store in history */
-static bool pushline(lua_State* L, bool isFirstLine) {
-  char* line = NULL;
+static bool pushline(LacoState* laco, bool isFirstLine) {
   const char* prompt = (isFirstLine) ? "> " : "... ";
+  lua_State* L = laco_getLacoLuaState(laco);
   bool result = false;

   if((line = linenoise(prompt)) != NULL) {
@@ -92,7 +92,7 @@

   lua_settop(L, 0);

-  if(!pushline(L, true)) return -1;
+  if(!pushline(laco, true)) return -1;

   /* Until complete line */
   while(true) {
@@ -101,7 +101,7 @@

     if(isPrintable(L, status)) continue;
     if(!incomplete(L, status)) break;
-    if(!pushline(L, false)) return -1;
+    if(!pushline(laco, false)) return -1;

     lua_pushliteral(L, "\n");
     lua_insert(L, -2);


[bouqueau] assert when locking a null mutex

--- src/utils/os_thread.c
+++ src/utils/os_thread.c
@@ -371,6 +371,7 @@
 u32 gf_mx_p(GF_Mutex *mx)
 {
 	u32 caller;
+	assert(mx);
 	if (!mx) return 0;
 	caller = gf_th_id();
 	if (caller == mx->Holder) {


Fix warning: implicit conversion loses integer precision in SparseMatrix. No need to use std::ptrdiff_t instead of Index since this later is requested to be signed.

--- Eigen/src/SparseCore/SparseMatrix.h
+++ Eigen/src/SparseCore/SparseMatrix.h
@@ -300,11 +300,11 @@
           totalReserveSize += reserveSizes[j];
         }
         m_data.reserve(totalReserveSize);
-        std::ptrdiff_t previousOuterIndex = m_outerIndex[m_outerSize];
-        for(std::ptrdiff_t j=m_outerSize-1; j>=0; --j)
+        Index previousOuterIndex = m_outerIndex[m_outerSize];
+        for(Index j=m_outerSize-1; j>=0; --j)
         {
-          ptrdiff_t innerNNZ = previousOuterIndex - m_outerIndex[j];
-          for(std::ptrdiff_t i=innerNNZ-1; i>=0; --i)
+          Index innerNNZ = previousOuterIndex - m_outerIndex[j];
+          for(Index i=innerNNZ-1; i>=0; --i)
           {
             m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i);
             m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i);
@@ -327,19 +327,19 @@
         {
           newOuterIndex[j] = count;
           Index alreadyReserved = (m_outerIndex[j+1]-m_outerIndex[j]) - m_innerNonZeros[j];
-          Index toReserve = std::max<std::ptrdiff_t>(reserveSizes[j], alreadyReserved);
+          Index toReserve = std::max<Index>(reserveSizes[j], alreadyReserved);
           count += toReserve + m_innerNonZeros[j];
         }
         newOuterIndex[m_outerSize] = count;

         m_data.resize(count);
-        for(ptrdiff_t j=m_outerSize-1; j>=0; --j)
+        for(Index j=m_outerSize-1; j>=0; --j)
         {
-          std::ptrdiff_t offset = newOuterIndex[j] - m_outerIndex[j];
+          Index offset = newOuterIndex[j] - m_outerIndex[j];
           if(offset>0)
           {
-            std::ptrdiff_t innerNNZ = m_innerNonZeros[j];
-            for(std::ptrdiff_t i=innerNNZ-1; i>=0; --i)
+            Index innerNNZ = m_innerNonZeros[j];
+            for(Index i=innerNNZ-1; i>=0; --i)
             {
               m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i);
               m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i);
@@ -451,7 +451,7 @@
       for(Index j=1; j<m_outerSize; ++j)
       {
         Index nextOldStart = m_outerIndex[j+1];
-        std::ptrdiff_t offset = oldStart - m_outerIndex[j];
+        Index offset = oldStart - m_outerIndex[j];
         if(offset>0)
         {
           for(Index k=0; k<m_innerNonZeros[j]; ++k)
@@ -1084,12 +1084,12 @@
   const Index outer = IsRowMajor ? row : col;
   const Index inner = IsRowMajor ? col : row;

-  std::ptrdiff_t room = m_outerIndex[outer+1] - m_outerIndex[outer];
-  std::ptrdiff_t innerNNZ = m_innerNonZeros[outer];
+  Index room = m_outerIndex[outer+1] - m_outerIndex[outer];
+  Index innerNNZ = m_innerNonZeros[outer];
   if(innerNNZ>=room)
   {
     // this inner vector is full, we need to reallocate the whole buffer :(
-    reserve(SingletonVector(outer,std::max<std::ptrdiff_t>(2,innerNNZ)));
+    reserve(SingletonVector(outer,std::max<Index>(2,innerNNZ)));
   }

   Index startId = m_outerIndex[outer];


Tweaks in MPI

Tweaks in MPI

--- mpi-scaling/path-mpi.c
+++ mpi-scaling/path-mpi.c
@@ -62,28 +62,14 @@
     }
 }

-int receive_updates(int m, int root, int* restrict recvupdates, int* restrict graph, int* restrict graphT) {
-    int upsrecv;
-    MPI_Bcast(&upsrecv, 1, MPI_INT, root, MPI_COMM_WORLD);
-    MPI_Bcast(recvupdates, upsrecv, MPI_INT, root, MPI_COMM_WORLD);
-    for (int i = 0; i < upsrecv; i += 3) {
-        int x = recvupdates[i];
-        int y = recvupdates[i + 1];
-        int v = recvupdates[i + 2];
-        graph[x * m + y] = v;
-        graphT[y * m + x] = v;
-    }
-    return upsrecv;
-}
-
-int optimize(int m, int c, int id, int* restrict graph, int* restrict graphT, int* restrict updates) {
-    int nups = 0; // Number of updates
+int optimize(int m, int c, int id, int* restrict graph, int* restrict graphT, int* restrict newcols) {
+    int hasupdate = 0;

     // Optimize the assigned columns
     for (int j = id * c * m; j < (id + 1) * c * m; j++) {
         int x = j / m;
         int y = j % m;
-        int hasupdate = 0;
+
         int newval = graph[j];
         for (int i = 0; i < m; i++) {
             int dist = graph[x * m + i] + graphT[y * m + i];
@@ -92,45 +78,28 @@
                 hasupdate = 1;
             }
         }
-        if (hasupdate) {
-            graph[j] = newval;
-            graphT[y * m + x] = newval;
-            updates[nups++] = x;
-            updates[nups++] = y;
-            updates[nups++] = newval;
-        }
-    }
-    return nups;
+        newcols[j - id * c * m] = newval;
+    }
+    return hasupdate;
 }

 void worker(int m, int c, int t, int id, int* restrict graph) {
     // Send matrix to every worker
     MPI_Bcast(graph, m * m, MPI_INT, 0, MPI_COMM_WORLD);

-    int* restrict updates = (int*) _mm_malloc(3 * m * c * sizeof(int), sizeof(long));
-    int* restrict recvupdates = (int*) _mm_malloc(3 * m * c * sizeof(int), sizeof(long));
+    int* restrict newcols = (int*) _mm_malloc(m * c * sizeof(int), sizeof(long));
     int* restrict graphT = (int*) _mm_malloc(m * m * sizeof(int), sizeof(long));
-    transpose(m, graph, graphT);
-
-    int done;
+
+    int hasupdate;
     do {
-        done = 1;
-        int nups = optimize(m, c, id, graph, graphT, updates);
-        done &= !nups;
-
-        // Synchronize state with other workers
-        for (int i = 0; i < t; i++) {
-            if (i == id) {
-                MPI_Bcast(&nups, 1, MPI_INT, i, MPI_COMM_WORLD);
-                MPI_Bcast(updates, nups, MPI_INT, i, MPI_COMM_WORLD);
-            } else {
-                done &= !receive_updates(m, i, recvupdates, graph, graphT);
-            }
-        }
-    } while (!done);
-
-    _mm_free(updates);
-    _mm_free(recvupdates);
+        transpose(m, graph, graphT);
+        int hup = optimize(m, c, id, graph, graphT, newcols);
+
+        MPI_Allreduce(&hup, &hasupdate, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
+        MPI_Allgather(newcols, c * m, MPI_INT, graph, c * m, MPI_INT, MPI_COMM_WORLD);
+    } while (!hasupdate);
+
+    _mm_free(newcols);
     _mm_free(graphT);
 }


added comments to hashtable code

added comments to hashtable code

git-svn-id: 128dd3b267779579ab434f8244e93c7ff269f855@56 72eaca01-2beb-3f56-2cdb-6f4d5dc7ddfa

--- src/util.c
+++ src/util.c
@@ -177,6 +177,7 @@
     return table;
 }

+/* adds a value to the hashtable */
 int hashtable_add(hashtable_t *table,void *key,void *value) {
     int h;
     kvpair_t *pair;
@@ -192,6 +193,7 @@
     return 0;
 }

+/* modifies the contents of the hashtable */
 int hashtable_mod(hashtable_t *table,void *key,void *value) {
     int h,i;
     h=table->hash(key);
@@ -205,6 +207,7 @@
     return 1;
 }

+/* gets data from the hashtable */
 void *hashtable_retrieve(hashtable_t *table,void *key) {
     int h,i;
     h=table->hash(key);
@@ -216,6 +219,7 @@
     return 0;
 }

+/* iterates through the hastable */
 int hashtable_foreach(hashtable_t *table,
                       int (*callback)(hashtable_t *,void *,void *),
                       void *arg) {
@@ -228,6 +232,7 @@
     return 0;
 }

+/* removes an entry from the hashtable */
 void *hashtable_remove(hashtable_t *table,void *key) {
     void *val=0;
     int h,i;
@@ -242,6 +247,7 @@
     return val;
 }

+/* cleans up all memory allocated by the hashtable */
 int cleanup_hashtable(hashtable_t *table) {
     int i,j;
     /* free all kvpairs (since they're not added by the user) */


Add a functor to setFromTriplets to handle duplicated entries

--- Eigen/src/SparseCore/SparseMatrix.h
+++ Eigen/src/SparseCore/SparseMatrix.h
@@ -437,6 +437,10 @@
     template<typename InputIterators>
     void setFromTriplets(const InputIterators& begin, const InputIterators& end);

+    template<typename DupFunctor, typename InputIterators>
+    void setFromTriplets(const InputIterators& begin, const InputIterators& end);
+
+    template<typename DupFunctor>
     void sumupDuplicates();

     //---
@@ -889,7 +893,7 @@

 namespace internal {

-template<typename InputIterator, typename SparseMatrixType>
+template<typename InputIterator, typename SparseMatrixType, typename DupFunctor>
 void set_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, int Options = 0)
 {
   EIGEN_UNUSED_VARIABLE(Options);
@@ -915,7 +919,7 @@
       trMat.insertBackUncompressed(it->row(),it->col()) = it->value();

     // pass 3:
-    trMat.sumupDuplicates();
+    trMat.template sumupDuplicates<DupFunctor>();
   }

   // pass 4: transposed copy -> implicit sorting
@@ -966,11 +970,24 @@
 template<typename InputIterators>
 void SparseMatrix<Scalar,_Options,_Index>::setFromTriplets(const InputIterators& begin, const InputIterators& end)
 {
-  internal::set_from_triplets(begin, end, *this);
+  internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_Index>, internal::scalar_sum_op<Scalar> >(begin, end, *this);
+}
+
+/** The same as setFromTriplets but when duplicates are met the functor \a DupFunctor is applied:
+  * \code
+  * value = DupFunctor()(OldValue, NewValue)
+  * \endcode
+ */
+template<typename Scalar, int _Options, typename _Index>
+template<typename DupFunctor, typename InputIterators>
+void SparseMatrix<Scalar,_Options,_Index>::setFromTriplets(const InputIterators& begin, const InputIterators& end)
+{
+  internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_Index>, DupFunctor>(begin, end, *this);
 }

 /** \internal */
 template<typename Scalar, int _Options, typename _Index>
+template<typename DupFunctor>
 void SparseMatrix<Scalar,_Options,_Index>::sumupDuplicates()
 {
   eigen_assert(!isCompressed());
@@ -989,7 +1006,7 @@
       if(wi(i)>=start)
       {
         // we already meet this entry => accumulate it
-        m_data.value(wi(i)) += m_data.value(k);
+        m_data.value(wi(i)) = DupFunctor()(m_data.value(wi(i)), m_data.value(k));
       }
       else
       {


solv_sort(): Fix build for non-glibc without qsort_r()

--- src/util.c
+++ src/util.c
@@ -115,13 +115,12 @@

    see also: http://sources.redhat.com/ml/libc-alpha/2008-12/msg00003.html
  */
-#if defined(__GLIBC__)
-
-# if HAVE_QSORT_R || HAVE___QSORT_R
+#if defined(__GLIBC__) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
+
 void
 solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard)
 {
-# if HAVE_QSORT_R
+# if defined(HAVE_QSORT_R)
   qsort_r(base, nmemb, size, compar, compard);
 # else
   /* backported for SLE10-SP2 */
@@ -129,12 +128,8 @@
 # endif

 }
-#else /* qsort_r or __qsort_r on glibc */
-/* use own version of qsort if none available */
-#include "qsort_r.c"
-#endif
-
-#else /* not glibc */
+
+#elif defined(HAVE_QSORT_R) /* not glibc, but has qsort_r() */

 struct solv_sort_data {
   int (*compar)(const void *, const void *, void *);
@@ -157,6 +152,9 @@
   qsort_r(base, nmemb, size, &d, solv_sort_helper);
 }

+#else /* not glibc and no qsort_r() */
+/* use own version of qsort if none available */
+#include "qsort_r.c"
 #endif

 char *


FatPkg/EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean

Cc: Ruiyu Ni <9fa3a6894a36bca79e6a72ad65af5a5702efecd1@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <1e8692d8ed8470b17e8ddd7612a0f029768dcb56@intel.com>
Reviewed-by: Ruiyu Ni <9fa3a6894a36bca79e6a72ad65af5a5702efecd1@intel.com>

--- FatPkg/EnhancedFatDxe/FileName.c
+++ FatPkg/EnhancedFatDxe/FileName.c
@@ -59,7 +59,7 @@
   PossibleShortName = TRUE;
   SeparateDot       = NULL;
   SetMem (File8Dot3Name, FAT_NAME_LEN, ' ');
-  for (TempName = FileName; *TempName; TempName++) {
+  for (TempName = FileName; *TempName != '\0'; TempName++) {
     if (*TempName == L'.') {
       SeparateDot = TempName;
     }
@@ -453,7 +453,7 @@
   UINT8 Sum;
   Sum = 0;
   for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {
-    Sum = (UINT8)(((Sum & 1) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
+    Sum = (UINT8)((((Sum & 1) != 0) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
   }

   return Sum;


File for reading European Data Format signals

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@1462 3c1deb5b-d424-0410-962d-aba41a686d42

error: pathspec 'source/unemap/edf.c' did not match any file(s) known to git


tidy up make_target()

tidy up make_target()

--- src/util.c
+++ src/util.c
@@ -399,6 +399,7 @@
     /* not an IP address, do a DNS lookup */
     } else {
         /* we don't call freeaddrinfo because we keep a pointer to the sin_addr in the target */
+        /* TODO what about the case where we're only using the first of multiple results? */
         getaddr = getaddrinfo(target_name, "nfs", hints, &addr);
         if (getaddr == 0) { /* success! */
             /* loop through possibly multiple DNS responses */
@@ -447,8 +448,8 @@
                 addr = addr->ai_next;
             }
         } else {
-            fprintf(stderr, "getaddrinfo error (%s): %s\n", target->name, gai_strerror(getaddr));
-            exit(2); /* ping and fping return 2 for name resolution failures */
+            /* ping and fping return 2 for name resolution failures */
+            fatalx(2, "getaddrinfo error (%s): %s\n", target->name, gai_strerror(getaddr));
         }
     } /* end of DNS */


MSVC does not support "using" declaration for casting operators.

--- autowiring/auto_arg.h
+++ autowiring/auto_arg.h
@@ -32,8 +32,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -62,8 +66,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -92,8 +100,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -122,8 +134,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -152,8 +168,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -182,8 +202,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -212,8 +236,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -242,8 +270,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -272,8 +304,12 @@
   using auto_type::is_input;
   using auto_type::is_output;

-  using auto_type::operator typename auto_type::base_type;
-  using auto_type::operator typename auto_type::shared_type;
+  operator typename auto_type::base_type () {
+    return auto_type::operator typename auto_type::base_type();
+  }
+  operator typename auto_type::shared_type () {
+    return auto_type::operator typename auto_type::shared_type();
+  }

   auto_arg() {}

@@ -312,7 +348,6 @@
   operator base_type () const {
     return *m_packet;
   }
-
   operator shared_type () {
     return m_packet;
   }
@@ -359,7 +394,6 @@
   operator base_type () const {
     return *m_packet;
   }
-
   operator shared_type () {
     return m_packet;
   }


Style.

Style.

--- src/util.c
+++ src/util.c
@@ -57,7 +57,7 @@
 }

 struct swf efp_make_swf(const struct efp *efp, const struct frag *fr_i,
-				const struct frag *fr_j)
+    const struct frag *fr_j)
 {
 	struct swf swf;

@@ -176,7 +176,7 @@
 }

 void efp_add_force(six_t *grad, const vec_t *com, const vec_t *pt,
-		const vec_t *force, const vec_t *add)
+    const vec_t *force, const vec_t *add)
 {
 	vec_t dr = vec_sub(CVEC(pt->x), com);
 	vec_t torque = vec_cross(&dr, force);
@@ -192,7 +192,7 @@
 }

 void efp_sub_force(six_t *grad, const vec_t *com, const vec_t *pt,
-		const vec_t *force, const vec_t *add)
+    const vec_t *force, const vec_t *add)
 {
 	vec_t dr = vec_sub(CVEC(pt->x), com);
 	vec_t torque = vec_cross(&dr, force);
@@ -207,7 +207,8 @@
 	six_atomic_sub_abc(grad, &torque);
 }

-void efp_move_pt(const vec_t *com, const mat_t *rotmat, const vec_t *pos_int, vec_t *out)
+void efp_move_pt(const vec_t *com, const mat_t *rotmat,
+    const vec_t *pos_int, vec_t *out)
 {
 	*out = mat_vec(rotmat, pos_int);
 	out->x += com->x;


make printfiles print canonical path if it differs

--- src/util.c
+++ src/util.c
@@ -135,4 +135,6 @@
     (*(guint*)count)++;
     struct vfile* vfile = (struct vfile*)file;
     log_info("\tFile %u: %s", (*(guint*)count), vfile->path);
+    if (g_strcmp0(vfile->path, vfile->path_canonical))
+        log_info("\t\t (%s)", vfile->path_canonical);
 }


gabble_call_candidates_to_array: document types and ownership

--- src/util.c
+++ src/util.c
@@ -1233,6 +1233,12 @@
     }
 }

+/**
+ * @candidates: (element-type JingleCandidate): candidates
+ *
+ * Returns: (transfer full): a GABBLE_ARRAY_TYPE_CANDIDATE_LIST, i.e.
+ *  a(usqa{sv})
+ */
 GPtrArray *
 gabble_call_candidates_to_array (GList *candidates)
 {


Support mulitple "sub-task" per worker task.

We previously allowed each actor to register itself exactly once, so
that the task evicts it upon completion. Now we associate a counter with
every task worker and the task complets the worker only after the
counter has reached 0.

--- src/vast/actor/task.h
+++ src/vast/actor/task.h
@@ -2,7 +2,7 @@
 #define VAST_ACTOR_TASK_H

 #include <chrono>
-#include <set>
+#include <map>
 #include <caf/all.hpp>
 #include "vast/time.h"
 #include "vast/actor/actor.h"
@@ -45,28 +45,30 @@
       {
         VAST_TRACE(this, "registers actor", a);
         monitor(a);
-        workers_.insert(a.address());
+        ++workers_[a.address()];
+        ++total_;
+      },
+      [=](actor const& a, uint64_t n)
+      {
+        VAST_TRACE(this, "registers actor", a, "for", n, "sub-tasks");
+        monitor(a);
+        workers_[a.address()] += n;
         ++total_;
       },
       [=](done_atom, actor const& a)
       {
         VAST_TRACE(this, "manually completed actor", a);
-        if (workers_.erase(a.address()) == 1)
-        {
-          demonitor(a);
-          notify();
-        }
+        complete(a->address());
+      },
+      [=](done_atom, actor_addr const& addr)
+      {
+        VAST_TRACE(this, "manually completed actor with address", addr);
+        complete(addr);
       },
       [=](done_atom)
       {
-        if (workers_.erase(last_sender()) == 1)
-        {
-          demonitor(last_sender());
-          notify();
-          return;
-        }
-        VAST_ERROR(this, "got DONE from unregistered actor:", last_sender());
-        quit(exit::error);
+        VAST_TRACE(this, "completed actor with address", last_sender());
+        complete(last_sender());
       },
       [=](supervisor_atom, actor const& a)
       {
@@ -91,10 +93,26 @@
   }

 private:
+  void complete(caf::actor_addr const& addr)
+  {
+    auto w = workers_.find(addr);
+    if (w == workers_.end())
+    {
+      VAST_ERROR(this, "got completion signal from unregistered actor:", addr);
+      quit(exit::error);
+    }
+    else if (--w->second == 0)
+    {
+      demonitor(addr);
+      workers_.erase(w);
+      notify();
+    }
+  }
+
   void notify()
   {
+    using namespace caf;
     auto runtime = time::stopwatch() - begin_;
-    using namespace caf;
     for (auto& s : subscribers_)
       send(s, progress_atom::value, uint64_t{workers_.size()}, total_);
     if (workers_.empty())
@@ -109,7 +127,7 @@
   uint32_t exit_reason_;
   uint64_t total_ = 0;
   time::point begin_;
-  std::set<caf::actor_addr> workers_;
+  std::map<caf::actor_addr, uint64_t> workers_;
   util::flat_set<caf::actor> subscribers_;
   util::flat_set<caf::actor> supervisors_;
 };


Fixed is_eq_csc() function in src/util.c

--- src/util.c
+++ src/util.c
@@ -54,8 +54,7 @@

         for (i=A->p[j]; i<A->p[j+1]; i++){  // Cycle rows i in column j
             if (A->i[i] != B->i[i] ||   // Different row indeces
-                A->x[i] - B->x[i] > TESTS_TOL ||
-                B->x[i] - A->x[i] < -TESTS_TOL){
+                c_abs(A->x[i] - B->x[i]) > TESTS_TOL){
                 return 0;
             }
         }


CCBC-1258: fix port order in vbucket diff info message

Change-Id: I210809594afe53a538d9555fdb2c3a4d4c70ef2d
Reviewed-on: http://review.couchbase.org/c/libcouchbase/+/130423
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Ellis Breen <9d8041ac7ead8d3e1f3217c04c7ed5e3098c2381@couchbase.com>

--- src/vbucket/vbucket.c
+++ src/vbucket/vbucket.c
@@ -1207,8 +1207,8 @@
         if (!found) {
             char *infostr = malloc(strlen(newsrv->authority) + 128);
             lcb_assert(infostr);
-            sprintf(infostr, "%s(Data=%d, Index=%d, Query=%d)", newsrv->authority, newsrv->svc.data, newsrv->svc.n1ql,
-                    newsrv->svc.ixquery);
+            sprintf(infostr, "%s(Data=%d, Index=%d, Query=%d)", newsrv->authority, newsrv->svc.data,
+                    newsrv->svc.ixquery, newsrv->svc.n1ql);
             out[offset] = infostr;
             ++offset;
         }


Fixed a typo in the spacing of stringifying complex
values that I'd fixed in my private copy, but somehow
never made it into my commit regarding stringifying
scalar types...  Went unnoticed probably because I'd
commented out most of my complex tests until the last
checkin.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@6924 3a8e244f-b0f2-452b-bcba-4c88e055c3ca

--- runtime/src/chpltypes.c
+++ runtime/src/chpltypes.c
@@ -126,10 +126,10 @@
   if (format == _default_format_write_complex32) {
     char* re = _chpl_tostring_float32(x.re, "%g");
     _float32 imval = x.im;
-    char* op = "+";
+    char* op = " + ";
     if (imval < 0.0) {
       imval = -x.im;
-      op = "-";
+      op = " - ";
     }
     char* im = _chpl_tostring_float32(imval, "%g");
     return _glom_strings(4, re, op, im, "i");


CHashWriter that does SHA256 in-place during serialization

--- src/util.h
+++ src/util.h
@@ -391,6 +391,46 @@
     return hash2;
 }

+class CHashWriter
+{
+private:
+    SHA256_CTX ctx;
+
+public:
+    int nType;
+    int nVersion;
+
+    void Init() {
+        SHA256_Init(&ctx);
+    }
+
+    CHashWriter(int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) {
+        Init();
+    }
+
+    CHashWriter& write(const char *pch, size_t size) {
+        SHA256_Update(&ctx, pch, size);
+        return (*this);
+    }
+
+    // invalidates the object
+    uint256 GetHash() {
+        uint256 hash1;
+        SHA256_Final((unsigned char*)&hash1, &ctx);
+        uint256 hash2;
+        SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
+        return hash2;
+    }
+
+    template<typename T>
+    CHashWriter& operator<<(const T& obj) {
+        // Serialize to this stream
+        ::Serialize(*this, obj, nType, nVersion);
+        return (*this);
+    }
+};
+
+
 template<typename T1, typename T2>
 inline uint256 Hash(const T1 p1begin, const T1 p1end,
                     const T2 p2begin, const T2 p2end)
@@ -428,13 +468,9 @@
 template<typename T>
 uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
 {
-    // Most of the time is spent allocating and deallocating CDataStream's
-    // buffer.  If this ever needs to be optimized further, make a CStaticStream
-    // class with its buffer on the stack.
-    CDataStream ss(nType, nVersion);
-    ss.reserve(10000);
+    CHashWriter ss(nType, nVersion);
     ss << obj;
-    return Hash(ss.begin(), ss.end());
+    return ss.GetHash();
 }

 inline uint160 Hash160(const std::vector<unsigned char>& vch)


Pass structs by value, not by reference, in EngineAPI. This simplifies call-layout through EngineAPI

--- Engine/source/console/engineTypes.h
+++ Engine/source/console/engineTypes.h
@@ -236,16 +236,16 @@
 struct _EngineStructTypeTraits
 {
    typedef T Type;
-   typedef const T& ValueType;
+   typedef const T ValueType;
    typedef void SuperType;

    // Structs get passed in as pointers and passed out as full copies.
-   typedef T* ArgumentValueType;
+   typedef T ArgumentValueType;
    typedef T ReturnValueType;
    typedef T DefaultArgumentValueStoreType;

    typedef ReturnValueType ReturnValue;
-   static ValueType ArgumentToValue( ArgumentValueType val ) { return *val; }
+   static ValueType ArgumentToValue( ArgumentValueType val ) { return val; }

    static const EngineTypeInfo* const TYPEINFO;
 };


Update Bonded Test

Update Bonded Test


update GzipOutputStream, replace do-while with while loop.

--- muduo/net/GzipStream.h
+++ muduo/net/GzipStream.h
@@ -8,6 +8,9 @@
 {
 namespace net
 {
+
+// FIXME
+// class GzipInputStream : boost::noncopyable

 class GzipOutputStream : boost::noncopyable
 {
@@ -25,7 +28,6 @@
   {
     finish();
   }
-

   // Return last error message or NULL if no error.
   const char* zlibErrorMessage() const
@@ -52,10 +54,10 @@
     void* in = const_cast<char*>(buf.data());
     zstream_.next_in = static_cast<Bytef*>(in);
     zstream_.avail_in = buf.size();
-    do
+    while (zstream_.avail_in > 0 && zerror_ == Z_OK)
     {
       zerror_ = compress(Z_NO_FLUSH);
-    } while (zstream_.avail_in > 0 && zerror_ == Z_OK);
+    }
     if (zstream_.avail_in == 0)
     {
       assert(static_cast<const void*>(zstream_.next_in) == buf.end());
@@ -69,10 +71,11 @@
     if (zerror_ != Z_OK)
       return false;

-    do
+    // do we need this step?
+    while (zerror_ == Z_OK)
     {
       zerror_ = compress(Z_FINISH);
-    } while (zerror_ == Z_OK);
+    }
     zerror_ = deflateEnd(&zstream_);
     bool ok = zerror_ == Z_OK;
     zerror_ = Z_STREAM_END;


add random_string

add random_string

adds function to generate a random string of a given length

--- src/util.h
+++ src/util.h
@@ -252,6 +252,22 @@
     }
 }

+std::string random_string( size_t length )
+{
+    auto randchar = []() -> char
+    {
+        const char charset[] =
+        "0123456789"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+        "abcdefghijklmnopqrstuvwxyz";
+        const size_t max_index = (sizeof(charset) - 1);
+        return charset[ rand() % max_index ];
+    };
+    std::string str(length,0);
+    std::generate_n( str.begin(), length, randchar );
+    return str;
+}
+
 std::string CopyrightHolders(const std::string& strPrefix);

 #endif // NAVCOIN_UTIL_H


Fixed bug #771

Fixed bug #771

Cleaned up the code a bit and made sure that an OpenGL window gets the OpenGL
renderer.  Inspired by a patch from Mason Wheeler.

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

--- src/video/SDL_video.c
+++ src/video/SDL_video.c
@@ -1490,31 +1490,35 @@
     SDL_DestroyRenderer(windowID);

     if (index < 0) {
-        const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
+        char *override = SDL_getenv("SDL_VIDEO_RENDERER");
+        int n = SDL_GetNumRenderDrivers();
+
+        if (!override && (window->flags & SDL_WINDOW_OPENGL)) {
+            override = "opengl";
+        }
         if (override) {
-            int i, n = SDL_GetNumRenderDrivers();
-            for (i = 0; i < n; ++i) {
+            for (index = 0; index < n; ++index) {
                 SDL_RenderDriver *driver =
-                    &SDL_CurrentDisplay.render_drivers[i];
+                    &SDL_CurrentDisplay.render_drivers[index];
+
                 if (SDL_strcasecmp(override, driver->info.name) == 0) {
-                    index = i;
+                    /* Create a new renderer instance */
+                    window->renderer = driver->CreateRenderer(window, flags);
                     break;
                 }
             }
-        }
-    }
-    if (index < 0) {
-        int n = SDL_GetNumRenderDrivers();
-        for (index = 0; index < n; ++index) {
-            SDL_RenderDriver *driver =
-                &SDL_CurrentDisplay.render_drivers[index];
-
-            if ((driver->info.flags & flags) == flags) {
-                /* Create a new renderer instance */
-                window->renderer = SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window, flags);
-                if (window->renderer) {
-                    /* Yay, we got one! */
-                    break;
+        } else {
+            for (index = 0; index < n; ++index) {
+                SDL_RenderDriver *driver =
+                    &SDL_CurrentDisplay.render_drivers[index];
+
+                if ((driver->info.flags & flags) == flags) {
+                    /* Create a new renderer instance */
+                    window->renderer = driver->CreateRenderer(window, flags);
+                    if (window->renderer) {
+                        /* Yay, we got one! */
+                        break;
+                    }
                 }
             }
         }
@@ -1528,7 +1532,6 @@
                          SDL_GetNumRenderDrivers() - 1);
             return -1;
         }
-
         /* Create a new renderer instance */
         window->renderer = SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window, flags);
     }


fix sysconf error in thread.c in linux

fix sysconf error in thread.c in linux

--- muggle/c/base/thread.c
+++ muggle/c/base/thread.c
@@ -59,6 +59,8 @@

 #else

+#include <unistd.h>
+
 int muggle_thread_create(muggle_thread_t *thread, muggle_thread_routine routine, void *args)
 {
 	return pthread_create(&thread->th, NULL, routine, args) == 0 ? MUGGLE_OK : MUGGLE_ERR_SYS_CALL;


Add {c|r}{begin|end} since gcc doesnt know it.

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

--- src/util.h
+++ src/util.h
@@ -0,0 +1,9 @@
+#pragma once
+
+namespace std {
+template <typename T> auto cbegin(const T &c) { return c.cbegin(); }
+template <typename T> auto crbegin(const T &c) { return c.crbegin(); }
+template <typename T> auto cend(const T &c) { return c.crbegin(); }
+template <typename T> auto crend(const T &c) { return c.crbegin(); }
+}
+


material: don't keep extra ref on copy-on-write materials

In _cogl_material_pre_change_notify if a material with descendants is
modified then we create a new material that is a copy of the one being
modified and reparent those descendants to the new material.

This patch ensures we drop the reference we get from cogl_material_copy
since we can rely on the descendants to keep the new material alive.

--- cogl/cogl-material.c
+++ cogl/cogl-material.c
@@ -1199,6 +1199,10 @@
       _cogl_material_foreach_child (material,
                                     reparent_strong_children_cb,
                                     new_authority);
+
+      /* The children will keep the new authority alive so drop the
+       * reference we got when copying... */
+      cogl_object_unref (new_authority);
     }

   /* At this point we know we have a material with no strong


util: Add new streq string equality helper (NULL safe)

Signed-off-by: Ikey Doherty <d8d992cf0016e35c2a8339d5e7d44bebd12a2d77@solus-project.com>

--- src/util.h
+++ src/util.h
@@ -10,6 +10,9 @@
  */

 #pragma once
+
+#include <stdbool.h>
+#include <string.h>

 /**
  * Shut up the compiler
@@ -47,6 +50,17 @@
  */
 char *string_printf(const char *s, ...) __attribute__((format(printf, 1, 2)));

+/**
+ * Determine if two strings are equal, accounting also for NULL strings
+ */
+static inline bool streq(const char *a, const char *b)
+{
+        if (!a || !b) {
+                return false;
+        }
+        return (strcmp(a, b) == 0);
+}
+
 /*
  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
  *


MTIGeometry interface update

MTIGeometry interface update

--- Frameworks/MetalPetal/MTIGeometry.h
+++ Frameworks/MetalPetal/MTIGeometry.h
@@ -15,7 +15,8 @@

 @property (nonatomic,readonly) MTLPrimitiveType primitiveType;

-@property (nonatomic,readonly) const void *bufferBytes NS_RETURNS_INNER_POINTER;
+@property (nonatomic,readonly,nullable) const void *bufferBytes NS_RETURNS_INNER_POINTER;
+
 @property (nonatomic,readonly) NSUInteger bufferLength;

 @end


Fixed interface for readdelim and readline in util.h.

--- src/util.h
+++ src/util.h
@@ -40,6 +40,7 @@

 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>

 /* ------------------------------------------------------------ */

@@ -123,12 +124,12 @@
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    This function is a replacement for POSIX.1-2008 getdelim()
 */
-int readdelim(char **lineptr, size_t *n, int delim, FILE *stream);
+ssize_t readdelim(char **lineptr, size_t *n, int delim, FILE *stream);

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    This function is a replacement for POSIX.1-2008 getline()
 */
-int readline(char **lineptr, size_t *n, FILE *stream);
+ssize_t readline(char **lineptr, size_t *n, FILE *stream);

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    successively returns new lines from file, NOT reentrant


This is meant to prevent drags from one view of a dir to another view of
the same dir. Kevin, is this the right place to do this?

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@5986 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/view.c
+++ src/view.c
@@ -2350,8 +2350,8 @@
 	if (e->win == v->win.base)
 	  {
             /* Dropped!  Handle data */
-	    /* Same view?  Mark to skip action */
-	    if( e->win == e->source_win )
+	    /* Same view or same underlying dir?  Mark to skip action */
+	    if( e->win == e->source_win || v->model == v_dnd_source->model)
 	      v->drag.matching_drop_attempt = 1;
 	    /* Perform the action... */
 	     e_dnd_handle_drop (v);


Handle properties named 'maximum' and 'minimum'.

--- src/properties.c
+++ src/properties.c
@@ -457,6 +457,10 @@
             end = mid - 1;
         mid = (beg + end) * 0.5;
     }
+    if (strcmp(string, "maximum")==0)
+        return AT_MAX;
+    if (strcmp(string, "minimum")==0)
+        return AT_MIN;
     return AT_EXTRA;
 }


Properly split the signature string into single complete types

--- common/dbus-helper.c
+++ common/dbus-helper.c
@@ -153,14 +153,56 @@
 	int i;

 	for (i = 0; sig[i]; i++) {
+		char type[32];
+		int len, struct_level, dict_level;
+		gboolean complete;
+
+		complete = FALSE;
+		struct_level = dict_level = 0;
+		memset(type, 0, sizeof(type));
+
+		/* Gather enough data to have a single complete type */
+		for (len = 0; len < (sizeof(type) - 1) && sig[i]; len++, i++) {
+			switch (sig[i]){
+			case '(':
+				struct_level++;
+				break;
+			case ')':
+				struct_level--;
+				if (struct_level <= 0 && dict_level <= 0)
+					complete = TRUE;
+				break;
+			case '{':
+				dict_level++;
+				break;
+			case '}':
+				dict_level--;
+				if (struct_level <= 0 && dict_level <= 0)
+					complete = TRUE;
+				break;
+			case 'a':
+				break;
+			default:
+				if (struct_level <= 0 && dict_level <= 0)
+					complete = TRUE;
+				break;
+			}
+
+			type[len] = sig[i];
+
+			if (complete)
+				break;
+		}
+
+
 		if (direction)
 			g_string_append_printf(gstr,
-					"\t\t\t<arg type=\"%c\" direction=\"%s\"/>\n",
-					sig[i], direction);
+					"\t\t\t<arg type=\"%s\" direction=\"%s\"/>\n",
+					type, direction);
 		else
 			g_string_append_printf(gstr,
-					"\t\t\t<arg type=\"%c\"/>\n",
-					sig[i]);
+					"\t\t\t<arg type=\"%s\"/>\n",
+					type);
 	}
 }


add an unreachable type, so we can properly type check binaries with an unreachable side (which we then ignore) #160

--- src/wasm.h
+++ src/wasm.h
@@ -91,7 +91,10 @@
   i32,
   i64,
   f32,
-  f64
+  f64,
+  unreachable // none means no type, e.g. a block can have no return type. but
+              // unreachable is different, as it can be "ignored" when doing
+              // type checking across branches
 };

 inline const char* printWasmType(WasmType type) {
@@ -129,6 +132,10 @@
   if (size == 4) return float_ ? WasmType::f32 : WasmType::i32;
   if (size == 8) return float_ ? WasmType::f64 : WasmType::i64;
   abort();
+}
+
+inline WasmType getReachableWasmType(WasmType a, WasmType b) {
+  return a != unreachable ? a : b;
 }

 // Literals
@@ -238,6 +245,7 @@
       case WasmType::i64: o << literal.i64; break;
       case WasmType::f32: literal.printFloat(o, literal.f32); break;
       case WasmType::f64: literal.printDouble(o, literal.f64); break;
+      default: WASM_UNREACHABLE();
     }
     restoreNormalColor(o);
     return o << ')';
@@ -861,8 +869,8 @@
     if (isRelational()) {
       type = i32;
     } else {
-      assert_node(left->type == right->type, this);
-      type = left->type;
+      assert_node(left->type != unreachable && right->type != unreachable ? left->type == right->type : true, this);
+      type = getReachableWasmType(left->type, right->type);
     }
   }
 };
@@ -931,7 +939,9 @@

 class Unreachable : public Expression {
 public:
-  Unreachable() : Expression(UnreachableId) {}
+  Unreachable() : Expression(UnreachableId) {
+    type = unreachable;
+  }

   std::ostream& doPrint(std::ostream &o, unsigned indent) {
     return printMinorOpening(o, "unreachable") << ')';


clean-up debug output

clean-up debug output

--- src/vmcore/dptroute.h
+++ src/vmcore/dptroute.h
@@ -168,7 +168,9 @@
 			os << "TROOEEEEETTTT!!!!" << std::endl;

 		} break;
-		case RT_SCOPE_LINK: {
+		case RT_SCOPE_LINK:
+		case RT_SCOPE_SITE:
+		case RT_SCOPE_UNIVERSE: {

 			os << "<dptroute: ";
 				os << rtr.get_dst() << " ";
@@ -178,32 +180,13 @@
 				os << "rtindex: " 	<< route.rtindex << " ";
 			os << "> ";

-		} break;
-		case RT_SCOPE_SITE:
-		case RT_SCOPE_UNIVERSE: {
-
 			for (std::map<uint16_t, dptnexthop>::const_iterator
 					it = route.dptnexthops.begin(); it != route.dptnexthops.end(); ++it) {

 				dptnexthop const& nhop = it->second;
-
-				os << "<dptroute: ";
-					os << rtr.get_dst() << " ";
-					switch (rtr.get_scope()) {
-					case RT_SCOPE_SITE:
-					case RT_SCOPE_UNIVERSE: {
-						os << "via " << nhop.get_gateway() << " ";
-					} break;
-					}
-					os << "dev " << cnetlink::get_instance().get_link(nhop.get_ifindex()).get_devname() << " ";
-					os << "scope " << rtr.get_scope_s() << " ";
-					os << "table " << rtr.get_table_id_s() << " ";
-					os << "rtindex: " 	<< route.rtindex << " ";
-					//os << rtr << " ";
-					//os << "flowentry=" 	<< s_buf << " ";
-				os << "> ";
+				os << "        " << nhop << std::endl;
+
 			}
-
 		} break;
 		}
 		return os;


huge bug on adress ..

huge bug on adress ..

--- src/vmod_threescale.c
+++ src/vmod_threescale.c
@@ -178,7 +178,7 @@

       if(connect(sock, (struct sockaddr *)remote, sizeof(struct sockaddr)) >= 0) {
         int sent = 0;
-        while(sent < (int)strlen(srequest+1)) {
+        while(sent < (int)strlen(srequest)+1) {
           tmpres = send(sock, srequest+sent, (int)strlen(srequest)-sent, 0);
           sent += tmpres;
         }


Ctrl-C handler for Windows

Ctrl-C handler for Windows

--- src/zsys.c
+++ src/zsys.c
@@ -39,6 +39,19 @@
 static bool s_first_time = true;
 static struct sigaction sigint_default;
 static struct sigaction sigterm_default;
+#elif defined (__WINDOWS__)
+static bool s_shim_installed = false;
+static zsys_handler_fn *installed_handler_fn;
+static BOOL WINAPI s_handler_fn_shim (DWORD ctrltype)
+{
+   // return TRUE for events that we handle
+   if (ctrltype == CTRL_C_EVENT && installed_handler_fn != NULL) {
+       installed_handler_fn (ctrltype);
+       return TRUE;
+   }
+   else
+       return FALSE;
+}
 #endif

 //  --------------------------------------------------------------------------
@@ -67,6 +80,12 @@
             sigaction (SIGTERM, NULL, &sigterm_default);
         }
     }
+#elif defined (__WINDOWS__)
+    installed_handler_fn = handler_fn;
+    if (!s_shim_installed) {
+        s_shim_installed = true;
+        SetConsoleCtrlHandler (s_handler_fn_shim, TRUE);
+    }
 #endif
 }

@@ -87,6 +106,12 @@
         sigterm_default.sa_handler = NULL;
         s_first_time = true;
     }
+#elif defined (__WIN32__)
+    if (s_shim_installed) {
+        SetConsoleCtrlHandler (s_handler_fn_shim, FALSE);
+        s_shim_installed = false;
+    }
+    installed_handler_fn = NULL;
 #endif
 }


IPIP: Fix coverity error.

IPIP: Fix coverity error.

Change-Id: Ia2b3350bf8e2c72eee3f33936ba16dd817c75c72
Signed-off-by: Ole Troan <aeed71d78dc09e4764ceac69b111eee9b50cfdd0@cisco.com>

--- src/vnet/ipip/sixrd.c
+++ src/vnet/ipip/sixrd.c
@@ -195,6 +195,9 @@
   ip_adjacency_t *adj = adj_get (ai);
   ipip_tunnel_t *t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);

+  /* Not our tunnel */
+  if (!t)
+    return;
   if (!memcmp (&sixrd_special_nh, &adj->sub_type.nbr.next_hop,
 	       sizeof (sixrd_special_nh)))
     {


Include signal.h

Include signal.h

--- src/ztee.c
+++ src/ztee.c
@@ -14,6 +14,7 @@
 #include <getopt.h>
 #include <pthread.h>
 #include <unistd.h>
+#include <signal.h>

 #include "../lib/lockfd.h"
 #include "../lib/logger.h"


libvortex-1.1: * [fix] Improving error message associated to listener bind error.

--- src/vortex_listener.c
+++ src/vortex_listener.c
@@ -484,7 +484,7 @@

         if (bind(fd, (struct sockaddr *)&saddr,  sizeof (struct sockaddr_in)) == VORTEX_SOCKET_ERROR) {
 		vortex_close_socket (fd);
-		axl_error_report (error, VortexBindError, "unable to bind address");
+		axl_error_report (error, VortexBindError, "unable to bind address (port already in use or insufficient permissions)");
 		return -1;
         }


 r4319@ib:  gugod | 2004-12-12T15:53:03.623656Z
 Special handle for space key (Indeed very special one).  Un-break
 the situation that OnKeySpace() is not called, hence the Candidate
 window doesn't show up, because ZUIN_NO_WORD is returned.

git-svn-id: e9d79eecdf4fd41b7fc286009e46b9de049783c0@12 ac1be623-90ea-0310-9410-ba68b2efa777

--- src/zuin.c
+++ src/zuin.c
@@ -98,7 +98,7 @@
 		pZuin->pho_inx[ 0 ] == 0 &&
 		pZuin->pho_inx[ 1 ] == 0 &&
 		pZuin->pho_inx[ 2 ] == 0 )
-		return ZUIN_NO_WORD;
+		return key==' '?ZUIN_KEY_ERROR:ZUIN_NO_WORD;

 	pZuin->pho_inx[ 3 ] = Key2PhoneInx( key, 3, pZuin->kbtype, searchTimes );
 	u16Pho = PhoneInx2Uint( pZuin->pho_inx );


vppinfra: Add missing %o

vppinfra: Add missing %o

This is used in vppinfra/socket.c:495

Type: feature

Change-Id: I89b409ae7abb01723108ae3e6c55bb1675db50ee
Signed-off-by: Nathan Skrzypczak <0fa918c439baf617eab84c5ae2a48ee9db643966@gmail.com>

--- src/vppinfra/format.c
+++ src/vppinfra/format.c
@@ -278,6 +278,7 @@
 	case 'x':
 	case 'X':
 	case 'u':
+	case 'o':
 	case 'd':
 	  {
 	    u64 number;
@@ -310,6 +311,9 @@
 		o.n_bits = BITS (int);
 		break;
 	      }
+
+	    if (c == 'o')
+	      o.base = 8;

 	    s = format_integer (s, number, &o);
 	  }


common: Don't segfault w/o org.freedesktop.Flatpak.SystemHelper

Without this patch flatpak-remote-add (and anything else that uses this
section of code) segfaults if org.freedesktop.Flatpak.SystemHelper is
unavailable because it tries to cast an integer to a GDbusProxy.

--- common/flatpak-dir.c
+++ common/flatpak-dir.c
@@ -289,7 +289,10 @@
           g_warning ("Can't find org.freedesktop.Flatpak.SystemHelper: %s\n", error->message);
           system_helper = NO_SYSTEM_HELPER;
         }
-      g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (system_helper), G_MAXINT);
+      else
+        {
+          g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (system_helper), G_MAXINT);
+        }
       g_once_init_leave (&self->system_helper, system_helper);
     }

@@ -332,7 +335,8 @@
   g_clear_object (&self->repo);
   g_clear_object (&self->basedir);

-  g_clear_object (&self->system_helper);
+  if (self->system_helper != NO_SYSTEM_HELPER)
+    g_clear_object (&self->system_helper);

   g_clear_object (&self->soup_session);
   g_clear_pointer (&self->summary_cache, g_hash_table_unref);


Fix for WIN32 builds with KRB5 (cherry picked from commit 3eddd1706a30cdf3dc9278692d8ee9038eac8a0d)

--- ssl/kssl.h
+++ ssl/kssl.h
@@ -70,6 +70,15 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <krb5.h>
+#ifdef OPENSSL_SYS_WIN32
+/* These can sometimes get redefined indirectly by krb5 header files
+ * after they get undefed in ossl_typ.h
+ */
+#undef X509_NAME
+#undef X509_EXTENSIONS
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+#endif

 #ifdef  __cplusplus
 extern "C" {


dir: Don't ignore errors when deleting a file

Of the 16 instances where g_file_delete() is used, these are the only
ones where the return value is ignored.  This triggers Coverity.

It might not be strictly necessary to handle the errors, but doing so
can only help with debugging.

--- common/flatpak-dir.c
+++ common/flatpak-dir.c
@@ -6438,6 +6438,7 @@
                               GCancellable      *cancellable,
                               GError           **error)
 {
+  g_autoptr(GError) local_error = NULL;
   g_autoptr(GFile) base = NULL;
   g_autoptr(GFile) dir = NULL;
   g_autoptr(GFile) current_link = NULL;
@@ -6454,7 +6455,12 @@

   current_link = g_file_get_child (dir, "current");

-  g_file_delete (current_link, cancellable, NULL);
+  if (!g_file_delete (current_link, cancellable, &local_error) &&
+      !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+    {
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return FALSE;
+    }

   rest = flatpak_decomposed_peek_arch (ref, NULL);
   if (!g_file_make_symbolic_link (current_link, rest, cancellable, error))
@@ -9065,7 +9071,13 @@
   /* Fix symlink */
   link_file = g_file_new_build_filename (g_get_user_data_dir (), "applications", desktop_name, NULL);
   relative_path = g_build_filename ("..", "xdg-desktop-portal", "applications", new_desktop, NULL);
-  g_file_delete (link_file, NULL, NULL);
+  if (!g_file_delete (link_file, NULL, &local_error) &&
+      !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+    {
+      g_debug ("Unable to delete desktop file link %s: %s", desktop_name, local_error->message);
+      g_clear_error (&local_error);
+    }
+
   new_link_file = g_file_new_build_filename (g_get_user_data_dir (), "applications", new_desktop, NULL);
   if (!g_file_make_symbolic_link (new_link_file, relative_path, NULL, &local_error))
     {
@@ -11898,9 +11910,26 @@
       sha256 = g_compute_checksum_for_bytes (G_CHECKSUM_SHA256, mfile_bytes);
       if (strcmp (sha256, checksum) != 0)
         {
-          g_file_delete (main_cache_file, NULL, NULL);
+          g_autoptr(GError) local_error = NULL;
+
+          if (!g_file_delete (main_cache_file, NULL, &local_error) &&
+              !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+            {
+              g_autofree char *path = g_file_get_path (main_cache_file);
+              g_debug ("Unable to delete file %s: %s", path, local_error->message);
+              g_clear_error (&local_error);
+            }
+
           if (sig_ext)
-            g_file_delete (sig_cache_file, NULL, NULL);
+            {
+              if (!g_file_delete (sig_cache_file, NULL, &local_error) &&
+                  !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+                {
+                  g_autofree char *path = g_file_get_path (sig_cache_file);
+                  g_debug ("Unable to delete file %s: %s", path, local_error->message);
+                  g_clear_error (&local_error);
+                }
+            }

           return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA,
                                      _("Invalid checksum for indexed summary %s read from %s"),


fix doubled code introduced with r231 - 97f9f969

--- ssl/tls1.c
+++ ssl/tls1.c
@@ -1450,8 +1450,6 @@

     if (ssl->cipher_info)
         SET_SSL_FLAG(SSL_TX_ENCRYPTED);
-    if (ssl->cipher_info)
-        SET_SSL_FLAG(SSL_TX_ENCRYPTED);

     memset(ssl->write_sequence, 0, 8);
     return ret;


examples/gtkdial/gtkdial.c: Fixing for removal of GtkObject type

--- examples/gtkdial/gtkdial.c
+++ examples/gtkdial/gtkdial.c
@@ -31,7 +31,7 @@

 static void gtk_dial_class_init               (GtkDialClass     *klass);
 static void gtk_dial_init                     (GtkDial          *dial);
-static void gtk_dial_destroy                  (GtkObject        *object);
+static void gtk_dial_destroy                  (GtkWidget        *widget);
 static void gtk_dial_realize                  (GtkWidget        *widget);
 static void gtk_dial_size_request             (GtkWidget        *widget,
                                                GtkRequisition   *requisition);
@@ -87,16 +87,13 @@
 static void
 gtk_dial_class_init (GtkDialClass *class)
 {
-  GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;

-  object_class = (GtkObjectClass*) class;
   widget_class = (GtkWidgetClass*) class;

   parent_class = g_type_class_peek_parent (class);

-  object_class->destroy = gtk_dial_destroy;
-
+  widget_class->destroy = gtk_dial_destroy;
   widget_class->realize = gtk_dial_realize;
   widget_class->expose_event = gtk_dial_expose;
   widget_class->size_request = gtk_dial_size_request;
@@ -137,22 +134,22 @@
 }

 static void
-gtk_dial_destroy (GtkObject *object)
+gtk_dial_destroy (GtkWidget *widget)
 {
   GtkDial *dial;

   g_return_if_fail (object != NULL);
   g_return_if_fail (GTK_IS_DIAL (object));

-  dial = GTK_DIAL (object);
+  dial = GTK_DIAL (widget);

   if (dial->adjustment)
     {
-      g_object_unref (GTK_OBJECT (dial->adjustment));
+      g_object_unref (dial->adjustment);
       dial->adjustment = NULL;
     }

-  GTK_OBJECT_CLASS (parent_class)->destroy (object);
+  GTK_WIDGET_CLASS (parent_class)->destroy (widget);
 }

 GtkAdjustment*
@@ -183,12 +180,12 @@

   if (dial->adjustment)
     {
-      g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial);
-      g_object_unref (GTK_OBJECT (dial->adjustment));
+      g_signal_handlers_disconnect_by_func (dial->adjustment, NULL, (gpointer) dial);
+      g_object_unref (dial->adjustment);
     }

   dial->adjustment = adjustment;
-  g_object_ref (GTK_OBJECT (dial->adjustment));
+  g_object_ref (dial->adjustment);

   g_signal_connect (G_OBJECT (adjustment), "changed",
 		    G_CALLBACK (gtk_dial_adjustment_changed),
@@ -481,7 +478,7 @@

       if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
 	  (dial->old_value != dial->adjustment->value))
-	g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
+	g_signal_emit_by_name (dial->adjustment, "value_changed");
     }

   return FALSE;
@@ -539,7 +536,7 @@
   g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);

   if (dial->policy == GTK_UPDATE_DELAYED)
-    g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
+    g_signal_emit_by_name (dial->adjustment, "value_changed");

   return FALSE;
 }
@@ -575,7 +572,7 @@
     {
       if (dial->policy == GTK_UPDATE_CONTINUOUS)
 	{
-	  g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
+	  g_signal_emit_by_name (dial->adjustment, "value_changed");
 	}
       else
 	{
@@ -613,7 +610,7 @@
   if (new_value != dial->adjustment->value)
     {
       dial->adjustment->value = new_value;
-      g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
+      g_signal_emit_by_name (dial->adjustment, "value_changed");
     }

   dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /


Fix a typo.

Fix a typo.

--- arangod/GeneralServer/VppNetwork.h
+++ arangod/GeneralServer/VppNetwork.h
@@ -218,7 +218,7 @@
     }
   }

-  // send fist
+  // send first
   resultVecRef.push_back(
       createChunkForNetworkMultiFirst(completeMessage->c_str(), offsetBegin,
                                       offsetEnd, id, numberOfChunks, totalLen));


msm_fb: hdmi: Break infinite loop

msm_fb: hdmi: Break infinite loop

Currently, if HDMI PLL lock fails, it will retry. It retries until
the PLL is locked. This may result in infinite loop. This change will
limit the retries to max 10.

Change-Id: I1745643cba7bbc5272f1252208759a83258e9fcb
Signed-off-by: Ajay Singh Parmar <222f6e9d17c93f3930c3fccb3bb755eb5187fb82@codeaurora.org>

--- arch/arm/mach-msm/clock-dss-8960.c
+++ arch/arm/mach-msm/clock-dss-8960.c
@@ -98,6 +98,7 @@
 	unsigned int val;
 	u32 ahb_en_reg, ahb_enabled;
 	unsigned int timeout_count;
+	int pll_lock_retry = 10;

 	ahb_en_reg = readl_relaxed(AHB_EN_REG);
 	ahb_enabled = ahb_en_reg & BIT(4);
@@ -149,7 +150,7 @@

 	timeout_count = 1000;
 	while (!(readl_relaxed(HDMI_PHY_PLL_STATUS0) & BIT(0)) &&
-			timeout_count) {
+			timeout_count && pll_lock_retry) {
 		if (--timeout_count == 0) {
 			/*
 			 * PLL has still not locked.
@@ -166,16 +167,18 @@
 			udelay(10);
 			writel_relaxed(0x0D, HDMI_PHY_PLL_LOCKDET_CFG2);
 			timeout_count = 1000;
-
-			pr_err("%s: PLL not locked after %d iterations\n",
-				__func__, timeout_count);
-			pr_err("%s: Asserting PLL S/W reset & trying again\n",
-				__func__);
+			pll_lock_retry--;
 		}
 	}

 	if (!ahb_enabled)
 		writel_relaxed(ahb_en_reg & ~BIT(4), AHB_EN_REG);
+
+	if (!pll_lock_retry) {
+		pr_err("%s: HDMI PLL not locked\n", __func__);
+		return -EAGAIN;
+	}
+
 	hdmi_pll_on = 1;
 	return 0;
 }


OMAP2 clockdomain: modem clockdomain is only present on OMAP2430

For some reason, previously, we included the MDM clockdomain on all 24xx,
but the stacked die-on-die modem configuration (chassis mode) is only
available on OMAP2430.

Signed-off-by: Paul Walmsley <a027184a55211cd23e3f3094f1fdc728df5e0500@pwsan.com>

--- arch/arm/mach-omap2/clockdomains.h
+++ arch/arm/mach-omap2/clockdomains.h
@@ -110,30 +110,6 @@
 };

 /*
- * 2420/2430 PM_WKDEP_MDM: CORE, MPU, WKUP
- * XXX This is probably 2430-only; 2420 did not have a stacked modem config.
- */
-static struct clkdm_dep mdm_24xx_wkdeps[] = {
-	{
-		.clkdm_name = "core_l3_clkdm",
-		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-	},
-	{
-		.clkdm_name = "core_l4_clkdm",
-		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-	},
-	{
-		.clkdm_name = "mpu_clkdm",
-		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-	},
-	{
-		.clkdm_name = "wkup_clkdm",
-		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
-	},
-	{ NULL },
-};
-
-/*
  * 2420 PM_WKDEP_MPU: CORE, DSP, WKUP
  * 2430 adds MDM
  */
@@ -190,6 +166,35 @@
 };

 #endif
+
+
+/* 2430-specific possible wakeup dependencies */
+
+#ifdef CONFIG_ARCH_OMAP2430
+
+/* 2430 PM_WKDEP_MDM: CORE, MPU, WKUP */
+static struct clkdm_dep mdm_2430_wkdeps[] = {
+	{
+		.clkdm_name = "core_l3_clkdm",
+		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
+	},
+	{
+		.clkdm_name = "core_l4_clkdm",
+		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
+	},
+	{
+		.clkdm_name = "mpu_clkdm",
+		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
+	},
+	{
+		.clkdm_name = "wkup_clkdm",
+		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
+	},
+	{ NULL },
+};
+
+#endif /* CONFIG_ARCH_OMAP2430 */
+

 /* 34XX-specific possible dependencies */

@@ -549,7 +554,7 @@
 	.clkstctrl_reg  = OMAP2430_CM_REGADDR(OMAP2430_MDM_MOD,
 						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
-	.wkdep_srcs	= mdm_24xx_wkdeps,
+	.wkdep_srcs	= mdm_2430_wkdeps,
 	.clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };


ARM: OMAP2+: PRM: fix compile for OMAP4-only build

For OMAP4 only builds, the omap2_prm_* functions have dummy wrappers
to detect incorrect usage.  However, several unrelated omap3 PRM
functions have made it inside the #else clause of the #ifdef wrapping
the omap2_prm stubs, causing them to disappear on OMAP4-only builds.

This was unnoticed until the IO chain support was added and introduced
a new function in this section which is referenced by omap_hwmod.c:

arch/arm/mach-omap2/omap_hwmod.c: In function '_reconfigure_io_chain':
arch/arm/mach-omap2/omap_hwmod.c:1665:3: error: implicit declaration of function 'omap3xxx_prm_reconfigure_io_chain' [-Werror=implicit-function-declaration]

Fix by using the #ifdef to only wrap the omap2_prm functions that
need stubs on OMAP4-only builds.

Cc: Paul Walmsley <a027184a55211cd23e3f3094f1fdc728df5e0500@pwsan.com>
Signed-off-by: Kevin Hilman <f9849b02abe18c1ece6bd40346458ed53f49d31b@ti.com>
[a027184a55211cd23e3f3094f1fdc728df5e0500@pwsan.com: fixed checkpatch warnings for patch description]
Signed-off-by: Paul Walmsley <a027184a55211cd23e3f3094f1fdc728df5e0500@pwsan.com>

--- arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -303,6 +303,8 @@
 extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
 extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);

+#endif	/* CONFIG_ARCH_OMAP4 */
+
 /* OMAP3-specific VP functions */
 u32 omap3_prm_vp_check_txdone(u8 vp_id);
 void omap3_prm_vp_clear_txdone(u8 vp_id);
@@ -320,8 +322,6 @@
 extern void omap3xxx_prm_ocp_barrier(void);
 extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
 extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
-
-#endif	/* CONFIG_ARCH_OMAP4 */

 #endif


microblaze: Fix cache loop function for cache range

I create wrong asm code but none test shows that this part of code is wrong.
I am not convinces that were good idea to create asm optimized macros
for caches. The reason is that there is not optimization with previous code
that's why make sense to add old code and do some benchmarking which
functions are faster.

Signed-off-by: Michal Simek <3a191dd2be46e826fee926d532b136ed65cb5318@monstr.eu>

--- arch/microblaze/kernel/cpu/cache.c
+++ arch/microblaze/kernel/cpu/cache.c
@@ -172,16 +172,15 @@
 /* It is used only first parameter for OP - for wic, wdc */
 #define CACHE_RANGE_LOOP_1(start, end, line_length, op)			\
 do {									\
-	int step = -line_length;					\
-	int count = end - start;					\
-	BUG_ON(count <= 0);						\
+	int volatile temp;						\
+	BUG_ON(end - start <= 0);					\
 									\
-	__asm__ __volatile__ (" 1:	addk	%0, %0, %1;		\
-					" #op " %0, r0;			\
-					bgtid   %1, 1b;			\
-					addk    %1, %1, %2;		\
-					" : : "r" (start), "r" (count),	\
-					"r" (step) : "memory");		\
+	__asm__ __volatile__ (" 1:	" #op " %1, r0;			\
+					cmpu	%0, %1, %2;		\
+					bgtid	%0, 1b;			\
+					addk	%1, %1, %3;		\
+				" : : "r" (temp), "r" (start), "r" (end),\
+					"r" (line_length) : "memory");	\
 } while (0);

 static void __flush_icache_range_msr_irq(unsigned long start, unsigned long end)
@@ -313,16 +312,6 @@
 	pr_debug("%s\n", __func__);
 	CACHE_ALL_LOOP2(cpuinfo.dcache_size, cpuinfo.dcache_line_length,
 					wdc.clear)
-
-#if 0
-	unsigned int i;
-
-	pr_debug("%s\n", __func__);
-
-	/* Just loop through cache size and invalidate it */
-	for (i = 0; i < cpuinfo.dcache_size; i += cpuinfo.dcache_line_length)
-			__invalidate_dcache(0, i);
-#endif
 }

 static void __invalidate_dcache_range_wb(unsigned long start,


powerpc/kprobes: Fix ABIv2 issues with kprobe_lookup_name

Use ppc_function_entry in places where we previously assumed
function descriptors exist.

Signed-off-by: Anton Blanchard <14deb5e5e417133e888bf47bb6a3555c9bb7d81c@samba.org>

--- arch/powerpc/include/asm/kprobes.h
+++ arch/powerpc/include/asm/kprobes.h
@@ -30,6 +30,7 @@
 #include <linux/ptrace.h>
 #include <linux/percpu.h>
 #include <asm/probes.h>
+#include <asm/code-patching.h>

 #define  __ARCH_WANT_KPROBES_INSN_SLOT

@@ -56,9 +57,9 @@
 		if ((colon = strchr(name, ':')) != NULL) {		\
 			colon++;					\
 			if (*colon != '\0' && *colon != '.')		\
-				addr = *(kprobe_opcode_t **)addr;	\
+				addr = (kprobe_opcode_t *)ppc_function_entry(addr); \
 		} else if (name[0] != '.')				\
-			addr = *(kprobe_opcode_t **)addr;		\
+			addr = (kprobe_opcode_t *)ppc_function_entry(addr); \
 	} else {							\
 		char dot_name[KSYM_NAME_LEN];				\
 		dot_name[0] = '.';					\


crypto: aesni - fix memory usage in GCM decryption

The kernel crypto API logic requires the caller to provide the
length of (ciphertext || authentication tag) as cryptlen for the
AEAD decryption operation. Thus, the cipher implementation must
calculate the size of the plaintext output itself and cannot simply use
cryptlen.

The RFC4106 GCM decryption operation tries to overwrite cryptlen memory
in req->dst. As the destination buffer for decryption only needs to hold
the plaintext memory but cryptlen references the input buffer holding
(ciphertext || authentication tag), the assumption of the destination
buffer length in RFC4106 GCM operation leads to a too large size. This
patch simply uses the already calculated plaintext size.

In addition, this patch fixes the offset calculation of the AAD buffer
pointer: as mentioned before, cryptlen already includes the size of the
tag. Thus, the tag does not need to be added. With the addition, the AAD
will be written beyond the already allocated buffer.

Note, this fixes a kernel crash that can be triggered from user space
via AF_ALG(aead) -- simply use the libkcapi test application
from [1] and update it to use rfc4106-gcm-aes.

Using [1], the changes were tested using CAVS vectors to demonstrate
that the crypto operation still delivers the right results.

[1] http://www.chronox.de/libkcapi.html

CC: Tadeusz Struk <ac7da5bc34fbda078ba4af5ef710d2a59a2316f5@intel.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Signed-off-by: Stephan Mueller <cc02df512ad79bcd2ad3264230580f113da4eba6@chronox.de>
Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>

--- arch/x86/crypto/aesni-intel_glue.c
+++ arch/x86/crypto/aesni-intel_glue.c
@@ -1155,7 +1155,7 @@
 		src = kmalloc(req->cryptlen + req->assoclen, GFP_ATOMIC);
 		if (!src)
 			return -ENOMEM;
-		assoc = (src + req->cryptlen + auth_tag_len);
+		assoc = (src + req->cryptlen);
 		scatterwalk_map_and_copy(src, req->src, 0, req->cryptlen, 0);
 		scatterwalk_map_and_copy(assoc, req->assoc, 0,
 			req->assoclen, 0);
@@ -1180,7 +1180,7 @@
 		scatterwalk_done(&src_sg_walk, 0, 0);
 		scatterwalk_done(&assoc_sg_walk, 0, 0);
 	} else {
-		scatterwalk_map_and_copy(dst, req->dst, 0, req->cryptlen, 1);
+		scatterwalk_map_and_copy(dst, req->dst, 0, tempCipherLen, 1);
 		kfree(src);
 	}
 	return retval;


x86: Get rid of dubious one-bit signed bitfield

This very noisy sparse warning appears on almost every file in
the kernel:

  CHECK   init/main.c
  arch/x86/include/asm/thread_info.h:43:55: error: dubious one-bit
  signed bitfield arch/x86/include/asm/thread_info.h:44:46: error:
  dubious one-bit signed bitfield

Sparse is right and this patch changes sig_on_uaccess_error and
uaccess_err flags to unsigned type and thus fixes the warning.

Signed-off-by: Anton Vorontsov <1d765a3da7f714ffaadb979466c507aa3415181f@gmail.com>
Acked-by: Andy Lutomirski <2cc0d0d76de2e6f37b92deeb83c85cb306fc5dc1@mit.edu>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@linux.intel.com>
Cc: Dan Carpenter <72501f147b2753e6660fdce744d9ac3084854f5e@gmail.com>
Link: 0cd8253db962bd3c99c847b54c740ec9038ec9f5@oksana.dev.rtsoft.ru
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- arch/x86/include/asm/thread_info.h
+++ arch/x86/include/asm/thread_info.h
@@ -40,8 +40,8 @@
 						*/
 	__u8			supervisor_stack[0];
 #endif
-	int			sig_on_uaccess_error:1;
-	int			uaccess_err:1;	/* uaccess failed */
+	unsigned int		sig_on_uaccess_error:1;
+	unsigned int		uaccess_err:1;	/* uaccess failed */
 };

 #define INIT_THREAD_INFO(tsk)			\


x86, mtrr: Kill over the top warn

x86, mtrr: Kill over the top warn

Fixes bugzilla: http://bugzilla.kernel.org/show_bug.cgi?id=12558
Fixes bugzilla: http://bugzilla.kernel.org/show_bug.cgi?id=12317

(and if this really needed to be a warn you'd be responding to the bugs left
in bugzilla from it...)

Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@linux.intel.com>
LKML-Reference: <e514fd3e7685584584c65db8693f57a25dce230f@localhost.localdomain>
Signed-off-by: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>

--- arch/x86/kernel/cpu/mtrr/generic.c
+++ arch/x86/kernel/cpu/mtrr/generic.c
@@ -464,7 +464,7 @@
 		tmp |= ~((1<<(hi - 1)) - 1);

 		if (tmp != mask_lo) {
-			WARN_ONCE(1, KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
+			printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n");
 			mask_lo = tmp;
 		}
 	}


x86: mtrr: don't modify RdDram/WrDram bits of fixed MTRRs

Impact: bug fix + BIOS workaround

BIOS is expected to clear the SYSCFG[MtrrFixDramModEn] on AMD CPUs
after fixed MTRRs are configured.

Some BIOSes do not clear SYSCFG[MtrrFixDramModEn] on BP (and on APs).

This can lead to obfuscation in Linux when this bit is not cleared on
BP but cleared on APs. A consequence of this is that the saved
fixed-MTRR state (from BP) differs from the fixed-MTRRs of APs --
because RdDram/WrDram bits are read as zero when
SYSCFG[MtrrFixDramModEn] is cleared -- and Linux tries to sync
fixed-MTRR state from BP to AP. This implies that Linux sets
SYSCFG[MtrrFixDramEn] and activates those bits.

More important is that (some) systems change these bits in SMM when
ACPI is enabled. Hence it is racy if Linux modifies RdMem/WrMem bits,
too.

(1) The patch modifies an old fix from Bernhard Kaindl to get
    suspend/resume working on some Acer Laptops. Bernhard's patch
    tried to sync RdMem/WrMem bits of fixed MTRR registers and that
    helped on those old Laptops. (Don't ask me why -- can't test it
    myself). But this old problem was not the motivation for the
    patch. (See http://lkml.org/lkml/2007/4/3/110)

(2) The more important effect is to fix issues on some more current systems.

    On those systems Linux panics or just freezes, see

    http://bugzilla.kernel.org/show_bug.cgi?id=11541
    (and also duplicates of this bug:
    http://bugzilla.kernel.org/show_bug.cgi?id=11737
    http://bugzilla.kernel.org/show_bug.cgi?id=11714)

    The affected systems boot only using acpi=ht, acpi=off or
    when the kernel is built with CONFIG_MTRR=n.

    The acpi options prevent full enablement of ACPI.  Obviously when
    ACPI is enabled the BIOS/SMM modfies RdMem/WrMem bits.  When
    CONFIG_MTRR=y Linux also accesses and modifies those bits when it
    needs to sync fixed-MTRRs across cores (Bernhard's fix, see (1)).
    How do you synchronize that? You can't. As a consequence Linux
    shouldn't touch those bits at all (Rationale are AMD's BKDGs which
    recommend to clear the bit that makes RdMem/WrMem accessible).
    This is the purpose of this patch. And (so far) this suffices to
    fix (1) and (2).

I suggest not to touch RdDram/WrDram bits of fixed-MTRRs and
SYSCFG[MtrrFixDramEn] and to clear SYSCFG[MtrrFixDramModEn] as
suggested by AMD K8, and AMD family 10h/11h BKDGs.
BIOS is expected to do this anyway. This should avoid that
Linux and SMM tread on each other's toes ...

Signed-off-by: Andreas Herrmann <39e536ca8269572d74bff7f8e46f22412f1aee88@amd.com>
Cc: dc31099191a1a231a41b126c85d59916cd0f555f@suse.de
Cc: Yinghai Lu <0674548f4d596393408a51d6287a76ebba2f42aa@kernel.org>
LKML-Reference: <a81fa584a53240db5421511bca724699cad3a31e@alberich.amd.com>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- arch/x86/kernel/cpu/mtrr/generic.c
+++ arch/x86/kernel/cpu/mtrr/generic.c
@@ -33,6 +33,32 @@
 struct mtrr_state_type mtrr_state = {};
 EXPORT_SYMBOL_GPL(mtrr_state);

+/**
+ * BIOS is expected to clear MtrrFixDramModEn bit, see for example
+ * "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD
+ * Opteron Processors" (26094 Rev. 3.30 February 2006), section
+ * "13.2.1.2 SYSCFG Register": "The MtrrFixDramModEn bit should be set
+ * to 1 during BIOS initalization of the fixed MTRRs, then cleared to
+ * 0 for operation."
+ */
+static inline void k8_check_syscfg_dram_mod_en(void)
+{
+	u32 lo, hi;
+
+	if (!((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
+	      (boot_cpu_data.x86 >= 0x0f)))
+		return;
+
+	rdmsr(MSR_K8_SYSCFG, lo, hi);
+	if (lo & K8_MTRRFIXRANGE_DRAM_MODIFY) {
+		printk(KERN_ERR FW_WARN "MTRR: CPU %u: SYSCFG[MtrrFixDramModEn]"
+		       " not cleared by BIOS, clearing this bit\n",
+		       smp_processor_id());
+		lo &= ~K8_MTRRFIXRANGE_DRAM_MODIFY;
+		mtrr_wrmsr(MSR_K8_SYSCFG, lo, hi);
+	}
+}
+
 /*
  * Returns the effective MTRR type for the region
  * Error returns:
@@ -165,6 +191,8 @@
 {
 	unsigned int *p = (unsigned int *) frs;
 	int i;
+
+	k8_check_syscfg_dram_mod_en();

 	rdmsr(MTRRfix64K_00000_MSR, p[0], p[1]);

@@ -306,27 +334,10 @@
 }

 /**
- * Enable and allow read/write of extended fixed-range MTRR bits on K8 CPUs
- * see AMD publication no. 24593, chapter 3.2.1 for more information
- */
-static inline void k8_enable_fixed_iorrs(void)
-{
-	unsigned lo, hi;
-
-	rdmsr(MSR_K8_SYSCFG, lo, hi);
-	mtrr_wrmsr(MSR_K8_SYSCFG, lo
-				| K8_MTRRFIXRANGE_DRAM_ENABLE
-				| K8_MTRRFIXRANGE_DRAM_MODIFY, hi);
-}
-
-/**
  * set_fixed_range - checks & updates a fixed-range MTRR if it differs from the value it should have
  * @msr: MSR address of the MTTR which should be checked and updated
  * @changed: pointer which indicates whether the MTRR needed to be changed
  * @msrwords: pointer to the MSR values which the MSR should have
- *
- * If K8 extentions are wanted, update the K8 SYSCFG MSR also.
- * See AMD publication no. 24593, chapter 7.8.1, page 233 for more information.
  */
 static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
 {
@@ -335,10 +346,6 @@
 	rdmsr(msr, lo, hi);

 	if (lo != msrwords[0] || hi != msrwords[1]) {
-		if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-		    (boot_cpu_data.x86 >= 0x0f && boot_cpu_data.x86 <= 0x11) &&
-		    ((msrwords[0] | msrwords[1]) & K8_MTRR_RDMEM_WRMEM_MASK))
-			k8_enable_fixed_iorrs();
 		mtrr_wrmsr(msr, msrwords[0], msrwords[1]);
 		*changed = true;
 	}
@@ -425,6 +432,8 @@
 	unsigned long long *saved = (unsigned long long *) frs;
 	bool changed = false;
 	int block=-1, range;
+
+	k8_check_syscfg_dram_mod_en();

 	while (fixed_range_blocks[++block].ranges)
 	    for (range=0; range < fixed_range_blocks[block].ranges; range++)


test

test

test

--- src/redis/info.c
+++ src/redis/info.c
@@ -110,6 +110,7 @@
         return rInfo;
     }

+
     if( (strncmp(ch,"ERR",2)) == 0){
         rInfo->err = 2;
         dst s= dsnew("redis info can't support command:");


Restrict trace when TRACE=on.

Restrict trace when TRACE=on.

--- src/relic_core.c
+++ src/relic_core.c
@@ -77,7 +77,7 @@
 		core_ctx = &(first_ctx);
 	}

-#if defined(CHECK) || defined(TRACE)
+#if defined(CHECK) && defined(TRACE)
 	core_ctx->trace = 0;
 #endif


Make reinitializing a repository return GIT_ENOTIMPLEMENTED instead of GIT_SUCCESS

--- src/repository.c
+++ src/repository.c
@@ -346,7 +346,7 @@
 {
 	/* TODO: reinit the repository */
 	results->has_been_reinit = 1;
-	return GIT_SUCCESS;
+	return GIT_ENOTIMPLEMENTED;
 }

 static int repo_init_createhead(git_repository *repo)


Update 3rdparty/postgresql/pg_lzcompress.h

--- 3rdparty/postgresql/pg_lzcompress.h
+++ 3rdparty/postgresql/pg_lzcompress.h
@@ -15,8 +15,6 @@
 #define PG_LZCOMPRESS_VERSION "13.2"

 #define Min(a, b) ((a) < (b) ? (a) : (b))
-
-#define unlikely

 #include <stdbool.h>
 #include <stdint.h>


backend/drm: ignore hotplug events while inactive

When the session is inactive, we can't change the KMS state. Ignore
hotplug events so that compositors don't try to perform a modeset when
a connector is plugged in. We already re-scan connectors when the
session becomes active.

To test, run a wlroots compositor on VT 1, switch to VT 2, unplug a
connector, re-plug it, switch back to VT 1. Without this patch the
screen is black on VT 1.

References: https://github.com/swaywm/wlroots/issues/2370

--- backend/drm/backend.c
+++ backend/drm/backend.c
@@ -109,8 +109,11 @@
 static void handle_dev_change(struct wl_listener *listener, void *data) {
 	struct wlr_drm_backend *drm = wl_container_of(listener, drm, dev_change);

+	if (!drm->session->active) {
+		return;
+	}
+
 	wlr_log(WLR_DEBUG, "%s invalidated", drm->name);
-
 	scan_drm_connectors(drm);
 }


walletdb: Remove unused static functions from walletdb.h

VerifyEnvironment and VerifyDatabaseFile were removed, but their
declarations weren't. Remove those.

--- src/wallet/walletdb.h
+++ src/wallet/walletdb.h
@@ -264,10 +264,6 @@
     DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
     /* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
     static bool IsKeyType(const std::string& strType);
-    /* verifies the database environment */
-    static bool VerifyEnvironment(const fs::path& wallet_path, bilingual_str& errorStr);
-    /* verifies the database file */
-    static bool VerifyDatabaseFile(const fs::path& wallet_path, bilingual_str& errorStr);

     //! write the hdchain model (external chain child index counter)
     bool WriteHDChain(const CHDChain& chain);