Moving init/end functions, moving compressSuperBlock inside body()

--- lib/compress/zstd_compress.c
+++ lib/compress/zstd_compress.c
@@ -2457,54 +2457,46 @@
     zc->blockState.nextCBlock = tmp;
 }

-static size_t ZSTD_compressBlock_targetCBlockSize_init(ZSTD_CCtx* zc,
-                               void* dst, size_t dstCapacity,
+static size_t ZSTD_compressBlock_targetCBlockSize_body(ZSTD_CCtx* zc,
+                               const size_t bss, void* dst, size_t dstCapacity,
                                const void* src, size_t srcSize,
                                U32 lastBlock)
 {
-    const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize);
-    FORWARD_IF_ERROR(bss);
-    if (bss == ZSTDbss_compress)
-        return ZSTD_compressSuperBlock(zc, dst, dstCapacity, lastBlock);
-    return 0;
-}
-
-static void ZSTD_compressBlock_targetCBlockSize_end(ZSTD_CCtx* zc)
-{
-    if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid)
-        zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check;
-}
-
-static size_t ZSTD_compressBlock_targetCBlockSize_body(ZSTD_CCtx* zc,
-                               size_t cSize, void* dst, size_t dstCapacity,
-                               const void* src, size_t srcSize,
-                               U32 lastBlock)
-{
-    /* Superblock compression was successful */
-    if (cSize != 0) {
-        ZSTD_confirmRepcodesAndEntropyTables(zc);
-        return cSize;
+    /* Attempt superblock compression and return early if successful */
+    {
+        if (bss == ZSTDbss_compress) {
+            size_t cSize = ZSTD_compressSuperBlock(zc, dst, dstCapacity, lastBlock);
+            FORWARD_IF_ERROR(cSize);
+            if (cSize != 0) {
+                ZSTD_confirmRepcodesAndEntropyTables(zc);
+                return cSize;
+            }
+        }
     }

     /* Superblock compression failed, attempt to emit noCompress superblocks
      * and return early if that is successful and we have enough room for checksum */
-    cSize = ZSTD_noCompressSuperBlock(dst, dstCapacity, src, srcSize, zc->appliedParams.targetCBlockSize, lastBlock);
-    if (cSize != ERROR(dstSize_tooSmall) && (dstCapacity - cSize) >= 4)
-        return cSize;
+    {
+        size_t cSize = ZSTD_noCompressSuperBlock(dst, dstCapacity, src, srcSize, zc->appliedParams.targetCBlockSize, lastBlock);
+        if (cSize != ERROR(dstSize_tooSmall) && (dstCapacity - cSize) >= 4)
+            return cSize;
+    }

     /* noCompress superblock emission failed. Attempt to compress normally
      * and return early if that is successful */
-    cSize = ZSTD_compressSequences(&zc->seqStore,
-        &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy,
-        &zc->appliedParams, (BYTE*)dst+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize,
-        srcSize, zc->entropyWorkspace, HUF_WORKSPACE_SIZE, zc->bmi2);
-    FORWARD_IF_ERROR(cSize);
-    if (cSize != 0) {
-        U32 const cBlockHeader24 = lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3);
-        MEM_writeLE24((BYTE*)dst, cBlockHeader24);
-        cSize += ZSTD_blockHeaderSize;
-        ZSTD_confirmRepcodesAndEntropyTables(zc);
-        return cSize;
+    {
+        size_t cSize = ZSTD_compressSequences(&zc->seqStore,
+            &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy,
+            &zc->appliedParams, (BYTE*)dst+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize,
+            srcSize, zc->entropyWorkspace, HUF_WORKSPACE_SIZE, zc->bmi2);
+        FORWARD_IF_ERROR(cSize);
+        if (cSize != 0) {
+            U32 const cBlockHeader24 = lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3);
+            MEM_writeLE24((BYTE*)dst, cBlockHeader24);
+            cSize += ZSTD_blockHeaderSize;
+            ZSTD_confirmRepcodesAndEntropyTables(zc);
+            return cSize;
+        }
     }

     /* Everything failed. Just emit a regular noCompress block */
@@ -2517,13 +2509,17 @@
                                U32 lastBlock)
 {
     size_t cSize = 0;
+    const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize);
     DEBUGLOG(5, "ZSTD_compressBlock_targetCBlockSize (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u, srcSize=%zu)",
                 (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit, (unsigned)zc->blockState.matchState.nextToUpdate, srcSize);
-    cSize = ZSTD_compressBlock_targetCBlockSize_init(zc, dst, dstCapacity, src, srcSize, lastBlock);
+    FORWARD_IF_ERROR(bss);
+
+    cSize = ZSTD_compressBlock_targetCBlockSize_body(zc, bss, dst, dstCapacity, src, srcSize, lastBlock);
     FORWARD_IF_ERROR(cSize);
-    cSize = ZSTD_compressBlock_targetCBlockSize_body(zc, cSize, dst, dstCapacity, src, srcSize, lastBlock);
-    FORWARD_IF_ERROR(cSize);
-    ZSTD_compressBlock_targetCBlockSize_end(zc);
+
+    if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid)
+        zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check;
+
     return cSize;
 }


add info_string

add info_string

--- firmware/opcn2-library.h
+++ firmware/opcn2-library.h
@@ -168,8 +168,8 @@
         void toggle_laser(bool state);
         histogram_data histogram();
         config_variables config();
+        */
         String info_string();
-        */

         String firmware_version;
     };


cleanup: prevent behavior change from a gRPC change (#6565)

This class currently encourages an ownership hack that works around a gRPC API
issue that is [being fixed](https://github.com/grpc/proposal/pull/238). At that
point the tests that use this class will start failing, because they manage it
using **two different `std::unique_ptr` objects**.

Prevent them failing by overriding the upcoming `Destroy` method to do nothing.
This preserves the existing behavior. Because I haven't used the `override`
keyword, this works before and after the gRPC change, decoupling this issue
from the import of the gRPC change.

Longer term it would be better to make the use of this class not require the
ownership hack at all, but that is a larger project. In the meantime this
change unblocks fixing the need for such hacks for other subclasses that don't
want to further promulgate the issue.

--- google/cloud/bigtable/testing/mock_response_reader.h
+++ google/cloud/bigtable/testing/mock_response_reader.h
@@ -79,8 +79,10 @@
  *
  * Note that using this mock often requires special memory management. The
  * google mock library requires all mocks to be destroyed. In contrast, grpc
- * specializes `std::unique_ptr<>` to *not* delete objects of type
- * `grpc::ClientAsyncResponseReaderInterface<T>`:
+ * previously specialized `std::unique_ptr<>` to *not* delete objects of type
+ * `grpc::ClientAsyncResponseReaderInterface<T>` (and our override of the
+ * Destroy method below preserves that behavior even after
+ * https://github.com/grpc/proposal/pull/238):
  *
  *
  *     https://github.com/grpc/grpc/blob/608188c680961b8506847c135b5170b41a9081e8/include/grpcpp/impl/codegen/async_unary_call.h#L305
@@ -111,6 +113,15 @@
   MOCK_METHOD(void, StartCall, (), (override));
   MOCK_METHOD(void, ReadInitialMetadata, (void*), (override));
   MOCK_METHOD(void, Finish, (Response*, grpc::Status*, void*), (override));
+
+  // Preserve the behavior from before https://github.com/grpc/proposal/pull/238
+  // of not destroying the object when
+  // std::unique_ptr<grpc::ClientAsyncResponseReaderInterface> goes out of
+  // scope.
+  //
+  // TODO(#6566): mark this with the override keyword once the method exists in
+  // the parent class.
+  virtual void Destroy() {}
 };

 template <typename Response>


contents moved to isc/region.h

contents moved to isc/region.h

--- lib/dns/include/dns/region.h
+++ lib/dns/include/dns/region.h
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 1998  Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#define isc_region_consume(r,l) \
-	do { \
-		isc_region_t *__r = (r); \
-		unsigned int __l = (l); \
-		INSIST(__r->length >= __l); \
-		__r->base += __l; \
-		__r->length -= __l; \
-	} while (0)
-
-#define isc_textregion_consume(r,l) \
-	do { \
-		isc_textregion_t *__r = (r); \
-		unsigned int __l = (l); \
-		INSIST(__r->length >= __l); \
-		__r->base += __l; \
-		__r->length -= __l; \
-	} while (0)


code review changes

code review changes

--- lib/dns/rdata/generic/mg_8.c
+++ lib/dns/rdata/generic/mg_8.c
@@ -15,7 +15,7 @@
  * SOFTWARE.
  */

- /* $Id: mg_8.c,v 1.18 2000/02/03 23:43:02 halley Exp $ */
+ /* $Id: mg_8.c,v 1.19 2000/03/16 01:40:27 brister Exp $ */

 #ifndef RDATA_GENERIC_MG_8_C
 #define RDATA_GENERIC_MG_8_C
@@ -31,7 +31,7 @@

 	REQUIRE(type == 8);

-	rdclass = rdclass;	/*unused*/
+	UNUSED(rdclass);

 	RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));

@@ -73,7 +73,7 @@

 	REQUIRE(type == 8);

-	rdclass = rdclass;	/*unused*/
+	UNUSED(rdclass);

 	if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
 		dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
@@ -85,7 +85,8 @@
 }

 static inline isc_result_t
