rewrite the mfii_mgmt path to be a bit more... symmetrical.

--- dev/pci/mfii.c
+++ dev/pci/mfii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfii.c,v 1.1 2012/08/14 00:27:51 dlg Exp $ */
+/* $OpenBSD: mfii.c,v 1.2 2012/08/16 03:50:14 dlg Exp $ */

 /*
  * Copyright (c) 2012 David Gwynne <dlg@openbsd.org>
@@ -131,8 +131,6 @@

 	bus_dmamap_t		ccb_dmamap;

-	union mfi_sgl		*ccb_sgl;
-
 	/* data for sgl */
 	void			*ccb_data;
 	size_t			ccb_len;
@@ -240,30 +238,26 @@
 void			mfii_done(struct mfii_softc *, struct mfii_ccb *);
 int			mfii_poll(struct mfii_softc *, struct mfii_ccb *);
 void			mfii_poll_done(struct mfii_softc *, struct mfii_ccb *);
+int			mfii_exec(struct mfii_softc *, struct mfii_ccb *);
+void			mfii_exec_done(struct mfii_softc *, struct mfii_ccb *);
 int			mfii_my_intr(struct mfii_softc *);
 int			mfii_intr(void *);
 void			mfii_postq(struct mfii_softc *);
-void			mfii_empty_done(struct mfii_softc *,
-			    struct mfii_ccb *);

 int			mfii_load_ccb(struct mfii_softc *, struct mfii_ccb *,
 			    void *, int);
+int			mfii_load_mfa(struct mfii_softc *, struct mfii_ccb *,
+			    void *, int);

 int			mfii_mfa_poll(struct mfii_softc *, struct mfii_ccb *);

-int			mfii_mgmt(struct mfii_softc *, u_int32_t, u_int32_t,
-			    u_int32_t, void *, u_int8_t *);
-int			mfii_do_mgmt(struct mfii_softc *, struct mfii_ccb *,
-			    u_int32_t, u_int32_t, u_int32_t, void *,
-			    u_int8_t *);
-void			mfii_mgmt_done(struct mfii_softc *, struct mfii_ccb *);
+int			mfii_mgmt(struct mfii_softc *, struct mfii_ccb *,
+			    u_int32_t, u_int8_t *, void *, size_t, int);

 int			mfii_scsi_cmd_io(struct mfii_softc *,
 			    struct scsi_xfer *);
 int			mfii_scsi_cmd_cdb(struct mfii_softc *,
 			    struct scsi_xfer *);
-int			mfii_create_sgl(struct mfii_softc *, struct mfii_ccb *,
-			    int);

 #define mfii_fw_state(_sc) mfii_read((_sc), MFI_OSP)
@@ -541,9 +535,16 @@
 int
 mfii_get_info(struct mfii_softc *sc)
 {
-	if (mfii_mgmt(sc, MR_DCMD_CTRL_GET_INFO, MFII_DATA_IN,
-	    sizeof(sc->sc_info), &sc->sc_info, NULL))
-		return (1);
+	struct mfii_ccb *ccb;
+	int rv;
+
+	ccb = scsi_io_get(&sc->sc_iopool, 0);
+	rv = mfii_mgmt(sc, ccb, MR_DCMD_CTRL_GET_INFO, NULL,
+	    &sc->sc_info, sizeof(sc->sc_info), SCSI_DATA_IN|SCSI_NOSLEEP);
+	scsi_io_put(&sc->sc_iopool, ccb);
+
+	if (rv != 0)
+		return (rv);

 #ifdef MFI_DEBUG
 	for (i = 0; i < sc->sc_info.mci_image_component_count; i++) {
@@ -698,9 +699,14 @@
 	u_int64_t r;
 	int to = 0, rv = 0;

+#ifdef DIAGNOSTIC
+	if (ccb->ccb_cookie != NULL || ccb->ccb_done != NULL)
+		panic("mfii_mfa_poll called with cookie or done set");
+#endif
+
 	hdr->mfh_context = ccb->ccb_smid;
 	hdr->mfh_cmd_status = 0xff;
-	hdr->mfh_flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
+	hdr->mfh_flags |= htole16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE);

 	r = MFII_REQ_MFA(ccb->ccb_request_dva);
 	memcpy(&ccb->ccb_req, &r, sizeof(ccb->ccb_req));
@@ -730,7 +736,14 @@
 		delay(1000);
 	}

-	ccb->ccb_done(sc, ccb);
+	if (ccb->ccb_len > 0) {
+		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap,
+		    0, ccb->ccb_dmamap->dm_mapsize,
+		    (ccb->ccb_direction == MFII_DATA_IN) ?
+		    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+
+		bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap);
+	}

 	return (rv);
 }
@@ -751,7 +764,7 @@
 	mfii_start(sc, ccb);

 	do {
-		delay(1);
+		delay(10);
 		mfii_postq(sc);
 	} while (rv == 1);

@@ -770,157 +783,131 @@
 }

 int
-mfii_mgmt(struct mfii_softc *sc, u_int32_t opc, u_int32_t dir, u_int32_t len,
-    void *buf, uint8_t *mbox)
-{
-	struct mfii_ccb *ccb;
-	int rv;
-
-	ccb = scsi_io_get(&sc->sc_iopool, 0);
-	mfii_scrub_ccb(ccb);
-	rv = mfii_do_mgmt(sc, ccb, opc, dir, len, buf, mbox);
-	scsi_io_put(&sc->sc_iopool, ccb);
-
-	return (rv);
-}
-
-int
-mfii_do_mgmt(struct mfii_softc *sc, struct mfii_ccb *ccb, u_int32_t opc,
-    u_int32_t dir, u_int32_t len, void *buf, uint8_t *mbox)
-{
-	struct mfi_dcmd_frame	*dcmd;
-	int			rv = EINVAL;
-	uint8_t			*dma_buf = NULL;
-	//int			s;
+mfii_exec(struct mfii_softc *sc, struct mfii_ccb *ccb)
+{
+	struct mutex m = MUTEX_INITIALIZER(IPL_BIO);
+
+#ifdef DIAGNOSTIC
+	if (ccb->ccb_cookie != NULL || ccb->ccb_done != NULL)
+		panic("mfii_exec called with cookie or done set");
+#endif
+
+	ccb->ccb_cookie = &m;
+	ccb->ccb_done = mfii_exec_done;
+
+	mtx_enter(&m);
+	while (ccb->ccb_done != NULL)
+		msleep(ccb, &m, PRIBIO, "mfiiexec", 0);
+	mtx_leave(&m);
+
+	return (0);
+}
+
+void
+mfii_exec_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
+{
+	struct mutex *m = ccb->ccb_cookie;
+
+	mtx_enter(m);
+	ccb->ccb_cookie = NULL;
+	wakeup_one(ccb);
+	mtx_leave(m);
+}
+
+int
+mfii_mgmt(struct mfii_softc *sc, struct mfii_ccb *ccb,
+    u_int32_t opc, u_int8_t *mbox, void *buf, size_t len, int flags)
+{
+	struct mfi_dcmd_frame *dcmd = ccb->ccb_request;
+	struct mfi_frame_header	*hdr = &dcmd->mdf_header;
+	u_int64_t r;
+	u_int8_t *dma_buf;
+	int rv = EIO;

 	dma_buf = dma_alloc(len, PR_WAITOK);
 	if (dma_buf == NULL)
+		return (ENOMEM);
+
+	mfii_scrub_ccb(ccb);
+	ccb->ccb_data = dma_buf;
+	ccb->ccb_len = len;
+	switch (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
+	case SCSI_DATA_IN:
+		ccb->ccb_direction = MFII_DATA_IN;
+		hdr->mfh_flags = htole16(MFI_FRAME_DIR_READ);
+		break;
+	case SCSI_DATA_OUT:
+		ccb->ccb_direction = MFII_DATA_OUT;
+		hdr->mfh_flags = htole16(MFI_FRAME_DIR_WRITE);
+		bcopy(buf, dma_buf, len);
+		break;
+	}
+
+	if (mfii_load_mfa(sc, ccb, &dcmd->mdf_sgl,
+	    ISSET(flags, SCSI_NOSLEEP)) != 0) {
+		rv = ENOMEM;
 		goto done;
-
-	dcmd = ccb->ccb_request;
-	memset(dcmd->mdf_mbox, 0, MFI_MBOX_SIZE);
-	dcmd->mdf_header.mfh_cmd = MFI_CMD_DCMD;
-	dcmd->mdf_header.mfh_timeout = 0;
+	}
+
+	hdr->mfh_cmd = MFI_CMD_DCMD;
+	hdr->mfh_context = ccb->ccb_smid;
+	hdr->mfh_data_len = htole32(len);
+        hdr->mfh_sg_count = ccb->ccb_dmamap->dm_nsegs;

 	dcmd->mdf_opcode = opc;
-	dcmd->mdf_header.mfh_data_len = htole32(0);
-	ccb->ccb_direction = dir;
-	ccb->ccb_cookie = ccb;
-	ccb->ccb_done = mfii_mgmt_done;
-
 	/* handle special opcodes */
-	if (mbox)
+	if (mbox != NULL)
 		memcpy(dcmd->mdf_mbox, mbox, MFI_MBOX_SIZE);

-	if (dir != MFII_DATA_NONE) {
-		if (dir == MFII_DATA_OUT)
-			bcopy(buf, dma_buf, len);
-		dcmd->mdf_header.mfh_data_len = htole32(len);
-		ccb->ccb_data = dma_buf;
-		ccb->ccb_len = len;
-		ccb->ccb_sgl = &dcmd->mdf_sgl;
-
-		if (mfii_create_sgl(sc, ccb, BUS_DMA_WAITOK)) {
-			rv = EINVAL;
-			goto done;
-		}
-	}
-
-	if (cold) {
-		if (mfii_mfa_poll(sc, ccb)) {
-			rv = EIO;
-			goto done;
-		}
-	} else {
-		panic("%s !cold", __func__);
-#if 0
-		s = splbio();
-		mfii_start(sc, ccb);
-
-		while (ccb->ccb_cookie != NULL)
-			tsleep(ccb, PRIBIO, "mfimgmt", 0);
-		splx(s);
-
-		if (ccb->ccb_flags & MFI_CCB_F_ERR) {
-			rv = EIO;
-			goto done;
-		}
-#endif
-	}
-
-	if (dir == MFII_DATA_IN)
-		bcopy(dma_buf, buf, len);
-
-	rv = 0;
+	if (ISSET(flags, SCSI_NOSLEEP))
+		mfii_mfa_poll(sc, ccb);
+	else {
+		r = MFII_REQ_MFA(ccb->ccb_request_dva);
+		memcpy(&ccb->ccb_req, &r, sizeof(ccb->ccb_req));
+		mfii_exec(sc, ccb);
+	}
+
+	if (hdr->mfh_cmd_status == MFI_STAT_OK) {
+		rv = 0;
+
+		if (ccb->ccb_direction == MFII_DATA_IN)
+			bcopy(dma_buf, buf, len);
+	}
+
 done:
-	if (dma_buf)
-		dma_free(dma_buf, len);
+	dma_free(dma_buf, len);

 	return (rv);
 }

-void
-mfii_mgmt_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
-{
-	struct mfi_frame_header *hdr = ccb->ccb_request;
-
-	if (ccb->ccb_data != NULL) {
-		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
-		    ccb->ccb_dmamap->dm_mapsize,
-		    (ccb->ccb_direction & MFII_DATA_IN) ?
-		    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
-
-		bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap);
-	}
-
-	if (hdr->mfh_cmd_status != MFI_STAT_OK)
-		ccb->ccb_flags |= MFI_CCB_F_ERR;
-
-	ccb->ccb_cookie = NULL;
-
-	wakeup(ccb);
-}
-
-int
-mfii_create_sgl(struct mfii_softc *sc, struct mfii_ccb *ccb, int flags)
-{
-	struct mfi_frame_header *hdr;
-	bus_dma_segment_t *sgd;
-	union mfi_sgl *sgl;
-	int error, i;
-
-	if (ccb->ccb_data == NULL)
-		return (1);
-
-	error = bus_dmamap_load(sc->sc_dmat, ccb->ccb_dmamap,
-	    ccb->ccb_data, ccb->ccb_len, NULL, flags);
-	if (error) {
-		if (error == EFBIG)
-			printf("more than %d dma segs\n", sc->sc_max_sgl);
-		else
-			printf("error %d loading dma map\n", error);
-		return (1);
-	}
-
-	hdr = ccb->ccb_request;
-	sgl = ccb->ccb_sgl;
-	sgd = ccb->ccb_dmamap->dm_segs;
-	for (i = 0; i < ccb->ccb_dmamap->dm_nsegs; i++) {
-		sgl->sg32[i].addr = htole32(sgd[i].ds_addr);
-		sgl->sg32[i].len = htole32(sgd[i].ds_len);
-	}
-
-	if (ccb->ccb_direction == MFII_DATA_IN) {
-		hdr->mfh_flags |= MFI_FRAME_DIR_READ;
-		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
-		    ccb->ccb_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
-	} else {
-		hdr->mfh_flags |= MFI_FRAME_DIR_WRITE;
-		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
-		    ccb->ccb_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE);
-	}
-
-	hdr->mfh_sg_count = ccb->ccb_dmamap->dm_nsegs;
+int
+mfii_load_mfa(struct mfii_softc *sc, struct mfii_ccb *ccb,
+    void *sglp, int nosleep)
+{
+	union mfi_sgl *sgl = sglp;
+	bus_dmamap_t dmap = ccb->ccb_dmamap;
+	int error;
+	int i;
+
+	if (ccb->ccb_len == 0)
+		return (0);
+
+	error = bus_dmamap_load(sc->sc_dmat, dmap,
+	    ccb->ccb_data, ccb->ccb_len, NULL,
+	    nosleep ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+        if (error) {
+                printf("%s: error %d loading dmamap\n", DEVNAME(sc), error);
+                return (1);
+        }
+
+	for (i = 0; i < dmap->dm_nsegs; i++) {
+		sgl->sg32[i].addr = htole32(dmap->dm_segs[i].ds_addr);
+		sgl->sg32[i].len = htole32(dmap->dm_segs[i].ds_len);
+	}
+
+	bus_dmamap_sync(sc->sc_dmat, dmap, 0, dmap->dm_mapsize,
+	    ccb->ccb_direction == MFII_DATA_OUT ?
+	    BUS_DMASYNC_PREWRITE : BUS_DMASYNC_PREREAD);

 	return (0);
 }
@@ -947,13 +934,16 @@
 	    ccb->ccb_request_offset, MFII_REQUEST_SIZE,
 	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);

