isl_coalesce.c: extract out update_basic_maps

This reduces the size of the isl_map_coalesce function.
This is especially interesting in the context of the next commit,
where the update_basic_maps function itself will grow in size.

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

--- isl_coalesce.c
+++ isl_coalesce.c
@@ -1728,6 +1728,31 @@
 	return NULL;
 }

+/* Update the basic maps in "map" based on the information in "tabs".
+ * Since we detected implicit equalities without calling
+ * isl_basic_map_gauss, we need to do it now.
+ */
+static __isl_give isl_map *update_basic_maps(__isl_take isl_map *map,
+	struct isl_tab **tabs)
+{
+	int i;
+
+	if (!map)
+		return NULL;
+
+	for (i = 0; i < map->n; ++i) {
+		map->p[i] = isl_basic_map_update_from_tab(map->p[i], tabs[i]);
+		map->p[i] = isl_basic_map_gauss(map->p[i], NULL);
+		map->p[i] = isl_basic_map_finalize(map->p[i]);
+		if (!map->p[i])
+			return isl_map_free(map);
+		ISL_F_SET(map->p[i], ISL_BASIC_MAP_NO_IMPLICIT);
+		ISL_F_SET(map->p[i], ISL_BASIC_MAP_NO_REDUNDANT);
+	}
+
+	return map;
+}
+
 /* For each pair of basic maps in the map, check if the union of the two
  * can be represented by a single basic map.
  * If so, replace the pair by the single basic map and start over.
@@ -1739,8 +1764,8 @@
  * in the basic maps.  We don't call isl_basic_map_gauss, though,
  * as that may affect the number of constraints.
  * This means that we have to call isl_basic_map_gauss at the end
- * of the computation to ensure that the basic maps are not left
- * in an unexpected state.
+ * of the computation (in update_basic_maps) to ensure that
+ * the basic maps are not left in an unexpected state.
  */
 struct isl_map *isl_map_coalesce(struct isl_map *map)
 {
@@ -1787,17 +1812,7 @@

 	map = coalesce(map, tabs);

-	if (map)
-		for (i = 0; i < map->n; ++i) {
-			map->p[i] = isl_basic_map_update_from_tab(map->p[i],
-								    tabs[i]);
-			map->p[i] = isl_basic_map_gauss(map->p[i], NULL);
-			map->p[i] = isl_basic_map_finalize(map->p[i]);
-			if (!map->p[i])
-				goto error;
-			ISL_F_SET(map->p[i], ISL_BASIC_MAP_NO_IMPLICIT);
-			ISL_F_SET(map->p[i], ISL_BASIC_MAP_NO_REDUNDANT);
-		}
+	map = update_basic_maps(map, tabs);

 	for (i = 0; i < n; ++i)
 		isl_tab_free(tabs[i]);


add isl_pw_*_has_tuple_id

add isl_pw_*_has_tuple_id

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

--- isl_pw_templ.c
+++ isl_pw_templ.c
@@ -176,6 +176,11 @@
 const char *FN(PW,get_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
 {
 	return pw ? isl_space_get_tuple_name(pw->dim, type) : NULL;
+}
+
+int FN(PW,has_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
+{
+	return pw ? isl_space_has_tuple_id(pw->dim, type) : -1;
 }

 __isl_give isl_id *FN(PW,get_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)


llvmpipe: added lp_build_sample_nop() for debugging

--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -2049,6 +2049,24 @@

 /**
+ * Just set texels to white instead of actually sampling the texture.
+ * For debugging.
+ */
+static void
+lp_build_sample_nop(struct lp_build_sample_context *bld,
+                    LLVMValueRef *texel)
+{
+   struct lp_build_context *texel_bld = &bld->texel_bld;
+   unsigned chan;
+
+   for (chan = 0; chan < 4; chan++) {
+      /*lp_bld_mov(texel_bld, texel, texel_bld->one);*/
+      texel[chan] = texel_bld->one;
+   }
+}
+
+
+/**
  * Build texture sampling code.
  * 'texel' will return a vector of four LLVMValueRefs corresponding to
  * R, G, B, A.
@@ -2113,13 +2131,17 @@
    height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, height);
    depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, depth);

-   if (util_format_is_rgba8_variant(bld.format_desc) &&
-       static_state->target == PIPE_TEXTURE_2D &&
-       static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR &&
-       static_state->mag_img_filter == PIPE_TEX_FILTER_LINEAR &&
-       static_state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE &&
-       is_simple_wrap_mode(static_state->wrap_s) &&
-       is_simple_wrap_mode(static_state->wrap_t)) {
+   if (0) {
+      /* For debug: no-op texture sampling */
+      lp_build_sample_nop(&bld, texel);
+   }
+   else if (util_format_is_rgba8_variant(bld.format_desc) &&
+            static_state->target == PIPE_TEXTURE_2D &&
+            static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR &&
+            static_state->mag_img_filter == PIPE_TEX_FILTER_LINEAR &&
+            static_state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE &&
+            is_simple_wrap_mode(static_state->wrap_s) &&
+            is_simple_wrap_mode(static_state->wrap_t)) {
       /* special case */
       lp_build_sample_2d_linear_aos(&bld, s, t, width_vec, height_vec,
                                     row_stride_array, data_array, texel);


freedreno: limit string marker to max packet size

Experimentally derived max size.

Signed-off-by: Rob Clark <6f78cdb10adbe0a7fbbf4098125a51f401c77a5f@freedesktop.org>

--- src/gallium/drivers/freedreno/freedreno_context.c
+++ src/gallium/drivers/freedreno/freedreno_context.c
@@ -152,6 +152,9 @@
 	struct fd_ringbuffer *ring = ctx->ring;
 	const uint32_t *buf = (const void *)string;

+	/* max packet size is 0x3fff dwords: */
+	len = MIN2(len, 0x3fff * 4);
+
 	OUT_PKT3(ring, CP_NOP, align(len, 4) / 4);
 	while (len >= 4) {
 		OUT_RING(ring, *buf);


Still more work to be done...

Still more work to be done...

--- src/sasa_lr.c
+++ src/sasa_lr.c
@@ -38,12 +38,6 @@
 #define PI 3.14159265358979323846
 #endif

-#ifdef __GNUC__
-#define __attrib_pure__ __attribute__((pure))
-#else
-#define __attrib_pure__
-#endif
-
 extern const char *freesasa_name;
 extern int freesasa_fail(const char *format, ...);
 extern int freesasa_warn(const char *format, ...);
@@ -51,13 +45,13 @@
 //calculation parameters (results stored in *sasa)
 typedef struct {
     int n_atoms;
-    const double *radii;
+    double *radii; //including probe
     const freesasa_coord_t *xyz;
-    const int **nb; // neighbors
-    const int *nn; // number of neighbors
-    const double **nb_xyd; // neighbours, xy-distance
-    const double **nb_xd; // neighbours, x-distance
-    const double **nb_yd; // neighbours, y-distance
+    int **nb; // neighbors
+    int *nn; // number of neighbors
+    double **nb_xyd; // neighbours, xy-distance
+    double **nb_xd; // neighbours, x-distance
+    double **nb_yd; // neighbours, y-distance
     double delta; // slice width
     double min_z; // bounds of the molecule
     double max_z;
@@ -67,11 +61,11 @@
 typedef struct {
     int n_slice; //number of atoms in slice
     double z; //the mid-point of the slice
-    char * restrict in_slice;
-    int * restrict idx; //index in slice to global numbering
-    int * restrict xdi; //global numbering to index in slice
-    double * restrict DR; //corrective multiplicative factor (D in L&R paper)
-    double * restrict r; //radius in slice;
+    char *in_slice;
+    int *idx; //index in slice to global numbering
+    int *xdi; //global numbering to index in slice
+    double *DR; //corrective multiplicative factor (D in L&R paper)
+    double *r; //radius in slice;
 } sasa_lr_slice_t;

 #if HAVE_LIBPTHREAD
@@ -79,11 +73,12 @@
 static void *sasa_lr_thread(void *arg);
 #endif

+/** Init slice and sum up arc-length */
 static void sasa_add_slice_area(double z, sasa_lr_t*);

-// the z argument is only really necessary for the debugging section
+/** Find which arcs are exposed in a slice */
 static void sasa_exposed_arcs(sasa_lr_slice_t *,
-			      double * restrict exposed_arc,
+			      double *exposed_arc,
 			      const sasa_lr_t *);

 /** a and b are a set of alpha and betas (in the notation of the
@@ -91,45 +86,26 @@
     circle, and returns 2*PI minus the length of the joined
     interval(s) (i.e. the exposed arc length). Does not necessarily
     leave a and b in a consistent state. */
-static double sasa_sum_angles(int n_buried, double *a, double *b);
-
-/** Calculate contacts, given coordinates and radii. The array nb will
-    have a list of neighbors to each atom, nn will say how many
-    neighbors each atom has, and nb_xyd the distance between
-    neighbours in the xy-plane. The arrays nn, nb and nb_xyd should be
-    of size n_atoms. The elements of nb and nb_xyd are dynamically
-    allocated to be of size nn[i]. **/
-static void sasa_get_contacts(int **nb, int *nn, double **nb_xyd,
-			      double **nb_xd, double **nb_yd,
-                              const freesasa_coord_t *xyz, const double *radii);
-
-
-int freesasa_lee_richards(double *sasa,
-			 const freesasa_coord_t *xyz,
-			 const double *atom_radii,
-			 double probe_radius,
-			 double delta,
-			 int n_threads)
-{
-    /* Steps:
-       Define slice range
-       For each slice:
-       1. Identify member atoms
-       2. Calculate their radii in slice
-       3. Calculate exposed arc-lengths for each atom
-       Sum up arc-length*delta for each atom
-    */
-    size_t n_atoms = freesasa_coord_n(xyz);
-    int return_value = FREESASA_SUCCESS;
-    if (n_atoms == 0) {
-	return freesasa_warn("Attempting Lee & Richards calculation "
-			    "on empty coordinates");
-    }
-    // determine slice range and init radii and sasa arrays
+static double sasa_sum_angles(int n_buried, double * restrict a,
+			      double * restrict b);
+
+/** Calculate adjacency lists, given coordinates and radii. Also
+    stores some distances to be used later. */
+static void sasa_get_contacts(sasa_lr_t *lr);
+
+/** Initialize object to be used for L&R calculation */
+static sasa_lr_t* freesasa_init_lr(double *sasa,
+				   const freesasa_coord_t *xyz,
+				   const double *atom_radii,
+				   double probe_radius,
+				   double delta) {
+    sasa_lr_t* lr = (sasa_lr_t*) malloc(sizeof(sasa_lr_t));
+    int n_atoms = freesasa_coord_n(xyz);
     double max_z=-1e50, min_z=1e50;
     double max_r = 0;
-    double radii[n_atoms];
+    double *radii = (double*) malloc(sizeof(double)*n_atoms);
     const double *v = freesasa_coord_all(xyz);
+    //find bounds of protein along z-axis and init radii
     for (size_t i = 0; i < n_atoms; ++i) {
         radii[i] = atom_radii[i] + probe_radius;
         double z = v[3*i+2], r = radii[i];
@@ -141,23 +117,61 @@
     min_z -= max_r;
     max_z += max_r;
     min_z += 0.5*delta;
-
+
+    //copy parameters
+    lr->n_atoms = n_atoms; lr->radii = radii; lr->xyz = xyz;
+    lr->delta = delta;
+    lr->min_z = min_z; lr->max_z = max_z;
+    lr->sasa = sasa;
+
+    //these will be malloc'd by get_contacts
+    lr->nn = NULL;
+    lr->nb = NULL;
+    lr->nb_xyd = lr->nb_xd = lr->nb_yd = NULL;
+
+    return lr;
+}
+
+static void freesasa_free_lr(sasa_lr_t *lr)
+{
+    for (int i = 0; i < lr->n_atoms; ++i) {
+	free(lr->nb[i]);
+	free(lr->nb_xyd[i]);
+	free(lr->nb_xd[i]);
+	free(lr->nb_yd[i]);
+    }
+    free(lr->radii);
+    free(lr->nn);
+    free(lr->nb);
+    free(lr->nb_xyd);
+    free(lr->nb_xd);
+    free(lr->nb_yd);
+    free(lr);
+}
+
+int freesasa_lee_richards(double *sasa,
+			  const freesasa_coord_t *xyz,
+			  const double *atom_radii,
+			  double probe_radius,
+			  double delta,
+			  int n_threads)
+{
+    int return_value = FREESASA_SUCCESS;
+    if (freesasa_coord_n(xyz) == 0) {
+	return freesasa_warn("Attempting Lee & Richards calculation "
+			     "on empty coordinates");
+    }
+
+    // determine slice range and init radii and sasa arrays
+    sasa_lr_t *lr = freesasa_init_lr(sasa, xyz, atom_radii,
+				     probe_radius, delta);
+
     // determine which atoms are neighbours
-    int *nb[n_atoms], nn[n_atoms];
-    double *nb_xyd[n_atoms], *nb_xd[n_atoms], *nb_yd[n_atoms];
-    sasa_get_contacts((int**)nb, (int*)nn, (double**)nb_xyd,
-		      (double**)nb_xd, (double**)nb_yd, xyz, radii);
-    sasa_lr_t lr = {.n_atoms = n_atoms, .radii = radii, .xyz = xyz,
-                    .nb = (const int**)nb, .nn = nn,
-		    .nb_xyd = (const double**)nb_xyd,
-		    .nb_xd = (const double**)nb_xd,
-		    .nb_yd = (const double**)nb_yd,
-		    .delta = delta,
-                    .min_z = min_z, .max_z = max_z, .sasa = sasa};
-
+    sasa_get_contacts(lr);
+
     if (n_threads > 1) {
 #if HAVE_LIBPTHREAD
-        sasa_lr_do_threads(n_threads, &lr);
+        sasa_lr_do_threads(n_threads, lr);
 #else
         return_value = freesasa_warn("program compiled for single-threaded use, "
                                     "but multiple threads were requested. Will "
@@ -167,16 +181,12 @@
     }
     if (n_threads == 1) {
         // loop over slices
-        for (double z = min_z; z < max_z; z += delta) {
-            sasa_add_slice_area(z,&lr);
+        for (double z = lr->min_z; z < lr->max_z; z += lr->delta) {
+            sasa_add_slice_area(z,lr);
         }
     }
-    for (int i = 0; i < n_atoms; ++i) {
-	free(nb[i]);
-	free(nb_xyd[i]);
-	free(nb_xd[i]);
-	free(nb_yd[i]);
-    }
+    freesasa_free_lr(lr);
+
     return return_value;
 }

@@ -286,7 +296,7 @@
 static void sasa_add_slice_area(double z, sasa_lr_t *lr)
 {
     sasa_lr_slice_t *slice = sasa_init_slice(z,lr);
-    double * restrict exposed_arc = (double* )malloc(slice->n_slice*(sizeof(double)));
+    double *exposed_arc = (double* )malloc(slice->n_slice*(sizeof(double)));

     //find exposed arcs
     sasa_exposed_arcs(slice, exposed_arc, lr);
@@ -300,14 +310,15 @@
 }

 static void sasa_exposed_arcs(sasa_lr_slice_t *slice,
-			      double * restrict exposed_arc,
+			      double *exposed_arc,
 			      const sasa_lr_t *lr)
 {
     const int n_slice = slice->n_slice;
-    const int * restrict nn = lr->nn;
-    const int ** restrict nb = lr->nb;
-    const double ** restrict nb_xyd = lr->nb_xyd;
-    const double * restrict r = slice->r;
+    const int *nn = lr->nn;
+    int **nb = lr->nb;
+    double **nb_xyd = lr->nb_xyd;
+    const double *r = slice->r;
+    const double *v = freesasa_coord_all(lr->xyz);

     char is_completely_buried[n_slice]; // keep track of completely buried circles
     for (int i = 0; i < n_slice; ++i) is_completely_buried[i] = 0;
@@ -322,16 +333,16 @@
         int I = slice->idx[i];
         double ri = slice->r[i], a[n_slice], b[n_slice];
         int n_buried = 0;
+	double xi = v[3*I], yi = v[3*I+1];
 	exposed_arc[i] = 0;
         // loop over neighbors
         for (int ni = 0; ni < nn[I]; ++ni) {
             int J = nb[I][ni];
 	    if (slice->in_slice[J] == 0) continue;
-            assert (I != J);
 	    int j = slice->xdi[J];
-            double rj = r[j]; //, xij = v[3*J]-xi, yij = v[3*J+1]-yi;
+            double rj = r[j];//, xij = v[3*J]-xi, yij = v[3*J+1]-yi;
             double d = nb_xyd[I][ni]; //sqrt(xij*xij+yij*yij);
-            // reasons to skip calculation
+	    // reasons to skip calculation
             if (d >= ri + rj) continue;     // atoms aren't in contact
             if (d + ri < rj) { // circle i is completely inside j
                 is_completely_buried[i] = 1;
@@ -341,13 +352,11 @@
                 is_completely_buried[j] = 1;
                 continue;
             }
-
             // half the arclength occluded from circle i due to verlap with circle j
             double alpha = acos ((ri*ri + d*d - rj*rj)/(2.0*ri*d));
             // the polar coordinates angle of the vector connecting i and j
             double beta = atan2 (lr->nb_yd[I][ni],lr->nb_xd[I][ni]);
-
-            a[n_buried] = alpha;
+	    a[n_buried] = alpha;
             b[n_buried] = beta;

             ++n_buried;
@@ -379,7 +388,7 @@
     }
 }

-static double sasa_sum_angles(int n_buried, double *a, double *b)
+static double sasa_sum_angles(int n_buried, double *restrict a, double *restrict b)
 {
     /* Innermost function in L&R, could potentially be sped up, but
        probably requires rethinking, algorithmically. Perhaps
@@ -446,23 +455,26 @@
     }
     return 2*PI - buried_angle;
 }
-
-static void sasa_get_contacts(int **nb, int *nn, double **nb_xyd,
-			      double **nb_xd, double **nb_yd,
-                              const freesasa_coord_t *xyz, const double *radii)
+static void sasa_get_contacts(sasa_lr_t *lr)
 {
     /* For low resolution L&R this function is the bottleneck in
        speed. Will also depend on number of atoms. */
-    size_t n_atoms = freesasa_coord_n(xyz);
+    size_t n_atoms = lr->n_atoms;
+    const double *v = freesasa_coord_all(lr->xyz);
+    const double *radii = lr->radii;
+
+    // init adjacency lists
+    int *nn = (int*)malloc(sizeof(int)*n_atoms);
+    int **nb = (int**)malloc(sizeof(int*)*n_atoms);
+    double **nb_xyd = (double**) malloc(sizeof(double*)*n_atoms);
+    double **nb_xd = (double**) malloc(sizeof(double*)*n_atoms);
+    double **nb_yd = (double**) malloc(sizeof(double*)*n_atoms);
     for (int i = 0; i < n_atoms; ++i) {
-        nn[i] = 0;
-        nb[i] = NULL;
-	nb_xyd[i] = NULL;
-	nb_xd[i] = NULL;
-	nb_yd[i] = NULL;
-    }
-    const double *restrict v = freesasa_coord_all(xyz);
-
+        nn[i] = 0; nb[i] = NULL;
+	nb_xyd[i] = NULL; nb_xd[i] = NULL; nb_yd[i] = NULL;
+    }
+
+    //calculate lists
     for (int i = 0; i < n_atoms; ++i) {
         double ri = radii[i];
         double xi = v[i*3], yi = v[i*3+1], zi = v[i*3+2];
@@ -474,7 +486,7 @@
                at least one axis, the following improves speed
                significantly for large proteins */
             double xj = v[j*3], yj = v[j*3+1], zj = v[j*3+2];
-            if ((xj-xi)*(xj-xi) > cut2 ||
+            if ((xj-xi)*(xj-xi) > cut2 ||
                 (yj-yi)*(yj-yi) > cut2 ||
                 (zj-zi)*(zj-zi) > cut2) {
                 continue;
@@ -497,7 +509,7 @@
 		nb_yd[j] = (double*) realloc(nb_yd[j],sizeof(double)*nn[j]);

 		double d = sqrt(dx*dx+dy*dy);
-		nb_xyd[i][nn[i]-1] = d;
+		nb_xyd[i][nn[i]-1] = d;
 		nb_xyd[j][nn[j]-1] = d;

 		nb_xd[i][nn[i]-1] = dx;
@@ -507,5 +519,12 @@
             }
         }
     }
-}
-
+
+    //copy results
+    lr->nn = nn;
+    lr->nb = nb;
+    lr->nb_xyd = nb_xyd;
+    lr->nb_xd = nb_xd;
+    lr->nb_yd = nb_yd;
+}
+


miner-rss: Fix memoryleaks connection and signal-id

--- src/miners/rss/tracker-miner-rss.c
+++ src/miners/rss/tracker-miner-rss.c
@@ -72,6 +72,9 @@
 	g_free (priv->last_status);
 	g_object_unref (priv->pool);

+	g_dbus_connection_signal_unsubscribe (priv->connection, priv->graph_updated_id);
+	g_object_unref (priv->connection);
+
 	G_OBJECT_CLASS (tracker_miner_rss_parent_class)->finalize (object);
 }


renamed search_frame as search_frame_by_timecode, added one parameter to search for the right index with either a timecode, a pts or a dts

--- search_idx.c
+++ search_idx.c
@@ -28,7 +28,7 @@
     return read_idx->timecode.hours * 1000000 + read_idx->timecode.minutes * 10000 + read_idx->timecode.seconds * 100 + read_idx->timecode.frames;
 }

-int search_frame(SearchContext *search, Index *read_idx)
+int search_frame_by_timecode(SearchContext *search, Index *read_idx)
 {
     int low = 0;
     int mid = search->size / 2;
@@ -140,34 +140,46 @@
     Index read_idx;
     Index *key_frame = NULL;

-    if (argc < 3) {
-        printf("usage: search_idx <index file> <hhmmssff>\n");
+    if (argc < 4) {
+        printf("usage: search_idx <parameter type> <index file> <hhmmssff>\n");
+        printf("parameters types are :\n\t-t\ttimecode\n\t-p\tpts\n\t-d\tdts\n");
         return 1;
     }

     register_protocol(&file_protocol);

-    if (url_fopen(search.pb, argv[1], URL_RDONLY) < 0) {
+    if (url_fopen(search.pb, argv[2], URL_RDONLY) < 0) {
         printf("error opening file %s\n", argv[1]);
         return 1;
     }
     search.size = url_fsize(search.pb) - HEADER_SIZE;
-    if (argv[2][8] != '\0'){
-        printf("invalid time value\n\ttime must be input as follow : hhmmssff\n");
-        return 0;
-    }
-    search.search_time = atoi(argv[2]);
+
+    search.search_time = atoi(argv[3]);

     printf("Index size : %lld\n", search.size);
     int64_t magic = get_le64(search.pb);
     if (magic != 0x534A2D494E444558LL){
-        printf("%s is not an index file.\n", argv[1]);
+        printf("%s is not an index file.\n", argv[2]);
         return 1;
     }
 //    printf("Version : %d\n", get_byte(search.pb));
-    printf("Looking for frame with timecode : %c%c:%c%c:%c%c:%c%c\n",argv[2][0], argv[2][1], argv[2][2], argv[2][3], argv[2][4], argv[2][5], argv[2][6], argv[2][7]);
-
-    int res = search_frame(&search, &read_idx);
+    printf("Looking for frame with timecode : %c%c:%c%c:%c%c:%c%c\n",argv[3][0], argv[3][1], argv[3][2], argv[3][3], argv[3][4], argv[3][5], argv[3][6], argv[3][7]);
+    int res = 0;
+    switch(argv[1][1]){
+        case 't':
+            if (argv[3][8] != '\0'){
+                printf("invalid time value\n\ttime_code must be input as follow : hhmmssff\n");
+                return 0;
+            }
+            res = search_frame_by_timecode(&search, &read_idx);
+            break;
+        case 'p':
+            res = search_frame_by_pts(&search, &read_idx);
+            break;
+        case 'd':
+            res = search_frame_by_dts(&search, &read_idx);
+            break;
+    }
     if (!res){
         printf("Frame could not be found, check input data\n");
         return 1;


boards/common/stm32: add common configuration for internal USB HS PHY

error: pathspec 'boards/common/stm32/include/cfg_usb_otg_hs_phy_utmi.h' did not match any file(s) known to git

--- boards/common/stm32/include/cfg_usb_otg_hs_phy_utmi.h
+++ boards/common/stm32/include/cfg_usb_otg_hs_phy_utmi.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2019 Koen Zandberg
+ *               2022 Gunar Schorcht
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_stm32
+ * @{
+ *
+ * @file
+ * @brief       Common configuration for STM32 OTG HS peripheral with internal UTMI HS PHY
+ *
+ * All STM32 boards which use the internal UTMI HS PHY for the USB OTG HS
+ * peripheral use the same configuration. Therefore a common configuration file
+ * can be used for these boards.
+ *
+ * @author      Koen Zandberg <koen@bergzand.net>
+ * @author      Gunar Schorcht <gunar@schorcht.net>
+ */
+
+#ifndef CFG_USB_OTG_HS_PHY_UTMI_H
+#define CFG_USB_OTG_HS_PHY_UTMI_H
+
+#include "periph_cpu.h"
+#include "usbdev_synopsys_dwc2.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enable the high speed USB OTG peripheral
+ */
+#define DWC2_USB_OTG_HS_ENABLED
+
+#ifndef USBPHYC_TUNE_VALUE
+/**
+ * @brief Default value of USBPHYC tuning control register
+ *
+ * The value of the USBPHYC tuning control register (USBPHYC_TUNE) is used by
+ * the USB HS PHY controller for the tuning interface of the internal
+ * USB HS PHY, please refer the Reference Manual for STM32F72xxx and STM32F73xxx
+ * for details.
+ *
+ * The value as defined in the [STM32CubeF7 HAL Driver MCU Component for F7]
+ * (https://bit.ly/3es9eFA) is used as default value.
+ * If necessary, it can be overridden by the board configuration in
+ * `periph_conf.h` by defining the value before this file is included.
+ */
+#define USBPHYC_TUNE_VALUE  0x00000f13U
+#endif
+
+/**
+ * @brief Common USB OTG HS configuration
+ */
+static const dwc2_usb_otg_fshs_config_t dwc2_usb_otg_fshs_config[] = {
+    {
+        .periph   = USB_OTG_HS_PERIPH_BASE,
+        .type     = DWC2_USB_OTG_HS,
+        .phy      = DWC2_USB_OTG_PHY_UTMI,
+        .rcc_mask = RCC_AHB1ENR_OTGHSEN,
+        .irqn     = OTG_HS_IRQn,
+        .ahb      = AHB1,
+        .dm       = GPIO_PIN(PORT_B, 14),
+        .dp       = GPIO_PIN(PORT_B, 15),
+        .af       = GPIO_AF10,
+        .phy_tune = USBPHYC_TUNE_VALUE,
+    }
+};
+
+/**
+ * @brief Number of available USB OTG peripherals
+ */
+#define USBDEV_NUMOF           ARRAY_SIZE(dwc2_usb_otg_fshs_config)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CFG_USB_OTG_HS_PHY_UTMI_H */
+/** @} */


create a dedicated function to remove current video info

--- src/modules/activity/video/video.c
+++ src/modules/activity/video/video.c
@@ -570,6 +570,20 @@
 }

 static void
+video_infos_del (void)
+{
+    edje_object_part_text_set (mod->o_edje, "title.label", "");
+    edje_object_part_text_set (mod->o_edje, "genre.label", "");
+    edje_object_part_text_set (mod->o_edje, "length.label", "");
+    edje_object_part_text_set (mod->o_edje, "synopsis.label", "");
+    panel_infos_display (0);
+    popup_resume_display (0);
+    enna_video_picture_set (mod->o_backdrop, NULL, 0);
+    enna_video_picture_set (mod->o_snapshot, NULL, 0);
+    enna_video_flags_update (mod->o_video_flags, NULL);
+}
+
+static void
 browser_cb_delay_hilight (void *data, Evas_Object *obj, void *event_info)
 {
     Browser_Selected_File_Data *ev = event_info;
@@ -670,15 +684,7 @@
     enna_list_select_nth(o, 0);
     mod->o_list = o;
     edje_object_part_swallow(mod->o_edje, "browser.swallow", o);
-    edje_object_part_text_set (mod->o_edje, "title.label", "");
-    edje_object_part_text_set (mod->o_edje, "genre.label", "");
-    edje_object_part_text_set (mod->o_edje, "length.label", "");
-    edje_object_part_text_set (mod->o_edje, "synopsis.label", "");
-    panel_infos_display (0);
-    popup_resume_display (0);
-    enna_video_picture_set (mod->o_backdrop, NULL, 0);
-    enna_video_picture_set (mod->o_snapshot, NULL, 0);
-    enna_video_flags_update (mod->o_video_flags, NULL);
+    video_infos_del ();
 }

 static void


[media] drxd: use kzalloc in drxd_attach()

This saves a little .text and removes the sizeof(...) style
inconsistency. Use sizeof(*state) in accordance with CodingStyle.

Signed-off-by: Rasmus Villemoes <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@osg.samsung.com>

--- drivers/media/dvb-frontends/drxd_hard.c
+++ drivers/media/dvb-frontends/drxd_hard.c
@@ -2950,10 +2950,9 @@
 {
 	struct drxd_state *state = NULL;

-	state = kmalloc(sizeof(struct drxd_state), GFP_KERNEL);
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
 	if (!state)
 		return NULL;
-	memset(state, 0, sizeof(*state));

 	state->ops = drxd_ops;
 	state->dev = dev;


fix field rendering

fix field rendering

git-svn-id: 5ee9a2a761147e4d9fa32565ef7949b666b061d3@207 d19143bc-622f-0410-bfdd-b5b2a6649095

--- src/modules/core/transition_luma.c
+++ src/modules/core/transition_luma.c
@@ -92,7 +92,7 @@

 // image processing functions

-static inline uint32_t smoothstep( int32_t edge1, int32_t edge2, uint32_t a )
+static inline int32_t smoothstep( int32_t edge1, int32_t edge2, int32_t a )
 {
 	if ( a < edge1 )
 		return 0;
@@ -152,10 +152,9 @@

 	int32_t i_softness = softness * ( 1 << 16 );

-	int field_count = field_order <= 0 ? 1 : 2;
+	int field_count = field_order < 0 ? 1 : 2;
 	int field_stride_src = field_count * stride_src;
 	int field_stride_dest = field_count * stride_dest;
-
 	int field = 0;

 	// composite using luma map
@@ -163,7 +162,7 @@
 	{
 		p_row = p_src + field * stride_src;
 		q_row = p_dest + field * stride_dest;
-		y_offset = ( field * luma_width ) << 16;
+		y_offset = field << 16;
 		i = field;

 		while ( i < height_src )


rename this to self

rename this to self

--- src/modules/gtk2/producer_pixbuf.c
+++ src/modules/gtk2/producer_pixbuf.c
@@ -61,20 +61,20 @@
 	pthread_mutex_t mutex;
 };

-static void load_filenames( producer_pixbuf this, mlt_properties producer_properties );
-static void refresh_image( producer_pixbuf this, mlt_frame frame, int width, int height );
+static void load_filenames( producer_pixbuf self, mlt_properties producer_properties );
+static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int height );
 static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index );
 static void producer_close( mlt_producer parent );

 mlt_producer producer_pixbuf_init( char *filename )
 {
-	producer_pixbuf this = calloc( sizeof( struct producer_pixbuf_s ), 1 );
-	if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
-	{
-		mlt_producer producer = &this->parent;
+	producer_pixbuf self = calloc( sizeof( struct producer_pixbuf_s ), 1 );
+	if ( self != NULL && mlt_producer_init( &self->parent, self ) == 0 )
+	{
+		mlt_producer producer = &self->parent;

 		// Get the properties interface
-		mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent );
+		mlt_properties properties = MLT_PRODUCER_PROPERTIES( &self->parent );

 		// Callback registration
 		producer->get_frame = producer_get_frame;
@@ -88,36 +88,36 @@

 		// Validate the resource
 		if ( filename )
-			load_filenames( this, properties );
-		if ( this->count )
+			load_filenames( self, properties );
+		if ( self->count )
 		{
 			mlt_frame frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
 			if ( frame )
 			{
 				mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
-				pthread_mutex_init( &this->mutex, NULL );
-				mlt_properties_set_data( frame_properties, "producer_pixbuf", this, 0, NULL, NULL );
+				pthread_mutex_init( &self->mutex, NULL );
+				mlt_properties_set_data( frame_properties, "producer_pixbuf", self, 0, NULL, NULL );
 				mlt_frame_set_position( frame, mlt_producer_position( producer ) );
 				mlt_properties_set_position( frame_properties, "pixbuf_position", mlt_producer_position( producer ) );
-				refresh_image( this, frame, 0, 0 );
+				refresh_image( self, frame, 0, 0 );
 				mlt_frame_close( frame );
 			}
 		}
-		if ( this->width == 0 )
+		if ( self->width == 0 )
 		{
 			producer_close( producer );
 			producer = NULL;
 		}
 		return producer;
 	}
-	free( this );
+	free( self );
 	return NULL;
 }

-static void load_filenames( producer_pixbuf this, mlt_properties producer_properties )
+static void load_filenames( producer_pixbuf self, mlt_properties producer_properties )
 {
 	char *filename = mlt_properties_get( producer_properties, "resource" );
-	this->filenames = mlt_properties_new( );
+	self->filenames = mlt_properties_new( );

 	// Read xml string
 	if ( strstr( filename, "<svg" ) )
@@ -141,7 +141,7 @@
 				remaining_bytes -= write( fd, xml + strlen( xml ) - remaining_bytes, remaining_bytes );
 			close( fd );

-			mlt_properties_set( this->filenames, "0", fullname );
+			mlt_properties_set( self->filenames, "0", fullname );

 			// Teehe - when the producer closes, delete the temp file and the space allo
 			mlt_properties_set_data( producer_properties, "__temporary_file__", fullname, 0, ( mlt_destructor )unlink, NULL );
@@ -164,7 +164,7 @@
 			if ( stat( full, &buf ) == 0 )
 			{
 				sprintf( key, "%d", keyvalue ++ );
-				mlt_properties_set( this->filenames, key, full );
+				mlt_properties_set( self->filenames, key, full );
 				gap = 0;
 			}
 			else
@@ -172,7 +172,7 @@
 				gap ++;
 			}
 		}
-		if ( mlt_properties_count( this->filenames ) > 0 )
+		if ( mlt_properties_count( self->filenames ) > 0 )
 			mlt_properties_set_int( producer_properties, "ttl", 1 );
 	}
 	else if ( strstr( filename, "/.all." ) != NULL )
@@ -184,25 +184,25 @@
 		*( strstr( dir_name, "/.all." ) + 1 ) = '\0';
 		sprintf( wildcard, "*%s", extension );

-		mlt_properties_dir_list( this->filenames, dir_name, wildcard, 1 );
+		mlt_properties_dir_list( self->filenames, dir_name, wildcard, 1 );

 		free( dir_name );
 	}
 	else
 	{
-		mlt_properties_set( this->filenames, "0", filename );
-	}
-
-	this->count = mlt_properties_count( this->filenames );
+		mlt_properties_set( self->filenames, "0", filename );
+	}
+
+	self->count = mlt_properties_count( self->filenames );
 }

-static void refresh_image( producer_pixbuf this, mlt_frame frame, int width, int height )
+static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int height )
 {
 	// Obtain properties of frame
 	mlt_properties properties = MLT_FRAME_PROPERTIES( frame );

 	// Obtain the producer
-	mlt_producer producer = &this->parent;
+	mlt_producer producer = &self->parent;

 	// Obtain properties of producer
 	mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
@@ -213,20 +213,20 @@
 	int update_cache = 0;

 	// restore GdkPixbuf
-	pthread_mutex_lock( &this->mutex );
+	pthread_mutex_lock( &self->mutex );
 	mlt_cache_item pixbuf_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.pixbuf" );
 	GdkPixbuf *pixbuf = mlt_cache_item_data( pixbuf_cache, NULL );
 	GError *error = NULL;

 	// restore scaled image
-	this->image_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.image" );
-	this->image = mlt_cache_item_data( this->image_cache, NULL );
+	self->image_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.image" );
+	self->image = mlt_cache_item_data( self->image_cache, NULL );

 	// Check if user wants us to reload the image
 	if ( mlt_properties_get_int( producer_props, "force_reload" ) )
 	{
 		pixbuf = NULL;
-		this->image = NULL;
+		self->image = NULL;
 		mlt_properties_set_int( producer_props, "force_reload", 0 );
 	}

@@ -238,7 +238,7 @@
 	position += mlt_producer_get_in( producer );

 	// Image index
-	int image_idx = ( int )floor( ( double )position / ttl ) % this->count;
+	int image_idx = ( int )floor( ( double )position / ttl ) % self->count;

 	// Key for the cache
 	char image_key[ 10 ];
@@ -259,39 +259,39 @@

 		if ( cached )
 		{
-			this->image_idx = image_idx;
+			self->image_idx = image_idx;
 			mlt_properties cached_props = MLT_FRAME_PROPERTIES( cached );
-			this->width = mlt_properties_get_int( cached_props, "width" );
-			this->height = mlt_properties_get_int( cached_props, "height" );
+			self->width = mlt_properties_get_int( cached_props, "width" );
+			self->height = mlt_properties_get_int( cached_props, "height" );
 			mlt_properties_set_int( producer_props, "_real_width", mlt_properties_get_int( cached_props, "real_width" ) );
 			mlt_properties_set_int( producer_props, "_real_height", mlt_properties_get_int( cached_props, "real_height" ) );
-			this->image = mlt_properties_get_data( cached_props, "image", NULL );
-			this->alpha = mlt_properties_get_int( cached_props, "alpha" );
-
-			if ( width != 0 && ( width != this->width || height != this->height ) )
-				this->image = NULL;
+			self->image = mlt_properties_get_data( cached_props, "image", NULL );
+			self->alpha = mlt_properties_get_int( cached_props, "alpha" );
+
+			if ( width != 0 && ( width != self->width || height != self->height ) )
+				self->image = NULL;
 		}
 	}
 	int disable_exif = mlt_properties_get_int( producer_props, "disable_exif" );

-    // optimization for subsequent iterations on single picture
-	if ( width != 0 && ( image_idx != this->image_idx || width != this->width || height != this->height ) )
-		this->image = NULL;
-	if ( image_idx != this->pixbuf_idx )
+	// optimization for subsequent iterations on single picture
+	if ( width != 0 && ( image_idx != self->image_idx || width != self->width || height != self->height ) )
+		self->image = NULL;
+	if ( image_idx != self->pixbuf_idx )
 		pixbuf = NULL;
 	mlt_log_debug( MLT_PRODUCER_SERVICE( producer ), "image %p pixbuf %p idx %d image_idx %d pixbuf_idx %d width %d\n",
-		this->image, pixbuf, image_idx, this->image_idx, this->pixbuf_idx, width );
+		self->image, pixbuf, image_idx, self->image_idx, self->pixbuf_idx, width );
 	if ( !pixbuf || mlt_properties_get_int( producer_props, "_disable_exif" ) != disable_exif )
 	{
-		this->image = NULL;
-		pixbuf = gdk_pixbuf_new_from_file( mlt_properties_get_value( this->filenames, image_idx ), &error );
+		self->image = NULL;
+		pixbuf = gdk_pixbuf_new_from_file( mlt_properties_get_value( self->filenames, image_idx ), &error );

 		if ( pixbuf )
 		{
 #ifdef USE_EXIF
 			// Read the exif value for this file
 			if ( disable_exif == 0) {
-				ExifData *d = exif_data_new_from_file( mlt_properties_get_value( this->filenames, image_idx ) );
+				ExifData *d = exif_data_new_from_file( mlt_properties_get_value( self->filenames, image_idx ) );
 				ExifEntry *entry;
 				int exif_orientation = 0;

@@ -351,7 +351,7 @@
 			mlt_cache_item_close( pixbuf_cache );
 			mlt_service_cache_put( MLT_PRODUCER_SERVICE( producer ), "pixbuf.pixbuf", pixbuf, 0, ( mlt_destructor )g_object_unref );
 			pixbuf_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.pixbuf" );
-			this->pixbuf_idx = image_idx;
+			self->pixbuf_idx = image_idx;

 			mlt_events_block( producer_props, NULL );
 			mlt_properties_set_int( producer_props, "_real_width", gdk_pixbuf_get_width( pixbuf ) );
@@ -360,13 +360,13 @@
 			mlt_events_unblock( producer_props, NULL );

 			// Store the width/height of the pixbuf temporarily
-			this->width = gdk_pixbuf_get_width( pixbuf );
-			this->height = gdk_pixbuf_get_height( pixbuf );
+			self->width = gdk_pixbuf_get_width( pixbuf );
+			self->height = gdk_pixbuf_get_height( pixbuf );
 		}
 	}

 	// If we have a pixbuf and we need an image
-	if ( pixbuf && width > 0 && !this->image )
+	if ( pixbuf && width > 0 && !self->image )
 	{
 		char *interps = mlt_properties_get( properties, "rescale.interp" );
 		int interp = GDK_INTERP_BILINEAR;
@@ -382,21 +382,21 @@
 		pixbuf = gdk_pixbuf_scale_simple( pixbuf, width, height, interp );

 		// Store width and height
-		this->width = width;
-		this->height = height;
+		self->width = width;
+		self->height = height;

 		// Allocate/define image
-		this->alpha = gdk_pixbuf_get_has_alpha( pixbuf );
+		self->alpha = gdk_pixbuf_get_has_alpha( pixbuf );
 		int src_stride = gdk_pixbuf_get_rowstride( pixbuf );
-		int dst_stride = this->width * ( this->alpha ? 4 : 3 );
+		int dst_stride = self->width * ( self->alpha ? 4 : 3 );
 		int image_size = dst_stride * ( height + 1 );
-		this->image = mlt_pool_alloc( image_size );
+		self->image = mlt_pool_alloc( image_size );

 		if ( src_stride != dst_stride )
 		{
-			int y = this->height;
+			int y = self->height;
 			uint8_t *src = gdk_pixbuf_get_pixels( pixbuf );
-			uint8_t *dst = this->image;
+			uint8_t *dst = self->image;
 			while ( y-- )
 			{
 				memcpy( dst, src, dst_stride );
@@ -406,13 +406,13 @@
 		}
 		else
 		{
-			memcpy( this->image, gdk_pixbuf_get_pixels( pixbuf ), src_stride * height );
+			memcpy( self->image, gdk_pixbuf_get_pixels( pixbuf ), src_stride * height );
 		}
 		if ( !use_cache )
-			mlt_cache_item_close( this->image_cache );
-		mlt_service_cache_put( MLT_PRODUCER_SERVICE( producer ), "pixbuf.image", this->image, image_size, mlt_pool_release );
-		this->image_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.image" );
-		this->image_idx = image_idx;
+			mlt_cache_item_close( self->image_cache );
+		mlt_service_cache_put( MLT_PRODUCER_SERVICE( producer ), "pixbuf.image", self->image, image_size, mlt_pool_release );
+		self->image_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.image" );
+		self->image_idx = image_idx;

 		// Finished with pixbuf now
 		g_object_unref( pixbuf );
@@ -425,13 +425,13 @@
 	mlt_cache_item_close( pixbuf_cache );
 	if ( width == 0 )
 	{
-		pthread_mutex_unlock( &this->mutex );
-		mlt_cache_item_close( this->image_cache );
+		pthread_mutex_unlock( &self->mutex );
+		mlt_cache_item_close( self->image_cache );
 	}

 	// Set width/height of frame
-	mlt_properties_set_int( properties, "width", this->width );
-	mlt_properties_set_int( properties, "height", this->height );
+	mlt_properties_set_int( properties, "width", self->width );
+	mlt_properties_set_int( properties, "height", self->height );
 	mlt_properties_set_int( properties, "real_width", mlt_properties_get_int( producer_props, "_real_width" ) );
 	mlt_properties_set_int( properties, "real_height", mlt_properties_get_int( producer_props, "_real_height" ) );

@@ -439,12 +439,12 @@
 	{
 		mlt_frame cached = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
 		mlt_properties cached_props = MLT_FRAME_PROPERTIES( cached );
-		mlt_properties_set_int( cached_props, "width", this->width );
-		mlt_properties_set_int( cached_props, "height", this->height );
+		mlt_properties_set_int( cached_props, "width", self->width );
+		mlt_properties_set_int( cached_props, "height", self->height );
 		mlt_properties_set_int( cached_props, "real_width", mlt_properties_get_int( producer_props, "_real_width" ) );
 		mlt_properties_set_int( cached_props, "real_height", mlt_properties_get_int( producer_props, "_real_height" ) );
-		mlt_frame_set_image( cached, this->image, this->width * ( this->alpha ? 4 : 3 ) * this->height, mlt_pool_release );
-		mlt_properties_set_int( cached_props, "alpha", this->alpha );
+		mlt_frame_set_image( cached, self->image, self->width * ( self->alpha ? 4 : 3 ) * self->height, mlt_pool_release );
+		mlt_properties_set_int( cached_props, "alpha", self->alpha );
 		mlt_properties_set_data( cache, image_key, cached, 0, ( mlt_destructor )mlt_frame_close, NULL );
 	}

@@ -459,35 +459,35 @@
 	mlt_properties properties = MLT_FRAME_PROPERTIES( frame );

 	// Obtain the producer for this frame
-	producer_pixbuf this = mlt_properties_get_data( properties, "producer_pixbuf", NULL );
+	producer_pixbuf self = mlt_properties_get_data( properties, "producer_pixbuf", NULL );

 	*width = mlt_properties_get_int( properties, "rescale_width" );
 	*height = mlt_properties_get_int( properties, "rescale_height" );

-	mlt_service_lock( MLT_PRODUCER_SERVICE( &this->parent ) );
+	mlt_service_lock( MLT_PRODUCER_SERVICE( &self->parent ) );

 	// Refresh the image
-	refresh_image( this, frame, *width, *height );
+	refresh_image( self, frame, *width, *height );

 	// Get width and height (may have changed during the refresh)
-	*width = this->width;
-	*height = this->height;
-	*format = this->alpha ? mlt_image_rgb24a : mlt_image_rgb24;
+	*width = self->width;
+	*height = self->height;
+	*format = self->alpha ? mlt_image_rgb24a : mlt_image_rgb24;

 	// NB: Cloning is necessary with this producer (due to processing of images ahead of use)
 	// The fault is not in the design of mlt, but in the implementation of the pixbuf producer...
-	if ( this->image )
+	if ( self->image )
 	{
 		// Clone the image
-		int image_size = this->width * this->height * ( this->alpha ? 4 :3 );
+		int image_size = self->width * self->height * ( self->alpha ? 4 :3 );
 		uint8_t *image_copy = mlt_pool_alloc( image_size );
-		memcpy( image_copy, this->image, image_size );
+		memcpy( image_copy, self->image, image_size );
 		// Now update properties so we free the copy after
 		mlt_frame_set_image( frame, image_copy, image_size, mlt_pool_release );
 		// We're going to pass the copy on
 		*buffer = image_copy;
-		mlt_log_debug( MLT_PRODUCER_SERVICE( &this->parent ), "%dx%d (%s)\n",
-			this->width, this->height, mlt_image_format_name( *format ) );
+		mlt_log_debug( MLT_PRODUCER_SERVICE( &self->parent ), "%dx%d (%s)\n",
+			self->width, self->height, mlt_image_format_name( *format ) );
 	}
 	else
 	{
@@ -495,9 +495,9 @@
 	}

 	// Release references and locks
-	pthread_mutex_unlock( &this->mutex );
-	mlt_cache_item_close( this->image_cache );
-	mlt_service_unlock( MLT_PRODUCER_SERVICE( &this->parent ) );
+	pthread_mutex_unlock( &self->mutex );
+	mlt_cache_item_close( self->image_cache );
+	mlt_service_unlock( MLT_PRODUCER_SERVICE( &self->parent ) );

 	return error;
 }
@@ -505,24 +505,24 @@
 static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index )
 {
 	// Get the real structure for this producer
-	producer_pixbuf this = producer->child;
+	producer_pixbuf self = producer->child;

 	// Fetch the producers properties
 	mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer );

-	if ( this->filenames == NULL && mlt_properties_get( producer_properties, "resource" ) != NULL )
-		load_filenames( this, producer_properties );
+	if ( self->filenames == NULL && mlt_properties_get( producer_properties, "resource" ) != NULL )
+		load_filenames( self, producer_properties );

 	// Generate a frame
 	*frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );

-	if ( *frame != NULL && this->count > 0 )
+	if ( *frame != NULL && self->count > 0 )
 	{
 		// Obtain properties of frame and producer
 		mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );

 		// Set the producer on the frame properties
-		mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL );
+		mlt_properties_set_data( properties, "producer_pixbuf", self, 0, NULL, NULL );

 		// Update timecode on the frame we're creating
 		mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
@@ -531,7 +531,7 @@
 		mlt_properties_set_position( properties, "pixbuf_position", mlt_producer_position( producer ) );

 		// Refresh the image
-		refresh_image( this, *frame, 0, 0 );
+		refresh_image( self, *frame, 0, 0 );

 		// Set producer-specific frame properties
 		mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( producer_properties, "progressive" ) );
