srv0srv.c:   Add another diagnostic print to determine why the 'queries inside InnoDB' counter might drift upwards

--- innobase/srv/srv0srv.c
+++ innobase/srv/srv0srv.c
@@ -1715,6 +1715,7 @@
 	ibool			has_slept	= FALSE;
 	srv_conc_slot_t*	slot;
 	ulint			i;
+	char                    err_buf[1000];

 	if (srv_thread_concurrency >= 500) {
 		/* Disable the concurrency check */
@@ -1732,6 +1733,16 @@
 	}
 retry:
 	os_fast_mutex_lock(&srv_conc_mutex);
+
+	if (trx->declared_to_be_inside_innodb) {
+	        ut_print_timestamp(stderr);
+
+	        trx_print(err_buf, trx);
+
+	        fprintf(stderr,
+"  InnoDB: Error: trying to declare trx to enter InnoDB, but\n"
+"InnoDB: it already is declared.\n%s\n", err_buf);
+	}

 	if (srv_conc_n_threads < (lint)srv_thread_concurrency) {


Added StringBuf

Added StringBuf

--- uString.h
+++ uString.h
@@ -37,6 +37,7 @@
 typedef std::wostream OStream;
 typedef std::wistream IStream;
 typedef std::wregex RegEx;
+typedef std::wstringbuf StringBuf;
 }// namespace UString

 #else
@@ -62,6 +63,7 @@
 typedef std::ostream OStream;
 typedef std::istream IStream;
 typedef std::regex RegEx;
+typedef std::stringbuf StringBuf;
 }// namespace UString

 #endif// UNICODE


generic_boot: rename shared reserved memory node

Rename the shared reserved memory node from "optee" to "optee_shm".
This should avoid confusion when we introduce the "optee_core" reserved
memory node in later commits.

Reviewed-by: Jerome Forissier <ced78d268b4c9a0a20a59a9feeebd2ad90da03d3@linaro.org>
Signed-off-by: Rouven Czerwinski <76cf81876f6bd9c36f3e19bf926d3e7bc1d0dc80@pengutronix.de>

--- core/arch/arm/kernel/generic_boot.c
+++ core/arch/arm/kernel/generic_boot.c
@@ -874,7 +874,7 @@

 	core_mmu_get_mem_by_type(MEM_AREA_NSEC_SHM, &shm_start, &shm_end);
 	if (shm_start != shm_end)
-		return add_res_mem_dt_node(dt, "optee",
+		return add_res_mem_dt_node(dt, "optee_shm",
 					   virt_to_phys((void *)shm_start),
 					   shm_end - shm_start);


[fix] dma_alloc_coherent() failed when insmod with parameter on linux kernel 4.14

--- udmabuf.c
+++ udmabuf.c
@@ -132,7 +132,6 @@
     size_t               alloc_size;
     void*                virt_addr;
     dma_addr_t           phys_addr;
-    u64                  dma_mask;
 #if (SYNC_ENABLE == 1)
     int                  sync_mode;
     int                  sync_offset;
@@ -764,19 +763,23 @@
         this->dma_dev = this->sys_dev;
 #if (USE_OF_DMA_CONFIG == 1)
         of_dma_configure(this->dma_dev, NULL);
-#else
-        if (this->dma_dev->dma_mask == NULL) {
-            this->dma_dev->dma_mask = &this->dma_mask;
-        }
-        if (dma_set_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit)) == 0) {
-            dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit));
-        } else {
-            printk(KERN_WARNING "dma_set_mask(DMA_BIT_MASK(%d)) failed\n", dma_mask_bit);
-            dma_set_mask(this->dma_dev, DMA_BIT_MASK(32));
-            dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(32));
-        }
-#endif
-    }
+#endif
+    }
+
+    /*
+     * setup dma_mask and coherent_dma_mask
+     */
+    if (this->dma_dev->dma_mask == NULL) {
+        this->dma_dev->dma_mask = &this->dma_dev->coherent_dma_mask;
+    }
+    if (dma_set_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit)) == 0) {
+        dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit));
+    } else {
+        printk(KERN_WARNING "dma_set_mask(DMA_BIT_MASK(%d)) failed\n", dma_mask_bit);
+        dma_set_mask(this->dma_dev, DMA_BIT_MASK(32));
+        dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(32));
+    }
+
     /*
      * dma buffer allocation
      */


Remove the unused file tee_kta_trace.h

Remove the unused file tee_kta_trace.h

Acked-by: Jerome Forissier <ced78d268b4c9a0a20a59a9feeebd2ad90da03d3@linaro.org>
Signed-off-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

--- core/include/kernel/tee_kta_trace.h
+++ core/include/kernel/tee_kta_trace.h
@@ -1,53 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Copyright (c) 2014, STMicroelectronics International N.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERNEL_TEE_KTA_TRACE_H
-#define KERNEL_TEE_KTA_TRACE_H
-
-#include <trace.h>
-
-/*
- * This file provides legacy support for static TAs which hasn't been
- * converted yet.
- */
-
-#define ETAMSG		EMSG
-#define ITAMSG		IMSG
-#define DTAMSG		DMSG
-#define FTAMSG		FMSG
-
-#define TAINMSG		INMSG
-#define TAOUTMSG	OUTMSG
-#define TAOUTRMSG	OUTRMSG
-
-#define ETAMSG_RAW	EMSG_RAW
-#define ITAMSG_RAW	IMSG_RAW
-#define DTAMSG_RAW	DMSG_RAW
-#define FTAMSG_RAW	FMSG_RAW
-
-#endif /*KERNEL_TEE_KTA_TRACE_H*/


Fix possible value set query for token inputs.

--- ui/util.h
+++ ui/util.h
@@ -6,23 +6,21 @@
 #include <QtWidgets/QWidget>
 #include <QtCore/QFileInfo>

-std::string BINARYNINJAUIAPI getStringForLocalVariable(
-    ArchitectureRef arch, FunctionRef func, BinaryNinja::Variable localVar);
+#include <optional>
+
+std::string BINARYNINJAUIAPI getStringForLocalVariable(ArchitectureRef arch, FunctionRef func, BinaryNinja::Variable localVar);
 std::string BINARYNINJAUIAPI getStringForRegisterValue(ArchitectureRef arch, BinaryNinja::RegisterValue value);
 std::string BINARYNINJAUIAPI getPossibleValueSetStateName(BNRegisterValueType state);
 std::string BINARYNINJAUIAPI getStringForIntegerValue(int64_t value);
 std::string BINARYNINJAUIAPI getStringForIntegerValue(uint64_t value);
-std::string BINARYNINJAUIAPI getStringForPossibleValueSet(
-    ArchitectureRef arch, const BinaryNinja::PossibleValueSet& values);
-std::string BINARYNINJAUIAPI getStringForInstructionDataflowDetails(
-    BinaryViewRef data, ArchitectureRef arch, FunctionRef func, uint64_t address);
-BinaryNinja::PossibleValueSet BINARYNINJAUIAPI getPossibleValueSetForToken(
-    View* view, BinaryViewRef data, ArchitectureRef arch, FunctionRef func, HighlightTokenState token, size_t instrIdx);
+std::string BINARYNINJAUIAPI getStringForPossibleValueSet(ArchitectureRef arch, const BinaryNinja::PossibleValueSet& values);
+std::string BINARYNINJAUIAPI getStringForInstructionDataflowDetails(BinaryViewRef data, ArchitectureRef arch, FunctionRef func, uint64_t address);
+std::optional<BinaryNinja::PossibleValueSet> BINARYNINJAUIAPI getPossibleValueSetForToken(View* view, BinaryViewRef data, ArchitectureRef arch,
+    FunctionRef func, HighlightTokenState token, size_t instrIdx);

-void BINARYNINJAUIAPI showHexPreview(
-    QWidget* parent, ViewFrame* frame, const QPoint& previewPos, BinaryViewRef data, uint64_t address);
-bool BINARYNINJAUIAPI showDisassemblyPreview(QWidget* parent, ViewFrame* frame, const QPoint& previewPos,
-    BinaryViewRef data, FunctionRef func, const ViewLocation& location);
+void BINARYNINJAUIAPI showHexPreview(QWidget* parent, ViewFrame* frame, const QPoint& previewPos, BinaryViewRef data, uint64_t address);
+bool BINARYNINJAUIAPI showDisassemblyPreview(QWidget* parent, ViewFrame* frame, const QPoint& previewPos,BinaryViewRef data, FunctionRef func,
+    const ViewLocation& location);
 void BINARYNINJAUIAPI showTextTooltip(QWidget* parent, const QPoint& previewPos, const QString& text);

 bool BINARYNINJAUIAPI isBinaryNinjaDataBase(QFileInfo& info, QFileAccessor& accessor);


change to use PCIWADDR

change to use PCIWADDR

--- usbxhci.c
+++ usbxhci.c
@@ -992,7 +992,7 @@
         int new;
         if ((new = port_new_attach(ctlr)) != -1) {
             print("new device attached at %d\n", new);
-
+            print("port status register %#ux\n", xhcireg_rd(ctlr, (PORTSC_OFF+new*PORTSC_ENUM_OFF), 0xFFFFFFFF)) {
             // dump the event TRB
             event_trb = (Trb *)ctlr->event_deq_virt;
             // check cycle bit before processing


fix and speed up u8_analyze for our purposes

--- utf8lib.c
+++ utf8lib.c
@@ -74,6 +74,7 @@
 			/* in gmqcc, invalid / overlong encodings are considered an error
 			 * goto findchar;
 			 */
+			if (!s[i]) goto done;
 			return false;
 		}
 		ch = (ch << 6) | (s[i+j] & 0x3F);
@@ -87,6 +88,7 @@
 		return false;
 	}

+done:
 	if (_start)
 		*_start = i;
 	if (_len)


eventdev: clarify usage of forward and release ops

Update doxygen to make it clear that RTE_EVENT_OP_FORWARD and
RTE_EVENT_OP_RELEASE must only be enqueued to the same port that the
original event was dequeued from.

Signed-off-by: Tim McDaniel <190d0658596d144b7d6e7de3c5d6e0f14d01ed54@intel.com>
Acked-by: Jerin Jacob <5bca7d2a432bc0f5422b70b2701a4e4fa32edd00@caviumnetworks.com>

--- lib/librte_eventdev/rte_eventdev.h
+++ lib/librte_eventdev/rte_eventdev.h
@@ -882,7 +882,10 @@
 #define RTE_EVENT_OP_FORWARD            1
 /**< The CPU use this operation to forward the event to different event queue or
  * change to new application specific flow or schedule type to enable
- * pipelining
+ * pipelining.
+ *
+ * This operation must only be enqueued to the same port that the
+ * event to be forwarded was dequeued from.
  */
 #define RTE_EVENT_OP_RELEASE            2
 /**< Release the flow context associated with the schedule type.
@@ -911,6 +914,9 @@
  * If current flow's scheduler type method is *RTE_SCHED_TYPE_PARALLEL*
  * or no scheduling context is held then this function may be an NOOP,
  * depending on the implementation.
+ *
+ * This operation must only be enqueued to the same port that the
+ * event to be released was dequeued from.
  *
  */

@@ -1144,6 +1150,9 @@
  * The *nb_events* parameter is the number of event objects to enqueue which are
  * supplied in the *ev* array of *rte_event* structure.
  *
+ * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
+ * enqueued to the same port that their associated events were dequeued from.
+ *
  * The rte_event_enqueue_burst() function returns the number of
  * events objects it actually enqueued. A return value equal to *nb_events*
  * means that all event objects have been enqueued.
@@ -1345,6 +1354,9 @@
  * rte_event_dequeue_burst() invocation, or invoking rte_event_enqueue_burst()
  * with RTE_EVENT_OP_RELEASE operation can be used to release the
  * contexts early.
+ *
+ * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
+ * enqueued to the same port that their associated events were dequeued from.
  *
  * @param dev_id
  *   The identifier of the device.


security: fix return types in documentation

Enhance returned values description for rte_security_session_destroy
and some other minor description changes.

Fixes: c261d1431bd8 ("security: introduce security API and framework")
Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <a2d89656bbb2a6e8a64a294f13639c7f6683f95e@partner.samsung.com>
Acked-by: Anoob Joseph <3ccb4777bd2856f4d9127f25efe6455b1a791ba2@marvell.com>
Acked-by: Akhil Goyal <74d7c4c993a22c1d4f60c46ff3d95c969a24a25c@nxp.com>

--- lib/librte_security/rte_security.h
+++ lib/librte_security/rte_security.h
@@ -378,7 +378,7 @@
  * @param   conf	update configuration parameters
  * @return
  *  - On success returns 0
- *  - On failure return errno
+ *  - On failure returns a negative errno value.
  */
 __rte_experimental
 int
@@ -403,12 +403,14 @@
  * return it to its original mempool.
  *
  * @param   instance	security instance
- * @param   sess	security session to freed
+ * @param   sess	security session to be freed
  *
  * @return
  *  - 0 if successful.
- *  - -EINVAL if session is NULL.
+ *  - -EINVAL if session or context instance is NULL.
  *  - -EBUSY if not all device private data has been freed.