-towire_mg(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
+towire_mg(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
+{
 	dns_name_t name;
 	isc_region_t region;

@@ -104,7 +105,8 @@
 }

 static inline int
-compare_mg(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
+compare_mg(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
+{
 	dns_name_t name1;
 	dns_name_t name2;
 	isc_region_t region1;
@@ -133,27 +135,29 @@

 	REQUIRE(type == 8);

-	rdclass = rdclass;	/*unused*/
+	UNUSED(rdclass);

-	source = source;
-	target = target;
+	UNUSED(source);
+	UNUSED(target);

 	return (DNS_R_NOTIMPLEMENTED);
 }

 static inline isc_result_t
-tostruct_mg(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
+tostruct_mg(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
+{

 	REQUIRE(rdata->type == 8);

-	target = target;
-	mctx = mctx;
+	UNUSED(target);
+	UNUSED(mctx);

 	return (DNS_R_NOTIMPLEMENTED);
 }

 static inline void
-freestruct_mg(void *source) {
+freestruct_mg(void *source)
+{
 	REQUIRE(source != NULL);
 	REQUIRE(ISC_FALSE);	/*XXX*/
 }
@@ -171,7 +175,8 @@
 }

 static inline isc_result_t
-digest_mg(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
+digest_mg(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
+{
 	isc_region_t r;
 	dns_name_t name;


iommu: reformatting in a few places

iommu: reformatting in a few places

Signed-off-by: Reto Achermann <66f6ea3e040423755b3cf26edfe6c7fb1f9adc27@inf.ethz.ch>

--- lib/driverkit/iommu_client.c
+++ lib/driverkit/iommu_client.c
@@ -59,7 +59,8 @@

 static void iommu_bind_cb(void *argst,  errval_t err, struct iommu_binding *ib)
 {
-    DRIVERKIT_DEBUG("[iommu client] bound to service: %s\n", err_getstring(err));
+    DRIVERKIT_DEBUG("[iommu client] bound to service: %s\n",
+                    err_getstring(err));

     struct iommu_client *st = argst;

@@ -96,7 +97,8 @@

     errval_t msgerr;
     uint8_t type, bits;
-    err = icl->binding->rpc_tx_vtbl.getvmconfig(icl->binding, &msgerr, &type, &bits);
+    err = icl->binding->rpc_tx_vtbl.getvmconfig(icl->binding, &msgerr, &type,
+                                                &bits);
     if (err_is_fail(err)) {
         driverkit_iommu_client_disconnect(icl);
         goto err_out;
@@ -511,7 +513,8 @@
     assert(cl);

     errval_t msgerr;
-    err = cl->binding->rpc_tx_vtbl.modify(cl->binding, dest, slot, attrs, &msgerr);
+    err = cl->binding->rpc_tx_vtbl.modify(cl->binding, dest, slot, attrs,
+                                          &msgerr);
     if (err_is_ok(err)) {
         err = msgerr;
     }


Oh yeah, it's an XInput symbol

Oh yeah, it's an XInput symbol

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

--- src/video/x11/SDL_x11sym.h
+++ src/video/x11/SDL_x11sym.h
@@ -36,7 +36,6 @@
 SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSetWindowAttributes* d),(a,b,c,d),return)
 SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return)
 SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return)
-SDL_X11_SYM(int,XCloseDevice,(Display* a,XDevice* b),(a,b),return)
 SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return)
 SDL_X11_SYM(int,XCopyArea,(Display* a,Drawable b,Drawable c,GC d,int e,int f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
 SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
@@ -229,6 +228,7 @@
 SDL_X11_SYM(void,XFreeDeviceList,(XDeviceInfo *a),(a),)
 SDL_X11_SYM(int,XSelectExtensionEvent,(Display *a,Window b,XEventClass *c,int d),(a,b,c,d),return)
 SDL_X11_SYM(XDevice*,XOpenDevice,(Display *a,XID b),(a,b),return)
+SDL_X11_SYM(int,XCloseDevice,(Display* a,XDevice* b),(a,b),return)
 #endif

 /* *INDENT-ON* */


Update SortingUtils.c

Update SortingUtils.c

--- src/common/SortingUtils.c
+++ src/common/SortingUtils.c
@@ -23,7 +23,7 @@
 	length--;

 	for ( ; i < length; i++ ) {
-		for ( j = 0; j < length - i; i++ ) {
+		for ( j = 0; j < length - i; j++ ) {
 			if ( cmp(vector[j], vector[j + 1], data) > 0 ) {
 				SU_SWAP(vector[j], vector[j + 1]);
 			}
@@ -51,7 +51,7 @@
 	for ( i = 1; i < length; i++) {
 		lower_index = i - 1;
 		for ( j = i; j < length; j++) {
-			if ( cmp(vector[lower_index], vector[j], data) > 0 ) {
+			if ( cmp(vector[j], vector[lower_index], data) < 0 ) {
 				lower_index = j;
 			}
 		}
@@ -85,7 +85,7 @@
 		while ( j-- ) {
 			// If the current element is smaller than the left one
 			// Move left element one position to the rigth
-			if ( cmp(unsorted, vector[j], data) > 0 ) {
+			if ( cmp(unsorted, vector[j], data) < 0 ) {
 				SU_SWAP(vector[j], vector[j + 1]);
 			} else {
 				// Else we stop, we have to insert element on j + 1
@@ -121,7 +121,7 @@
 	}

 	for ( i = 1; i < length; i++) {
-		if ( cmp(vector[i], vector[pivot_index], data) > 0 ) {
+		if ( cmp(vector[i], vector[pivot_index], data) < 0 ) {
 			// if element is smaller than the pivot
 			// swap it with the first element greater than it
 			// So the first element greater than it is potencially the next one
@@ -158,7 +158,7 @@
 	int *i1 = (int *) v1;
 	int *i2 = (int *) v2;

-	return *i1 - *i2;
+	return *i2 - *i1;
 }

 /**


vp8parse: Set framerate once caps are set

Change-Id: I1b009000614ef048480a8e54b32b338ee2a17b81

--- src/vp8parse/kmsvp8parse.c
+++ src/vp8parse/kmsvp8parse.c
@@ -122,7 +122,6 @@

   g_value_init (&value, GST_TYPE_FRACTION);
   gst_value_set_fraction (&value, (GST_SECOND / duration) * 1000, 1000);
-
   num = gst_value_get_fraction_numerator (&value);
   denom = gst_value_get_fraction_denominator (&value);

@@ -137,11 +136,6 @@
       GST_INFO_OBJECT (self, "Updating fps denom: %d", denom);
       self->priv->framerate_denom = denom;
       update_caps = TRUE;
-    }
-
-    if (self->priv->framerate_denom != -1 && self->priv->framerate_num != -1) {
-      gst_base_parse_set_frame_rate (GST_BASE_PARSE (self),
-          self->priv->framerate_num, self->priv->framerate_denom, 0, 0);
     }
   }

@@ -222,6 +216,10 @@

     gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
     gst_caps_unref (caps);
+
+    if (!self->priv->started)
+      gst_base_parse_set_frame_rate (GST_BASE_PARSE (self),
+          self->priv->framerate_num, self->priv->framerate_denom, 0, 0);

     self->priv->started = TRUE;
   }


fsnotify: use fsnotify_create_event to allocate the q_overflow event

Currently fsnotify defines a static fsnotify event which is sent when a
group overflows its allotted queue length.  This patch just allocates that
event from the event cache rather than defining it statically.  There is no
known reason that the current implementation is wrong, but this makes sure the
event is initialized and created like any other.

Signed-off-by: Eric Paris <b0b36e3cd9ea4e5739ff430a3056fabf2fdb0376@redhat.com>

--- fs/notify/notification.c
+++ fs/notify/notification.c
@@ -56,7 +56,7 @@
  * it is needed.  It's refcnt is set 1 at kernel init time and will never
  * get set to 0 so it will never get 'freed'
  */
-static struct fsnotify_event q_overflow_event;
+static struct fsnotify_event *q_overflow_event;
 static atomic_t fsnotify_sync_cookie = ATOMIC_INIT(0);

 /**
@@ -195,7 +195,7 @@
 	mutex_lock(&group->notification_mutex);

 	if (group->q_len >= group->max_events) {
-		event = &q_overflow_event;
+		event = q_overflow_event;
 		ret = -EOVERFLOW;
 		/* sorry, no private data on the overflow event */
 		priv = NULL;
@@ -412,8 +412,11 @@
 	fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC);
 	fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC);

-	initialize_event(&q_overflow_event);
-	q_overflow_event.mask = FS_Q_OVERFLOW;
+	q_overflow_event = fsnotify_create_event(NULL, FS_Q_OVERFLOW, NULL,
+						 FSNOTIFY_EVENT_NONE, NULL, 0,
+						 GFP_KERNEL);
+	if (!q_overflow_event)
+		panic("unable to allocate fsnotify q_overflow_event\n");

 	return 0;
 }


refs #5025 Fixing Linux build error.

refs #5025 Fixing Linux build error.

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

--- ft/ft-node-deserialize.c
+++ ft/ft-node-deserialize.c
@@ -151,4 +151,4 @@
     }

     return r;
-}+}


This isn't pretty but at least it works properly, even across a modem line!

--- Scroller.c
+++ Scroller.c
@@ -28,7 +28,7 @@
 ****************************************************************/

 #ifndef lint
-static const char cvsid[] = "$Id: Scroller.c,v 1.95 2000/04/28 07:41:01 phelps Exp $";
+static const char cvsid[] = "$Id: Scroller.c,v 1.96 2000/04/28 08:30:55 phelps Exp $";
 #endif /* lint */

 #include <config.h>
@@ -303,7 +303,7 @@
     self -> previous = NULL;
     self -> next = NULL;
     self -> width = width;
-    self -> is_pending = 0;
+    self -> is_pending = False;
     self -> glyph = glyph -> alloc(glyph);
     return self;
 }
@@ -713,7 +713,7 @@
 		}
 		else
 		{
-		    holder -> is_pending = 1;
+		    holder -> is_pending = True;
 		}
 	    }
 	}
@@ -1265,27 +1265,33 @@
     int offset = 0 - self -> scroller.left_offset;

     printf("overflow recovery\n");
-
-    /* Update any glyphs which need to be repainted */
-    for (holder = self -> scroller.left_holder; holder != NULL; holder = holder -> next)
-    {
-	if (holder -> is_pending)
-	{
-	    if (self -> scroller.use_pixmap)
+    if (self -> scroller.state == SS_READY)
+    {
+	/* Update any glyphs which need to be repainted */
+	for (holder = self -> scroller.left_holder; holder != NULL; holder = holder -> next)
+	{
+	    int width = glyph_holder_width(holder);
+
+	    if (holder -> is_pending)
 	    {
-		glyph_holder_paint(
-		    holder, display, self -> scroller.pixmap,
-		    offset, 0, 0, self -> core.width, self -> scroller.height);
-		Redisplay((Widget)self, NULL, 0);
+		if (self -> scroller.use_pixmap)
+		{
+		    glyph_holder_paint(
+			holder, display, self -> scroller.pixmap,
+			offset, 0, 0, self -> core.width, self -> scroller.height);
+		    Redisplay((Widget)self, NULL, 0);
+		}
+		else
+		{
+		    glyph_holder_paint(
+			holder, display, XtWindow((Widget)self),
+			offset, 0, 0, self -> core.width, self -> scroller.height);
+		}
+
+		holder -> is_pending = False;
 	    }
-	    else
-	    {
-		glyph_holder_paint(
-		    holder, display, XtWindow((Widget)self),
-		    offset, 0, 0, self -> core.width, self -> scroller.height);
-	    }
-
-	    holder -> is_pending = 0;
+
+	    offset += width;
 	}
     }

@@ -1293,6 +1299,13 @@
     if (self -> scroller.is_dragging)
     {
 	drag_to(self, self -> scroller.overflow_x);
+
+	/* If we received a mouse-up event then restart the scroller */
+	if (self -> scroller.is_dragging < 0)
+	{
+	    self -> scroller.is_dragging = False;
+	    EnableClock(self);
+	}
     }
     else
     {
@@ -1633,10 +1646,19 @@
     {
 	if (self -> scroller.is_dragging)
 	{
-	    /* Restart the timer */
-	    self -> scroller.is_dragging = False;
-	    EnableClock(self);
-	    return -1;
+	    if (self -> scroller.state == SS_OVERFLOW)
+	    {
+		/* Hideous hack -- use -1 to indicate dragging should stop */
+		self -> scroller.is_dragging = -1;
+		return -1;
+	    }
+	    else
+	    {
+		/* Restart the timer */
+		self -> scroller.is_dragging = False;
+		EnableClock(self);
+		return -1;
+	    }
 	}
     }

@@ -2109,7 +2131,7 @@
 	    return;
 	}

-	/* Otherwise we're not definitely dragging */
+	/* Otherwise we're definitely dragging */
 	self -> scroller.is_dragging = True;

 	/* Disable the timer until the drag is done */


More glyph reference counting hackery.

More glyph reference counting hackery.

Make sure we release the reference to a successor glyph when the glyph
is freed.  Use a new reference type for the successor references so
that we can keep track of them too.

--- Scroller.c
+++ Scroller.c
@@ -182,13 +182,15 @@
 enum glyph_ref_type {
     REF_GAP,
     REF_QUEUE,
-    REF_HOLDER
+    REF_HOLDER,
+    REF_REPLACE
 };

 static const char *ref_type_names[] = {
     "GAP",
     "QUEUE",
-    "HOLDER"
+    "HOLDER",
+    "REPLACE"
 };

 /* To help track memory leaks, we record the line number, reference
@@ -261,77 +263,6 @@
 static void
 glyph_set_clock(glyph_t self, int level_count);

-
-/* Allocates and initializes a new glyph holder for the given message */
-static glyph_t
-glyph_alloc(ScrollerWidget widget, message_t message)
-{
-    glyph_t self;
-
-    /* Allocate memory for a new glyph */
-    self = malloc(sizeof(struct glyph));
-    if (self == NULL) {
-        return NULL;
-    }
-
-    /* Initialize its fields to sane values */
-    memset(self, 0, sizeof(struct glyph));
-
-    /* Increment the reference count */
-    self->widget = widget;
-
-    /* Bail out now if we're the gap */
-    DPRINTF((1, "allocated glyph %p\n", self));
-    if (message == NULL) {
-        return self;
-    }
-
-    /* Allocate a message view for display */
-    self->message_view = message_view_alloc(message, 0,
-                                            widget->scroller.renderer);
-    if (self->message_view == NULL) {
-        glyph_free(self);
-        return NULL;
-    }
-
-    /* Figure out how big the glyph should be */
-    message_view_get_sizes(self->message_view, False, &self->sizes);
-
-    /* Add a little space on the end */
-    /* FIX THIS: compute the per_char info for a space */
-    self->sizes.width += widget->scroller.font->ascent;
-
-    /* Start the clock */
-    self->timeout = None;
-    glyph_set_clock(self, widget->scroller.fade_levels);
-
-    return self;
-}
-
-/* Frees the resources consumed by the receiver */
-static void
-glyph_free(glyph_t self)
-{
-    /* Sanity checks */
-    ASSERT(self->refs == NULL);
-    ASSERT(self->visible_count == 0);
-
-    /* Free the message_view */
-    if (self->message_view) {
-        message_view_free(self->message_view);
-    }
-
-    /* Cancel any pending timeout */
-    if (self->timeout != None) {
-        XtRemoveTimeOut(self->timeout);
-    }
-
-    /* Free the glyph itself */
-    free(self);
-
-    DPRINTF((1, "freed glyph %p\n", self));
-}
-
 #if defined(DEBUG)
 # define GLYPH_ALLOC_REF(glyph, type, rock)     \
     glyph_alloc_ref(glyph, type, __FILE__, __LINE__, rock)
@@ -410,6 +341,81 @@
         }                                       \
     } while (0)
 #endif /* DEBUG */
+
+/* Allocates and initializes a new glyph holder for the given message */
+static glyph_t
+glyph_alloc(ScrollerWidget widget, message_t message)
+{
+    glyph_t self;
+
+    /* Allocate memory for a new glyph */
+    self = malloc(sizeof(struct glyph));
+    if (self == NULL) {
+        return NULL;
+    }
+
+    /* Initialize its fields to sane values */
+    memset(self, 0, sizeof(struct glyph));
+
+    /* Increment the reference count */
+    self->widget = widget;
+
+    /* Bail out now if we're the gap */
+    DPRINTF((1, "allocated glyph %p\n", self));
+    if (message == NULL) {
+        return self;
+    }
+
+    /* Allocate a message view for display */
+    self->message_view = message_view_alloc(message, 0,
+                                            widget->scroller.renderer);
+    if (self->message_view == NULL) {
+        glyph_free(self);
+        return NULL;
+    }
+
+    /* Figure out how big the glyph should be */
+    message_view_get_sizes(self->message_view, False, &self->sizes);
+
+    /* Add a little space on the end */
+    /* FIX THIS: compute the per_char info for a space */
+    self->sizes.width += widget->scroller.font->ascent;
+
+    /* Start the clock */
+    self->timeout = None;
+    glyph_set_clock(self, widget->scroller.fade_levels);
+
+    return self;
+}
+
+/* Frees the resources consumed by the receiver */
+static void
+glyph_free(glyph_t self)
+{
+    /* Sanity checks */
+    ASSERT(self->refs == NULL);
+    ASSERT(self->visible_count == 0);
+
+    /* If the glyph has a successor then release our reference to it. */
+    if (self->successor) {
+	GLYPH_FREE_REF(self->successor, REF_REPLACE, self);
+    }
+
+    /* Free the message_view */
+    if (self->message_view) {
+        message_view_free(self->message_view);
+    }
+
+    /* Cancel any pending timeout */
+    if (self->timeout != None) {
+        XtRemoveTimeOut(self->timeout);
+    }
+
+    /* Free the glyph itself */
+    free(self);
+
+    DPRINTF((1, "freed glyph %p\n", self));
+}

 /* This is called each time the glyph should fade */
 static void
@@ -661,8 +667,9 @@
     next->previous = new_glyph;
     old_glyph->next = NULL;

-    /* Tell the old glyph that it's been superseded */
-    GLYPH_ALLOC_REF(new_glyph, REF_QUEUE, NULL);
+    /* Tell the old glyph that it's been superseded; it retains a
+     * reference to its successor. */
+    GLYPH_ALLOC_REF(new_glyph, REF_REPLACE, old_glyph);
     old_glyph->successor = new_glyph;

     /* Clean up */


lib: fix compile error for ARC arch

lib: fix compile error for ARC arch

macro Z_ARC_MPU_SIZE_ALIGN is no longer exist, so change it accordingly

Signed-off-by: Yuguo Zou <b01c60d22fb0bade29952a876407fe6c413a8642@synopsys.com>

--- lib/libc/newlib/libc-hooks.c
+++ lib/libc/newlib/libc-hooks.c
@@ -51,7 +51,7 @@
 #define HEAP_BASE	ROUND_UP(USED_RAM_END_ADDR, \
 				 CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE)
 #elif defined(CONFIG_ARC)
-#define HEAP_BASE	Z_ARC_MPU_SIZE_ALIGN(USED_RAM_END_ADDR)
+#define HEAP_BASE	ROUND_UP(USED_RAM_END_ADDR, Z_ARC_MPU_ALIGN)
 #else
 #error "Unsupported platform"
 #endif /* CONFIG_<arch> */


libc/stdio: fix wrong condition for checking invalid mode

freopen should return NULL when oflags is less than 0, not equal to 0.
Because negative value is returned on failure of lib_mode2offlags which
converts the mode string into file open mode flag.

Change-Id: Iaa573ff6e37f5790bfb1a16fb7bb4bc7f997e0c3
Signed-off-by: Ahreum Jeong <33863a1723a2843378ef12cc55c193a40f777104@samsung.com>

--- lib/libc/stdio/lib_freopen.c
+++ lib/libc/stdio/lib_freopen.c
@@ -124,7 +124,7 @@
 		/* Convert the mode string into standard file open mode flags. */

 		oflags = lib_mode2oflags(mode);
-		if (oflags == 0) {
+		if (oflags < 0) {
 			return NULL;
 		}


Bug fixing on chunk boundaries with large files

--- src/wordstreamer_scatter.c
+++ src/wordstreamer_scatter.c
@@ -208,15 +208,15 @@
         /* Retrieve a complete word */
         _mr_wordstreamer_retrieve_word(ws, file_size, buffer, map);

-        if (ws->offset >= stop_offset) ws->end = true;
+        if (ws->offset > stop_offset) ws->end = true;
         _timer_stop(&ws->timer_get);

         return 0;
     } else {
         char character = map[offset];
-
+
         /* Retrieve one more word (last word on two chunks) */
-        if(!ispunct(character) && !isspace(character) && offset < file_size) {
+        if(offset== stop_offset && !ispunct(character) && !isspace(character) && offset < file_size) {

             _mr_wordstreamer_retrieve_word(ws, file_size, buffer, map);
             ws->end = true;


timer: optimize for empty case

timer: optimize for empty case

In many application there are no timers queued, and the call to
rte_timer_managecan be optimized in that case avoid reading HPET and
lock overhead.

Signed-off-by: Stephen Hemminger <a072e933f45880fe04500ea083d5c7f6e81a06f0@vyatta.com>
Reviewed-by: Vincent Jardin <26f68a5f0ed81e06a96944a1149c7c618180edec@6wind.com>

--- lib/librte_timer/rte_timer.c
+++ lib/librte_timer/rte_timer.c
@@ -403,9 +403,14 @@
 	union rte_timer_status status;
 	struct rte_timer *tim, *tim2;
 	unsigned lcore_id = rte_lcore_id();
-	uint64_t cur_time = rte_get_hpet_cycles();
+	uint64_t cur_time;
 	int ret;

+	/* optimize for the case where per-cpu list is empty */
+	if (LIST_EMPTY(&priv_timer[lcore_id].pending))
+		return;
+
+	cur_time = rte_get_hpet_cycles();
 	__TIMER_STAT_ADD(manage, 1);

 	/* browse ordered list, add expired timers in 'expired' list */


Another missing file

Another missing file

error: pathspec 'include/Pyros3D/Assets/Renderable/Terrains/Terrain.h' did not match any file(s) known to git

--- include/Pyros3D/Assets/Renderable/Terrains/Terrain.h
+++ include/Pyros3D/Assets/Renderable/Terrains/Terrain.h
@@ -0,0 +1,49 @@
+//============================================================================
+// Name        : Terrain
+// Author      : Duarte Peixinho
+// Version     :
+// Copyright   : ;)
+// Description : Terrain
+//============================================================================
+
+#ifndef TERRAIN_H
+#define TERRAIN_H
+
+#include <Pyros3D/Assets/Renderable/Primitives/Primitive.h>
+#include <Pyros3D/Rendering/Components/Rendering/RenderingComponent.h>
+#include <Pyros3D/Other/Export.h>
+
+namespace p3d {
+
+	class PYROS3D_API Terrain : public Primitive {
+
+		friend class TerrainRenderingComponent;
+
+		public:
+
+			Terrain(Texture* heightmap, const f32 dimensions, const uint32 segments, const f32 height = 1, bool smooth = false, bool repeatUV = false);
+
+		protected:
+
+			int imgWidth, imgHeight, seg;
+			f32 unit;
+	};
+
+	class PYROS3D_API TerrainRenderingComponent : public RenderingComponent
+	{
+
+	protected:
+
+		f32 segunits;
+
+	public:
+
+		TerrainRenderingComponent(Terrain* renderable, IMaterial* Material = NULL);
+		bool GetHeightFromLocalCoords(Vec3 &coords);
+		bool GetHeightFromGlobalCoords(Vec3 &coords);
+
+	};
+
+};
+
+#endif /* TERRAIN_H */


Fixed Cb/Cr offset computation (height*pitch/4 is different from height/2*pitch/2 if height is odd).

--- src/gfx/generic/generic.c
+++ src/gfx/generic/generic.c
@@ -7035,11 +7035,11 @@
           switch (gfxs->src_format) {
                case DSPF_I420:
                     gfxs->src_org[1] = gfxs->src_org[0] + gfxs->src_height * gfxs->src_pitch;
-                    gfxs->src_org[2] = gfxs->src_org[1] + gfxs->src_height * gfxs->src_pitch / 4;
+                    gfxs->src_org[2] = gfxs->src_org[1] + gfxs->src_height/2 * gfxs->src_pitch/2;
                     break;
                case DSPF_YV12:
                     gfxs->src_org[2] = gfxs->src_org[0] + gfxs->src_height * gfxs->src_pitch;
-                    gfxs->src_org[1] = gfxs->src_org[2] + gfxs->src_height * gfxs->src_pitch / 4;
+                    gfxs->src_org[1] = gfxs->src_org[2] + gfxs->src_height/2 * gfxs->src_pitch/2;
                     break;
                case DSPF_NV12:
                case DSPF_NV21:
@@ -7069,11 +7069,11 @@
      switch (gfxs->dst_format) {
           case DSPF_I420:
                gfxs->dst_org[1] = gfxs->dst_org[0] + gfxs->dst_height * gfxs->dst_pitch;
-               gfxs->dst_org[2] = gfxs->dst_org[1] + gfxs->dst_height * gfxs->dst_pitch / 4;
+               gfxs->dst_org[2] = gfxs->dst_org[1] + gfxs->dst_height/2 * gfxs->dst_pitch/2;
                break;
           case DSPF_YV12:
                gfxs->dst_org[2] = gfxs->dst_org[0] + gfxs->dst_height * gfxs->dst_pitch;
-               gfxs->dst_org[1] = gfxs->dst_org[2] + gfxs->dst_height * gfxs->dst_pitch / 4;
+               gfxs->dst_org[1] = gfxs->dst_org[2] + gfxs->dst_height/2 * gfxs->dst_pitch/2;
                break;
           case DSPF_NV12:
           case DSPF_NV21:


Added command line fullscreen flag to the SDL port, closes #126

--- SDL/main.c
+++ SDL/main.c
@@ -488,14 +488,28 @@
     }
 }

+static bool get_arg_flag(const char *flag, int *argc, char **argv)
+{
+    for (unsigned i = 1; i < *argc; i++) {
+        if (strcmp(argv[i], flag) == 0) {
+            (*argc)--;
+            argv[i] = argv[*argc];
+            return true;
+        }
+    }
+    return false;
+}
+
 int main(int argc, char **argv)
 {
 #define str(x) #x
 #define xstr(x) str(x)
     fprintf(stderr, "SameBoy v" xstr(VERSION) "\n");
+
+    bool fullscreen = get_arg_flag("--fullscreen", &argc, argv);

     if (argc > 2) {
-        fprintf(stderr, "Usage: %s [rom]\n", argv[0]);
+        fprintf(stderr, "Usage: %s [--fullscreen] [rom]\n", argv[0]);
         exit(1);
     }

@@ -514,6 +528,10 @@
     window = SDL_CreateWindow("SameBoy v" xstr(VERSION), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                               160 * 2, 144 * 2, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
     SDL_SetWindowMinimumSize(window, 160, 144);
+
+    if (fullscreen) {
+        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+    }

     SDL_GLContext gl_context = SDL_GL_CreateContext(window);


Doxygen description file main.c

Doxygen description file main.c


xenapi_driver: fix copy-paste typo

xenapi_driver: fix copy-paste typo

Clang found that we are passing variable with wrong enum type to
'xenapiCrashExitEnum2virDomainLifecycle' function. This is probably
copy-paste typo as the correct variable exists in the code, but it isn't
used.

Signed-off-by: Pavel Hrdina <d4772d05997b8abf035041e3b4f4996380ea7e7a@redhat.com>

--- src/xenapi/xenapi_driver.c
+++ src/xenapi/xenapi_driver.c
@@ -1504,7 +1504,7 @@
         defPtr->onReboot = xenapiNormalExitEnum2virDomainLifecycle(action);
     enum xen_on_crash_behaviour crash;
     if (xen_vm_get_actions_after_crash(session, &crash, vm))
-        defPtr->onCrash = xenapiCrashExitEnum2virDomainLifecycle(action);
+        defPtr->onCrash = xenapiCrashExitEnum2virDomainLifecycle(crash);
     xen_vm_get_platform(session, &result, vm);
     if (result != NULL) {
         size_t i;


nir: Fix the Mesa build without -DDEBUG.

With -DDEBUG -UNDEBUG, this assert uses reg_state::stack_size, which
doesn't exist, breaking the build:

assert(state->states[index].index < state->states[index].stack_size);

Switch it to ifndef NDEBUG, so the field will exist if the assertion
actually generates code.

Signed-off-by: Kenneth Graunke <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>
Reviewed-by: Matt Turner <789b315743a28dd066a4ba1459c35951c291d8a6@gmail.com>

--- src/glsl/nir/nir_to_ssa.c
+++ src/glsl/nir/nir_to_ssa.c
@@ -134,7 +134,7 @@
    nir_ssa_def **stack;
    int index;
    unsigned num_defs; /** < used to add indices to debug names */
-#ifdef DEBUG
+#ifndef NDEBUG
    unsigned stack_size;
 #endif
 } reg_state;
@@ -489,7 +489,7 @@
          state->states[reg->index].stack = ralloc_array(state->states,
                                                         nir_ssa_def *,
                                                         stack_size);
-#ifdef DEBUG
+#ifndef NDEBUG
          state->states[reg->index].stack_size = stack_size;
 #endif
          state->states[reg->index].index = -1;


XObject Save/Restore

XObject Save/Restore

--- src/xenia/kernel/xobject.h
+++ src/xenia/kernel/xobject.h
@@ -20,6 +20,7 @@
 #include "xenia/xbox.h"

 namespace xe {
+class ByteStream;
 class Emulator;
 }  // namespace xe

@@ -109,15 +110,19 @@
 class XObject {
  public:
   enum Type {
-    kTypeModule,
-    kTypeThread,
+    kTypeUndefined,
+    kTypeEnumerator,
     kTypeEvent,
     kTypeFile,
+    kTypeIOCompletion,
+    kTypeModule,
+    kTypeMutant,
+    kTypeNotifyListener,
     kTypeSemaphore,
-    kTypeNotifyListener,
-    kTypeMutant,
+    kTypeSession,
+    kTypeSocket,
+    kTypeThread,
     kTypeTimer,
-    kTypeEnumerator,
   };

   XObject(KernelState* kernel_state, Type type);
@@ -142,6 +147,9 @@
   void Retain();
   void Release();
   X_STATUS Delete();
+
+  virtual bool Save(ByteStream* stream) { return false; };
+  virtual bool Restore(ByteStream* stream) { return false; };

   // Reference()
   // Dereference()


Change hint type to `const void*` (#2568)

This is both more correct, and the build fails on AIX without it

--- src/google/protobuf/map.h
+++ src/google/protobuf/map.h
@@ -592,7 +592,7 @@
     MapAllocator(const MapAllocator<X>& allocator)
         : arena_(allocator.arena()) {}

-    pointer allocate(size_type n, const_pointer hint = 0) {
+    pointer allocate(size_type n, const void* hint = 0) {
       // If arena is not given, malloc needs to be called which doesn't
       // construct element object.
       if (arena_ == NULL) {


Unref signal arguments/results after use

--- ssg-char-device-instance.c
+++ ssg-char-device-instance.c
@@ -60,6 +60,8 @@
     int result;

     g_signal_emit(priv->self, ssg_char_device_instance_signals[WRITE], 0, buf_bytes, &result);
+
+    g_bytes_unref(buf_bytes);

     return result;
 }
@@ -83,6 +85,8 @@
         g_return_val_if_fail(bytes_read <= len, 0);
         memcpy(buf,g_bytes_get_data(result,NULL),bytes_read);
     }
+
+    g_bytes_unref(result);

     return bytes_read;


~LogRecord() should be virtual

~LogRecord() should be virtual

--- src/condor_c++_util/log.h
+++ src/condor_c++_util/log.h
@@ -17,7 +17,7 @@
 public:

 	LogRecord();
-	~LogRecord();
+	virtual ~LogRecord();
 	LogRecord *get_next() { return next; }
 	int get_op_type() { return op_type; }


Removed uneeded prototypes

Removed uneeded prototypes

--- Src/main.c
+++ Src/main.c
@@ -32,11 +32,6 @@
 #include "constants.h"
 #include "engine.h"
 #include "systemtime.h"
-
-void set_mode();
-void runloop(int x);
-void keyboard(unsigned char key, int x, int y);
-void display(void);

 void *constructor(void *n);


protecting compilation failure

protecting compilation failure

--- Top/main.c
+++ Top/main.c
@@ -211,7 +211,9 @@
      /* VL: added this also to csoundReset() in csound.c   */
       if (csoundInitModules(csound) != 0)
       csound->LongJmp(csound, 1);
-    csoundCompileOrc(csound, NULL);
+     if(csoundCompileOrc(csound, NULL) != 0){
+        csoundDie(csound, Str("cannot compile orchestra \n"));
+     }
     /* IV - Jan 28 2005 */
     print_benchmark_info(csound, Str("end of orchestra compile"));
     if (!csoundYield(csound))


tools: Silence CodeChecker in erl_memory.c

--- lib/tools/c_src/erl_memory.c
+++ lib/tools/c_src/erl_memory.c
@@ -94,11 +94,32 @@

 #define PRINT_OPERATIONS 0

+/* In VC++, noreturn is a declspec that has to be before the types,
+ * but in GNUC it is an attribute to be placed between return type
+ * and function name, hence __decl_noreturn <types> __noreturn <function name>
+ *
+ * at some platforms (e.g. Android) __noreturn is defined at sys/cdef.h
+ */
+#if __GNUC__
+#  define __decl_noreturn
+#  ifndef __noreturn
+#     define __noreturn __attribute__((noreturn))
+#  endif
+#else
+#  if defined(__WIN32__) && defined(_MSC_VER)
+#    define __noreturn
+#    define __decl_noreturn __declspec(noreturn)
+#  else
+#    define __noreturn
+#    define __decl_noreturn
+#  endif
+#endif
+
 /* Our own assert() ... */
 #ifdef DEBUG
 #define ASSERT(A) ((void) ((A) ? 1 : assert_failed(__FILE__, __LINE__, #A)))
 #include <stdio.h>
-static int assert_failed(char *f, int l, char *a)
+__decl_noreturn static int __noreturn assert_failed(char *f, int l, char *a)
 {
     fprintf(stderr, "%s:%d: Assertion failed: %s\n", f, l, a);
     abort();
@@ -131,8 +152,8 @@
 #define EM_MIN_TRACE_READ_SIZE (EM_DEFAULT_BUF_SZ/20)
 #define EM_TIME_FIELD_WIDTH 11

-static void error(int res);
-static void error_msg(int res, char *msg);
+__decl_noreturn static void __noreturn error(int res);
+__decl_noreturn static void __noreturn error_msg(int res, char *msg);

 typedef struct {
     usgnd_int_max size;
@@ -1887,13 +1908,13 @@
     return error_str;
 }

-static void
+__decl_noreturn static void __noreturn
 error(int res)
 {
     error_msg(res, NULL);
 }

-static void
+__decl_noreturn static void __noreturn
 error_msg(int res, char *msg)
 {
     fprintf(stderr,


Remove a duplicate doc comment

Remove a duplicate doc comment

--- gdk/x11/gdkdisplay-x11.c
+++ gdk/x11/gdkdisplay-x11.c
@@ -1187,17 +1187,6 @@
                      gdk_x11_get_xatom_by_name_for_display (display, "SM_CLIENT_ID"));
 }

-/**
- * gdk_display_open:
- * @display_name: the name of the display to open
- *
- * Opens a display.
- *
- * Return value: (transfer none): a #GdkDisplay, or %NULL if the display
- *               could not be opened.
- *
- * Since: 2.2
- */
 GdkDisplay *
 _gdk_x11_display_open (const gchar *display_name)
 {


Fixed typo

Fixed typo

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@6727 e128ff1e-fa79-4151-a8cb-522299a2c450

--- src/gsCore/gsMultiPatch.h
+++ src/gsCore/gsMultiPatch.h
@@ -20,7 +20,7 @@
 namespace gismo
 {

-/** @brief Container clas sfor a set of geometry patches and their
+/** @brief Container class for a set of geometry patches and their
     topology, that is, the interface connections and outer boundary
     faces.


fix include guard

fix include guard

--- Steering.h
+++ Steering.h
@@ -1,5 +1,5 @@
 #ifndef COMMON_STEERING_H
-#define COMMON_STEERING_h
+#define COMMON_STEERING_H

 #include "Vector3.h"
 #include "Vehicle.h"


Fix formatting

Fix formatting

--- keyboards/ergodox_ez/keymaps/paulfioravanti/keymap.c
+++ keyboards/ergodox_ez/keymaps/paulfioravanti/keymap.c
@@ -85,7 +85,7 @@
                                                           KC_BSPACE,      KC_DELETE, KC_END,
   // right hand
   KC_EQUAL,  KC_6,   KC_7,      KC_8,       KC_9,    KC_0,      KC_MINUS,
-  MO(MEDIA),       KC_Y,   KC_U,      KC_I,       KC_O,    KC_P,      KC_QUOTE,
+  MO(MEDIA), KC_Y,   KC_U,      KC_I,       KC_O,    KC_P,      KC_QUOTE,
              KC_H,   KC_J,      KC_K,       KC_L,    KC_SCOLON, RCTL_T(KC_ESC),
   MO(CODER), KC_N,   KC_M,      KC_COMMA,   KC_DOT,  KC_SLSH,   KC_RSHIFT,
                      LEFT_PANE, RIGHT_PANE, UP_PANE, DOWN_PANE, KC_RGUI,


fixes to arg copy

fixes to arg copy

--- Top/main.c
+++ Top/main.c
@@ -247,7 +247,7 @@
     s = csoundQueryGlobalVariable(csound, "_RTMIDI");
     if (csound->enableHostImplementedMIDIIO == 1) {
         if (s) {
-	  s = strcpy(csound, "hostbased");
+	  strcpy(s, "hostbased");
         }
         csoundSetConfigurationVariable(csound,"rtmidi", "hostbased");
     }


* account setup dialog is now handled correctly after it is closed

pmo-trunk-r85

--- src/gtk-glade/modest-ui.c
+++ src/gtk-glade/modest-ui.c
@@ -408,12 +408,17 @@
 {
 	GtkWidget *advanced_account_setup;
 	ModestUIPrivate *priv;
+	gint retval;

 	priv = MODEST_UI_GET_PRIVATE(MODEST_UI(user_data));

 	advanced_account_setup = glade_xml_get_widget(priv->glade_xml, "mailbox_setup_advanced");

-	gtk_widget_show_all(advanced_account_setup);
+	gtk_widget_show_all(GTK_WIDGET(advanced_account_setup));
+
+	retval=gtk_dialog_run(GTK_DIALOG(advanced_account_setup));
+
+        gtk_widget_hide(GTK_WIDGET(advanced_account_setup));
 }


patch to main avoiding free issue--review

--- Top/main.c
+++ Top/main.c
@@ -98,6 +98,7 @@
 {
     OPARMS  *O = csound->oparms;
     char    *s;
+    int new_s = 0;
     FILE    *xfile = NULL;
     int     n;
     int     csdFound = 0;
@@ -245,7 +246,7 @@
     s = csoundQueryGlobalVariable(csound, "_RTMIDI");
     if (csound->enableHostImplementedMIDIIO == 1) {
         if (s == NULL) {
-            s = strdup("hostbased");
+          s = strdup("hostbased"); new_s=1;
         } else {
             strcpy(s, "hostbased");
         }
@@ -311,7 +312,7 @@
     if (O->Midioutname != NULL || O->FMidioutname != NULL)
       openMIDIout(csound);

-    free(s);
+    if (new_s) free(s);
     return CSOUND_SUCCESS;
 }


added INCDIR for CSD

added INCDIR for CSD

--- Top/main.c
+++ Top/main.c
@@ -176,7 +176,7 @@
         fileDir = csoundGetDirectoryForPath(csound, csound->orchname);
         csoundAppendEnv(csound, "SADIR", fileDir);
         csoundAppendEnv(csound, "SSDIR", fileDir);
-        /*csoundAppendEnv(csound, "INCDIR", fileDir);*/
+        csoundAppendEnv(csound, "INCDIR", fileDir);
         csoundAppendEnv(csound, "MFDIR", fileDir);
         mfree(csound, fileDir);


added ADC functions, reorganized the structure. still needs testing (check the first few lines for status)

--- src/hal/drivers/hal_stg.c
+++ src/hal/drivers/hal_stg.c
@@ -46,14 +46,14 @@

     ADC:
       Parameters:
-/todo  	float	stg.<channel>.adc-offset
-/todo  	float	stg.<channel>.adc-gain
+/totest	float	stg.<channel>.adc-offset
+/totest	float	stg.<channel>.adc-gain

       Pins:
-/todo  	float	stg.<channel>.adc-value
+/totest	float	stg.<channel>.adc-value

       Functions:
-/todo  	void    stg.<channel>.adc_read
+/totest	void    stg.<channel>.adc_read

     Digital In:
@@ -84,6 +84,9 @@
 /** Copyright (C) 2003 John Kasunich
                        <jmkasunich AT users DOT sourceforge DOT net>
 */
+
+/* Based on STGMEMBS.CPP from the Servo To Go Windows drivers
+    - Copyright (c) 1996 Servo To Go Inc and released under GPL Version 2 */

 /** This program is free software; you can redistribute it and/or
     modify it under the terms of version 2.1 of the GNU General
@@ -110,24 +113,16 @@
     information, go to www.linuxcnc.org.
 */

+
 #ifndef RTAPI
 #error This is a realtime component only!
 #endif

+#include <asm/io.h>
 #include "rtapi.h"		/* RTAPI realtime OS API */
 #include "rtapi_app.h"		/* RTAPI realtime module decls */
 #include "hal.h"		/* HAL public API decls */
 #include "hal_stg.h"		/* STG related defines */
-
-#define FASTIO
-
-#ifdef FASTIO
-#define rtapi_inb inb
-#define rtapi_outb outb
-#ifdef RTAPI			/* for ULAPI, sys/io.h defines these functs */
-#include <asm/io.h>
-#endif
-#endif

 #ifndef MODULE
 #define MODULE
@@ -162,9 +157,16 @@
     hal_float_t pos_scale[MAX_CHANS];		/* parameter: scaling factor for pos */

 /* dac data */
-    hal_float_t *value[MAX_CHANS];		/* value to be written to dac */
-    hal_float_t offset[MAX_CHANS];		/* offset value for DAC */
-    hal_float_t gain[MAX_CHANS];		/* gain to be applied */
+    hal_float_t *dac_value[MAX_CHANS];		/* value to be written to dac */
+    hal_float_t dac_offset[MAX_CHANS];		/* offset value for DAC */
+    hal_float_t dac_gain[MAX_CHANS];		/* gain to be applied */
+
+/* adc data */
+    hal_float_t *adc_value[MAX_CHANS];		/* value to be read from adc */
+    hal_float_t adc_offset[MAX_CHANS];		/* offset value for ADC */
+    hal_float_t adc_gain[MAX_CHANS];		/* gain to be applied */
+    int adc_current_chan;			/* holds the currently converting channel */
+
 } stg_struct;

 static stg_struct *stg_driver;
@@ -180,22 +182,34 @@
 /***********************************************************************
 *                  LOCAL FUNCTION DECLARATIONS                         *
 ************************************************************************/
-
+/* helper functions, to export HAL pins & co. */
 static int export_counter(int num, stg_struct * addr);
 static int export_dac(int num, stg_struct * addr);
+static int export_adc(int num, stg_struct * addr);
+
+/* Board specific functions */

 /* initializes the STG, takes care of autodetection, all initialisations */
 static int stg_init_card(void);
 /* scans possible addresses for STG cards */
 static unsigned short stg_autodetect(void);

+/* counter related functions */
 static int stg_counter_init(int ch);
+static long stg_counter_read(int i);
+
+/* dac related functions */
 static int stg_dac_init(int ch);
-
-static long stg_counter_read(int i);
 static int stg_dac_write(int ch, short value);

+/* adc related functions */
+static int stg_adc_init(int ch);
+static int stg_adc_start(unsigned short wAxis);
+static short stg_adc_read(int ch);
+
+
 /* periodic functions registered to HAL */
+static void stg_adcs_read(void *arg, long period);
 static void stg_dacs_write(void *arg, long period);
 static void stg_counter_capture(void *arg, long period);

@@ -263,12 +277,30 @@
 	    return -1;
 	}
 	/* init counter */
-	*(stg_driver->value[n]) = 0;
-	stg_driver->offset[n] = 0.0;
-	stg_driver->gain[n] = 1.0;
-
-	/* init counter chip */
+	*(stg_driver->dac_value[n]) = 0;
+	stg_driver->dac_offset[n] = 0.0;
+	stg_driver->dac_gain[n] = 1.0;
+
+	/* init dac chip */
 	stg_dac_init(n);
+
+	retval = export_adc(n, stg_driver);
+	if (retval != 0) {
+	    rtapi_print_msg(RTAPI_MSG_ERR,
+		"STG: ERROR: adc %d var export failed\n", n + 1);
+	    hal_exit(comp_id);
+	    return -1;
+	}
+	/* init counter */
+	*(stg_driver->adc_value[n]) = 0;
+	stg_driver->adc_offset[n] = 0.0;
+	stg_driver->adc_gain[n] = 1.0;
+
+	stg_driver->adc_current_chan = -1; /* notify that no conversion has been started yet */
+
+	/* init adc chip */
+	stg_adc_init(n);
+
     }
     /* export functions */
     retval = hal_export_funct("stg.capture_position", stg_counter_capture,
@@ -292,6 +324,17 @@
     }
     rtapi_print_msg(RTAPI_MSG_INFO,
 	"STG: installed %d dacs\n", num_chan);
+
+    retval = hal_export_funct("stg.read_adcs", stg_adcs_read,
+	stg_driver, 1, 0, comp_id);
+    if (retval != 0) {
+	rtapi_print_msg(RTAPI_MSG_ERR,
+	    "STG: ERROR: stg_read_adcs funct export failed\n");
+	hal_exit(comp_id);
+	return -1;
+    }
+    rtapi_print_msg(RTAPI_MSG_INFO,
+	"STG: installed %d adcs\n", num_chan);

     /* was 'period' specified in the insmod command? */
     if (period > 0) {
@@ -334,6 +377,72 @@
     /* done */
 }

+/* stg_dacs_write() - writes all dac's to the board
+    - calls stg_dac_write() */
+
+static void stg_dacs_write(void *arg, long period)
+{
+    stg_struct *stg;
+    float volts;
+    short ncounts, i;
+
+    stg=arg;
+    for (i=0;i < num_chan; i++) {
+	/* scale the voltage to be written based on offset and gain */
+	volts = (*(stg->dac_value[i]) - stg->dac_offset[i]) * stg->dac_gain[i];
+	/* compute the value for the DAC */
+	ncounts = (short) ((10.0 - volts) / 20.0 * 0x1FFF);
+	/* write it to the card */
+	stg_dac_write(i, ncounts);
+    }
+}
+
+/* stg_adcs_read() - reads one adc at a time from the board to hal
+    - calls stg_adc_read() */
+
+/* long description :
+
+    Because the conversion takes a while (first mux to the right channel ~5usecs,
+    then start the conversion, and wait for it to finish ~16-20 usecs) for all the
+    8 channels, it would be too much to start the conversion, wait for the result
+    for all the 8 axes.
+    Instead a different approach is chosen:
+    - on the beginning of the function the conversion should already be done
+    - it gets read and sent to HAL
+    - the new channel gets mux'ed
+    - and at the end of the function the new conversion is started, so that the data
+      will be available at the next run.
+    This way 8 periods are needed to read 8 ADC's. It is possible to set the board
+    to do faster conversions (AZ bit on INTC off), but that would make it less
+    reliable (autozero takes care of temp. errors).*/
+/*! \todo STG_ADC_Improvement (if any user requests it).
+    Another improvement might be to let the user chose what channels he would like
+    for ADC (having only 2 channels might speed things up considerably).
+*/
+static void stg_adcs_read(void *arg, long period)
+{
+    stg_struct *stg;
+    float volts;
+    short ncounts;
+
+    stg=arg;
+    if (stg->adc_current_chan > 0) {
+	/* we should have the conversion done for adc_num_chan */
+	ncounts = stg_adc_read(stg->adc_current_chan);
+	volts = 10.0 - (ncounts * 20.0 / 0x1FFF);
+	*(stg->adc_value[stg->adc_current_chan]) = volts * stg->adc_gain[stg->adc_current_chan] \
+			    - stg->adc_offset[stg->adc_current_chan];
+    }
+    /* if adc_num_chan < 0, it's the first time this routine runs
+       thus we don't have any ready data, we simply start the next conversion */
+    if (stg->adc_current_chan++ > num_chan)
+	stg->adc_current_chan=0; //increase the channel, and roll back to 0 after all chans are done
+
+    /* select the current channel with the mux, and start the conversion */
+    stg_adc_start(stg->adc_current_chan);
+    /* the next time this function runs, the result should be available */
+}
+
 /***********************************************************************
 *                      BOARD SPECIFIC FUNCTIONS                        *
 ************************************************************************/
@@ -345,17 +454,17 @@
 {
     /* Set Counter Command Register - Master Control, Master Reset (MRST), */
     /* and Reset address pointer (RADR). */
-    rtapi_outb(CTRL(ch), 0x23);
+    outb(CTRL(ch), 0x23);

     /* Set Counter Command Register - Input Control, OL Load (P3), */
     /* and Enable Inputs A and B (INA/B). */
-    rtapi_outb(CTRL(ch), 0x68);
+    outb(CTRL(ch), 0x68);

     /* Set Counter Command Register - Output Control */
-    rtapi_outb(CTRL(ch), 0x80);
+    outb(CTRL(ch), 0x80);

     /* Set Counter Command Register - Quadrature */
-    rtapi_outb(CTRL(ch), 0xC3);
+    outb(CTRL(ch), 0xC3);
     return 0;
 }

@@ -375,25 +484,6 @@
     return 0;
 }

-/* stg_dacs_write() - writes all dac's to the board
-    - calls stg_dac_write() */
-
-static void stg_dacs_write(void *arg, long period)
-{
-    stg_struct *stg;
-    float volts;
-    short ncounts, i;
-
-    stg=arg;
-    for (i=0;i < num_chan; i++) {
-	/* scale the voltage to be written based on offset and gain */
-	volts = (*(stg->value[i]) - stg->offset[i]) * stg->gain[i];
-	/* compute the value for the DAC */
-	ncounts = (short) ((10.0 - volts) / 20.0 * 0x1FFF);
-	/* write it to the card */
-	stg_dac_write(i, ncounts);
-    }
-}

 /*
   stg_dac_write() - writes a dac channel
@@ -403,7 +493,7 @@
 {

     /* write the DAC */
-    rtapi_outb (base + DAC_0 + (ch << 1), value);
+    outb (base + DAC_0 + (ch << 1), value);

     return 0;
 }
@@ -423,10 +513,10 @@
 	} byte;
     } pos;

-    rtapi_outb(CTRL(i), 0x03);
-    pos.byte.b0 = rtapi_inb(DATA(i));
-    pos.byte.b1 = rtapi_inb(DATA(i));
-    pos.byte.b2 = rtapi_inb(DATA(i));
+    outb(CTRL(i), 0x03);
+    pos.byte.b0 = inb(DATA(i));
+    pos.byte.b1 = inb(DATA(i));
+    pos.byte.b2 = inb(DATA(i));
     if (pos.byte.b2 < 0) {
 	pos.byte.b3 = -1;
     } else {
@@ -434,6 +524,67 @@
     }
     return pos.l;
 }
+
+/*
+  stg_adc_init() - Initializes the dac channel
+*/
+
+static int stg_adc_init(int ch)
+{
+    /* not much to setup for the ADC's */
+    /* only select the mode of operation
+    we will work with AutoZero */
+    outb(base + MIO_2, 0x90);
+    return 0;
+}
+
+int stg_adc_start(unsigned short wAxis)
+{
+    /* do a dummy read from the ADC, just to set the input multiplexer to
+     the right channel */
+    inw(base + ADC_0 + (wAxis << 1));
+
+    /* wait 4 uS for settling time on the multiplexer and ADC. You probably
+     shouldn't really have a delay in a driver */
+    outb(0x80, 0);
+    outb(0x80, 0);
+    outb(0x80, 0);
+    outb(0x80, 0);
+
+    /* now start conversion */
+    outw(base + ADC_0 + (wAxis << 1), 0);
+
+    return 0;
+};
+
+static short stg_adc_read(int axis)
+{
+    short j;
+
+    /*
+    there must have been a delay between stg_adc_start() and
+    stg_adc_read(), of 19 usec if autozeroing (we are), 4 usecs
+    otherwise. In code that calls this, make sure you split these
+    calls up with some intervening code
+    */
+
+    /* make sure conversion is done, assume polling delay is done.
+    EOC (End Of Conversion) is bit 0x08 in IIR (Interrupt Request
+    Register) of Interrupt Controller.  Don't wait forever though
+    bail out eventually. */
+
+    for (j = 0; !(inb(base + IRR) & 0x08) && (j < 1000); j++);
+
+    j = inw(base + ADC_0 + (axis << 1));
+
+    if (j & 0x1000)       /* is sign bit negative? */
+	j |= 0xf000;      /* sign extend */
+    else
+	j &= 0xfff;       /* make sure high order bits are zero. */
+
+    return j;
+};
+

 /***********************************************************************
 *                   LOCAL FUNCTION DEFINITIONS                         *
@@ -487,20 +638,20 @@
     rtapi_set_msg_level(RTAPI_MSG_WARN);

     /* export pin for voltage received by the board() */
-    rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.value", num);
-    retval = hal_pin_float_new(buf, HAL_WR, &addr->value[num], comp_id);
+    rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.dac-value", num);
+    retval = hal_pin_float_new(buf, HAL_WR, &addr->dac_value[num], comp_id);
     if (retval != 0) {
 	return retval;
     }
     /* export parameter for offset */
     rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.dac-offset", num);
-    retval = hal_param_float_new(buf, HAL_WR, &addr->offset[num], comp_id);
+    retval = hal_param_float_new(buf, HAL_WR, &addr->dac_offset[num], comp_id);
     if (retval != 0) {
 	return retval;
     }
     /* export parameter for gain */
     rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.dac-gain", num);
-    retval = hal_param_float_new(buf, HAL_WR, &addr->gain[num], comp_id);
+    retval = hal_param_float_new(buf, HAL_WR, &addr->dac_gain[num], comp_id);
     if (retval != 0) {
 	return retval;
     }
@@ -509,6 +660,40 @@
     return 0;
 }

+static int export_adc(int num, stg_struct *addr)
+{
+    int retval, msg;
+    char buf[HAL_NAME_LEN + 2];
+
+    /* This function exports a lot of stuff, which results in a lot of
+       logging if msg_level is at INFO or ALL. So we save the current value
+       of msg_level and restore it later.  If you actually need to log this
+       function's actions, change the second line below */
+    msg = rtapi_get_msg_level();
+    rtapi_set_msg_level(RTAPI_MSG_WARN);
+
+    /* export pin for voltage received by the board() */
+    rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.adc-value", num);
+    retval = hal_pin_float_new(buf, HAL_WR, &addr->adc_value[num], comp_id);
+    if (retval != 0) {
+	return retval;
+    }
+    /* export parameter for offset */
+    rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.adc-offset", num);
+    retval = hal_param_float_new(buf, HAL_WR, &addr->adc_offset[num], comp_id);
+    if (retval != 0) {
+	return retval;
+    }
+    /* export parameter for gain */
+    rtapi_snprintf(buf, HAL_NAME_LEN, "stg.%d.adc-gain", num);
+    retval = hal_param_float_new(buf, HAL_WR, &addr->adc_gain[num], comp_id);
+    if (retval != 0) {
+	return retval;
+    }
+    /* restore saved message level */
+    rtapi_set_msg_level(msg);
+    return 0;
+}

 static int stg_init_card()
@@ -538,10 +723,10 @@
 	address = i * 0x20 + 0x200;

 	/* does jumper = i? */
-	if ((rtapi_inb(address + BRDTST) & 0x0f) == i) {
+	if ((inb(address + BRDTST) & 0x0f) == i) {
 	    k = 0;		// var for getting the serial
 	    for (j = 0; j < 8; j++) {
-		ofs = (rtapi_inb(address + BRDTST) >> 4);
+		ofs = (inb(address + BRDTST) >> 4);

 		if (ofs & 8) {	/* is SER set? */
 		    ofs = ofs & 7;	/* mask for Q2,Q1,Q0 */


getting in step

getting in step

--- Top/main.c
+++ Top/main.c
@@ -25,6 +25,14 @@
 #include "csoundCore.h"         /*                      MAIN.C          */
 #include "soundio.h"
 #include "csmodule.h"
+#include "csound_orc.h"
+
+#ifdef PARCS
+#include "cs_par_base.h"
+#include "cs_par_orc_semantics.h"
+#include "cs_par_dispatch.h"
+#endif
+
 #if defined(USE_OPENMP)
 #include <omp.h>
 #endif


call MidiClose() earlier in mainRESET()

call MidiClose() earlier in mainRESET()

--- Top/main.c
+++ Top/main.c
@@ -645,8 +645,8 @@
     void tranRESET(void);
     void MidiClose(ENVIRON*);

+    MidiClose(p);
     cleanup((void*) p);                 /* IV - Feb 03 2005 */
-    MidiClose(p);

 #if defined(USE_FLTK) && defined(never)        /* IV - Nov 30 2002 */
     void widgetRESET(void);     /* N.B. this is not used yet, */


MonkVG: Work In Progress. Added back VG_STROKE_PATH. Removed GLE backward compatibility library. Removed SQLite, uses cpp_btree instead. Multiple optimizations. Now renders the batch without optimization but correctly.

--- VG/vgext.h
+++ VG/vgext.h
@@ -87,7 +87,7 @@
 VG_API_CALL void VG_API_ENTRY vgDumpBatchMNK( VGBatchMNK batch, void **vertices, unsigned long *size ) VG_API_EXIT;

 /* context MonkVG */
-VG_API_CALL VGboolean vgCreateContextMNK( VGint width, VGint height, VGRenderingBackendTypeMNK backend );
+VG_API_CALL VGboolean vgCreateContextMNK( VGint width, VGint height );
 VG_API_CALL void vgResizeSurfaceMNK( VGint width, VGint height );
 VG_API_CALL void vgDestroyContextMNK( void );


CoinBase Maturity

CoinBase Maturity

--- src/consensus/consensus.h
+++ src/consensus/consensus.h
@@ -17,7 +17,7 @@
 /** The maximum allowed number of signature check operations in a block (network rule) */
 static const int64_t MAX_BLOCK_SIGOPS_COST = 800000;//we should have low cost then bitsend.//10MiB/50 old signature
 /** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 100;
+static const int COINBASE_MATURITY = 288;

 /** Flags for nSequence and nLockTime locks */
 enum {


Mempool ok?

Mempool ok?

--- src/http/unused/mempool.h
+++ src/http/unused/mempool.h
@@ -5,10 +5,6 @@
 Feel free to copy, use and enjoy according to the license provided.
 */
 #ifndef MEMPOOL_H
-
-/* *****************************************************************************
-Doesn't work yet - FAILS SOME TESTS
-*/

 /* *****************************************************************************
 A simple `mmap` based memory pool - `malloc` alternative.
@@ -166,7 +162,7 @@
       target == NULL;                                                          \
   } while (0);

-#define MEMPOOL_DEALLOC_SPECIAL(target, size) munmap((target), (size));
+#define MEMPOOL_DEALLOC_SPECIAL(target, size) munmap((target), (size))

 #else

@@ -191,7 +187,7 @@
   if (!size)
     return NULL;
   if (size & 15) {
-    size = size + 16 - (size & 15);
+    size = (size & (~16)) + 16;
   }
   size += sizeof(struct mempool_reserved_slice_s_offset);

@@ -211,8 +207,11 @@
       slice->prev->next = slice->next;
     else
       mempool_reserved_pool.available = slice->next;
+    slice->next = NULL;
+    slice->prev = NULL;
   } else {
     MEMPOOL_ALLOC_SPECIAL(slice, MEMPOOL_BLOCK_SIZE);
+    // fprintf(stderr, "Allocated Block at %p\n", slice);
     slice->offset.behind = 0;
     slice->offset.ahead =
         MEMPOOL_BLOCK_SIZE - (sizeof(struct mempool_reserved_slice_s_offset));
@@ -293,7 +292,9 @@
     goto alloc_indi;
   if ((slice->offset.ahead & MEMPOOL_USED_MARKER) != MEMPOOL_USED_MARKER)
     goto error;
+
   slice->offset.ahead &= MEMPOOL_SIZE_MASK;
+
   MEMPOOL_LOCK();
   /* merge slice with upper boundry */
   while ((tmp = (mempool_reserved_slice_s *)(((uintptr_t)slice) +
@@ -332,18 +333,26 @@
     slice = tmp;
   }

-  /* return memory to system? */
+  /* return memory to system, if the block is no longer required. */
   if (MEMPOOL_RETURN_MEM_TO_SYSTEM && mempool_reserved_pool.available &&
       slice->offset.behind == 0 &&
       ((mempool_reserved_slice_s *)(((uintptr_t)slice) + slice->offset.ahead))
               ->offset.ahead == 0) {
     MEMPOOL_UNLOCK();
+    // fprintf(
+    //     stderr, "DEALLOCATED BLOCK %p, size review %u == %lu %s\n", slice,
+    //     slice->offset.ahead,
+    //     MEMPOOL_BLOCK_SIZE - sizeof(struct mempool_reserved_slice_s_offset),
+    //     (slice->offset.ahead ==
+    //      MEMPOOL_BLOCK_SIZE - sizeof(struct mempool_reserved_slice_s_offset))
+    //         ? "passed."
+    //         : "FAILED.");
     MEMPOOL_DEALLOC_SPECIAL(slice, MEMPOOL_BLOCK_SIZE);
-    // fprintf(stderr, "DEALLOCATED BLOCK %p\n", slice);
     return;
   }

   /* inform higher neighbor about any updates */
+  // fprintf(stderr, "slice: %p -> %u\n", slice, slice->offset.ahead);
   ((mempool_reserved_slice_s *)(((uintptr_t)slice) + slice->offset.ahead))
       ->offset.behind = slice->offset.ahead;

@@ -393,7 +402,7 @@
   if (!size)
     return NULL;
   if (size & 15) {
-    size = size + 16 - (size & 15);
+    size = (size & (~16)) + 16;
   }
   size += sizeof(struct mempool_reserved_slice_s_offset);

@@ -424,6 +433,11 @@
     tmp->prev = NULL;
     slice->offset.ahead += tmp->offset.ahead;
   }
+
+  /* inform higher neighbor about any updates */
+  ((mempool_reserved_slice_s *)(((uintptr_t)slice) + slice->offset.ahead))
+      ->offset.behind = slice->offset.ahead;
+
   if ((slice->offset.ahead) > size + sizeof(mempool_reserved_slice_s)) {
     /* cut the slice in two */
     tmp = (mempool_reserved_slice_s *)(((uintptr_t)slice) + size);
@@ -491,12 +505,11 @@

 #include <time.h>
 static void mempool_stats(void) {
-  fprintf(stderr,
-          "* Pool object: %lu bytes\n"
-          "* Alignment: %lu \n"
-          "* Minimal Allocateion Size (including header): %lu\n"
-          "* Minimal Allocation Space (no header): %lu (controls allignment)\n"
-          "* Header size: %lu\n",
+  fprintf(stderr, "* Pool object: %lu bytes\n"
+                  "* Alignment: %lu \n"
+                  "* Minimal Allocation Size (including header): %lu\n"
+                  "* Minimal Allocation Space (no header): %lu\n"
+                  "* Header size: %lu\n",
           sizeof(mempool_reserved_pool),
           sizeof(struct mempool_reserved_slice_s_offset),
           sizeof(mempool_reserved_slice_s),


organize foundation headers into their section

--- Zangetsu.h
+++ Zangetsu.h
@@ -39,10 +39,7 @@
 #import "CWAssertionMacros.h"
 #import "CWLogging.h"

-#import "CWMacros.h"
-#import "CWSHA1Utilities.h"
-#import "CWTask.h"
-#import "CWDateUtilities.h"
+//Foundation
 #import "NSString+Empty.h"
 #import "NSString+URL.h"
 #import "NSString+Enumeration.h"
@@ -53,11 +50,24 @@
 #import "NSDictionary+Search.h"
 #import "NSDictionary+Enumeration.h"
 #import "NSDictionary+Transform.h"
-#import "CWSystemInfo.h"
 #import "NSSet+Search.h"
 #import "NSSet+Transform.h"
 #import "NSSet+Enumeration.h"
 #import "NSURLConnection+Asynchronous.h"
+#import "NSData+HexRepresentation.h"
+#import "NSMutableArray+Copying.h"
+#import "NSMutableArray+Shuffle.h"
+#import "NSMutableURLRequest+Authorization.h"
+#import "NSRecursiveLock+UnlockWithBlock.h"
+#import "NSNumber+RepeatingActions.h"
+
+#import "CWMacros.h"
+#import "CWSHA1Utilities.h"
+#import "CWTask.h"
+#import "CWDateUtilities.h"
+
+#import "CWSystemInfo.h"
+
 #import "CWDebugUtilities.h"
 #import "NSObject+Nil.h"
 #import "NSObject+AssociatedObjects.h"
@@ -67,7 +77,7 @@
 #import "CWErrorUtilities.h"
 #import "CWGraphicsFoundation.h"
 #import "CWMD5Utilities.h"
-#import "NSData+HexRepresentation.h"
+
 #import "CWExceptionUtilities.h"
 #import "CWURLUtilities.h"
 #import "CWRuntimeUtilities.h"
@@ -75,14 +85,12 @@
 #import "CWApplicationRegistry.h"
 #import "CWStack.h"
 #import "CWTree.h"
-#import "NSMutableArray+Copying.h"
-#import "NSMutableArray+Shuffle.h"
+
 #import "CWBase64.h"
 #import "CWZLib.h"
 #import "CWQueue.h"
 #import "CWURLRequest.h"
-#import "NSMutableURLRequest+Authorization.h"
-#import "NSRecursiveLock+UnlockWithBlock.h"
+
 #import "NSColor+CGColor.h"
 #import "CWBlockQueue.h"
 #import "CWTrie.h"
@@ -91,4 +99,4 @@
 #import "CWBlockTimer.h"
 #import "CWFixedQueue.h"
 #import "CWPriorityQueue.h"
-#import "NSNumber+RepeatingActions.h"
+


Changes to sync required for promise activities (#26920)

--- src/core/lib/gprpp/sync.h
+++ src/core/lib/gprpp/sync.h
@@ -68,6 +68,7 @@
   bool TryLock() ABSL_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
     return gpr_mu_trylock(&mu_) != 0;
   }
+  void AssertHeld() ABSL_ASSERT_EXCLUSIVE_LOCK() {}

  private:
   gpr_mu mu_;


Auto-merge from mysql-trunk.

Auto-merge from mysql-trunk.

--- storage/myisam/mi_static.c
+++ storage/myisam/mi_static.c
@@ -41,7 +41,6 @@
 ulong    myisam_bulk_insert_tree_size=8192*1024;
 ulong    myisam_data_pointer_size=4;
 ulonglong    myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0;
-pthread_mutex_t  THR_LOCK_myisam_mmap;

 static int always_valid(const char *filename __attribute__((unused)))
 {


Remember to initialize variable

Remember to initialize variable

--- src/csp_service_handler.c
+++ src/csp_service_handler.c
@@ -74,7 +74,7 @@

 		/* Try to malloc a lot */
 #if defined(_CSP_FREERTOS_)
-		uint32_t size;
+		uint32_t size = 0;
 		void * pmem;
 		while(1) {
 			size = size + 100;


- generate M_ERROR on error, discard excess data indications


net: conn: Use safe slist macro when searching connection

Try to catch simultaneous insert to/delete from list when
searching the connection.

Signed-off-by: Jukka Rissanen <f9f077d1da4c7aa947f9864fa5a28c3588f6a45d@linux.intel.com>

--- subsys/net/ip/connection.c
+++ subsys/net/ip/connection.c
@@ -149,8 +149,9 @@
 					  uint16_t local_port)
 {
 	struct net_conn *conn;
-
-	SYS_SLIST_FOR_EACH_CONTAINER(&conn_used, conn, node) {
+	struct net_conn *tmp;
+
+	SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&conn_used, conn, tmp, node) {
 		if (conn->proto != proto) {
 			continue;
 		}


* libsvn_fs/dag.c (node_is_kind_p): Unredund.

--- subversion/libsvn_fs/dag.c
+++ subversion/libsvn_fs/dag.c
@@ -270,10 +270,7 @@
      node kind. */
   skel_t *kind = header->children;

-  if (svn_fs__matches_atom (kind, kindstr))
-    return TRUE;
-  else
-    return FALSE;
+  return svn_fs__matches_atom (kind, kindstr);
 }

 int svn_fs__dag_is_file (dag_node_t *node)


(svn_fs__dag_dir_entries):  create stub so binaries can still link with fs

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@838745 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_fs/dag.c
+++ subversion/libsvn_fs/dag.c
@@ -352,6 +352,16 @@
   return SVN_NO_ERROR;
 }

+
+
+svn_error_t *svn_fs__dag_dir_entries (skel_t **entries_p,
+                                      dag_node_t *node,
+                                      trail_t *trail)
+{
+  abort();
+  /* NOTREACHED */
+  return NULL;
+}


Typo fix.

Typo fix.

Approved by dionisos.

* subversion/libsvn_fs/dag.h (svn_fs__dag_remove_node): Fix typo in comment.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@849121 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_fs/dag.h
+++ subversion/libsvn_fs/dag.h
@@ -330,7 +330,7 @@

    NOTE: If ID represents a directory, and that directory has mutable
    children, you risk orphaning those children by leaving them
-   danging, disconnected from all DAG trees.  It is assumed that
+   dangling, disconnected from all DAG trees.  It is assumed that
    callers of this interface know what in the world they are doing.  */
 svn_error_t *svn_fs__dag_remove_node (svn_fs_t *fs,
                                       const svn_fs_id_t *id,


Simplistic running of stale work queues.

* subversion/libsvn_wc/log.c:
  (svn_wc_cleanup3): open a special DB that allows non-empty work queues
    since we want to empty it(!). run the work queue, if appropriate.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@879461 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_wc/log.c
+++ subversion/libsvn_wc/log.c
@@ -48,6 +48,7 @@
 #include "lock.h"
 #include "translate.h"
 #include "tree_conflicts.h"
+#include "workqueue.h"

 #include "private/svn_wc_private.h"
 #include "svn_private_config.h"
@@ -2395,6 +2396,10 @@
   return svn_wc_adm_close2(adm_access, scratch_pool);
 }

+
+/* ### possibly eliminate the WC_CTX parameter? callers really shouldn't
+   ### be doing anything *but* running a cleanup, and we need a special
+   ### DB anyway. ... *shrug* ... consider later.  */
 svn_error_t *
 svn_wc_cleanup3(svn_wc_context_t *wc_ctx,
                 const char *local_abspath,
@@ -2402,11 +2407,18 @@
                 void *cancel_baton,
                 apr_pool_t * scratch_pool)
 {
+  svn_wc__db_t *db;
   int wc_format_version;

   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));

-  SVN_ERR(svn_wc__internal_check_wc(&wc_format_version, wc_ctx->db,
+  /* We need a DB that allows a non-empty work queue (though it *will*
+     auto-upgrade). We'll handle everything manually.  */
+  SVN_ERR(svn_wc__db_open(&db, svn_wc__db_openmode_readwrite,
+                          NULL /* ### config */, TRUE, FALSE,
+                          scratch_pool, scratch_pool));
+
+  SVN_ERR(svn_wc__internal_check_wc(&wc_format_version, db,
                                     local_abspath, scratch_pool));

   /* a "version" of 0 means a non-wc directory */
@@ -2416,11 +2428,22 @@
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool));

-  if (wc_format_version < SVN_WC__VERSION)
+  if (wc_format_version < SVN_WC__WC_NG_VERSION)
     return svn_error_create(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
                             _("Log format too old, please use "
                               "Subversion 1.6 or earlier"));

+  /* ### we really should be running these logs recursively. bleah.
+     ### for now, just run them in "this" directory. when we reach the
+     ### one-dir layout, then this will work just fine.  */
+  if (wc_format_version >= SVN_WC__HAS_WORK_QUEUE)
+    SVN_ERR(svn_wc__wq_run(db, local_abspath, cancel_func, cancel_baton,
+                           scratch_pool));
+
+  /* We're done with this DB. We can go back to the DB provided in the
+     WC_CTX for the old-style log processing.  */
+  SVN_ERR(svn_wc__db_close(db));
+
   return svn_error_return(cleanup_internal(wc_ctx->db, local_abspath,
                                            cancel_func, cancel_baton,
                                            scratch_pool));


* subversion/svnadmin/main.c
  (subcommand_crashtest): silence 'not all control paths return a value'
   warning in VisualStudio

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1096150 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnadmin/main.c
+++ subversion/svnadmin/main.c
@@ -2004,4 +2004,7 @@

   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
   abort();
-}
+
+  /* merely silence a compiler warning (this will never be executed) */
+  return SVN_NO_ERROR;
+}


* svnserve/main.c (main): Remove the comment claiming that our libraries
aren't thread-safe; the only non-thread-safe area of our library we know
about is the collection of file and line data in errors, and a race
there just means we report inaccurate file and line information in
maintainer-mode error messages.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@846104 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnserve/main.c
+++ subversion/svnserve/main.c
@@ -190,12 +190,9 @@
           exit(0);
         }

-#if APR_HAS_FORK
-      /* This definitely won't work on Windows, which doesn't have the
-       * concept of forking a process at all.  I'm not sure how to
-       * structure a forking daemon process under Windows.  (Threads?
-       * Our library code isn't perfectly thread-safe at the
-       * moment.) -ghudson */
+      /* ### We should try to use threads when APR_HAS_FORK isn't
+       * defined (such as on Windows). */
+#if APR_HAS_FORK
       status = apr_proc_fork(&proc, connection_pool);
       if (status == APR_INCHILD)
         {


* subversion/svnserve/main.c
  (main): The 'flags' parameter for apr_sockaddr_info_get() should
   be apr_int32_t, not u_int32_t.

Found by: joeswatosh

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@905949 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnserve/main.c
+++ subversion/svnserve/main.c
@@ -389,7 +389,7 @@
   apr_uint16_t port = SVN_RA_SVN_PORT;
   const char *host = NULL;
   int family = APR_INET;
-  u_int32_t sockaddr_info_flags = 0;
+  apr_int32_t sockaddr_info_flags = 0;
   svn_boolean_t prefer_v6 = FALSE;
   int mode_opt_count = 0;
   const char *config_filename = NULL;


Fix debug UART call

Fix debug UART call

--- supervisor/shared/serial.c
+++ supervisor/shared/serial.c
@@ -55,7 +55,7 @@
     const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEBUG_UART_TX);

     common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL,
-                                    false, 115200, 8, PARITY_NONE, 1, 1.0f, 64,
+                                    false, 115200, 8, UART_PARITY_NONE, 1, 1.0f, 64,
                                     buf_array, true);
     common_hal_busio_uart_never_reset(&debug_uart);
 #endif


Move WANT_SIGFPE_HANDLER.

Move WANT_SIGFPE_HANDLER.

--- acconfig.h
+++ acconfig.h
@@ -61,6 +61,9 @@
 /* Define to empty if the keyword does not work.  */
 #undef volatile

+/* Define if you want SIGFPE handled (see Include/pyfpe.h). */
+#undef WANT_SIGFPE_HANDLER
+
 /* Define if you want to use SGI (IRIX 4) dynamic linking.
    This requires the "dl" library by Jack Jansen,
    ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
@@ -85,9 +88,6 @@
 /* Define if you want to use the GNU readline library */
 #undef WITH_READLINE

-/* Define if you want SIGFPE handled (see Include/pyfpe.h). */
-#undef WANT_SIGFPE_HANDLER
-

 /* Leave that blank line there-- autoheader needs it! */


wm: fix build

wm: fix build

--- lib/commonAPI/coreapi/ext/shared/NetworkDetectBase.h
+++ lib/commonAPI/coreapi/ext/shared/NetworkDetectBase.h
@@ -2,7 +2,7 @@
 #include "common/RhoThread.h"
 #include "logging/RhoLog.h"
 #include "INetworkDetect.h"
-#ifdef OS_WP8
+#if defined( OS_WP8 ) || defined( OS_WINCE )
 #include "winsock2.h"
 #endif


Method renaming

Method renaming

--- libs-carto/mapnikvt/src/mapnikvt/ExpressionContext.h
+++ libs-carto/mapnikvt/src/mapnikvt/ExpressionContext.h
@@ -32,7 +32,7 @@
         float getScaleDenominator() const { return _scaleDenom; }

         void setFeatureData(std::shared_ptr<const FeatureData> featureData) { _featureData = std::move(featureData); }
-        const std::shared_ptr<const FeatureData>& getFeatureDataPtr() const { return _featureData; }
+        const std::shared_ptr<const FeatureData>& getFeatureData() const { return _featureData; }

         void setNutiParameterValueMap(std::map<std::string, Value> paramValueMap) { _nutiParameterValueMap = std::move(paramValueMap); }
         const std::map<std::string, Value>& getNutiParameterValueMap() const { return _nutiParameterValueMap; }


Removed an unneeded change to the blocking/nonblocking state in
rs232SetSpeed() that was added when the conversion to termios was made.

git-svn-id: 769d22dfa2d22aad706b9a451492fb87c0735f19@3301 08b38cba-cd3b-11de-854e-f91c5b6e4272

--- modules/gadgeteer/gadget/Devices/Intersense/serial.c
+++ modules/gadgeteer/gadget/Devices/Intersense/serial.c
@@ -532,12 +532,6 @@
         return FALSE;
     }

-    if (fcntl(port->desc, F_SETFL, O_NDELAY) < 0)
-    {
-        perror( "Tracker-Port Setup");
-        return FALSE;
-    }
-
     if( tcflush(port->desc, TCIOFLUSH ) == -1 )
     {
         perror( "Flushing Port for InterSense Tracker" );


Improved OS feature detection log messages.

Change-Id: I9de9c83bea12577ef5a56cba5cd460eb67e7cbff

--- lib/cap.c
+++ lib/cap.c
@@ -1190,11 +1190,12 @@
         static struct os_caps {
                 const char *fname;
                 const char *str;
+                const char *desc;
         } tab[PQOS_CAP_TYPE_NUMOF] = {
-                { "/proc/cpuinfo", "cqm"},
-                { "/proc/cpuinfo", "cat_l3"},
-                { "/proc/cpuinfo", "cat_l2"},
-                { "/proc/cpuinfo", "mba"},
+                { "/proc/cpuinfo", "cqm", "CMT"},
+                { "/proc/cpuinfo", "cat_l3", "L3 CAT"},
+                { "/proc/cpuinfo", "cat_l2", "L2 CAT"},
+                { "/proc/cpuinfo", "mba", "MBA"},
         };

         /**
@@ -1223,7 +1224,7 @@
                                   " OS detection!\n");
                         return ret;
                 }
-                LOG_INFO("%s %s\n", tab[type].str, *os_ptr ?
+                LOG_INFO("OS support for %s %s\n", tab[type].desc, *os_ptr ?
                          "detected" : "not detected");
         }
         /**


Add a missing space between type name and "*"

--- lib/ctx.c
+++ lib/ctx.c
@@ -2015,7 +2015,7 @@
     goto exit;
   }

-  cache->next = (grn_cache_entry*)cache;
+  cache->next = (grn_cache_entry *)cache;
   cache->prev = (grn_cache_entry *)cache;
   cache->hash = grn_hash_create(&grn_gctx, NULL, GRN_TABLE_MAX_KEY_SIZE,
                                 sizeof(grn_cache_entry), GRN_OBJ_KEY_VAR_SIZE);


Follow msgpack_packer_write_callback signature change

It's a part of MessagePack 1.0.1 support.

    ctx.c: In function 'grn_ctx_impl_init':
    ctx.c:558:51: warning: passing argument 3 of 'msgpack_packer_init' from incompatible pointer type
       msgpack_packer_init(&ctx->impl->msgpacker, ctx, grn_msgpack_buffer_write);
                                                       ^
    In file included from /tmp/local/include/msgpack.h:27:0,
                     from grn_ctx_impl.h:30,
                     from ctx.c:23:
    /tmp/local/include/msgpack/pack.h:128:13: note: expected 'msgpack_packer_write' but argument is of type 'int (*)(void *, const char *, unsigned int)'
     inline void msgpack_packer_init(msgpack_packer* pk, void* data, msgpack_packer_write callback)
                 ^

GitHub: #328

Reported by Hiroshi Hatake. Thanks!!!

--- lib/ctx.c
+++ lib/ctx.c
@@ -470,8 +470,13 @@
 #define IMPL_SIZE ((sizeof(struct _grn_ctx_impl) + (grn_pagesize - 1)) & ~(grn_pagesize - 1))

 #ifdef GRN_WITH_MESSAGE_PACK
+# if MSGPACK_VERSION_MAJOR < 1
+typedef unsigned int msgpack_size_t;
+# else /* MSGPACK_VERSION_MAJOR < 1 */
+typedef size_t msgpack_size_t;
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
 static int
-grn_msgpack_buffer_write(void *data, const char *buf, unsigned int len)
+grn_msgpack_buffer_write(void *data, const char *buf, msgpack_size_t len)
 {
   grn_ctx *ctx = (grn_ctx *)data;
   return grn_bulk_write(ctx, ctx->impl->outbuf, buf, len);


Implement cos_angle in hdc.c

Implement cos_angle in hdc.c

Signed-off-by: Tushar Pankaj <514568343cdd6c4d7c6bb94cf636e24b01176284@gmail.com>

--- lib/hdc.c
+++ lib/hdc.c
@@ -37,6 +37,7 @@
  * Calculates the norm of VEC.
  * @param vec  Input vector
  * @param len  Length of VEC
+ * @return Norm of VEC
  */
 static double norm(double vec[], size_t len)
 {
@@ -57,3 +58,15 @@
         dest[i] = op1[i] * op2[i];
     }
 }
+
+/**
+ * Calculates the cosine similarity of OP1 and OP2.
+ * @param op1  First operand
+ * @param op2  Second operand
+ * @param len  Length of vectors
+ * @return Cosine similarity of OP1 and OP2.
+ */
+static double cos_angle(double op1[], double op2[], size_t len)
+{
+    return dot_product(op1, op2, len) / (norm(op1, len) * norm(op2, len));
+}