passes in parameters for the rest of loss and bw.
----

not too convinced that poisson is correct (see corresponding dummynet
commit msg)

the command line reading code has ballooned and could use cleaning in some
way. since this is user code, i'm not _terribly_ concerned, but...

should add more to 'ipfw pipe show'.

more validity checking would be nice, but having the kernel catch it and
 give a printf() and EINVAL is not bad.

--- delay/ipfw_mods/ipfw.c
+++ delay/ipfw_mods/ipfw.c
@@ -546,8 +546,6 @@
 	    else
 		rulenum = 0 ;
 	    for ( ; nbytes > 0 ; p = (struct dn_pipe *)next_pipe ) {
-		double b = p->bandwidth ;
-		char buf[30] ;
 		char qs[30] ;
 		char plr[30] ;
 		int l ;
@@ -560,14 +558,72 @@

 		if (rulenum != 0 && rulenum != p->pipe_nr)
 			continue;
-		if (b == 0)
-		    sprintf(buf, "unlimited");
-		else if (b >= 1000000)
-		    sprintf(buf, "%7.3f Mbit/s", b/1000000 );
-		else if (b >= 1000)
-		    sprintf(buf, "%7.3f Kbit/s", b/1000 );
+
+		printf("%05d: ",p->pipe_nr);
+
+		printf("\tbandwidth dist:\t");
+		if (!p->bwdist)
+		    printf("none (unlimited bw)");
 		else
-		    sprintf(buf, "%7.3f bit/s ", b );
+		if (p->bwdist & DN_DIST_CONST_RATE)
+		    printf("constant, %4d ",p->bandwidth);
+		else
+		if (p->bwdist & DN_DIST_UNIFORM)
+		    printf("uniform, var %4d mean %4d ",
+			p->bwvar,p->bwmean);
+		else
+		if (p->bwdist & DN_DIST_POISSON)
+		    printf("Poisson, mean %4d ",p->bwmean);
+		else
+		if (p->bwdist & DN_DIST_TABLE_RANDOM)
+		    printf("random (PRINT ENTRIES)");
+		else
+		if (p->bwdist & DN_DIST_TABLE_DETERM)
+		     printf("deterministic (PRINT ENTRIES)");
+
+		printf("\n\tdelay dist:\t");
+		if (!p->delaydist)
+		    printf("none");
+		else
+		if (p->delaydist & DN_DIST_CONST_TIME)
+		    printf("constant, %4d ms",p->delay);
+		else
+		if (p->delaydist & DN_DIST_UNIFORM)
+		    printf("uniform, var %4d mean %4d ",
+			p->delayvar,p->delaymean);
+		else
+		if (p->delaydist & DN_DIST_POISSON)
+		    printf("Poisson, mean %4d ",p->delaymean);
+		else
+		if (p->delaydist & DN_DIST_TABLE_RANDOM)
+		    printf("random (PRINT ENTRIES)");
+		else
+		if (p->delaydist & DN_DIST_TABLE_DETERM)
+		     printf("deterministic (PRINT ENTRIES)");
+
+		printf("\n\tloss dist:\t");
+		if (!p->lossdist)
+		    printf("none");
+		else
+		if (p->lossdist & DN_DIST_CONST_TIME)
+		    printf("constant time, %4d ",p->lossmean);
+		else
+		if (p->lossdist & DN_DIST_CONST_RATE)
+		    printf("constant rate, %4d ",p->plr);
+		else
+		if (p->lossdist & DN_DIST_UNIFORM)
+		    printf("uniform, var %4d mean %4d ",
+			p->lossvar,p->lossmean);
+		else
+		if (p->lossdist & DN_DIST_POISSON)
+		    printf("Poisson, mean %4d ",p->lossmean);
+		else
+		if (p->lossdist & DN_DIST_TABLE_RANDOM)
+		    printf("random (PRINT ENTRIES)");
+		else
+		if (p->lossdist & DN_DIST_TABLE_DETERM)
+		    printf("deterministic (PRINT ENTRIES)");
+		putchar('\n');

 		if ( (l = p->queue_size_bytes) != 0 ) {
 		    if (l >= 8192)
@@ -580,22 +636,7 @@
 		    sprintf(plr,"plr %f", 1.0*p->plr/(double)(0x7fffffff));
 		else
 		    plr[0]='\0';
-		printf("%05d: %s\n",p->pipe_nr, buf);
-		if (p->delaydist & DN_DIST_CONST_TIME)
-		    printf("constant delay %4d ms",p->delay);
-		else
-		if (p->delaydist & DN_DIST_UNIFORM)
-		    printf("uniform delay var %4d mean %4d ms",
-			p->delayvar,p->delaymean);
-		else
-		if (p->delaydist & DN_DIST_POISSON)
-		    printf("Poisson delay mean %4d ms",p->delaymean);
-		else
-		if (p->delaydist & DN_DIST_TABLE_RANDOM)
-		    printf("random delay table");
-		else
-		if (p->delaydist & DN_DIST_TABLE_DETERM)
-		     printf("deterministic delay table");
+
 		printf(" %s%s %d queues (%d buckets)\n",
 		    qs, plr,
 		    p->rq_elements, p->rq_size);
@@ -1189,8 +1230,7 @@

 /*
  * build_poisson()
- * given a mean, which we grab from the supplied pipe, build a table for
- * poisson distribution.
+ * given a mean, build a table for poisson distribution.
  *
  * remember calculus long, long ago, estimating the area under the function by
  * calculating f(1) + f(2) + f(3) + ... ? Well, that is sort of what we are
@@ -1198,51 +1238,47 @@
  * 7's in the table.  When the table is complete, one can randomly choose
  * values from this table, with the results following a poisson distribution.
  */
-static void
-build_poisson(struct dn_pipe *pipe)
-{
-	int p, x;
-	double probability;
-
-	if (pipe->delaymean <= 0)
-		show_usage("invalid delaymean %d\n",pipe->delaymean);
-
-	x = pipe->delayentries = 0;
-
-	if ( ! ( pipe->delaytable = malloc(sizeof(int)*0x8200)))
-	        err(1,"poisson table ate all of the memory\n");
-
-	do {
-	    /* P(x) =  e^-mean * mean^x
-	     *         ----------------
-	     *              x!
-	     *
-	     * we will have approximately 0x8000 entries in our table.
-	     * there is no deep meaning to 0x8000. arbitrary.
-	     *
-	     * note that we make use of P(x-1) to calculate P(x).
+static int *
+build_poisson(int mean, int *entries)
+{
+    int p, x;
+    int *table;
+    double probability;
+
+    if (mean <= 0)
+	show_usage("invalid mean %d\n",mean);
+
+    x = *entries = 0;
+
+    if ( ! ( table = malloc(sizeof(int)*0x8200)))
+        err(1,"poisson table ate all of the memory\n");
+
+    do {
+        /* P(x) =  e^-mean * mean^x
+         *         ----------------
+         *              x!
+         *
+         * we will have approximately 0x8000 entries in our table.
+         * there is no deep meaning to 0x8000. arbitrary.
+         *
+         */
+        probability = log(mean) * x - mean - ln_gamma(1.0 + x);
+        probability = (probability < -40.0) ? 0.0 : exp(probability);
+        probability *= 0x8000;
+        for(p= (int)probability ;p;p--) {
+	    table[(*entries)++]=x;
+	    /* since we truncate when casting to int, I don't even think
+	     * we need any more than 0x8000 entries. However, I do not
+	     * feel confident enough to chance it.
 	     */
-probability = log(pipe->delaymean) * x - pipe->delaymean - ln_gamma(1.0 + x);
-probability = (probability < -40.0) ? 0.0 : exp(probability);
-probability *= 0x8000;
-/*	    if (!probability)
-		probability = exp(-pipe->delaymean);
-	    else
-		probability = probability * pipe->delaymean / x;
-*/	    for(p= (int)probability ;p;p--) {
-		pipe->delaytable[pipe->delayentries++]=x;
-printf("there's a %d\n",x);
-		/* since we truncate when casting to int, I don't even think
-		 * we need any more than 0x8000 entries. However, I do not
-		 * feel confident enough to chance it.
-		 */
-		if (pipe->delayentries == 0x8200)
-		    return;
-	    }
-	    x++;
-	} while(x < pipe->delaymean || probability >= 1);
-
-}
+	    if (*entries == 0x8200)
+	        return table;
+        }
+        x++;
+    } while(x < mean || probability >= 1);
+    return table;
+}
+
 static void
 config_pipe(int ac, char **av)
 {
@@ -1262,6 +1298,7 @@
 	    arglen = strlen(*av);
             if (!strncmp(*av,"bw",arglen) ||
                 ! strncmp(*av,"bandwidth",arglen)) {
+		pipe.bwdist = DN_DIST_CONST_RATE;
                 pipe.bandwidth = strtoul(av[1], &end, 0);
                 if (*end == 'K' || *end == 'k' )
                         end++, pipe.bandwidth *= 1000 ;
@@ -1270,6 +1307,63 @@
                 if ( *end == 'B' || !strncmp(end, "by", 2) )
                         pipe.bandwidth *= 8 ;
                 av+=2; ac-=2;
+	    } else if (!strncmp(*av,"bwdist",arglen) ) {
+		av++; ac--;
+		arglen = strlen(*av);
+		if (!strncmp(*av,"constant",arglen) ) {
+		    pipe.bwdist=DN_DIST_CONST_RATE;
+		} else if (!strncmp(*av,"uniform",arglen) ) {
+		    pipe.bwdist=DN_DIST_UNIFORM;
+		} else if (!strncmp(*av,"poisson",arglen) ) {
+		    pipe.bwdist=DN_DIST_POISSON;
+                } else if (!strncmp(*av,"random",arglen) ) {
+                    pipe.bwdist=DN_DIST_TABLE_RANDOM;
+		} else if (!strncmp(*av,"determ",arglen) ) {
+		    pipe.bwdist=DN_DIST_TABLE_DETERM;
+		} else show_usage("invalid bw distribution ``%s''", *av);
+		av++; ac--;
+	    } else if (!strncmp(*av,"bwmean",arglen) ) {
+		/* used for all bw types except custom */
+		pipe.bwmean = strtoul(av[1], &end, 0);
+		if (*end == 'K' || *end == 'k' )
+		    end++, pipe.bwmean *= 1000 ;
+		else if (*end == 'M')
+		    end++, pipe.bwmean *= 1000000 ;
+		if ( *end == 'B' || !strncmp(end, "by", 2) )
+		    pipe.bwmean *= 8 ;
+		av+=2; ac-=2;
+	    } else if (!strncmp(*av,"bwvar",arglen) ) {
+		/* used for uniform dist */
+		pipe.bwvar = strtoul(av[1], &end, 0);
+		if (*end == 'K' || *end == 'k' )
+		    end++, pipe.bwvar *= 1000 ;
+		else if (*end == 'M')
+		    end++, pipe.bwvar *= 1000000 ;
+		if ( *end == 'B' || !strncmp(end, "by", 2) )
+		    pipe.bwvar *= 8 ;
+		av+=2; ac-=2;
+	    } else if (!strncmp(*av,"bwquantum",arglen) ) {
+		pipe.bwquantum = strtol(av[1], NULL, 0);
+		av+=2; ac-=2;
+	    } else if (!strncmp(*av,"bwentries",arglen) ) {
+		/* bw table. first, the number of entries.
+		 * next, the entries themselves */
+		pipe.bwentries = strtol(av[1], NULL, 0);
+		if (pipe.bwentries <= 0)
+		    show_usage("%d entries in your custom bw table?", av[1]);
+		av+=2; ac-=2;
+		pipe.bwtable = malloc(pipe.bwentries*sizeof(int));
+		for(i=0;i<pipe.bwentries;i++) {
+		    pipe.bwtable[i] = strtoul(av[i], &end, 0);
+		    if (*end == 'K' || *end == 'k' )
+			end++, pipe.bwtable[i] *= 1000;
+		    else if (*end == 'M')
+			end++, pipe.bwtable[i] *= 1000000;
+		    if ( *end == 'B' || !strncmp(end, "by", 2) )
+			pipe.bwtable[i] *= 8;
+		}
+		av+=pipe.bwentries;
+		ac-=pipe.bwentries;
             } else if (!strcmp(*av,"delay") ) {
 		pipe.delaydist = DN_DIST_CONST_TIME;
                 pipe.delay = strtoul(av[1], NULL, 0);
@@ -1299,7 +1393,7 @@
                 av+=2; ac-=2;
 	    } else if (!strncmp(*av,"delayentries",arglen) ) {
 		/* delay table. first, the number of entries. next, the entries themselves */
-		pipe.delayentries = strtol(av[1], NULL, 0);
+		pipe.delayentries = strtoul(av[1], NULL, 0);
 		if (pipe.delayentries <= 0)
 		    show_usage("%d entries in your custom delay table?", av[1]);
 		av+=2; ac-=2;
@@ -1329,6 +1423,8 @@
 		    pipe.lossdist=DN_DIST_TABLE_DETERM;
 		} else if (!strncmp(*av,"uniform",arglen) ) {
 		    pipe.lossdist=DN_DIST_UNIFORM;
+		} else if (!strncmp(*av,"poisson",arglen) ) {
+		    pipe.lossdist=DN_DIST_POISSON;
 		} else show_usage("invalid loss distribution ``%s''", *av);
                 av++; ac--;
 	    } else if (!strcmp(*av,"loss") ) {
@@ -1337,7 +1433,8 @@
 		av+=2; ac-=2;
 	    } else if (!strncmp(*av,"lossmean",arglen) ) {
 		/* if mean is rate-based, convert it */
-		if (pipe.lossdist & DN_DIST_UNIFORM) {
+		if (pipe.lossdist &
+		    (DN_DIST_UNIFORM|DN_DIST_POISSON|DN_DIST_TABLE_RANDOM)) {
 		    double d = strtod(av[1], NULL);
 		    if ((d > 1) | (d < 0))
 			show_usage("invalid lossmean %s\n",av[1]);
@@ -1454,8 +1551,23 @@
                 show_usage("unrecognised option ``%s''", *av);
         }

+	/* handle poisson distribution */
 	if (pipe.delaydist == DN_DIST_POISSON)
-	    build_poisson(&pipe);
+	    pipe.delaytable =
+		build_poisson(pipe.delaymean,&(pipe.delayentries));
+	if (pipe.lossdist == DN_DIST_POISSON) {
+	    /* the mean is a 31-bit number and the cheesy method that i use
+	     * is just not going to work. of course, my 'adjustment' below
+	     * is even worse.
+	     */
+	    pipe.losstable =
+		build_poisson(pipe.lossmean>>0x10,&(pipe.lossentries));
+	    for (i = 0; i < pipe.lossentries; i++)
+		    pipe.losstable[i]<<=0x10;
+	}
+	if (pipe.bwdist == DN_DIST_POISSON)
+	    pipe.bwtable =
+		build_poisson(pipe.bwmean,&(pipe.bwentries));

         if (pipe.pipe_nr == 0 )
             show_usage("pipe_nr %d be > 0", pipe.pipe_nr);


Remove unused type 'xccdf_substitution_func'

--- src/XCCDF/public/xccdf_benchmark.h
+++ src/XCCDF/public/xccdf_benchmark.h
@@ -3435,18 +3435,6 @@
     XCCDF_SUBST_INSTANCE   ///< substitute cdf:instance element
 } xccdf_subst_type_t;

-/**
- * Textual substitution callback.
- * This function is supposed to return textual representation of the substitution with given ID.
- * @param type Type of the substitution
- * @param id   ID of the object to be substituted
- * @param arg  arbitrary user-defined argument
- * @return     newly allocated substitution string (will be free'd)
- * @deprecated This callback has been deprecated. It cannot be applied on XCCDF 1.2+ documents
- * given the xccdf:sub/@use parameter.
- */
-typedef char*(*xccdf_substitution_func)(xccdf_subst_type_t type, const char *id, void *arg);
-
 /************************************************************/
 /** @} End of XCCDF group */
 /// @}


log a warning on bogus arguments

log a warning on bogus arguments

--- cal/mdnssd-bip/shared/bip-net-clear.c
+++ cal/mdnssd-bip/shared/bip-net-clear.c
@@ -5,6 +5,11 @@

 void bip_net_clear(bip_peer_network_info_t *net) {
+    if (net == NULL) {
+        g_log(CAL_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bip_net_clear: NULL net passed in");
+        return;
+    }
+
     net->header_index = 0;

     if (net->buffer != NULL) {


chap 5

chap 5

error: pathspec 'add_one.c' did not match any file(s) known to git

--- add_one.c
+++ add_one.c
@@ -0,0 +1,13 @@
+/* add_one.c -- increment: prefix and suffix */
+#include <stdio.h>
+int main(void)
+{
+	int ultra = 0, super = 0;
+	while (super < 5)
+	{
+		super++;
+		++ultra;
+		printf("super = %d, ultra = %d\n", super, ultra);
+	}
+	return 0;
+}


convert an error log into an info log

 convert an error log into an info log

git-svn-id: ff687e355030673c307e7da231f59639d58f56d5@1182 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

--- avahi-daemon/static-services.c
+++ avahi-daemon/static-services.c
@@ -693,7 +693,7 @@
 	        break;

             case GLOB_NOMATCH:
-	        avahi_log_error("No service found in %s.", AVAHI_SERVICE_DIR);
+	        avahi_log_info("No service found in %s.", AVAHI_SERVICE_DIR);
 	        break;
 	        }
     else {


azalia_generic_mixer_pin_sense has nothing to do with pin sense anymore. it is about codec gpio quirks.  so rename it as azalia_codec_gpio_quirks, and move it to where the rest of the codec specific code is.

--- dev/pci/azalia_codec.c
+++ dev/pci/azalia_codec.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: azalia_codec.c,v 1.90 2008/12/23 10:33:10 jakemsr Exp $	*/
+/*	$OpenBSD: azalia_codec.c,v 1.91 2008/12/23 10:43:26 jakemsr Exp $	*/
 /*	$NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $	*/

 /*-
@@ -77,7 +77,6 @@

 int	azalia_generic_mixer_fix_indexes(codec_t *);
 int	azalia_generic_mixer_default(codec_t *);
-int	azalia_generic_mixer_pin_sense(codec_t *);
 int	azalia_generic_mixer_create_virtual(codec_t *, int, int);
 int	azalia_generic_mixer_delete(codec_t *);
 int	azalia_generic_mixer_ensure_capacity(codec_t *, size_t);
@@ -92,6 +91,7 @@
 int	azalia_gpio_unmute(codec_t *, int);

 void	azalia_pin_config_ov(widget_t *, int, int);
+int	azalia_codec_gpio_quirks(codec_t *);

 int	azalia_ad1984_mixer_init(codec_t *);
 int	azalia_alc260_mixer_init(codec_t *);
@@ -277,7 +277,6 @@
 		return 0;
 	return 1;
 }
-

 int
 azalia_generic_codec_init_dacgroup(codec_t *this)
@@ -949,43 +948,6 @@
 }

 int
-azalia_generic_mixer_pin_sense(codec_t *this)
-{
-	/* GPIO quirks */
-
-	if (this->vid == SIGMATEL_STAC9221 && this->subid == STAC9221_APPLE_ID) {
-		this->comresp(this, this->audiofunc, 0x7e7, 0, NULL);
-		azalia_gpio_unmute(this, 0);
-		azalia_gpio_unmute(this, 1);
-	}
-	if (this->vid == REALTEK_ALC883 && this->subid == ALC883_ACER_ID) {
-		azalia_gpio_unmute(this, 0);
-		azalia_gpio_unmute(this, 1);
-	}
-	if ((this->vid == REALTEK_ALC660 && this->subid == ALC660_ASUS_G2K) ||
-	    (this->vid == REALTEK_ALC880 && this->subid == ALC880_ASUS_M5200) ||
-	    (this->vid == REALTEK_ALC880 && this->subid == ALC880_ASUS_A7M) ||
-	    (this->vid == REALTEK_ALC882 && this->subid == ALC882_ASUS_A7T) ||
-	    (this->vid == REALTEK_ALC882 && this->subid == ALC882_ASUS_W2J) ||
-	    (this->vid == REALTEK_ALC885 && this->subid == ALC885_APPLE_MB3) ||
-	    (this->vid == REALTEK_ALC885 && this->subid == ALC885_APPLE_MB4) ||
-	    (this->vid == SIGMATEL_STAC9205 && this->subid == STAC9205_DELL_D630) ||
-	    (this->vid == SIGMATEL_STAC9205 && this->subid == STAC9205_DELL_V1500)) {
-		azalia_gpio_unmute(this, 0);
-	}
-
-	if (this->vid == REALTEK_ALC880 && this->subid == ALC880_MEDION_MD95257) {
-		azalia_gpio_unmute(this, 1);
-	}
-
-	if (this->vid == IDT_92HD71B7 && this->subid == IDT92HD71B7_DELL_E6400) {
-		azalia_gpio_unmute(this, 0);
- 	}
-
-	return 0;
-}
-
-int
 azalia_generic_mixer_create_virtual(codec_t *this, int pdac, int padc)
 {
 	mixer_item_t *m;
@@ -1057,7 +1019,7 @@
 {
 	azalia_generic_mixer_init(this);
 	azalia_generic_mixer_create_virtual(this, -1, -1);
-	azalia_generic_mixer_pin_sense(this);
+	azalia_codec_gpio_quirks(this);

 	return 0;
 }
@@ -1737,6 +1699,38 @@
 		w->d.pin.device = val;
 }

+int
+azalia_codec_gpio_quirks(codec_t *this)
+{
+	if (this->vid == SIGMATEL_STAC9221 && this->subid == STAC9221_APPLE_ID) {
+		this->comresp(this, this->audiofunc, 0x7e7, 0, NULL);
+		azalia_gpio_unmute(this, 0);
+		azalia_gpio_unmute(this, 1);
+	}
+	if (this->vid == REALTEK_ALC883 && this->subid == ALC883_ACER_ID) {
+		azalia_gpio_unmute(this, 0);
+		azalia_gpio_unmute(this, 1);
+	}
+	if ((this->vid == REALTEK_ALC660 && this->subid == ALC660_ASUS_G2K) ||
+	    (this->vid == REALTEK_ALC880 && this->subid == ALC880_ASUS_M5200) ||
+	    (this->vid == REALTEK_ALC880 && this->subid == ALC880_ASUS_A7M) ||
+	    (this->vid == REALTEK_ALC882 && this->subid == ALC882_ASUS_A7T) ||
+	    (this->vid == REALTEK_ALC882 && this->subid == ALC882_ASUS_W2J) ||
+	    (this->vid == REALTEK_ALC885 && this->subid == ALC885_APPLE_MB3) ||
+	    (this->vid == REALTEK_ALC885 && this->subid == ALC885_APPLE_MB4) ||
+	    (this->vid == SIGMATEL_STAC9205 && this->subid == STAC9205_DELL_D630) ||
+	    (this->vid == SIGMATEL_STAC9205 && this->subid == STAC9205_DELL_V1500)) {
+		azalia_gpio_unmute(this, 0);
+	}
+	if (this->vid == REALTEK_ALC880 && this->subid == ALC880_MEDION_MD95257) {
+		azalia_gpio_unmute(this, 1);
+	}
+	if (this->vid == IDT_92HD71B7 && this->subid == IDT92HD71B7_DELL_E6400) {
+		azalia_gpio_unmute(this, 0);
+ 	}
+	return 0;
+}
+
 /* ----------------------------------------------------------------
  * codec specific functions
  * ---------------------------------------------------------------- */
@@ -1763,7 +1757,7 @@
 {
 	azalia_generic_mixer_init(this);
 	azalia_generic_mixer_create_virtual(this, 0x08, -1);
-	azalia_generic_mixer_pin_sense(this);
+	azalia_codec_gpio_quirks(this);
 	return 0;
 }

@@ -1773,7 +1767,7 @@
 {
 	azalia_generic_mixer_init(this);
 	azalia_generic_mixer_create_virtual(this, 0x0c, -1);
-	azalia_generic_mixer_pin_sense(this);
+	azalia_codec_gpio_quirks(this);
 	return 0;
 }

@@ -1800,7 +1794,7 @@
 {
 	azalia_generic_mixer_init(this);
 	azalia_generic_mixer_create_virtual(this, 0x0b, 0x0a);
-	azalia_generic_mixer_pin_sense(this);
+	azalia_codec_gpio_quirks(this);
 	return 0;
 }

@@ -1810,7 +1804,7 @@
 {
 	azalia_generic_mixer_init(this);
 	azalia_generic_mixer_create_virtual(this, 0x0e, 0x09);
-	azalia_generic_mixer_pin_sense(this);
+	azalia_codec_gpio_quirks(this);
 	return 0;
 }


Return p is NAN with no data

Return p is NAN with no data

--- spit/numList.c
+++ spit/numList.c
@@ -252,7 +252,7 @@

 double loadTTable(size_t df, size_t tail, double a) {
-  double ret = 0;
+  double ret = NAN;

   a = 0.05; // hard coded
   fprintf(stderr,"*info* load table %zd, %zd, %.4lf\n", df, tail, a);
@@ -273,9 +273,11 @@
 	  ret = atof(third);
 	}
       }
-    }
-  }
-  fclose(fp);
+    }
+    fclose(fp);
+  } else {
+    fprintf(stderr,"*error* the critical t table couldn't be loaded\n");
+  }
   return ret;
 }