+	if (ccb->ccb_len > 0) {
+		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap,
+		    0, ccb->ccb_dmamap->dm_mapsize,
+		    (ccb->ccb_direction == MFII_DATA_IN) ?
+		    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+
+		bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap);
+	}
+
 	ccb->ccb_done(sc, ccb);
-}
-
-void
-mfii_empty_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
-{
-	/* nop */
 }

 int
@@ -1012,7 +1002,6 @@
 	bus_dmamap_sync(sc->sc_dmat, MFII_DMA_MAP(m),
 	    0, sizeof(*iiq), BUS_DMASYNC_PREREAD);

-	ccb->ccb_done = mfii_empty_done;
 	rv = mfii_mfa_poll(sc, ccb);

 	bus_dmamap_sync(sc->sc_dmat, MFII_DMA_MAP(m),
@@ -1157,16 +1146,8 @@
 mfii_scsi_cmd_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
 {
 	struct scsi_xfer *xs = ccb->ccb_cookie;
-	bus_dmamap_t dmap = ccb->ccb_dmamap;
 	struct mpii_msg_scsi_io *io = ccb->ccb_request;
 	struct mfii_raid_context *ctx = (struct mfii_raid_context *)(io + 1);
-
-	if (ccb->ccb_len != 0) {
-		bus_dmamap_sync(sc->sc_dmat, dmap, 0, dmap->dm_mapsize,
-		    ccb->ccb_direction == MFII_DATA_OUT ?
-		    BUS_DMASYNC_PREWRITE : BUS_DMASYNC_PREREAD);
-		bus_dmamap_unload(sc->sc_dmat, dmap);
-	}

 	switch (ctx->status) {
         case MFI_STAT_OK:
@@ -1312,7 +1293,6 @@
 	ccb->ccb_flags = 0;
 	ccb->ccb_done = NULL;
 	ccb->ccb_direction = 0;
-	ccb->ccb_sgl = NULL;
 	ccb->ccb_data = NULL;
 	ccb->ccb_len = 0;


Finished decomposing the update_player function

Resolves #126

--- game/physics.c
+++ game/physics.c
@@ -337,6 +337,9 @@

 void process_command(Game *game, const Command command) {
     Player *player = game->player;
+    if (command != COMMAND_NONE) {
+        player->physics = 1;
+    }
     /* Update the player running state */
     if (command == COMMAND_LEFT) {
         if (player->speed_x == 0) {
@@ -399,11 +402,8 @@
     }
 }

-void update_player(Game *game, const Command command) {
+void update_player_perk(Game *game) {
     Player *player = game->player;
-    if (command != COMMAND_NONE) {
-        player->physics = 1;
-    }
     if (player->physics) {
         game->played_frames++;
         /* Check for expiration of the player's perk. */
@@ -436,6 +436,10 @@
             }
         }
     }
+}
+
+void update_player(Game *game, const Command command) {
+    update_player_perk(game);
     process_command(game, command);
     /* This ordering makes the player run horizontally before falling.
      * This seems to be the expected order from an user point-of-view. */


[xfatfs] xfatfs_read()バグ修正。nreadの値が正しくとれていなかった。

--- picox/filesystem/xfatfs.c
+++ picox/filesystem/xfatfs.c
@@ -288,8 +288,8 @@
         fres = f_read(filehandle, p, to_read, &read);
         X__EXIT_IF(fres != FR_OK, X__ToXError(fres));

-        size    -= to_read;
-        p       += to_read;
+        size -= read;
+        p    += read;

         /* ファイル終端チェック */
         X_BREAK_IF(to_read != read);


Remove early return from style-set on non-realized widget

vte_terminal_set_font_full_internal copes just fine with this.

--- src/vte.c
+++ src/vte.c
@@ -4571,12 +4571,6 @@
 			GtkStyle       *prev_style)
 {
 	VteTerminal *terminal = VTE_TERMINAL(widget);
-
-	if (!GTK_WIDGET_REALIZED(widget)) {
-		_vte_debug_print(VTE_DEBUG_MISC,
-				"Don't change style if we aren't realized.\n");
-		return;
-	}

         GTK_WIDGET_CLASS (vte_terminal_parent_class)->style_set (widget, prev_style);


tweak mpii_start.

tweak mpii_start.

on 64bit archs you can post the descriptor in one go, which is easy. on
32bit you have to post it in halves in the right order, which is not
atomic and requires barriers for ordering.

--- dev/pci/mpii.c
+++ dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: mpii.c,v 1.87 2014/03/27 07:12:52 dlg Exp $	*/
+/*	$OpenBSD: mpii.c,v 1.88 2014/03/27 10:15:43 dlg Exp $	*/
 /*
  * Copyright (c) 2010, 2012 Mike Belopuhov
  * Copyright (c) 2009 James Giannoules
@@ -127,7 +127,6 @@

 struct mpii_ccb {
 	struct mpii_softc	*ccb_sc;
-	int			ccb_smid;

 	void *			ccb_cookie;
 	bus_dmamap_t		ccb_dmamap;
@@ -136,6 +135,7 @@
 	void			*ccb_cmd;
 	bus_addr_t		ccb_cmd_dva;
 	u_int16_t		ccb_dev_handle;
+	u_int16_t		ccb_smid;

 	volatile enum {
 		MPII_CCB_FREE,
@@ -2384,7 +2384,7 @@
 		}

 		ccb->ccb_sc = sc;
-		ccb->ccb_smid = i;
+		htolem16(&ccb->ccb_smid, i);
 		ccb->ccb_offset = sc->sc_request_size * i;

 		ccb->ccb_cmd = &cmd[ccb->ccb_offset];
@@ -2499,10 +2499,16 @@
 {
 	struct mpii_request_header	*rhp;
 	struct mpii_request_descr	descr;
-	u_int32_t			*rdp = (u_int32_t *)&descr;
+	u_long				 *rdp = (u_long *)&descr;

 	DNPRINTF(MPII_D_RW, "%s: mpii_start %#x\n", DEVNAME(sc),
 	    ccb->ccb_cmd_dva);
+
+	bus_dmamap_sync(sc->sc_dmat, MPII_DMA_MAP(sc->sc_requests),
+	    ccb->ccb_offset, sc->sc_request_size,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
+	ccb->ccb_state = MPII_CCB_QUEUED;

 	rhp = ccb->ccb_cmd;

@@ -2511,7 +2517,7 @@
 	switch (rhp->function) {
 	case MPII_FUNCTION_SCSI_IO_REQUEST:
 		descr.request_flags = MPII_REQ_DESCR_SCSI_IO;
-		htolem16(&descr.dev_handle, ccb->ccb_dev_handle);
+		descr.dev_handle = htole16(ccb->ccb_dev_handle);
 		break;
 	case MPII_FUNCTION_SCSI_TASK_MGMT:
 		descr.request_flags = MPII_REQ_DESCR_HIGH_PRIORITY;
@@ -2521,13 +2527,7 @@
 	}

 	descr.vf_id = sc->sc_vf_id;
-	htolem16(&descr.smid, ccb->ccb_smid);
-
-	bus_dmamap_sync(sc->sc_dmat, MPII_DMA_MAP(sc->sc_requests),
-	    ccb->ccb_offset, sc->sc_request_size,
-	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-
-	ccb->ccb_state = MPII_CCB_QUEUED;
+	descr.smid = ccb->ccb_smid;

 	DNPRINTF(MPII_D_RW, "%s:   MPII_REQ_DESCR_POST_LOW (0x%08x) write "
 	    "0x%08x\n", DEVNAME(sc), MPII_REQ_DESCR_POST_LOW, *rdp);
@@ -2535,10 +2535,22 @@
 	DNPRINTF(MPII_D_RW, "%s:   MPII_REQ_DESCR_POST_HIGH (0x%08x) write "
 	    "0x%08x\n", DEVNAME(sc), MPII_REQ_DESCR_POST_HIGH, *(rdp+1));

+#if defined(__LP64__)
+	bus_space_write_raw_8(sc->sc_iot, sc->sc_ioh,
+	    MPII_REQ_DESCR_POST_LOW, *rdp);
+#else
 	mtx_enter(&sc->sc_req_mtx);
-	mpii_write(sc, MPII_REQ_DESCR_POST_LOW, htole32(*rdp));
-	mpii_write(sc, MPII_REQ_DESCR_POST_HIGH, htole32(*(rdp+1)));
+	bus_space_write_raw_4(sc->sc_iot, sc->sc_ioh,
+	    MPII_REQ_DESCR_POST_LOW, rdp[0]);
+	bus_space_barrier(sc->sc_iot, sc->sc_ioh,
+	    MPII_REQ_DESCR_POST_LOW, 8, BUS_SPACE_BARRIER_WRITE);
+
+	bus_space_write_raw_4(sc->sc_iot, sc->sc_ioh,
+	    MPII_REQ_DESCR_POST_HIGH, rdp[1]);
+	bus_space_barrier(sc->sc_iot, sc->sc_ioh,
+	    MPII_REQ_DESCR_POST_LOW, 8, BUS_SPACE_BARRIER_WRITE);
 	mtx_leave(&sc->sc_req_mtx);
+#endif
 }

 int


[tests] Initialize threads

[tests] Initialize threads

Since Twitter-GLib is using libsoup and GIO asynchronous APIs it's a
good idea to initialize threading before actually using those API.
Since libraries MUST NOT do that, we need to do it ourselves in
binaries using those libraries.

--- tests/twitter-test-main.c
+++ tests/twitter-test-main.c
@@ -7,6 +7,8 @@
                    char ***argv)
 {
   g_type_init ();
+
+  g_thread_init (NULL);

   g_test_init (argc, argv, NULL);


Changed ALL of the error messages to be more readable.

--- gram/protocol/source/globus_gram_protocol_error.c
+++ gram/protocol/source/globus_gram_protocol_error.c
@@ -4,82 +4,82 @@
 globus_l_gram_client_error_strings[] =
 {
     "Success",
-    "GLOBUS_GRAM_CLIENT_ERROR_PARAMETER_NOT_SUPPORTED",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_REQUEST",
-    "GLOBUS_GRAM_CLIENT_ERROR_NO_RESOURCES",
-    "GLOBUS_GRAM_CLIENT_ERROR_BAD_DIRECTORY",
-    "GLOBUS_GRAM_CLIENT_ERROR_EXECUTABLE_NOT_FOUND",
-    "GLOBUS_GRAM_CLIENT_ERROR_INSUFFICIENT_FUNDS",
-    "GLOBUS_GRAM_CLIENT_ERROR_AUTHORIZATION",
-    "GLOBUS_GRAM_CLIENT_ERROR_USER_CANCELLED",
-    "GLOBUS_GRAM_CLIENT_ERROR_SYSTEM_CANCELLED",
-    "GLOBUS_GRAM_CLIENT_ERROR_PROTOCOL_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_STDIN_NOT_FOUND",
-    "GLOBUS_GRAM_CLIENT_ERROR_CONNECTION_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_MAXTIME",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_COUNT",
-    "GLOBUS_GRAM_CLIENT_ERROR_NULL_SPECIFICATION_TREE",
-    "GLOBUS_GRAM_CLIENT_ERROR_JM_FAILED_ALLOW_ATTACH",
-    "GLOBUS_GRAM_CLIENT_ERROR_JOB_EXECUTION_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_PARADYN",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_JOBTYPE",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_MYJOB",
-    "GLOBUS_GRAM_CLIENT_ERROR_BAD_SCRIPT_ARG_FILE",
-    "GLOBUS_GRAM_CLIENT_ERROR_ARG_FILE_CREATION_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_JOBSTATE",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_SCRIPT_REPLY",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_SCRIPT_STATUS",
-    "GLOBUS_GRAM_CLIENT_ERROR_JOBTYPE_NOT_SUPPORTED",
-    "GLOBUS_GRAM_CLIENT_ERROR_UNIMPLEMENTED",
-    "GLOBUS_GRAM_CLIENT_ERROR_TEMP_SCRIPT_FILE_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_USER_PROXY_NO_FOUND",
-    "GLOBUS_GRAM_CLIENT_ERROR_OPENING_USER_PROXY",
-    "GLOBUS_GRAM_CLIENT_ERROR_JOB_CANCEL_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_MALLOC_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_DUCT_INIT_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_DUCT_LSP_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_HOST_COUNT",
-    "GLOBUS_GRAM_CLIENT_ERROR_UNSUPPORTED_PARAMETER",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_QUEUE",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_PROJECT",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_EVALUATION_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_BAD_RSL_ENVIRONMENT",
-    "GLOBUS_GRAM_CLIENT_ERROR_DRYRUN",
-    "GLOBUS_GRAM_CLIENT_ERROR_ZERO_LENGTH_RSL",
-    "GLOBUS_GRAM_CLIENT_ERROR_STAGING_EXECUTABLE",
-    "GLOBUS_GRAM_CLIENT_ERROR_STAGING_STDIN",
-    "GLOBUS_GRAM_CLIENT_ERROR_INVALID_JOB_MANAGER_TYPE",
-    "GLOBUS_GRAM_CLIENT_ERROR_BAD_ARGUMENTS",
-    "GLOBUS_GRAM_CLIENT_ERROR_GATEKEEPER_MISCONFIGURED",
-    "GLOBUS_GRAM_CLIENT_ERROR_BAD_RSL",
-    "GLOBUS_GRAM_CLIENT_ERROR_VERSION_MISMATCH",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_ARGUMENTS",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_COUNT",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_DIRECTORY",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_DRYRUN",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_ENVIRONMENT",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_EXECUTABLE",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_HOST_COUNT",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_JOBTYPE",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_MAXTIME",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_MYJOB",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_PARADYN",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_PROJECT",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_QUEUE",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_STDERR",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_STDIN",
-    "GLOBUS_GRAM_CLIENT_ERROR_RSL_STDOUT",
-    "GLOBUS_GRAM_CLIENT_ERROR_OPENING_JOBMANAGER_SCRIPT",
-    "GLOBUS_GRAM_CLIENT_ERROR_CREATING_PIPE",
-    "GLOBUS_GRAM_CLIENT_ERROR_FCNTL_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_STDOUT_FILENAME_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_STDERR_FILENAME_FAILED",
-    "GLOBUS_GRAM_CLIENT_ERROR_FORKING_EXECUTABLE",
-    "GLOBUS_GRAM_CLIENT_ERROR_EXECUTABLE_PERMISSIONS",
-    "GLOBUS_GRAM_CLIENT_ERROR_OPENING_STDOUT",
-    "GLOBUS_GRAM_CLIENT_ERROR_OPENING_STDERR",
-    "GLOBUS_GRAM_CLIENT_ERROR_OPENING_CACHE_USER_PROXY",
-    "GLOBUS_GRAM_CLIENT_ERROR_OPENING_CACHE"
+    "One of The RSL parameters is not supported",
+    "the RSL lentgh is greater than the maximum allowed",
+    "unused NO_RESOURCES",
+    "unable to set default to the directory requested",
+    "executable not found",
+    "unused INSUFFICIENT_FUNDS",
+    "authentication with the remote server failed.",
+    "unused USER_CANCELLED",
+    "unused SYSTEM_CANCELLED",
+    "failure during data transfer to the server",
+    "stdin file not found",
+    "failed to connect to server, check host and port",
+    "invalid maxtime, integer required",
+    "invalid count, integer required",
+    "job manager received an invalid RSL",
+    "job manager failed in allowing others to make contact",
+    "job failed when the job manager attempted to run it",
+    "Invalid paradyn specified",
+    "jobtype RSL parameter is invalid",
+    "myjob RSL parameter is invalid",
+    "The job manager failed to locate an internal script argument file",
+    "The job manager failed to create an internal script argument file",
+    "The job manager detected an invalid job state",
+    "The job manager detected an invalid script response",
+    "The job manager detected an invalid job state",
+    "The RSL jobtype is not supported by this job manager",
+    "unused ERROR_UNIMPLEMENTED",
+    "The job manager failed to create an internal script submission file",
+    "The job manager can not find the user proxy",
+    "The job manager failed to open the user proxy",
+    "The job manager failed to cancel the job as requested",
+    "System error: malloc failed",
+    "Failed to initialize job interprocess communication",
+    "Failed to setup job interprocess communication",
+    "The RSL host count parameter is invalid",
+    "One of the RSL parameters specified is unsupported",
+    "The RSL queue parameter is invalid",
+    "The RSL project parameter is invalid",
+    "The RSL includes variables that could not be identified",
+    "The RSL environment parameter is invalid",
+    "The RSL dryrun parameter is invalid",
+    "The RSL is invalid, empty string",
+    "The job manager failed to stage the executable",
+    "The job manager failed to stage the stdin file",
+    "Request to run an invalid job manager type",
+    "The RSL arguments parameter is invalid",
+    "The gatekeeper failed to run the job manager",
+    "The RSL is invalid, parse failed",
+    "There is a version mismatch between GRAM components",
+    "The RSL arguments parameter is invalid",
+    "The RSL count parameter is invalid",
+    "The RSL directory parameter is invalid",
+    "The RSL dryrun parameter is invalid",
+    "The RSL environment parameter is invalid",
+    "The RSL executable parameter is invalid",
+    "The RSL host_count parameter is invalid",
+    "The RSL jobtype parameter is invalid",
+    "The RSL maxtime parameter is invalid",
+    "The RSL myjob parameter is invalid",
+    "The RSL paradyn parameter is invalid",
+    "The RSL project parameter is invalid",
+    "The RSL queue parameter is invalid",
+    "The RSL stderr parameter is invalid",
+    "The RSL stdin parameter is invalid",
+    "The RSL stdout parameter is invalid",
+    "The job manager failed to locate an internal script",
+    "The job manager failed on the system call pipe()",
+    "The job manager failed on the system call fcntl()",
+    "The job manager failed to create the temporary stdout filename",
+    "The job manager failed to create the temporary stderr filename",
+    "The job manager failed on the system call fork()",
+    "unable to run the executable because of the file permissions",
+    "The job manager failed to open stdout",
+    "The job manager failed to open stderr",
+    "Unable to open cache file to relocate the user proxy",
+    "The job manager failed to open the cache"
 };

 const char *


- drobne poprawki kompatybilności dla SunOS (sz)

git-svn-id: 5ce22904ebd2e91e07686586c06e775ed4fb9e1a@360 d0e0d552-48cc-411f-a74d-6ebdfb0732cf

--- src/libgadu.c
+++ src/libgadu.c
@@ -1158,7 +1158,7 @@
 	}

 	/* wytnij cieki, zostaw tylko nazw pliku */
-	while ((tmp = rindex(filename, '/')) || (tmp = rindex(filename, '\\')))
+	while ((tmp = strrchr(filename, '/')) || (tmp = strrchr(filename, '\\')))
 		filename = tmp + 1;

 	if (strlen(filename) < 1 || strlen(filename) > 1024) {


MFC r273026:

MFC r273026:

Add a tunable for arc_shrink_shift (vfs.zfs.arc_shrink_shift) that
controls how much fraction, 1/2^arc_shrink_shift, should be reclaimed
when there is memory pressure.

Submitted by:	Richard Kojedzinszky <krichy at tvnetwork.hu>

--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -220,6 +220,7 @@
 TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min);
 TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit);
 TUNABLE_QUAD("vfs.zfs.arc_average_blocksize", &zfs_arc_average_blocksize);
+TUNABLE_INT("vfs.zfs.arc_shrink_shift", &zfs_arc_shrink_shift);
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0,
     "Maximum ARC size");
@@ -228,6 +229,10 @@
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_average_blocksize, CTLFLAG_RDTUN,
     &zfs_arc_average_blocksize, 0,
     "ARC average blocksize");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_shrink_shift, CTLFLAG_RW,
+    &arc_shrink_shift, 0,
+    "log2(fraction of arc to reclaim)");
+
 /*
  * We don't have a tunable for arc_free_target due to the dependency on
  * pagedaemon initialisation.


fix the test program in VoNR

fix the test program in VoNR

--- tests/vonr/session-test.c
+++ tests/vonr/session-test.c
@@ -1905,6 +1905,8 @@
     rv = testgnb_ngap_send(ngap, sendbuf);
     ABTS_INT_EQUAL(tc, OGS_OK, rv);

+    ogs_msleep(100);
+
     /* Send PDU session establishment request */
     sess6 = test_sess_add_by_dnn_and_psi(test_ue, "ims", 6);
     ogs_assert(sess6);