@@ -554,11 +554,11 @@

 static void producer_close( mlt_producer parent )
 {
-	producer_pixbuf this = parent->child;
-	pthread_mutex_destroy( &this->mutex );
+	producer_pixbuf self = parent->child;
+	pthread_mutex_destroy( &self->mutex );
 	parent->close = NULL;
 	mlt_service_cache_purge( MLT_PRODUCER_SERVICE(parent) );
 	mlt_producer_close( parent );
-	mlt_properties_close( this->filenames );
-	free( this );
+	mlt_properties_close( self->filenames );
+	free( self );
 }


2 minor bug fix.

2 minor bug fix.

bk: 39793378QbV_US1-5VC_9WMbmnAdfQ

--- src/export.c
+++ src/export.c
@@ -18,9 +18,10 @@
 	FILE	*f;
 	char	*type = 0;

-	while ((c = getopt(ac, av, "d:Dhkt:Twvi:x:r:")) != -1) {
+	while ((c = getopt(ac, av, "d:Dhkqt:Twvi:x:r:")) != -1) {
 		switch (c) {
 		    case 'v':	vflag = 1; break;
+		    case 'q':	break; /* no op; for interface consistency */
 		    case 'd':	diff_style = optarg; break;
 		    case 'h':	hflag = 1; break; /* disbale patch header */
 		    case 'k':	kflag = 1; break;
@@ -40,7 +41,7 @@
 				break;
 		    default :
 usage:			fprintf(stderr,
-		"usage: bk export [-tplain|patch] [-TDkwv] [-i<pattern>] [-x<pattern>]\n");
+		"usage: bk export [-tplain|patch] [-TDkqwv] [-i<pattern>] [-x<pattern>]\n");
 			fprintf(stderr,
 				"\t[-r<rev> | -d u|c] [source] dest\n");
 			exit(1);


Propagate tsdn to default extent hooks.

Propagate tsdn to default extent hooks.

This avoids bootstrapping issues for configurations that require
allocation during tsd initialization.

This resolves #390.

--- src/extent.c
+++ src/extent.c
@@ -561,10 +561,23 @@
 }

 static void *
+extent_alloc_default_impl(tsdn_t *tsdn, arena_t *arena, void *new_addr,
+    size_t size, size_t alignment, bool *zero, bool *commit)
+{
+	void *ret;
+
+	ret = extent_alloc_core(tsdn, arena, new_addr, size, alignment, zero,
+	    commit, arena->dss_prec);
+	if (ret == NULL)
+		return (NULL);
+
+	return (ret);
+}
+
+static void *
 extent_alloc_default(extent_hooks_t *extent_hooks, void *new_addr, size_t size,
     size_t alignment, bool *zero, bool *commit, unsigned arena_ind)
 {
-	void *ret;
 	tsdn_t *tsdn;
 	arena_t *arena;

@@ -577,12 +590,9 @@
 	 * already.
 	 */
 	assert(arena != NULL);
-	ret = extent_alloc_core(tsdn, arena, new_addr, size, alignment, zero,
-	    commit, arena->dss_prec);
-	if (ret == NULL)
-		return (NULL);
-
-	return (ret);
+
+	return (extent_alloc_default_impl(tsdn, arena, new_addr, size,
+	    alignment, zero, commit));
 }

 static extent_t *
@@ -619,8 +629,14 @@
 	extent = extent_alloc(tsdn, arena);
 	if (extent == NULL)
 		return (NULL);
-	addr = (*r_extent_hooks)->alloc(*r_extent_hooks, new_addr, size,
-	    alignment, zero, commit, arena->ind);
+	if (*r_extent_hooks == &extent_hooks_default) {
+		/* Call directly to propagate tsdn. */
+		addr = extent_alloc_default_impl(tsdn, arena, new_addr, size,
+		    alignment, zero, commit);
+	} else {
+		addr = (*r_extent_hooks)->alloc(*r_extent_hooks, new_addr, size,
+		    alignment, zero, commit, arena->ind);
+	}
 	if (addr == NULL) {
 		extent_dalloc(tsdn, arena, extent);
 		return (NULL);
@@ -770,21 +786,33 @@
 }

 static bool
+extent_dalloc_default_impl(tsdn_t *tsdn, void *addr, size_t size)
+{
+
+	if (!have_dss || !extent_in_dss(tsdn, addr))
+		return (extent_dalloc_mmap(addr, size));
+	return (true);
+}
+
+
+static bool
 extent_dalloc_default(extent_hooks_t *extent_hooks, void *addr, size_t size,
     bool committed, unsigned arena_ind)
 {
+	tsdn_t *tsdn;

 	assert(extent_hooks == &extent_hooks_default);

-	if (!have_dss || !extent_in_dss(tsdn_fetch(), addr))
-		return (extent_dalloc_mmap(addr, size));
-	return (true);
+	tsdn = tsdn_fetch();
+
+	return (extent_dalloc_default_impl(tsdn, addr, size));
 }

 void
 extent_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena,
     extent_hooks_t **r_extent_hooks, extent_t *extent)
 {
+	bool err;

 	assert(extent_base_get(extent) != NULL);
 	assert(extent_size_get(extent) != 0);
@@ -797,9 +825,17 @@
 	 * allocating threads, and reregister if deallocation fails.
 	 */
 	extent_deregister(tsdn, extent);
-	if (!(*r_extent_hooks)->dalloc(*r_extent_hooks, extent_base_get(extent),
-	    extent_size_get(extent), extent_committed_get(extent),
-	    arena->ind)) {
+	if (*r_extent_hooks == &extent_hooks_default) {
+		/* Call directly to propagate tsdn. */
+		err = extent_dalloc_default_impl(tsdn, extent_base_get(extent),
+		    extent_size_get(extent));
+	} else {
+		err = (*r_extent_hooks)->dalloc(*r_extent_hooks,
+		    extent_base_get(extent), extent_size_get(extent),
+		    extent_committed_get(extent), arena->ind);
+	}
+
+	if (!err) {
 		extent_dalloc(tsdn, arena, extent);
 		return;
 	}
@@ -977,35 +1013,52 @@
 }

 static bool
+extent_merge_default_impl(tsdn_t *tsdn, void *addr_a, void *addr_b)
+{
+
+	if (!maps_coalesce)
+		return (true);
+	if (have_dss && extent_in_dss(tsdn, addr_a) != extent_in_dss(tsdn,
+	    addr_b))
+			return (true);
+
+	return (false);
+}
+
+static bool
 extent_merge_default(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
     void *addr_b, size_t size_b, bool committed, unsigned arena_ind)
 {
+	tsdn_t *tsdn;

 	assert(extent_hooks == &extent_hooks_default);

-	if (!maps_coalesce)
-		return (true);
-	if (have_dss) {
-		tsdn_t *tsdn = tsdn_fetch();
-		if (extent_in_dss(tsdn, addr_a) != extent_in_dss(tsdn, addr_b))
-			return (true);
-	}
-
-	return (false);
+	tsdn = tsdn_fetch();
+
+	return (extent_merge_default_impl(tsdn, addr_a, addr_b));
 }

 bool
 extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena,
     extent_hooks_t **r_extent_hooks, extent_t *a, extent_t *b)
 {
+	bool err;
 	rtree_ctx_t rtree_ctx_fallback;
 	rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback);
 	rtree_elm_t *a_elm_a, *a_elm_b, *b_elm_a, *b_elm_b;

 	extent_hooks_assure_initialized(arena, r_extent_hooks);