* fix for undefined XMLCALL

* fix for undefined XMLCALL

git-svn-id: ff687e355030673c307e7da231f59639d58f56d5@918 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

--- avahi-daemon/static-services.c
+++ avahi-daemon/static-services.c
@@ -302,6 +302,10 @@
     char *buf;
 };

+#ifndef XMLCALL
+#define XMLCALL
+#endif
+
 static void XMLCALL xml_start(void *data, const char *el, const char *attr[]) {
     struct xml_userdata *u = data;


Add proper DAC/ADC grouping for AD1984 (from NetBSD).

This fixes fallout for AD1984 revealed by recent azalia.c
changes and reported on misc@.

While here:

* move gpio_unmute to more logical place,
* remove code ifdef'ed and unused for ages.

from Alexey Suslikov, thanks

Index: sys/dev/pci/azalia_codec.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.52
diff -u -r1.52 azalia_codec.c
--- sys/dev/pci/azalia_codec.c	23 Oct 2008 02:23:04 -0000	1.52
+++ sys/dev/pci/azalia_codec.c	24 Oct 2008 17:29:36 -0000
@@ -98,6 +98,7 @@
 	(const codec_t *, nid_t, int, u_char);
 int	azalia_generic_set_port(codec_t *, mixer_ctrl_t *);
 int	azalia_generic_get_port(codec_t *, mixer_ctrl_t *);
+int	azalia_gpio_unmute(codec_t *, int);

 int	azalia_alc260_init_dacgroup(codec_t *);
 int	azalia_alc260_mixer_init(codec_t *);
@@ -127,7 +128,6 @@
 int	azalia_stac9221_set_port(codec_t *, mixer_ctrl_t *);
 int	azalia_stac9221_get_port(codec_t *, mixer_ctrl_t *);
 int	azalia_stac9221_apple_unsol_event(codec_t *, int);
-int	azalia_gpio_unmute(codec_t *, int);
 int	azalia_stac7661_init_dacgroup(codec_t *);
 int	azalia_stac7661_mixer_init(codec_t *);
 int	azalia_stac7661_set_port(codec_t *, mixer_ctrl_t *);
@@ -1708,6 +1708,26 @@
 	return azalia_generic_mixer_get(this, m->nid, m->target, mc);
 }

