INTEGRATION: CWS i18n31 (1.17.22); FILE MERGED 2007/05/31 12:01:03 sb 1.17.22.1: #i76869# Added rtl_uString_iterateCodePoints.

--- sal/rtl/source/string.c
+++ sal/rtl/source/string.c
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: string.c,v $
  *
- *  $Revision: 1.17 $
- *
- *  last change: $Author: rt $ $Date: 2007-04-03 14:05:53 $
+ *  $Revision: 1.18 $
+ *
+ *  last change: $Author: rt $ $Date: 2007-07-26 09:06:02 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -55,6 +55,7 @@
 #endif

 #include "strimp.h"
+#include "surrogates.h"

 #ifndef _RTL_STRING_H_
 #include <rtl/string.h>
@@ -136,17 +137,6 @@

 /* ======================================================================= */

-#define RTL_UNICODE_START_HIGH_SURROGATES                   0xD800
-#define RTL_UNICODE_END_HIGH_SURROGATES                     0xDBFF
-#define RTL_UNICODE_START_LOW_SURROGATES                    0xDC00
-#define RTL_UNICODE_END_LOW_SURROGATES                      0xDFFF
-
-#define RTL_UNICODE_SURROGATES_HALFMASK                     0x03FFUL
-#define RTL_UNICODE_SURROGATES_HALFBASE                     0x0010000UL
-#define RTL_UNICODE_SURROGATES_HALFSHIFT                    10
-
-/* ----------------------------------------------------------------------- */
-
 static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
 {
     int                 n;
@@ -166,8 +156,7 @@
             n += 2;
         else
         {
-            if ( (c < RTL_UNICODE_START_HIGH_SURROGATES) ||
-                 (c > RTL_UNICODE_END_HIGH_SURROGATES) )
+            if ( !SAL_RTL_IS_HIGH_SURROGATE(c) )
                 n += 3;
             else
             {
@@ -176,12 +165,9 @@
                 if ( pStr+1 < pEndStr )
                 {
                     c = *(pStr+1);
-                    if ( (c >= RTL_UNICODE_START_LOW_SURROGATES) &&
-                         (c <= RTL_UNICODE_END_LOW_SURROGATES) )
+                    if ( SAL_RTL_IS_LOW_SURROGATE(c) )
                     {
-                        nUCS4Char -= RTL_UNICODE_START_HIGH_SURROGATES;
-                        nUCS4Char <<= RTL_UNICODE_SURROGATES_HALFSHIFT;
-                        nUCS4Char += (c-RTL_UNICODE_START_LOW_SURROGATES) + RTL_UNICODE_SURROGATES_HALFBASE;
+                        nUCS4Char = SAL_RTL_COMBINE_SURROGATES(nUCS4Char, c);
                         pStr++;
                     }
                 }


Add header includes for gif_hash.h

Add header includes for gif_hash.h

--- lib/gif_hash.h
+++ lib/gif_hash.h
@@ -24,6 +24,10 @@
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef HAVE_BASETSD_H
 #include <basetsd.h>
 #endif


Warnings--;

Warnings--;

--HG--
extra : convert_revision : svn%3A99687598-2e92-11dd-8019-fe7b9d601d1b/trunk%404156

--- Plugins/Displays/Brushed/GrowlBrushedWindowController.h
+++ Plugins/Displays/Brushed/GrowlBrushedWindowController.h
@@ -15,9 +15,6 @@
 	unsigned	uid;
 }

-- (id) init;
-- (void) dealloc;
-
 - (unsigned) depth;
 - (void) setNotification: (GrowlApplicationNotification *) theNotification;


It's ok for __repr__ to return unicode.

It's ok for __repr__ to return unicode.

--- Objects/object.c
+++ Objects/object.c
@@ -361,15 +361,8 @@
 		res = (*v->ob_type->tp_repr)(v);
 		if (res == NULL)
 			return NULL;
-		if (PyUnicode_Check(res)) {
-			PyObject* str;
-			str = PyUnicode_AsEncodedString(res, NULL, NULL);
-			Py_DECREF(res);
-			if (str)
-				res = str;
-			else
-				return NULL;
-		}
+		if (PyUnicode_Check(res))
+			return res;
 		if (!PyString_Check(res)) {
 			PyErr_Format(PyExc_TypeError,
 				     "__repr__ returned non-string (type %.200s)",


restored older arg specification

restored older arg specification

--- Opcodes/oscbnk.c
+++ Opcodes/oscbnk.c
@@ -2580,7 +2580,7 @@
             (SUBR) vco2ftset, (SUBR) NULL, (SUBR) NULL                  },
     { "vco2ft",     sizeof(VCO2FT),     TW, 3,      "k",    "kov",
             (SUBR) vco2ftset, (SUBR) vco2ft, (SUBR) NULL                },
-    { "vco2",       sizeof(VCO2),       TR, 5,      "a",    "kkoOOo",
+    { "vco2",       sizeof(VCO2),       TR, 5,      "a",    "kkoM",
             (SUBR) vco2set, (SUBR) NULL, (SUBR) vco2                    },
     { "denorm",     sizeof(DENORMS),   0,  4,      "",     "y",
             (SUBR) NULL, (SUBR) NULL, (SUBR) denorms                    },


csound lock functions correctly from struct now

--- Opcodes/serial.c
+++ Opcodes/serial.c
@@ -549,7 +549,7 @@
     unsigned int ans = 0;
     uint16_t c, val;
     ARDUINO_GLOBALS *q = (ARDUINO_GLOBALS*)p;
-    //CSOUND *csound = q->csound;
+    CSOUND *csound = q->csound;
     //printf("Q=%p\n", q);
     // Read until we see a header word
     while((c = arduino_get_byte(q->port))!=0xf0) {
@@ -568,9 +568,9 @@
       c = (hi>>4)&0x0f;
       //printf("Sensor %d value %d(%.2x)\n", c, val, val);
       // critical region
-      csoundLockMutex(q->lock);
+      csound->LockMutex(q->lock);
       q->values[c] = val;
-      csoundUnlockMutex(q->lock);
+      csound->UnlockMutex(q->lock);
       // end critical region
     }
     return ans;
@@ -579,7 +579,7 @@
 int32_t arduino_deinit(CSOUND *csound, ARD_START *p)
 {                               /* NOT FINISHED */
     p->q->stop = 1;
-    csoundJoinThread(p->q->thread);
+    csound->JoinThread(p->q->thread);
     p->q->thread = NULL;
     return OK;
 }
@@ -597,18 +597,18 @@
                                        Str("failed to open serial line\n"));
     q = (ARDUINO_GLOBALS*) csound->QueryGlobalVariable(csound,
                                                        "arduinoGlobals_");
-    if (q!=NULL) return csound->InitError(csound,
+    if (q!=NULL) return csound->InitError(csound, "%s",
                                     Str("arduinoStart already running\n"));
     if (UNLIKELY(csound->CreateGlobalVariable(csound, "arduinoGlobals_",
                                               sizeof(ARDUINO_GLOBALS)) != 0))
       return
-        csound->InitError(csound, Str("arduino: failed to allocate globals"));
+        csound->InitError(csound, "%s", Str("arduino: failed to allocate globals"));
     q = (ARDUINO_GLOBALS*) csound->QueryGlobalVariable(csound,
                                                        "arduinoGlobals_");
     if (q==NULL) return csound->InitError(csound, "&%s", Str("Failed to allocate\n"));
     p->q = q;
     q->csound = csound;
-    q->lock = csoundCreateMutex(0);
+    q->lock = csound->Create_Mutex(0);
     q->port = xx;
     for (n=0; n<MAXSENSORS; n++) q->values[n] = 0;
     // Start listening thread
@@ -635,9 +635,9 @@
     if (ind <0 || ind>MAXSENSORS)
       return csound->PerfError(csound, &p->h,
                                "%s", Str("out of range\n"));
-    csoundLockMutex(q->lock);
+    csound->LockMutex(q->lock);
     *p->val = (MYFLT)q->values[ind];
-    csoundUnlockMutex(q->lock);
+    csound->UnlockMutex(q->lock);
     //printf("ind %d val %d\n", ind, q->values[ind]);
     return OK;
 }


Include <assert.h>.
(_longjmp): Ensure that we have at least 4 exception-handling args.  (This code
	will need updating to make it work on x86, where only 2 exception handling
	args are available).

(Logical change 1.59)

--- src/siglongjmp.c
+++ src/siglongjmp.c
@@ -25,6 +25,7 @@

 #define UNW_LOCAL_ONLY

+#include <assert.h>
 #include <libunwind.h>
 #include <setjmp.h>
 #include <signal.h>
@@ -83,9 +84,11 @@
 	  mp = (unw_word_t *) &current_mask;
 	}

-      if (unw_set_reg (&c, UNW_REG_EH_ARG0, wp[1]) < 0
-	  || unw_set_reg (&c, UNW_REG_EH_ARG1, val) < 0
-	  || unw_set_reg (&c, UNW_REG_EH_ARG2, mp[0]) < 0
+      assert (UNW_NUM_EH_REGS >= 4);
+
+      if (unw_set_reg (&c, UNW_REG_EH + 0, wp[1]) < 0
+	  || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
+	  || unw_set_reg (&c, UNW_REG_EH + 2, mp[0]) < 0
 	  || unw_set_reg (&c, UNW_REG_IP,
 			  (unw_word_t) &_UI_siglongjmp_cont))
 	abort ();
@@ -94,7 +97,7 @@
 	{
 	  if (_NSIG > 16 * sizeof (unw_word_t))
 	    abort ();
-	  if (unw_set_reg (&c, UNW_REG_EH_ARG3, mp[1]) < 0)
+	  if (unw_set_reg (&c, UNW_REG_EH + 3, mp[1]) < 0)
 	    abort ();
 	}


[PDM] reverted to old overcurrent detect function until mcp23s17 api is working

--- PDM_Node.X/PDM.c
+++ PDM_Node.X/PDM.c
@@ -517,20 +517,20 @@
 void check_load_overcurrent(void) {
   if (millis - overcrt_chk_tmr >= OVERCRT_CHK_INTV) {
     uint8_t load_idx;
-    uint16_t load_status = mcp23s17_read_all(gpio_connection);
     for (load_idx = 0; load_idx < NUM_CTL; load_idx++) {
-      uint8_t load_on = load_status & (0x1 << GPIO_CHN[load_idx]);
       switch (overcurrent_flag[load_idx]) {

         case NO_OVERCRT:
-          if (load_enabled(load_idx) && !load_on) {
+          if (load_enabled(load_idx) &&
+              load_current[load_idx] < OVERCRT_DETECT) {
             overcurrent_flag[load_idx] = OVERCRT;
             overcurrent_tmr[load_idx] = millis;
           }
           break;

         case OVERCRT:
-          if (load_enabled(load_idx) && !load_on) {
+          if (load_enabled(load_idx) &&
+              load_current[load_idx] < OVERCRT_DETECT) {
             if (millis - overcurrent_tmr[load_idx] >= OVERCRT_RESET_WAIT) {
               disable_load(load_idx);
               overcurrent_flag[load_idx] = OVERCRT_RESET;


skipping . and ..

skipping . and ..

--- src/sink_shell.c
+++ src/sink_shell.c
@@ -912,6 +912,9 @@

 	// List all the files in the directory with some info about them.
 	do {
+		if (ffd.cFileName[0] == '.' &&
+			(ffd.cFileName[1] == 0 || (ffd.cFileName[1] == '.' && ffd.cFileName[2] == 0)))
+			continue;
 		sink_list_push(ctx, res, sink_str_newcstr(ctx, ffd.cFileName));
 	} while (FindNextFile(find, &ffd) != 0);


o do not break after first iteration but when we found a match.
o try to read the whole cis (but not more than len bytes) instead of the
  first 256 bytes.

first one spotted by lint.  mickey@, krw@ and deraadt@ ok.

--- dev/cardbus/cardbus.c
+++ dev/cardbus/cardbus.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: cardbus.c,v 1.31 2005/09/26 22:43:18 deraadt Exp $	*/
+/*	$OpenBSD: cardbus.c,v 1.32 2005/12/07 12:42:16 fgsch Exp $	*/
 /*	$NetBSD: cardbus.c,v 1.24 2000/04/02 19:11:37 mycroft Exp $	*/

 /*
@@ -235,10 +235,10 @@
 				    CARDBUS_CIS_ASI_ROM_IMAGE(cis_ptr)) {
 					bus_space_read_region_1(p->romt,
 					    p->romh, CARDBUS_CIS_ADDR(cis_ptr),
-					    tuples, 256);
+					    tuples, MIN(p->image_size, len));
 					found++;
+					break;
 				}
-				break;
 			}

 		out:


Bug #21056  ndb pushdown equal/setValue error on datetime: thread safe bitmap not needed

--- sql/ha_ndbcluster.h
+++ sql/ha_ndbcluster.h
@@ -365,9 +365,9 @@
     skip(0), collation(NULL), rewrite_stack(NULL)
   {
     // Allocate type checking bitmaps
-    bitmap_init(&expect_mask, 0, 512, TRUE);
-    bitmap_init(&expect_field_type_mask, 0, 512, TRUE);
-    bitmap_init(&expect_field_result_mask, 0, 512, TRUE);
+    bitmap_init(&expect_mask, 0, 512, FALSE);
+    bitmap_init(&expect_field_type_mask, 0, 512, FALSE);
+    bitmap_init(&expect_field_result_mask, 0, 512, FALSE);

     if (stack)
       cond_ptr= stack->ndb_cond;


501 - Fix for static analysis warning fix

Change-Id: I9f0ee4f0b9e5c5c5d8ff4625b66b8d52eb5a484c
Reviewed-on: http://10.236.89.5:8080/3130
Scrum-Card: Henrik Roslund <e8caef7a9dd093a023b212715d73af6d746b7206@Mecel.se>
Reviewed-by: Henrik Roslund <e8caef7a9dd093a023b212715d73af6d746b7206@Mecel.se>
Tested-by: Henrik Roslund <e8caef7a9dd093a023b212715d73af6d746b7206@Mecel.se>

--- src-IL/src/il_rle.c
+++ src-IL/src/il_rle.c
@@ -10,6 +10,7 @@

 #include "il_internal.h"
 #include "il_rle.h"
+#include <stdint.h>

 ILboolean ilRleCompressLine(ILubyte *p, ILuint n, ILubyte bpp,
 			ILubyte *q, ILuint *DestWidth, ILenum CompressMode) {


Factor out deadlock and action detection message

--- src/spec-reach.c
+++ src/spec-reach.c
@@ -525,10 +525,6 @@
 		vset_reorder(domain);
 	}
 	Warning(info,"Exploration took %ld group checks and %ld next state calls",eg_count,next_count);
-	if (dlk_detect)
-	  Warning(info,"No deadlocks found");
-	if (act_detect)
-	  Warning(info,"Action %s not found", act_detect);
 }

 void reach_bfs2(){
@@ -582,10 +578,6 @@
 		vset_reorder(domain);
 	}
 	Warning(info,"Exploration took %ld group checks and %ld next state calls",eg_count,next_count);
-	if (dlk_detect)
-	  Warning(info,"No deadlocks found");
-	if (act_detect)
-	  Warning(info,"Action %s not found", act_detect);
 }

 /**
@@ -835,10 +827,6 @@
 		vset_reorder(domain);
 	}
 	Warning(info,"Exploration took %ld group checks and %ld next state calls",eg_count,next_count);
-	if (dlk_detect)
-	  Warning(info,"No deadlocks found");
-	if (act_detect)
-	  Warning(info,"Action %s not found", act_detect);
 }

 static FILE* table_file;
@@ -1068,6 +1056,10 @@
 		reach_sat3();
 		break;
 	}
+	if (dlk_detect)
+	  Warning(info,"No deadlocks found");
+	if (act_detect)
+	  Warning(info,"Action %s not found", act_detect);
 	SCCstopTimer(timer);
 	SCCreportTimer(timer,"reachability took");
 	final_stat_reporting(visited);


add taxon rank to observation model (explore)

--- INaturalistIOS/ExploreObservation.h
+++ INaturalistIOS/ExploreObservation.h
@@ -19,6 +19,7 @@
 @property (nonatomic, copy) NSString *iconicTaxonName;
 @property (nonatomic, copy) NSString *taxonName;
 @property (nonatomic, assign) NSInteger taxonId;
+@property (nonatomic, copy) NSString *taxonRank;
 @property (nonatomic, copy) NSString *commonName;
 @property (nonatomic, copy) NSString *observerName;
 @property (nonatomic, assign) NSInteger observerId;


Omit vset_minus when saving levels.

Omit vset_minus when saving levels.

This is faster and uses less memory.

Signed-off-by: Michael Weber <5059b5df59e67be29faa89536427a574a4318434@cs.utwente.nl>

--- src/spec-reach.c
+++ src/spec-reach.c
@@ -412,7 +412,7 @@
 	      for(int i=level;i<max_levels;i++)
 		levels[i] = vset_create(domain,0,NULL);
 	    }
-	    vset_copy(levels[level],current_level);
+	    vset_copy(levels[level],visited);
 	  }
 	        stats_and_progress_report(current_level,visited,level);
 		level++;
@@ -470,7 +470,6 @@
 		levels[i] = vset_create(domain,0,NULL);
 	    }
 	    vset_copy(levels[level],visited);
-	    if (level != 0) vset_minus(levels[level],levels[level - 1]);
 	  }
 		vset_copy(old_vis,visited);
 		stats_and_progress_report(NULL,visited,level);
@@ -529,7 +528,6 @@
 		levels[i] = vset_create(domain,0,NULL);
 	    }
 	    vset_copy(levels[level],visited);
-	    if (level != 0) vset_minus(levels[level],levels[level - 1]);
 	  }
 		vset_copy(old_vis,visited);
 		stats_and_progress_report(NULL,visited,level);


util: fix off-by-one array access

util: fix off-by-one array access

Thanks to ASAN, I found this off-by-one memory access in the unix2dos
code:

/util/unix2dos: =================================================================
==23589==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000dd2f at pc 0x00000040428e bp 0x7ffd6fc31b90 sp 0x7ffd6fc31b80
READ of size 1 at 0x60200000dd2f thread T0
    #0 0x40428d in spice_convert_newlines /home/elmarco/src/spice/spice-gtk/src/spice-util.c:355
    #1 0x40443a in spice_unix2dos /home/elmarco/src/spice/spice-gtk/src/spice-util.c:382
    #2 0x401eae in test_unix2dos /home/elmarco/src/spice/spice-gtk/tests/util.c:69
    #3 0x7fb8bcd81983  (/lib64/libglib-2.0.so.0+0x6e983)
    #4 0x7fb8bcd81b4e  (/lib64/libglib-2.0.so.0+0x6eb4e)
    #5 0x7fb8bcd81d5d in g_test_run_suite (/lib64/libglib-2.0.so.0+0x6ed5d)
    #6 0x7fb8bcd81d80 in g_test_run (/lib64/libglib-2.0.so.0+0x6ed80)
    #7 0x402cce in main /home/elmarco/src/spice/spice-gtk/tests/util.c:207
    #8 0x7fb8bc755730 in __libc_start_main (/lib64/libc.so.6+0x20730)
    #9 0x401818 in _start (/home/elmarco/src/spice/spice-gtk/tests/util+0x401818)

0x60200000dd2f is located 1 bytes to the left of 4-byte region [0x60200000dd30,0x60200000dd34)
allocated by thread T0 here:
    #0 0x7fb8c10421d0 in realloc (/lib64/libasan.so.3+0xc71d0)
    #1 0x7fb8bcd61f1f in g_realloc (/lib64/libglib-2.0.so.0+0x4ef1f)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/elmarco/src/spice/spice-gtk/src/spice-util.c:355 in spice_convert_newlines

Signed-off-by: Marc-André Lureau <a6f2b960a4aca61381fc650a67901b2ac8e83e6d@redhat.com>

--- src/spice-util.c
+++ src/spice-util.c
@@ -352,7 +352,7 @@
         if (nl) {
             /* let's not double \r if it's already in the line */
             if (to == NEWLINE_TYPE_CR_LF &&
-                output->str[output->len - 1] != '\r')
+                (output->len == 0 || output->str[output->len - 1] != '\r'))
                 g_string_append_c(output, '\r');

             g_string_append_c(output, '\n');


Deprecated: Fix GCC13 build by including cstdint

--- src/Deprecated.h
+++ src/Deprecated.h
@@ -27,6 +27,7 @@
  * or old migration code
  */

+#include <cstdint>
 #include <string>

 namespace medialibrary


fixed time unit error in clock_gettime.

fixed time unit error in clock_gettime.

--- components/libc/pthreads/clock_time.c
+++ components/libc/pthreads/clock_time.c
@@ -112,7 +112,7 @@
     tick = rt_tick_get();

     tp->tv_sec = _timevalue.tv_sec + tick / RT_TICK_PER_SECOND;
-    tp->tv_nsec = (_timevalue.tv_usec + (tick % RT_TICK_PER_SECOND) * NANOSECOND_PER_TICK) * 1000;
+    tp->tv_nsec = (_timevalue.tv_usec + (tick % RT_TICK_PER_SECOND) * MICROSECOND_PER_TICK) * 1000;

     return 0;
 }


Fixed build error from last commit

Fixed build error from last commit

--- myoddtest/testcommon.h
+++ myoddtest/testcommon.h
@@ -10,6 +10,10 @@

 #include <chrono>
 #include <random>
+
+#ifndef UNUSED_ALWAYS
+# define UNUSED_ALWAYS(x) x
+#endif

 #undef max
 #undef min
@@ -24,7 +28,7 @@
 _CrtMemState stateNow, stateDiff;\
 _CrtMemCheckpoint(&stateNow);\
 int diffResult = _CrtMemDifference(&stateDiff, &memState_, &stateNow);\
-UNUSED_ALWAYS(stateNow)\
+UNUSED_ALWAYS(stateNow);\
 if (diffResult)\
 {\
   FAIL() << "Memory leak of " << stateDiff.lSizes[1] << " byte(s) detected.";\
@@ -41,7 +45,7 @@
     _CrtMemState stateNow, stateDiff;\
     _CrtMemCheckpoint(&stateNow);\
     int diffResult = _CrtMemDifference(&stateDiff, &memState_, &stateNow);\
-    UNUSED_ALWAYS(stateNow)\
+    UNUSED_ALWAYS(stateNow);\
     if (diffResult)\
     {\
       ADD_FAILURE() << "Memory leak of " << stateDiff.lSizes[1] << " byte(s) detected.";\


Remove extra forward slash in GPIO paths

Currently, there is a double slash between SYSFS_GPIO_PATH and
SYSFS_GPIO_ALIAS_PATH.

Now, removed the extra slash.

Resolves: LE-15852
Change-Id: Ib858cc8d19100b85af097448f64df4d64db93a48

--- components/sysfsGpio/gpioSysfsUtils.c
+++ components/sysfsGpio/gpioSysfsUtils.c
@@ -121,14 +121,14 @@
     FILE *fp = NULL;

     // First check if the GPIO has already been exported
-    snprintf(path, sizeof(path), "%s/%s%s", SYSFS_GPIO_PATH, GpioAliasesPath, gpioRef->gpioName);
+    snprintf(path, sizeof(path), "%s%s%s", SYSFS_GPIO_PATH, GpioAliasesPath, gpioRef->gpioName);
     if (CheckGpioPathExist(path))
     {
         return LE_OK;
     }

     // Write the GPIO number to the export file
-    snprintf(export, sizeof(export), "%s/%s%s", SYSFS_GPIO_PATH, GpioAliasPrefix, "export");
+    snprintf(export, sizeof(export), "%s%s%s", SYSFS_GPIO_PATH, GpioAliasPrefix, "export");
     snprintf(gpioStr, sizeof(gpioStr), "%d", gpioRef->pinNum);
     do
     {
@@ -316,7 +316,7 @@
         return LE_BAD_PARAMETER;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
                           gpioRef->gpioName, "value");
     snprintf(attr, sizeof(attr), "%d", level);
     LE_DEBUG("path:%s, attr:%s", path, attr);
@@ -353,7 +353,7 @@
         return LE_BAD_PARAMETER;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "edge");

     switch(edge)
@@ -411,7 +411,7 @@
         return LE_OK;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
             gpioRef->gpioName, "direction");
     attr = (mode == SYSFS_PIN_MODE_OUTPUT) ? "out": "in";
     LE_DEBUG("path:%s, attribute:%s", path, attr);
@@ -447,7 +447,7 @@
         return LE_NOT_IMPLEMENTED;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "pull");
     attr = (pud == SYSFS_PULLUPDOWN_TYPE_DOWN) ? "down": "up";
     LE_DEBUG("path:%s, attr:%s", path, attr);
@@ -588,7 +588,7 @@
         return LE_BAD_PARAMETER;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "active_low");
     snprintf(attr, sizeof(attr), "%d", level);
     LE_DEBUG("path:%s, attr:%s", path, attr);
@@ -650,7 +650,7 @@
     gpioRef->callbackContextPtr = contextPtr;

     // Start monitoring the fd for the correct GPIO
-    snprintf(monFile, sizeof(monFile), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(monFile, sizeof(monFile), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "value");

     do
@@ -754,7 +754,7 @@
         return -1;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "value");
     leResult = ReadSysGpioSignalAttr(path, sizeof(result), result);
     if (leResult != LE_OK)
@@ -866,7 +866,7 @@
         return false;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "direction");
     leResult = ReadSysGpioSignalAttr(path, sizeof(result), result);
     if (leResult != LE_OK)
@@ -916,7 +916,7 @@
         return -1;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "pull");
     leResult = ReadSysGpioSignalAttr(path, sizeof(result), result);
     if (leResult != LE_OK)
@@ -965,7 +965,7 @@
         return -1;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "active_low");
     leResult = ReadSysGpioSignalAttr(path, sizeof(result), result);
     if (leResult != LE_OK)
@@ -1014,7 +1014,7 @@
         return SYSFS_EDGE_SENSE_NONE;
     }

-    snprintf(path, sizeof(path), "%s/%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
+    snprintf(path, sizeof(path), "%s%s%s/%s", SYSFS_GPIO_PATH, GpioAliasesPath,
              gpioRef->gpioName, "edge");
     leResult = ReadSysGpioSignalAttr(path, sizeof(result), result);
     if (leResult != LE_OK)
@@ -1303,7 +1303,7 @@
     char path[128];

     *gpioDesignPtr = GpioDesign;
-    snprintf(path, sizeof(path), "%s/%s%s", SYSFS_GPIO_PATH, SYSFS_GPIO_ALIAS_PREFIX, "export");
+    snprintf(path, sizeof(path), "%s%s%s", SYSFS_GPIO_PATH, SYSFS_GPIO_ALIAS_PREFIX, "export");
     if (access(path, W_OK) == 0)
     {
         LE_INFO("GPIO design V2");


Include dependent headers in stakeinput.h

--- src/stakeinput.h
+++ src/stakeinput.h
@@ -4,6 +4,10 @@

 #ifndef PIVX_STAKEINPUT_H
 #define PIVX_STAKEINPUT_H
+
+#include "chain.h"
+#include "streams.h"
+#include "uint256.h"

 class CKeyStore;
 class CWallet;


use proper exception handling mechanism in stead of abusing embed API

now platform strings work with exception handlers in place

--- src/string/api.c
+++ src/string/api.c
@@ -715,21 +715,20 @@
         return STRINGNULL;
     else {
         STRING *retv;
-        Parrot_jump_buff *prev_jmp = interp->api_jmp_buf;
-        Parrot_jump_buff jmp;
-        interp->api_jmp_buf        = &jmp;
-
-        if (setjmp(jmp)) {
+        Parrot_runloop jmp;
+
+        if (setjmp(jmp.resume)) {
             /* catch */
-            interp->api_jmp_buf = prev_jmp;
+            Parrot_cx_delete_handler_local(interp, STRINGNULL);
             retv =  Parrot_str_new_init(interp, c, strlen(c),
                                         Parrot_binary_encoding_ptr, 0);
         }
         else {
             /* try */
+            Parrot_ex_add_c_handler(interp, &jmp);
             retv = Parrot_str_new_init(interp, c, Parrot_str_platform_strlen(interp, c),
                                         Parrot_platform_encoding_ptr, 0);
-            interp->api_jmp_buf = prev_jmp;
+            Parrot_cx_delete_handler_local(interp, STRINGNULL);
         }

         return retv;


Destroy selectors

Destroy selectors

svn path=/trunk/libcss/; revision=6268

--- src/stylesheet.c
+++ src/stylesheet.c
@@ -418,12 +418,24 @@
 css_error css_stylesheet_selector_destroy(css_stylesheet *sheet,
 		css_selector *selector)
 {
-	UNUSED(sheet);
-	UNUSED(selector);
-
-	/** \todo Need to ensure that selector is removed from whatever it's
-	 * attached to (be that the parent selector, parent rule, or the
-	 * hashtable of selectors (or any combination of these) */
+	css_selector *c, *d;
+
+	if (sheet == NULL || selector == NULL)
+		return CSS_BADPARM;
+
+	/* Must not be attached to a rule */
+	if (selector->rule != NULL)
+		return CSS_INVALID;
+
+	/* Destroy combinator chain */
+	for (c = selector->combinator; c != NULL; c = d) {
+		d = c->combinator;
+
+		sheet->alloc(c, 0, sheet->pw);
+	}
+
+	/* Destroy this selector */
+	sheet->alloc(selector, 0, sheet->pw);

 	return CSS_OK;
 }


Silence MSVC arithmetic warnings

Silence MSVC arithmetic warnings

--- src/symtseries.c
+++ src/symtseries.c
@@ -12,6 +12,13 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
+
+#ifdef _MSC_VER
+#pragma warning( push )
+// To silence the +INFINITY warning
+#pragma warning( disable : 4056 )
+#pragma warning( disable : 4756 )
+#endif

 /* Breakpoints used in iSAX symbol estimation */
 static const double breaks[STS_MAX_CARDINALITY - 1][STS_MAX_CARDINALITY + 1] =
@@ -671,4 +678,8 @@
     return result != 0;
 }

+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+
 #endif // STS_COMPILE_UNIT_TESTS


add comments

add comments

--- src/tables/CFF.h
+++ src/tables/CFF.h
@@ -4,6 +4,10 @@
 #include "glyf.h"
 #include <font/caryll-sfnt.h>
 #include <support/util.h>
+
+// The result of parsing CFF table contains both CFF metadata and glyph outline.
+// To simplify code and storage, the glyph outlines are stored inside glyf table.
+// and the CFF table contains CFF metadata only.

 typedef struct {
 	float a;
@@ -79,8 +83,9 @@
 	table_CFF *fdArray;
 };

+// CFF and glyf
 typedef struct {
-	table_CFF *cffMeta;
+	table_CFF *meta;
 	table_glyf *glyphs;
 } caryll_cff_parse_result;


Added define for MULTIPLEMONTHCAL_CLASS

Added define for MULTIPLEMONTHCAL_CLASS

--- ImprovedControls/multiplemonthcal.h
+++ ImprovedControls/multiplemonthcal.h
@@ -44,4 +44,13 @@
 VOID   MONTHCAL_Register(VOID);
 VOID   MONTHCAL_Unregister(VOID);

+#define MULTIPLEMONTHCAL_CLASSA          "MultipleMonthCal32"
+#define MULTIPLEMONTHCAL_CLASSW          L"MultipleMonthCal32"
+
+#ifdef UNICODE
+#define MULTIPLEMONTHCAL_CLASS           MULTIPLEMONTHCAL_CLASSW
+#else
+#define MULTIPLEMONTHCAL_CLASS           MULTIPLEMONTHCAL_CLASSA
+#endif
+
 #endif  /* __IMPROVED_MONTHCAL_H */


Support for vertex weights (not tested).

--- PartitionMetis.h
+++ PartitionMetis.h
@@ -61,7 +61,7 @@
 	 *  will contain the partition for each cells
 	 * @param imbalance The allowed imbalance
 	 */
-	void partition(int* partition, double imbalance = 1.05)
+	void partition(int* partition, int const* vertexWeights = nullptr, double imbalance = 1.05)
 	{
 		int rank, procs;
 		MPI_Comm_rank(m_comm, &rank);
@@ -89,8 +89,16 @@
 			}
 		}
 		eptr[m_numCells] = m_numCells * internal::Topology<Topo>::cellvertices();
+
+    idx_t wgtflag = 0;
+    idx t* elmwgt = nullptr;
+    if (vertexWeights != nullptr) {
+      elmwgt = new idx_t[m_numCells];
+      for (unsigned int i = 0; i < m_numCells; i++) {
+        elmwgt[i] = static_cast<idx_t>(vertexWeights[i]);
+      }
+    }

-		idx_t wgtflag = 0;
 		idx_t numflag = 0;
 		idx_t ncon = 1;
 		idx_t ncommonnodes = 3; // TODO adapt for hex
@@ -106,7 +114,7 @@

 		idx_t* part = new idx_t[m_numCells];

-		ParMETIS_V3_PartMeshKway(elemdist, eptr, eind, 0L, &wgtflag, &numflag,
+		ParMETIS_V3_PartMeshKway(elemdist, eptr, eind, elmwgt, &wgtflag, &numflag,
 			&ncon, &ncommonnodes, &nparts, tpwgts, &ubvec, options, &edgecut, part, &m_comm);

 		delete [] elemdist;
@@ -130,4 +138,4 @@

 }

-#endif // PUML_PARTITIONMETHIS_H+#endif // PUML_PARTITIONMETHIS_H


Actually pass in the boolean value to the TPM. (Kylie patch)

--- src/tcs/tcspbg.c
+++ src/tcs/tcspbg.c
@@ -2733,6 +2733,7 @@
 			TCPA_PHYSICAL_PRESENCE fPhysicalPresence /* in */
     )
 {
+	UINT16 offset;
 	UINT32 paramSize;
 	TSS_RESULT result = TSS_E_NOTIMPL;
 	BYTE txBlob[TPM_TXBLOB_SIZE];
@@ -2749,7 +2750,9 @@
 	if ((result = ctx_verify_context(hContext)))
 		return result;

-	LoadBlob_Header(TPM_TAG_RQU_COMMAND, 0x0A,
+	offset = 10;
+	LoadBlob_UINT16(&offset, fPhysicalPresence, txBlob, NULL);
+	LoadBlob_Header(TPM_TAG_RQU_COMMAND, offset,
 			TPM_ORD_PhysicalPresence, txBlob);

 	if ((result = req_mgr_submit_req(txBlob)))


pkt-gen: allow -Z and -z to be used together

--- apps/pkt-gen/pkt-gen.c
+++ apps/pkt-gen/pkt-gen.c
@@ -784,19 +784,19 @@
 		}
 		naddr = g->src_ip.ipv4.start;
 		ip->ip_src.s_addr = htonl(naddr);
-
-		/* update checksums if needed */
-		if (oaddr != naddr) {
-			ip_sum = cksum_add(ip_sum, ~oaddr >> 16);
-			ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff);
-			ip_sum = cksum_add(ip_sum, naddr >> 16);
-			ip_sum = cksum_add(ip_sum, naddr & 0xffff);
-		}
-		if (oport != nport) {
-			udp_sum = cksum_add(udp_sum, ~oport);
-			udp_sum = cksum_add(udp_sum, nport);
-		}
-
+	} while (0);
+	/* update checksums if needed */
+	if (oaddr != naddr) {
+		ip_sum = cksum_add(ip_sum, ~oaddr >> 16);
+		ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff);
+		ip_sum = cksum_add(ip_sum, naddr >> 16);
+		ip_sum = cksum_add(ip_sum, naddr & 0xffff);
+	}
+	if (oport != nport) {
+		udp_sum = cksum_add(udp_sum, ~oport);
+		udp_sum = cksum_add(udp_sum, nport);
+	}
+	do {
 		naddr = oaddr = ntohl(ip->ip_dst.s_addr);
 		nport = oport = ntohs(udp->uh_dport);
 		if (g->options & OPT_RANDOM_DST) {
@@ -881,14 +881,14 @@
 		}
 		naddr = ntohs(g->src_ip.ipv6.start.s6_addr16[group]);
 		ip6->ip6_src.s6_addr16[group] = htons(naddr);
-
-		/* update checksums if needed */
-		if (oaddr != naddr)
-			udp_sum = cksum_add(~oaddr, naddr);
-		if (oport != nport)
-			udp_sum = cksum_add(udp_sum,
-			    cksum_add(~oport, nport));
-
+	} while (0);
+	/* update checksums if needed */
+	if (oaddr != naddr)
+		udp_sum = cksum_add(~oaddr, naddr);
+	if (oport != nport)
+		udp_sum = cksum_add(udp_sum,
+		    cksum_add(~oport, nport));
+	do {
 		group = g->dst_ip.ipv6.egroup;
 		naddr = oaddr = ntohs(ip6->ip6_dst.s6_addr16[group]);
 		nport = oport = ntohs(udp->uh_dport);


vsprintf: Turn kptr_restrict off by default

kptr_restrict has been triggering bugs in apps such as perf, and it also makes
the system less useful by default, so turn it off by default.

This is how we generally handle security features that remove functionality,
such as firewall code or SELinux - they have to be configured and activated
from user-space.

Distributions can turn kptr_restrict on again via this line in
/etc/sysctrl.conf:

kernel.kptr_restrict = 1

( Also mark the variable __read_mostly while at it, as it's typically modified
  only once per bootup, or not at all. )

Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Acked-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- lib/vsprintf.c
+++ lib/vsprintf.c
@@ -797,7 +797,7 @@
 	return string(buf, end, uuid, spec);
 }

-int kptr_restrict = 1;
+int kptr_restrict __read_mostly;

 /*
  * Show a '%p' thing.  A kernel extension is that the '%p' is followed


fix some coding style issues.

fix some coding style issues.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@2198 6f19259b-4bc3-4df7-8a09-765794883524

--- EdkModulePkg/Include/Protocol/IsaIo.h
+++ EdkModulePkg/Include/Protocol/IsaIo.h
@@ -85,7 +85,7 @@
 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (
-  IN EFI_ISA_IO_PROTOCOL  *This,
+  IN     EFI_ISA_IO_PROTOCOL          *This,
   IN     EFI_ISA_IO_PROTOCOL_WIDTH    Width,
   IN     UINT32                       Offset,
   IN     UINTN                        Count,
@@ -100,7 +100,7 @@
 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM) (
-  IN EFI_ISA_IO_PROTOCOL  *This,
+  IN     EFI_ISA_IO_PROTOCOL          *This,
   IN     EFI_ISA_IO_PROTOCOL_WIDTH    Width,
   IN     UINT32                       DestOffset,
   IN     UINT32                       SrcOffset,
@@ -110,7 +110,7 @@
 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_MAP) (
-  IN EFI_ISA_IO_PROTOCOL    *This,
+  IN     EFI_ISA_IO_PROTOCOL            *This,
   IN     EFI_ISA_IO_PROTOCOL_OPERATION  Operation,
   IN     UINT8                          ChannelNumber      OPTIONAL,
   IN     UINT32                         ChannelAttributes,
@@ -123,14 +123,14 @@
 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (
-  IN EFI_ISA_IO_PROTOCOL  *This,
+  IN  EFI_ISA_IO_PROTOCOL          *This,
   IN  VOID                         *Mapping
   );

 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER) (
-  IN EFI_ISA_IO_PROTOCOL  *This,
+  IN  EFI_ISA_IO_PROTOCOL          *This,
   IN  EFI_ALLOCATE_TYPE            Type,
   IN  EFI_MEMORY_TYPE              MemoryType,
   IN  UINTN                        Pages,
@@ -141,7 +141,7 @@
 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (
-  IN EFI_ISA_IO_PROTOCOL  *This,
+  IN  EFI_ISA_IO_PROTOCOL          *This,
   IN  UINTN                        Pages,
   IN  VOID                         *HostAddress
   );
@@ -149,7 +149,7 @@
 typedef
 EFI_STATUS
 (EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (
-  IN EFI_ISA_IO_PROTOCOL  *This
+  IN EFI_ISA_IO_PROTOCOL                  *This
   );

 //


NEON: fix ploaddup

NEON: fix ploaddup

--- Eigen/src/Core/arch/NEON/PacketMath.h
+++ Eigen/src/Core/arch/NEON/PacketMath.h
@@ -191,14 +191,14 @@
 {
   float32x2_t lo, hi;
   lo = vdup_n_f32(*from);
-  hi = vdup_n_f32(*from);
+  hi = vdup_n_f32(*(from+1));
   return vcombine_f32(lo, hi);
 }
 template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int*     from)
 {
   int32x2_t lo, hi;
   lo = vdup_n_s32(*from);
-  hi = vdup_n_s32(*from);
+  hi = vdup_n_s32(*(from+1));
   return vcombine_s32(lo, hi);
 }


testlibrbd: fix warnings

testlibrbd: fix warnings

Signed-off-by: Josh Durgin <51652c783f70f5b272ebd02f1fd20d3af7a2449f@dreamhost.com>

--- src/testlibrbd.c
+++ src/testlibrbd.c
@@ -50,7 +50,6 @@
 void test_resize_and_stat(rbd_image_t image, size_t size)
 {
   rbd_image_info_t info;
-  int r;
   assert(rbd_resize(image, size) == 0);
   assert(rbd_stat(image, &info, sizeof(info)) == 0);
   printf("image has size %llu and order %d\n", (unsigned long long) info.size, info.order);
@@ -188,7 +187,7 @@
 {
   ssize_t written;
   written = rbd_write(image, off, len, test_data);
-  printf("wrote: %d\n", written);
+  printf("wrote: %d\n", (int) written);
   assert(written == len);
 }

@@ -219,7 +218,7 @@
   assert((result = malloc(sizeof(result) * (len + 1))) != 0);

   read = rbd_read(image, off, len, result);
-  printf("read: %d\n", read);
+  printf("read: %d\n", (int) read);
   assert(read == len);
   result[len] = '\0';
   printf("read: %s\nexpected: %s\n", result, expected);


Fix Audio Release bug in Android.

Fix Audio Release bug in Android.

--- Engine/Audio/Platform/Android/Audio.c
+++ Engine/Audio/Platform/Android/Audio.c
@@ -80,7 +80,7 @@
     {
         AudioPlayer* player = AArrayList_Pop(destroyList, AudioPlayer*);

-        // removed from loopList
+        // remove from loopList
         AAudio->SetLoop(player, false);

         (*player->object)->Destroy(player->object);
@@ -366,20 +366,30 @@
 }

+static void Destroy(ArrayList(AudioPlayer*)* playerList)
+{
+    while (playerList->size > 0)
+    {
+        AudioPlayer* player = AArrayList_Pop(playerList, AudioPlayer*);
+        (*player->object)->Destroy(player->object);
+    }
+}
+
+
 static void Release()
 {
-    (*engineObject)   ->Destroy(engineObject);
-    (*outputMixObject)->Destroy(outputMixObject);
-
-    engineObject    = NULL;
-    engineEngine    = NULL;
-    outputMixObject = NULL;
+    Destroy(destroyList);
+    Destroy(loopList);
+    Destroy(testErrorList);

     AArrayList  ->Release(cacheList);
     AArrayList  ->Release(destroyList);
     AArrayList  ->Release(loopList);
     AArrayList  ->Release(testErrorList);
     AArrayStrSet->Release(filePathSet);
+
+    (*outputMixObject)->Destroy(outputMixObject);
+    (*engineObject)   ->Destroy(engineObject);
 }


Remove debugging code.

Remove debugging code.

--- libltdl/ltdl.c
+++ libltdl/ltdl.c
@@ -2063,7 +2063,6 @@
     free (result);
   result = last_error ? strdup (last_error) : 0;
   LT__SETERRORSTR (0);
-  fprintf (stderr, "%s: %s\n", __func__, result);
   return result;
 }


Added varargs code.

Added varargs code.

--- Python/compile.c
+++ Python/compile.c
@@ -1956,6 +1956,30 @@
 }

 static void
+com_arglist(c, n)
+	struct compiling *c;
+	node *n;
+{
+	int i, nargs, op;
+	REQ(n, varargslist);
+	/* varargslist: (fpdef ',')* '+' NAME | fpdef (',' fpdef)* [','] */
+	op = UNPACK_ARG;
+	nargs = (NCH(n) + 1) / 2;
+	for (i = 0; i < NCH(n); i += 2) {
+		if (TYPE(CHILD(n, i)) == PLUS) {
+			op = UNPACK_VARARG;
+			nargs = i/2;
+			break;
+		}
+	}
+	com_addoparg(c, op, nargs);
+	for (i = 0; i < 2*nargs; i += 2)
+		com_fpdef(c, CHILD(n, i));
+	if (op == UNPACK_VARARG)
+		com_addopname(c, STORE_NAME, CHILD(n, 2*nargs+1));
+}
+
+static void
 com_file_input(c, n)
 	struct compiling *c;
 	node *n;
@@ -1978,17 +2002,12 @@
 {
 	node *ch;
 	REQ(n, funcdef); /* funcdef: 'def' NAME parameters ':' suite */
-	ch = CHILD(n, 2); /* parameters: '(' [fplist] ')' */
-	ch = CHILD(ch, 1); /* ')' | fplist */
+	ch = CHILD(n, 2); /* parameters: '(' [varargslist] ')' */
+	ch = CHILD(ch, 1); /* ')' | varargslist */
 	if (TYPE(ch) == RPAR)
 		com_addoparg(c, UNPACK_ARG, 0);
-	else {
-		int i;
-		REQ(ch, fplist); /* fplist: fpdef (',' fpdef)* */
-		com_addoparg(c, UNPACK_ARG, (NCH(ch)+1)/2);
-		for (i = 0; i < NCH(ch); i += 2)
-			com_fpdef(c, CHILD(ch, i));
-	}
+	else
+		com_arglist(c, ch);
 	c->c_infunction = 1;
 	com_node(c, CHILD(n, 4));
 	c->c_infunction = 0;


Create code string with initial size of 1000 instead of 0.

--- Python/compile.c
+++ Python/compile.c
@@ -162,7 +162,7 @@
 	struct compiling *c;
 	char *filename;
 {
-	if ((c->c_code = newsizedstringobject((char *)NULL, 0)) == NULL)
+	if ((c->c_code = newsizedstringobject((char *)NULL, 1000)) == NULL)
 		goto fail_3;
 	if ((c->c_consts = newlistobject(0)) == NULL)
 		goto fail_2;


Totally get rid of silly '\E' escape.

Totally get rid of silly '\E' escape.

--- Python/compile.c
+++ Python/compile.c
@@ -489,9 +489,6 @@
 		case 'n': *p++ = '\n'; break;
 		case 'r': *p++ = '\r'; break;
 		case 'v': *p++ = '\013'; break; /* VT */
-#if 0
-		case 'E': *p++ = '\033'; break; /* ESC, not C */
-#endif
 		case 'a': *p++ = '\007'; break; /* BEL, not classic C */
 		case '0': case '1': case '2': case '3':
 		case '4': case '5': case '6': case '7':


Change temp names created by listcomps from [%d] to _[%d], so the one-liner     [k for k in dir() if k[0] != "_"] can be used to get the non-private names (used to contain "[1]").

--- Python/compile.c
+++ Python/compile.c
@@ -1309,7 +1309,7 @@
 {
 	/* listmaker: test list_for */
 	char tmpname[12];
-	sprintf(tmpname, "[%d]", ++c->c_tmpname);
+	sprintf(tmpname, "_[%d]", ++c->c_tmpname);
 	com_addoparg(c, BUILD_LIST, 0);
 	com_addbyte(c, DUP_TOP); /* leave the result on the stack */
 	com_push(c, 2);
@@ -4689,7 +4689,7 @@
 {
 	char tmpname[12];

-	sprintf(tmpname, "[%d]", ++st->st_tmpname);
+	sprintf(tmpname, "_[%d]", ++st->st_tmpname);
 	symtable_add_def(st, tmpname, DEF_LOCAL);
 	symtable_assign(st, CHILD(n, 1), 0);
 	symtable_node(st, CHILD(n, 3));


Undo part of 2.59: 't' case of convertsimple() should not use convertbuffer().

convertbuffer() uses the buffer interface's getreadbuffer(), but 't'
should use getcharbuffer().

--- Python/getargs.c
+++ Python/getargs.c
@@ -635,7 +635,6 @@
 			else { /* any buffer-like object */
 				char *buf;
 				int count = convertbuffer(arg, p, &buf);
-
 				if (count < 0)
 					return converterr(buf, arg, msgbuf);
 				*q = count;
@@ -936,7 +935,7 @@

 	case 't': { /* 8-bit character buffer, read-only access */
 		const char **p = va_arg(*p_va, const char **);
-		char *buf;
+		PyBufferProcs *pb = arg->ob_type->tp_as_buffer;
 		int count;

 		if (*format++ != '#')
@@ -944,14 +943,21 @@
 				"invalid use of 't' format character",
 				arg, msgbuf);
 		if (!PyType_HasFeature(arg->ob_type,
-				       Py_TPFLAGS_HAVE_GETCHARBUFFER))
+				       Py_TPFLAGS_HAVE_GETCHARBUFFER) ||
+		    pb == NULL || pb->bf_getcharbuffer == NULL ||
+		    pb->bf_getsegcount == NULL)
 			return converterr(
 				"string or read-only character buffer",
 				arg, msgbuf);

-		count = convertbuffer(arg, (void **)p, &buf);
+		if (pb->bf_getsegcount(arg, NULL) != 1)
+			return converterr(
+				"string or single-segment read-only buffer",
+				arg, msgbuf);
+
+		count = pb->bf_getcharbuffer(arg, 0, p);
 		if (count < 0)
-			return converterr(buf, arg, msgbuf);
+			return converterr("(unspecified)", arg, msgbuf);
 		*va_arg(*p_va, int *) = count;
 		break;
 	}


Better error message when non-dictionary received for **kwarg

--- Python/getargs.c
+++ Python/getargs.c
@@ -1023,8 +1023,13 @@

 	if (keywords) {
 		if (!PyDict_Check(keywords)) {
-			PyErr_SetString(PyExc_SystemError,
-	  "non-dictionary object received when keyword dictionary expected");
+			if (keywords == NULL)
+				PyErr_SetString(PyExc_SystemError,
+		     "NULL received when keyword dictionary expected");
+			else
+				PyErr_Format(PyExc_SystemError,
+		     "%s received when keyword dictionary expected",
+					     keywords->ob_type->tp_name);
 			return 0;
 		}
 		kwlen = PyDict_Size(keywords);


Change sort error output format

Change sort error output format

--- src/tools/sort.c
+++ src/tools/sort.c
@@ -379,13 +379,21 @@

 			PhoneFromUint(bopomofo_buf, sizeof(bopomofo_buf), word.phone);

-			fprintf(stderr, "Error in phrase `%s' ", phrase_data[num_phrase_data].phrase);
-			fprintf(stderr, "{%d", phrase_data[num_phrase_data].phone[0]);
+			fprintf(stderr, "Error in phrase `%s'. Word `%s' has no phone %d (%s).", phrase_data[num_phrase_data].phrase ,word.word, word.phone, bopomofo_buf);
+			fprintf(stderr, " // { \"");
+			for (j = 0; j < strlen(phrase_data[num_phrase_data].phrase); ++j) {
+				fprintf(stderr, "\\x%02X", (unsigned char)phrase_data[num_phrase_data].phrase[j]);
+			}
+			fprintf(stderr, "\" /* %s */ , 0, { %d", phrase_data[num_phrase_data].phrase, phrase_data[num_phrase_data].phone[0]);
 			for (j = 1; j < phrase_len; ++j) {
 				fprintf(stderr, ", %d", phrase_data[num_phrase_data].phone[j]);
 			}
-			fprintf(stderr, "}. ");
-			fprintf(stderr, "Word `%s' has no phone %d (%s).\n", word.word, word.phone, bopomofo_buf);
+			fprintf(stderr, " } /* ");
+			for (j = 0; j < phrase_len; ++j) {
+				PhoneFromUint(bopomofo_buf, sizeof(bopomofo_buf), phrase_data[num_phrase_data].phone[j]);
+				fprintf(stderr, "%s ", bopomofo_buf);
+			}
+			fprintf(stderr, "*/ },\n");
 			/* FIXME: shall exit(-1) when tsi.src is fixed */
 			//exit(-1);
 		}


Fix TrackPoint detection.

Fix TrackPoint detection.

--- src/trackpoint.c
+++ src/trackpoint.c
@@ -121,7 +121,7 @@
     while (i < n) {
         char name_path[4096];
         snprintf(name_path, sizeof(path),
-                 "%s/%s/name", path, filelist[n]->d_name);
+                 "%s/%s/name", path, filelist[i]->d_name);
         if (is_equal_device_name(local, name_path)) {
             ret = TRUE;
             break;


Fix warning in tree

Fix warning in tree

--- src/treedbs-ll.c
+++ src/treedbs-ll.c
@@ -410,13 +410,13 @@

 static void
 create_nodes (node_table_t *nodes, size_t log_size, size_t sat_bits, int alloc,
-              int error)
+              int error_num)
 {
     nodes->size = 1ULL << log_size;
     nodes->log_size = log_size;
     nodes->thres = nodes->size / 64;
     nodes->mask = nodes->size - 1;
-    nodes->error_num = error;
+    nodes->error_num = error_num;
     nodes->sat_bits = sat_bits;
     nodes->sat_mask = 0;
     nodes->sat_right = 32 - (sat_bits + 1) / 2;


crush: fix memory leak when destroying tree buckets

Reflects ceph.git commit 46d63d98434b3bc9dad2fc9ab23cbaedc3bcb0e4.

Reported-by: Alexander Lyakas <dd9708ec40e6f738e4ae235182bdaf2321900767@gmail.com>
Reviewed-by: Alex Elder <f429030cf5c0faf36fac3d102073b6e63a647baa@inktank.com>
Signed-off-by: Sage Weil <6dd34506bbd5e58221bbb3e4732d97c91f02277b@inktank.com>

--- net/ceph/crush/crush.c
+++ net/ceph/crush/crush.c
@@ -62,6 +62,8 @@

 void crush_destroy_bucket_tree(struct crush_bucket_tree *b)
 {
+	kfree(b->h.perm);
+	kfree(b->h.items);
 	kfree(b->node_weights);
 	kfree(b);
 }


s390/pci: unify pci_iomap symbol exports

Since commit 8cfc99b58366 ("s390: add pci_iomap_range") we use
EXPORT_SYMBOL for pci_iomap but EXPORT_SYMBOL_GPL for pci_iounmap.
Change the related functions to use EXPORT_SYMBOL like the asm-generic
variants do.

Signed-off-by: Sebastian Ott <34be3ca399e9e73d80098c083a5b58614c3ca6da@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>

--- arch/s390/pci/pci.c
+++ arch/s390/pci/pci.c
@@ -287,7 +287,7 @@
 	addr = ZPCI_IOMAP_ADDR_BASE | ((u64) idx << 48);
 	return (void __iomem *) addr + offset;
 }
-EXPORT_SYMBOL_GPL(pci_iomap_range);
+EXPORT_SYMBOL(pci_iomap_range);

 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 {
@@ -309,7 +309,7 @@
 	}
 	spin_unlock(&zpci_iomap_lock);
 }
-EXPORT_SYMBOL_GPL(pci_iounmap);
+EXPORT_SYMBOL(pci_iounmap);

 static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
 		    int size, u32 *val)


ipv4: dont drop packet in defrag but consume it

When defragmentation is finalized, we clone a packet and kfree_skb() it.

Call consume_skb() to not confuse dropwatch, since its not a drop.

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

--- net/ipv4/ip_fragment.c
+++ net/ipv4/ip_fragment.c
@@ -569,7 +569,7 @@
 		skb_morph(head, qp->q.fragments);
 		head->next = qp->q.fragments->next;

-		kfree_skb(qp->q.fragments);
+		consume_skb(qp->q.fragments);
 		qp->q.fragments = head;
 	}