+ *  - -ENOTSUP if destroying private data is not supported.
+ *  - other negative values in case of freeing private data errors.
  */
 int
 rte_security_session_destroy(struct rte_security_ctx *instance,


Update the version number to 3.99 (first pre-release for 4.0)

--- version.c
+++ version.c
@@ -1 +1 @@
-char version[] = "strace -- version 3.1.0.1";
+char version[] = "strace -- version 3.99";


Add memory address range check.

Add memory address range check.

--- vvm/vvm.h
+++ vvm/vvm.h
@@ -19,7 +19,7 @@
  *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 #if !defined(WINNT)
-#ident "$Id: vvm.h,v 1.27 1999/12/12 19:47:54 steve Exp $"
+#ident "$Id: vvm.h,v 1.28 2000/01/06 05:56:02 steve Exp $"
 #endif

 # include  <cassert>
@@ -222,6 +222,7 @@
       void set_word(unsigned addr,
 		    const vvm_bitset_t<WIDTH>&val)
 	    { unsigned base = WIDTH * addr;
+	      assert(addr < size);
 	      for (unsigned idx = 0 ;  idx < WIDTH ;  idx += 1)
 		    bits[base+idx] = val[idx];
 	      call_list_(addr);
@@ -230,6 +231,7 @@
       void set_word(unsigned addr,
 		    const vpip_bit_t val[WIDTH])
 	    { unsigned base = WIDTH * addr;
+	      assert(addr < size);
 	      for (unsigned idx = 0 ;  idx < WIDTH ;  idx += 1)
 		    bits[base+idx] = val[idx];
 	      call_list_(addr);
@@ -238,6 +240,7 @@
       vvm_bitset_t<WIDTH> get_word(unsigned addr) const
 	    { vvm_bitset_t<WIDTH> val;
 	      unsigned base = WIDTH * addr;
+	      assert(addr < size);
 	      for (unsigned idx = 0 ;  idx < WIDTH ;  idx += 1)
 		    val[idx] = bits[base+idx];
 	      return val;
@@ -258,6 +261,9 @@

 /*
  * $Log: vvm.h,v $
+ * Revision 1.28  2000/01/06 05:56:02  steve
+ *  Add memory address range check.
+ *
  * Revision 1.27  1999/12/12 19:47:54  steve
  *  Remove the useless vvm_simulation class.
  *


mshtml: fix accelerator handling

mshtml: fix accelerator handling

--- webview.h
+++ webview.h
@@ -1078,6 +1078,7 @@
   case WM_COMMAND:
   case WM_KEYDOWN:
   case WM_KEYUP: {
+    HRESULT r = S_OK;
     IWebBrowser2 *webBrowser2;
     IOleObject *browser = *w->priv.browser;
     if (browser->lpVtbl->QueryInterface(browser, iid_unref(&IID_IWebBrowser2),
@@ -1086,10 +1087,13 @@
       if (browser->lpVtbl->QueryInterface(
               browser, iid_unref(&IID_IOleInPlaceActiveObject),
               (void **)&pIOIPAO) == S_OK) {
-        pIOIPAO->lpVtbl->TranslateAccelerator(pIOIPAO, &msg);
+        r = pIOIPAO->lpVtbl->TranslateAccelerator(pIOIPAO, &msg);
         pIOIPAO->lpVtbl->Release(pIOIPAO);
       }
       webBrowser2->lpVtbl->Release(webBrowser2);
+    }
+    if (r != S_FALSE) {
+      break;
     }
   }
   default:


More junk.

More junk.

--- x11/x11.c
+++ x11/x11.c
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <string.h>

-RCSID("$Id: x11.c,v 1.2 2006/07/21 17:43:13 wmcbrine Exp $");
+RCSID("$Id: x11.c,v 1.3 2006/07/21 17:50:27 wmcbrine Exp $");

 #ifndef XPOINTER_TYPEDEFED
 typedef char * XPointer;
@@ -53,15 +53,6 @@
 #define MAX_COLORS   8  /* maximum of "normal" colours */
 #define COLOR_CURSOR 16 /* colour of cursor - 1 more than 2 * MAX_COLORS */
 #define COLOR_BORDER 17 /* colour of border - 2 more than 2 * MAX_COLORS */
-
-#ifdef HAVE_XPM_H
-# define PDC_NUMBER_OPTIONS 33
-#define PDC_NUMBER_APP_RESOURCES 35
-#else
-# define PDC_NUMBER_OPTIONS 32
-# define PDC_NUMBER_APP_RESOURCES 34
-#endif
-#define PDC_NUMBER_XCURSES_ACTIONS 5

 #define XCURSESNORMALFONTINFO	app_data.normalfont
 #define XCURSESITALICFONTINFO	app_data.italicfont
@@ -500,7 +491,7 @@
 int windowEntered = 1;
 static char *XCursesProgramName;

-XtResource app_resources[PDC_NUMBER_APP_RESOURCES] =
+XtResource app_resources[] =
 {
 	{
 		"lines",
@@ -866,7 +857,7 @@

 };

-XrmOptionDescRec options[PDC_NUMBER_OPTIONS] =
+XrmOptionDescRec options[] =
 {
    {"-lines",		  "*lines",		XrmoptionSepArg, NULL},
    {"-cols",		  "*cols",		XrmoptionSepArg, NULL},
@@ -905,7 +896,7 @@
    {"-colorBoldWhite",	  "*colorBoldWhite",	XrmoptionSepArg, NULL},
 };

-XtActionsRec XCursesActions[PDC_NUMBER_XCURSES_ACTIONS] =
+XtActionsRec XCursesActions[] =
 {
    {"XCursesButton",		(XtActionProc)XCursesButton},
    {"XCursesKeyPress",		(XtActionProc)XCursesKeyPress},
@@ -914,7 +905,6 @@
    {"string",			(XtActionProc)XCursesHandleString},
 };

-char global_display_name[100];		/* large enough for DISPLAY=machine */
 Bool after_first_curses_request = False;
 int colors[(2 * MAX_COLORS) + 2];
 Bool vertical_cursor = False;


Fix: 2022-03-15

Fix: 2022-03-15

--- xbinary.h
+++ xbinary.h
@@ -713,7 +713,7 @@
     static qint32 _read_int32(char *pData,bool bIsBigEndian=false);
     static quint64 _read_uint64(char *pData,bool bIsBigEndian=false);
     static qint64 _read_int64(char *pData,bool bIsBigEndian=false);
-    static QString _read_ansiString(char *pData, qint32 nMaxSize=50);
+    static QString _read_ansiString(char *pData,qint32 nMaxSize=50);
     static QByteArray _read_byteArray(char *pData,int nSize);
     static float _read_float(char *pData,bool bIsBigEndian=false); // TODO Check
     static double _read_double(char *pData,bool bIsBigEndian=false); // TODO Check


Seems to fix killUserSession() crash

Seems to fix killUserSession() crash

--- core/system/user/user_manager_web.c
+++ core/system/user/user_manager_web.c
@@ -56,10 +56,13 @@
 	// wait till queue will be empty
 	while( TRUE )
 	{
-		if( ses->us_WSConnections ->wusc_Data->wsc_MsgQueue.fq_First == NULL )
-		{
+		FRIEND_MUTEX_LOCK( &(ses->us_Mutex) );
+		if( ses->us_WSConnections->wusc_Data->wsc_MsgQueue.fq_First == NULL )
+		{
+			FRIEND_MUTEX_UNLOCK( &(ses->us_Mutex) );
 			break;
 		}
+		FRIEND_MUTEX_UNLOCK( &(ses->us_Mutex) );
 		usleep( 1000 );
 	}


added XConfigureWindow wrapper

added XConfigureWindow wrapper

--- xbutton.c
+++ xbutton.c
@@ -96,6 +96,18 @@
 	return real_XMoveResizeWindow(display, w, x, y, width, height);
 }

+int XConfigureWindow(Display *display, Window w, unsigned int value_mask, XWindowChanges *values)
+{
+	static int (*real_XConfigureWindow)(Display *, Window, unsigned int, XWindowChanges *);
+	if (!real_XConfigureWindow)
+		real_XConfigureWindow = dlsym(RTLD_NEXT, "XConfigureWindow");
+	if (value_mask & CWWidth)
+		fprintf(stderr, "Xlib: configure window width %d\n", values->width);
+	if (value_mask & CWHeight)
+		fprintf(stderr, "Xlib: configure window height %d\n", values->height);
+	return real_XConfigureWindow(display, w, value_mask, values);
+}
+
 Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attributes)
 {
 	static Window (*real_XCreateWindow)(Display *, Window, int, int, unsigned int, unsigned int, unsigned int, int, unsigned int, Visual *, unsigned long, XSetWindowAttributes *);


Fixes issue 1467

Fixes issue 1467

Properly handles INFINITE in redirect_WaitForSingleObject.
Adds a test to unit_tests.

SVN-Revision: 2715

--- core/win32/drwinapi/kernel32_sync.c
+++ core/win32/drwinapi/kernel32_sync.c
@@ -1,5 +1,5 @@
 /* **********************************************************
- * Copyright (c) 2013 Google, Inc.   All rights reserved.
+ * Copyright (c) 2013-2014 Google, Inc.   All rights reserved.
  * **********************************************************/

 /*
@@ -168,9 +168,15 @@
 {
     NTSTATUS res;
     LARGE_INTEGER li;
-    li.QuadPart = -((int)dwMilliseconds * TIMER_UNITS_PER_MILLISECOND);
+    LARGE_INTEGER *timeout;
+    if (dwMilliseconds == INFINITE)
+        timeout = NULL;
+    else {
+        li.QuadPart = -((int)dwMilliseconds * TIMER_UNITS_PER_MILLISECOND);
+        timeout = &li;
+    }
     /* XXX: are there special handles we need to convert to real handles? */
-    res = NtWaitForSingleObject(hHandle, FALSE/*!alertable*/, &li);
+    res = NtWaitForSingleObject(hHandle, FALSE/*!alertable*/, timeout);
     if (!NT_SUCCESS(res)) {
         set_last_error(ntstatus_to_last_error(res));
         return WAIT_FAILED;
@@ -195,6 +201,7 @@
     LONG val1, val2, res;
     HANDLE e;
     DWORD dw;
+    LARGE_INTEGER li;

     print_file(STDERR, "testing drwinapi kernel32 sync-related routines\n");

@@ -245,5 +252,16 @@
     EXPECT(dw == WAIT_OBJECT_0, true);
     ok = redirect_CloseHandle(e);
     EXPECT(ok, true);
+
+    /* Test INFINITE wait (i#1467) */
+    e = CreateWaitableTimer(NULL, TRUE, "mytimer");
+    EXPECT(e != NULL, true);
+    li.QuadPart = -(50 * TIMER_UNITS_PER_MILLISECOND);
+    ok = SetWaitableTimer(e, &li, 0, NULL, NULL, FALSE);
+    EXPECT(ok, true);
+    dw = redirect_WaitForSingleObject(e, INFINITE);
+    EXPECT(dw == WAIT_OBJECT_0, true);
+    ok = redirect_CloseHandle(e);
+    EXPECT(ok, true);
 }
 #endif


Minor xfiller improvements.

Minor xfiller improvements.

--- xfiller.c
+++ xfiller.c
@@ -1,6 +1,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <GL/glx.h>
+#include <sched.h>
 #include <unistd.h>

 #include <stdlib.h>
@@ -56,11 +57,12 @@

 	dis = XOpenDisplay(NULL);;
 	if (!dis) {
-		fprintf(stderr, "Unable to open X display.\n");
+		fputs("Unable to open X display.\n", stderr);
 		exit(1);
 	}
 	create_window(dis, &wm_delete_msg);
 	for (;;) {
+		sched_yield();
 		XNextEvent(dis, &evt);
 		if ((Atom)evt.xclient.data.l[0] == wm_delete_msg) {
 			break;
@@ -69,4 +71,3 @@
 	XCloseDisplay(dis);
 	return 0;
 }
-


fix dtostrf() issue using trackerj/odometer fixes along with my own fix for string null character ending

--- cores/esp8266/core_esp8266_noniso.c
+++ cores/esp8266/core_esp8266_noniso.c
@@ -162,46 +162,45 @@
         strcpy(s, "ovf");
         return s;
     }
-
     char* out = s;
-    int signInt_Part = 1;
-
     // Handle negative numbers
     if (number < 0.0) {
-        signInt_Part = -1;
+        *out = '-';
+        ++out;
         number = -number;
     }

-    // calc left over digits
-    if (prec > 0)
-    {
-        width -= (prec + 1);
-    }
-
     // Round correctly so that print(1.999, 2) prints as "2.00"
-    double rounding = 0.5;
+    // I optimized out most of the divisions
+    double rounding = 2.0;
     for (uint8_t i = 0; i < prec; ++i)
-        rounding /= 10.0;
+        rounding *= 10.0;
+    rounding = 1.0 / rounding;

     number += rounding;

     // Extract the integer part of the number and print it
     unsigned long int_part = (unsigned long)number;
     double remainder = number - (double)int_part;
-    out += sprintf(out, "%*ld", width, int_part * signInt_Part);
+    out += sprintf(out, "%d", int_part);

     // Print the decimal point, but only if there are digits beyond
     if (prec > 0) {
         *out = '.';
         ++out;
-
-
-        for (unsigned char decShift = prec; decShift > 0; decShift--) {
-            remainder *= 10.0;
-        }
-        sprintf(out, "%0*d", prec, (int)remainder);
-    }
-
+    }
+
+    // Print the digits after the decimal point
+    int8_t digit = 0;
+    while (prec-- > 0) {
+        remainder *= 10.0;
+        digit = (int8_t)remainder;
+        if (digit > 9) digit = 9; // insurance
+        *out = (char)('0' | digit);
+        ++out;
+        remainder -= digit;
+    }
+    *out = 0;
     return s;
 }


fixes #3

fixes #3

--- zopfli/zopflimodule.c
+++ zopfli/zopflimodule.c
@@ -1,3 +1,4 @@
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <stdlib.h>
 #include "zlib_container.h"
@@ -10,8 +11,8 @@
 {
   const unsigned char *in;
   unsigned char *in2, *out;
-  size_t insize = 0;
-  size_t outsize = 0;
+  size_t insize;
+  size_t outsize;
   Options options;
   InitOptions(&options);
   options.verbose = 0;


Bug fix : missing override

Bug fix : missing override

--- test/fixtures/internal_extension.h
+++ test/fixtures/internal_extension.h
@@ -48,7 +48,7 @@
 public:
   int get() override;

-  ClientInterface::clone_type clone();
+  ClientInterface::clone_type clone() override;

 private:
   int m_int = 20;


no need for extra delegate conformance decleration

--- SKBookmarkController.h
+++ SKBookmarkController.h
@@ -42,7 +42,7 @@

 @class SKBookmark, SKStatusBar;

-@interface SKBookmarkController : SKWindowController <NSWindowDelegate, NSToolbarDelegate, NSMenuDelegate, SKOutlineViewDelegate, NSOutlineViewDataSource> {
+@interface SKBookmarkController : SKWindowController <NSWindowDelegate, NSToolbarDelegate, NSMenuDelegate, SKOutlineViewDelegate> {
     SKOutlineView *outlineView;
     SKStatusBar *statusBar;
     SKBookmark *bookmarkRoot;


Common default parameters for ABSO and SHIL

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

--- STRUCT/ABSOSHILConst.h
+++ STRUCT/ABSOSHILConst.h
@@ -0,0 +1,30 @@
+#ifndef ABSOSHILCONST_H
+#define ABSOSHILCONST_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
+
+/* $Id$ */
+
+//
+// z-positions defining the absorber
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+// start of inner opening cone
+    const Float_t zOpen   = 300.;
+// rear end of the absorber
+    const Float_t zRear   = 503.;
+// thickness of rear shield
+    const Float_t dRear  =  35.;
+//
+// angles defining the absorber
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+// min acceptance angle
+    const Float_t accMin = 2. *kDegrad;
+// angle of first opening cone
+    Float_t thetaOpen1 = 0.78*kDegrad;
+//
+// inner radius of heavy shield
+    Float_t rAbs = 4.1;
+// innner radius of beam tube
+    Float_t rVacu=2.9;
+#endif
+


dg: add even predcessors in CFG

dg: add even predcessors in CFG

we need them for some analyses

--- src/DependenceGraph.h
+++ src/DependenceGraph.h
@@ -108,13 +108,24 @@
     unsigned int getRevDataDependenciesNum() const { return revDataDepEdges.size(); }

 #ifdef ENABLE_CFG
-    void addSucc(NodePtrT s) { succs.insert(s); }
+    void addSucc(NodePtrT s)
+    {
+        succs.insert(s);
+        s->preds.insert(static_cast<NodePtrT>(this));
+    }

     cfg_iterator succ_begin(void) { return succs.begin(); }
     const_cfg_iterator succ_begin(void) const { return succs.begin(); }
     cfg_iterator succ_end(void) { return succs.end(); }
     const_cfg_iterator succ_end(void) const { return succs.end(); }
+
+    cfg_iterator pred_begin(void) { return preds.begin(); }
+    const_cfg_iterator pred_begin(void) const { return preds.begin(); }
+    cfg_iterator pred_end(void) { return preds.end(); }
+    const_cfg_iterator pred_end(void) const { return preds.end(); }
+
     unsigned int getSuccNum(void) const { return succs.size(); }
+    unsigned int getPredNum(void) const { return preds.size(); }
 #endif /* ENABLE_CFG */

     DG *addSubgraph(DG *sub)
@@ -150,6 +161,8 @@

     // successors of this node
     CFGEdgesType succs;
+    // predcessors of this node
+    CFGEdgesType preds;
 #endif /* ENABLE_CFG */

     ControlEdgesType controlDepEdges;


svml: add NEON implementation to simde_x_mm_deg2rad_{ps,pd}

--- simde/x86/svml.h
+++ simde/x86/svml.h
@@ -1842,6 +1842,8 @@

     #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
       r_.f32 = a_.f32 * (SIMDE_MATH_PIF / 180.0f);
+    #elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
+      r_.neon_f32 = vmulq_n_f32(a_.neon_i32, SIMDE_MATH_PIF / 180.0f);
     #else
       SIMDE_VECTORIZE
       for (size_t i = 0 ; i < (sizeof(r_.f32) / sizeof(r_.f32[0])) ; i++) {
@@ -1865,6 +1867,8 @@

     #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
       r_.f64 = a_.f64 * (SIMDE_MATH_PI / 180.0);
+    #elif defined(SIMDE_ARM_NEON_A64V8_NATIVE)
+      r_.neon_f64 = vmulq_n_f64(a_.neon_i64, SIMDE_MATH_PI / 180.0);
     #else
       SIMDE_VECTORIZE
       for (size_t i = 0 ; i < (sizeof(r_.f64) / sizeof(r_.f64[0])) ; i++) {


TODO idea

TODO idea

--- simpleQtLogger.h
+++ simpleQtLogger.h
@@ -64,6 +64,7 @@

   TODO:
    - trimming (removing of whitespace) selectable, at least for at the start of log-message
+   - idea: have messages optional prefixed with current stack-depth "...|" if ENABLE_FUNCTION_STACK_TRACE enabled --> maybe not
    - provide to add/remove user defined sinks
    - optimize function-log macro to not create a stack-object according to ENABLE_FUNCTION_STACK_TRACE
    - enable pedantic-errors, check for no compiler warnings, use e.g.: -Wall -Wextra -Werror -pedantic-errors -Wwrite-strings


Cleanup.

Cleanup.

--- src/Magnum/Renderer.h
+++ src/Magnum/Renderer.h
@@ -308,7 +308,7 @@
         /**
          * @brief Set clear color
          *
-         * Initial value is {0.125f, 0.125f, 0.125f, 1.0f}.
+         * Initial value is `{0.125f, 0.125f, 0.125f, 1.0f}`.
          * @see @fn_gl{ClearColor}
          */
         static void setClearColor(const Color4& color);
@@ -363,7 +363,7 @@
         /**
          * @brief Set front-facing polygon winding
          *
-         * Initial value is `FrontFace::CounterClockWise`.
+         * Initial value is @ref FrontFace::CounterClockWise.
          * @see @ref setFaceCullingMode(), @fn_gl{FrontFace}
          */
         static void setFrontFace(FrontFace mode);
@@ -673,7 +673,7 @@
         /**
          * @{ @name Blending
          *
-         * You have to enable blending with setFeature() first.
+         * You have to enable blending with @ref enable() first.
          * @todo Blending for given draw buffer
          */


Increased send buffer size to increase frames per second.

--- Software/cube_driver.c
+++ Software/cube_driver.c
@@ -67,7 +67,7 @@
 #define INIT_FILE_NAME "/opt/adaptive/cube/initialization.bin"
 #define MAX_BOARDS 10
 #define NUM_PANELS_PER_BOARD 4
-#define SEND_BUFFER_SIZE 1000
+#define SEND_BUFFER_SIZE 10000

 typedef enum {FPGA_RESET, FPGA_RUN} FPGA_MODE;
 typedef struct


Avoid undefined behaviour of std::memcpy() on initial write to buffer

--- cpp/inc/bond/stream/output_buffer.h
+++ cpp/inc/bond/stream/output_buffer.h
@@ -221,15 +221,19 @@
         }

         //
-        // copy to the tail of current range
-        std::memcpy(_rangePtr + _rangeSize,
-                    buffer,
-                    sizePart);
-
-        //
-        // increase current range size
-        //
-        _rangeSize += sizePart;
+        // Copy to the tail of current range. Note that _rangePtr may still be
+        // null here on initial write to an empty buffer. The behaviour of
+        // std::memcpy() is undefined in that situation, even if size == 0.
+        //
+        if (sizePart > 0)
+        {
+            std::memcpy(_rangePtr + _rangeSize,
+                        buffer,
+                        sizePart);
+
+            // increase current range size
+            _rangeSize += sizePart;
+        }

         //
         // if there is more bytes to copy, allocate a new buffer


Cleanup defines, remove unused code

Cleanup defines, remove unused code

--- src/unit_PARALLEL/chrono_parallel/ChParallelDefines.h
+++ src/unit_PARALLEL/chrono_parallel/ChParallelDefines.h
@@ -28,6 +28,7 @@
 //#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_OMP
 //#define THRUST_HOST_SYSTEM THRUST_HOST_SYSTEM_OMP
 #endif
+
 #ifndef _MSC_VER
 #include <fenv.h>
 #endif
@@ -38,6 +39,8 @@
 #include <thrust/host_vector.h>
 #include <thrust/device_vector.h>
 #include <math.h>
+#include <vector>
+#include <string.h>
 #include <thrust/transform.h>
 #include <thrust/functional.h>
 #include <thrust/inner_product.h>
@@ -60,17 +63,21 @@
 //#include <thrust/system/tbb/execution_policy.h>
 #include <thrust/execution_policy.h>
 #include "chrono_parallel/ChApiParallel.h"
-//#include <mpi.h>
-#include <omp.h>
-#include <vector>
-#include <string.h>
+#include "chrono_parallel/ChConfigParallel.h"
+
+#ifdef CHRONO_PARALLEL_OMP_FOUND
+   #include <omp.h>
+#endif
+
+
 #ifdef _MSC_VER
-#define thrust_parallel thrust::cpp::par
+   #define thrust_parallel thrust::cpp::par
 #else
-#define thrust_parallel thrust::omp::par
+   #define thrust_parallel thrust::omp::par
 #endif
-//using namespace thrust;
+
 typedef unsigned int uint;
+typedef int  shape_type;

 //#ifdef __CDT_PARSER__
 //#define __host__
@@ -87,14 +94,14 @@

 //#define SIM_ENABLE_GPU_MODE
 #ifdef SIM_ENABLE_GPU_MODE
-#define custom_vector thrust::device_vector
-#else
-#ifndef __CDT_PARSER__
-#define custom_vector thrust::host_vector
-#else
-using namespace thrust;
-#define custom_vector host_vector
-#endif
+   #define custom_vector thrust::device_vector
+   #else
+   #ifndef __CDT_PARSER__
+      #define custom_vector thrust::host_vector
+   #else
+      using namespace thrust;
+      #define custom_vector host_vector
+   #endif
 #endif

 //Output Verbosity Level
@@ -174,38 +181,16 @@
 };

-
 enum SOLVERMODE{
    NORMAL,
    SLIDING,
    SPINNING,
 };

-
 enum NARROWPHASETYPE {
   NARROWPHASE_MPR,
   NARROWPHASE_R
 };

-
-#define shape_type int
-
-//#define SPHERE 0
-//#define ELLIPSOID 1
-//#define BOX 2
-//#define CYLINDER 3
-//#define CONVEXHULL 4
-//#define TRIANGLEMESH 5
-//#define BARREL 6
-//#define RECT 7             //Currently implemented on GPU only
-//#define DISC 8             //Currently implemented on GPU only
-//#define ELLIPSE 9          //Currently implemented on GPU only
-//#define CAPSULE 10         //Currently implemented on GPU only
-//#define CONE 11            //Currently implemented on GPU only
-
-#define Vector_ZERO_EPSILON 1e-8
-#define MIN_ZERO_EPSILON 1.1754943508222875E-38
-#define EPS FLT_EPSILON
-
 #endif


Issue #58: Annotated new packetDescriptors property for ObjC generics.

--- Source/ORSSerialPort.h
+++ Source/ORSSerialPort.h
@@ -379,7 +379,7 @@
  *
  *  Returns an empty array if no packet descriptors are installed.
  */
-@property (nonatomic, strong, readonly) NSArray *packetDescriptors;
+@property (nonatomic, strong, readonly) ORSArrayOf(ORSPacketDescriptor *) *packetDescriptors;

 /** ---------------------------------------------------------------------------------------
  * @name Port Properties


Reduce the size of Node by 8 bytes on 64bit with gcc/clang compilers

Reduce the size of Node by 8 bytes on 64bit with gcc and clang compilers
(from 72 bytes to 64 bytes) by altering the order of its parent classes. The
TreeShared<Node> parent class now comes last because it contains only 1 member
(in release) which is an int and the first member of Node is a uint32_t. This
way no padding is added by gcc/clang and these two members will use the same
word in memory.

MSVC likely won't get any benefit from this because it makes sure each class
in the hierarchy is memory-aligned (see "Compiler being used" section in [1]).
There should be no size impact for MSVC.

[1] http://www.cprogramming.com/tutorial/size_of_class_object.html

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/326793002

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@175844 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/core/dom/Node.h
+++ Source/core/dom/Node.h
@@ -107,7 +107,7 @@
     RenderObject* m_renderer;
 };

-class Node : public TreeSharedWillBeRefCountedGarbageCollected<Node>, public EventTarget, public ScriptWrappable {
+class Node : public EventTarget, public ScriptWrappable, public TreeSharedWillBeRefCountedGarbageCollected<Node> {
     friend class Document;
     friend class TreeScope;
     friend class TreeScopeAdopter;


Renamed CF functions to stay in our namespace, as confirmed by @steipete

--- Sources/NKShorthands.h
+++ Sources/NKShorthands.h
@@ -37,8 +37,8 @@
 NS_INLINE char * NKFcc(code) { return (char[5]){(code >> 24) & 0xFF, (code >> 16) & 0xFF, (code >> 8) & 0xFF, code & 0xFF, 0}; }

 // Foundation functions for CF
-NS_INLINE CFIndex CFMaxRange(CFRange range) { return (range.location + range.length); }
-NS_INLINE Boolean CFLocationInRange(CFIndex location, CFRange range) { return (location >= range.location ? (location <= CFMaxRange(range) ? YES : NO) : NO); }
+NS_INLINE CFIndex NKMaxRange(CFRange range) { return (range.location + range.length); }
+NS_INLINE Boolean NKLocationInRange(CFIndex location, CFRange range) { return (location >= range.location ? (location <= NKMaxRange(range) ? YES : NO) : NO); }

 NS_INLINE BOOL NKIsEmpty(id object) {


Integrate Marcel Taeumel & Tobias Pape's v2 SSL plugin changes.

M    SqueakSSL/sqWin32SSL.c

git-svn-id: f18ccec24f938f15aa42574278fe0cc52f637e81@3416 fa1542d4-bde8-0310-ad64-8ed1123d492a

--- SqueakSSL/sqWin32SSL.c
+++ SqueakSSL/sqWin32SSL.c
@@ -1,4 +1,16 @@
-/* sqWin32SSL.c: SqueakSSL implementation for Windows */
+/****************************************************************************
+*   PROJECT: SqueakSSL implementation for Windows
+*   FILE:    sqWin32SSL.c
+*   CONTENT: SSL platform functions
+*
+*   AUTHORS:  Andreas Raab (ar)
+*
+*             Marcel Taeumel (mt)
+*               Hasso Plattner Institute, Postdam, Germany
+*             Tobias Pape (topa)
+*               Hasso Plattner Institute, Postdam, Germany
+*****************************************************************************/
+
 #include <windows.h>
 #include <errno.h>
 #include <malloc.h>
@@ -18,6 +30,7 @@

 	char *certName;
 	char *peerName;
+	char *serverName;

 	CredHandle sslCred;
 	CtxtHandle sslCtxt;
@@ -126,7 +139,7 @@
 	char  bFriendlyName[MAX_NAME_SIZE];

 	if(certName) {
-		hStore = CertOpenSystemStore(0, "MY");
+		hStore = CertOpenSystemStore(0, L"MY");
 		if(!hStore) {
 			if(ssl->loglevel) printf("sqSetupCert: CertOpenSystemStore failed\n");
 			return 0;
@@ -199,7 +212,9 @@
 	PCERT_NAME_INFO certInfo = NULL;
 	PCERT_RDN_ATTR certAttr = NULL;
 	DWORD dwSize = 0;
-	char tmpBuf[1024];
+	int cbPeerName = 0;
+	LPTSTR tmpBuf = NULL;
+	DWORD cchTmpBuf = 0;

 	if(ssl->peerName) {
 		free(ssl->peerName);
@@ -214,32 +229,21 @@
 		return 0;
 	}

-	/* Figure out the size of the blob */
-	if(!CryptDecodeObject(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, X509_NAME,
-		certHandle->pCertInfo->Subject.pbData,
-		certHandle->pCertInfo->Subject.cbData,
-		0, NULL, &dwSize)) {
-			if(ssl->loglevel) printf("sqExtractPeerName: CryptDecodeObject failed\n");
-			return 0;
-	}
+	/* Extract CN from certificate */
+	cchTmpBuf = CertGetNameString(certHandle, CERT_NAME_ATTR_TYPE, 0, szOID_COMMON_NAME, NULL, 0);
+	tmpBuf = (LPTSTR)alloca(cchTmpBuf * sizeof(TCHAR));
+	CertGetNameString(certHandle, CERT_NAME_ATTR_TYPE, 0, szOID_COMMON_NAME, tmpBuf, cchTmpBuf);
+
+#ifdef _UNICODE
+	/* Convert wide to UTF8 */
+	cbPeerName = WideCharToMultiByte(CP_UTF8, 0, tmpBuf, -1, NULL, 0, NULL, NULL);
+	if (cbPeerName == 0) return 0;
+	ssl->peerName = calloc(1, cbPeerName);
+	WideCharToMultiByte(CP_UTF8, 0, tmpBuf, -1, ssl->peerName, cbPeerName, NULL, NULL);
+#else
+	ssl->peerName = _strdup(tmpBuf);
+#endif

-	/* Get the contents */
-	certInfo = alloca(dwSize);
-	if(!CryptDecodeObject(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, X509_NAME,
-		certHandle->pCertInfo->Subject.pbData,
-		certHandle->pCertInfo->Subject.cbData,
-		0, certInfo, &dwSize)) {
-			if(ssl->loglevel) printf("sqExtractPeerName: CryptDecodeObject failed\n");
-			return 0;
-	}
-
-	/* Fetch the CN from the cert */
-	certAttr = CertFindRDNAttr(szOID_COMMON_NAME, certInfo);
-	if(certAttr == NULL) return 0;
-
-	/* Translate from RDN to string */
-	if(CertRDNValueToStr(CERT_RDN_PRINTABLE_STRING, &certAttr->Value, tmpBuf, sizeof(tmpBuf)) == 0) return 0;
-	ssl->peerName = _strdup(tmpBuf);
 	if(ssl->loglevel) printf("sqExtractPeerName: Peer name is %s\n", ssl->peerName);

 	CertFreeCertificateContext(certHandle);
@@ -401,6 +405,7 @@

 	if(ssl->certName) free(ssl->certName);
 	if(ssl->peerName) free(ssl->peerName);
+	if(ssl->serverName) free(ssl->serverName);
 	if(ssl->dataBuf) free(ssl->dataBuf);

 	free(ssl);
@@ -423,6 +428,8 @@
 	SCHANNEL_CRED sc_cred = { 0 };
 	ULONG sslFlags, retFlags;
 	sqSSL *ssl = sslFromHandle(handle);
+	LPTSTR serverName = NULL;
+	int ccServerName = 0;

 	/* Verify state of session */
 	if(ssl == NULL || (ssl->state != SQSSL_UNUSED && ssl->state != SQSSL_CONNECTING)) {
@@ -433,9 +440,10 @@
 		/* resize the data buffer */
 		ssl->dataMax += (srcLen < 4096) ? (4096) : (srcLen+1024);
 		ssl->dataBuf = realloc(ssl->dataBuf, ssl->dataMax);
-		if(!ssl->dataBuf) return SQSSL_OUT_OF_MEMORY;
-	}
-	if(ssl->loglevel) printf("sqConnectSSL: input token %d bytes\n", srcLen);
+		if (!ssl->dataBuf) return SQSSL_OUT_OF_MEMORY;
+	}
+	if(ssl->loglevel)
+		printf("sqConnectSSL: input token %d bytes\n", srcLen);
 	memcpy(ssl->dataBuf + ssl->dataLen, srcBuf, srcLen);
 	ssl->dataLen += srcLen;

@@ -470,18 +478,32 @@

 	if(ssl->loglevel) printf("sqConnectSSL: Input to InitSecCtxt is %d bytes\n", ssl->dataLen);

+#ifdef _UNICODE
+	if(ssl->serverName) {
+		ccServerName = MultiByteToWideChar(CP_UTF8, 0, ssl->serverName, -1, NULL, 0);
+		if (ccServerName == 0) {
+			return SQSSL_GENERIC_ERROR;
+		}
+		serverName = (LPTSTR)alloca(ccServerName * sizeof(TCHAR));
+		if (MultiByteToWideChar(CP_UTF8, 0, ssl->serverName, -1, serverName, ccServerName) == 0) {
+			return SQSSL_GENERIC_ERROR;
+		}
+	}
+#else
+	if(ssl->serverName) serverName = ssl->serverName;
+#endif
+
 	if(ssl->state == SQSSL_UNUSED) {
 		ssl->state = SQSSL_CONNECTING;

-		if(!sqSetupCert(ssl, ssl->certName, 0))
-			/* FIXME. We need a different error code here. */
+		if (!sqSetupCert(ssl, ssl->certName, 0)) {
 			return SQSSL_GENERIC_ERROR;
-
-		ret = InitializeSecurityContext(&ssl->sslCred, NULL, NULL,
+		}
+		ret = InitializeSecurityContext(&ssl->sslCred, NULL, serverName,
 										sslFlags, 0, 0, NULL, 0, &ssl->sslCtxt,
 										&ssl->sbdOut, &retFlags, NULL);
 	} else {
-		ret = InitializeSecurityContext(&ssl->sslCred, &ssl->sslCtxt, NULL,
+		ret = InitializeSecurityContext(&ssl->sslCred, &ssl->sslCtxt, serverName,
 										sslFlags, 0, 0, &ssl->sbdIn, 0, NULL,
 										&ssl->sbdOut, &retFlags, NULL);
 	}
@@ -516,11 +538,11 @@
 					memmove(ssl->dataBuf, ssl->dataBuf + (ssl->dataLen - extra), extra);
 					ssl->dataLen = extra;
 				} else ssl->dataLen = 0;
-
+
 				/* Don't return zero (SQSSL_OK) when more data is needed */
 				return count ? count : SQSSL_NEED_MORE_DATA;
 			default:
-				if(ssl->loglevel) printf("Unexpected return code %d\n", ret);
+				if(ssl->loglevel) printf("Unexpected return code %lu\n", (unsigned long)ret);
 				return SQSSL_GENERIC_ERROR;
 		}
 	}
@@ -799,6 +821,7 @@
 	switch(propID) {
 		case SQSSL_PROP_PEERNAME:  return ssl->peerName;
 		case SQSSL_PROP_CERTNAME:  return ssl->certName;
+		case SQSSL_PROP_SERVERNAME: return ssl->serverName;
 		default:
 			if(ssl->loglevel) printf("sqGetStringPropertySSL: Unknown property ID %d\n", propID);
 			return NULL;
@@ -838,7 +861,7 @@
 	if(!pfxStore) return 0;

 	/* And copy the certificates to MY store */
-	myStore = CertOpenSystemStore(0, "MY");
+	myStore = CertOpenSystemStore(0, L"MY");
 	pContext = NULL;
 	while(pContext = CertEnumCertificatesInStore(pfxStore, pContext)) {
 		CertAddCertificateContextToStore(myStore, pContext, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
@@ -865,16 +888,27 @@
 	if(propLen) {
 	  property = calloc(1, propLen+1);
 	  memcpy(property, propName, propLen);
+	  property[propLen] = '\0';
 	};

-	if(ssl->loglevel) printf("sqSetStringPropertySSL(%d): %s\n", propID, property);
+	if(ssl->loglevel) printf("sqSetStringPropertySSL(%d): %s\n", propID, property ? property : "(null)");

 	switch(propID) {
-		case SQSSL_PROP_CERTNAME: ssl->certName = property; break;
+		case SQSSL_PROP_CERTNAME:
+			if(ssl->certName) free(ssl->certName);
+			ssl->certName = property;
+			break;
+		case SQSSL_PROP_SERVERNAME:
+			if(ssl->serverName) free(ssl->serverName);
+			ssl->serverName = property;
+			break;
 		/* Platform specific: Adds a .PFX file to MY certificate store w/o password.
 		   Useful for installing the default test certificate in SqueakSSL. */
-		case 10001: return sqAddPfxCertToStore(propName, propLen, NULL, 0);
-		default:
+		case 10001:
+			if(property) free(property);
+			return sqAddPfxCertToStore(propName, propLen, NULL, 0);
+		default:
+			if(property) free(property);
 			if(ssl->loglevel) printf("sqSetStringPropertySSL: Unknown property ID %d\n", propID);
 			return 0;
 	}
@@ -894,7 +928,7 @@
 	switch(propID) {
 		case SQSSL_PROP_SSLSTATE: return ssl->state;
 		case SQSSL_PROP_CERTSTATE: return ssl->certFlags;
-		case SQSSL_PROP_VERSION: return 1;
+		case SQSSL_PROP_VERSION: return SQSSL_VERSION;
 		case SQSSL_PROP_LOGLEVEL: return ssl->loglevel;
 		default:
 			if(ssl->loglevel) printf("sqGetIntPropertySSL: Unknown property ID %d\n", propID);
@@ -911,6 +945,7 @@
 	Returns: Non-zero if successful.
 */
 sqInt sqSetIntPropertySSL(sqInt handle, sqInt propID, sqInt propValue) {
+
 	sqSSL *ssl = sslFromHandle(handle);
 	if(ssl == NULL) return 0;

@@ -920,5 +955,5 @@
 			if(ssl->loglevel) printf("sqSetIntPropertySSL: Unknown property ID %d\n", propID);
 			return 0;
 	}
-	return 0;
-}
+	return 1;
+}


Don't import file we just removed

Don't import file we just removed

--- TMLKit/TMLKit/TMLKit.h
+++ TMLKit/TMLKit/TMLKit.h
@@ -31,7 +31,6 @@
 #import "NSObject+TMLJSON.h"
 #import "NSString+TML.h"
 #import "NSURL+TML.h"
-#import "UIBarButtonItem+TML.h"
 #import "UIBarItem+TML.h"
 #import "UIButton+TML.h"
 #import "UILabel+TML.h"


[doc]

[doc]

--- Xcode/OSIA/ScreenshotsController.h
+++ Xcode/OSIA/ScreenshotsController.h
@@ -8,6 +8,7 @@

 #import <UIKit/UIKit.h>

+/* Displays screenshots */
 @interface ScreenshotsController : UIViewController

 @property (nonatomic, strong) NSArray *screenshots;


auxiliary/os: fix the android build - s/drm_munmap/os_munmap/

Squash this silly typo introduced with commit c63eb5dd5ec(auxiliary/os: get
the mmap/munmap wrappers working with android)

Cc: "10.4 10.5" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Signed-off-by: Emil Velikov <4c996f2f093ddd0585a556460b4cc3ba555546ef@gmail.com>
Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/gallium/auxiliary/os/os_mman.h
+++ src/gallium/auxiliary/os/os_mman.h
@@ -70,8 +70,8 @@
    return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12));
 }

-#  define drm_munmap(addr, length) \
-              munmap(addr, length)
+#  define os_munmap(addr, length) \
+             munmap(addr, length)

 #else
 /* assume large file support exists */


Bluetooth: controller: Fix error codes for accept/reject CIS request

The LE Accept/Reject CIS Request commands shall return Unknown
Connection Identifier if the handle is not a CIS handle or does not
exist. If the CIS already has been established, the commands shall
return Command Disallowed.

Signed-off-by: Wolfgang Puffitsch <f148e6efbb74c70a1ee845a87fa7616913a99a4b@demant.com>

--- subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c
+++ subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c
@@ -48,6 +48,12 @@
 static struct ll_conn *ll_cis_get_acl_awaiting_reply(uint16_t handle, uint8_t *error)
 {
 	struct ll_conn *acl_conn = NULL;
+
+	if (!IS_CIS_HANDLE(handle) || ll_conn_iso_stream_get(handle)->group == NULL) {
+		BT_ERR("Unknown CIS handle %u", handle);
+		*error = BT_HCI_ERR_UNKNOWN_CONN_ID;
+		return NULL;
+	}

 	for (int h = 0; h < CONFIG_BT_MAX_CONN; h++) {
 		struct ll_conn *conn = ll_conn_get(h);
@@ -66,7 +72,7 @@

 	if (!acl_conn) {
 		BT_ERR("No connection found for handle %u", handle);
-		*error = BT_HCI_ERR_UNKNOWN_CONN_ID;
+		*error = BT_HCI_ERR_CMD_DISALLOWED;
 		return NULL;
 	}


Fixed copy & paste error

Fixed copy & paste error

--- src/geometry/CTiglTransformation.h
+++ src/geometry/CTiglTransformation.h
@@ -117,7 +117,7 @@
     TIGL_EXPORT gp_Pnt Transform(const gp_Pnt& point) const;

     // Transforms a surface with the current transformation matrix and
-    // returns the transformed point
+    // returns the transformed surface
     TIGL_EXPORT Handle(Geom_Surface) Transform(const Handle(Geom_Surface)& surf) const;

     // Transforms a vector with the current transformation matrix and


i guess this is too rude

i guess this is too rude

--- src/google/protobuf-c/protobuf-c.c
+++ src/google/protobuf-c/protobuf-c.c
@@ -1483,7 +1483,8 @@
           }
         case PROTOBUF_C_WIRE_TYPE_START_GROUP:
         case PROTOBUF_C_WIRE_TYPE_END_GROUP:
-          PROTOBUF_C_ASSERT_NOT_REACHED ();
+          UNPACK_ERROR (("unsupported group tag at offset %u", (unsigned)(at-data)));
+          goto error_cleanup;
         case PROTOBUF_C_WIRE_TYPE_32BIT:
           if (rem < 4)
             {


Make rev-list flush the stdio buffers after each rev.

We'd rather get the revisions in a slow but timely manner than
have to wait for them.

--- rev-list.c
+++ rev-list.c
@@ -63,7 +63,8 @@
 		static char pretty_header[16384];
 		pretty_print_commit(commit_format, commit->buffer, ~0, pretty_header, sizeof(pretty_header));
 		printf("%s%c", pretty_header, hdr_termination);
-	}
+	}
+	fflush(stdout);
 }

 static int filter_commit(struct commit * commit)


fixed broken assert

fixed broken assert

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

--- trunk/libmesh/include/dof_object.h
+++ trunk/libmesh/include/dof_object.h
@@ -1,4 +1,4 @@
-// $Id: dof_object.h,v 1.7 2003-03-07 20:59:04 jwpeterson Exp $
+// $Id: dof_object.h,v 1.8 2003-03-08 05:44:02 benkirk Exp $

 // The Next Great Finite Element Library.
 // Copyright (C) 2002  Benjamin S. Kirk, John W. Peterson
@@ -46,7 +46,7 @@
  *
  * \author Benjamin S. Kirk
  * \date 2003
- * \version $Revision: 1.7 $
+ * \version $Revision: 1.8 $
  */

 class DofObject
@@ -368,7 +368,7 @@
 	  for (unsigned int v=0; v<this->n_vars(s); v++)
 	    if (this->n_comp(s,v) != 0)
 	      {
-		here();
+//		here();
 		assert (_dof_ids[s][v] != NULL); delete [] _dof_ids[s][v]; _dof_ids[s][v] = NULL;
 	      }

@@ -545,16 +545,17 @@
   if (this->n_systems())
     {
       for (unsigned int s=0; s<this->n_systems(); s++)
-	{
-	  for (unsigned int v=0; v<this->n_vars(s); v++)
-	    if (this->n_comp(s,v) != 0)
-	      {
-		assert (_dof_ids[s][v] != NULL); delete [] _dof_ids[s][v]; _dof_ids[s][v] = NULL;
-	      }
-
-	  assert (_dof_ids[s] != NULL); delete [] _dof_ids[s]; _dof_ids[s] = NULL;
-	  assert (_n_comp[s]  != NULL); delete [] _n_comp[s];  _n_comp[s]  = NULL;
-	}
+	if (this->n_vars(s))
+	  {
+	    for (unsigned int v=0; v<this->n_vars(s); v++)
+	      if (this->n_comp(s,v) != 0)
+		{
+		  assert (_dof_ids[s][v] != NULL); delete [] _dof_ids[s][v]; _dof_ids[s][v] = NULL;
+		}
+
+	    assert (_dof_ids[s] != NULL); delete [] _dof_ids[s]; _dof_ids[s] = NULL;
+	    assert (_n_comp[s]  != NULL); delete [] _n_comp[s];  _n_comp[s]  = NULL;
+	  }

       assert (_dof_ids != NULL); delete [] _dof_ids; _dof_ids = NULL;
       assert (_n_comp  != NULL); delete [] _n_comp;  _n_comp  = NULL;
@@ -750,6 +751,11 @@
   // If we already have memory allocated clear it.
   if (this->n_vars(s))
     {
+      assert (_dof_ids    != NULL);
+      assert (_dof_ids[s] != NULL);
+      assert (_n_comp     != NULL);
+      assert (_n_comp[s]  != NULL);
+
       for (unsigned int v=0; v<this->n_vars(s); v++)
 	if (n_comp(s,v) != 0)
 	  {
@@ -761,7 +767,8 @@
       assert (_n_comp  != NULL); delete [] _n_comp[s];  _n_comp[s]  = NULL;
       assert (_dof_ids != NULL); delete [] _dof_ids[s]; _dof_ids[s] = NULL;
     }
-
+
+  // Reset the number of variables in the system
   _n_vars[s] = static_cast<unsigned char>(nvars);

   if (this->n_vars(s) > 0)
@@ -776,6 +783,7 @@
 	}
     }

+
 #else

   // If we already have memory allocated clear it.
@@ -783,7 +791,8 @@
     {
       assert (_dof_ids[s] != NULL); delete [] _dof_ids[s]; _dof_ids[s] = NULL;
     }
-
+
+  // Reset the number of variables in the system
   _n_vars[s] = static_cast<unsigned char>(nvars);

   if (this->n_vars(s) > 0)
@@ -795,6 +804,7 @@
 	_dof_ids[s][v] = invalid_id - 1;
     }

+
 #endif
 }


some progress with eof bug

some progress with eof bug

git-svn-id: 41bd7e47c31e4d43f97241d7529f6785d233c6d8@332 23f926e6-80f1-49ca-85a0-60d4a27bb3ac

--- trunk/rdo_stream/rdobinarystream.h
+++ trunk/rdo_stream/rdobinarystream.h
@@ -58,14 +58,16 @@
 				int s = vec.size();
 				char cc = c;
 				if ( current < vec.size() ) {
-					setg( vec.begin(), &vec[current], vec.end() );
+					setg( &vec[current], &vec[current], &vec[current + 1] );
 					stream->setstate( goodbit );
 					return c;
 				} else {
+					setg( &vec[current], &vec[current], &vec[current] );
 					stream->setstate( eofbit );
 					return traits_type::eof();
 				}
 			} else {
+				setg( &vec[current], &vec[current], &vec[current] );
 				stream->setstate( eofbit );
 				return traits_type::eof();
 			}


Add merging of two or more ListActionStatus

--- src/gui-qt/undo/listactionhelper.h
+++ src/gui-qt/undo/listactionhelper.h
@@ -14,14 +14,32 @@
 namespace Undo {

 struct ListActionStatus {
-    bool selectionValid;
+    bool selectionValid = false;

-    bool canAdd;
-    bool canClone;
-    bool canRemove;
+    bool canAdd = false;
+    bool canClone = false;
+    bool canRemove = false;

-    bool canRaise;
-    bool canLower;
+    bool canRaise = false;
+    bool canLower = false;
+
+    ListActionStatus() = default;
+
+    ListActionStatus(const ListActionStatus& a, const ListActionStatus& b)
+    {
+        selectionValid = a.selectionValid | b.selectionValid;
+        canAdd = (a.canAdd & b.canAdd) | (a.canAdd & !b.selectionValid) | (!a.selectionValid & b.canAdd);
+        canClone = (a.canClone & b.canClone) | (a.canClone & !b.selectionValid) | (!a.selectionValid & b.canClone);
+        canRemove = (a.canRemove & b.canRemove) | (a.canRemove & !b.selectionValid) | (!a.selectionValid & b.canRemove);
+        canRaise = (a.canRaise & b.canRaise) | (a.canRaise & !b.selectionValid) | (!a.selectionValid & b.canRaise);
+        canLower = (a.canLower & b.canLower) | (a.canLower & !b.selectionValid) | (!a.selectionValid & b.canLower);
+    }
+
+    template <class... T>
+    ListActionStatus(const ListActionStatus& a, const ListActionStatus& b, T... v)
+        : ListActionStatus(ListActionStatus(a, b), v...)
+    {
+    }
 };

 class ListActionHelper {
@@ -55,7 +73,7 @@
         const ListT* list = mem_fn_call(f, a, listArgs);

         if (list == nullptr) {
-            return { false, false, false, false, false, false };
+            return ListActionStatus();
         }

         const index_type list_size = list->size();


Fix doc comment

Fix doc comment

--- turbine/code/src/turbine/turbine.h
+++ turbine/code/src/turbine/turbine.h
@@ -56,10 +56,10 @@

 #define TURBINE_CODE_STRING_MAX 64

-/*
+/**
   Convert code to string.
   output: buffer of at least TURBINE_CODE_STRING_MAX bytes
- */
+*/
 int turbine_code_tostring(char* output, turbine_code code);

 void turbine_finalize(Tcl_Interp *interp);


Add deparse step to blocking version of encryption test to make it comparable

--- src/hardware_dep/dpdk/main_async.c
+++ src/hardware_dep/dpdk/main_async.c
@@ -209,6 +209,9 @@

 void do_blocking_sync_op(packet_descriptor_t* pd, enum async_op_type op){
     unsigned int lcore_id = rte_lcore_id();
+
+    control_DeparserImpl(pd, 0, 0);
+    emit_packet(pd, 0, 0);

     create_crypto_op(async_ops[lcore_id],pd,op,NULL);
     if (rte_crypto_op_bulk_alloc(lcore_conf[lcore_id].crypto_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -227,6 +230,8 @@

     rte_mempool_put_bulk(lcore_conf[lcore_id].crypto_pool, (void **)dequeued_ops[lcore_id], 1);

+    reset_pd(pd);
+    parse_packet(pd, 0, 0);
 }

 void main_loop_async(struct lcore_data* lcdata, packet_descriptor_t *pd)


pg_database's datpath column must not be marked toastable, because GetRawDatabaseInfo() won't cope with a compressed path spec (much less a moved-off one).  I'm not going to force an initdb for this change, because it's noncritical --- we're not actually using datpath at all right now.  But it seems a good idea to apply the fix while I'm thinking about it.

--- src/include/catalog/pg_attribute.h
+++ src/include/catalog/pg_attribute.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.67 2000/11/14 18:37:46 tgl Exp $
+ * $Id: pg_attribute.h,v 1.68 2001/01/14 22:17:22 tgl Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -284,7 +284,8 @@
 DATA(insert OID = 0 ( 1262 datistemplate    16 0  1   4 0 -1 -1 t p f c f f));
 DATA(insert OID = 0 ( 1262 datallowconn     16 0  1   5 0 -1 -1 t p f c f f));
 DATA(insert OID = 0 ( 1262 datlastsysoid    26 0  4   6 0 -1 -1 t p f i f f));
-DATA(insert OID = 0 ( 1262 datpath			25 0 -1   7 0 -1 -1 f x f i f f));
+/* do not mark datpath as toastable; GetRawDatabaseInfo won't cope */
+DATA(insert OID = 0 ( 1262 datpath			25 0 -1   7 0 -1 -1 f p f i f f));
 DATA(insert OID = 0 ( 1262 ctid				27 0  6  -1 0 -1 -1 f p f i f f));
 DATA(insert OID = 0 ( 1262 oid				26 0  4  -2 0 -1 -1 t p f i f f));
 DATA(insert OID = 0 ( 1262 xmin				28 0  4  -3 0 -1 -1 t p f i f f));


handle gcc inability to properly check if const char* is passed to printf

--- src/include/libfly/fly_debugging.h
+++ src/include/libfly/fly_debugging.h
@@ -34,9 +34,9 @@

 static inline void fly_do_log(const char *subsys, const char *msg)
 {
-	printf(subsys);
+	printf("%s", subsys);
 	printf(" ");
-	printf(msg);
+	printf("%s", msg);
 	printf("\n");
 }


Wilbern Cobb fixed joystick code on FreeBSD

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40359

--- src/joystick/bsd/SDL_sysjoystick.c
+++ src/joystick/bsd/SDL_sysjoystick.c
@@ -41,7 +41,12 @@

 #include <dev/usb/usb.h>
 #include <dev/usb/usbhid.h>
-#include <usbhid.h>
+
+#if defined(__FreeBSD__)
+# include <libusb.h>
+#else
+# include <usbhid.h>
+#endif

 #include "SDL_error.h"
 #include "SDL_joystick.h"
@@ -205,7 +210,8 @@
 	joy->nballs = 0;

 	while (hid_get_item(hdata, &hitem) > 0) {
-		char *s, *sp;
+		char *sp;
+		const char *s;

 		switch (hitem.kind) {
 		case hid_collection:
@@ -271,7 +277,7 @@
 	static struct hid_item hitem;
 	static struct hid_data *hdata;
 	static struct report *rep;
-	int nbutton, naxe;
+	int nbutton, naxe = -1;
 	Sint32 v;

 	rep = &joy->hwdata->inreport;


lib-http: Fixed assertion failure in http_client_request_send_payload() caused by inappropriate retry attempt.

--- src/lib-http/http-client-request.c
+++ src/lib-http/http-client-request.c
@@ -1004,6 +1004,13 @@

 bool http_client_request_try_retry(struct http_client_request *req)
 {
+	/* don't ever retry if we're sending data in small blocks via
+	   http_client_request_send_payload() and we're not waiting for a
+	   100 continue (there's no way to rewind the payload for a retry)
+	 */
+	if (req->payload_wait &&
+		(!req->payload_sync || req->conn->payload_continue))
+		return FALSE;
 	/* limit the number of attempts for each request */
 	if (req->attempts+1 >= req->client->set.max_attempts)
 		return FALSE;


lib-http: Fixed handling of limits=NULL parameter for http_request_parser_init. Got messed up in patch queue.

--- src/lib-http/http-request-parser.c
+++ src/lib-http/http-request-parser.c
@@ -42,15 +42,16 @@
 {
 	struct http_request_parser *parser;
 	struct http_header_limits hdr_limits;
-	uoff_t max_payload_size = limits->max_payload_size;
+	uoff_t max_payload_size;

 	parser = i_new(struct http_request_parser, 1);
-	parser->max_target_length = limits->max_target_length;
-
-	if (limits != NULL)
+	if (limits != NULL) {
 		hdr_limits = limits->header;
-	else
+		max_payload_size = limits->max_payload_size;
+	} else {
 		memset(&hdr_limits, 0, sizeof(hdr_limits));
+		max_payload_size = 0;
+	}

 	/* substitute default limits */
 	if (parser->max_target_length == 0)


settings_dup(): Copy only the settings, leave the rest of the struct zeroed out.

--- src/lib-settings/settings-parser.c
+++ src/lib-settings/settings-parser.c
@@ -847,6 +847,18 @@
 	return FALSE;
 }

+static void settings_set_parent(const struct setting_parser_info *info,
+				void *child, void *parent)
+{
+	void **ptr;
+
+	if (info->parent_offset == (size_t)-1)
+		return;
+
+	ptr = PTR_OFFSET(child, info->parent_offset);
+	*ptr = parent;
+}
+
 void *settings_dup(const struct setting_parser_info *info,
 		   const void *set, pool_t pool)
 {
@@ -855,17 +867,27 @@
 	void *dest_set, *dest, *const *children;
 	unsigned int i, count;

+	/* don't just copy everything from set to dest_set. it may contain
+	   some non-setting fields allocated from the original pool. */
 	dest_set = p_malloc(pool, info->struct_size);
-	memcpy(dest_set, set, info->struct_size);
 	for (def = info->defines; def->key != NULL; def++) {
 		src = CONST_PTR_OFFSET(set, def->offset);
 		dest = PTR_OFFSET(dest_set, def->offset);

 		switch (def->type) {
-		case SET_INTERNAL:
-		case SET_BOOL:
-		case SET_UINT:
-			break;
+		case SET_BOOL: {
+			const bool *src_bool = src;
+			bool *dest_bool = dest;
+
+			*dest_bool = *src_bool;
+		}
+		case SET_UINT: {
+			const unsigned int *src_uint = src;
+			unsigned int *dest_uint = dest;
+
+			*dest_uint = *src_uint;
+			break;
+		}
 		case SET_STR_VARS:
 		case SET_STR:
 		case SET_ENUM: {
@@ -889,6 +911,8 @@
 				child_set = settings_dup(def->list_info,
 							 children[i], pool);
 				array_append(dest_arr, &child_set, 1);
+				settings_set_parent(def->list_info, child_set,
+						    dest_set);
 			}
 			break;
 		}


imagefreeze: Add test for bufferalloc passthrough

--- tests/check/elements/imagefreeze.c
+++ tests/check/elements/imagefreeze.c
@@ -66,25 +66,27 @@
   pipeline = gst_pipeline_new ("pipeline");
   fail_unless (pipeline != NULL);

-  videotestsrc = gst_element_factory_make ("videotestsrc", NULL);
+  videotestsrc = gst_element_factory_make ("videotestsrc", "src");
   fail_unless (videotestsrc != NULL);
   g_object_set (videotestsrc, "num-buffers", 1, NULL);

-  capsfilter1 = gst_element_factory_make ("capsfilter", NULL);
+  capsfilter1 = gst_element_factory_make ("capsfilter", "filter1");
   fail_unless (capsfilter1 != NULL);
   g_object_set (capsfilter1, "caps", caps1, NULL);

-  imagefreeze = gst_element_factory_make ("imagefreeze", NULL);
+  imagefreeze = gst_element_factory_make ("imagefreeze", "freeze");
   fail_unless (imagefreeze != NULL);

-  capsfilter2 = gst_element_factory_make ("capsfilter", NULL);
+  capsfilter2 = gst_element_factory_make ("capsfilter", "filter2");
   fail_unless (capsfilter2 != NULL);
   g_object_set (capsfilter2, "caps", caps2, NULL);

-  fakesink = gst_element_factory_make ("fakesink", NULL);
+  fakesink = gst_element_factory_make ("fakesink", "sink");
   fail_unless (fakesink != NULL);
   g_object_set (fakesink, "signal-handoffs", TRUE, "async", FALSE, NULL);
-  g_signal_connect (fakesink, "handoff", sink_handoff, sink_handoff_data);
+
+  if (sink_handoff)
+    g_signal_connect (fakesink, "handoff", sink_handoff, sink_handoff_data);

   gst_bin_add_many (GST_BIN (pipeline), videotestsrc, capsfilter1, imagefreeze,
       capsfilter2, fakesink, NULL);
@@ -448,6 +450,102 @@

 GST_END_TEST;

+static GstBuffer *test_buffer = NULL;
+
+static GstFlowReturn
+test_bufferalloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
+    GstBuffer ** buf)
+{
+  fail_if (test_buffer != NULL);
+
+  test_buffer = gst_buffer_new_and_alloc (size);
+  gst_buffer_set_caps (test_buffer, caps);
+
+  *buf = gst_buffer_ref (test_buffer);
+
+  return GST_FLOW_OK;
+}
+
+static void
+sink_handoff_cb_bufferalloc (GstElement * object, GstBuffer * buffer,
+    GstPad * pad, gpointer user_data)
+{
+  guint *n_buffers = (guint *) user_data;
+
+  if (*n_buffers == G_MAXUINT)
+    return;
+
+  fail_unless (buffer->parent != NULL);
+  fail_unless (test_buffer != NULL);
+  fail_unless (buffer->parent == test_buffer);
+
+  *n_buffers = *n_buffers + 1;
+}
+
+GST_START_TEST (test_imagefreeze_bufferalloc)
+{
+  GstElement *pipeline;
+  GstElement *sink;
+  GstPad *sinkpad;
+  GstCaps *caps1, *caps2;
+  GstBus *bus;
+  GMainLoop *loop;
+  guint n_buffers = G_MAXUINT;
+
+  caps1 =
+      gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
+  caps2 =
+      gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
+
+  pipeline =
+      setup_imagefreeze (caps1, caps2, G_CALLBACK (sink_handoff_cb_bufferalloc),
+      &n_buffers);
+
+  sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
+  fail_unless (sink != NULL);
+  sinkpad = gst_element_get_static_pad (sink, "sink");
+  fail_unless (sinkpad != NULL);
+  gst_pad_set_bufferalloc_function (sinkpad, test_bufferalloc);
+  gst_object_unref (sinkpad);
+  gst_object_unref (sink);
+
+  loop = g_main_loop_new (NULL, TRUE);
+  fail_unless (loop != NULL);
+
+  bus = gst_element_get_bus (pipeline);
+  fail_unless (bus != NULL);
+  gst_bus_add_watch (bus, bus_handler, loop);
+  gst_object_unref (bus);
+
+  fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PAUSED),
+      GST_STATE_CHANGE_SUCCESS);
+
+  fail_unless (gst_element_seek (pipeline, 1.0, GST_FORMAT_TIME,
+          GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET,
+          400 * GST_MSECOND));
+
+  n_buffers = 0;
+  fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING),
+      GST_STATE_CHANGE_SUCCESS);
+
+  g_main_loop_run (loop);
+
+  fail_unless (test_buffer != NULL);
+  fail_unless (n_buffers >= 1);
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+
+  gst_buffer_unref (test_buffer);
+  test_buffer = NULL;
+
+  g_object_unref (pipeline);
+  g_main_loop_unref (loop);
+  gst_caps_unref (caps1);
+  gst_caps_unref (caps2);
+}
+
+GST_END_TEST;
+
 static Suite *
 imagefreeze_suite (void)
 {
@@ -464,6 +562,8 @@
   tcase_add_test (tc_chain, test_imagefreeze_25_1_400ms_0ms);
   tcase_add_test (tc_chain, test_imagefreeze_25_1_220ms_380ms);

+  tcase_add_test (tc_chain, test_imagefreeze_bufferalloc);
+
   return s;
 }


If view is inconsistent, show the mail as expunged.

--HG--
branch : HEAD

--- src/lib-storage/index/index-mail.c
+++ src/lib-storage/index/index-mail.c
@@ -978,6 +978,11 @@
 	data->seq = seq;
 	data->flags = rec->flags & MAIL_FLAGS_NONRECENT;

+	if (mail_index_view_is_inconsistent(mail->trans->trans_view)) {
+		mail_set_expunged(&mail->mail.mail);
+		return;
+	}
+
 	if ((mail->wanted_fields & (MAIL_FETCH_NUL_STATE |
 				    MAIL_FETCH_IMAP_BODY |
 				    MAIL_FETCH_IMAP_BODYSTRUCTURE)) != 0) {


evas/gl - don't crushed up when failed to allocate surface.

git-svn-id: 24a995eca3b83137dd7eab3408044d7832e202f7@75748 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/canvas/evas_object_image.c
+++ src/lib/canvas/evas_object_image.c
@@ -2345,14 +2345,14 @@
    source->proxy.redraw = EINA_FALSE;

    /* We need to redraw surface then */
-   if ((source->proxy.surface) &&
+   if ((source->proxy.surface) &&
        ((source->proxy.w != w) || (source->proxy.h != h)))
      {
         e->engine.func->image_map_surface_free(e->engine.data.output,
                                                source->proxy.surface);
         source->proxy.surface = NULL;
      }
-
+
    /* FIXME: Hardcoded alpha 'on' */
    /* FIXME (cont): Should see if the object has alpha */
    if (!source->proxy.surface)
@@ -2362,6 +2362,8 @@
         source->proxy.w = w;
         source->proxy.h = h;
      }
+
+   if (!source->proxy.surface) return;

    ctx = e->engine.func->context_new(e->engine.data.output);
    e->engine.func->context_color_set(e->engine.data.output, ctx, 0, 0, 0, 0);
@@ -2369,7 +2371,7 @@
    e->engine.func->rectangle_draw(e->engine.data.output, ctx,
                                   source->proxy.surface, 0, 0, w, h);
    e->engine.func->context_free(e->engine.data.output, ctx);
-
+
    ctx = e->engine.func->context_new(e->engine.data.output);
    evas_render_mapped(e, source, ctx, source->proxy.surface,
                       -source->cur.geometry.x,


evas/evas_object_table - don't be aborted

git-svn-id: 24a995eca3b83137dd7eab3408044d7832e202f7@70602 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/canvas/evas_object_table.c
+++ src/lib/canvas/evas_object_table.c
@@ -97,7 +97,6 @@
 {                                                                       \
    CRIT("no widget data for object %p (%s)",                            \
         o, evas_object_type_get(o));                                    \
-   abort();                                                             \
    return;                                                              \
 }

@@ -107,7 +106,6 @@
 {                                                                       \
    CRIT("No widget data for object %p (%s)",                            \
         o, evas_object_type_get(o));                                    \
-   abort();                                                             \
    return val;                                                          \
 }


remove code that forceds fb 0 . let disp name do it

SVN revision: 44149

--- src/lib/ecore_evas/ecore_evas_fb.c
+++ src/lib/ecore_evas/ecore_evas_fb.c
@@ -657,7 +657,6 @@
      {
 	einfo->info.virtual_terminal = 0;
 	einfo->info.device_number = strtol(disp_name, NULL, 10);
-	einfo->info.device_number = 0;
 	einfo->info.refresh = 0;
 	einfo->info.rotation = ee->rotation;
 	evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);


scrollable interface: typo type

scrollable interface: typo type

--- src/lib/elm_interface_scrollable.h
+++ src/lib/elm_interface_scrollable.h
@@ -686,7 +686,7 @@
  * @param[in] single_dir
  *
  */
-#define elm_scrollable_interface_single_direction_set(single_dir) ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_SINGLE_DIRECTION_SET), EO_TYPECHECK(Eina_Bool, single_dir)
+#define elm_scrollable_interface_single_direction_set(single_dir) ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_SINGLE_DIRECTION_SET), EO_TYPECHECK(Elm_Scroller_Single_Direction, single_dir)

 /**
  * @def elm_scrollable_interface_single_direction_get


It turns out that asm/reg.h is missing from the 2.6.x kernel headers, which prevents libthread_db (used by gdb) from compiling.  Include a copy within include/sys/user.h for mips, per what was done in glibc.

--- libc/sysdeps/linux/mips/sys/user.h
+++ libc/sysdeps/linux/mips/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.

    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,154 @@
    too much into it.  Don't use it for anything other than GDB unless
    you know what you are doing.  */

-#include <asm/reg.h>
+/* #include <asm/reg.h> */
+/* Instead of including the kernel header, that will vary depending on
+   whether the 32- or the 64-bit kernel is installed, we paste its
+   contents here.  Note that the fact that the file is inline here,
+   instead of included separately, doesn't change in any way the
+   licensing status of a program that includes user.h.  Since this is
+   for gdb alone, and gdb is GPLed, no surprises here.  */
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+/*
+ * Various register offset definitions for debuggers, core file
+ * examiners and whatnot.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995, 1999 by Ralf Baechle
+ */
+#ifndef __ASM_MIPS_REG_H
+#define __ASM_MIPS_REG_H
+
+/*
+ * This defines/structures correspond to the register layout on stack -
+ * if the order here is changed, it needs to be updated in
+ * include/asm-mips/stackframe.h
+ */
+#define EF_REG0			6
+#define EF_REG1			7
+#define EF_REG2			8
+#define EF_REG3			9
+#define EF_REG4			10
+#define EF_REG5			11
+#define EF_REG6			12
+#define EF_REG7			13
+#define EF_REG8			14
+#define EF_REG9			15
+#define EF_REG10		16
+#define EF_REG11		17
+#define EF_REG12		18
+#define EF_REG13		19
+#define EF_REG14		20
+#define EF_REG15		21
+#define EF_REG16		22
+#define EF_REG17		23
+#define EF_REG18		24
+#define EF_REG19		25
+#define EF_REG20		26
+#define EF_REG21		27
+#define EF_REG22		28
+#define EF_REG23		29
+#define EF_REG24		30
+#define EF_REG25		31
+/*
+ * k0/k1 unsaved
+ */
+#define EF_REG28		34
+#define EF_REG29		35
+#define EF_REG30		36
+#define EF_REG31		37
+
+/*
+ * Saved special registers
+ */
+#define EF_LO			38
+#define EF_HI			39
+
+#define EF_CP0_EPC		40
+#define EF_CP0_BADVADDR		41
+#define EF_CP0_STATUS		42
+#define EF_CP0_CAUSE		43
+
+#define EF_SIZE			180	/* size in bytes */
+
+#endif /* __ASM_MIPS_REG_H */
+
+#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+
+/*
+ * Various register offset definitions for debuggers, core file
+ * examiners and whatnot.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995, 1999 Ralf Baechle
+ * Copyright (C) 1995, 1999 Silicon Graphics
+ */
+#ifndef _ASM_REG_H
+#define _ASM_REG_H
+
+/*
+ * This defines/structures correspond to the register layout on stack -
+ * if the order here is changed, it needs to be updated in
+ * include/asm-mips/stackframe.h
+ */
+#define EF_REG0			 0
+#define EF_REG1			 1
+#define EF_REG2			 2
+#define EF_REG3			 3
+#define EF_REG4			 4
+#define EF_REG5			 5
+#define EF_REG6			 6
+#define EF_REG7			 7
+#define EF_REG8			 8
+#define EF_REG9			 9
+#define EF_REG10		10
+#define EF_REG11		11
+#define EF_REG12		12
+#define EF_REG13		13
+#define EF_REG14		14
+#define EF_REG15		15
+#define EF_REG16		16
+#define EF_REG17		17
+#define EF_REG18		18
+#define EF_REG19		19
+#define EF_REG20		20
+#define EF_REG21		21
+#define EF_REG22		22
+#define EF_REG23		23
+#define EF_REG24		24
+#define EF_REG25		25
+/*
+ * k0/k1 unsaved
+ */
+#define EF_REG28		28
+#define EF_REG29		29
+#define EF_REG30		30
+#define EF_REG31		31
+
+/*
+ * Saved special registers
+ */
+#define EF_LO			32
+#define EF_HI			33
+
+#define EF_CP0_EPC		34
+#define EF_CP0_BADVADDR		35
+#define EF_CP0_STATUS		36
+#define EF_CP0_CAUSE		37
+
+#define EF_SIZE			304	/* size in bytes */
+
+#endif /* _ASM_REG_H */
+
+#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+
+#if _MIPS_SIM == _MIPS_SIM_ABI32

 struct user
 {
@@ -40,6 +187,24 @@
   char		u_comm[32];		/* user command name */
 };

+#else
+
+struct user {
+  __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
+  __extension__ unsigned long	u_tsize;	/* text size (pages) */
+  __extension__ unsigned long	u_dsize;	/* data size (pages) */
+  __extension__ unsigned long	u_ssize;	/* stack size (pages) */
+  __extension__ unsigned long long start_code;	/* text starting address */
+  __extension__ unsigned long long start_data;	/* data starting address */
+  __extension__ unsigned long long start_stack;	/* stack starting address */
+  __extension__ long long	signal;		/* signal causing core dump */
+  __extension__ unsigned long long u_ar0;	/* help gdb find registers */
+  __extension__ unsigned long long magic;	/* identifies a core file */
+  char		u_comm[32];		/* user command name */
+};
+
+#endif
+
 #define PAGE_SHIFT		12
 #define PAGE_SIZE		(1UL << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE-1))


const-ify some more data

const-ify some more data

--- rsvg-css.c
+++ rsvg-css.c
@@ -275,7 +275,7 @@

 typedef struct
 {
-	const char * name;
+	const char * const name;
 	guint rgb;
 } ColorPair;

@@ -377,7 +377,7 @@
 		UNSETINHERIT ();
 	else
 		{
-			const static ColorPair color_list [] =
+			static const ColorPair color_list [] =
 				{
 					{ "aliceblue",            PACK_RGB (240,248,255) },
 					{ "antiquewhite",         PACK_RGB (250,235,215) },


Fix dumb mistake, fdivr is no scalar3

Fix dumb mistake, fdivr is no scalar3

--- libhoomd/computes/EvaluatorWalls.h
+++ libhoomd/computes/EvaluatorWalls.h
@@ -167,7 +167,7 @@
                 if (!std::isfinite(force_divr))
                 #endif
                     {
-                        force_divr = Scalar3(0.0,0.0,0.0);
+                        force_divr = Scalar(0.0);
                         pair_eng = Scalar(0.0);
                     }
                 // add the force and potential energy to the particle i
@@ -203,7 +203,7 @@
                 if (!std::isfinite(force_divr))
                 #endif
                     {
-                        force_divr = Scalar3(0.0,0.0,0.0);
+                        force_divr = Scalar(0.0);
                         pair_eng = Scalar(0.0);
                     }
                 // add the force and potential energy to the particle i


Fixed tokenizing of patterns. [code]

Fixed tokenizing of patterns. [code]

--- liblouis/compileTranslationTable.c
+++ liblouis/compileTranslationTable.c
@@ -4100,21 +4100,15 @@
 			widechar patterns[512], buffer[256];
 			TranslationTableOffset offset;
 			int len, mrk;
-
-			//noback = 1;
-			getToken(nested, &ptn_before, "before pattern");
-			getToken(nested, &ruleChars, "chars pattern");
-			getToken(nested, &ptn_after, "after pattern");
-			getToken(nested, &ruleDots, "dots pattern");
-
-			if(!parseDots(nested, &cells, &ruleDots))
-			{
+
+			noback = 1;
+			getRuleCharsText(nested, &ptn_before);
+			getRuleCharsText(nested, &ruleChars);
+			getRuleCharsText(nested, &ptn_after);
+			getRuleDotsPattern(nested, &ruleDots);
+
+			if(!addRule(nested, opcode, &ruleChars, &ruleDots, 0, 0))
 				ok = 0;
-				break;
-			}
-			if(!addRule(nested, opcode, &ruleChars, &cells, 0, 0))
-				ok = 0;
-
 			len = pattern_compile(&ptn_before.chars[0], ptn_before.length, buffer, 256);
 			if(!len)
 			{
@@ -4123,7 +4117,7 @@
 			}
 			mrk = patterns[0] = len + 1;
 			pattern_reverse(buffer, &patterns[1]);
-
+
 			len = pattern_compile(&ptn_after.chars[0], ptn_after.length, &patterns[mrk], 256);
 			if(!len)
 			{
@@ -4131,16 +4125,16 @@
 				break;
 			}
 			len += mrk;
-
+
 			if(!allocateSpaceInTable(nested, &offset, len * sizeof(widechar)))
 			{
 				ok = 0;
 				break;
 			}
-
+
 			memcpy(&table->ruleArea[offset], patterns, len * sizeof(widechar));
 			newRule->patterns = offset;
-
+
 			break;
 		}


Bugfix to get rid of an erroneous error message.

--- liblouis/compileTranslationTable.c
+++ liblouis/compileTranslationTable.c
@@ -3616,7 +3616,7 @@
     {
       /* See if table in current directory or subdirectory */
       table = getTable (tableList);
-      if (!table)
+      if (!table  && errorCount == 1 && fileCount == 1)
 	/* See if table on installed path. */
 	{
 #ifdef _WIN32
@@ -3630,7 +3630,7 @@
 	  table = getTable (trialPath);
 	}
     }
-  if (!table)
+  if (!table && errorCount == 1 && fileCount == 1)
     lou_logPrint ("Cannot find %s", trialPath);
   return table;
 }


sync with glibc

sync with glibc

--- libpthread/linuxthreads/spinlock.c
+++ libpthread/linuxthreads/spinlock.c
@@ -108,7 +108,7 @@
 #ifdef BUSY_WAIT_NOP
       BUSY_WAIT_NOP;
 #endif
-      __asm __volatile ("" : "=m" (lock->__status) : "0" (lock->__status));
+      __asm __volatile ("" : "=m" (lock->__status) : "m" (lock->__status));
     }

     lock->__spinlock += (spin_count - lock->__spinlock) / 8;


tests: fs/fat_fs_dual_drive: check fs_seek return values

Inside test_file_truncate(), the results of fs_seek() are not
checked. So adds some checks there.

Fixes #13874
Fixes CID-190939

Signed-off-by: Daniel Leung <d94e04d205b5962d7873a139ef298b03c1717f72@intel.com>

--- tests/subsys/fs/fat_fs_dual_drive/src/test_fat_file.c
+++ tests/subsys/fs/fat_fs_dual_drive/src/test_fat_file.c
@@ -148,7 +148,13 @@
 		return res;
 	}

-	fs_seek(&filep, 0, FS_SEEK_END);
+	res = fs_seek(&filep, 0, FS_SEEK_END);
+	if (res) {
+		TC_PRINT("fs_seek failed after truncating file [%d]\n", res);
+		fs_close(&filep);
+		return res;
+	}
+
 	/* Verify fs_tell() */
 	if (fs_tell(&filep) > 0) {
 		TC_PRINT("Failed truncating to size 0\n");
@@ -163,7 +169,12 @@
 		return res;
 	}

-	fs_seek(&filep, 0, FS_SEEK_END);
+	res = fs_seek(&filep, 0, FS_SEEK_END);
+	if (res) {
+		TC_PRINT("fs_seek failed after writing to file [%d]\n", res);
+		fs_close(&filep);
+		return res;
+	}

 	orig_pos = fs_tell(&filep);
 	TC_PRINT("Original size of file = %ld\n", orig_pos);
@@ -177,7 +188,13 @@
 		return res;
 	}

-	fs_seek(&filep, 0, FS_SEEK_END);
+	res = fs_seek(&filep, 0, FS_SEEK_END);
+	if (res) {
+		TC_PRINT("fs_seek failed after shrinking file [%d]\n", res);
+		fs_close(&filep);
+		return res;
+	}
+
 	TC_PRINT("File size after shrinking by 5 bytes = %ld\n",
 						fs_tell(&filep));
 	if (fs_tell(&filep) != (orig_pos - 5)) {
@@ -188,7 +205,13 @@

 	/* Test expanding file */
 	TC_PRINT("Testing expanding\n");
-	fs_seek(&filep, 0, FS_SEEK_END);
+	res = fs_seek(&filep, 0, FS_SEEK_END);
+	if (res) {
+		TC_PRINT("fs_seek failed before expanding file [%d]\n", res);
+		fs_close(&filep);
+		return res;
+	}
+
 	orig_pos = fs_tell(&filep);
 	res = fs_truncate(&filep, orig_pos + 10);
 	if (res) {
@@ -197,7 +220,13 @@
 		return res;
 	}

-	fs_seek(&filep, 0, FS_SEEK_END);
+	res = fs_seek(&filep, 0, FS_SEEK_END);
+	if (res) {
+		TC_PRINT("fs_seek failed after expanding file [%d]\n", res);
+		fs_close(&filep);
+		return res;
+	}
+
 	TC_PRINT("File size after expanding by 10 bytes = %ld\n",
 						fs_tell(&filep));
 	if (fs_tell(&filep) != (orig_pos + 10)) {
@@ -208,7 +237,13 @@

 	/* Check if expanded regions are zeroed */
 	TC_PRINT("Testing for zeroes in expanded region\n");
-	fs_seek(&filep, -5, FS_SEEK_END);
+	res = fs_seek(&filep, -5, FS_SEEK_END);
+	if (res) {
+		TC_PRINT("fs_seek failed before testing for zeroes [%d]\n",
+			 res);
+		fs_close(&filep);
+		return res;
+	}

 	brw = fs_read(&filep, read_buff, 5);


GenFw: PeCoffConvertImageToXip overwrites file headers

If a section had an offset which overlapped with the executable headers
then the headers would be overwritten by PeCoffConvertImageToXip.
Now, this function will abort the conversion to XIP if this situation
is detected.

git-svn-id: f3880c1fc5096ce2109c8aec392d8e07f619f417@1776 c2973edb-eda0-4c78-bc6a-9341b269661f

--- Source/C/GenFw/GenFw.c
+++ Source/C/GenFw/GenFw.c
@@ -1449,6 +1449,16 @@
     }
   }

+  if (FirstSectionOffset < PeHdr->Pe32.OptionalHeader.SizeOfHeaders) {
+    //
+    // If one of the sections should be loaded to an offset overlapping with
+    // the executable header, then it cannot be made into an XIP image.
+    //
+    VerboseMsg ("PE/COFF conversion to XIP is impossible due to overlap");
+    VerboseMsg ("of section data with the executable header.");
+    return;
+  }
+
   if (FirstSectionOffset == *FileLength) {
     //
     // If we never found a section with a non-zero size, then we
@@ -1482,9 +1492,9 @@
   memset (XipFile, 0, XipLength);

   //
-  // Copy all the headers over (anything before the first section data)
-  //
-  memcpy (XipFile, *FileBuffer, FirstSectionOffset);
+  // Copy the file headers
+  //
+  memcpy (XipFile, *FileBuffer, PeHdr->Pe32.OptionalHeader.SizeOfHeaders);

   NewPeHdr = GetPeCoffHeader ((void *)XipFile);
   if (NewPeHdr == NULL) {


Add T...Create() macro, that calls +new

Add T...Create() macro, that calls +new

--- Sources/TCollections.h
+++ Sources/TCollections.h
@@ -87,6 +87,7 @@

 #define TArray(Type)                        _TConcat2(Type, Array)
 #define TArrayAlloc(Type)                   ( (TArray(Type)) [NSArray alloc] )
+#define TArrayCreate(Type)                  ( (TArray(Type)) [NSArray new] )
 #define TArrayMake(Type, Objects...)        _TCollectionMake(TArray, Type, Objects)
 #define TArrayFromVariadic(Type, First)     _TCollectionFromVariadic(TMutableArray, Type, First)
 #define _TArrayForward(Type) \
@@ -99,6 +100,7 @@

 #define TMutableArray(Type)                     _TConcat2(Type, MutableArray)
 #define TMutableArrayAlloc(Type)                ( (TMutableArray(Type)) [NSMutableArray alloc] )
+#define TMutableArrayCreate(Type)               ( (TMutableArray(Type)) [NSMutableArray new] )
 #define TMutableArrayMake(Type, Objects...)     _TCollectionMake(TMutableArray, Type, Objects)
 #define TMutableArrayFromVariadic(Type, First)  _TCollectionFromVariadic(TMutableArray, Type, First)
 #define _TMutableArrayForward(Type) \
@@ -112,6 +114,7 @@

 #define TSet(Type)                      _TConcat2(Type, Set)
 #define TSetAlloc(Type)                 ( (TSet(Type)) [NSSet alloc] )
+#define TSetCreate(Type)                ( (TSet(Type)) [NSSet new] )
 #define TSetMake(Type, Objects...)      _TCollectionMake(TSet, Type, Objects)
 #define TSetFromVariadic(Type, First)   _TCollectionFromVariadic(TMutableSet, Type, First)
 #define _TSetForward(Type) \
@@ -124,6 +127,7 @@

 #define TMutableSet(Type)                       _TConcat2(Type, MutableSet)
 #define TMutableSetAlloc(Type)                  ( (TMutableSet(Type)) [NSMutableSet alloc] )
+#define TMutableSetCreate(Type)                 ( (TMutableSet(Type)) [NSMutableSet new] )
 #define TMutableSetMake(Type, Objects...)       _TCollectionMake(TMutableSet, Type, Objects)
 #define TMutableSetFromVariadic(Type, First)    _TCollectionFromVariadic(TMutableSet, Type, First)
 #define _TMutableSetForward(Type) \
@@ -136,6 +140,7 @@

 #define TCountedSet(Type)                       _TConcat2(Type, CountedSet)
 #define TCountedSetAlloc(Type)                  ( (TCountedSet(Type)) [NSCountedSet alloc] )
+#define TCountedSetCreate(Type)                 ( (TCountedSet(Type)) [NSCountedSet new] )
 #define TCountedSetMake(Type, Objects...)       _TCollectionMake(TCountedSet, Type, Objects)
 #define TCountedSetFromVariadic(Type, First)    _TCollectionFromVariadic(TCountedSet, Type, First)
 #define _TCountedSetForward(Type) \
@@ -149,6 +154,7 @@

 #define TOrderedSet(Type)                       _TConcat2(Type, OrderedSet)
 #define TOrderedSetAlloc(Type)                  ( (TOrderedSet(Type)) [NSOrderedSet alloc] )
+#define TOrderedSetCreate(Type)                 ( (TOrderedSet(Type)) [NSOrderedSet new] )
 #define TOrderedSetMake(Type, Objects...)       _TCollectionMake(TOrderedSet, Type, Objects)
 #define TOrderedSetFromVariadic(Type, First)    _TCollectionFromVariadic(TMutableOrderedSet, Type, First)
 #define _TOrderedSetForward(Type) \
@@ -161,6 +167,7 @@

 #define TMutableOrderedSet(Type)                    _TConcat2(Type, MutableOrderedSet)
 #define TMutableOrderedSetAlloc(Type)               ( (TMutableOrderedSet(Type)) [NSMutableOrderedSet alloc] )
+#define TMutableOrderedSetCreate(Type)              ( (TMutableOrderedSet(Type)) [NSMutableOrderedSet new] )
 #define TMutableOrderedSetMake(Type, Objects...)    _TCollectionMake(TMutableOrderedSet, Type, Objects)
 #define TMutableOrderedSetFromVariadic(Type, First) _TCollectionFromVariadic(TMutableOrderedSet, Type, First)
 #define _TMutableOrderedSetForward(Type) \
@@ -186,6 +193,7 @@

 #define TDictionary(Key, Value)                 _TConcat4(Key, To, Value, Dictionary)
 #define TDictionaryAlloc(Key, Value)            ( (TDictionary(Key, Value)) [NSDictionary alloc] )
+#define TDictionaryCreate(Key, Value)           ( (TDictionary(Key, Value)) [NSDictionary new] )
 #define TDictionaryMake(Key, Value, TPairs...)  ( (TDictionary(Key, Value)) _TAssociativeCollectionMake(TMutableDictionary, Key, Value, TPairs) )
 #define _TDictionaryForward(Key, Value) \
     @protocol _TConcat4(TDictionary_, Key, _, Value); \
@@ -197,6 +205,7 @@

 #define TMutableDictionary(Key, Value)                  _TConcat4(Key, To, Value, MutableDictionary)
 #define TMutableDictionaryAlloc(Key, Value)             ( (TMutableDictionary(Key, Value)) [NSMutableDictionary alloc] )
+#define TMutableDictionaryCreate(Key, Value)            ( (TMutableDictionary(Key, Value)) [NSMutableDictionary new] )
 #define TMutableDictionaryMake(Key, Value, TPairs...)   _TAssociativeCollectionMake(TMutableDictionary, Key, Value, TPairs)
 #define _TMutableDictionaryForward(Key, Value) \
     @protocol _TConcat4(TMutableDictionary_, Key, _, Value); \
@@ -208,6 +217,7 @@

 #define TCache(Key, Value)                  _TConcat4(Key, To, Value, Cache)
 #define TCacheAlloc(Key, Value)             ( (TCache(Key, Value)) [NSCache alloc] )
+#define TCacheCreate(Key, Value)            ( (TCache(Key, Value)) [NSCache new] )
 #define TCacheMake(Key, Value, TPairs...)   _TAssociativeCollectionMake(TCache, Key, Value, TPairs)
 #define _TCacheForward(Key, Value) \
     @protocol _TConcat4(TCache_, Key, _, Value); \


minor tweak

minor tweak

--- slashd/jreplay.c
+++ slashd/jreplay.c
@@ -138,12 +138,12 @@

 		bmap_op_start_type(b, BMAP_OPCNT_WORK);

-		/* a no-op will gather the locks for us */
-		brepls_init(tract, -1);
-
 		FCMH_WAIT_BUSY(b->bcm_fcmh);
 		BMAP_LOCK(b);
 		bmap_wait_locked(b, b->bcm_flags & BMAPF_REPLMODWR);
+
+		/* a no-op will gather the locks for us */
+		brepls_init(tract, -1);

 		mds_repl_bmap_walk_all(b, tract, NULL, 0);


use a pointer we actually have

use a pointer we actually have

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

--- slashd/mdsrepl.c
+++ slashd/mdsrepl.c
@@ -615,7 +615,7 @@
 				    slstrerror(rc));

 			/* Find/add our replica's IOS ID */
-			rc = mds_repl_iosv_lookup_add(rrq->rrq_inoh,
+			rc = mds_repl_iosv_lookup_add(fcmh_2_inoh(fcmh),
 			    iosv, iosidx, nios);
 			if (rc)
 				goto bail;


dont use mp after the pscrpc_req_finished()

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

--- slashd/sitemon.c
+++ slashd/sitemon.c
@@ -125,8 +125,10 @@
 	BMAP_ULOCK(bcm);

 	rc = RSX_WAITREP(rq, mp);
+	if (rc == 0)
+		rc = mp->rc;
 	pscrpc_req_finished(rq);
-	if (rc == 0 && mp->rc == 0) {
+	if (rc == 0) {
 		mds_repl_bmap_rel(bcm);
 		mds_repl_unrefrq(rrq);
 		return (1);


formatting

formatting

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

--- sliod/bmap_iod.c
+++ sliod/bmap_iod.c
@@ -268,7 +268,8 @@

 			bmap_op_done_type(b, BMAP_OPCNT_RLSSCHED);

-		} while ((i < MAX_BMAP_RELEASE) && (biod = lc_getnb(&bmapRlsQ)));
+		} while ((i < MAX_BMAP_RELEASE) &&
+			 (biod = lc_getnb(&bmapRlsQ)));

 		if (!i)
 			goto end;


tidy naming conventions

tidy naming conventions

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

--- sliod/bmap_iod.c
+++ sliod/bmap_iod.c
@@ -332,7 +332,7 @@
 }

 void
-sliod_bmaprlsthr_main(__unusedx struct psc_thread *thr)
+slibmaprlsthr_main(__unusedx struct psc_thread *thr)
 {
 	struct psc_dynarray a = DYNARRAY_INIT;
 	struct srm_bmap_release_req *brr, *mq;
@@ -433,13 +433,13 @@
 }

 void
-sliod_bmaprlsthr_spawn(void)
-{
-	lc_reginit(&bmapRlsQ, struct bmap_iod_info,
-		   biod_lentry, "bmapRlsQ");
-
-	pscthr_init(SLITHRT_BMAPRLS, 0, sliod_bmaprlsthr_main,
-		    NULL, 0, "slibmaprlsthr");
+slibmaprlsthr_spawn(void)
+{
+	lc_reginit(&bmapRlsQ, struct bmap_iod_info, biod_lentry,
+	    "bmapRlsQ");
+
+	pscthr_init(SLITHRT_BMAPRLS, 0, slibmaprlsthr_main, NULL, 0,
+	    "slibmaprlsthr");
 }

 void


before scheduling a new crcup to go out, check to see if one is already in flight for on the same bmap, and place it on the hold list instead.  this addresses the multiple bcr scheduling crash we see about once a day under regular stress

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

--- sliod/bmap_iod.c
+++ sliod/bmap_iod.c
@@ -305,7 +305,8 @@
 				psc_assert(bii->bii_bcr == tmp ||
 					   !bii->bii_bcr);
 				if (tmp->bcr_crcup.nups ==
-				    MAX_BMAP_INODE_PAIRS) {
+				    MAX_BMAP_INODE_PAIRS &&
+				    !(b->bcm_flags & BMAP_IOD_INFLIGHT)) {
 					bii->bii_bcr = NULL;
 					bcr_ready_add(inf, tmp);
 				} else


unused

unused

--- sliod/fidc_iod.c
+++ sliod/fidc_iod.c
@@ -103,7 +103,7 @@
 static int
 sli_open_backing_file(struct fidc_membh *f)
 {
-	int lvl = PLL_DIAG, incr, rc = 0;
+	int lvl = PLL_DIAG, rc = 0;
 	char fidfn[PATH_MAX];

 	sli_fg_makepath(&f->fcmh_fg, fidfn);


spacing

spacing

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

--- sliod/fidc_iod.h
+++ sliod/fidc_iod.h
@@ -41,7 +41,7 @@

 #define sli_fcmh_get(fgp, fp)	fidc_lookup((fgp), FIDC_LOOKUP_CREATE, NULL, 0, (fp))

-#define sli_fcmh_get_rlsbmap(fgp, fp)	\
+#define sli_fcmh_get_rlsbmap(fgp, fp)						\
 				fidc_lookup((fgp), FIDC_LOOKUP_CREATE |		\
 				    FIDC_LOOKUP_RLSBMAP, NULL, 0, (fp))


system headers always come first unless absolutely necessary

--- sliod/repl_iod.c
+++ sliod/repl_iod.c
@@ -28,6 +28,8 @@
  * we can get bursty.
  */

+#include <sys/statvfs.h>
+
 #include <stdio.h>

 #include "pfl/atomic.h"
@@ -49,8 +51,6 @@
 #include "slerr.h"
 #include "sliod.h"
 #include "sltypes.h"
-
-#include <sys/statvfs.h>

 struct psc_poolmaster	 sli_replwkrq_poolmaster;
 struct psc_poolmgr	*sli_replwkrq_pool;


comment

comment

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

--- sliod/repl_iod.h
+++ sliod/repl_iod.h
@@ -50,7 +50,7 @@

 	uint32_t		 srw_status;		/* return code to pass back to MDS */
 	psc_spinlock_t		 srw_lock;
-	psc_atomic32_t		 srw_refcnt;
+	psc_atomic32_t		 srw_refcnt;		/* one ref for pending list, one for each sliver */
 	int			 srw_nslvr_tot;
 	int			 srw_nslvr_cur;


confirm: fix stupid bug, use opt_manage framework

--- ir/ana/irconsconfirm.c
+++ ir/ana/irconsconfirm.c
@@ -42,6 +42,7 @@
 #include "debug.h"
 #include "error.h"
 #include "irflag.h"
+#include "opt_manage.h"

 /**
  * Walker environment.
@@ -441,7 +442,7 @@
 	if (is_Switch(cond)) {
 		long proj_nr = get_Proj_proj(proj);
 		handle_case(block, cond, proj_nr, env);
-	} else if (is_Const(cond)) {
+	} else if (is_Cond(cond)) {
 		ir_node *selector = get_Cond_selector(cond);
 		ir_relation rel;

@@ -565,25 +566,13 @@
 /*
  * Construct Confirm nodes
  */
-void construct_confirms(ir_graph *irg)
+static ir_graph_state_t do_construct_confirms(ir_graph *irg)
 {
 	env_t env;
-	int edges_active = edges_activated(irg);
-
 	FIRM_DBG_REGISTER(dbg, "firm.ana.confirm");
-
-	remove_critical_cf_edges(irg);
-
-	/* we need dominance info */
-	assure_doms(irg);

 	assert(get_irg_pinned(irg) == op_pin_state_pinned &&
 	       "Nodes must be placed to insert Confirms");
-
-	if (! edges_active) {
-		/* We need edges */
-		edges_activate(irg);
-	}

 	env.num_confirms = 0;
 	env.num_consts   = 0;
@@ -602,10 +591,20 @@
 	DB((dbg, LEVEL_1, "# Const replacements: %u\n", env.num_consts));
 	DB((dbg, LEVEL_1, "# node equalities   : %u\n", env.num_eq));
 	DB((dbg, LEVEL_1, "# non-null Confirms : %u\n", env.num_non_null));
-
-	/* deactivate edges if they where off */
-	if (! edges_active)
-		edges_deactivate(irg);
+	return 0;
+}
+
+static optdesc_t opt_confirms = {
+	"confirms",
+	IR_GRAPH_STATE_CONSISTENT_OUT_EDGES
+	| IR_GRAPH_STATE_CONSISTENT_DOMINANCE
+	| IR_GRAPH_STATE_NO_CRITICAL_EDGES,
+	do_construct_confirms
+};
+
+void construct_confirms(ir_graph *irg)
+{
+	perform_irg_optimization(irg, &opt_confirms);
 }

 /* Construct a pass. */


bechordal: Do not re-fetch a value, which we already have.

--- ir/be/bechordal_main.c
+++ ir/be/bechordal_main.c
@@ -229,7 +229,7 @@
 {
 	chordal_env->cls              = cls;
 	chordal_env->border_heads     = pmap_create();
-	chordal_env->allocatable_regs = bitset_malloc(chordal_env->cls->n_regs);
+	chordal_env->allocatable_regs = bitset_malloc(cls->n_regs);

 	be_assure_live_chk(irg);

@@ -237,7 +237,7 @@
 	be_put_allocatable_regs(irg, cls, chordal_env->allocatable_regs);

 	be_timer_push(T_RA_CONSTR);
-	be_pre_spill_prepare_constr(irg, chordal_env->cls);
+	be_pre_spill_prepare_constr(irg, cls);
 	be_timer_pop(T_RA_CONSTR);

 	dump(BE_CH_DUMP_CONSTR, irg, cls, "constr-pre");


jumpthreading: fix some cases where loops would be produced without Phi[loop] inside

The problem was that we have to force SSA construction for memory values to
ensure the presence of the Phi[loop] nodes. Previously we did not do it
if we didn't introduce new values.

This fixes firm-testsuite/opt/jumpthreading8.c

--- ir/opt/jumpthreading.c
+++ ir/opt/jumpthreading.c
@@ -127,7 +127,7 @@
                           ir_node *second_block, ir_node *second_val)
 {
 	/* no need to do anything */
-	if (orig_val == second_val)
+	if (orig_val == second_val && !(is_Phi(orig_val) && get_Phi_loop(orig_val)))
 		return;

 	ir_graph *irg = get_irn_irg(orig_val);
@@ -137,8 +137,13 @@
 	set_irn_link(orig_block, orig_val);
 	mark_irn_visited(orig_block);

-	ssa_second_def_block = second_block;
-	ssa_second_def       = second_val;
+	if (orig_val == second_val) {
+		/* In the loop-phi case setting a 2nd def is wrong */
+		ssa_second_def_block = NULL;
+	} else {
+		ssa_second_def_block = second_block;
+		ssa_second_def       = second_val;
+	}

 	/* Only fix the users of the first, i.e. the original node */
 	foreach_out_edge_safe(orig_val, edge) {
@@ -304,8 +309,8 @@
 			continue;
 #endif

-		DB((dbg, LEVEL_2, ">> Fixing users of %+F\n", node));
 		ir_node *copy_node = (ir_node*)get_irn_link(node);
+		DB((dbg, LEVEL_2, ">> Fixing users of %+F (copy %+F)\n", node, copy_node));
 		construct_ssa(block, node, copy_block, copy_node);
 	}

@@ -649,6 +654,11 @@

 	ir_free_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_IRN_VISITED);

-	confirm_irg_properties(irg,
-		changed ? IR_GRAPH_PROPERTIES_NONE : IR_GRAPH_PROPERTIES_ALL);
-}
+	if (changed) {
+		/* we tend to produce alot of duplicated keep edges, remove them */
+		remove_End_Bads_and_doublets(get_irg_end(irg));
+		confirm_irg_properties(irg, IR_GRAPH_PROPERTIES_NONE);
+	} else {
+		confirm_irg_properties(irg, IR_GRAPH_PROPERTIES_ALL);
+	}
+}


is_SubClass_of() check only once for transitive closure state

[r8494]

--- ir/tr/tr_inheritance.c
+++ ir/tr/tr_inheritance.c
@@ -471,17 +471,9 @@
 /* Classify pairs of types/entities in the inheritance relations.          */
 /* ----------------------------------------------------------------------- */

-/* Returns true if low is subclass of high. */
-int is_SubClass_of(ir_type *low, ir_type *high) {
+/** Returns true if low is subclass of high. */
+static int check_is_SubClass_of(ir_type *low, ir_type *high) {
   int i, n_subtypes;
-  assert(is_Class_type(low) && is_Class_type(high));
-
-  if (low == high) return 1;
-
-  if (get_irp_inh_transitive_closure_state() == inh_transitive_closure_valid) {
-    pset *m = get_type_map(high, d_down);
-    return pset_find_ptr(m, low) ? 1 : 0;
-  }

   /* depth first search from high downwards. */
   n_subtypes = get_class_n_subtypes(high);
@@ -492,6 +484,19 @@
       return 1;
   }
   return 0;
+}
+
+/* Returns true if low is subclass of high. */
+int is_SubClass_of(ir_type *low, ir_type *high) {
+  assert(is_Class_type(low) && is_Class_type(high));
+
+  if (low == high) return 1;
+
+  if (get_irp_inh_transitive_closure_state() == inh_transitive_closure_valid) {
+    pset *m = get_type_map(high, d_down);
+    return pset_find_ptr(m, low) ? 1 : 0;
+  }
+  return check_is_SubClass_of(low, high);
 }