+int
+azalia_gpio_unmute(codec_t *this, int pin)
+{
+	uint32_t data, mask, dir;
+
+	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data);
+	this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
+	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir);
+
+	data |= 1 << pin;
+	mask |= 1 << pin;
+	dir |= 1 << pin;
+
+	this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
+	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL);
+	DELAY(1000);
+	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL);
+
+	return 0;
+}

 /* ----------------------------------------------------------------
  * Realtek ALC260
@@ -2181,18 +2201,11 @@
 int
 azalia_alc882_init_dacgroup(codec_t *this)
 {
-#if 0
-	static const convgroupset_t dacs = {
-		-1, 3,
-		{{4, {0x02, 0x03, 0x04, 0x05}}, /* analog 8ch */
-		 {1, {0x06}},	/* digital */
-		 {1, {0x25}}}};	/* another analog */
-#else
 	static const convgroupset_t dacs = {
 		-1, 2,
 		{{4, {0x02, 0x03, 0x04, 0x05}}, /* analog 8ch */
 		 {1, {0x06}}}};	/* digital */
-#endif
+		/* don't support for 0x25 dac */
 	static const convgroupset_t adcs = {
 		-1, 2,
 		{{3, {0x07, 0x08, 0x09}}, /* analog 6ch */
@@ -2484,13 +2497,14 @@
 azalia_ad1984_init_dacgroup(codec_t *this)
 {
 	static const convgroupset_t dacs = {
-		-1, 1,
-		{{2, {0x03, 0x04}}}};
-
+		-1, 2,
+		{{2, {0x04, 0x03}},	/* analog 4ch */
+		 {1, {0x02}}}};		/* digital */
 	static const convgroupset_t adcs = {
-		-1, 1,
-		{{1, {0x08}}}};
-
+		-1, 3,
+		{{2, {0x08, 0x09}},	/* analog 4ch */
+		 {1, {0x06}},		/* digital */
+		 {1, {0x05}}}}; 	/* digital */
 	this->dacs = dacs;
 	this->adcs = adcs;
 	return 0;
@@ -3006,27 +3020,6 @@
 		DPRINTF(("%s: unknown tag: %d\n", __func__, tag));
 	}
         return 0;
-}
-
-int
-azalia_gpio_unmute(codec_t *this, int pin)
-{
-	uint32_t data, mask, dir;
-
-	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data);
-	this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
-	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir);
-
-	data |= 1 << pin;
-	mask |= 1 << pin;
-	dir |= 1 << pin;
-
-	this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
-	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL);
-	DELAY(1000);
-	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL);
-
-	return 0;
 }

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

--- dev/pci/azalia_codec.c
+++ dev/pci/azalia_codec.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: azalia_codec.c,v 1.52 2008/10/23 02:23:04 jakemsr Exp $	*/
+/*	$OpenBSD: azalia_codec.c,v 1.53 2008/10/25 02:19:02 jakemsr Exp $	*/
 /*	$NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $	*/

 /*-
@@ -98,6 +98,7 @@
 	(const codec_t *, nid_t, int, u_char);
 int	azalia_generic_set_port(codec_t *, mixer_ctrl_t *);
 int	azalia_generic_get_port(codec_t *, mixer_ctrl_t *);
+int	azalia_gpio_unmute(codec_t *, int);

 int	azalia_alc260_init_dacgroup(codec_t *);
 int	azalia_alc260_mixer_init(codec_t *);
@@ -127,7 +128,6 @@
 int	azalia_stac9221_set_port(codec_t *, mixer_ctrl_t *);
 int	azalia_stac9221_get_port(codec_t *, mixer_ctrl_t *);
 int	azalia_stac9221_apple_unsol_event(codec_t *, int);
-int	azalia_gpio_unmute(codec_t *, int);
 int	azalia_stac7661_init_dacgroup(codec_t *);
 int	azalia_stac7661_mixer_init(codec_t *);
 int	azalia_stac7661_set_port(codec_t *, mixer_ctrl_t *);
@@ -1708,6 +1708,26 @@
 	return azalia_generic_mixer_get(this, m->nid, m->target, mc);
 }

+int
+azalia_gpio_unmute(codec_t *this, int pin)
+{
+	uint32_t data, mask, dir;
+
+	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data);
+	this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
+	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir);
+
+	data |= 1 << pin;
+	mask |= 1 << pin;
+	dir |= 1 << pin;
+
+	this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
+	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL);
+	DELAY(1000);
+	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL);
+
+	return 0;
+}

 /* ----------------------------------------------------------------
  * Realtek ALC260
@@ -2181,18 +2201,11 @@
 int
 azalia_alc882_init_dacgroup(codec_t *this)
 {
-#if 0
-	static const convgroupset_t dacs = {
-		-1, 3,
-		{{4, {0x02, 0x03, 0x04, 0x05}}, /* analog 8ch */
-		 {1, {0x06}},	/* digital */
-		 {1, {0x25}}}};	/* another analog */
-#else
 	static const convgroupset_t dacs = {
 		-1, 2,
 		{{4, {0x02, 0x03, 0x04, 0x05}}, /* analog 8ch */
 		 {1, {0x06}}}};	/* digital */