-	if ((*r_extent_hooks)->merge(*r_extent_hooks, extent_base_get(a),
-	    extent_size_get(a), extent_base_get(b), extent_size_get(b),
-	    extent_committed_get(a), arena->ind))
+	if (*r_extent_hooks == &extent_hooks_default) {
+		/* Call directly to propagate tsdn. */
+		err = extent_merge_default_impl(tsdn, extent_base_get(a),
+		    extent_base_get(b));
+	} else {
+		err = (*r_extent_hooks)->merge(*r_extent_hooks,
+		    extent_base_get(a), extent_size_get(a), extent_base_get(b),
+		    extent_size_get(b), extent_committed_get(a), arena->ind);
+	}
+
+	if (err)
 		return (true);

 	/*


Bug fixing: unit masks were left out when converting names into native event codes.

--- src/extras.c
+++ src/extras.c
@@ -561,6 +561,11 @@
 	int retval = PAPI_ENOEVNT;
 	char name[PAPI_HUGE_STR_LEN]; /* make sure it's big enough */
 	unsigned int i, j;
+
+#if ((defined PERFCTR_PFM_EVENTS) | (defined SUBSTRATE_USES_LIBPFM))
+	   extern unsigned int _papi_pfm_ntv_name_to_code(char *name, int *event_code);
+	         retval = _papi_pfm_ntv_name_to_code(in, out);
+#else

 	for (j=0,i = 0 | PAPI_NATIVE_MASK;j<papi_num_components; j++,i = 0 | PAPI_NATIVE_MASK) {
 		/* first check each component for name_to_code */
@@ -589,6 +594,7 @@
 			if (retval == PAPI_OK) return(retval);
 		}
 	}