* vte.c: fix the name of a declared function (was _set_size, is _size_set)

git-svn-id: 79c0a0b434771571d36fb1f915535dd30d02fa63@57 c1152ede-e825-0410-90e1-bb353d73734c

--- src/vte.h
+++ src/vte.h
@@ -90,7 +90,7 @@
 void vte_terminal_fork_command(VteTerminal *terminal,
 			       const char *command,
 			       const char **argv);
-void vte_terminal_set_size(VteTerminal *terminal, long columns, long rows);
+void vte_terminal_size_set(VteTerminal *terminal, long columns, long rows);
 void vte_terminal_feed(VteTerminal *terminal,
 		       const char *data,
 		       size_t length);


gnrc_ipv6_netif: a RA source MUST be link-local

--- sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c
+++ sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c
@@ -111,8 +111,7 @@
                 mutex_unlock(&entry->mutex);    /* function below relocks mutex */
 #ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER
                 if (entry->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN) {
-                    gnrc_ndp_internal_send_rtr_adv(entry->pid, &tmp_addr->addr,
-                                                   NULL, false);
+                    gnrc_ndp_internal_send_rtr_adv(entry->pid, NULL, NULL, false);
                 }
 #endif
 #ifdef MODULE_GNRC_NDP_ROUTER


* Fix a nasty problem with output buffering not have enough (or large enough)
  buffers. In fact, the code was pretty much shot.
* Try to fool WMP into thinking that we are a microsoft server.
* When we establish a stream to a user, copy the codec information from
  that saved as part of the stream. This gives us the real frame_size and
  other important parameters.
* ASF needs to know about key frames, so add some logic to copy this information
  around.
* When we get the data from ffmpeg as part of a feed, make sure that we save
  the actual codec parameters.
* Allow configuration of AudioCodec and VideoCodec
* Make sure that we delete the feed file before starting. This is not ideal
  but it makes things work a whole lot better!

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@454 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- ffserver.c
+++ ffserver.c
@@ -63,7 +63,8 @@
     "WAIT_FEED",
 };

-#define IOBUFFER_MAX_SIZE 16384
+#define IOBUFFER_MAX_SIZE 32768
+#define PACKET_MAX_SIZE 16384

 /* coef for exponential mean for bitrate estimation in statistics */
 #define AVG_COEF 0.9
@@ -79,7 +80,6 @@
     struct sockaddr_in from_addr; /* origin */
     struct pollfd *poll_entry; /* used when polling */
     long timeout;
-    UINT8 buffer[IOBUFFER_MAX_SIZE];
     UINT8 *buffer_ptr, *buffer_end;
     int http_error;
     struct HTTPContext *next;
@@ -93,6 +93,8 @@
     struct FFStream *stream;
     AVFormatContext fmt_ctx;
     int last_packet_sent; /* true if last data packet was sent */
+    UINT8 buffer[IOBUFFER_MAX_SIZE];
+    UINT8 pbuffer[PACKET_MAX_SIZE];
 } HTTPContext;

 /* each generated stream is described here */
@@ -528,13 +530,14 @@
     mime_type = c->stream->fmt->mime_type;
     if (!mime_type)
         mime_type = "application/x-octet_stream";
-    q += sprintf(q, "Content-type: %s\r\n", mime_type);
     q += sprintf(q, "Pragma: no-cache\r\n");

     /* for asf, we need extra headers */
     if (!strcmp(c->stream->fmt->name,"asf")) {
-        q += sprintf(q, "Pragma: features=broadcast\r\n");
-    }
+        q += sprintf(q, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=1234\r\nPragma: features=\"broadcast\"\r\n");
+        mime_type = "application/octet-stream";
+    }
+    q += sprintf(q, "Content-Type: %s\r\n", mime_type);
     q += sprintf(q, "\r\n");

     /* prepare output buffer */
@@ -606,6 +609,8 @@
                     case CODEC_TYPE_VIDEO:
                         video_bit_rate += st->codec.bit_rate;
                         break;
+                    default:
+                        abort();
                     }
                 }
                 q += sprintf(q, "<TD> %s <TD> %d <TD> %d <TD> %d",
@@ -696,11 +701,15 @@
                               unsigned char *buf, int size)
 {
     HTTPContext *c = opaque;
-    if (size > IOBUFFER_MAX_SIZE)
+
+    if (c->buffer_ptr == c->buffer_end || !c->buffer_ptr)
+        c->buffer_ptr = c->buffer_end = c->buffer;
+
+    if (c->buffer_end - c->buffer + size > IOBUFFER_MAX_SIZE)
         abort();
-    memcpy(c->buffer, buf, size);
-    c->buffer_ptr = c->buffer;
-    c->buffer_end = c->buffer + size;
+
+    memcpy(c->buffer_end, buf, size);
+    c->buffer_end += size;
 }

 static int open_input_stream(HTTPContext *c, const char *info)
@@ -718,6 +727,9 @@
         /* compute position (absolute time) */
         if (find_info_tag(buf, sizeof(buf), "date", info)) {
             stream_pos = parse_date(buf, 0);
+        } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
+            int prebuffer = strtol(buf, 0, 10);
+            stream_pos = gettime() - prebuffer * 1000000;
         } else {
             stream_pos = gettime();
         }
@@ -763,7 +775,11 @@
                 AVStream *st;
                 st = av_mallocz(sizeof(AVStream));
                 c->fmt_ctx.streams[i] = st;
-                memcpy(st, c->stream->streams[i], sizeof(AVStream));
+                if (c->stream->feed == c->stream)
+                    memcpy(st, c->stream->streams[i], sizeof(AVStream));
+                else
+                    memcpy(st, c->stream->feed->streams[c->stream->feed_streams[i]], sizeof(AVStream));
+
                 st->codec.frame_number = 0; /* XXX: should be done in
                                                AVStream, not in codec */
                 c->got_key_frame[i] = 0;
@@ -782,7 +798,7 @@
                 c->got_key_frame[i] = 0;
             }
         }
-        init_put_byte(&c->fmt_ctx.pb, c->buffer, IOBUFFER_MAX_SIZE,
+        init_put_byte(&c->fmt_ctx.pb, c->pbuffer, PACKET_MAX_SIZE,
                       1, c, NULL, http_write_packet, NULL);
         c->fmt_ctx.pb.is_streamed = 1;
         /* prepare header */
@@ -881,9 +897,24 @@
                         }
                     }
                 } else {
-		send_it:
+                    AVCodecContext *codec;
+                send_it:
+                    /* Fudge here */
+                    codec = &c->fmt_ctx.streams[pkt.stream_index]->codec;
+
+                    codec->key_frame = ((pkt.flags & PKT_FLAG_KEY) != 0);
+
+#ifdef PJSG
+                    if (codec->codec_type == CODEC_TYPE_AUDIO) {
+                        codec->frame_size = (codec->sample_rate * pkt.duration + 500000) / 1000000;
+                        /* printf("Calculated size %d, from sr %d, duration %d\n", codec->frame_size, codec->sample_rate, pkt.duration); */
+                    }
+#endif
+
                     if (av_write_packet(&c->fmt_ctx, &pkt, 0))
-			c->state = HTTPSTATE_SEND_DATA_TRAILER;
+                        c->state = HTTPSTATE_SEND_DATA_TRAILER;
+
+                    codec->frame_number++;
                 }

                 av_free_packet(&pkt);
@@ -920,15 +951,17 @@
         }
     }

-    len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr);
-    if (len < 0) {
-        if (errno != EAGAIN && errno != EINTR) {
-            /* error : close connection */
-            return -1;
-        }
-    } else {
-        c->buffer_ptr += len;
-        c->data_count += len;
+    if (c->buffer_end > c->buffer_ptr) {
+        len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr);
+        if (len < 0) {
+            if (errno != EAGAIN && errno != EINTR) {
+                /* error : close connection */
+                return -1;
+            }
+        } else {
+            c->buffer_ptr += len;
+            c->data_count += len;
+        }
     }
     return 0;
 }