-#endif
+		/* don't support for 0x25 dac */
 	static const convgroupset_t adcs = {
 		-1, 2,
 		{{3, {0x07, 0x08, 0x09}}, /* analog 6ch */
@@ -2484,13 +2497,14 @@
 azalia_ad1984_init_dacgroup(codec_t *this)
 {
 	static const convgroupset_t dacs = {
-		-1, 1,
-		{{2, {0x03, 0x04}}}};
-
+		-1, 2,
+		{{2, {0x04, 0x03}},	/* analog 4ch */
+		 {1, {0x02}}}};		/* digital */
 	static const convgroupset_t adcs = {
-		-1, 1,
-		{{1, {0x08}}}};
-
+		-1, 3,
+		{{2, {0x08, 0x09}},	/* analog 4ch */
+		 {1, {0x06}},		/* digital */
+		 {1, {0x05}}}}; 	/* digital */
 	this->dacs = dacs;
 	this->adcs = adcs;
 	return 0;
@@ -3008,27 +3022,6 @@
         return 0;
 }

-int
-azalia_gpio_unmute(codec_t *this, int pin)
-{
-	uint32_t data, mask, dir;
-
-	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data);
-	this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
-	this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir);
-
-	data |= 1 << pin;
-	mask |= 1 << pin;
-	dir |= 1 << pin;
-
-	this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
-	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL);
-	DELAY(1000);
-	this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL);
-
-	return 0;
-}
-
 /* ----------------------------------------------------------------
  * Sony VAIO FE and SZ
  * ---------------------------------------------------------------- */


Help update

Help update

--- spit/xorrupt.c
+++ spit/xorrupt.c
@@ -140,15 +140,15 @@
   // if one -f specified, add to all jobs
   // if -F specified (with n drives), have c x n jobs
   if (!device) {
-    fprintf(stderr,"*info* xorrupt -f device [-p position] [-t time]\n");
+    fprintf(stderr,"*info* xorrupt -f device [-p position ... -p position] [-t time]\n");
     fprintf(stderr,"\nTemporarily XOR a byte at an offset position, sleep then restore\n");
     fprintf(stderr,"\nOptions:\n");
     fprintf(stderr,"   -f device  specifies a block device\n");
-    fprintf(stderr,"   -p offset  the block device offset [defaults to 0]\n");
+    fprintf(stderr,"   -p offset  the block device offset [defaults to byte 0]\n");
     fprintf(stderr,"   -p 2k      can use k,M,G units\n");
     fprintf(stderr,"   -p 4M      can use k,M,G units\n");
     fprintf(stderr,"   -p 10G     can use k,M,G units\n");
-    fprintf(stderr,"   -t time    the default time until restore\n");
+    fprintf(stderr,"   -t time    the time until restore [defaults to %zd]\n", runtime);
     fprintf(stderr,"\n");
     fprintf(stderr,"Note:\n");
     fprintf(stderr,"  Control-C can be used to cancel the timer. The byte is still restored\n");


Fixed bugs with array initialisation

Fixed bugs with array initialisation

--- proteus/WaveTools.h
+++ proteus/WaveTools.h
@@ -59,7 +59,9 @@
 	  {
             ii= nn + 1;
 	    om = ii*omega;
-	    kw = {ii*kDir[0], ii*kDir[1], ii*kDir[2]};
+	    kw[0] = ii*kDir[0];
+	    kw[1] = ii*kDir[1];
+	    kw[2] = ii*kDir[2];
 	    phi = ii*phi0;
 	    HH= HH + __cpp_eta_mode(x,t,kw,om,phi,Ycoeff[nn]);
 	  }
@@ -74,13 +76,17 @@

 	int ii =0;
 	double om = 0.;
-	double kw[3] = {0.,0.,0.};
+	double kw[nDim] = {0.,0.,0.};
 	double phi = 0.;
 	double kmode = 0.;
 	double amp = 0.;
 	double* Ufenton;
 	double* Uf;
 	Uf = new double[nDim];
+	Uf[0] = 0.;
+	Uf[1] = 0.;
+	Uf[2] = 0.;
+

@@ -90,14 +96,15 @@
 	    ii=nn+1;
 	    om = ii*omega;
 	    kmode = ii*kAbs;
-	    kw = {ii*kDir[0], ii*kDir[1], ii*kDir[2]};
+	    kw[0] = ii*kDir[0];
+	    kw[1] = ii*kDir[1];
+	    kw[2] = ii*kDir[2];
 	    phi = ii*phi0;
             amp = tanh(kmode*depth)*sqrt(gAbs/kAbs)*Bcoeff[nn]/omega;
 	    Ufenton = __cpp_vel_mode(x, t ,kw, kmode, om, phi, amp, mwl, depth, waveDir, vDir);
 	    Uf[0] = Uf[0]+ *(Ufenton);//[0];
 	    Uf[1] = Uf[1]+ *(Ufenton+1);//[1];
 	    Uf[2] = Uf[2]+ *(Ufenton+2);//[2];
-	    delete [] Ufenton;

 	  }

@@ -107,7 +114,9 @@
 	    }

         return Uf;
-
+
+	delete [] Ufenton;
+	delete [] Uf;


go back to previous version due to some warnings on Windows

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@14641 27541ba8-7e3a-0410-8455-c3a389f83636

--- mathcore/inc/Math/VectorUtil_Cint.h
+++ mathcore/inc/Math/VectorUtil_Cint.h
@@ -50,18 +50,15 @@
 #if defined (linux) || defined (_WIN32) || defined (__APPLE__)

     std::ostream & operator<< (std::ostream & os, const XYZVector & v) {
-      //return operator<< <char,char_traits<char> > (os,v);
-      return operator<< (os,v);
+      return operator<< <char,char_traits<char> > (os,v);
     }

     std::ostream & operator<< (std::ostream & os, const XYZPoint & p) {
-      //return operator<< <char,char_traits<char> > (os,p);
-      return operator<< (os,p);
+      return operator<< <char,char_traits<char> > (os,p);
     }

     std::ostream & operator<< (std::ostream & os, const XYZTVector & q) {
-      //      return operator<< <char,char_traits<char> > (os,q);
-      return operator<< (os,q);
+      return operator<< <char,char_traits<char> > (os,q);
     }

 #endif


Changed the default convolve to outer

Changed the default convolve to outer

--- src/Convolve.h
+++ src/Convolve.h
@@ -13,7 +13,7 @@
     enum BoundaryCondition {Zero = 0, Homogeneous, Clamp, Wrap};

     static Image apply(Window im, Window filter, BoundaryCondition b = Zero,
-                       Multiply::Mode m = Multiply::Elementwise);
+                       Multiply::Mode m = Multiply::Outer);

 };


exit ptarmd if btc_set_channel() failure

* bitcoinj version only(return true always on bitcoind version)
* monitoring.c call set_channel()

--- ptarmd/monitoring.c
+++ ptarmd/monitoring.c
@@ -491,7 +491,7 @@
                     ptarmd_eventlog(
                         ln_channel_id(&pConf->channel),
                         "fail: set_channel\n");
-                    lnapp_stop_threads(pConf);
+                    ptarmd_stop();
                 }
             }
         }


Commit access test

Commit access test

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@308712 91177308-0d34-0410-b5e6-96231b3b80d8


DISPATCH-1979: Additional fix, clean session data after conn config has been set to zero

--- src/adaptors/http2/http2_adaptor.c
+++ src/adaptors/http2/http2_adaptor.c
@@ -2172,14 +2172,13 @@
 {
     sys_mutex_lock(qd_server_get_activation_lock(http2_adaptor->core->qd->server));

-    clean_session_data(conn);
-
     if (conn->pn_raw_conn) {
         qd_log(http2_adaptor->log_source, QD_LOG_TRACE, "[C%"PRIu64"] Setting conn->pn_raw_conn=0", conn->conn_id);
         conn->pn_raw_conn = 0;
     }

     if (conn->ingress) {
+        clean_session_data(conn);
         close_connections(conn);
     }
     else {
@@ -2195,11 +2194,16 @@
             }
             conn->stream_dispatcher_stream_data = 0;

-            if (conn->delete_egress_connections) {
-                // The config has already been freed by the qd_http_connector_decref() function, set it to zero here
-                conn->config = 0;
-                close_connections(conn);
-            }
+        }
+        if (conn->delete_egress_connections) {
+            // The config has already been freed by the qd_http_connector_decref() function, set it to zero here
+            conn->config = 0;
+            // It is important that clean_session_data be called *after* the conn->config has been set to zero
+            clean_session_data(conn);
+            close_connections(conn);
+        }
+        else {
+            clean_session_data(conn);
         }
     }
     sys_mutex_unlock(qd_server_get_activation_lock(http2_adaptor->core->qd->server));


added #ifdefs around the sslcontext code which we don't care about for this release

--- pycurl/src/pycurl.c
+++ pycurl/src/pycurl.c
@@ -1061,9 +1061,11 @@
         case CURLOPT_USERPWD:
             break;
 #if (LIBCURL_VERSION_NUM >= 0x070a06)
+#if 0
         case CURLOPT_SSL_CTX_DATA:
             /* FIXME - implement this */
             /* FIXME - fall through for now */
+#endif
 #endif
         default:
             PyErr_SetString(PyExc_TypeError, "strings are not supported for this option");
@@ -1303,7 +1305,9 @@
         const curl_passwd_callback pwd_cb = password_callback;
         const curl_debug_callback d_cb = debug_callback;
 #if (LIBCURL_VERSION_NUM >= 0x070a06)
+#if 0
         const curl_ssl_ctx_callback ssl_ctx_cb = ssl_ctx_callback;