+#endif /* PERFCTR_PFM_EVENTS */
 	return (retval);
 }


Removed unnecessary include, fonts.h

Removed unnecessary include, fonts.h

--- src/fbchar.c
+++ src/fbchar.c
@@ -3,7 +3,6 @@
 #include "libfb.h"
 #include "fballoc.h"
 #include "fbchar.h"
-#include "fonts/fonts.h"

 #define	MIN(a,b)	( (a) < (b) ? (a) : (b) )
 #define MAX(a,b)	( (a) > (b) ? (a) : (b) )


add debugging prints

add debugging prints

--- usbxhci.c
+++ usbxhci.c
@@ -931,13 +931,17 @@

     // set up the event ring size
     xhcireg_wr(ctlr, ERSTSZ_OFF, 0xFFFF, 1); // write 1 to event segment table size register
+    print("configured event ring size\n");
     xhcireg_wr(ctlr, ERDP_OFF, 0xFFFFFFF0, ctlr->event_deq); // [2:0] used by xHC, [3] is Event Handle Busy TODO
-    xhcireg_wr(ctlr, ERDP_OFF + 4, 0xFFFFFFFF, ctlr->event_deq); // write the event segtable pointer
+    xhcireg_wr(ctlr, ERDP_OFF + 4, 0xFFFFFFFF, 0);
+    print("configured event ring deq ptr\n");
     xhcireg_wr(ctlr, ERSTBA_OFF, 0xFFFFFFC0, ctlr->event_segtable); // [5:0] is reserved
     xhcireg_wr(ctlr, ERSTBA_OFF + 4, 0xFFFFFFFF, 0); // ERSTBA_HI = 0