@@ -963,10 +996,10 @@
     HTTPContext *c1;

     if (c->buffer_ptr >= c->buffer_end) {
+        FFStream *feed = c->stream;
         /* a packet has been received : write it in the store, except
            if header */
         if (c->data_count > FFM_PACKET_SIZE) {
-            FFStream *feed = c->stream;

             //            printf("writing pos=0x%Lx size=0x%Lx\n", feed->feed_write_index, feed->feed_size);
             /* XXX: use llseek or url_seek */
@@ -992,6 +1025,29 @@
                     c1->state = HTTPSTATE_SEND_DATA;
                 }
             }
+        } else {
+            /* We have a header in our hands that contains useful data */
+            AVFormatContext s;
+            ByteIOContext *pb = &s.pb;
+            int i;
+
+            memset(&s, 0, sizeof(s));
+
+            url_open_buf(pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
+            pb->buf_end = c->buffer_end;        /* ?? */
+            pb->is_streamed = 1;
+
+            if (feed->fmt->read_header(&s, 0) < 0) {
+                goto fail;
+            }
+
+            /* Now we have the actual streams */
+            if (s.nb_streams != feed->nb_streams) {
+                goto fail;
+            }
+            for (i = 0; i < s.nb_streams; i++) {
+                memcpy(&feed->streams[i]->codec, &s.streams[i]->codec, sizeof(AVCodecContext));
+            }
         }
         c->buffer_ptr = c->buffer;
     }
@@ -1028,7 +1084,8 @@
     for(i=0;i<feed->nb_streams;i++) {
         st = feed->streams[i];
         av1 = &st->codec;
-        if (av1->codec == av->codec &&
+        if (av1->codec_id == av->codec_id &&
+            av1->codec_type == av->codec_type &&
             av1->bit_rate == av->bit_rate) {

             switch(av->codec_type) {
@@ -1044,6 +1101,8 @@
                     av1->gop_size == av->gop_size)
                     goto found;
                 break;
+            default:
+                abort();
             }
         }
     }
@@ -1187,6 +1246,8 @@
         av->max_qdiff= 3;

         break;
+    default:
+        abort();
     }

     st = av_mallocz(sizeof(AVStream));
@@ -1194,6 +1255,40 @@
         return;
     stream->streams[stream->nb_streams++] = st;
     memcpy(&st->codec, av, sizeof(AVCodecContext));
+}
+
+int opt_audio_codec(const char *arg)
+{
+    AVCodec *p;
+
+    p = first_avcodec;
+    while (p) {
+        if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_AUDIO)
+            break;
+        p = p->next;
+    }
+    if (p == NULL) {
+        return CODEC_ID_NONE;
+    }
+
+    return p->id;
+}
+
+int opt_video_codec(const char *arg)
+{
+    AVCodec *p;
+
+    p = first_avcodec;
+    while (p) {
+        if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_VIDEO)
+            break;
+        p = p->next;
+    }
+    if (p == NULL) {
+        return CODEC_ID_NONE;
+    }
+
+    return p->id;
 }

 int parse_ffconfig(const char *filename)
@@ -1319,6 +1414,9 @@
                 fprintf(stderr, "%s:%d: No corresponding <Feed> for </Feed>\n",
                         filename, line_num);
                 errors++;
+            } else {
+                /* Make sure that we start out clean */
+                unlink(feed->feed_filename);
             }
             feed = NULL;
         } else if (!strcasecmp(cmd, "<Stream")) {
@@ -1386,6 +1484,22 @@
                 audio_id = stream->fmt->audio_codec;
                 video_id = stream->fmt->video_codec;
             }