sh: Fixup ndelay() xloops calculation for alternate HZ.

Currently the xloops calculation in ndelay() gets set to 0 when
calculated with HZ=250, fix up how we do the HZ factoring in order
to get this right for differing values.

Signed-off-by: kogiidena <047a4de6377e684adef3064ea9bc5b5bf7dd7aa7@eggplant.ddo.jp>
Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>

--- arch/sh/lib/delay.c
+++ arch/sh/lib/delay.c
@@ -24,9 +24,10 @@
 	__asm__("dmulu.l	%0, %2\n\t"
 		"sts	mach, %0"
 		: "=r" (xloops)
-		: "0" (xloops), "r" (cpu_data[raw_smp_processor_id()].loops_per_jiffy)
+		: "0" (xloops),
+		  "r" (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy)
 		: "macl", "mach");
-	__delay(xloops * HZ);
+	__delay(xloops);
 }

 void __udelay(unsigned long usecs)


packet: remove unnecessary break after return

Signed-off-by: Fabian Frederick <3efd2a027b14fd890cd23a9ef6d1134b4e5ad850@skynet.be>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/packet/af_packet.c
+++ net/packet/af_packet.c
@@ -3071,10 +3071,8 @@
 		break;
 	case PACKET_MR_PROMISC:
 		return dev_set_promiscuity(dev, what);