+    print("configured event ring bar\n");
     // enable interrupt and TODO: disable MSI/MSIX
     // set interrupt enable = 1
-    xhcireg_wr(ctlr, INTE_OFF, 0x1, 1);
+    xhcireg_wr(ctlr, INTE_OFF, 0x3, 2); // IE = 1, IP = 0 -> 2'b10 = 2
+    print("interrupt is on\n");

     // CRCR_CMDRING_LO = ctlr->cmd_ring_bar
     xhcireg_wr(ctlr, CRCR_OFF, CRCR_CMDRING_LO, ctlr->cmd_ring_bar);
@@ -947,6 +951,7 @@

     // tell the controller to run
     xhcireg_wr(ctlr, USBCMD_OFF, USBCMD_RS, USBCMD_RS_RUN);
+    print("controller is on\n");
     /*
      * Linkage to the generic HCI driver.
      */


CDRIVER-946: implement mongoc_bulk_operation_set_flags

--- src/mongoc/mongoc-bulk-operation.c
+++ src/mongoc/mongoc-bulk-operation.c
@@ -524,3 +524,14 @@
       MONGOC_BYPASS_DOCUMENT_VALIDATION_TRUE :
       MONGOC_BYPASS_DOCUMENT_VALIDATION_FALSE;
 }
+
+
+void
+mongoc_bulk_operation_set_flags (mongoc_bulk_operation_t  *bulk,
+                                 mongoc_bulk_write_flags_t flags)
+{
+   BSON_ASSERT (bulk);
+
+   bulk->flags.ordered = flags.ordered;
+   bulk->flags.bypass_document_validation = flags.bypass_document_validation;
+}


 2008-01-288888888 Ebby Wiselyn <ebbywiselyn@gmail.com>  ** Fix for bug #512545 and other fixes **

svn path=/trunk/; revision=8438

--- calendar/backends/google/e-cal-backend-google-utils.c
+++ calendar/backends/google/e-cal-backend-google-utils.c
@@ -34,8 +34,10 @@
 #include <bonobo/bonobo-exception.h>
 #include <bonobo/bonobo-moniker-util.h>

+#include <glib.h>
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
+#include <glib/gprintf.h>

 #include <libgnomevfs/gnome-vfs.h>

@@ -383,7 +385,6 @@

 }

-
 /*************************************************** EGoItem Functions*********************************************/

 /**
@@ -400,6 +401,7 @@
 	ECalComponent *comp;
 	ECalComponentText text;
 	ECalComponentDateTime dt;
+	ECalComponentOrganizer *org = NULL;
 	icaltimezone *default_zone;
 	const char *description, *uid, *temp;
 	struct icaltimetype itt_utc, itt;
@@ -424,7 +426,7 @@
 		e_cal_component_set_description_list (comp, &l);

 	}
-
+
 	/*Creation*/
 	temp = gdata_entry_get_start_time (item->entry);
 	temp = gd_date_to_ical (g_strdup(temp));
@@ -484,7 +486,7 @@
 	/* Attendees */
 	GSList *go_attendee_list = NULL, *l = NULL, *attendee_list = NULL;
 	go_attendee_list = gdata_entry_get_attendee_list (item->entry);
-
+
 	if (go_attendee_list != NULL) {

 		for (l = go_attendee_list; l != NULL; l = l->next) {
@@ -492,18 +494,38 @@
 			go_attendee = (Attendee *)l->data;

 			ECalComponentAttendee *attendee = g_new0 (ECalComponentAttendee, 1);
-
+#if 0
+			_print_attendee ((Attendee *)l->data);
+#endif
+			attendee->value = g_strconcat ("MAILTO:", go_attendee->attendee_email, NULL);
 			attendee->cn = g_strdup (go_attendee->attendee_value);
-
-			attendee->value = g_strconcat ("MAILTO:", go_attendee->attendee_email, NULL);
 			attendee->role = ICAL_ROLE_OPTPARTICIPANT;
-			attendee->status = ICAL_PARTSTAT_ACCEPTED;
-
-			attendee_list = g_slist_prepend (attendee_list, attendee);
+			attendee->status = ICAL_PARTSTAT_NEEDSACTION;
+			attendee->cutype =  ICAL_CUTYPE_INDIVIDUAL;
+
+			/* Check for Organizer */
+			if (go_attendee->attendee_rel) {
+				gchar *val;
+				val = strstr ((const gchar *)go_attendee->attendee_rel, (const gchar *)"organizer");
+				if (val != NULL && !strcmp ("organizer", val)) {
+					org = g_new0 (ECalComponentOrganizer, 1);
+
+					if (go_attendee->attendee_email)
+						org->value = g_strconcat("MAILTO:", go_attendee->attendee_email, NULL);
+					if (go_attendee->attendee_value)
+						org->cn =  g_strdup (go_attendee->attendee_value);
+				}
+			}
+
+			attendee_list = g_slist_prepend (attendee_list, attendee);
 		}
 		e_cal_component_set_attendee_list (comp, attendee_list);
 	}
-
+
+	/* Set the organizer if any */
+	if (org)
+		e_cal_component_set_organizer (comp, org);
+
 	/* Location */
 	e_cal_component_set_location (comp, gdata_entry_get_location (item->entry));

@@ -538,7 +560,14 @@
 			dt.tzid = icaltimezone_get_tzid (default_zone);
 		}
 	}
-
+#if 0
+	/* temp hack to see how recurrence work */
+	ECalComponentRange *recur_id;
+	recur_id = g_new0 (ECalComponentRange, 1);
+	recur_id->datetime = dt;
+	recur_id->type = E_CAL_COMPONENT_RANGE_THISFUTURE;
+	e_cal_component_set_recurid (comp, recur_id);
+#endif
 	e_cal_component_set_dtend (comp, &dt);

 	uid = gdata_entry_get_id (item->entry);


FFT2n: refactor reverse actions

FFT2n: refactor reverse actions

--- src/fft_2n.h
+++ src/fft_2n.h
@@ -87,6 +87,8 @@

   private:
     void init_bitrev();
+    void bit_rev_permute(vec::Vector<T>& vec);
+    void bit_rev_permute(vec::Buffers<T>& vec);

     unsigned data_len; // number of real input elements
     T w;
@@ -137,6 +139,26 @@
     // init bit-reversed indices
     for (unsigned i = 0; i < len; ++i) {
         rev[i] = reverse_bitwise(i, len, log_n);
+    }
+}
+
+template <typename T>
+void Radix2<T>::bit_rev_permute(vec::Vector<T>& vec)
+{
+    for (unsigned i = 0; i < (unsigned)this->n; ++i) {
+        if (rev[i] < i) {
+            vec.swap(i, rev[i]);
+        }
+    }
+}
+
+template <typename T>
+void Radix2<T>::bit_rev_permute(vec::Buffers<T>& vec)
+{
+    for (unsigned i = 0; i < (unsigned)this->n; ++i) {
+        if (rev[i] < i) {
+            vec.swap(i, rev[i]);
+        }
     }
 }

@@ -239,11 +261,7 @@
     }

     // reversion of elements of output to return values on the natural order
-    for (unsigned i = 0; i < len; i++) {
-        if (rev[i] < i) {
-            output.swap(i, rev[i]);
-        }
-    }
+    bit_rev_permute(output);
 }

 template <typename T>
@@ -322,13 +340,8 @@
     const unsigned len = this->n;

     // 1st reversion of elements of output
-    for (unsigned i = 0; i < len; i++) {
-        if (rev[i] < i) {
-            output.swap(i, rev[i]);
-        }
-    }
-
-    // copy input to output
+    bit_rev_permute(output);
+
     output.copy(input);

     for (unsigned m = len / 2; m >= 1; m /= 2) {
@@ -346,11 +359,7 @@
     }

     // 2nd reversion of elements of output to return its natural order
-    for (unsigned i = 0; i < len; i++) {
-        if (rev[i] < i) {
-            output.swap(i, rev[i]);
-        }
-    }
+    bit_rev_permute(output);
 }

 template <typename T>


Added todo comment

Added todo comment

--- uspeech.h
+++ uspeech.h
@@ -1,6 +1,6 @@
 /*
  uspeech v.4.x.x
- 2012 Arjo Chakravarty
+ 2012-2014 Arjo Chakravarty

  uspeech is a library that allows sounds to be classified into certain phonemes
  on the Arduino. This creates a simple beginning for a full scale voice recognition
@@ -71,5 +71,5 @@
     void debugPrint(); /*!< Outputs the datain the accumulator vector. Only enabled for arduino.*/
     #endif
 };
-
+//TODO: implement statistics classes.
 #endif


Clean up Buffer Sources implementation

Clean up Buffer Sources implementation

--- src/fields.c
+++ src/fields.c
@@ -100,15 +100,6 @@
 static int fields_parse_finish(struct fields_reader *, struct fields_record *,
     const char *, char *);

-struct fields_buffer {
-    const char *buffer;
-    size_t      buffer_size;
-};
-
-static struct fields_buffer *fields_buffer_alloc(const char *, size_t);
-static int fields_buffer_read(void *, const char **, size_t *);
-static void fields_buffer_free(void *);
-
 enum fields_state {
     FIELDS_STATE_MAYBE_INSIDE_FIELD,
     FIELDS_STATE_INSIDE_FIELD,
@@ -156,6 +147,53 @@
 fields_whitespace(char ch)
 {
     return (ch == FIELDS_HT) || (ch == FIELDS_SP);
+}
+
+/*
+ * Buffer Sources
+ * ==============
+ */
+
+struct fields_buffer {
+    const char *buffer;
+    size_t      buffer_size;
+};
+
+static struct fields_buffer *
+fields_buffer_alloc(const char *buffer, size_t buffer_size)
+{
+    struct fields_buffer *self;
+
+    self = malloc(sizeof(*self));
+    if (self == NULL)
+        return NULL;
+
+    self->buffer = buffer;
+    self->buffer_size = buffer_size;
+
+    return self;
+}
+
+static int
+fields_buffer_read(void *source, const char **buffer, size_t *buffer_size)
+{
+    struct fields_buffer *self = source;
+
+    *buffer = self->buffer;
+    *buffer_size = self->buffer_size;
+
+    self->buffer = NULL;
+    self->buffer_size = 0;
+
+    return 0;
+}
+
+static void
+fields_buffer_free(void *source)
+{
+    struct fields_buffer *self = source;
+
+    free(self);
 }

 /*
@@ -1041,45 +1079,3 @@

     return 0;
 }
-
-/*
- * Buffer Sources
- * ==============
- */
-
-static struct fields_buffer *
-fields_buffer_alloc(const char *buffer, size_t buffer_size)
-{
-    struct fields_buffer *self;
-
-    self = malloc(sizeof(*self));
-    if (self == NULL)
-        return NULL;
-
-    self->buffer = buffer;
-    self->buffer_size = buffer_size;
-
-    return self;
-}
-
-static int
-fields_buffer_read(void *source, const char **buffer, size_t *buffer_size)
-{
-    struct fields_buffer *self = source;
-
-    *buffer = self->buffer;
-    *buffer_size = self->buffer_size;
-
-    self->buffer = NULL;
-    self->buffer_size = 0;
-
-    return 0;
-}
-
-static void
-fields_buffer_free(void *source)
-{
-    struct fields_buffer *self = source;
-
-    free(self);
-}


Fixed build on Linux, which appears to be very picky about printf formatting.

--- util/gm.c
+++ util/gm.c
@@ -1,9 +1,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#ifdef WINDOWS
 #pragma warning( push, 3 )
+#endif
 #include <gm.h>
+#ifdef WINDOWS
 #pragma warning( pop )
+#endif
 #ifndef WINDOWS
 #include <ctype.h> // for tolower
 #endif
@@ -152,15 +156,15 @@

 	crWarning( "GM: gm_max_length_for_size( "
 			"size=%u ) = %u", min_size,
-			gm_max_length_for_size( min_size ) );
+			(unsigned int) gm_max_length_for_size( min_size ) );

 	crWarning( "GM: gm_min_message_size() = %u",
-			gm_min_message_size( cr_gm.port ) );
+			(unsigned int) gm_min_message_size( cr_gm.port ) );

 	crWarning( "GM: num_send_tokens=%u "
 			"num_receive_tokens=%u",
-			gm_num_send_tokens( cr_gm.port ),
-			gm_num_receive_tokens( cr_gm.port ) );
+			(unsigned int) gm_num_send_tokens( cr_gm.port ),
+			(unsigned int) gm_num_receive_tokens( cr_gm.port ) );
 }

 #if CR_GM_DEBUG