+#endif
 #endif

         switch(option) {


Fix build with Qt 5.15 (missing QPainterPath include)

--- qt5/style/qtcurve.h
+++ qt5/style/qtcurve.h
@@ -31,6 +31,8 @@
 #include <QCache>
 #include <QColor>
 #include <QFont>
+#include <QPainter>
+#include <QPainterPath>
 #include <QStyleOption>
 #include <QtGlobal>
 #include <QCommonStyle>


Fix a syntax error for platform010

Fix a syntax error for platform010

Summary:
This diff fixes a syntax error for platform010. The errors fixed look like one of the following:
```
buck-out/v2/gen/fbcode/6dbc4bb1b9a32829/manifold/client/__client_request_controller__/headers/manifold/client/ClientRequestController.h:106:11: error: '~ClientRequestController' overrides a destructor but is not marked 'override' [-Werror,-Wsuggest-destructor-override]
  virtual ~ClientRequestController();
          ^

buck-out/v2/gen/fbcode/6dbc4bb1b9a32829/manifold/util/__lrucache__/headers/manifold/util/MfLruCache.h:187:38: error: use of function '__builtin_alloca' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability [-Werror,-Walloca]
    uint32_t *indices = (uint32_t *) alloca(sizeof(uint32_t) * n);
                                     ^
```

Reviewed By: alyssaverkade

Differential Revision: D35689204

fbshipit-source-id: 3d26edf5433f9498ab35ba6f343b7bb3728d4abe

--- quic/api/Observer.h
+++ quic/api/Observer.h
@@ -88,7 +88,7 @@
   explicit Observer(const Config& observerConfig)
       : observerConfig_(observerConfig) {}

-  virtual ~Observer() = default;
+  ~Observer() override = default;

   /**
    * Returns observers configuration.


Fix range check for base quality values

Fix range check for base quality values

--- rapi_bwa/rapi_bwa.c
+++ rapi_bwa/rapi_bwa.c
@@ -1119,8 +1119,8 @@
 		read->qual = read->seq + seq_len + 1;
 		for (int i = 0; i < seq_len; ++i) {
 			read->qual[i] = (int)qual[i] - q_offset + 33; // 33 is the Sanger offset.  BWA expects it this way.
-			if (read->qual[i] > 127)
-			{ // qual is unsigned, by Sanger base qualities have an allowed range of [0,94], and 94+33=127
+			if (read->qual[i] < 33 || read->qual[i] > 126)
+			{ // Sanger base qualities have an allowed range of [0,93], and 93+33=126
 				fprintf(stderr, "Invalid base quality score %d\n", read->qual[i]);
 				error_code = RAPI_PARAM_ERROR;
 				goto error;


Correctly label plgopus as sample based

Correctly label plgopus as sample based

git-svn-id: 8a77b5e12cf30fc5f8c95b12d648985d6db39537@12620 a612230a-c5fa-0310-af8b-88eea846685b

--- sipXmediaLib/src/mp/codecs/plgopus/plgopus.c
+++ sipXmediaLib/src/mp/codecs/plgopus/plgopus.c
@@ -40,7 +40,7 @@
    "Xiph.org",                 /* codecManufacturer */
    "Opus",                     /* codecName */
    PACKAGE_VERSION,            /* codecVersion */
-   CODEC_TYPE_FRAME_BASED,     /* codecType */
+   CODEC_TYPE_SAMPLE_BASED,     /* codecType */

 /*///////////////////// SDP info /////////////////////*/
    "opus",                      /* mimeSubtype */


Add some labels

Add some labels

--- testmud/mud/home/Game/lib/object.c
+++ testmud/mud/home/Game/lib/object.c
@@ -22,9 +22,10 @@

 inherit base LIB_OBJECT;

+inherit describe "describe";
 inherit position "position";
 inherit bulk "bulk";
-inherit "timer";
+inherit timer "timer";

 int destructing;


e2k: minor: Update output in e2k/e2k_syscall_handler.c

--- src/arch/e2k/e2k_syscall_handler.c
+++ src/arch/e2k/e2k_syscall_handler.c
@@ -13,7 +13,7 @@
 unsigned long cpuSyscall(int number, uint64_t arg1, uint64_t arg2,
 			 uint64_t arg3, uint64_t arg4)
 {
-	printk("syscall handler %d (%lu, %lu, %lu, %lu)\n", number, arg1, arg2, arg3, arg4);
+	printk("syscall handler %d (%lx, %lx, %lx, %lx)\n", number, arg1, arg2, arg3, arg4);

 	return 0;
 }
@@ -22,7 +22,7 @@
 unsigned long cpuJmpSyscall(int number, uint64_t arg1, uint64_t arg2,
 			 uint64_t arg3, uint64_t arg4)
 {
-	printk("jmpsyscall handler %d (%lu, %lu, %lu, %lu)\n", number, arg1, arg2, arg3, arg4);
+	printk("jmpsyscall handler %d (%lx, %lx, %lx, %lx)\n", number, arg1, arg2, arg3, arg4);

 	return 0;
 }


Change copyright to help grd change along.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/2809036

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@50725 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/views/browser_bubble.h
+++ chrome/browser/views/browser_bubble.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.


dynarec: Implement ADD3, SUB3

dynarec: Implement ADD3, SUB3

--- src/arm/dynarec-arm/dynarec-impl.c
+++ src/arm/dynarec-arm/dynarec-impl.c
@@ -292,33 +292,27 @@
 	saveRegs(ctx);
 	saveNZCV(ctx);)

-bool _ThumbCompilerADD3(struct ARMCore* cpu, struct ARMDynarecContext* ctx, uint16_t opcode) {
-	flushPC(ctx);
-	flushPrefetch(ctx);
-	EMIT_IMM(ctx, AL, 1, opcode);
-	EMIT(ctx, PUSH, AL, REGLIST_SAVE);
-	EMIT(ctx, BL, AL, ctx->code, _thumbTable[opcode >> 6]);
-	EMIT(ctx, POP, AL, REGLIST_SAVE);
-	EMIT_IMM(ctx, AL, 1, ctx->gpr_15);
-	EMIT(ctx, LDRI, AL, 2, REG_ARMCore, offsetof(struct ARMCore, gprs) + 15 * sizeof(uint32_t));
-	EMIT(ctx, CMP, AL, 1, 2);
-	EMIT(ctx, B, NE, ctx->code, cpu->dynarec.epilogue);
-	return true;
-}
-
-bool _ThumbCompilerSUB3(struct ARMCore* cpu, struct ARMDynarecContext* ctx, uint16_t opcode) {
-	flushPC(ctx);
-	flushPrefetch(ctx);
-	EMIT_IMM(ctx, AL, 1, opcode);
-	EMIT(ctx, PUSH, AL, REGLIST_SAVE);
-	EMIT(ctx, BL, AL, ctx->code, _thumbTable[opcode >> 6]);
-	EMIT(ctx, POP, AL, REGLIST_SAVE);
-	EMIT_IMM(ctx, AL, 1, ctx->gpr_15);
-	EMIT(ctx, LDRI, AL, 2, REG_ARMCore, offsetof(struct ARMCore, gprs) + 15 * sizeof(uint32_t));
-	EMIT(ctx, CMP, AL, 1, 2);
-	EMIT(ctx, B, NE, ctx->code, cpu->dynarec.epilogue);
-	return true;
-}
+#define DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(NAME, BODY) \
+	DEFINE_INSTRUCTION_THUMB(NAME, \
+		int rm = (opcode >> 6) & 0x0007; \
+		int rd = opcode & 0x0007; \
+		int rn = (opcode >> 3) & 0x0007; \
+		BODY;)
+
+DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(ADD3,
+	unsigned reg_rd = defReg(ctx, rd);
+	unsigned reg_rn = useReg(ctx, rn);
+	unsigned reg_rm = useReg(ctx, rm);
+	EMIT(ctx, ADDS, AL, reg_rd, reg_rn, reg_rm);
+	saveRegs(ctx);
+	saveNZCV(ctx);)
+DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB3,
+	unsigned reg_rd = defReg(ctx, rd);
+	unsigned reg_rn = useReg(ctx, rn);
+	unsigned reg_rm = useReg(ctx, rm);
+	EMIT(ctx, SUBS, AL, reg_rd, reg_rn, reg_rm);
+	saveRegs(ctx);
+	saveNZCV(ctx);)

 bool _ThumbCompilerADD1(struct ARMCore* cpu, struct ARMDynarecContext* ctx, uint16_t opcode) {
 	flushPC(ctx);


Small cleanup

Small cleanup

--- y/y/serde3/archives.h
+++ y/y/serde3/archives.h
@@ -931,9 +931,7 @@
                 return core::Err(Error(ErrorType::IOError));
             }
             bool read_members = true;
-#ifdef Y_SLIM_POD_HEADER
             read_members = header.type.has_serde();