-		break;
 	case PACKET_MR_ALLMULTI:
 		return dev_set_allmulti(dev, what);
-		break;
 	case PACKET_MR_UNICAST:
 		if (i->alen != dev->addr_len)
 			return -EINVAL;


First stab att siginfo handling, needs more work. KNF.

--- arch/vax/vax/trap.c
+++ arch/vax/vax/trap.c
@@ -1,3 +1,4 @@
+/*      $OpenBSD: trap.c,v 1.7 1997/05/28 23:29:43 niklas Exp $     */
 /*      $NetBSD: trap.c,v 1.24 1996/11/06 20:19:55 cgd Exp $     */

 /*
@@ -130,20 +131,22 @@
 arithflt(frame)
 	struct trapframe *frame;
 {
-	u_int	sig, type=frame->trap,trapsig=1,s;
+	u_int	sig, type = frame->trap, trapsig=1, s;
 	u_int	rv, addr;
-	struct	proc *p=curproc;
+	struct	proc *p = curproc;
 	struct	pmap *pm;
 	vm_map_t map;
 	vm_prot_t ftype;
 	extern vm_map_t	pte_map;
-
-	if((frame->psl & PSL_U) == PSL_U) {
+	int	typ;
+	caddr_t	v;
+
+	if ((frame->psl & PSL_U) == PSL_U) {
 		type|=T_USER;
 		p->p_addr->u_pcb.framep = frame;
 	}

-	type&=~(T_WRITE|T_PTEFETCH);
+	type &= ~(T_WRITE|T_PTEFETCH);

 #ifdef TRAPDEBUG
@@ -152,7 +155,7 @@
 		frame->trap, frame->code, frame->pc, frame->psl);
 fram:
 #endif
-	switch(type){
+	switch (type) {

 	default:
 faulter:
@@ -162,28 +165,29 @@
 		printf("Trap: type %x, code %x, pc %x, psl %x\n",
 		    frame->trap, frame->code, frame->pc, frame->psl);
 		showregs(frame);
-		panic("trap: adr %x",frame->code);
+		panic("trap: adr %x", frame->code);
 	case T_KSPNOTVAL:
 		goto faulter;

 	case T_TRANSFLT|T_USER:
 	case T_TRANSFLT: /* Translation invalid - may be simul page ref */