@@ -332,7 +336,7 @@
 	buf = gm_dma_malloc( cr_gm.port, length );
 	if ( buf == NULL )
 	{
-		crError( "gm_dma_malloc( port=%p, len=%d ) : failed",
+		crError( "gm_dma_malloc( port=%p, len=%ld ) : failed",
 				cr_gm.port, length );
 	}

@@ -1402,7 +1406,7 @@
 		if ( status != GM_SUCCESS )
 		{
 			crError( "GM: gm_set_acceptable_sizes( port=%u, pri=%u, "
-					"mask=%u ) failed: %s (%d)", cr_gm.port_num,
+					"mask=%ld ) failed: %s (%d)", cr_gm.port_num,
 					priority, mask,
 					cr_gm_str_error( status ), status );
 		}


PBC is probably not an advanced option.

PBC is probably not an advanced option.

--- modules/access/vcdx/vcd.c
+++ modules/access/vcdx/vcd.c
@@ -2,7 +2,7 @@
  * vcd.c : VCD input module for vlc
  *****************************************************************************
  * Copyright (C) 2000,2003 VideoLAN
- * $Id: vcd.c,v 1.15 2004/01/25 17:31:22 gbazin Exp $
+ * $Id$
  *
  * Authors: Rocky Bernstein <rocky@panix.com>
  *
@@ -104,7 +104,7 @@
               N_("Use playback control?"),
               N_("If VCD is authored with playback control, use it. "
                  "Otherwise we play by tracks."),
-              VLC_TRUE );
+              VLC_FALSE );

     add_string( MODULE_STRING "-author-format",
                 "%v - %F disc %c of %C",


pretty label for gridlines

pretty label for gridlines

git-svn-id: a4967eeb46e72ec0d67de3341f099b34cc11cf18@12682 03a3cea6-2c03-0410-ac9b-9271b1c66c29

--- render/render_gridlines.c
+++ render/render_gridlines.c
@@ -66,6 +66,31 @@
 	cairo_show_text(cairo, txt);
 }

+static void pretty_label(double x, char* buf) {
+	int i;
+	sprintf(buf, "%.2f", x);
+	logverb("label: \"%s\"\n", buf);
+	// Look for decimal point.
+	if (!strchr(buf, '.')) {
+		logverb("no decimal point\n");
+		return;
+	}
+	// Trim trailing zeroes (after the decimal point)
+	i = strlen(buf)-1;
+	while (buf[i] == '0') {
+		buf[i] = '\0';
+		logverb("trimming trailing zero at %i: \"%s\"\n", i, buf);
+		i--;
+		assert(i > 0);
+	}
+	// Trim trailing decimal point, if it exists.
+	i = strlen(buf)-1;
+	if (buf[i] == '.') {
+		buf[i] = '\0';
+		logverb("trimming trailing decimal point at %i: \"%s\"\n", i, buf);
+	}
+}
+
 int render_gridlines(cairo_t* c2, render_args_t* args) {
 	double rastep, decstep;
 	int ind;
@@ -110,7 +135,6 @@
 		// draw the grid line on the nearest pixel... cairo pixel centers are at 0.5
 		x = 0.5 + round(x-0.5);
 		cairo_move_to(cairo, x, 0);
-		//cairo_line_to(cairo, x, args->H - y0);
 		cairo_line_to(cairo, x, args->H);
 	}
 	for (dec = decstep * floor(args->decmin / decstep);
@@ -126,27 +150,24 @@
 	cairo_stroke(cairo);

 	if (args->gridlabel) {
+		char buf[32];
 		cairo_set_source_rgba(cairo, 1.0, 1.0, 1.0, 8.0);
 		cairo_select_font_face(cairo, "DejaVu Sans Mono Book", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
 		cairo_set_font_size(cairo, 18);
 		for (ra = ralabelstep * floor(args->ramin / ralabelstep);
 			 ra <= ralabelstep * ceil(args->ramax / ralabelstep);
 			 ra += ralabelstep) {
-			char buf[32];
 			float x = ra2pixelf(ra, args);
 			float y = args->H;
 			if (!in_image((int)round(x+0.5), 0, args))
 				continue;
-			sprintf(buf, "%.2f", ra);
-			// Trim off ".00"
-			if (ends_with(buf, ".00"))
-				buf[strlen(buf) - 3] = '\0';
+			pretty_label(ra, buf);
+			logverb("Adding label ra=\"%s\"\n", buf);
 			add_text(cairo, x, y, buf, args);
 		}
 		for (dec = declabelstep * floor(args->decmin / declabelstep);
 			 dec <= declabelstep * ceil(args->decmax / declabelstep);
 			 dec += declabelstep) {
-			char buf[32];
 			float y = dec2pixelf(dec, args);
 			float x = 0;
 			// yep, it can wrap around :)
@@ -154,10 +175,8 @@
 				continue;
 			if (!in_image(0, (int)round(y+0.5), args))
 				continue;
-			sprintf(buf, "%.2f", dec);
-			// Trim off ".00"
-			if (ends_with(buf, ".00"))
-				buf[strlen(buf) - 3] = '\0';
+			pretty_label(dec, buf);
+			logverb("Adding label dec=\"%s\"\n", buf);
 			add_text(cairo, x, y, buf, args);
 		}
 	}


Drop constexpr from compiled-out debug settings

* This works for everything but rdcstr unfortunately

--- renderdoc/core/settings.h
+++ renderdoc/core/settings.h
@@ -66,7 +66,7 @@
 #define RDOC_DEBUG_CONFIG(type, name, defaultValue, description)                         \
   static ConfigVarRegistration<type> CONCAT(config, __LINE__)(                           \
       STRING_LITERAL(STRINGIZE(name)), defaultValue, true, STRING_LITERAL(description)); \
-  static constexpr type name() { return defaultValue; }
+  static const type name() { return defaultValue; }
 #else

 #define RDOC_DEBUG_CONFIG(type, name, defaultValue, description)                         \


Need to move some owned handles

Need to move some owned handles

--- renderer/VulkanRenderer.h
+++ renderer/VulkanRenderer.h
@@ -497,8 +497,8 @@
 	, height(other.height)
 	, numSamples(other.numSamples)
 	, currentLayout(other.currentLayout)
-	, texture(other.texture)
-	, additionalView(other.additionalView)
+	, texture(std::move(other.texture))
+	, additionalView(std::move(other.additionalView))
 	, image(other.image)
 	, format(other.format)
 	, imageView(other.imageView)


Use introspection queue for remaining TpChannel introspection

20080527163451-53eee-13ca2f3326d8308df0a7d48b670d100d1d974828.gz

--- telepathy-glib/channel.c
+++ telepathy-glib/channel.c
@@ -358,19 +358,25 @@
       DEBUG ("%p: GetHandle() failed: %s", self, error->message);
     }

-  if (self->channel_type == 0)
-    {
-      tp_cli_channel_call_get_channel_type (self, -1,
-          tp_channel_got_channel_type_cb, NULL, NULL, NULL);
+  _tp_channel_continue_introspection (self);
+}
+
+
+static void
+_tp_channel_get_handle (TpChannel *self)
+{
+  if (self->handle_type == TP_UNKNOWN_HANDLE_TYPE
+      || (self->handle == 0 && self->handle_type != TP_HANDLE_TYPE_NONE))
+    {
+      tp_cli_channel_call_get_handle (self, -1,
+          tp_channel_got_handle_cb, NULL, NULL, NULL);
     }
   else
     {
-      tp_proxy_add_interface_by_id ((TpProxy *) self, self->channel_type);
-
-      tp_cli_channel_call_get_interfaces (self, -1,
-          tp_channel_got_interfaces_cb, NULL, NULL, NULL);
-    }
-}
+      _tp_channel_continue_introspection (self);
+    }
+}
+

 static void
 tp_channel_closed_cb (TpChannel *self,
@@ -448,16 +454,10 @@
   g_queue_push_tail (self->priv->introspect_needed,
       _tp_channel_get_interfaces);

-  if (self->handle_type == TP_UNKNOWN_HANDLE_TYPE
-      || (self->handle == 0 && self->handle_type != TP_HANDLE_TYPE_NONE))
-    {
-      tp_cli_channel_call_get_handle (self, -1,
-          tp_channel_got_handle_cb, NULL, NULL, NULL);
-    }
-  else
-    {
-      _tp_channel_continue_introspection (self);
-    }
+  g_queue_push_tail (self->priv->introspect_needed,
+      _tp_channel_get_handle);
+
+  _tp_channel_continue_introspection (self);

   return (GObject *) self;
 }


Changed the accessibility of `ThreadPoolExecutor`'s protected virtual functions.

Summary: The virtual functions marked `protected` in `ThreadPoolExecutor` should be marked `protected` in `EDFThreadPoolExecutor`.

Reviewed By: yfeldblum

Differential Revision: D15008767

fbshipit-source-id: 6bad51068a8b64f623643e0d0deb684ed6e2be22

--- folly/executors/EDFThreadPoolExecutor.h
+++ folly/executors/EDFThreadPoolExecutor.h
@@ -57,11 +57,12 @@

   folly::Executor::KeepAlive<> deadlineExecutor(uint64_t deadline);

- private:
+ protected:
   void threadRun(ThreadPtr thread) override;
   void stopThreads(std::size_t numThreads) override;
   std::size_t getPendingTaskCountImpl() const override;

+ private:
   bool shouldStop();
   std::shared_ptr<Task> take();


kos: fix RLE in gdb_stub (Richard Moats)


dstore JSON plugin: better support for storing a non-JSON originated data tree

--- plugins/CORE/dstorepluginJSONPARSER/src/DLLMainDSTOREpluginJSONPARSER.c
+++ plugins/CORE/dstorepluginJSONPARSER/src/DLLMainDSTOREpluginJSONPARSER.c
@@ -66,6 +66,7 @@
     TIOAccess* fptr;
     json_value* jsonDoc;
     json_value* currentJsonNode;
+    char activeNodeIsValueNode;
 };
 typedef struct SDestFileData TDestFileData;

@@ -115,6 +116,7 @@
         TDestFileData* fd = (TDestFileData*) malloc( sizeof( TDestFileData ) );
         memset( fd, 0, sizeof( TDestFileData ) );
         fd->fptr = outFile;
+        fd->activeNodeIsValueNode = 0;
         *filedata = fd;
         return 1;
     }
@@ -173,6 +175,8 @@
                              UInt32 haschildren   ) GUCEF_PLUGIN_CALLSPEC_SUFFIX
 {
     TDestFileData* fd = (TDestFileData*)*filedata;
+    fd->activeNodeIsValueNode = 0;
+
     if ( GUCEF_NULL == fd->currentJsonNode )
     {
         fd->jsonDoc = fd->currentJsonNode = json_object_new( attscount + haschildren );
@@ -187,7 +191,10 @@
         else
         if ( nodeType == GUCEF_DATATYPE_OBJECT )
         {
-            childNode = json_object_new( attscount + haschildren );
+            if ( 1 != attscount || 0 != haschildren )
+                childNode = json_object_new( attscount + haschildren );
+            else
+                fd->activeNodeIsValueNode = 1;
         }

         if ( GUCEF_NULL != childNode )
@@ -214,7 +221,9 @@
                            UInt32 haschildren   ) GUCEF_PLUGIN_CALLSPEC_SUFFIX
 {
     TDestFileData* fd = (TDestFileData*)*filedata;
-    fd->currentJsonNode = fd->currentJsonNode->parent;
+    if ( ( GUCEF_NULL != fd->currentJsonNode ) && ( 0 == fd->activeNodeIsValueNode ) )
+        fd->currentJsonNode = fd->currentJsonNode->parent;
+    fd->activeNodeIsValueNode = 0;
 }

 /*---------------------------------------------------------------------------*/
@@ -232,7 +241,8 @@
 {
     TDestFileData* fd = (TDestFileData*)*filedata;

-    if ( GUCEF_NULL == attname || 0 == attscount ) return;
+    if ( 0 == attscount )
+        return;

     if ( NULL == attvalue )
     {
@@ -263,7 +273,10 @@
                     json_array_push( fd->currentJsonNode, att );
                 else
                 if ( fd->currentJsonNode->type == json_object )
-                    json_object_push( fd->currentJsonNode, attname, att );
+                    if ( GUCEF_NULL != attname )
+                        json_object_push( fd->currentJsonNode, attname, att );
+                    else
+                        json_object_push( fd->currentJsonNode, nodename, att );
             }
             break;
         }
@@ -277,7 +290,10 @@
                     json_array_push( fd->currentJsonNode, att );
                 else
                 if ( fd->currentJsonNode->type == json_object )
-                    json_object_push( fd->currentJsonNode, attname, att );
+                    if ( GUCEF_NULL != attname )
+                        json_object_push( fd->currentJsonNode, attname, att );
+                    else
+                        json_object_push( fd->currentJsonNode, nodename, att );
             }
             break;
         }
@@ -293,7 +309,10 @@
                     json_array_push( fd->currentJsonNode, att );
                 else
                 if ( fd->currentJsonNode->type == json_object )