+        } else if (!strcasecmp(cmd, "AudioCodec")) {
+            get_arg(arg, sizeof(arg), &p);
+            audio_id = opt_audio_codec(arg);
+            if (audio_id == CODEC_ID_NONE) {
+                fprintf(stderr, "%s:%d: Unknown AudioCodec: %s\n",
+                        filename, line_num, arg);
+                errors++;
+            }
+        } else if (!strcasecmp(cmd, "VideoCodec")) {
+            get_arg(arg, sizeof(arg), &p);
+            video_id = opt_video_codec(arg);
+            if (video_id == CODEC_ID_NONE) {
+                fprintf(stderr, "%s:%d: Unknown VideoCodec: %s\n",
+                        filename, line_num, arg);
+                errors++;
+            }
         } else if (!strcasecmp(cmd, "AudioBitRate")) {
             get_arg(arg, sizeof(arg), &p);
             if (stream) {


Make sure we don't write too much metadata.

--- dev/softraid.c
+++ dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.28 2007/04/21 23:39:18 marco Exp $ */
+/* $OpenBSD: softraid.c,v 1.29 2007/04/21 23:50:47 marco Exp $ */
 /*
  * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
  *
@@ -1789,6 +1789,14 @@
 	im_sv = (struct sr_vol_meta *)(sm + 1);
 	im_sc = (struct sr_chunk_meta *)(im_sv + 1);

+	if (sizeof(struct sr_metadata) + sizeof(struct sr_vol_meta) +
+	    (sizeof(struct sr_chunk_meta) * sd->sd_vol.sv_meta.svm_no_chunk) >
+	    sz) {
+		printf("%s: too much metadata.  Metadata NOT written to disk\n",
+		    DEVNAME(sc));
+		goto bad;
+	}
+
 	if (sm->ssd_magic == 0) {
 		/* initial metadata */
 		sm->ssd_magic = SR_MAGIC;
@@ -1798,7 +1806,7 @@
 		sr_get_uuid(&sm->ssd_uuid);

 		/* volume */
-		bcopy(sv, im_sv, sizeof(struct sr_metadata));
+		bcopy(sv, im_sv, sizeof(struct sr_vol_meta));
 		bcopy(&sm->ssd_uuid, &im_sv->svm_uuid,
 		    sizeof(im_sv->svm_uuid));
 		sm->ssd_vd_ver = SR_VOL_VERSION;
@@ -1806,7 +1814,6 @@

 		/* chunk */
-		/* XXX do some sanity to prevent too many disks */
 		for (i = 0; i < sd->sd_vol.sv_meta.svm_no_chunk; i++) {
 			bcopy(&sm->ssd_uuid,
 			    &sd->sd_vol.sv_chunks[i]->src_meta.scm_uuid,
@@ -1861,7 +1868,7 @@
 		biowait(&b);

 		/* XXX do something smart here */
-		/* marck chunk offline and restart metadata write */
+		/* mark chunk offline and restart metadata write */
 		if (b.b_flags & B_ERROR) {
 			printf("%s: %s i/o error on block %d while writing "
 			    "metadata %d\n", DEVNAME(sc),


winhttp: retry authentication

winhttp: retry authentication

If the caller has provided bad authentication, give them another
apportunity to get it right until they give up. This brings WinHTTP in
line with the other transports.

--- src/transports/winhttp.c
+++ src/transports/winhttp.c
@@ -926,10 +926,11 @@
 			if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0)
 				return -1;

-			if (allowed_types &&
-				(!t->cred || 0 == (t->cred->credtype & allowed_types))) {
+			if (allowed_types) {
 				int cred_error = 1;

+				git_cred_free(t->cred);
+				t->cred = NULL;
 				/* Start with the user-supplied credential callback, if present */
 				if (t->owner->cred_acquire_cb) {
 					cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,


more and more ... and more more... https zawsze i wszedzie ;>

git-svn-id: 5ce22904ebd2e91e07686586c06e775ed4fb9e1a@13 d0e0d552-48cc-411f-a74d-6ebdfb0732cf

--- src/libgadu.c
+++ src/libgadu.c
@@ -1040,14 +1040,16 @@
 				gg_debug(GG_DEBUG_MISC, "-- connection failed, trying direct connection\n");

 				if ((sess->fd = gg_connect(addr, GG_DEFAULT_PORT, sess->async)) == -1) {
+				    gg_debug(GG_DEBUG_MISC, "-- connection failed, trying https connection\n");
+				    if ((sess->fd = gg_connect(&a, GG_HTTPS_PORT, sess->async)) == -1) {
 					gg_debug(GG_DEBUG_MISC, "-- connect() failed. errno = %d (%s)\n", errno, strerror(errno));

 					e->type = GG_EVENT_CONN_FAILED;
 					e->event.failure = GG_FAILURE_CONNECTING;
 					sess->state = GG_STATE_IDLE;
 					break;
+				    }
 				}
-
 				sess->state = GG_STATE_CONNECTING_GG;
 				sess->check = GG_CHECK_WRITE;
 			} else {
@@ -1070,12 +1072,15 @@
 				gg_debug(GG_DEBUG_MISC, "-- http connection failed, errno = %d (%s), trying direct connection\n", res, strerror(res));

 				if ((sess->fd = gg_connect(addr, GG_DEFAULT_PORT, sess->async)) == -1) {
+				    gg_debug(GG_DEBUG_MISC, "-- connection failed, trying https connection\n");
+				    if ((sess->fd = gg_connect(addr, GG_HTTPS_PORT, sess->async)) == -1) {
 					gg_debug(GG_DEBUG_MISC, "-- connect() failed. errno = %d (%s)\n", errno, strerror(errno));

 					e->type = GG_EVENT_CONN_FAILED;
 					e->event.failure = GG_FAILURE_CONNECTING;
 					sess->state = GG_STATE_IDLE;
 					break;
+				    }
 				}

 				sess->state = GG_STATE_CONNECTING_GG;
@@ -1166,12 +1171,15 @@
 			sess->server_ip = a.s_addr;

 			if ((sess->fd = gg_connect(&a, port, sess->async)) == -1) {
-				gg_debug(GG_DEBUG_MISC, "-- connect() failed. errno = %d (%s)\n", errno, strerror(errno));
-
-				e->type = GG_EVENT_CONN_FAILED;
-				e->event.failure = GG_FAILURE_CONNECTING;
-				sess->state = GG_STATE_IDLE;
-				break;
+				gg_debug(GG_DEBUG_MISC, "-- connection failed, trying https connection\n");
+				if ((sess->fd = gg_connect(&a, GG_HTTPS_PORT, sess->async)) == -1) {
+				    gg_debug(GG_DEBUG_MISC, "-- connection failed, errno = %d (%s)\n", errno, strerror(errno));
+
+				    e->type = GG_EVENT_CONN_FAILED;
+				    e->event.failure = GG_FAILURE_CONNECTING;
+				    sess->state = GG_STATE_IDLE;
+				    break;
+				}
 			}

 			sess->state = GG_STATE_CONNECTING_GG;


u3: refactors "retreat" block of u3a_take in to do/while loop

--- pkg/urbit/noun/allocate.c
+++ pkg/urbit/noun/allocate.c
@@ -1094,25 +1094,11 @@
   return new;
 }

-#define TAKE_ROOT 0
-#define TAKE_HEAD 1
-#define TAKE_TAIL 2
-
-//  stack frame for recording head vs tail iteration
-//
-//    In Hoon, this structure would be as follows:
-//
-//    $%  [%root ~]
-//        [%head old=^]
-//        [%tail old=^ hed=*]
-//    ==
-//
-typedef struct takeframe
-{
-  c3_y  tag_y;
-  u3_cell old;
-  u3_weak hed;
-} takeframe;
+typedef struct _ca_take
+{
+  u3_weak hed;  //  taken head
+  u3_cell old;  //  old cell
+} _ca_take;

 static inline u3_noun
 _ca_take_next(u3a_pile* pil_u, u3_noun veb)
@@ -1176,12 +1162,11 @@
         u3a_cell*  old_u = (u3a_cell*)veb_u;

         {
-          takeframe* fam_u = u3a_push(pil_u);
+          _ca_take* fam_u = u3a_push(pil_u);
           u3a_pile_sane(pil_u);

-          fam_u->tag_y = TAKE_HEAD;
-          fam_u->old   = veb;
-          fam_u->hed   = u3_none;
+          fam_u->hed = u3_none;
+          fam_u->old = veb;
         }

         veb = old_u->hed;
@@ -1196,77 +1181,44 @@
 u3_noun
 u3a_take(u3_noun veb)
 {
-  u3a_pile pil_u;
-  u3_noun    pro;
-  c3_o     nor_o = u3a_is_north(u3R);
+  u3a_pile  pil_u;
+  _ca_take* fam_u;
+  u3_noun     pro;
+  c3_o      nor_o = u3a_is_north(u3R);

   u3t_on(coy_o);

   c3_assert(u3_none != veb);

-  u3a_pile_prep(&pil_u, sizeof(takeframe));
-
-  //  push the ROOT stack frame (our termination condition)
-  //
-  {
-    takeframe* fam_u = u3a_push(&pil_u);
-    fam_u->tag_y = TAKE_ROOT;
-  }
-
-  //  read from the current noun .veb
+  u3a_pile_prep(&pil_u, sizeof(*fam_u));
+
+  //  commence taking
   //
   pro = _ca_take_next(&pil_u, veb);

-  //  consume: popped stack frame, and .pro from above
+  //  process cell results
   //
-  retreat: {
-    takeframe* fam_u = u3a_peek(&pil_u);
-
-    switch ( fam_u->tag_y ) {
-      default: {
-        c3_assert(0);
-      }
-
-      //  .fam_u is our stack root, we're done.
+  if ( c3n == u3a_pile_done(&pil_u) ) {
+    fam_u = u3a_peek(&pil_u);
+
+    do {
+      //  fam_u is a head-frame: stash copy and continue into the tail
       //
-      case TAKE_ROOT: {
-        u3a_pop(&pil_u);
-        break;
-      }
-
-      //  .pro is the copied head of a cell; save a pointer to it in .new_u
-      //  and advance to copy the tail
+      if ( u3_none == fam_u->hed ) {
+        u3a_cell* old_u = u3a_to_ptr(fam_u->old);
+        fam_u->hed = pro;
+        pro        = _ca_take_next(&pil_u, old_u->tel);
+        fam_u      = u3a_peek(&pil_u);
+      }
+      //  fam_u is a tail-frame: copy cell and pop the stack
       //
-      case TAKE_HEAD: {
+      else {
         u3a_cell* old_u = u3a_to_ptr(fam_u->old);
-        c3_assert( u3_none == fam_u->hed );
-
-        fam_u->tag_y = TAKE_TAIL;
-        fam_u->hed   = pro;
-
-        // veb = old_u->tel;
-        // goto advance;
-        pro = _ca_take_next(&pil_u, old_u->tel);
-        goto retreat;
-      }
-
-      //  .pro is the copied tail of a cell; save a pointer to it in .new_u,
-      //  and produce the whole copied cell (as if it were a read from above).
-      //
-      case TAKE_TAIL: {
-        u3a_cell* old_u = u3a_to_ptr(fam_u->old);
-        c3_assert( u3_none != fam_u->hed );
-
-        pro = _ca_take_cell(old_u, fam_u->hed, pro);
-        u3a_pop(&pil_u);
-        goto retreat;
-      }
-    }
-  }
-
-  //  sanity check
-  //
-  c3_assert( c3y == u3a_pile_done(&pil_u) );
+        pro   = _ca_take_cell(old_u, fam_u->hed, pro);
+        fam_u = u3a_pop(&pil_u);
+      }
+    } while ( c3n == u3a_pile_done(&pil_u) );
+  }

   u3t_off(coy_o);


spa_generate_rootconf: add support for old vdev labels

It seems that old ZFS versions (v15) completely omit "vdev_children"
property when there is a single child.

Reported by:	jase
Tested by:	jase
MFC after:	1 week

--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -3792,9 +3792,8 @@
 	/*
 	 * Multi-vdev root pool configuration discovery is not supported yet.
 	 */
-	nchildren = 0;
-	VERIFY(nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN,
-	    &nchildren) == 0);
+	nchildren = 1;
+	nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren);
 	holes = NULL;
 	nvlist_lookup_uint64_array(best_cfg, ZPOOL_CONFIG_HOLE_ARRAY,
 	    &holes, &nholes);


Add compile option checks to gpkg extension init

--- gpkg/spatialdb.c
+++ gpkg/spatialdb.c
@@ -630,6 +630,42 @@
     return SQLITE_ERROR;
   }

+  const char *forbidden_options[] = {
+    "SQLITE_OMIT_FOREIGN_KEY", "foreign key",
+    "SQLITE_OMIT_TRIGGER", "trigger",
+    "SQLITE_OMIT_VIRTUALTABLE", "virtual table",
+    "SQLITE_RTREE_INT_ONLY", "floating point rtree",
+    NULL, NULL
+  };
+
+  const char **forbidden_option = forbidden_options;
+  while (*forbidden_option != NULL) {
+    if (sqlite3_compileoption_used(*forbidden_option)) {
+      if (pzErrMsg) {
+        *pzErrMsg = sqlite3_mprintf("libgpkg requires %s support but %s compile option was used", *(forbidden_option + 1), *forbidden_option);
+      }
+      return SQLITE_ERROR;
+    }
+    forbidden_option += 2;
+  }
+
+  const char *required_options[] = {
+    "SQLITE_ENABLE_RTREE", "rtree",
+    NULL, NULL
+  };
+
+  const char **required_option = required_options;
+  while (*required_option != NULL) {
+    if (!sqlite3_compileoption_used(*required_option)) {
+      if (pzErrMsg) {
+        *pzErrMsg = sqlite3_mprintf("libgpkg requires %s support but %s compile option was not used", *(required_option + 1), *required_option);
+      }
+      return SQLITE_ERROR;
+    }
+    required_option += 2;
+  }
+
+
   error_t error;
   if (error_init(&error) != SQLITE_OK) {
     if (pzErrMsg) {


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6@11585 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- magick/distribute-cache.c
+++ magick/distribute-cache.c
@@ -72,7 +72,7 @@
 #include "magick/string-private.h"
 #include "magick/version.h"
 #include "magick/version-private.h"
-#if defined(MAGICKCORE_HAVE_SOCKET)
+#if defined(MAGICKCORE_HAVE_SOCKET) && !defined(__MINGW32__) && !defined(__MINGW64__)
 #include <netinet/in.h>
 #include <netdb.h>
 #include <sys/socket.h>
@@ -150,7 +150,7 @@
 static int ConnectPixelCacheServer(const char *hostname,const int port,
   size_t *session_key,ExceptionInfo *exception)
 {
-#if defined(MAGICKCORE_HAVE_SOCKET)
+#if defined(MAGICKCORE_HAVE_SOCKET) && !defined(__MINGW32__) && !defined(__MINGW64__)
   char
     service[MaxTextExtent];

@@ -833,7 +833,7 @@
 MagickExport void DistributePixelCacheServer(const int port,
   ExceptionInfo *exception)
 {
-#if defined(MAGICKCORE_HAVE_SOCKET) && defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_HAVE_SOCKET) && defined(MAGICKCORE_THREAD_SUPPORT) && !defined(__MINGW32__) && !defined(__MINGW64__)
   char
     service[MaxTextExtent];


Remove superflous control variable to improve readability?

--- gbcamextract.c
+++ gbcamextract.c
@@ -187,17 +187,17 @@
 }

 void drawSpan( char pixelBuffer[], char *buffer, int x, int y ) {
-  unsigned char lowBits, highBits, i;
-  char *p;
-  p = pixelBuffer + (x/4) + 1 + y * ROW_SIZE;
-  for( i = 8; i; --i, p+=ROW_SIZE+2 )
+  unsigned char lowBits, highBits;
+  char *p, *q;
+  p = pixelBuffer + (x/4) + y * ROW_SIZE;
+  for( q = p + ROW_SIZE * 8; p<q; p+=ROW_SIZE )
   {
     lowBits = ~*buffer++;
     highBits = ~*buffer++;
-    *p-- = (lowBits & 1) | ((highBits & 1) << 1) | ((lowBits & 2) << 1) | ((highBits & 2) << 2) | ((lowBits & 4) << 2)  | ((highBits & 4) << 3) | ((lowBits & 8) << 3) | ((highBits & 8) << 4);
+    p[1] = (lowBits & 1) | ((highBits & 1) << 1) | ((lowBits & 2) << 1) | ((highBits & 2) << 2) | ((lowBits & 4) << 2)  | ((highBits & 4) << 3) | ((lowBits & 8) << 3) | ((highBits & 8) << 4);
     lowBits >>= 4;
     highBits >>= 4;
-    *p-- = (lowBits & 1) | ((highBits & 1) << 1) | ((lowBits & 2) << 1) | ((highBits & 2) << 2) | ((lowBits & 4) << 2)  | ((highBits & 4) << 3) | ((lowBits & 8) << 3) | ((highBits & 8) << 4);
+    p[0] = (lowBits & 1) | ((highBits & 1) << 1) | ((lowBits & 2) << 1) | ((highBits & 2) << 2) | ((lowBits & 4) << 2)  | ((highBits & 4) << 3) | ((lowBits & 8) << 3) | ((highBits & 8) << 4);
   }
 }


posixcompat/sysconf: Print warning when executing unknown sysconf command.

On Barrelfish, we only implement a very small subset of the variables
that can be queried with sysconf. Print a warning when a program queries
one that is not implemented. Previously, the warning was only printed
when posixcompat debugging was enabled.

Signed-off-by: Moritz Hoffmann <53ba0aa052d551db5cb133c62d34e71044d0deba@inf.ethz.ch>

--- lib/posixcompat/sysconf.c
+++ lib/posixcompat/sysconf.c
@@ -41,8 +41,8 @@
         }

     default:
-        POSIXCOMPAT_DEBUG("sysconf(%d): No implementation for this "
-                          "configuration information.\n", name);
+        debug_printf("sysconf(%d): No implementation for this "
+                     "configuration information.\n", name);
         errno = EINVAL;
         return -1;
     }


spirv: add double support to _vtn_block_load_store()

Signed-off-by: Samuel Iglesias Gonsálvez <b753b212f30aed827c3eea2e437609dc37310153@igalia.com>
Reviewed-by: Jason Ekstrand <68c46a606457643eab92053c1c05574abb26f861@jlekstrand.net>

--- src/compiler/spirv/vtn_variables.c
+++ src/compiler/spirv/vtn_variables.c
@@ -527,6 +527,7 @@
    case GLSL_TYPE_UINT:
    case GLSL_TYPE_INT:
    case GLSL_TYPE_FLOAT:
+   case GLSL_TYPE_DOUBLE:
    case GLSL_TYPE_BOOL:
       /* This is where things get interesting.  At this point, we've hit
        * a vector, a scalar, or a matrix.


Fix warnings in registration/joint_icp.h

> joint_icp.h:135:55: warning: unused parameter 'cloud' [-Wunused-parameter]
> joint_icp.h:161:55: warning: unused parameter 'cloud' [-Wunused-parameter]

--- registration/include/pcl/registration/joint_icp.h
+++ registration/include/pcl/registration/joint_icp.h
@@ -132,7 +132,7 @@
         * \param[in] cloud the input point cloud source
         */
       virtual void
-      setInputSource (const PointCloudSourceConstPtr &cloud)
+      setInputSource (const PointCloudSourceConstPtr& /*cloud*/)
       {
         PCL_WARN ("[pcl::%s::setInputSource] Warning; JointIterativeClosestPoint expects multiple clouds. Please use addInputSource.",
             getClassName ().c_str ());
@@ -158,7 +158,7 @@
         * \param[in] cloud the input point cloud target
         */
       virtual void
-      setInputTarget (const PointCloudTargetConstPtr &cloud)
+      setInputTarget (const PointCloudTargetConstPtr& /*cloud*/)
       {
         PCL_WARN ("[pcl::%s::setInputTarget] Warning; JointIterativeClosestPoint expects multiple clouds. Please use addInputTarget.",
             getClassName ().c_str ());


log accept error

log accept error

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@13844 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- ffserver.c
+++ ffserver.c
@@ -654,8 +654,10 @@
     len = sizeof(from_addr);
     fd = accept(server_fd, (struct sockaddr *)&from_addr,
                 &len);
-    if (fd < 0)
+    if (fd < 0) {
+        http_log("error during accept %s\n", strerror(errno));
         return;
+    }
     ff_socket_nonblock(fd, 1);

     /* XXX: should output a warning page when coming


libscaf: rip out "lazy_math" stuff

libscaf: rip out "lazy_math" stuff

--- src/libscaf.c
+++ src/libscaf.c
@@ -115,8 +115,6 @@

 static int scaf_experiment_running = 0;
 static int scaf_lazy_experiments;
-static int scaf_lazy_math;
-static int lazy_math_skipped = 0;
 static int scaf_mypid;
 static int scaf_num_online_hardware_threads;
 static int scaf_nullfd;
@@ -372,12 +370,6 @@
    else
       scaf_lazy_experiments = 1;

-   char *lazymath = getenv("SCAF_LAZY_MATH");
-   if(lazymath)
-      scaf_lazy_math = atoi(lazymath);
-   else
-      scaf_lazy_math = 1;
-
    char *sectiondumps = getenv("SCAF_SECTION_DUMPS");
    if(sectiondumps)
      scaf_section_dumps = atoi(sectiondumps);
@@ -571,12 +563,6 @@
       scaf_section_efficiency = 0.5;
    }

-   if(scaf_lazy_math && (current_num_clients < 2 || scaf_disable_experiments)){
-      scaf_section_start_time = rtclock() - scaf_init_rtclock;
-      lazy_math_skipped = 1;
-      goto skip_math;
-   }
-
    // Compute results for reporting before this section
    float scaf_serial_efficiency = 1.0 / current_threads;
    float scaf_latest_efficiency_duration = (scaf_section_duration + scaf_serial_duration);
@@ -600,11 +586,6 @@
       scaf_serial_duration = scaf_section_start_time - scaf_section_end_time;
    }
 #endif
-
-   static float last_reported_efficiency = LOWPASS_INITIAL;
-skip_math:
-   if(scaf_lazy_math && lazy_math_skipped){
-      scaf_latest_efficiency_smooth = last_reported_efficiency;
    }

    scaf_skip_communication_for_section = scaf_communication_rate_limit(scaf_section_start_time);
@@ -618,7 +599,6 @@
       scaf_message->section = section;

       scaf_message->message_value.efficiency = scaf_latest_efficiency_smooth;
-      last_reported_efficiency = scaf_latest_efficiency_smooth;

 #if ZMQ_VERSION_MAJOR > 2
       zmq_sendmsg(scafd, &request, 0);
@@ -683,11 +663,6 @@
    if(!scafd_available){
       scaf_in_parallel_section = 0;
       return;
-   }
-
-   if(lazy_math_skipped){
-      lazy_math_skipped = 0;
-      goto skip_math;
    }

 #if(HAVE_LIBPAPI)
@@ -756,7 +731,6 @@
    }
 #endif // !__KNC__

-skip_math:
    scaf_in_parallel_section = 0;
    return;
 }


u3: shortcircuit direct atoms in u3i_chub()

--- pkg/urbit/noun/imprison.c
+++ pkg/urbit/noun/imprison.c
@@ -313,12 +313,17 @@
 u3_atom
 u3i_chub(c3_d dat_d)
 {
-  c3_w dat_w[2] = {
-    dat_d & 0xffffffffULL,
-    dat_d >> 32
-  };
-
-  return u3i_words(2, dat_w);
+  if ( c3y == u3a_is_cat(dat_d) ) {
+    return (u3_atom)dat_d;
+  }
+  else {
+    c3_w dat_w[2] = {
+      dat_d & 0xffffffffULL,
+      dat_d >> 32
+    };
+
+    return u3i_words(2, dat_w);
+  }
 }

 /* u3i_bytes(): Copy [a] bytes from [b] to an LSB first atom.


use SYMLOOP_MAX rather than MAXSYMLINKS

use SYMLOOP_MAX rather than MAXSYMLINKS

--- dev/systrace.c
+++ dev/systrace.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: systrace.c,v 1.71 2014/07/13 23:10:23 deraadt Exp $	*/
+/*	$OpenBSD: systrace.c,v 1.72 2015/01/19 18:37:19 deraadt Exp $	*/
 /*
  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
  * All rights reserved.
@@ -1516,7 +1516,7 @@

 	if (hamper) {
 		/* ELOOP if namei() tries to readlink */
-		ndp->ni_loopcnt = MAXSYMLINKS;
+		ndp->ni_loopcnt = SYMLOOP_MAX;
 		cnp->cn_flags &= ~FOLLOW;
 		cnp->cn_flags |= NOFOLLOW;
 	}


tests/xtimer_drift: remove uneeded timex call

--- tests/xtimer_drift/main.c
+++ tests/xtimer_drift/main.c
@@ -65,7 +65,6 @@
 void *slacker_thread(void *arg)
 {
     (void) arg;
-    timex_t now;

     LOG_DEBUG("run thread %" PRIkernel_pid "\n", thread_getpid());

@@ -77,7 +76,6 @@
         msg_t m;
         msg_receive(&m);
         struct timer_msg *tmsg = m.content.ptr;
-        xtimer_now_timex(&now);
         xtimer_usleep(TEST_MSG_RX_USLEEP);

         tmsg->msg.type = 12345;


thermometer: Use GAttrib buffer

thermometer: Use GAttrib buffer

This patch replaces the static local buffer by the GAttrib internal
buffer to temporarily store the output ATT PDU.

--- thermometer/thermometer.c
+++ thermometer/thermometer.c
@@ -1135,9 +1135,10 @@
 {
 	struct thermometer *t = user_data;
 	const struct characteristic *ch;
-	uint8_t opdu[ATT_MAX_MTU];
+	uint8_t *opdu;
 	uint16_t handle, olen;
 	GSList *l;
+	int plen;

 	if (len < 3) {
 		DBG("Bad pdu received");
@@ -1158,7 +1159,8 @@
 	else if (g_strcmp0(ch->attr.uuid, MEASUREMENT_INTERVAL_UUID) == 0)
 		proc_measurement_interval(t, pdu, len);

-	olen = enc_confirmation(opdu, sizeof(opdu));
+	opdu = g_attrib_get_buffer(t->attrib, &plen);
+	olen = enc_confirmation(opdu, plen);

 	if (olen > 0)
 		g_attrib_send(t->attrib, 0, opdu[0], opdu, olen, NULL, NULL,


Added yet another type cast to the else if clause in xTaskCheckForTimeOut.  This is to ensure it works correctly on ALL 16 bit compilers (hopefully).

git-svn-id: 43aea61533866f88f23079d48f4f5dc2d5288937@941 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

--- Source/tasks.c
+++ Source/tasks.c
@@ -1744,7 +1744,7 @@
 			passed since vTaskSetTimeout() was called. */
 			xReturn = pdTRUE;
 		}
-		else if( ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) < ( portTickType ) *pxTicksToWait )
+		else if( ( ( portTickType ) ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) ) < ( portTickType ) *pxTicksToWait )
 		{
 			/* Not a genuine timeout. Adjust parameters for time remaining. */
 			*pxTicksToWait -= ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering );


close[t:4325] Fix #4325 (use {{{int}}} instead of {{{u_int32_t}}}).

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

--- src/ydb.c
+++ src/ydb.c
@@ -2884,7 +2884,7 @@

 static int
 locked_txn_stat (DB_TXN *txn, struct txn_stat **txn_stat) {
-    toku_ydb_lock(); u_int32_t r = toku_txn_stat(txn, txn_stat); toku_ydb_unlock(); return r;
+    toku_ydb_lock(); int r = toku_txn_stat(txn, txn_stat); toku_ydb_unlock(); return r;
 }

 static int


kcmp: Make ID generation tree work on abstract elements, not fd-entries

Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>

--- file-ids.c
+++ file-ids.c
@@ -25,6 +25,12 @@

 };

+struct kid_elem {
+	int pid;
+	unsigned genid;
+	unsigned idx;
+};
+
 static struct kid_tree fd_tree = {
 	.root = RB_ROOT,
 	.kcmp_type = KCMP_FILE,
@@ -77,18 +83,15 @@
 	struct rb_root	subtree_root;
 	struct rb_node	subtree_node;

-	u32		genid;	/* generic id, may have duplicates */
 	u32		subid;	/* subid is always unique */
-
-	pid_t		pid;
-	int		fd;
+	struct kid_elem	elem;
 } __aligned(sizeof(long));

 static void show_subnode(struct rb_node *node, int self)
 {
 	struct kid_entry *this = rb_entry(node, struct kid_entry, subtree_node);

-	pr_info("\t\t| %x.%x %s\n", this->genid, this->subid,
+	pr_info("\t\t| %x.%x %s\n", this->elem.genid, this->subid,
 			self ? "(self)" : "");
 	if (node->rb_left) {
 		pr_info("\t\t| left:\n");
@@ -112,7 +115,7 @@
 {
 	struct kid_entry *this = rb_entry(node, struct kid_entry, node);

-	pr_info("\t%x.%x\n", this->genid, this->subid);
+	pr_info("\t%x.%x\n", this->elem.genid, this->subid);
 	if (node->rb_left) {
 		pr_info("\tleft:\n");
 		show_node(node->rb_left);
@@ -137,7 +140,7 @@
 		show_node(root->rb_node);
 }

-static struct kid_entry *alloc_kid_entry(struct kid_tree *tree, pid_t pid, struct fdinfo_entry *fe)
+static struct kid_entry *alloc_kid_entry(struct kid_tree *tree, struct kid_elem *elem)
 {
 	struct kid_entry *e;

@@ -146,9 +149,7 @@
 		goto err;

 	e->subid	= tree->subid++;
-	e->genid	= fe->id;
-	e->pid		= pid;
-	e->fd		= fe->fd;
+	e->elem		= *elem;

 	/* Make sure no overflow here */
 	BUG_ON(!e->subid);
@@ -163,7 +164,7 @@
 }

 static struct kid_entry *kid_generate_sub(struct kid_tree *tree, struct kid_entry *e,
-		pid_t pid, struct fdinfo_entry *fe, int *new_id)
+		struct kid_elem *elem, int *new_id)
 {
 	struct rb_node *node = e->subtree_root.rb_node;
 	struct kid_entry *sub = NULL;
@@ -175,7 +176,8 @@

 	while (node) {
 		struct kid_entry *this = rb_entry(node, struct kid_entry, subtree_node);
-		int ret = sys_kcmp(this->pid, pid, tree->kcmp_type, this->fd, fe->fd);
+		int ret = sys_kcmp(this->elem.pid, elem->pid, tree->kcmp_type,
+				this->elem.idx, elem->idx);

 		parent = *new;
 		if (ret < 0)
@@ -186,7 +188,7 @@
 			return this;
 	}

-	sub = alloc_kid_entry(tree, pid, fe);
+	sub = alloc_kid_entry(tree, elem);
 	if (!sub)
 		return NULL;

@@ -196,7 +198,7 @@
 }

 static struct kid_entry *kid_generate_gen(struct kid_tree *tree,
-		pid_t pid, struct fdinfo_entry *fe, int *new_id)
+		struct kid_elem *elem, int *new_id)
 {
 	struct rb_node *node = tree->root.rb_node;
 	struct kid_entry *e = NULL;
@@ -208,15 +210,15 @@
 		struct kid_entry *this = rb_entry(node, struct kid_entry, node);

 		parent = *new;
-		if (fe->id < this->genid)
+		if (elem->genid < this->elem.genid)
 			node = node->rb_left, new = &((*new)->rb_left);
-		else if (fe->id > this->genid)
+		else if (elem->genid > this->elem.genid)
 			node = node->rb_right, new = &((*new)->rb_right);
 		else
-			return kid_generate_sub(tree, this, pid, fe, new_id);
-	}
-
-	e = alloc_kid_entry(tree, pid, fe);
+			return kid_generate_sub(tree, this, elem, new_id);
+	}
+
+	e = alloc_kid_entry(tree, elem);
 	if (!e)
 		return NULL;

@@ -234,9 +236,14 @@
 int fd_id_generate(pid_t pid, struct fdinfo_entry *fe)
 {
 	struct kid_entry *fid;
+	struct kid_elem e;
 	int new_id = 0;

-	fid = kid_generate_gen(&fd_tree, pid, fe, &new_id);
+	e.pid = pid;
+	e.genid = fe->id;
+	e.idx = fe->fd;
+
+	fid = kid_generate_gen(&fd_tree, &e, &new_id);
 	if (!fid)
 		return -ENOMEM;


use mallocarray()

use mallocarray()

--- dev/usb/ugen.c
+++ dev/usb/ugen.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ugen.c,v 1.79 2014/07/12 20:26:33 mpi Exp $ */
+/*	$OpenBSD: ugen.c,v 1.80 2015/01/11 03:07:44 deraadt Exp $ */
 /*	$NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $	*/

@@ -347,7 +347,7 @@
 			isize = UGETW(edesc->wMaxPacketSize);
 			if (isize == 0)	/* shouldn't happen */
 				return (EINVAL);
-			sce->ibuf = malloc(isize * UGEN_NISOFRAMES,
+			sce->ibuf = mallocarray(isize, UGEN_NISOFRAMES,
 				M_USBDEV, M_WAITOK);
 			sce->cur = sce->fill = sce->ibuf;
 			sce->limit = sce->ibuf + isize * UGEN_NISOFRAMES;


ARM: Allow compilation in thumb mode (CCOPT_ARM=-mthumb).

--- src/lj_arch.h
+++ src/lj_arch.h
@@ -190,9 +190,6 @@
 #if defined(__ARMEB__)
 #error "No support for big-endian ARM"
 #endif
-#if defined(__thumb__) || defined(__thumb2__)
-#error "No support for Thumb instruction set (yet)"
-#endif
 #if !__ARM_EABI__
 #error "Only ARM EABI is supported"
 #endif


Added deep sleep mode

Added deep sleep mode

--- Sources/main.c
+++ Sources/main.c
@@ -48,6 +48,10 @@

 //------------------------------------------

+#define ACTIVE_LEVEL_AWAKE		0
+#define ACTIVE_LEVEL_SLEEP		1
+#define ACTIVE_LEVEL_DEEPSLEEP	2
+
 #define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))

@@ -78,43 +82,59 @@
 	LPTMR0_CSR = LPTMR_CSR_TIE_MASK | LPTMR_CSR_TEN_MASK;		// Enable with interrupt.
 }

+static void periodicTimerStartSlow()
+{
+	LPTMR0_CSR = 0;												// Ensure timer is stopped and counter cleared
+	LPTMR0_PSR = LPTMR_PSR_PCS(1) | LPTMR_PSR_PRESCALE(8);		// Counter frequency is 1.95Hz (1kHz LPO divided by 512)
+	LPTMR0_CMR = 20;											// Interrupt every 10 seconds or so
+	LPTMR0_CSR = LPTMR_CSR_TIE_MASK | LPTMR_CSR_TEN_MASK;		// Enable with interrupt.
+}
+
 static void periodicTimerStop()
 {
 	LPTMR0_CSR = 0;												// Ensure timer is stopped and counter cleared
+	periodicTimerIrqCount = 0;
 }

 static uint32_t sleepCounter = 0;
-static int isAsleep = 0;
+static int activeLevel = ACTIVE_LEVEL_AWAKE;

 static void sleep()
 {
-	isAsleep = 1;
+	activeLevel = ACTIVE_LEVEL_SLEEP;
 	tftSetBacklight(0);
-#ifdef TFT_POWER_OFF
+	tftSleep();
+	periodicTimerStop();
+	periodicTimerStartSlow();
+}
+
+static void deepSleep()
+{
+	activeLevel = ACTIVE_LEVEL_DEEPSLEEP;
 	touchScreenDisconnect();
 	spiPinsDisconnect();
 	tftPowerOff();
-#else
-	tftSleep();
-#endif
 	periodicTimerStop();
 }

 static void wakeUp()
 {
-	if (isAsleep) {
-#ifdef TFT_POWER_OFF
-		tftPowerOn();
-		touchScreenConnect();
-		spiPinsConnect();
-		rendererClearScreen();
-		touchbuttonsRedraw();
-#else
-		tftWake();
-#endif
+	if (activeLevel != ACTIVE_LEVEL_AWAKE) {
+		if (activeLevel == ACTIVE_LEVEL_DEEPSLEEP) {
+			tftPowerOn();
+			touchScreenConnect();
+			spiPinsConnect();
+			rendererClearScreen();
+			touchbuttonsRedraw();
+		}
+		else {
+			tftWake();
+		}
+
 		tftSetBacklight(1);
+		periodicTimerStop();
 		periodicTimerStart();
-		isAsleep = 0;
+		activeLevel = ACTIVE_LEVEL_AWAKE;
 	}

 	sleepCounter = 0;
@@ -282,6 +302,7 @@
 		if (keyMatrixCheckInterrupt()) {
 			buttonsPollState();
 			keyMatrixClearInterrupt();
+			wakeUp();
 		}

 		if (accelCheckTransientInterrupt()) {
@@ -290,17 +311,22 @@
 		}

 		if (periodicTimerIrqCount) {
-			touchButtonsUpdate(&event);
-			periodicTimerIrqCount = 0;
+			if (activeLevel == ACTIVE_LEVEL_SLEEP) {
+				deepSleep();
+			}
+			else {
+				touchButtonsUpdate(&event);
+				periodicTimerIrqCount = 0;

 #ifndef DISABLE_KEYPAD
-			debugSetOverlayHex(0, capElectrodeGetValue(0));
-			debugSetOverlayHex(1, capElectrodeGetValue(1));
-#endif
-
-			sleepCounter++;
-			if (sleepCounter > SLEEP_TIMEOUT) {
-				sleep();
+				debugSetOverlayHex(0, capElectrodeGetValue(0));
+				debugSetOverlayHex(1, capElectrodeGetValue(1));
+#endif
+
+				sleepCounter++;
+				if (sleepCounter > SLEEP_TIMEOUT) {
+					sleep();
+				}
 			}
 		}

@@ -308,7 +334,6 @@
 		touchbuttonsRender();

 		if (event) {
-			wakeUp();
 			rendererRenderDrawList();
 			if (event->type == EVENT_IRACTION) {
 				deviceDoIrAction((const Device*)GET_FLASH_PTR(event->deviceOffset), (const IrAction*)GET_FLASH_PTR(event->irActionOffset));


unused variable

unused variable

--- src/unabto_application.c
+++ src/unabto_application.c
@@ -32,7 +32,6 @@

 void debug_dump_acl() {
     void* it = db_.first();
-    uint32_t offset = 0;
     while (it != NULL) {
         struct fp_acl_user user;
         fp_acl_db_status res = db_.load(it, &user);
@@ -152,7 +151,7 @@
     // https://github.com/nabto/ionic-starter-nabto/blob/master/www/nabto/unabto_queries.xml

     application_event_result res;
-
+
     switch (request->queryId) {
     case 10000:
         // get_public_device_info.json
@@ -162,7 +161,6 @@
         if (!unabto_query_write_uint8(query_response, fp_acl_is_pair_allowed(request))) return AER_REQ_RSP_TOO_LARGE;
         if (!unabto_query_write_uint8(query_response, fp_acl_is_user_paired(request))) return AER_REQ_RSP_TOO_LARGE;
         if (!unabto_query_write_uint8(query_response, fp_acl_is_user_owner(request))) return AER_REQ_RSP_TOO_LARGE;
-
         return AER_REQ_RESPONSE_READY;

     case 10010:


Add comment about checkpoint callbacks, used for testing purposes only.

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

--- src/ydb.c
+++ src/ydb.c
@@ -1025,6 +1025,8 @@
 }

 // For test purposes only.
+// These callbacks are never used in production code, only as a way to test the system
+// (for example, by causing crashes at predictable times).
 static void (*checkpoint_callback_f)(void*) = NULL;
 static void * checkpoint_callback_extra     = NULL;
 static void (*checkpoint_callback2_f)(void*) = NULL;


wavpack: Remove bus GSource to prevent a valgrind warning

--- tests/check/pipelines/wavpack.c
+++ tests/check/pipelines/wavpack.c
@@ -95,6 +95,7 @@
   GstBus *bus;
   GMainLoop *loop;
   GstBuffer *in, *out;
+  guint bus_watch = 0;

   srcadapter = gst_adapter_new ();
   fail_unless (srcadapter != NULL);
@@ -148,7 +149,7 @@

   bus = gst_element_get_bus (pipeline);
   fail_unless (bus != NULL);
-  gst_bus_add_watch (bus, bus_handler, loop);
+  bus_watch = gst_bus_add_watch (bus, bus_handler, loop);
   gst_object_unref (bus);

   had_first_buffer = FALSE;
@@ -179,6 +180,7 @@
   g_main_loop_unref (loop);
   g_object_unref (srcadapter);
   g_object_unref (sinkadapter);
+  g_source_remove (bus_watch);
 }

 GST_END_TEST;


Create deleteIcon.c

Create deleteIcon.c

error: pathspec 'FMER/scripts/editCreateWorkout/editorButtons/deleteIcon.c' did not match any file(s) known to git

--- FMER/scripts/editCreateWorkout/editorButtons/deleteIcon.c
+++ FMER/scripts/editCreateWorkout/editorButtons/deleteIcon.c
@@ -0,0 +1,57 @@
+editCreateWorkout: editorButtons: deleteIcon
+Set Variable [ $delete; Value:Right ( Get ( ActiveLayoutObjectName ) ; 2 ) ]
+Go to Object [ Object Name: "segment" & $delete ]
+If [ Get ( ActiveFieldContents ) = "" ]
+Go to Field [ ]
+Set Variable [ $delete ]
+Refresh Window
+Exit Script [ ]
+End If
+Show Custom Dialog [ Message: "delete icon or segement? If you delete icon the segement stays. If you delete the segement all
+other segements move over to close the gap."; Buttons: “cancel”, “x icon”, “x segement” ]
+If [ Get ( LastMessageChoice ) = 3 ]
+Show Custom Dialog [ Message: "Are you sure you want delete this segement and move all the other segements over to ﬁll in its
+gap?"; Buttons: “cancel”, “x segment” ]
+If [ Get ( LastMessageChoice ) = 2 ]
+Set Variable [ $workout; Value:activity::_Lactivity ]
+New Window [ Height: 1; Width: 1; Top: 1; Left: 1 ]
+// New Window [ ]
+Go to Layout [ “WorkoutSegment” (segment01) ]
+Enter Find Mode [ ]
+Set Field [ segment01::kworkout; $workout ]
+Set Field [ segment01::SegmentNumber; $delete ]
+Perform Find [ ]
+Delete Record/Request
+[ No dialog ]
+#
+#Close gap by re-numbering all segments.
+Enter Find Mode [ ]
+Set Field [ segment01::kworkout; $workout ]
+Perform Find [ ]
+Go to Record/Request/Page
+[ First ]
+Set Variable [ $segment; Value:1 ]
+Loop
+Set Field [ segment01::SegmentNumber; If ($segment < 10 ; "0" & $segment ; $segment ) ]
+Set Variable [ $segment; Value:segment01::SegmentNumber + 1 ]
+Go to Record/Request/Page
+[ Next; Exit after last ]
+End Loop
+Close Window [ Current Window ]
+Go to Field [ ]
+Refresh Window
+Exit Script [ ]
+End If
+End If
+Go to Field [ ]
+Refresh Window
+Show Custom Dialog [ Message: "delete icon?"; Buttons: “OK”, “Cancel” ]
+If [ Get ( LastMessageChoice ) = 1 ]
+Go to Object [ Object Name: "icon" & $delete ]
+Set Field [ "" ]
+Go to Field [ ]
+End If
+January 8, 平成26 12:53:13 Fat and Muscle Efﬁciency Research.fp7 - deleteIcon -1-editCreateWorkout: editorButtons: deleteIcon
+Set Variable [ $delete ]
+Refresh Window
+January 8, 平成26 12:53:13 Fat and Muscle Efﬁciency Research.fp7 - deleteIcon -2-


Implement username/password sending in the library.

--- lib/send_client_mosq.c
+++ lib/send_client_mosq.c
@@ -41,6 +41,7 @@
 	struct _mosquitto_packet *packet = NULL;
 	int payloadlen;
 	uint8_t will = 0;
+	uint8_t byte;

 	if(!mosq || !mosq->id) return 1;

@@ -57,6 +58,12 @@
 			return 1;
 		}
 	}
+	if(mosq->username){
+		payloadlen += 2+strlen(mosq->username);
+		if(mosq->password){
+			payloadlen += 2+strlen(mosq->password);
+		}
+	}

 	packet->command = CONNECT;
 	packet->remaining_length = 12+payloadlen;
@@ -69,11 +76,17 @@
 	/* Variable header */
 	if(_mosquitto_write_string(packet, PROTOCOL_NAME, strlen(PROTOCOL_NAME))) return 1;
 	if(_mosquitto_write_byte(packet, PROTOCOL_VERSION)) return 1;
+	byte = (clean_session&0x1)<<1;
 	if(will){
-		if(_mosquitto_write_byte(packet, ((mosq->will->retain&0x1)<<5) | ((mosq->will->qos&0x3)<<3) | ((will&0x1)<<2) | ((clean_session&0x1)<<1))) return 1;
-	}else{
-		if(_mosquitto_write_byte(packet, (clean_session&0x1)<<1)) return 1;
+		byte = byte | ((mosq->will->retain&0x1)<<5) | ((mosq->will->qos&0x3)<<3) | ((will&0x1)<<2);
 	}
+	if(mosq->username){
+		byte = byte | 0x1<<6;
+		if(mosq->password){
+			byte = byte | 0x1<<7;
+		}
+	}
+	if(_mosquitto_write_byte(packet, byte)) return 1;
 	if(_mosquitto_write_uint16(packet, keepalive)) return 1;

 	/* Payload */
@@ -81,6 +94,12 @@
 	if(will){
 		if(_mosquitto_write_string(packet, mosq->will->topic, strlen(mosq->will->topic))) return 1;
 		if(_mosquitto_write_string(packet, (const char *)mosq->will->payload, mosq->will->payloadlen)) return 1;
+	}
+	if(mosq->username){
+		if(_mosquitto_write_string(packet, mosq->username, strlen(mosq->username))) return 1;
+		if(mosq->password){
+			if(_mosquitto_write_string(packet, mosq->password, strlen(mosq->password))) return 1;
+		}
 	}

 	mosq->keepalive = keepalive;


Another HSDPA MSM. From/tested by giovanni <qgiovanni@gmail.com>. No man page addition as it is unclear who makes it.

--- dev/usb/umsm.c
+++ dev/usb/umsm.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: umsm.c,v 1.20 2008/02/19 10:57:48 jsg Exp $	*/
+/*	$OpenBSD: umsm.c,v 1.21 2008/04/25 04:21:15 jsg Exp $	*/

 /*
  * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -67,6 +67,7 @@
 	{ USB_VENDOR_NOVATEL,	USB_PRODUCT_NOVATEL_XU870 },
 	{ USB_VENDOR_NOVATEL,	USB_PRODUCT_NOVATEL_ES620 },
 	{ USB_VENDOR_QUALCOMM,	USB_PRODUCT_QUALCOMM_MSM_HSDPA },
+	{ USB_VENDOR_QUALCOMM,	USB_PRODUCT_QUALCOMM_MSM_HSDPA2 },
 	{ USB_VENDOR_SIERRA,	USB_PRODUCT_SIERRA_EM5625 },
 	{ USB_VENDOR_SIERRA,	USB_PRODUCT_SIERRA_AIRCARD_580 },
 	{ USB_VENDOR_SIERRA,	USB_PRODUCT_SIERRA_AIRCARD_595 },


Update main.c

Update main.c

--- Sources/main.c
+++ Sources/main.c
@@ -47,13 +47,16 @@
     int indice1, indice2;
     nbAsBanque = 0;
     nbAsJoueur = 0;
-    short carteDuJoueur;
-
-    carteDuJoueur = tirer_carte(JOUEUR);
-    for(indice1 = 0; indice2 < NB_CARTES; indice1++)
-    {
-        cartes[indice1] = LIBRE;
-    }
+    short carteTiree;
+
+
+    carteTiree = tirer_carte(BANQUE_CACHEE);
+    carteTiree = tirer_carte(BANQUE);
+
+    carteTiree = tirer_carte(JOUEUR);
+    carteTiree = tirer_carte(JOUEUR);
+
+

     return 0;
 }


typos

typos

Ignore-this: 9ed3fef5fdd765084ecf6daf0e8cd61d

darcs-hash:20110211224009-c41ad-57497896a313dfd7b1625cbc2dd7f0630803e0d3

--- src/unix/lwt_unix_unix.c
+++ src/unix/lwt_unix_unix.c
@@ -583,7 +583,7 @@

 CAMLprim value lwt_unix_get_cpu()
 {
-  lwt_unix_not_implemented("get_cpu");
+  lwt_unix_not_available("get_cpu");
 }

 #endif
@@ -625,12 +625,12 @@

 CAMLprim value lwt_unix_get_affinity(value val_pid)
 {
-  lwt_unix_not_implemented("get_affinity");
+  lwt_unix_not_available("get_affinity");
 }

 CAMLprim value lwt_unix_set_affinity(value val_pid, value val_cpus)
 {
-  lwt_unix_not_implemented("set_affinity");
+  lwt_unix_not_available("set_affinity");
 }

 #endif


Remove header display and do not print name of processed file


Addresses #1683 Minor cleanup.

Addresses #1683 Minor cleanup.

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

--- src/ydb.c
+++ src/ydb.c
@@ -3636,7 +3636,7 @@
             return r;
         r = toku_env_open(env, ".", DB_PRIVATE + DB_INIT_MPOOL, 0);
         if (r != 0) {
-            toku_env_close(env, 0);
+            env_unref(env);
             return r;
         }
         assert(env_opened(env));
@@ -3695,7 +3695,7 @@
         toku_free(result->i);
         toku_free(result);
         env_unref(env);
-        return ENOMEM;
+        return r;
     }
     r = toku_brt_set_bt_compare(result->i->brt, env->i->bt_compare);
     assert(r==0);


Fixed some minor, stupid mistakes

Fixed some minor, stupid mistakes

--- fizzbuzz.c
+++ fizzbuzz.c
@@ -58,7 +58,8 @@

 	memset(rev_result, 0, length+1);

-	for(int x = 0; x < length; x++)
+	int y;
+	for(y = 0; x < length; x++)
 	{
 		rev_result[x] = result[(length-1)-x];
 	}


sync whitespace

sync whitespace

--- dev/usb/urio.c
+++ dev/usb/urio.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: urio.c,v 1.10 2002/07/09 17:41:02 nate Exp $	*/
+/*	$OpenBSD: urio.c,v 1.11 2002/07/10 13:18:10 nate Exp $	*/
 /*	$NetBSD: urio.c,v 1.11 2002/02/11 15:11:49 augustss Exp $	*/

 /*
@@ -544,7 +544,7 @@
 	sc->sc_refcnt++;

 	err = usbd_do_request_flags(sc->sc_udev, &req, ptr, req_flags,
-				    &req_actlen, USBD_DEFAULT_TIMEOUT);
+		  &req_actlen, USBD_DEFAULT_TIMEOUT);

 	if (--sc->sc_refcnt < 0)
 		usb_detach_wakeup(USBDEV(sc->sc_dev));


Close descriptor, if error happens in loadCat()

--- lib/libc/nls/msgcat.c
+++ lib/libc/nls/msgcat.c
@@ -320,6 +320,7 @@
 static char     *_errowner = "Message Catalog System";

 #define CORRUPT() {                                            \
+	(void)fclose(cat->fp);                                 \
 	(void)fprintf(stderr, "%s: corrupt file.", _errowner); \
 	free(cat);                                             \
 	NLRETERR(EFTYPE);                                      \
@@ -327,6 +328,7 @@

 #define NOSPACE() {                                              \
 	saverr = errno;                                          \
+	(void)fclose(cat->fp);                                   \
 	(void)fprintf(stderr, "%s: no more memory.", _errowner); \
 	free(cat);                                               \
 	errno = saverr;                                          \
@@ -379,12 +381,14 @@
 		CORRUPT();

 	if (header.majorVer != MCMajorVer) {
+		(void)fclose(cat->fp);
 		free(cat);
 		(void)fprintf(stderr, "%s: %s is version %ld, we need %ld.\n",
 		    _errowner, catpath, header.majorVer, MCMajorVer);
 		NLRETERR(EFTYPE);
 	}
 	if (header.numSets <= 0) {
+		(void)fclose(cat->fp);
 		free(cat);
 		(void)fprintf(stderr, "%s: %s has %ld sets!\n",
 		    _errowner, catpath, header.numSets);
@@ -421,7 +425,9 @@
 			int     res;

 			if ((res = loadSet(cat, set)) <= 0) {
+				saverr = errno;
 				__nls_free_resources(cat, i);
+				errno = saverr;
 				if (res < 0)
 					NOSPACE();
 				CORRUPT();


Make the function cst_to_constr static in lwt_unix_unix.c

It is already publicly exposed in the unix library.

--- src/unix/lwt_unix_unix.c
+++ src/unix/lwt_unix_unix.c
@@ -2836,7 +2836,7 @@
   char data[];
 };

-value cst_to_constr(int n, int *tbl, int size, int deflt)
+static value cst_to_constr(int n, int *tbl, int size, int deflt)
 {
   int i;
   for (i = 0; i < size; i++)


Fix cast from const warning (#60)

Fix cast from const warning (#60)

--- src/zip.c
+++ src/zip.c
@@ -108,7 +108,7 @@

 struct zip_entry_t {
   int index;
-  const char *name;
+  char *name;
   mz_uint64 uncomp_size;
   mz_uint64 comp_size;
   mz_uint32 uncomp_crc32;


Added the unlock password data function

Added the unlock password data function

--- lib/libpolypasshash.c
+++ lib/libpolypasshash.c
@@ -103,13 +103,13 @@
   context->threshold=threshold;

   context->secret = NULL; //cue the paranoid parrot meme...
-  context->secret = malloc(sizeof(uint8)*secret_length);
+  context->secret = malloc(sizeof(uint8)*secret_length+1);
   if(context->secret == NULL){
     free(context);
     return NULL;
   }
   memcpy(context->secret,secret,sizeof(uint8)*secret_length);
-
+  context->secret[secret_length]='\0';
   for(i=0;i<MAX_NUMBER_OF_SHARES;i++){
     share_numbers[i]=(unsigned char)i+1;
   }
@@ -319,13 +319,12 @@
     // get a new share.
     gfshare_ctx_enc_getshare( ctx->share_context, entry_node->share_number,
         share_data);
-
-    // get a salt for this entry, we are using sprintf, but we could use
+   // get a salt for this entry, we are using sprintf, but we could use
     // memcpy in case this function requires it.
     get_random_salt(SALT_LENGTH, entry_node->salt);
     entry_node->salt[SALT_LENGTH-1]='\0';
     sprintf(salted_password,"%s%s",entry_node->salt, password);
-
+
     _calculate_digest(resulting_hash, salted_password);

     // xor the whole thing, we do this in an unsigned int fashion imagining
@@ -496,13 +495,14 @@
 *
 * INPUTS :
 *   PARAMETERS:
-*     pph_context *ctx:      The context in which we are working
-*
-*     uint8 share_number:    The length of the username/password pair arrays
-*
-*     const char *usernames: The username attempts
-*
-*     const char *passwords: The password attempts
+*     pph_context *ctx:             The context in which we are working
+*
+*     unsigned int username_count:  The length of the username/password pair
+*                                   arrays
+*
+*     const char *usernames:        The username attempts
+*
+*     const char *passwords:        The password attempts
 *
 * OUTPUTS :
 *   PARAMETERS:
@@ -514,7 +514,7 @@
 *   RETURN :
 *     Type: int PPH_ERROR
 *           Values:                         When:
-*           PPH_ACCOUNT_IS_INVALID            We couln't recombine with the
+*           PPH_ACCOUNT_IS_INVALID            We couldn't recombine with the
 *                                             information given
 *
 *           PPH_USERNAME_IS_TOO_LONG          The username/pw won't fit in the
@@ -531,9 +531,68 @@
 * CHANGES :
 *     TODO:
 */
-PPH_ERROR pph_unlock_password_data(pph_context *ctx, uint8 share_number,
+PPH_ERROR pph_unlock_password_data(pph_context *ctx,unsigned int username_count,
                           const uint8 *usernames[], const uint8 *passwords[]){
-
+
+
+  uint8 share_numbers[MAX_NUMBER_OF_SHARES];
+  gfshare_ctx *G;
+  unsigned int i;
+  uint8 salted_password[USERNAME_LENGTH+SALT_LENGTH];
+  uint8 estimated_digest[DIGEST_LENGTH];
+  uint8 estimated_share[SHARE_LENGTH];
+  pph_entry *entry;
+
+  pph_account_node *current_user;
+
+  //sanitize the data.
+  if(ctx == NULL || usernames == NULL || passwords == NULL){
+    return PPH_BAD_PTR;
+  }
+
+  if(username_count < ctx->threshold){
+    return PPH_ACCOUNT_IS_INVALID;
+  }
+
+  // initialize the share numbers
+  for(i=0;i<MAX_NUMBER_OF_SHARES;i++){
+    share_numbers[i] = 0;
+    //share_numbers[i] = (uint8)(i+1);
+  }
+  // do the reconstruction.
+  G = gfshare_ctx_init_dec( share_numbers, MAX_NUMBER_OF_SHARES-1,
+     SHARE_LENGTH);
+
+  // traverse our possible users
+  current_user=ctx->account_data;
+  while(current_user!=NULL){
+    // check if our users lies inside this
+    // TODO: do this faster
+    for(i = 0; i<username_count;i++){
+      if(!strcmp(usernames[i],current_user->account.username)){
+        // this is an existing user!
+        // give all of it's calculated shares to libgfshare...
+        entry = current_user->account.entries;
+        while(entry!=NULL){
+          // calulate the share
+          sprintf(salted_password,"%s%s",entry->salt,passwords[i]);
+          _calculate_digest(estimated_digest,salted_password);
+          _xor_share_with_digest(estimated_share,entry->hashed_value,
+              estimated_digest,SHARE_LENGTH);
+
+          // give share to recombine
+          share_numbers[entry->share_number] = entry->share_number+1;
+          gfshare_ctx_dec_giveshare(G, entry->share_number,estimated_share);
+
+          entry = entry->next;
+        }
+      }
+    }
+    current_user = current_user->next;
+  }
+  gfshare_ctx_dec_newshares(G, share_numbers);
+  gfshare_ctx_dec_extract(G, ctx->secret);
+  gfshare_ctx_enc_setsecret(ctx->share_context, ctx->secret);
   return PPH_ERROR_UNKNOWN;
 }


Only call freeaddrinfo if job->info is not NULL

If it is NULL and freeaddrinfo is called, libc segmentation faults

--- src/unix/lwt_unix_unix.c
+++ src/unix/lwt_unix_unix.c
@@ -2070,7 +2070,8 @@
       vres = v;
     }
   }
-  freeaddrinfo(job->info);
+  if (job->info != NULL)
+    freeaddrinfo(job->info);
   lwt_unix_free_job(&job->job);
   CAMLreturn(vres);
 }


Delete zmq.c

Delete zmq.c


Removed softmax Int16 dependency on std::vector

--- tensorflow/lite/kernels/internal/reference/softmax.h
+++ tensorflow/lite/kernels/internal/reference/softmax.h
@@ -16,7 +16,6 @@
 #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SOFTMAX_H_

 #include <limits>
-#include <vector>

 #include "fixedpoint/fixedpoint.h"
 #include "tensorflow/lite/kernels/internal/common.h"
@@ -145,6 +144,20 @@
   }
 }

+int16_t CalculateExp(const SoftmaxParams& params, const int16_t* input_data,
+                     const int depth, int16_t max_in_row, int i, int c) {
+  int32_t input_diff = input_data[i * depth + c] - max_in_row;
+  // scale the input_diff such that [-65535, 0] correspond to [-10.0, 0.0]
+  int32_t scaled_diff = MultiplyByQuantizedMultiplier(
+      input_diff, params.input_multiplier, params.input_left_shift);
+  // recenter to [-32768, 32767]
+  int32_t sym_scaled_diff = scaled_diff + 32767;
+  int16_t sat_sym_scaled_diff =
+      std::min(std::max(sym_scaled_diff, static_cast<int32_t>(-32768)),
+               static_cast<int32_t>(32767));
+  // apply the exp() LUT activation function
+  return generic_int16_table_lookup(sat_sym_scaled_diff, params.exp_lut);
+}
 // Quantized softmax with int16_t input and int16_t output.
 inline void SoftmaxInt16(const SoftmaxParams& params,
                          const RuntimeShape& input_shape,
@@ -165,27 +178,10 @@
     }

     // Compute exp(input - max_input)
-    std::vector<int16_t> exp_result_Q015(depth);
-    for (int c = 0; c < depth; ++c) {
-      int32_t input_diff = input_data[i * depth + c] - max_in_row;
-      // scale the input_diff such that [-65535, 0] correspond to [-10.0, 0.0]
-      int32_t scaled_diff = MultiplyByQuantizedMultiplier(
-          input_diff, params.input_multiplier, params.input_left_shift);
-      // recenter to [-32768, 32767]
-      int32_t sym_scaled_diff = scaled_diff + 32767;
-      int16_t sat_sym_scaled_diff =
-          std::min(std::max(sym_scaled_diff, static_cast<int32_t>(-32768)),
-                   static_cast<int32_t>(32767));
-      // apply the exp() LUT activation function
-      exp_result_Q015[c] =
-          generic_int16_table_lookup(sat_sym_scaled_diff, params.exp_lut);
-    }
-
     // sum_of_exps is a Q16.15 fixed point format.
     int32_t sum_of_exps = 0;
     for (int c = 0; c < depth; ++c) {
-      // Q16.15 + Q0.15
-      sum_of_exps += exp_result_Q015[c];
+      sum_of_exps += CalculateExp(params, input_data, depth, max_in_row, i, c);
     }

     // Compute the reciprocal 1/sum_of_exps
@@ -211,7 +207,9 @@
     for (int c = 0; c < depth; ++c) {
       uint8_t right_shift = 31 - headroom_plus_one;
       int64_t round = 1 << (right_shift - 1);
-      int32_t result = (static_cast<int64_t>(exp_result_Q015[c]) *
+      int16_t exp_result_Q015 =
+          CalculateExp(params, input_data, depth, max_in_row, i, c);
+      int32_t result = (static_cast<int64_t>(exp_result_Q015) *
                             static_cast<int64_t>(reciprocal_scale_Q015) +
                         round) >>
                        right_shift;


fix: avoid tampering written data

fix: avoid tampering written data

Speed and Temperature were altered when writing files:
 ./srmcmd -r -w out1.srm in.srm
 ./srmcmd -r -w out2.srm out1.srm

This was due to missing rounding of the converted values.

--- srmfile.c
+++ srmfile.c
@@ -654,8 +654,8 @@

 		for( ci = bk->first; ci <= bk->last; ++ci ){
 			srm_chunk_t ck = data->chunks[ci];
-			unsigned speed = ( ck->speed * 1000) / 3.6;
-			int temp = ck->temp * 10;
+			unsigned speed = 0.5 + ( ck->speed * 1000) / 3.6;
+			int temp = 0.5 + ck->temp * 10;

 			if( 0 > _setuint16( buf, 0, ck->pwr ) )
 				goto clean1;


ABI fixes from 1.0.1-stable

ABI fixes from 1.0.1-stable

--- ssl/ssl.h
+++ ssl/ssl.h
@@ -1329,12 +1329,6 @@
 	unsigned char *next_proto_negotiated;
 	unsigned char next_proto_negotiated_len;
 #endif
-	int renegotiate;/* 1 if we are renegotiating.
-	                 * 2 if we are a server and are inside a handshake
-	                 * (i.e. not just sending a HelloRequest) */
-#ifndef OPENSSL_NO_SRP
-	SRP_CTX srp_ctx; /* ctx for SRP authentication */
-#endif

 #define session_ctx initial_ctx

@@ -1351,6 +1345,13 @@
 #else
 #define session_ctx ctx
 #endif /* OPENSSL_NO_TLSEXT */
+
+	int renegotiate;/* 1 if we are renegotiating.
+	                 * 2 if we are a server and are inside a handshake
+	                 * (i.e. not just sending a HelloRequest) */
+#ifndef OPENSSL_NO_SRP
+	SRP_CTX srp_ctx; /* ctx for SRP authentication */
+#endif

 	/* Callback for disabling session caching and ticket support
 	 * on a session basis, depending on the chosen cipher. */


Move some COMP functions to be inside the #ifndef OPENSSL_NO_COMP wrapping preprocessor directive.  This also removes a duplicate declaration.

--- ssl/ssl.h
+++ ssl/ssl.h
@@ -1200,11 +1200,6 @@
 char *	SSL_CIPHER_get_version(SSL_CIPHER *c);
 const char *	SSL_CIPHER_get_name(SSL_CIPHER *c);

-const COMP_METHOD *SSL_get_current_compression(SSL *s);
-const COMP_METHOD *SSL_get_current_expansion(SSL *s);
-const char *SSL_COMP_get_name(const COMP_METHOD *comp);
-STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
-
 int	SSL_get_fd(SSL *s);
 int	SSL_get_rfd(SSL *s);
 int	SSL_get_wfd(SSL *s);
@@ -1492,11 +1487,17 @@
 #endif

 #ifndef OPENSSL_NO_COMP
+const COMP_METHOD *SSL_get_current_compression(SSL *s);
+const COMP_METHOD *SSL_get_current_expansion(SSL *s);
+const char *SSL_COMP_get_name(const COMP_METHOD *comp);
 STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
 int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
 #else
+const void *SSL_get_current_compression(SSL *s);
+const void *SSL_get_current_expansion(SSL *s);
+const char *SSL_COMP_get_name(const void *comp);
 void *SSL_COMP_get_compression_methods(void);
-int SSL_COMP_add_compression_method(int id,char *cm);
+int SSL_COMP_add_compression_method(int id,void *cm);
 #endif

 /* BEGIN ERROR CODES */


remove superfasthash definition in mrf.h

--- src/lsh/mrf.h
+++ src/lsh/mrf.h
@@ -51,8 +51,6 @@
       int _radius;
   };

-  uint32_t SuperFastHash(const char *data, uint32_t len);
-
   template<typename feat>
   void mrf_hash_m(const char *data, uint32_t len, feat &f)
   { };