-		if(frame->trap&T_PTEFETCH){
+		if (frame->trap & T_PTEFETCH) {
 			u_int	*ptep, *pte, *pte1;

-			if(frame->code<0x40000000)
-				ptep=(u_int *)p->p_addr->u_pcb.P0BR;
+			if (frame->code<0x40000000)
+				ptep = (u_int *)p->p_addr->u_pcb.P0BR;
 			else
 				ptep=(u_int *)p->p_addr->u_pcb.P1BR;
-			pte1=(u_int *)trunc_page(&ptep[(frame->code
-				&0x3fffffff)>>PGSHIFT]);
-			pte=(u_int*)&Sysmap[((u_int)pte1&0x3fffffff)>>PGSHIFT];
-			if(*pte&PG_SREF){ /* Yes, simulated */
-				s=splhigh();
-
-				*pte|=PG_REF|PG_V;*pte&=~PG_SREF;pte++;
-				*pte|=PG_REF|PG_V;*pte&=~PG_SREF;
-				mtpr(0,PR_TBIA);
+			pte1 = (u_int *)trunc_page(&ptep[(frame->code &
+			     0x3fffffff)>>PGSHIFT]);
+			pte = (u_int*)&Sysmap[((u_int)pte1 & 0x3fffffff) >>
+			     PGSHIFT];
+			if (*pte & PG_SREF) { /* Yes, simulated */
+				s = splhigh();
+
+				*pte |= PG_REF|PG_V; *pte &= ~PG_SREF; pte++;
+				*pte |= PG_REF|PG_V; *pte &= ~PG_SREF;
+				mtpr(0, PR_TBIA);
 				splx(s);
 				goto uret;
 			}
@@ -191,23 +195,24 @@
 			u_int   *ptep, *pte;

 			frame->code=trunc_page(frame->code);
-			if(frame->code<0x40000000){
-				ptep=(u_int *)p->p_addr->u_pcb.P0BR;
-				pte=&ptep[(frame->code>>PGSHIFT)];
-			} else if(frame->code>0x7fffffff){
-				pte=(u_int *)&Sysmap[((u_int)frame->code&
-					0x3fffffff)>>PGSHIFT];
+			if (frame->code<0x40000000) {
+				ptep = (u_int *)p->p_addr->u_pcb.P0BR;
+				pte = &ptep[(frame->code >> PGSHIFT)];
+			} else if(frame->code > 0x7fffffff) {
+				pte = (u_int *)&Sysmap[((u_int)frame->code &
+				    0x3fffffff) >> PGSHIFT];
 			} else {
-				ptep=(u_int *)p->p_addr->u_pcb.P1BR;
-				pte=&ptep[(frame->code&0x3fffffff)>>PGSHIFT];
-			}
-			if(*pte&PG_SREF){
-				s=splhigh();
-				*pte|=PG_REF|PG_V;*pte&=~PG_SREF;pte++;
-				*pte|=PG_REF|PG_V;*pte&=~PG_SREF;
-			/*	mtpr(frame->code,PR_TBIS); */
-			/*	mtpr(frame->code+NBPG,PR_TBIS); */
-				mtpr(0,PR_TBIA);
+				ptep = (u_int *)p->p_addr->u_pcb.P1BR;
+				pte = &ptep[(frame->code & 0x3fffffff) >>
+				    PGSHIFT];
+			}
+			if (*pte & PG_SREF) {
+				s = splhigh();
+				*pte |= PG_REF|PG_V; *pte &= ~PG_SREF; pte++;
+				*pte |= PG_REF|PG_V; *pte &= ~PG_SREF;
+			/*	mtpr(frame->code, PR_TBIS); */
+			/*	mtpr(frame->code + NBPG, PR_TBIS); */
+				mtpr(0, PR_TBIA);
 				splx(s);
 				goto uret;
 			}
@@ -222,84 +227,101 @@
 		if (!p)
 			panic("trap: access fault without process");
 		pm=&p->p_vmspace->vm_pmap;
-		if(frame->trap&T_PTEFETCH){
-			u_int faultaddr,testaddr=(u_int)frame->code&0x3fffffff;
-			int P0=0,P1=0,SYS=0;
-
-			if(frame->code==testaddr) P0++;
-			else if(frame->code>0x7fffffff) SYS++;
-			else P1++;
-
-			if(P0){
-				faultaddr=(u_int)pm->pm_pcb->P0BR+
-					((testaddr>>PGSHIFT)<<2);
-			} else if(P1){
-				faultaddr=(u_int)pm->pm_pcb->P1BR+
-					((testaddr>>PGSHIFT)<<2);
-			} else panic("pageflt: PTE fault in SPT\n");
-
-			faultaddr&=~PAGE_MASK;
-			rv = vm_fault(pte_map, faultaddr,
-				VM_PROT_WRITE|VM_PROT_READ, FALSE);
+		if (frame->trap&T_PTEFETCH) {
+			u_int faultaddr;
+			u_int testaddr = (u_int)frame->code & 0x3fffffff;
+			int P0=0, P1=0, SYS=0;
+
+			if (frame->code==testaddr)
+				P0++;
+			else if (frame->code > 0x7fffffff)
+				SYS++;
+			else
+				P1++;
+
+			if (P0) {
+				faultaddr = (u_int)pm->pm_pcb->P0BR +
+				    ((testaddr >> PGSHIFT) << 2);
+			} else if (P1) {
+				faultaddr = (u_int)pm->pm_pcb->P1BR +
+				    ((testaddr >> PGSHIFT) << 2);
+			} else
+				panic("pageflt: PTE fault in SPT\n");
+
+			rv = vm_fault(pte_map, faultaddr & ~PAGE_MASK,
+			    VM_PROT_WRITE|VM_PROT_READ, FALSE);
 			if (rv != KERN_SUCCESS) {
-
-				sig=SIGSEGV;
+				typ = SEGV_MAPERR;
+				v = (caddr_t)faultaddr;
+				sig = SIGSEGV;
 				goto bad;
 			} else
 				trapsig=0;
 		}
-		addr=(frame->code& ~PAGE_MASK);
-		if((frame->pc>(unsigned)0x80000000)&&
-			(frame->code>(unsigned)0x80000000)){
-			map=kernel_map;
+		addr = (frame->code & ~PAGE_MASK);
+		if ((frame->pc > (unsigned)0x80000000) &&
+		    (frame->code > (unsigned)0x80000000)) {
+			map = kernel_map;
 		} else {
-			map= &p->p_vmspace->vm_map;
+			map = &p->p_vmspace->vm_map;
 		}
-		if(frame->trap&T_WRITE) ftype=VM_PROT_WRITE|VM_PROT_READ;
-		else ftype = VM_PROT_READ;
+		if (frame->trap & T_WRITE)
+			ftype = VM_PROT_WRITE|VM_PROT_READ;
+		else
+			ftype = VM_PROT_READ;

 		rv = vm_fault(map, addr, ftype, FALSE);
 		if (rv != KERN_SUCCESS) {
-			if(frame->pc>(u_int)0x80000000){
-				if(p->p_addr->u_pcb.iftrap){
-					frame->pc=(int)p->p_addr->u_pcb.iftrap;
+			if (frame->pc > (u_int)0x80000000) {
+				if (p->p_addr->u_pcb.iftrap) {
+					frame->pc =
+					    (int)p->p_addr->u_pcb.iftrap;
 					return;
 				}
-				printf("Segv in kernel mode: rv %d\n",rv);
+				printf("Segv in kernel mode: rv %d\n", rv);
 				goto faulter;
 			}
-			sig=SIGSEGV;
-		} else trapsig=0;
+			typ = SEGV_MAPERR;
+			v = (caddr_t)frame->code;
+			sig = SIGSEGV;
+		} else
+			trapsig=0;
 		break;

 	case T_PTELEN:
 	case T_PTELEN|T_USER:	/* Page table length exceeded */
-		pm=&p->p_vmspace->vm_pmap;
+		pm = &p->p_vmspace->vm_pmap;
 #ifdef TRAPDEBUG
 if(faultdebug)printf("trap ptelen type %x, code %x, pc %x, psl %x\n",
                         frame->trap, frame->code, frame->pc, frame->psl);
 #endif
-		if(frame->code<0x40000000){ /* P0 */
+		if (frame->code < 0x40000000) { /* P0 */
 			int i;

-			if (p->p_vmspace == 0){
+			if (p->p_vmspace == 0) {
 				printf("no vmspace in fault\n");
 				goto faulter;
 			}
 			i = p->p_vmspace->vm_tsize + p->p_vmspace->vm_dsize;
-			if (i > (frame->code >> PAGE_SHIFT)){
+			if (i > (frame->code >> PAGE_SHIFT)) {
 				pmap_expandp0(pm, i << 1);
 				trapsig = 0;
 			} else {
+				typ = SEGV_MAPERR;
+				v = (caddr_t)0xdeadbeef;	/* XXX */
 				sig = SIGSEGV;
 			}
-		} else if (frame->code > 0x7fffffff){ /* System, segv */
+		} else if (frame->code > 0x7fffffff) { /* System, segv */
+			typ = SEGV_MAPERR;
+			v = (caddr_t)0xdeadbeef;	/* XXX */
 			sig = SIGSEGV;
 		} else { /* P1 */
 			int i;

 			i = (u_int)(p->p_vmspace->vm_maxsaddr);
-			if (frame->code < i){
+			if (frame->code < i) {
+				typ = SEGV_MAPERR;
+				v = (caddr_t)0xdeadbeef;	/* XXX */
 				sig = SIGSEGV;
 			} else {
 				pmap_expandp1(pm);
@@ -310,6 +332,8 @@

 	case T_BPTFLT|T_USER:
 	case T_TRCTRAP|T_USER:
+		typ = TRAP_BRKPT;
+		v = (caddr_t)0xdeadbeef;		/* XXX */
 		sig = SIGTRAP;
 		frame->psl &= ~PSL_T;
 		break;
@@ -317,16 +341,20 @@
 	case T_PRIVINFLT|T_USER:
 	case T_RESADFLT|T_USER:
 	case T_RESOPFLT|T_USER:
-		sig=SIGILL;
+		typ = ILL_ILLOPC;
+		v = (caddr_t)0xdeadbeef;		/* XXX */
+		sig = SIGILL;
 		break;

 	case T_ARITHFLT|T_USER:
-		sig=SIGFPE;
+		typ = FPE_FLTINV;	/* XXX? */
+		v = (caddr_t)0;
+		sig = SIGFPE;
 		break;

 	case T_ASTFLT|T_USER:
-		mtpr(AST_NO,PR_ASTLVL);
-		trapsig=0;
+		mtpr(AST_NO, PR_ASTLVL);
+		trapsig = 0;
 		break;

 #ifdef DDB
@@ -337,7 +365,7 @@
 	}
 bad:
 	if (trapsig)
-		trapsignal(curproc, sig, frame->code);
+		trapsignal(curproc, sig, frame->code, typ, v);
 uret:
 	userret(curproc, frame->pc, frame->psl);
 };


SUNRPC: Use short-hand IPv6 ANYADDR for RPCB_SET

Clean up: When doing an RPCB_SET, make the kernel's rpcb client use the
shorthand "::" for the universal form of the IPv6 ANY address.

Without this patch, rpcbind will advertise:

  0000:0000:0000:0000:0000:0000:0000:0000.x.y

This is cosmetic only.  It cleans up the display of information from
/sbin/rpcinfo.

Signed-off-by: Chuck Lever <e7d8216bf9b1956703857d0050bd04192118f43d@oracle.com>
Signed-off-by: J. Bruce Fields <51738506c1b2ccb0761f23bdc612c93babf738ea@citi.umich.edu>

--- net/sunrpc/rpcb_clnt.c
+++ net/sunrpc/rpcb_clnt.c
@@ -20,6 +20,7 @@
 #include <linux/in6.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
+#include <net/ipv6.h>

 #include <linux/sunrpc/clnt.h>
 #include <linux/sunrpc/sched.h>
@@ -304,10 +305,13 @@
 	char buf[64];

 	/* Construct AF_INET6 universal address */
-	snprintf(buf, sizeof(buf),
-			NIP6_FMT".%u.%u",
-			NIP6(address_to_register->sin6_addr),
-			port >> 8, port & 0xff);
+	if (ipv6_addr_any(&address_to_register->sin6_addr))
+		snprintf(buf, sizeof(buf), "::.%u.%u",
+				port >> 8, port & 0xff);
+	else
+		snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u",
+				NIP6(address_to_register->sin6_addr),
+				port >> 8, port & 0xff);
 	map->r_addr = buf;

 	dprintk("RPC:       %sregistering [%u, %u, %s, '%s'] with "


[t:4778] upgrade subtree estimates to stat64info using real code. fix #4778

refactor existing node deserialization code so that upgrading a header can
call deserialization code on the root node and get stat64info instead of
deserializing it manually.

git-svn-id: b5c078ec0b4d3a50497e9dd3081db18a5b4f16e5@43459 c7de825b-a66e-492c-adef-691d508d4ae1

--- newbrt/brt-serialize.c
+++ newbrt/brt-serialize.c
@@ -1684,7 +1684,8 @@
 static int
 deserialize_and_upgrade_internal_node(BRTNODE node,
                                       struct rbuf *rb,
-                                      struct brtnode_fetch_extra* bfe)
+                                      struct brtnode_fetch_extra* bfe,
+                                      STAT64INFO info)
 {
     int r = 0;
     int version = node->layout_version_read_from_disk;
@@ -1700,10 +1701,17 @@
         if (version == BRT_LAST_LAYOUT_VERSION_WITH_FINGERPRINT) {
             (void) rbuf_int(rb);  // 8. fingerprint
         }
-        (void) rbuf_ulonglong(rb);  // 9. nkeys (ulonglong)
-        (void) rbuf_ulonglong(rb);  // 10. ndata (ulonglong)
-        (void) rbuf_ulonglong(rb);  // 11. dsize (ulonglong)
+        uint64_t nkeys = rbuf_ulonglong(rb);
+        uint64_t ndata = rbuf_ulonglong(rb);
+        uint64_t dsize = rbuf_ulonglong(rb);
         (void) rbuf_char(rb);       // 12. exact (char)
+        invariant(nkeys == ndata);
+        if (info) {
+            // info is non-null if we're trying to upgrade old subtree
+            // estimates to stat64info
+            info->numrows += nkeys;
+            info->numbytes += dsize;
+        }
     }

     node->childkeys = NULL;
@@ -1897,16 +1905,24 @@
 static int
 deserialize_and_upgrade_leaf_node(BRTNODE node,
                                   struct rbuf *rb,
-                                  struct brtnode_fetch_extra* bfe)
+                                  struct brtnode_fetch_extra* bfe,
+                                  STAT64INFO info)
 {
     int r = 0;
     int version = node->layout_version_read_from_disk;

     // This is a leaf node, so the offsets in the buffer will be
     // different from the internal node offsets above.
-    (void) rbuf_ulonglong(rb);  // 6. nkeys
-    (void) rbuf_ulonglong(rb);  // 7. ndata
-    (void) rbuf_ulonglong(rb);  // 8. dsize
+    uint64_t nkeys = rbuf_ulonglong(rb);  // 6. nkeys
+    uint64_t ndata = rbuf_ulonglong(rb);  // 7. ndata
+    uint64_t dsize = rbuf_ulonglong(rb);  // 8. dsize
+    invariant(nkeys == ndata);
+    if (info) {
+        // info is non-null if we're trying to upgrade old subtree
+        // estimates to stat64info
+        info->numrows += nkeys;
+        info->numbytes += dsize;
+    }

     if (version == BRT_LAYOUT_VERSION_14) {
         (void) rbuf_int(rb);  // 9. optimized_for_upgrade
@@ -2078,6 +2094,7 @@
                                 BRTNODE_DISK_DATA* ndd,
                                 BLOCKNUM blocknum,
                                 struct brtnode_fetch_extra* bfe,
+                                STAT64INFO info,
                                 int fd)
 {
     int r = 0;
@@ -2135,9 +2152,9 @@

     // Check height to determine whether this is a leaf node or not.
     if (node->height > 0) {
-        r = deserialize_and_upgrade_internal_node(node, &rb, bfe);
+        r = deserialize_and_upgrade_internal_node(node, &rb, bfe, info);
     } else {
-        r = deserialize_and_upgrade_leaf_node(node, &rb, bfe);
+        r = deserialize_and_upgrade_leaf_node(node, &rb, bfe, info);
     }

     *ndd = toku_xmalloc(node->n_children*sizeof(**ndd));
@@ -2160,6 +2177,7 @@
     BLOCKNUM blocknum,
     u_int32_t fullhash,
     struct brtnode_fetch_extra* bfe,
+    STAT64INFO info,
     struct rbuf *rb,
     int fd
     )
@@ -2192,7 +2210,7 @@
     // Check if we are reading in an older node version.
     if (version <= BRT_LAYOUT_VERSION_14) {
         // Perform the upgrade.
-        r = deserialize_and_upgrade_brtnode(node, ndd, blocknum, bfe, fd);
+        r = deserialize_and_upgrade_brtnode(node, ndd, blocknum, bfe, info, fd);
         if (r != 0) {
             goto cleanup;
         }
@@ -2407,6 +2425,32 @@
     return e;
 }

+static enum deserialize_error_code
+deserialize_brtnode_from_fd(int fd,
+                            BLOCKNUM blocknum,
+                            u_int32_t fullhash,
+                            BRTNODE *brtnode,
+                            BRTNODE_DISK_DATA *ndd,
+                            struct brtnode_fetch_extra *bfe,
+                            STAT64INFO info)
+{
+    enum deserialize_error_code e;
+    struct rbuf rb = RBUF_INITIALIZER;
+    int r = 0;
+    r = read_block_from_fd_into_rbuf(fd, blocknum, bfe->h, &rb);
+    if (r != 0) {
+        e = DS_ERRNO;
+        goto cleanup;
+    } // if we were successful, then we are done.
+
+    e = deserialize_brtnode_from_rbuf(brtnode, ndd, blocknum, fullhash, bfe, info, &rb, fd);
+    if (e != DS_OK) {
+        dump_bad_block(rb.buf,rb.size);
+    }
+cleanup:
+    toku_free(rb.buf);
+    return e;
+}

 // Read brt node from file into struct.  Perform version upgrade if necessary.
 enum deserialize_error_code
@@ -2415,7 +2459,8 @@
                                u_int32_t fullhash,
                                BRTNODE *brtnode,
                                BRTNODE_DISK_DATA* ndd,
-                               struct brtnode_fetch_extra* bfe)
+                               struct brtnode_fetch_extra* bfe
+    )
 // Effect: Read a node in.  If possible, read just the header.
 {
     toku_trace("deserial start");
@@ -2424,27 +2469,12 @@
     read_brtnode_header_from_fd_into_rbuf_if_small_enough(fd, blocknum, bfe->h, &rb);

     e = deserialize_brtnode_header_from_rbuf_if_small_enough(brtnode, ndd, blocknum, fullhash, bfe, &rb, fd);
-    if (e != DS_OK) { //<CER> ??? Change this to != DS_OK?
-        e = DS_OK;
-	toku_free(rb.buf);
-	rb = RBUF_INITIALIZER;
-
+    if (e != DS_OK) {
 	// Something went wrong, go back to doing it the old way.
-        int r = 0;
-	r = read_block_from_fd_into_rbuf(fd, blocknum, bfe->h, &rb);
-	if (r != 0) {
-            e = DS_ERRNO;
-            goto cleanup;
-        } // if we were successful, then we are done.
-
-	e = deserialize_brtnode_from_rbuf(brtnode, ndd, blocknum, fullhash, bfe, &rb, fd);
-	if (e != DS_OK) {
-	    dump_bad_block(rb.buf,rb.size);
-	}
+        e = deserialize_brtnode_from_fd(fd, blocknum, fullhash, brtnode, ndd, bfe, NULL);
     }
     toku_trace("deserial done");

-cleanup:
     toku_free(rb.buf);
     return e;
 }
@@ -2744,122 +2774,26 @@
 }

 static enum deserialize_error_code
-upgrade_subtree_estimates_to_stat64info(int UU(fd), struct brt_header *h)
+upgrade_subtree_estimates_to_stat64info(int fd, struct brt_header *h)
 {
-    int r;
-    enum deserialize_error_code e = DS_OK;
+    enum deserialize_error_code e;
     // 15 was the last version with subtree estimates
     invariant(h->layout_version_read_from_disk <= BRT_LAYOUT_VERSION_15);
-    BLOCKNUM b = h->root_blocknum;
-    struct rbuf rb_s;
-    struct rbuf *rb = &rb_s;
-    rbuf_init(rb, NULL, 0);
-    DISKOFF offset, size;
-    toku_translate_blocknum_to_offset_size(h->blocktable, b, &offset, &size);
-    {
-        u_int8_t *XMALLOC_N(size, raw_block);
-        {
-            ssize_t rlen = pread(fd, raw_block, size, offset);
-            lazy_assert((DISKOFF)rlen == size);
-        }
-        {
-            // root node must be a leaf or nonleaf node
-            u_int8_t *magic = raw_block + uncompressed_magic_offset;
-            invariant(memcmp(magic, "tokuleaf", 8) == 0 || memcmp(magic, "tokunode", 8) == 0);
-            // root node cannot have a different version from the header, if
-            // the header needs to read its subtree estimates
-            u_int8_t *version = raw_block + uncompressed_version_offset;
-            int layout_version = toku_dtoh32(*(uint32_t*)version);
-            invariant(layout_version == h->layout_version_read_from_disk);
-        }
-        {
-            int n_sub_blocks = toku_dtoh32(*(u_int32_t*)&raw_block[node_header_overhead]);
-            invariant(0 <= n_sub_blocks && n_sub_blocks <= max_sub_blocks);
-            {
-                u_int32_t header_length = node_header_overhead + sub_block_header_size(n_sub_blocks);
-                invariant(header_length <= size);
-                u_int32_t xsum = x1764_memory(raw_block, header_length);
-                u_int32_t stored_xsum = toku_dtoh32(*(u_int32_t *)(raw_block + header_length));
-                if (xsum != stored_xsum) {
-                    e = DS_XSUM_FAIL;
-                    goto exit;
-                }
-            }
-            struct sub_block sub_block[n_sub_blocks];
-            u_int32_t *sub_block_header = (u_int32_t *) &raw_block[node_header_overhead + 4];
-            size_t uncompressed_size = 0;
-            for (int i = 0; i < n_sub_blocks; ++i) {
-                sub_block_init(&sub_block[i]);
-                int64_t csize = toku_dtoh32(sub_block_header[0]);
-                int64_t usize = toku_dtoh32(sub_block_header[1]);
-                invariant(0 <= csize && csize < (1<<30));
-                invariant(0 <= usize && usize < (1<<30));
-                sub_block[i].compressed_size = csize;
-                sub_block[i].uncompressed_size = usize;
-                sub_block[i].xsum = toku_dtoh32(sub_block_header[2]);
-                uncompressed_size += sub_block[i].uncompressed_size;
-                sub_block_header += 3;
-            }
-            unsigned char *buf = toku_xmalloc(node_header_overhead + uncompressed_size);
-            resource_assert(buf);
-            rbuf_init(rb, buf, node_header_overhead + uncompressed_size);
-            memcpy(rb->buf, raw_block, node_header_overhead);
-            unsigned char *compressed_data = raw_block + node_header_overhead + sub_block_header_size(n_sub_blocks) + sizeof(u_int32_t);
-            unsigned char *uncompressed_data = rb->buf + node_header_overhead;
-            r = decompress_all_sub_blocks(n_sub_blocks, sub_block, compressed_data, uncompressed_data, num_cores, brt_pool);
-            if (r != 0) {
-                fprintf(stderr, "%s:%d block %"PRId64" failed %d at %p size %"PRId64"\n", __FUNCTION__, __LINE__, b.b, r, raw_block, size);
-                dump_bad_block(raw_block, size);
-                fprintf(stderr, "Unknown failure while reading node in file %s.\n", toku_cachefile_fname_in_env(h->cf));
-            }
-            lazy_assert_zero(r);
-            rb->ndone = 0;
-        }
-        toku_free(raw_block);
-    }
-    resource_assert(rb->buf);
-    bytevec magic;
-    rbuf_literal_bytes(rb, &magic, 8);
-    int node_version = rbuf_int(rb);
-    invariant(node_version == h->layout_version_read_from_disk);
-    (void) rbuf_int(rb); // layout_version_original
-    (void) rbuf_int(rb); // build_id
-    (void) rbuf_int(rb); // nodesize
-    (void) rbuf_int(rb); // flags
-    int height = rbuf_int(rb);
-    if (node_version <= BRT_LAST_LAYOUT_VERSION_WITH_FINGERPRINT) {
-        (void) rbuf_int(rb); // rand4fingerprint
-        (void) rbuf_int(rb); // localfingerprint
-        (void) rbuf_int(rb); // another fingerprint (according to deserialize_brtnode_nonleaf_from_rbuf in 5.0.8)
-    }
-    h->on_disk_stats = ZEROSTATS;
-    if (height > 0) {
-        invariant(memcmp(magic, "tokunode", 8) == 0);
-        int n_children = rbuf_int(rb);
-        for (int i = 0; i < n_children; ++i) {
-            if (node_version <= BRT_LAST_LAYOUT_VERSION_WITH_FINGERPRINT) {
-                (void) rbuf_int(rb); // child fingerprint
-            }
-            u_int64_t nkeys = rbuf_ulonglong(rb);
-            u_int64_t ndata = rbuf_ulonglong(rb);
-            invariant(nkeys == ndata);
-            h->on_disk_stats.numrows += nkeys;
-            h->on_disk_stats.numbytes += rbuf_ulonglong(rb);
-            (void) rbuf_char(rb); // exact
-        }
-    } else {
-        invariant(memcmp(magic, "tokuleaf", 8) == 0);
-        u_int64_t nkeys = rbuf_ulonglong(rb);
-        u_int64_t ndata = rbuf_ulonglong(rb);
-        invariant(nkeys == ndata);
-        h->on_disk_stats.numrows += nkeys;
-        h->on_disk_stats.numbytes += rbuf_ulonglong(rb);
-    }
+
+    BRTNODE unused_node = NULL;
+    BRTNODE_DISK_DATA unused_ndd = NULL;
+    struct brtnode_fetch_extra bfe;
+    fill_bfe_for_min_read(&bfe, h);
+    e = deserialize_brtnode_from_fd(fd, h->root_blocknum, 0, &unused_node, &unused_ndd,
+                                    &bfe, &h->on_disk_stats);
     h->in_memory_stats = h->on_disk_stats;

-    // done, discard the rest
-    toku_free(rb->buf);
-exit:
+    if (unused_node) {
+        toku_brtnode_free(&unused_node);
+    }
+    if (unused_ndd) {
+        toku_free(unused_ndd);
+    }
     return e;
 }


{{{test_log10.recover}}} now works.  Fixes #548.

The final fix for this bug involves writing zeros into the unused bytes of the disk when serializing nodes.
This is important for two reasons:
 1. It makes the files the same the bit-level.  (The problem showed up because a node of size near 1MB was written, and then the node split, causing the node to shrink, and when the node was written again, some left over bits from the previous node were still on disk.  Then the file compare failed after recovery.)
 1. It causes the file system to actually allocate the space for a node, so that when a node grows, it will all be contiguous on disk.

It has the disadvantage of writing more to disk than we did before, possibly reducing performance.  It probably doesn't matter much, however.

git-svn-id: 4b2652e19d8125fd9d24eff55f31fd1beb5a42e7@2916 c7de825b-a66e-492c-adef-691d508d4ae1

--- newbrt/brt-serialize.c
+++ newbrt/brt-serialize.c
@@ -186,11 +186,13 @@
     wbuf_int(&w, w.crc32);
 #endif

+    memset(w.buf+w.ndone, 0, size-w.ndone); // fill with zeros
+
     //write_now: printf("%s:%d Writing %d bytes\n", __FILE__, __LINE__, w.ndone);
     {
-	ssize_t r=pwrite(fd, w.buf, w.ndone, off);
+	ssize_t r=pwrite(fd, w.buf, size, off); // write the whole buffer, including the zeros
 	if (r<0) printf("r=%ld errno=%d\n", (long)r, errno);
-	assert((size_t)r==w.ndone);
+	assert(r==size);
     }

     if (calculated_size!=w.ndone)


validation: Mark g_chainman DEPRECATED

validation: Mark g_chainman DEPRECATED

Former-commit-id: 982f377450b7075ce2e0ecbfdcb74928e5350517

--- src/validation.h
+++ src/validation.h
@@ -891,6 +891,7 @@
     void Reset();
 };

+/** DEPRECATED! Please use node.chainman instead. May only be used in validation.cpp internally */
 extern ChainstateManager g_chainman GUARDED_BY(::cs_main);

 /** @returns the most-work valid chainstate. */


Added ws_value_set_is_subset()

Added ws_value_set_is_subset()

--- src/values/set.c
+++ src/values/set.c
@@ -129,3 +129,13 @@
 }
 */

+/*
+bool
+ws_value_set_is_subset(
+    struct ws_value_set const* self,
+    struct ws_value_set const* other
+) {
+    return ws_set_is_subset(self->set, other->set);
+}
+*/
+


fixed frame interleaving

fixed frame interleaving

--- ngx_rtmp_live_module.c
+++ ngx_rtmp_live_module.c
@@ -391,6 +391,10 @@
     } else {
         prio = 0;
         ch.csid = NGX_RTMP_LIVE_CSID_AUDIO;
+    }
+
+    if (lacf->interleave) {
+        ch.csid = NGX_RTMP_LIVE_CSID_VIDEO;
     }

     lh.csid = ch.csid;


yet another tiny sync with randr

yet another tiny sync with randr

--- src/via_driver.c
+++ src/via_driver.c
@@ -1665,7 +1665,7 @@
          *   Max Height: 4096 (and beyond)
          *
          * CLE266A: primary AdjustFrame can use only 24 bits, so we are limited
-         * to 12x11 bits; 4080x2048 (~2:1), 3344x2508 (4:3), or 2896x2896 (1:1).
+         * to 12x11 bits; 4080x2048 (~2:1), 3344x2508 (4:3) or 2896x2896 (1:1).
          * Test CLE266Cx, KM400, KM400A, K8M800, PM800, CN400 please.
          *
          * We should be able to limit the memory available for a mode to 32 MB,
@@ -3081,6 +3081,7 @@
     VIASETREG(VIA_REG_TRANSPACE, 0x64000000);

     VIASETREG(VIA_REG_TRANSET, 0x00fe0000);
+
     if (pVia->Chipset == VIA_CLE266 && pVia->ChipRev >= 3)
         VIASETREG(VIA_REG_TRANSPACE, 0x40008c0f);
     else


Added GObject properties

Added GObject properties

--- src/vncdisplay.c
+++ src/vncdisplay.c
@@ -107,6 +107,21 @@

 G_DEFINE_TYPE(VncDisplay, vnc_display, GTK_TYPE_DRAWING_AREA)

+/* Properties */
+enum
+{
+  PROP_0,
+  PROP_POINTER_LOCAL,
+  PROP_POINTER_GRAB,
+  PROP_KEYBOARD_GRAB,
+  PROP_READ_ONLY,
+  PROP_WIDTH,
+  PROP_HEIGHT,
+  PROP_NAME,
+  PROP_LOSSY_ENCODING,
+  PROP_SCALING
+};
+
 /* Signals */
 typedef enum
 {
@@ -135,6 +150,83 @@
 				      0, 0, 0, 0,
 				      0, 0, 0, 0, 0,};
 static GParamSpec *signalCredParam;
+
+static void
+vnc_display_get_property (GObject    *object,
+			  guint       prop_id,
+			  GValue     *value,
+			  GParamSpec *pspec)
+{
+  VncDisplay *vnc = VNC_DISPLAY (object);
+
+  switch (prop_id)
+    {
+      case PROP_POINTER_LOCAL:
+        g_value_set_boolean (value, vnc->priv->local_pointer);
+	break;
+      case PROP_POINTER_GRAB:
+        g_value_set_boolean (value, vnc->priv->grab_pointer);
+	break;
+      case PROP_KEYBOARD_GRAB:
+        g_value_set_boolean (value, vnc->priv->grab_keyboard);
+	break;
+      case PROP_READ_ONLY:
+        g_value_set_boolean (value, vnc->priv->read_only);
+	break;
+      case PROP_WIDTH:
+        g_value_set_int (value, vnc_display_get_width (vnc));
+	break;
+      case PROP_HEIGHT:
+        g_value_set_int (value, vnc_display_get_height (vnc));
+	break;
+      case PROP_NAME:
+        g_value_set_string (value, vnc_display_get_name (vnc));
+	break;
+      case PROP_LOSSY_ENCODING:
+        g_value_set_boolean (value, vnc->priv->allow_lossy);
+	break;
+      case PROP_SCALING:
+        g_value_set_boolean (value, vnc->priv->allow_scaling);
+	break;
+      default:
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+	break;
+    }
+}
+
+static void
+vnc_display_set_property (GObject      *object,
+			  guint         prop_id,
+			  const GValue *value,
+			  GParamSpec   *pspec)
+{
+  VncDisplay *vnc = VNC_DISPLAY (object);
+
+  switch (prop_id)
+    {
+      case PROP_POINTER_LOCAL:
+        vnc_display_set_pointer_local (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_POINTER_GRAB:
+        vnc_display_set_pointer_grab (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_KEYBOARD_GRAB:
+        vnc_display_set_keyboard_grab (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_READ_ONLY:
+        vnc_display_set_read_only (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_LOSSY_ENCODING:
+        vnc_display_set_lossy_encoding (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_SCALING:
+        vnc_display_set_scaling (vnc, g_value_get_boolean (value));
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}

 GtkWidget *vnc_display_new(void)
 {
@@ -1643,7 +1735,111 @@
 	GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);

 	object_class->finalize = vnc_display_finalize;
+	object_class->get_property = vnc_display_get_property;
+	object_class->set_property = vnc_display_set_property;
+
 	gtkobject_class->destroy = vnc_display_destroy;
+
+	g_object_class_install_property (object_class,
+					 PROP_POINTER_LOCAL,
+					 g_param_spec_boolean ( "local-pointer",
+								"Local Pointer",
+								"Whether we should use the local pointer",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_POINTER_GRAB,
+					 g_param_spec_boolean ( "grab-pointer",
+								"Grab Pointer",
+								"Whether we should grab the pointer",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_KEYBOARD_GRAB,
+					 g_param_spec_boolean ( "grab-keyboard",
+								"Grab Keyboard",
+								"Whether we should grab the keyboard",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_READ_ONLY,
+					 g_param_spec_boolean ( "read-only",
+								"Read Only",
+								"Whether this connection is read-only mode",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_WIDTH,
+					 g_param_spec_int     ( "width",
+								"Width",
+								"The width of the remote screen",
+								0,
+								G_MAXINT,
+								0,
+								G_PARAM_READABLE |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_HEIGHT,
+					 g_param_spec_int     ( "height",
+								"Height",
+								"The height of the remote screen",
+								0,
+								G_MAXINT,
+								0,
+								G_PARAM_READABLE |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_NAME,
+					 g_param_spec_string  ( "name",
+								"Name",
+								"The screen name of the remote connection",
+								NULL,
+								G_PARAM_READABLE |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_LOSSY_ENCODING,
+					 g_param_spec_boolean ( "lossy-encoding",
+								"Lossy Encoding",
+								"Whether we should use a lossy encoding",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_SCALING,
+					 g_param_spec_boolean ( "scaling",
+								"Scaling",
+								"Whether we should use scaling",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));

 	signalCredParam = g_param_spec_enum("credential",
 					    "credential",


Clean up how flex arrays are allocated.

Clean up how flex arrays are allocated.

--- src/wren_value.c
+++ src/wren_value.c
@@ -32,8 +32,11 @@

 #define ALLOCATE(vm, type) \
     ((type*)wrenReallocate(vm, NULL, 0, sizeof(type)))
-#define ALLOCATE_FLEX(vm, type, extra) \
-    ((type*)wrenReallocate(vm, NULL, 0, sizeof(type) + extra))
+
+#define ALLOCATE_FLEX(vm, mainType, arrayType, count) \
+    ((mainType*)wrenReallocate(vm, NULL, 0, \
+        sizeof(mainType) + sizeof(arrayType) * count))
+
 #define ALLOCATE_ARRAY(vm, type, count) \
     ((type*)wrenReallocate(vm, NULL, 0, sizeof(type) * count))

@@ -131,7 +134,7 @@
 ObjClosure* wrenNewClosure(WrenVM* vm, ObjFn* fn)
 {
   ObjClosure* closure = ALLOCATE_FLEX(vm, ObjClosure,
-                                      sizeof(Upvalue*) * fn->numUpvalues);
+                                      Upvalue*, fn->numUpvalues);
   initObj(vm, &closure->obj, OBJ_CLOSURE, vm->fnClass);

   closure->fn = fn;
@@ -222,7 +225,7 @@
 Value wrenNewInstance(WrenVM* vm, ObjClass* classObj)
 {
   ObjInstance* instance = ALLOCATE_FLEX(vm, ObjInstance,
-                                        classObj->numFields * sizeof(Value));
+                                        Value, classObj->numFields);
   initObj(vm, &instance->obj, OBJ_INSTANCE, classObj);

   // Initialize fields to null.
@@ -618,7 +621,7 @@

 Value wrenNewUninitializedString(WrenVM* vm, size_t length)
 {
-  ObjString* string = ALLOCATE_FLEX(vm, ObjString, length + 1);
+  ObjString* string = ALLOCATE_FLEX(vm, ObjString, char, length + 1);
   initObj(vm, &string->obj, OBJ_STRING, vm->stringClass);
   string->length = (int)length;


session: Make sure our auth file descriptor gets closed on exec

We never want the auth file descriptor to leak to the unpriveleged
cockpit-agent. Although we close all extra file descriptors before
execing(), this is a double insurance against future refactoring.

Closes #1225
Reviewed-by: Marius Vollmer <bb11c6e942c5cc765df5f04da146b3198127a7a3@redhat.com>

--- src/ws/session.c
+++ src/ws/session.c
@@ -22,6 +22,7 @@
 #include <assert.h>
 #include <err.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -566,6 +567,7 @@
   struct passwd *pw;
   const char *auth;
   int status;
+  int flags;
   int res;

   if (isatty (0))
@@ -590,6 +592,11 @@
       if (setgid (0) != 0 || setuid (0) != 0)
         err (1, "couldn't switch permissions correctly");
     }
+
+  /* We should never leak our auth fd to other processes */
+  flags = fcntl (AUTH_FD, F_GETFD);
+  if (flags < 0 || fcntl (AUTH_FD, F_SETFD, flags | FD_CLOEXEC))
+    err (1, "couldn't set auth fd flags");

   auth = argv[1];
   rhost = argv[2];


Don't use a stack based DPC structure in the System per-CPU code

Whilst this is believed to be safe, there is no documentation to say that
Windows does not make use of the DPC structure after the DPC routine has
completed. Instead, make the DPC structure part of the per-CPU structure.

Also fix an ASSERT on the per-CPU array pointer not being NULLed.

Signed-off-by: Paul Durrant <dba6cd059c0054f8a3c62ba902cd9d7238853ee4@citrix.com>

--- src/xen/system.c
+++ src/xen/system.c
@@ -49,6 +49,7 @@
 #define XEN_SYSTEM_TAG  'TSYS'

 typedef struct _SYSTEM_PROCESSOR {
+    KDPC    Dpc;
     CHAR    Manufacturer[13];
     UCHAR   ApicID;
     UCHAR   ProcessorID;
@@ -343,7 +344,7 @@
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
-    PKEVENT             Event = _Context;
+    PKEVENT             Event = Argument1;
     ULONG               Index;
     PROCESSOR_NUMBER    ProcNumber;
     PSYSTEM_PROCESSOR   Processor;
@@ -352,7 +353,7 @@
     ULONG               EDX;

     UNREFERENCED_PARAMETER(Dpc);
-    UNREFERENCED_PARAMETER(Argument1);
+    UNREFERENCED_PARAMETER(_Context);
     UNREFERENCED_PARAMETER(Argument2);

     Index = KeGetCurrentProcessorNumberEx(&ProcNumber);
@@ -438,18 +439,20 @@
         break;
     }
     case KeProcessorAddCompleteNotify: {
+        PSYSTEM_PROCESSOR   Processor;
         KEVENT              Event;
-        KDPC                Dpc;

         ASSERT3U(Index, <, Context->ProcessorCount);

+        Processor = &Context->Processor[Index];
+
         KeInitializeEvent(&Event, NotificationEvent, FALSE);

-        KeInitializeDpc(&Dpc, SystemProcessorInformation, &Event);
-        KeSetImportanceDpc(&Dpc, HighImportance);
-        KeSetTargetProcessorDpcEx(&Dpc, &ProcNumber);
-
-        KeInsertQueueDpc(&Dpc, NULL, NULL);
+        KeInitializeDpc(&Processor->Dpc, SystemProcessorInformation, NULL);
+        KeSetImportanceDpc(&Processor->Dpc, HighImportance);
+        KeSetTargetProcessorDpcEx(&Processor->Dpc, &ProcNumber);
+
+        KeInsertQueueDpc(&Processor->Dpc, &Event, NULL);

         (VOID) KeWaitForSingleObject(&Event,
                                      Executive,
@@ -507,6 +510,7 @@
     Context->ProcessorChangeHandle = NULL;

     __SystemFree(Context->Processor);
+    Context->Processor = NULL;
     Context->ProcessorCount = 0;
 }


fixed bug in predefine namespaces

fixed bug in predefine namespaces

--- src/xml_select.c
+++ src/xml_select.c
@@ -1,4 +1,4 @@
-/*  $Id: xml_select.c,v 1.59 2003/12/17 06:26:01 mgrouch Exp $  */
+/*  $Id: xml_select.c,v 1.60 2004/03/30 04:01:41 mgrouch Exp $  */

 /*

@@ -733,7 +733,7 @@
     xsltInitLibXml(&xsltOps);

     /* set parameters */
-    selParseNSArr(ns_arr, &nCount, start, argv+2);
+    selParseNSArr(ns_arr, &nCount, argc-start, argv+2);

     c = sizeof(xsl_buf);
     i = selPrepareXslt(xsl_buf, &c, &ops, ns_arr, start, argc, argv);


Slience a warning

Slience a warning

--- stage2/command.c
+++ stage2/command.c
@@ -268,7 +268,7 @@
 		return 1;
 	}
 	drvStorageDevice floppy = fdGetDriver();
-	fat12LoadFile(&floppy, argv[1], 0x500);
+	fat12LoadFile(&floppy, argv[1], (void*)0x500);
 	return 0;
 }


add checking for palindome

add checking for palindome

--- string_reverse.c
+++ string_reverse.c
@@ -1,5 +1,9 @@
 #include "stdio.h"
 #define MAX_LEN 80
+
+void reverse(char * string, char * reversed);
+void insant_reverse(char * string);
+int ispalindrome(char * string);

 // Didn't want use string.h
 int len(char * string) {
@@ -8,9 +12,30 @@
     return len;
 }

+// Didn't want use ctype.h
+int tolower(int c) {
+    if (c < 'A' || c > 'Z')
+        return c;
+    else
+        return c - 'A' + 'a';
+}
+
+int main(void) {
+    char string [MAX_LEN];
+    printf("Enter any string\n>>> ");
+    fgets(string, MAX_LEN, stdin);
+    char reversed [MAX_LEN];
+    reverse(string, reversed);
+    printf("Entered string: %s\n", string);
+    printf("Reversed string: %s\n", reversed);
+    insant_reverse(string);
+    printf("Instant reverse: %s\n", string);
+    printf("Palindrome: %s\n", ispalindrome(string)? "yes": "no");
+    return 0;
+}
+
 void reverse(char * string, char * reversed) {
     int slen = len(string);
-    printf("%d\n", slen);
     for (int index = 0; index < slen; index++) {
         reversed[slen - index - 1] = string[index];
     }
@@ -28,15 +53,14 @@
     }
 }

-int main(void) {
-    char string [MAX_LEN];
-    printf("Enter any string\n>>> ");
-    fgets(string, MAX_LEN, stdin);
-    char reversed [MAX_LEN];
-    reverse(string, reversed);
-    printf("Entered string: %s\n", string);
-    printf("Reversed string: %s\n", reversed);
-    insant_reverse(string);
-    printf("Instant reverse: %s\n", string);
-    return 0;
+int ispalindrome(char * string) {
+    int p_flag = 1;
+    int slen = len(string);
+    for (int index = 0; index < slen; index++) {
+        if (tolower(string[index]) != tolower(string[slen - index - 1])) {
+            p_flag = 0;
+            break;
+        }
+    }
+    return p_flag;
 }


Don't use log_01[] in my_strtod() to avoid loss of precision.

This is for bug #28121.

strings/strtod.c:
  Don't use log_01[] in my_strtod() to avoid loss of precision.

--- strings/strtod.c
+++ strings/strtod.c
@@ -244,8 +244,8 @@
     else
       step= array_elements(log_10) - 1;
     for (; exponent > step; exponent-= step)
-      result*= neg_exp ? log_01[step] : log_10[step];
-    result*= neg_exp ? log_01[exponent] : log_10[exponent];
+      result= neg_exp ? result / log_10[step] : result * log_10[step];
+    result= neg_exp ? result / log_10[exponent] : result * log_10[exponent];
   }

 done:


New configurale version. V1 is now the default.

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

--- RICH/AliRICHv2.h
+++ RICH/AliRICHv2.h
@@ -0,0 +1,41 @@
+#ifndef ALIRICHV2_H
+#define ALIRICHV2_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+
+///////////////////////////////////////////////////////////
+//  Manager and hits classes for set: RICH full version  //
+///////////////////////////////////////////////////////////
+
+#include "AliRICHv1.h"
+
+class AliRICHv2 : public AliRICHv1 {
+
+ public:
+
+  //Int_t fCkov_number;
+  //Int_t fFreon_prod;
+
+    AliRICHv2();
+    AliRICHv2(const char *name, const char *title);
+    virtual void   Init();
+    virtual       ~AliRICHv2() {}
+
+ private:
+    ClassDef(AliRICHv2,1)  //Hits manager for set: RICH full version, CONFIGURABLE
+
+	};
+
+
+#endif
+
+
+
+
+
+
+


pata_arasan: Add clk_{un}prepare() support

clk_{un}prepare is mandatory for platforms using common clock framework. Since
this driver is used by SPEAr platform, which supports common clock framework,
add clk_{un}prepare() support for it.

Signed-off-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@linaro.com>
Signed-off-by: Jeff Garzik <15f615bf7d20c2937c7eb5aa759110fd6768848c@redhat.com>

--- drivers/ata/pata_arasan_cf.c
+++ drivers/ata/pata_arasan_cf.c
@@ -310,7 +310,7 @@
 	unsigned long flags;
 	int ret = 0;

-	ret = clk_enable(acdev->clk);
+	ret = clk_prepare_enable(acdev->clk);
 	if (ret) {
 		dev_dbg(acdev->host->dev, "clock enable failed");
 		return ret;
@@ -340,7 +340,7 @@
 	writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB,
 			acdev->vbase + OP_MODE);
 	spin_unlock_irqrestore(&acdev->host->lock, flags);
-	clk_disable(acdev->clk);
+	clk_disable_unprepare(acdev->clk);
 }

 static void dma_callback(void *dev)


drbd: Allow online layout change of AL while peer is not connected

If a user forces the operation he takes the blame in case
the peer does not have enough space. No reason to dey this...

Signed-off-by: Philipp Reisner <35a55a4ac466b5abd81eb66f3f7d6a972dd0dc24@linbit.com>
Signed-off-by: Lars Ellenberg <31df9cacdc65c624cc60c2dcd22bbf92dc230e16@linbit.com>
Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@fb.com>

--- drivers/block/drbd/drbd_nl.c
+++ drivers/block/drbd/drbd_nl.c
@@ -2489,7 +2489,7 @@
 			goto fail_ldev;
 		}

-		if (device->state.conn != C_CONNECTED) {
+		if (device->state.conn != C_CONNECTED && !rs.resize_force) {
 			retcode = ERR_MD_LAYOUT_CONNECTED;
 			goto fail_ldev;
 		}


blkfront: Lock blkfront_info when closing

The bdev .open/.release fops race against backend switches to Closing,
handled by the XenBus thread.

The original code attempted to serialize block device holders and
xenbus only via bd_mutex. This is insufficient, the info->bd pointer
may already be stale (or null) while xenbus tries to bump up the
refcount.

Protect blkfront_info with a dedicated mutex.

Signed-off-by: Daniel Stodden <05f14ed2a2851619d24030f51bb8d7a9bac70353@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <35cfe9f678a9e9bbdcf2f6e68cd105ce06d149b1@citrix.com>

--- drivers/block/xen-blkfront.c
+++ drivers/block/xen-blkfront.c
@@ -79,6 +79,7 @@
  */
 struct blkfront_info
 {
+	struct mutex mutex;
 	struct xenbus_device *xbdev;
 	struct gendisk *gd;
 	int vdevice;
@@ -804,7 +805,6 @@
 	return err;
 }

-
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
  * structures and the ring buffer for communication with the backend, and
@@ -836,6 +836,7 @@
 		return -ENOMEM;
 	}

+	mutex_init(&info->mutex);
 	info->xbdev = dev;
 	info->vdevice = vdevice;
 	info->connected = BLKIF_STATE_DISCONNECTED;
@@ -951,6 +952,43 @@
 	return err;
 }

+static void
+blkfront_closing(struct blkfront_info *info)
+{
+	struct xenbus_device *xbdev = info->xbdev;
+	struct block_device *bdev = NULL;
+
+	mutex_lock(&info->mutex);
+
+	if (xbdev->state == XenbusStateClosing) {
+		mutex_unlock(&info->mutex);
+		return;
+	}
+
+	if (info->gd)
+		bdev = bdget_disk(info->gd, 0);
+
+	mutex_unlock(&info->mutex);
+
+	if (!bdev) {
+		xenbus_frontend_closed(xbdev);
+		return;
+	}
+
+	mutex_lock(&bdev->bd_mutex);
+
+	if (info->users) {
+		xenbus_dev_error(xbdev, -EBUSY,
+				 "Device in use; refusing to close");
+		xenbus_switch_state(xbdev, XenbusStateClosing);
+	} else {
+		xlvbd_release_gendisk(info);
+		xenbus_frontend_closed(xbdev);
+	}
+
+	mutex_unlock(&bdev->bd_mutex);
+	bdput(bdev);
+}

 /*
  * Invoked when the backend is finally 'ready' (and has told produced
@@ -1034,7 +1072,6 @@
 			    enum xenbus_state backend_state)
 {
 	struct blkfront_info *info = dev_get_drvdata(&dev->dev);
-	struct block_device *bd;

 	dev_dbg(&dev->dev, "blkfront:blkback_changed to state %d.\n", backend_state);

@@ -1051,25 +1088,7 @@
 		break;

 	case XenbusStateClosing:
-		if (info->gd == NULL) {
-			xenbus_frontend_closed(dev);
-			break;
-		}
-		bd = bdget_disk(info->gd, 0);
-		if (bd == NULL)
-			xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
-
-		mutex_lock(&bd->bd_mutex);
-		if (info->users > 0)
-			xenbus_dev_error(dev, -EBUSY,
-					 "Device in use; refusing to close");
-		else {
-			xlvbd_release_gendisk(info);
-			xenbus_frontend_closed(info->xbdev);
-		}
-
-		mutex_unlock(&bd->bd_mutex);
-		bdput(bd);
+		blkfront_closing(info);
 		break;
 	}
 }


drivers: can: kvaser_pci: Fix incorrect RAM context struct type

The can_kvaser_pci_data_##inst type was supposed to be
can_kvaser_pci_data and not can_kvaser_pci_config. This got unnoticed
because there were no struct members to pre-initialize, and a reference
to the struct was stored using a void pointer.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>

--- drivers/can/can_kvaser_pci.c
+++ drivers/can/can_kvaser_pci.c
@@ -172,7 +172,7 @@
 					       can_kvaser_pci_read_reg, can_kvaser_pci_write_reg,  \
 					       CAN_KVASER_PCI_OCR, CAN_KVASER_PCI_CDR);            \
                                                                                \
-	static struct can_kvaser_pci_config can_kvaser_pci_data_##inst;                            \
+	static struct can_kvaser_pci_data can_kvaser_pci_data_##inst;                              \
                                                                                \
 	static struct can_sja1000_data can_sja1000_data_##inst =                                   \
 		CAN_SJA1000_DATA_INITIALIZER(&can_kvaser_pci_data_##inst);                         \


[AGPGART] Intel-agp adjustments

[AGPGART] Intel-agp adjustments

Fix a call to __free_page where __free_pages(, 2) was meant, and do proper
error path handling. Also remove a redundant conditional.

Signed-off-by: Jan Beulich <01de09643e0ae62e116f8bd77de435799874b456@novell.com>
Signed-off-by: Dave Jones <d5ec0d24602845f6f4b6a35ef729998d1fba5507@redhat.com>

--- drivers/char/agp/intel-agp.c
+++ drivers/char/agp/intel-agp.c
@@ -186,8 +186,9 @@
 		return NULL;

 	if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) {
+		change_page_attr(page, 4, PAGE_KERNEL);
 		global_flush_tlb();
-		__free_page(page);
+		__free_pages(page, 2);
 		return NULL;
 	}
 	global_flush_tlb();
@@ -209,7 +210,7 @@
 	global_flush_tlb();
 	put_page(page);
 	unlock_page(page);
-	free_pages((unsigned long)addr, 2);
+	__free_pages(page, 2);
 	atomic_dec(&agp_bridge->current_memory_agp);
 }

@@ -314,9 +315,6 @@
 {
 	struct agp_memory *new;
 	void *addr;
-
-	if (pg_count != 1 && pg_count != 4)
-		return NULL;

 	switch (pg_count) {
 	case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge);


rio: addition has higher precedence than ?:

Signed-off-by: Roel Kluin <aa9c6213291cec1ff07688554fb7b904b9ffe4e3@gmail.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/char/rio/rio_linux.c
+++ drivers/char/rio/rio_linux.c
@@ -333,7 +333,7 @@

 int rio_minor(struct tty_struct *tty)
 {
-	return tty->index + (tty->driver == rio_driver) ? 0 : 256;
+	return tty->index + ((tty->driver == rio_driver) ? 0 : 256);
 }

 static int rio_set_real_termios(void *ptr)