-#endif
             if(read_members) {
                 if(!_file.read_one(header.members)) {
                     return core::Err(Error(ErrorType::IOError));


Added the full lifecycle test case Added a new testcase that covers the full lifecycle of the application, including thresholdless accounts. The full lifecycle stands for init_context, creating accounts, saving context, reloading, unlocking and checking accounts again.

--- tests/check_libpph_thresholdless.c
+++ tests/check_libpph_thresholdless.c
@@ -368,6 +368,112 @@

+// We are going to test the full application lifecycle with a thresholdless
+// account, by generating a new context, creating threshold accounts, creating
+// a thresholdless account, saving the context, reloading the context, unlocking
+// the context and logging as a thresholdless account
+START_TEST(test_pph_thresholdless_full_lifecycle){
+
+
+  PPH_ERROR error;
+  pph_context *context;
+  uint8 threshold = 2;
+  uint8 partial_bytes = 0;
+  unsigned int i;
+  unsigned int username_count=5;
+  const uint8 *usernames[] = {"username1",
+                              "username12",
+                              "username1231",
+                              "username26",
+                              "username5",
+                            };
+  const uint8 *passwords[] = {"password1",
+                              "password12",
+                              "password1231",
+                              "password26",
+                              "password5"
+                              };
+
+    unsigned int username_lengths[] = { strlen("username1"),
+                                      strlen("username12"),
+                                      strlen("username1231"),
+                                      strlen("username26"),
+                                      strlen("username5"),
+                                  };
+  const uint8 *usernames_subset[] = { "username12",
+                                      "username26"};
+  unsigned int username_lengths_subset[] = { strlen("username12"),
+                                            strlen("username26"),
+                                            };
+  const uint8 *password_subset[] = { "password12",
+                                     "password26"};
+  uint8 key_backup[DIGEST_LENGTH];
+
+
+  // check for bad pointers at first
+  error = pph_unlock_password_data(NULL, username_count, usernames,
+      username_lengths, passwords);
+  ck_assert_msg(error == PPH_BAD_PTR," EXPECTED BAD_PTR");
+
+  // setup the context
+  context = pph_init_context(threshold, partial_bytes);
+  ck_assert_msg(context != NULL,
+      "this was a good initialization, go tell someone");
+
+  // backup the key...
+  memcpy(key_backup,context->AES_key,DIGEST_LENGTH);
+
+  // store the accounts
+  for(i=0;i<username_count;i++) {
+    error = pph_create_account(context, usernames[i], strlen(usernames[i]),
+        passwords[i], strlen(passwords[i]),1);
+    ck_assert(error == PPH_ERROR_OK);
+  }
+
+
+  // create a thresholdless account
+  error = pph_create_account( context, "thresholdless", strlen("thresholdless"),
+      "thresholdlesspw", strlen("thresholdlesspw"), 0);
+  ck_assert( error == PPH_ERROR_OK);
+
+  // check that we can login with the thresholdless account
+  error = pph_check_login(context, "thresholdless", strlen("thresholdless"),
+      "thresholdlesspw", strlen("thresholdlesspw"));
+  ck_assert( error == PPH_ERROR_OK);
+
+
+  // store the context
+  error = pph_store_context( context, "pph.db");
+  ck_assert( error == PPH_ERROR_OK);
+  pph_destroy_context(context);
+
+  // reload the context
+  context = pph_reload_context("pph.db");
+  ck_assert( context != NULL);
+
+  // let's check for NULL pointers on the username and password fields
+  error = pph_unlock_password_data(context, username_count, usernames,
+      username_lengths, passwords);
+  ck_assert_msg(error == PPH_ERROR_OK," EXPECTED PPH_ERROR_OK");
+
+
+  // check that we can login with an unlocked context.
+  error = pph_check_login(context, usernames_subset[0],
+    strlen(usernames_subset[0]),password_subset[0], strlen(password_subset[0]));
+  ck_assert(error == PPH_ERROR_OK);
+
+  // check that we can login with the thresholdless account
+  error = pph_check_login(context, "thresholdless", strlen("thresholdless"),
+      "thresholdlesspw", strlen("thresholdlesspw"));
+  ck_assert( error == PPH_ERROR_OK);
+
+  pph_destroy_context(context);
+
+
+}END_TEST
+
+
+

 // test suite definition
 Suite * polypasshash_thl_suite(void)
@@ -379,12 +485,13 @@

   /* no partial bytes with thresholdless accounts case */
   TCase *tc_non_partial = tcase_create ("non-partial");
-  tcase_add_test (tc_non_partial,test_pph_init_context_AES_key);
-  tcase_add_test (tc_non_partial,test_pph_destroy_context_AES_key);
-  tcase_add_test (tc_non_partial,test_pph_create_accounts);
-  tcase_add_test (tc_non_partial,test_create_account_mixed_accounts);
-  tcase_add_test (tc_non_partial,test_check_login_thresholdless);
-  tcase_add_test (tc_non_partial,test_pph_unlock_password_data);
+  tcase_add_test (tc_non_partial, test_pph_init_context_AES_key);
+  tcase_add_test (tc_non_partial, test_pph_destroy_context_AES_key);
+  tcase_add_test (tc_non_partial, test_pph_create_accounts);
+  tcase_add_test (tc_non_partial, test_create_account_mixed_accounts);
+  tcase_add_test (tc_non_partial, test_check_login_thresholdless);
+  tcase_add_test (tc_non_partial, test_pph_unlock_password_data);
+  tcase_add_test (tc_non_partial, test_pph_thresholdless_full_lifecycle);
   suite_add_tcase (s, tc_non_partial);

   return s;


tests: use LC_LIBSSH instead of LANG for env tests.

LANG is stripped and replaced on many distros and LC_* is accepted
by default on debian

--- tests/client/torture_request_env.c
+++ tests/client/torture_request_env.c
@@ -72,7 +72,7 @@
     rc = ssh_channel_open_session(c);
     assert_int_equal(rc, SSH_OK);

-    rc = ssh_channel_request_env(c, "LANG", "LIBSSH");
+    rc = ssh_channel_request_env(c, "LC_LIBSSH", "LIBSSH");
     assert_int_equal(rc, SSH_OK);

     rc = ssh_channel_request_exec(c, "bash -c export");
@@ -85,7 +85,7 @@
         assert_int_equal(rc, nbytes);
 #endif

-        if (strstr(buffer, "LANG=\"LIBSSH\"")) {
+        if (strstr(buffer, "LC_LIBSSH=\"LIBSSH\"")) {
             lang_found = 1;
             break;
         }


Forgot file with r16454

Forgot file with r16454

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@16455 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


views: Remove obsolete TODO from widget_delegate.h

R=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10642024

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@143901 0039d316-1c4b-4281-b951-d872f2087c98

--- ui/views/widget/widget_delegate.h
+++ ui/views/widget/widget_delegate.h
@@ -25,7 +25,6 @@
 class View;
 class Widget;

-// WidgetDelegate interface
 // Handles events on Widgets in context-specific ways.
 class VIEWS_EXPORT WidgetDelegate {
  public:
@@ -44,9 +43,6 @@
   // Returns the view that should have the focus when the widget is shown.  If
   // NULL no view is focused.
   virtual View* GetInitiallyFocusedView();
-
-  // Moved from WindowDelegate: ------------------------------------------------
-  // TODO(beng): sort

   virtual BubbleDelegateView* AsBubbleDelegate();
   virtual DialogDelegate* AsDialogDelegate();


Add function to get the set of keys from a Map.

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

--- compiler/include/map.h
+++ compiler/include/map.h
@@ -34,6 +34,7 @@
   inline MapElem<K,C> *put(K akey, C avalue);
   inline C get(K akey);
   inline void get_keys(Vec<K> &keys);
+  inline void get_keys_set(Vec<K> &keys);
   inline void get_values(Vec<C> &values);
 };

@@ -171,6 +172,13 @@
   for (int i = 0; i < n; i++)
     if (v[i].key)
       keys.add(v[i].key);
+}
+
+template <class K, class C> inline void
+Map<K,C>::get_keys_set(Vec<K> &keys) {
+  for (int i = 0; i < n; i++)
+    if (v[i].key)
+      keys.set_add(v[i].key);
 }

 template <class K, class C> inline void


Change to the new icon theme in the same way that the theme config
dialog does.  There has to be a better way for both.

SVN revision: 26019

--- src/bin/e_int_config_icon_themes.c
+++ src/bin/e_int_config_icon_themes.c
@@ -119,9 +119,9 @@
    e_config->icon_theme = evas_stringshare_add(cfdata->themename);
    e_config_save_queue();

-   /* FIXME: Not sure about this stuff, but we need to redo any existing icons now. */
-//   a = e_action_find("restart");
-//   if ((a) && (a->func.go)) a->func.go(NULL, NULL);
+   /* If it's good enough for themes, it's good enough for icon themes, but ICK!. */
+   a = e_action_find("restart");
+   if ((a) && (a->func.go)) a->func.go(NULL, NULL);
    return 1; /* Apply was OK */
 }


Fix typo in comment.

Fix typo in comment.

This typo was accidentally added by recent commit 4cbd128.

--- src/bin/pg_basebackup/receivelog.c
+++ src/bin/pg_basebackup/receivelog.c
@@ -410,7 +410,7 @@
  * indefinitely.
  *
  * standby_message_timeout controls how often we send a message
- * back to the master letting it know our progress, in miliseconds.
+ * back to the master letting it know our progress, in milliseconds.
  * This message will only contain the write location, and never
  * flush or replay.
  *


minor changes

minor changes

--- redis/include/zapata/redis/config.h
+++ redis/include/zapata/redis/config.h
@@ -79,7 +79,7 @@
 #define PACKAGE_NAME "zapata-redis"

 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "zapata-redis 0.9.7-1yakkety10"
+#define PACKAGE_STRING "zapata-redis 0.9.7-1yakkety11"

 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "zapata-redis"
@@ -88,10 +88,10 @@
 #define PACKAGE_URL ""

 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.9.7-1yakkety10"
+#define PACKAGE_VERSION "0.9.7-1yakkety11"

 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1

 /* Version number of package */
-#define VERSION "0.9.7-1yakkety10"
+#define VERSION "0.9.7-1yakkety11"


if you really must look inside the pool to decide if you've called pool_init already, the pr_size field is the least worst field to peek at.

--- dev/cardbus/cardslot.c
+++ dev/cardbus/cardslot.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: cardslot.c,v 1.16 2013/10/30 08:47:20 mpi Exp $	*/
+/*	$OpenBSD: cardslot.c,v 1.17 2014/12/19 05:48:36 tedu Exp $	*/
 /*	$NetBSD: cardslot.c,v 1.9 2000/03/22 09:35:06 haya Exp $	*/

 /*
@@ -103,7 +103,7 @@
 	struct cardbus_softc *csc = NULL;
 	struct pcmcia_softc *psc = NULL;

-	if (cardsloteventpool.pr_align == 0)
+	if (cardsloteventpool.pr_size == 0)
 		pool_init(&cardsloteventpool, sizeof(struct cardslot_event),
 		    0, 0, 0, "cardslot", NULL);


Clean up detail list

Clean up detail list

--- mud/home/Http/lib/detail.c
+++ mud/home/Http/lib/detail.c
@@ -51,7 +51,7 @@

 	sz = sizeof(details);

-	buffer = "
Details
\n
";
+	buffer = "
Details
\n";

 	for (i = 0; i < sz; i++) {
 		buffer += detail_box(obj, details[i]);


Free memory allocated by procstat_getfiles(), which may make difference
when procstat(1) is run with -a option.

Submitted by:	Daniel Dettlaff <dmilith gmail com>
MFC after:	1 week

--- usr.bin/procstat/procstat_files.c
+++ usr.bin/procstat/procstat_files.c
@@ -476,4 +476,5 @@

 		printf("\n");
 	}
-}
+	procstat_freefiles(procstat, head);
+}


Fixing bug in tree structured VQ code that would generate nodes with redundant input vector indices, causing rare frontend verify crashes.

--- encoder/basisu_enc.h
+++ encoder/basisu_enc.h
@@ -1634,6 +1634,14 @@

 				if ((!l_weight) || (!r_weight))
 				{
+					l_children.resize(0);
+					new_l_child.set(0.0f);
+					l_ttsum = 0.0f;
+					l_weight = 0;
+					r_children.resize(0);
+					new_r_child.set(0.0f);
+					r_ttsum = 0.0f;
+					r_weight = 0;
 					TrainingVectorType firstVec;
 					for (uint32_t i = 0; i < node.m_training_vecs.size(); i++)
 					{
@@ -1660,7 +1668,7 @@
 						}
 					}

-					if (!l_weight)
+					if ((!l_weight) || (!r_weight))
 						return false;
 				}


Create ScalarTransforms.h

Create ScalarTransforms.h

error: pathspec 'remill/BC/Compat/ScalarTransforms.h' did not match any file(s) known to git

--- remill/BC/Compat/ScalarTransforms.h
+++ remill/BC/Compat/ScalarTransforms.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2019 Trail of Bits, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "remill/BC/Version.h"
+
+#include <llvm/Transforms/Scalar.h>
+
+#if LLVM_VERSION_NUMBER >= LLVM_VERSION(7, 0)
+#include <llvm/Transforms/Utils.h>
+#endif


Add ON / OFF / PAUSE / RESUME to webinterface

--- src/WS2812FX.h
+++ src/WS2812FX.h
@@ -409,6 +409,8 @@
       service(void),
       start(void),
       stop(void),
+      pause(void),
+      resume(void),
       strip_off(void),
       fade_out(void),
       setMode(uint8_t m),


Display compound-assignment upcast in dump

--- src/cc1/ops/expr_assign_compound.c
+++ src/cc1/ops/expr_assign_compound.c
@@ -109,9 +109,16 @@
 {
 	dump_desc_expr_newline(ctx, "compound assignment", e, 0);

-	dump_printf_indent(ctx, 0, " %s%s\n",
+	dump_printf_indent(ctx, 0, " %s%s=",
 			e->assign_is_post ? "post-assignment " : "",
 			op_to_str(e->bits.compoundop.op));
+
+	if(e->bits.compoundop.upcast_ty){
+		dump_printf_indent(ctx, 0, " upcast='%s'",
+				type_to_str(e->bits.compoundop.upcast_ty));
+	}
+
+	dump_printf_indent(ctx, 0, "\n");

 	dump_inc(ctx);
 	dump_expr(e->lhs, ctx);


New syntaxes for add_attribute and get_attribute.
Added init_attribute.

Signed-off-by: Étienne Schmitt <25d5031dc1a1d443222aec9a4e916501ae23c255@inria.fr>

--- cgogn/core/cmap/map_base.h
+++ cgogn/core/cmap/map_base.h
@@ -256,6 +256,34 @@
 	}

 	/**
+	 * @brief add an attribute, given a ref on an existing attribute
+	 * @param result_attribute, a reference to an attribute that will be overwritten
+	 * @param attribute_name the name of the attribute to create
+	 */
+	template <typename T, Orbit ORBIT>
+	inline void add_attribute(Attribute<T, ORBIT>& attribute_handler, const std::string& attribute_name)
+	{
+		attribute_handler = add_attribute<T,ORBIT>(attribute_name);
+	}
+
+	/**
+	 * @brief init_attribute, init an uninitialized Attribute<T,ORBIT> object (does nothing if the attribute_handler param is already valid)
+	 */
+	template <typename T, Orbit ORBIT>
+	inline void init_attribute(Attribute<T, ORBIT>& attribute_handler, const std::string& attribute_name)
+	{
+		if (attribute_handler.is_valid())
+		{
+			cgogn_log_debug("init_attribute(Attribute<T, ORBIT>&,const std::string&)") << "The attribute \"" << attribute_handler.name() << "\" is already initialized.";
+			return;
+		}
+
+		add_attribute(attribute_handler, attribute_name);
+		if (!attribute_handler.is_valid())
+			get_attribute(attribute_handler, attribute_name);
+	}
+
+	/**
 	 * \brief remove an attribute
 	 * @param ah a handler to the attribute to remove
 	 * @return true if remove succeed else false
@@ -295,6 +323,12 @@
 		return Attribute<T, ORBIT>(this, ca);
 	}

+	template <typename T, Orbit ORBIT>
+	inline void get_attribute(Attribute<T, ORBIT>& ah, const std::string& attribute_name)
+	{
+		ah = get_attribute<T,ORBIT>(attribute_name);
+	}
+
 	template <typename T>
 	inline Attribute_T<T> get_attribute(Orbit orbit, const std::string& attribute_name)
 	{
@@ -302,6 +336,12 @@

 		ChunkArray<T>* ca = this->attributes_[orbit].template get_chunk_array<T>(attribute_name);
 		return Attribute_T<T>(this, ca, orbit);
+	}
+
+	template <typename T>
+	inline void get_attribute(Attribute_T<T>& ath, Orbit orbit, const std::string& attribute_name)
+	{
+		ath = get_attribute<T>(orbit, attribute_name);
 	}

 	/**


DO NOT CLOSE STREAM

DO NOT CLOSE STREAM

--- src/Watchdog.c
+++ src/Watchdog.c
@@ -100,7 +100,6 @@
     fputs("[WATCHDOG] INFO: Watchdog terminated\n", __stream);
     fprintf(__stream, "[WATCHDOG] %-5s %zu allocations, %zu frees\n", "", __allocations_counter, __frees_counter);
     fprintf(__stream, "[WATCHDOG] %-5s %zu bytes allocated, %zu bytes freed\n", "", bytes_allocated, bytes_freed);
-    fclose(__stream);
 }

 /*


fix types in two error printfs. one of these also had a %d bug no vararg for it, oops.

--- dev/pci/drm/i915_drv.c
+++ dev/pci/drm/i915_drv.c
@@ -1899,8 +1899,8 @@

 	if ((obj_priv->gtt_offset & ~I915_FENCE_START_MASK) ||
 	    (obj_priv->gtt_offset & (obj->size - 1))) {
-		DRM_ERROR("%s: object 0x%08x not 1M or size (0x%zx) aligned\n",
-		     __func__, obj_priv->gtt_offset, obj->size);
+		DRM_ERROR("object 0x%lx not 1M or size (0x%zx) aligned\n",
+		     obj_priv->gtt_offset, obj->size);
 		return;
 	}

@@ -1940,8 +1940,8 @@

 	if ((obj_priv->gtt_offset & ~I830_FENCE_START_MASK) ||
 	    (obj_priv->gtt_offset & (obj->size - 1))) {
-		DRM_ERROR("object 0x%08x not 512K or size aligned\n",
-		     obj_priv->gtt_offset);
+		DRM_ERROR("object 0x%08x not 512K or size aligned 0x%lx\n",
+		     obj_priv->gtt_offset, obj->size);
 		return;
 	}


thread id can be local to main()

thread id can be local to main()

--- regtest-libplayer.c
+++ regtest-libplayer.c
@@ -40,7 +40,6 @@
   PLAYER_ID_DUMMY
 } player_id_t;

-static pthread_t tid;
 static player_id_t player_id = PLAYER_ID_ALL;

 static int
@@ -150,6 +149,7 @@
 {
   void *ret;
   pthread_attr_t attr;
+  pthread_t tid;

   printf ("*** libplayer %s regression tool ***\n", LIBPLAYER_VERSION);


Having just calculated which sequence number we wish to wait for (so
that in the reading-only case we need only wait for all gpu writes to be
done and flushed), don't then wait for the full seqno anyway.

Found by Clang's static analyser where it flagged a dead store to the
seqno variable.

--- dev/pci/drm/i915_drv.c
+++ dev/pci/drm/i915_drv.c
@@ -2563,8 +2563,7 @@
 		} else {
 			seqno = obj_priv->last_write_seqno;
 		}
-		ret =  i915_wait_request(dev_priv,
-		    obj_priv->last_rendering_seqno, interruptible);
+		ret =  i915_wait_request(dev_priv, seqno, interruptible);
 	}
 	return (ret);
 }


Dead prototype

Dead prototype

--- dev/pci/drm/i915_drv.h
+++ dev/pci/drm/i915_drv.h
@@ -227,7 +227,6 @@
 extern void i915_driver_lastclose(struct drm_device * dev);
 extern void i915_driver_close(struct drm_device *dev,
 				 struct drm_file *file_priv);
-extern int i915_driver_device_is_agp(struct drm_device * dev);
 extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
 			      unsigned long arg);
 extern void i915_emit_breadcrumb(struct drm_device *dev);


fixing warnings

fixing warnings

git-svn-id: 9e9401559e51101c165cdce4d49b411eb20436ed@4302 3d70eeeb-363e-0410-a505-8a46323a89f2

--- src/air/enum.c
+++ src/air/enum.c
@@ -209,7 +209,7 @@
 }

 static void
-_enumPrintVal(FILE *file, const airEnum *enm, unsigned int ii) {
+_enumPrintVal(FILE *file, const airEnum *enm, int ii) {

   if (enm->desc) {
     fprintf(file, "desc: %s\n", enm->desc[ii]);
@@ -232,7 +232,9 @@

 void
 airEnumPrint(FILE *file, const airEnum *enm) {
-  unsigned int ii;
+  int ii; /* this should arguable be unsigned int, but
+             airEnum values were kept as "int", even after
+             the great unsigned conversion */

   if (!(file && enm)) {
     return;
@@ -247,8 +249,8 @@
   if (enm->val) {
     fprintf(file, "Values (%u valid) given explicitly\n", enm->M);
     fprintf(file, "--- (0) %d: \"%s\"\n", enm->val[0], enm->str[0]);
-    for (ii=1; ii<=enm->M; ii++) {
-      fprintf(file, "--- (%u) %d: \"%s\" == \"%s\"\n", ii,
+    for (ii=1; ii<=AIR_CAST(int, enm->M); ii++) {
+      fprintf(file, "--- (%d) %d: \"%s\" == \"%s\"\n", ii,
               enm->val[ii], enm->str[ii],
               airEnumStr(enm, enm->val[ii]));
       _enumPrintVal(file, enm, ii);
@@ -257,8 +259,8 @@
     /* enm->val NULL */
     fprintf(file, "Values implicit; [1,%u] valid\n", enm->M);
     fprintf(file, "--- 0: \"%s\"\n", enm->str[0]);
-    for (ii=1; ii<=enm->M; ii++) {
-      fprintf(file, "--- %d: %s == %s\n", AIR_CAST(int, ii), enm->str[ii],
+    for (ii=1; ii<=AIR_CAST(int, enm->M); ii++) {
+      fprintf(file, "--- %d: %s == %s\n", ii, enm->str[ii],
               airEnumStr(enm, ii));
       _enumPrintVal(file, enm, ii);
     }


avoid nan when normalizing a zero vector

--- src/annoylib.h
+++ src/annoylib.h
@@ -188,8 +188,10 @@
 template<typename T>
 inline void normalize(T* v, int f) {
   T norm = get_norm(v, f);
-  for (int z = 0; z < f; z++)
-    v[z] /= norm;
+  if (norm > 0) {
+    for (int z = 0; z < f; z++)
+      v[z] /= norm;
+  }
 }

 template<typename T, typename Random, typename Distance, typename Node>


Use rbstream for reading profile data

Use rbstream for reading profile data

Per-dive reading of the DC takes too long because of latency on read
commands. The rbstream solves this by reading ahead in large blocks.

--- src/cochran_commander.c
+++ src/cochran_commander.c
@@ -29,6 +29,7 @@
 #include "serial.h"
 #include "array.h"
 #include "ringbuffer.h"
+#include "rbstream.h"

 #define C_ARRAY_SIZE(array) (sizeof (array) / sizeof *(array))

@@ -473,31 +474,6 @@
 	return DC_STATUS_SUCCESS;
 }

-static unsigned int
-cochran_commander_read_retry (cochran_commander_device_t *device, dc_event_progress_t *progress, unsigned int address, unsigned char data[], unsigned int size)
-{
-	// Save the state of the progress events.
-	unsigned int saved = progress->current;
-
-	unsigned int nretries = 0;
-	dc_status_t rc = DC_STATUS_SUCCESS;
-	while ((rc = cochran_commander_read (device, progress, address, data, size)) != DC_STATUS_SUCCESS) {
-		// Automatically discard a corrupted packet,
-		// and request a new one.
-		if (rc != DC_STATUS_PROTOCOL && rc != DC_STATUS_TIMEOUT)
-			return rc;
-
-		// Abort if the maximum number of retries is reached.
-		if (nretries++ >= MAXRETRIES)
-			return rc;
-
-		// Restore the state of the progress events.
-		progress->current = saved;
-	}
-
-	return rc;
-}
-

 /*
  *  For corrupt dives the end-of-samples pointer is 0xFFFFFFFF
@@ -607,11 +583,8 @@
 		}

 		unsigned int profile_pre = array_uint32_le(log_entry + device->layout->pt_profile_pre);
-		unsigned int profile_begin = array_uint32_le(log_entry + device->layout->pt_profile_begin);
-		unsigned int profile_end = array_uint32_le(log_entry + device->layout->pt_profile_end);

 		unsigned int sample_size = cochran_commander_profile_size(device, data, idx, profile_pre, last_profile_pre);
-		unsigned int read_size = cochran_commander_profile_size(device, data, idx, profile_begin, profile_end);
 		last_profile_pre = profile_pre;

 		// Determine if sample exists
@@ -623,7 +596,7 @@
 				data->invalid_profile_dive_num = idx;
 			}
 			// Accumulate read size for progress bar
-			sample_read_size += read_size;
+			sample_read_size += sample_size;
 		}
 	}

@@ -860,6 +833,7 @@
 	cochran_commander_device_t *device = (cochran_commander_device_t *) abstract;
 	const cochran_device_layout_t *layout = device->layout;
 	dc_status_t status = DC_STATUS_SUCCESS;
+	dc_rbstream_t *rbstream = NULL;

 	cochran_data_t data;
 	data.logbook = NULL;
@@ -957,6 +931,14 @@
 	// Number of dives to read
 	dive_count = (layout->rb_logbook_entry_count + head_dive - tail_dive) % layout->rb_logbook_entry_count;

+	// Create the ringbuffer stream.
+	unsigned int last_start_address = array_uint32_le (data.logbook + ((head_dive - 1) * layout->rb_logbook_entry_size) + layout->pt_profile_end);
+	status = dc_rbstream_new (&rbstream, abstract, 1, 131072, layout->rb_profile_begin, layout->rb_profile_end, last_start_address);
+	if (status != DC_STATUS_SUCCESS) {
+		ERROR (abstract->context, "Failed to create the ringbuffer stream.");
+		goto error;
+	}
+
 	int invalid_profile_flag = 0;

 	// Loop through each dive
@@ -968,14 +950,17 @@
 		unsigned int sample_start_address = array_uint32_le (log_entry + layout->pt_profile_begin);
 		unsigned int sample_end_address = array_uint32_le (log_entry + layout->pt_profile_end);

-		int sample_size = 0;
+		int sample_size = 0, pre_size = 0;

 		// Determine if profile exists
 		if (idx == data.invalid_profile_dive_num)
 			invalid_profile_flag = 1;

-		if (!invalid_profile_flag)
+		if (!invalid_profile_flag) {
 			sample_size = cochran_commander_profile_size(device, &data, idx, sample_start_address, sample_end_address);
+			pre_size = cochran_commander_profile_size(device, &data, idx, sample_end_address, last_start_address);
+			last_start_address = sample_start_address;
+		}

 		// Build dive blob
 		unsigned int dive_size = layout->rb_logbook_entry_size + sample_size;
@@ -989,38 +974,30 @@

 		// Read profile data
 		if (sample_size) {
-			if (sample_end_address == 0xFFFFFFFF)
-				// Corrupt dive, guess the end address
-				sample_end_address = cochran_commander_guess_sample_end_address(device, &data, idx);
-
-			if (sample_start_address <= sample_end_address) {
-				rc = cochran_commander_read_retry (device, &progress, sample_start_address, dive + layout->rb_logbook_entry_size, sample_size);
-				if (rc != DC_STATUS_SUCCESS) {
-					ERROR (abstract->context, "Failed to read the sample data.");
-					status = rc;
-					free(dive);
+			if (pre_size) {
+				// Read throwaway sample data, pre-dive events and post-dive surface sample
+				unsigned char *pre = (unsigned char *) malloc (pre_size);
+				if (pre == NULL) {
+					status = DC_STATUS_NOMEMORY;
 					goto error;
 				}
-			} else {
-				// It wrapped the buffer, copy two sections
-				unsigned int size = layout->rb_profile_end - sample_start_address;
-
-				rc = cochran_commander_read_retry (device, &progress, sample_start_address, dive + layout->rb_logbook_entry_size, size);
+				rc = dc_rbstream_read(rbstream, &progress, pre, pre_size);
+				free(pre);
 				if (rc != DC_STATUS_SUCCESS) {
-					ERROR (abstract->context, "Failed to read the sample data.");
-					status = rc;
-					free(dive);
-					goto error;
-				}
-
-				rc = cochran_commander_read_retry (device, &progress, layout->rb_profile_begin, dive + layout->rb_logbook_entry_size + size, sample_end_address - layout->rb_profile_begin);
-				if (rc != DC_STATUS_SUCCESS) {
-					ERROR (abstract->context, "Failed to read the sample data.");
+					ERROR (abstract->context, "Failed to read the pre-dive event data.");
 					status = rc;
 					free(dive);
 					goto error;
 				}
 			}
+			// read sample data
+			rc = dc_rbstream_read(rbstream, &progress, dive + layout->rb_logbook_entry_size, sample_size);
+			if (rc != DC_STATUS_SUCCESS) {
+				ERROR (abstract->context, "Failed to read the sample data.");
+				status = rc;
+				free(dive);
+				goto error;
+			}
 		}

 		if (callback && !callback (dive, dive_size, dive + layout->pt_fingerprint, layout->fingerprint_size, userdata)) {
@@ -1032,6 +1009,7 @@
 	}

 error:
+	dc_rbstream_free(rbstream);
 	free(data.logbook);
 	return status;
 }


Since wsmux is currently designed to act as a N inputs : 1 output device, be more coherent when handling the attachment of output devices (displays): - on attach, only claim the mux output if it has none already; - on detach, only force detachment from the input devices from this display   if we are the mux output.

--- dev/wscons/wsdisplay.c
+++ dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.85 2008/01/23 16:37:55 jsing Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.86 2008/06/07 20:34:36 miod Exp $ */
 /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */

 /*
@@ -621,7 +621,16 @@
 #if NWSKBD > 0
 	if (sc->sc_input != NULL) {
 #if NWSMUX > 0
-		wsmux_detach_sc(sc->sc_input);	/* XXX not exactly correct */
+		/*
+		 * If we are the display of the mux we are attached to,
+		 * disconnect all input devices from us.
+		 */
+		if (sc->sc_input->me_dispdv == &sc->sc_dv) {
+			if ((rc = wsmux_set_display((struct wsmux_softc *)
+						    sc->sc_input, NULL)) != 0)
+				return (rc);
+		}
+
 		/*
 		 * XXX
 		 * If we created a standalone mux (dmux), we should destroy it
@@ -676,7 +685,7 @@
 	if (mux == NULL)
 		panic("wsdisplay_common_attach: no memory");
 	sc->sc_input = &mux->sc_base;
-	mux->sc_displaydv = &sc->sc_dv;
+
 	if (kbdmux >= 0)
 		printf(" mux %d", kbdmux);
 #else
@@ -718,7 +727,12 @@
 	printf("\n");

 #if NWSKBD > 0 && NWSMUX > 0
-	wsmux_set_display(mux, &sc->sc_dv);
+	/*
+	 * If this mux did not have a display device yet, volunteer for
+	 * the job.
+	 */
+	if (mux->sc_displaydv == NULL)
+		wsmux_set_display(mux, &sc->sc_dv);
 #endif

 	sc->sc_accessops = accessops;
@@ -1839,12 +1853,12 @@
 	if (!(scr->scr_flags & SCR_GRAPHICS) &&
 	    (sc->sc_scr[no]->scr_flags & SCR_GRAPHICS)) {
 		/* switching from a text console to a graphic console */
-
+
 		/* remove a potential wsmoused(8) selection */
 		mouse_remove(sc);
 		wsmoused_release(sc);
 	}
-
+
 	if ((scr->scr_flags & SCR_GRAPHICS) &&
 	    !(sc->sc_scr[no]->scr_flags & SCR_GRAPHICS)) {
 		/* switching from a graphic console to a text console */
@@ -3286,10 +3300,9 @@
 		}

 		/* inject event to notify wsmoused(8) to close mouse device */
-		if (wsms_dev != NULL)
+		if (wsms_dev != NULL)
 			wsmouse_input(wsms_dev, 0, 0, 0, 0, 0,
 				      WSMOUSE_INPUT_WSMOUSED_CLOSE);
-
 	}
 #endif /* NWSMOUSE > 0 */
 }


fix avx 512 problem

fix avx 512 problem

--- src/annoylib.h
+++ src/annoylib.h
@@ -75,9 +75,11 @@
 #endif

 #ifndef NO_MANUAL_VECTORIZATION
-#if defined(__AVX512F__)
+#if defined(__GNUC__) && (__GNUC__ >6) && defined(__AVX512F__)  // See #402
+#pragma message "Using 512-bit AVX instructions"
 #define USE_AVX512
 #elif defined(__AVX__) && defined (__SSE__) && defined(__SSE2__) && defined(__SSE3__)
+#pragma message "Using 128-bit AVX instructions"
 #define USE_AVX
 #endif
 #endif
@@ -989,6 +991,8 @@
       // Delete file if it already exists (See issue #335)
       unlink(filename);

+      printf("path: %s\n", filename);
+
       FILE *f = fopen(filename, "wb");
       if (f == NULL) {
         showUpdate("Unable to open: %s\n", strerror(errno));


Minor updates of exe_trace.c

Minor updates of exe_trace.c

--- src/collect/exe_trace.c
+++ src/collect/exe_trace.c
@@ -41,9 +41,10 @@
         __real_fclose(posix_fp);
     }

+    int pid = getpid();
+    printf("PID %d Rank %d\n", pid, my_rank);
     /* if MPI are used, rename the pid based files to rank based */
     if(my_rank != -1) {
-        int pid = getpid();
         char old_file_path[FILE_PATH_LENGTH];
         char new_file_path[FILE_PATH_LENGTH];
         /* Rename EXE traces */
@@ -65,6 +66,7 @@
 }

 void __cyg_profile_func_enter (void *func, void *caller) {
+#ifdef EXE_TRACE
     char exe_logtext[80];
     if(exe_fp != NULL) {
         struct timeval current, difftime;
@@ -73,9 +75,11 @@
         sprintf(exe_logtext, "e %p %p %6ld.%06ld\n", func, caller, (long) difftime.tv_sec, (long) difftime.tv_usec );
         __real_fwrite(exe_logtext, strlen(exe_logtext), 1, exe_fp);
     }
+#endif
 }

 void __cyg_profile_func_exit (void *func, void *caller) {
+#ifdef EXE_TRACE
     char exe_logtext[80];
     if (exe_fp != NULL) {
         struct timeval current, difftime;
@@ -85,5 +89,6 @@
         sprintf(exe_logtext, "x %p %p %6ld.%06ld\n", func, caller, (long) difftime.tv_sec, (long) difftime.tv_usec );
         __real_fwrite(exe_logtext, strlen(exe_logtext), 1, exe_fp);
     }
+#endif
 }


Fix prototype for API function TessBaseGetBlockTextOrientations

The declaration did not match the implementation (BOOL / bool).

Signed-off-by: Stefan Weil <8d4c780fcfdc41841e5070f4c43da8958ba6aec0@weilnetz.de>

--- src/api/capi.h
+++ src/api/capi.h
@@ -326,7 +326,7 @@

 TESS_API void  TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle, TessTruthCallback* cb);

-TESS_API void  TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI* handle, int** block_orientation, BOOL** vertical_writing);
+TESS_API void  TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI* handle, int** block_orientation, bool** vertical_writing);

 #endif