-                    json_object_push( fd->currentJsonNode, attname, att );
+                    if ( GUCEF_NULL != attname )
+                        json_object_push( fd->currentJsonNode, attname, att );
+                    else
+                        json_object_push( fd->currentJsonNode, nodename, att );
             }
             break;
         }
@@ -314,7 +333,10 @@
                     json_array_push( fd->currentJsonNode, att );
                 else
                 if ( fd->currentJsonNode->type == json_object )
-                    json_object_push( fd->currentJsonNode, attname, att );
+                    if ( GUCEF_NULL != attname )
+                        json_object_push( fd->currentJsonNode, attname, att );
+                    else
+                        json_object_push( fd->currentJsonNode, nodename, att );
             }
             break;
         }
@@ -326,7 +348,10 @@
                 json_array_push( fd->currentJsonNode, att );
             else
             if ( fd->currentJsonNode->type == json_object )
-                json_object_push( fd->currentJsonNode, attname, att );
+                if ( GUCEF_NULL != attname )
+                    json_object_push( fd->currentJsonNode, attname, att );
+                else
+                    json_object_push( fd->currentJsonNode, nodename, att );
             break;
         }
     }


Markup fix.

Markup fix.

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@28447 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/include/deal.II/multigrid/mg_transfer_component.h
+++ deal.II/include/deal.II/multigrid/mg_transfer_component.h
@@ -1,7 +1,7 @@
 //---------------------------------------------------------------------------
 //    $Id$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012, 2013 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -69,12 +69,12 @@
    * This function is only called
    * by derived classes. These can
    * also set the member variables
-   * #selected and #mg_selected to
+   * selected_component and mg_selected_component member variables to
    * restrict the transfer matrices
    * to certain components.
    * Furthermore, they use
-   * #target_component and
-   * #mg_target_component for
+   * target_component and
+   * mg_target_component for
    * re-ordering and grouping of
    * components.
    */


Got rid of the include of "types.h" since it is now included by an earlier include.

--- delta.c
+++ delta.c
@@ -77,7 +77,6 @@
 #include "trace.h"
 #include "checksum.h"
 #include "search.h"
-#include "types.h"

 /**


Added underline to same frag routine

Added underline to same frag routine

--- reportlab/lib/_rl_accel.c
+++ reportlab/lib/_rl_accel.c
@@ -2,10 +2,10 @@
 #copyright ReportLab Inc. 2000
 #see license.txt for license details
 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/lib/_rl_accel.c?cvsroot=reportlab
-#$Header: /tmp/reportlab/reportlab/lib/_rl_accel.c,v 1.32 2003/01/12 12:25:03 rgbecker Exp $
+#$Header: /tmp/reportlab/reportlab/lib/_rl_accel.c,v 1.33 2003/04/22 12:30:19 rgbecker Exp $
  ****************************************************************************/
 #if 0
-static __version__=" $Id: _rl_accel.c,v 1.32 2003/01/12 12:25:03 rgbecker Exp $ "
+static __version__=" $Id: _rl_accel.c,v 1.33 2003/04/22 12:30:19 rgbecker Exp $ "
 #endif
 #include <Python.h>
 #include <stdlib.h>
@@ -27,7 +27,7 @@
 #ifndef min
 #	define min(a,b) ((a)<(b)?(a):(b))
 #endif
-#define VERSION "0.41"
+#define VERSION "0.42"
 #define MODULE "_rl_accel"
 #ifndef	ATTRDICT
 	#if PY_MAJOR_VERSION>=2
@@ -715,7 +715,7 @@
 static PyObject *_sameFrag(PyObject *self, PyObject* args)
 {
 	PyObject *f, *g;
-	static char *names[] = {"fontName", "fontSize", "textColor", "rise", NULL};
+	static char *names[] = {"fontName", "fontSize", "textColor", "rise", "underline", NULL};
 	int	r=0, t;
 	char **p;
 	if (!PyArg_ParseTuple(args, "OO:_sameFrag", &f, &g)) return NULL;


layout=index: Don't crash on mailbox_update() if the mailbox path couldn't be found.

--- src/lib-storage/list/mailbox-list-index-backend.c
+++ src/lib-storage/list/mailbox-list-index-backend.c
@@ -337,7 +337,7 @@
 		return -1;

 	/* rename the directory */
-	if (!guid_128_is_empty(update->mailbox_guid) &&
+	if (!guid_128_is_empty(update->mailbox_guid) && old_path != NULL &&
 	    mailbox_list_set_get_root_path(&box->list->set,
 					   MAILBOX_LIST_PATH_TYPE_MAILBOX,
 					   &root_dir)) {


lwip: Merge upstream commit "tcp: Avoid 3-second delay for a half-open connection"

Upstream commit: 2e26fc9224b019f5630258c0198cd0148766cb82

--- lwip/src/core/tcp_in.c
+++ lwip/src/core/tcp_in.c
@@ -751,6 +751,10 @@
       /* send a RST to bring the other side in a non-synchronized state. */
       tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(),
         ip_current_src_addr(), tcphdr->dest, tcphdr->src);
+      /* Resend SYN immediately (don't wait for rto timeout) to establish
+        connection faster */
+      pcb->rtime = 0;
+      tcp_rexmit_rto(pcb);
     }
     break;
   case SYN_RCVD:


Removal of compile-time warnings

Removal of compile-time warnings

--- src/lib/transport/socket/storagestub/sstub_conn.c
+++ src/lib/transport/socket/storagestub/sstub_conn.c
@@ -108,12 +108,12 @@

     if(data == NULL) {
       fprintf(stderr, "create_rpc_server: NULL arguments passed\n");
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     if((rpcfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
       perror("socket");
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     bzero(&servaddr, sizeof(struct sockaddr_in));
@@ -124,23 +124,23 @@
     if(bind(rpcfd, (struct sockaddr *) &servaddr,
 	    sizeof(struct sockaddr_in)) < 0) {
       perror("bind");
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     transp = svctcp_create(rpcfd, BUFSIZ, BUFSIZ);
     if (transp == NULL) {
       fprintf (stderr, "%s", "cannot create TS-RPC tcp service.");
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     pmap_unset(CLIENTCONTENT_PROG, CLIENTCONTENT_VERS);

     if (!svc_register(transp, CLIENTCONTENT_PROG, CLIENTCONTENT_VERS,
-		 clientcontent_prog_2, NULL)) {
+		      clientcontent_prog_2, 0)) {
       fprintf(stderr, "(TS-RPC server) unable to register \"client to "
 	      "content\" program (prognum=0x%x, versnum=%d, tcp)\n",
 	      CLIENTCONTENT_PROG, CLIENTCONTENT_VERS);
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     *(data->control_ready) = 1;       /* Signal the parent thread that
@@ -149,7 +149,7 @@

     svc_run();
     fprintf(stderr, "create_rpc_server: svc_run returned!\n");
-    pthread_exit(-1);
+    pthread_exit((void *)-1);
 }

@@ -198,7 +198,7 @@
     /* Create new connection to the TS-RPC server. */
     if((connfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
       perror("socket");
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     bzero(&hints,  sizeof(struct addrinfo));
@@ -209,12 +209,12 @@

     if((error = getaddrinfo("localhost", port_str, &hints, &info)) < 0) {
       fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     if(connect(connfd, info->ai_addr, sizeof(struct sockaddr_in)) < 0) {
       perror("sunrpc connect");
-      pthread_exit(-1);
+      pthread_exit((void *)-1);
     }

     freeaddrinfo(info);
@@ -273,7 +273,7 @@
 			cstate->flags &= ~CSTATE_ALLOCATED;
 			pthread_mutex_unlock(&cstate->cmutex);
 			printf("exiting thread \n");
-			pthread_exit(0);
+			pthread_exit((void *)0);
 		}

 		FD_ZERO(&cstate->read_fds);


wdk now deserializes

wdk now deserializes

--- src/libshogun/kernel/WeightedDegreeStringKernel.h
+++ src/libshogun/kernel/WeightedDegreeStringKernel.h
@@ -969,7 +969,7 @@

 				::new(t)shogun::CWeightedDegreeStringKernel(lhs, rhs, degree);

-				t->set_max_mismatch(max_mismatch);
+				//t->set_max_mismatch(max_mismatch);

 				std::cout << "done loading WDK from non-defaultconstruct data" << std::endl;
 			}


Cleanup stack after error

Cleanup stack after error

--- lua-extension/glirc-lua.c
+++ lua-extension/glirc-lua.c
@@ -286,6 +286,7 @@
                 size_t len = 0;
                 const char *msg = lua_tolstring(L, -1, &len);
                 glirc_print(glirc, ERROR_MESSAGE, msg, len);
+                lua_settop(L, 0); // discard error message
         }
 }


ensure commit of reused cached segments

ensure commit of reused cached segments

--- src/segment.c
+++ src/segment.c
@@ -359,13 +359,16 @@
         protection_still_good = true; // otherwise, the guard pages are still in place
       }
     }
+    if (page_kind != MI_PAGE_SMALL && !mi_option_is_enabled(mi_option_eager_commit) &&
+      (mi_option_is_enabled(mi_option_cache_reset) || mi_option_is_enabled(mi_option_page_reset))) {
+      _mi_os_commit(segment, segment->segment_size, tld->stats);
+    }
   }
   // and otherwise allocate it from the OS
   else {
     segment = (mi_segment_t*)_mi_os_alloc_aligned(segment_size, MI_SEGMENT_SIZE, commit, os_tld);
     if (segment == NULL) return NULL;
     mi_segments_track_size((long)segment_size,tld);
-
   }
   mi_assert_internal(segment != NULL && (uintptr_t)segment % MI_SEGMENT_SIZE == 0);
   if (!commit) {


engine: fix memory leak

engine: fix memory leak

Signed-off-by: Sébastien Boisvert <1a4d2e25eb5ba040b6ad5779a730a1a8a0ff9bc5@anl.gov>

--- engine/actor.c
+++ engine/actor.c
@@ -1654,6 +1654,7 @@
     struct bsal_message new_message;
     struct bsal_fifo *queue;
     int destination;
+    void *buffer_to_release;

     queue = NULL;
     destination = -1;
@@ -1696,6 +1697,9 @@
                         bsal_message_source(&new_message));
         bsal_actor_send(actor, destination, &new_message);

+        buffer_to_release = bsal_message_buffer(&new_message);
+        free(buffer_to_release);
+
         /* recursive actor call
          */
         bsal_actor_send_to_self_empty(actor, BSAL_ACTOR_FORWARD_MESSAGES);


Fix MS compiler error

Fix MS compiler error

git-svn-id: 9ed0004971709408f906b8bdafa7f98a7bcab630@630 f854266a-e20d-0410-a9be-8852184c940f

--- iaxclient/lib/libspeex/include/speex/speex_echo.h
+++ iaxclient/lib/libspeex/include/speex/speex_echo.h
@@ -63,7 +63,16 @@
    float *Y2;
    float *E;
    float *PHI;
+#if defined(_MSC_VER)
+# if ((_MSC_VER < 1300) || (_MSC_VER >= 1400))
+   /* this works with older or newer MS compilers, but not .Net 2002 or 2003 */
+   float * __restrict W;
+# else
+   float * W;
+# endif
+#else
    float * restrict W;
+#endif
    float *power;
    float *power_1;
    float *grad;


Trivial spelling fix.

Trivial spelling fix.

--- include/BALL/STRUCTURE/assignBondOrderProcessor.h
+++ include/BALL/STRUCTURE/assignBondOrderProcessor.h
@@ -49,7 +49,7 @@

 namespace BALL
 {
-	/**	Bond Order assignment processor
+	/**	Bond Order Assignment Processor
 			\ingroup StructureMiscellaneous
 	*/


x64: Missing c_exit_hook

x64: Missing c_exit_hook

--- include/arch/x86/arch/64/mode/fastpath/fastpath.h
+++ include/arch/x86/arch/64/mode/fastpath/fastpath.h
@@ -94,6 +94,8 @@
 static inline void NORETURN
 fastpath_restore(word_t badge, word_t msgInfo, tcb_t *cur_thread)
 {
+    c_exit_hook();
+
     if (unlikely(cur_thread == x86KSfpuOwner)) {
         /* We are using the FPU, make sure it is enabled */
         enableFpu();


Move the typedef definition before private section.

--- include/cling/Interpreter/DynamicLibraryManager.h
+++ include/cling/Interpreter/DynamicLibraryManager.h
@@ -22,6 +22,16 @@
   ///\brief A helper class managing dynamic shared objects.
   ///
   class DynamicLibraryManager {
+  public:
+    ///\brief Describes the result of loading a library.
+    ///
+    enum LoadLibResult {
+      kLoadLibSuccess, // library loaded successfully
+      kLoadLibExists,  // library was already loaded
+      kLoadLibError, // library was not found
+      kLoadLibNumResults
+    };
+
   private:
     typedef const void* DyLibHandle;
     typedef llvm::DenseMap<DyLibHandle, std::string> DyLibs;
@@ -38,15 +48,6 @@
                             bool isAbsolute, bool& exists, bool& isDyLib);

   public:
-    ///\brief Describes the result of loading a library.
-    ///
-    enum LoadLibResult {
-      kLoadLibSuccess, // library loaded successfully
-      kLoadLibExists,  // library was already loaded
-      kLoadLibError, // library was not found
-      kLoadLibNumResults
-    };
-
     DynamicLibraryManager(const InvocationOptions& Opts);
     ~DynamicLibraryManager();


Add visibility attribute for InstCombinePass (r226987).

Warning by gcc:
'llvm::InstCombinePass' declared with greater visibility than the type of its field 'llvm::InstCombinePass::Worklist' [-Wattributes]

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

--- include/llvm/Transforms/InstCombine/InstCombine.h
+++ include/llvm/Transforms/InstCombine/InstCombine.h
@@ -24,7 +24,7 @@

 namespace llvm {

-class InstCombinePass {
+class LLVM_LIBRARY_VISIBILITY InstCombinePass {
   InstCombineWorklist Worklist;

 public:


packetizer: h264: set frame rate from vui when possible

--- modules/packetizer/h264.c
+++ modules/packetizer/h264.c
@@ -757,8 +757,13 @@
         p_sys->b_cpb_dpb_delays_present_flag = p_sps->vui.b_cpb_dpb_delays_present_flag;
         p_sys->i_cpb_removal_delay_length_minus1 = p_sps->vui.i_cpb_removal_delay_length_minus1;
         p_sys->i_dpb_output_delay_length_minus1 = p_sps->vui.i_dpb_output_delay_length_minus1;
-    }
-
+
+        if( p_sps->vui.b_fixed_frame_rate && !p_dec->fmt_out.video.i_frame_rate_base )
+        {
+            p_dec->fmt_out.video.i_frame_rate_base = p_sps->vui.i_num_units_in_tick;
+            p_dec->fmt_out.video.i_frame_rate = p_sps->vui.i_time_scale;
+        }
+    }
     /* We have a new SPS */
     if( !p_sys->b_sps )
         msg_Dbg( p_dec, "found NAL_SPS (sps_id=%d)", p_sps->i_id );


Isn't required any authentication to download a photo.

--- gfbgraph/gfbgraph-photo.c
+++ gfbgraph/gfbgraph-photo.c
@@ -287,7 +287,6 @@
         request = soup_requester_request (requester, priv->source, error);
         if (request != NULL) {
                 message = soup_request_http_get_message (SOUP_REQUEST_HTTP (request));
-                gfbgraph_authorizer_process_message (authorizer, message);

                 stream = soup_request_send (request, NULL, error);
                 if (stream != NULL) {


[project @ 2001-02-28 14:24:46 by sewardj] Don't do a prototype for tcSetAttr if !HAVE_TERMIOS_H.

--- ghc/lib/std/cbits/stgio.h
+++ ghc/lib/std/cbits/stgio.h
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: stgio.h,v 1.25 2001/01/16 14:06:14 simonmar Exp $
+ * $Id: stgio.h,v 1.26 2001/02/28 14:24:46 sewardj Exp $
  *
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1999
  *
@@ -172,8 +172,8 @@
 /* tcSetAttr.c */
 #ifdef HAVE_TERMIOS_H
 #include <termios.h>
+int tcSetAttr (int fd, int options, const struct termios *tp);
 #endif
-int tcSetAttr (int fd, int options, const struct termios *tp);

 #endif /* ! STGIO_H */


fixes for signedness warnings

fixes for signedness warnings

svn path=/trunk/; revision=1068

--- gmime/gmime-stream-mmap.c
+++ gmime/gmime-stream-mmap.c
@@ -257,7 +257,7 @@
 		break;
 	case GMIME_STREAM_SEEK_END:
 		if (stream->bound_end == -1) {
-			real = offset <= 0 ? stream->bound_start + mstream->maplen + offset : -1;
+			real = offset <= 0 ? stream->bound_start + (off_t) mstream->maplen + offset : -1;
 			if (real != -1) {
 				if (real < stream->bound_start)
 					real = stream->bound_start;


refactoring metric initializer

refactoring metric initializer

--- gmm/itkInitializeMetric.h
+++ gmm/itkInitializeMetric.h
@@ -20,23 +20,23 @@
     itkNewMacro(Self);
     itkTypeMacro(InitializeMetric, Object);

+    /** typedefs */
+    typedef itk::GMMPointSetToPointSetMetricBase<TFixedPointSet, TMovingPointSet> MetricType;
+
+    // define type of metric
     enum class Metric
     {
       GMML2Rigid,
       GMML2,
-      GMMKC,
+      GMMKC
     };

-    /** typedefs */
-    typedef itk::GMMPointSetToPointSetMetricBase<TFixedPointSet, TMovingPointSet> MetricType;
+    itkSetEnumMacro(TypeOfMetric, Metric);
+    itkGetEnumMacro(TypeOfMetric, Metric);
+    void SetTypeOfMetric(const size_t & type) { this->SetTypeOfMetric(static_cast<Metric>(type)); }

     // Get metric
     itkGetObjectMacro(Metric, MetricType);
-
-    // Set/Get type of metric
-    itkSetEnumMacro(TypeOfMetric, Metric);
-    itkGetEnumMacro(TypeOfMetric, Metric);
-    void SetTypeOfMetric(const size_t & type) { this->SetTypeOfMetric(static_cast<Metric>(type)); }

     void Initialize()
     {
@@ -57,6 +57,10 @@
         break;
       }
       }
+
+      if (m_Metric == nullptr) {
+        itkExceptionMacro(<< "metric has not been initialized.");
+      }
     }

     void PrintReport() const
@@ -68,9 +72,12 @@

   protected:
     Metric m_TypeOfMetric;
-    typename MetricType::Pointer m_Metric = nullptr;
+    typename MetricType::Pointer m_Metric;

-    InitializeMetric() {}
+    InitializeMetric()
+    {
+      m_Metric = nullptr;
+    }
     ~InitializeMetric() {}
   };
 }


trim selector

trim selector

--- src/gainer.c
+++ src/gainer.c
@@ -106,11 +106,12 @@

 int service(int fd) {
 	int n;
-	char buf[256];
+	char buf[256], *ptr;
 	memset(buf, 0, 256);
 	if ((n=read(fd,buf,255)) < 0)
 		error(1, errno, "read");
-	buf[255] = 0;
+	buf[n] = 0;
+	if ((ptr=strpbrk(buf,"\r\n"))) *ptr = 0;
 	char path[PATH_MAX], tpath[PATH_MAX], *doc;
 	snprintf(tpath, PATH_MAX - 1, "%s/%s", docroot, buf);
 	realpath(tpath, path);
@@ -122,7 +123,7 @@
 	struct stat info;
 	if (stat(path, &info) != 0) {
 		write(fd, notfound, sizeof(notfound));
-		error(0, errno, "serve");
+		error(0, errno, "service");
 	}
 	else if (S_ISDIR(info.st_mode)) serve_dir(fd, path);
 	else if (S_ISREG(info.st_mode)) serve_file(fd, path);


Remove OBJECT_WITH_SYMBOL in global.h

Remove OBJECT_WITH_SYMBOL in global.h

--- src/global.h
+++ src/global.h
@@ -20,19 +20,6 @@
 extern "C" {
 #endif

-  /*
-#define OBJECT_WITH_SYMBOL\
-  mrb_sym sym_id;\
-  mrb_object obj
-
-typedef struct GLOBAL_OBJECT {
-  OBJECT_WITH_SYMBOL;
-} mrb_globalobject;
-
-typedef struct CONST_OBJECT {
-  OBJECT_WITH_SYMBOL;
-} mrb_constobject;
-  */

 void  mrbc_init_global(void);


fix for Solaris Express 11 with CC 5.

fix for Solaris Express 11 with CC 5.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@41660 27541ba8-7e3a-0410-8455-c3a389f83636

--- math/mathcore/inc/TMath.h
+++ math/mathcore/inc/TMath.h
@@ -503,7 +503,7 @@

 inline Int_t TMath::IsNaN(Double_t x)
 #if defined(R__ANSISTREAM) || (defined(R__MACOSX) && defined(__arm__) )
-#ifdef isnan
+#if defined(isnan) || defined(R__SOLARIS_CC50)
    // from math.h
   { return ::isnan(x); }
 #else


Revise the bug in matlab interface. Bug:When transforming the model to matlab structure, don't malloc for sv_indices.

--- matlab/svm_model_matlab.c
+++ matlab/svm_model_matlab.c
@@ -10,7 +10,7 @@
 #endif
 #endif

-#define NUM_OF_RETURN_FIELD 10
+#define NUM_OF_RETURN_FIELD 11

 #define Malloc(type,n) (type *)malloc((n)*sizeof(type))


Add index on host

Add index on host

Help queries determining what hosts data is from.

--- etl/yams-etl.c
+++ etl/yams-etl.c
@@ -150,6 +150,11 @@
 		if (do_command(conn, sql) != 0)
 			return 1;
 	}
+
+	snprintf(sql, SQL_LEN,
+			"CREATE INDEX ON %s (host);", tablename);
+	if (do_command(conn, sql) != 0)
+		return 1;

 	return 0;
 }


function returns void

function returns void

--- signer/tools/v2/adfile.c
+++ signer/tools/v2/adfile.c
@@ -262,7 +262,8 @@

                 *status = ldns_rr_new_frm_str(&rr, line, new_ttl, *orig, prev);
                 if (*status == LDNS_STATUS_OK) {
-                    return ldns_rr2canonical(rr);
+                    ldns_rr2canonical(rr);
+                    return rr;
                 } else if (*status == LDNS_STATUS_SYNTAX_EMPTY) {
                     *status = LDNS_STATUS_OK;
                     if (rr) {


Get it right...

Get it right...

--- lib/version.c
+++ lib/version.c
@@ -33,7 +33,7 @@
  */

 #if defined(F_ID) || defined(DEBUG)
-char *fl_id_ver = "$Id: version.c,v 1.4 2003/04/10 21:30:55 leeming Exp $";
+char *fl_id_ver = "$Id: version.c,v 1.5 2003/04/10 21:44:33 leeming Exp $";
 #endif

 #include <stdio.h>
@@ -55,13 +55,14 @@
 int
 fl_library_version(int *ver, int *rev)
 {
-    int v, r = -1;
+    int const v = FL_VERSION;
+    int const r = FL_REVISION;
     int c = 0;

     if (rev)
-	*rev = FL_REVISION;
+	*rev = r;
     if (ver)
-	*ver = FL_VERSION;
+	*ver = v;

     return v * 1000 + r;
 }


Align _XXX_VALUE with the usage.

Align _XXX_VALUE with the usage.

The code uses _XXX_VALUE macros like this in `btls.c`:

```
switch(_XXX_VALUE(x)) {
   case _XXX_A: ...
   case _XXX_B: ...
}
```

The old _XXX_VALUE macros were written in a way that prevented `btls.c` from switching on them properly.

--- dsock.h
+++ dsock.h
@@ -287,7 +287,7 @@
 #define DSOCK_BTLS_DHEPARAMS_NONE         (0 << 13) /* default */
 #define DSOCK_BTLS_DHEPARAMS_AUTO         (1 << 13)
 #define DSOCK_BTLS_DHEPARAMS_LEGACY       (2 << 13)
-#define DSOCK_BTLS_DHEPARAMS_VALUE(x)     ((x >> 13) & 0x3)
+#define DSOCK_BTLS_DHEPARAMS_VALUE(x)     ((x) & (0x3 << 13))

 #define DSOCK_BTLS_ECDHECURVE_NONE        (1 << 15)
 #define DSOCK_BTLS_ECDHECURVE_AUTO        (0 << 15) /* default */
@@ -298,7 +298,7 @@
 #define DSOCK_BTLS_ECDHECURVE_SECP256K1   (6 << 15)
 #define DSOCK_BTLS_ECDHECURVE_SECP384R1   (7 << 15)
 #define DSOCK_BTLS_ECDHECURVE_SECP521R1   (8 << 15)
-#define DSOCK_BTLS_ECDHECURVE_VALUE(x)    ((x >> 15) & 0xf)
+#define DSOCK_BTLS_ECDHECURVE_VALUE(x)    ((x) & (0xf << 15))

 #define DSOCK_BTLS_CIPHERS_DEFAULT        (1 << 19)
 #define DSOCK_BTLS_CIPHERS_SECURE         (1 << 19) /* default */
@@ -306,12 +306,12 @@
 #define DSOCK_BTLS_CIPHERS_LEGACY         (3 << 19)
 #define DSOCK_BTLS_CIPHERS_INSECURE       (4 << 19)
 #define DSOCK_BTLS_CIPHERS_SPECIFIC       (5 << 19) /* see list below */
-#define DSOCK_BTLS_CIPHERS_VALUE(x)       ((x >> 19) & 0x7)
+#define DSOCK_BTLS_CIPHERS_VALUE(x)       ((x) & (0x7 << 19))

 #define DSOCK_BTLS_VERIFY_DEPTH_DEFAULT   (6 << 22)
 #define DSOCK_BTLS_VERIFY_DEPTH(X)        (X << 22)
 #define DSOCK_BTLS_VERIFY_DEPTH_MAX       (1 << 27)
-#define DSOCK_BTLS_VERIFY_VALUE(x)        ((x >> 22) & 0x1f)
+#define DSOCK_BTLS_VERIFY_VALUE(x)        ((x) & (0x1f << 22))

 /* BTLS v1.2 ciphers */
 #define DSOCK_BTLS_CIPHERS_ECDHE_RSA_AES256_GCM_SHA384       (1ull <<  0)


bugfix: handle then error of accept

bugfix: handle then error of accept

just close it when accept reach the limit on the number of open file
descriptors

--- silly-src/silly_socket.c
+++ silly-src/silly_socket.c
@@ -76,6 +76,9 @@

 struct silly_socket {
 	sp_t spfd;
+	//reverse for accept
+	//when reach the limit of file descriptor's number
+	int reservefd;
 	size_t eventcap;
 	//event
 	int eventindex;
@@ -83,7 +86,8 @@
 	sp_event_t *eventbuff;
 	//socket pool
 	struct socket *socketpool;
-	//ctrl pipe, call write can be automatic wen data less then 64k(from APUE)
+	//ctrl pipe, call write can be automatic
+	//when data less then 64k(from APUE)
 	int ctrlsendfd;
 	int ctrlrecvfd;
 	fd_set ctrlfdset;
@@ -311,8 +315,16 @@
 	assert(ADDRLEN >= INET_ADDRSTRLEN + 8);
 	socklen_t len = sizeof(struct sockaddr);
 	int fd = accept(listen->fd, (struct sockaddr *)&addr, &len);
-	if (unlikely(fd < 0))
+	if (unlikely(fd < 0)) {
+		if (errno != EMFILE)
+			return ;
+		close(ss->reservefd);
+		fd = accept(listen->fd, NULL, NULL);
+		close(fd);
+		silly_log("[socket] accept reach limit of file descriptor\n");
+		ss->reservefd = open("/dev/null", O_RDONLY);
 		return ;
+	}
 	sa = silly_malloc(sizeof(*sa) + ADDRLEN);
 	sa->data = (uint8_t *)(sa + 1);
 	sa->type = SILLY_SACCEPT;
@@ -1329,6 +1341,7 @@
 	if (unlikely(err < 0))
 		goto end;
 	ss->spfd = spfd;
+	ss->reservefd = open("/dev/null", O_RDONLY);
 	ss->ctrlsendfd = fd[1];
 	ss->ctrlrecvfd = fd[0];
 	ss->eventindex = 0;
@@ -1357,6 +1370,7 @@
 	int i;
 	assert(SSOCKET);
 	sp_free(SSOCKET->spfd);
+	close(SSOCKET->reservefd);
 	close(SSOCKET->ctrlsendfd);
 	close(SSOCKET->ctrlrecvfd);