fixed bug #681: member variable was not set in constructor (thanks Bhaskara!)

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@5668 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- segmentation/include/pcl/segmentation/sac_segmentation.h
+++ segmentation/include/pcl/segmentation/sac_segmentation.h
@@ -82,7 +82,7 @@
       /** \brief Empty constructor. */
       SACSegmentation () :  model_ (), sac_ (), model_type_ (-1), method_type_ (0),
                             threshold_ (0), optimize_coefficients_ (true),
-                            radius_min_ (-std::numeric_limits<double>::max()), radius_max_ (std::numeric_limits<double>::max()), eps_angle_ (0.0),
+                            radius_min_ (-std::numeric_limits<double>::max()), radius_max_ (std::numeric_limits<double>::max()), samples_radius_ (0.0), eps_angle_ (0.0),
                             axis_ (Eigen::Vector3f::Zero ()), max_iterations_ (50), probability_ (0.99)
       {
         //srand ((unsigned)time (0)); // set a random seed


Optimized sump critical part and Lock Kernel during get_samples()

--- hydrabus/hydrabus_sump.c
+++ hydrabus/hydrabus_sump.c
@@ -80,20 +80,35 @@
 	tim_init();
 }

+static void get_samples(void) __attribute__((optimize("-O3")));
 static void get_samples(void)
 {
+	uint32_t config_state;
+	config_state = config.state;
+
+	/* Lock Kernel for logic analyzer */
+	chSysLock();
+
 	HAL_TIM_Base_Start(&htim);

-	if(config.state == SUMP_STATE_ARMED) {
-		while(1) {
+	if(config_state == SUMP_STATE_ARMED)
+	{
+		uint32_t config_trigger_value;
+		uint32_t config_trigger_mask;
+
+		config_trigger_value =  config.trigger_values[0];
+		config_trigger_mask = config.trigger_masks[0];
+
+		while(1)
+		{
 			while( !(TIM4->SR & TIM_SR_UIF)) {
 				//Wait for timer...
 			}

 			*(buffer+INDEX) = GPIOC->IDR;
 			TIM4->SR &= ~TIM_SR_UIF;  //clear overflow flag
-			if ( !((*(buffer+INDEX) ^ config.trigger_values[0]) & config.trigger_masks[0]) ) {
-				config.state = SUMP_STATE_TRIGGED;
+			if ( !((*(buffer+INDEX) ^ config_trigger_value) & config_trigger_mask) ) {
+				config_state = SUMP_STATE_TRIGGED;
 				break;
 			}
 			INDEX++;
@@ -101,20 +116,25 @@
 		}
 	}

-	if(config.state == SUMP_STATE_TRIGGED) {
-		while(config.delay_count > 0) {
+	if(config_state == SUMP_STATE_TRIGGED)
+	{
+		register uint32_t config_delay_count = config.delay_count;
+
+		while(config_delay_count > 0)
+		{
 			while( !(TIM4->SR & TIM_SR_UIF)) {
 				//Wait for timer...
 			}

 			*(buffer+INDEX) = GPIOC->IDR;
 			TIM4->SR &= ~TIM_SR_UIF;  //clear overflow flag
-			config.delay_count--;
+			config_delay_count--;
 			INDEX++;
 			INDEX &= STATES_LEN-1;
 		}
 	}

+	chSysUnlock();
 	config.state = SUMP_STATE_IDLE;
 	HAL_TIM_Base_Stop(&htim);
 }
@@ -133,6 +153,7 @@
 	}
 }

+int cmd_sump(t_hydra_console *con, __attribute__((unused)) t_tokenline_parsed *p) __attribute__((optimize("-O3")));
 int cmd_sump(t_hydra_console *con, __attribute__((unused)) t_tokenline_parsed *p)
 {


* subversion/libsvn_ra_dav/session.c (svn_ra_dav__get_repos_root): Fix
  crash caused by allocating the repository root URL in the temporary pool
  instead of the session pool (and then caching it in the session).
  There is no test for this since it will be covered by my next commit, which
  triggered this bug.

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

--- subversion/libsvn_ra_dav/session.c
+++ subversion/libsvn_ra_dav/session.c
@@ -846,7 +846,7 @@
       url_buf = svn_stringbuf_create(ras->url, pool);
       svn_path_remove_components
         (url_buf, svn_path_component_count(bc_relative.data));
-      ras->repos_root = url_buf->data;
+      ras->repos_root = apr_pstrdup(ras->pool, url_buf->data);
     }

   *url = ras->repos_root;


Fix issue #3119.

Fix issue #3119.

* subversion/libsvn_ra_neon/commit.c
  (commit_add_file): Ensure that a file does not exist in both the working url
   (the path within the transaction) and the public url (the path in HEAD),
   since we do not have a way to find the deleted items.

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

--- subversion/libsvn_ra_neon/commit.c
+++ subversion/libsvn_ra_neon/commit.c
@@ -1011,9 +1011,9 @@

   /* If the parent directory existed before this commit then there may be a
      file with this URL already. We need to ensure such a file does not
-     exist, which we do by attempting a PROPFIND.  Of course, a
-     PROPFIND *should* succeed if this "add" is actually the second
-     half of a "replace".
+     exist, which we do by attempting a PROPFIND in both public URL (the path
+     in HEAD) and the working URL (the path within the transaction), since
+     we cannot differentiate between deleted items.

      ### For now, we'll assume that if this path has already been
      added to the valid targets hash, that addition occurred during the
@@ -1024,25 +1024,31 @@
       && (! apr_hash_get(file->cc->valid_targets, path, APR_HASH_KEY_STRING)))
     {
       svn_ra_neon__resource_t *res;
-      svn_error_t *err = svn_ra_neon__get_starting_props(&res,
-                                                         file->cc->ras,
-                                                         file->rsrc->wr_url,
-                                                         NULL, workpool);
-      if (!err)
+      svn_error_t *err1 = svn_ra_neon__get_starting_props(&res,
+                                                          file->cc->ras,
+                                                          file->rsrc->wr_url,
+                                                          NULL, workpool);
+      svn_error_t *err2 = svn_ra_neon__get_starting_props(&res,
+                                                          file->cc->ras,
+                                                          file->rsrc->url,
+                                                          NULL, workpool);
+      if (! err1 && ! err2)
         {
-          /* If the PROPFIND succeeds the file already exists */
+          /* If the PROPFINDs succeed the file already exists */
           return svn_error_createf(SVN_ERR_RA_DAV_ALREADY_EXISTS, NULL,
                                    _("File '%s' already exists"),
                                    file->rsrc->url);
         }
-      else if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
+      else if ((err1 && (err1->apr_err == SVN_ERR_FS_NOT_FOUND))
+               || (err2 && (err2->apr_err == SVN_ERR_FS_NOT_FOUND)))
         {
-          svn_error_clear(err);
+          svn_error_clear(err1);
+          svn_error_clear(err2);
         }
       else
         {
           /* A real error */
-          return err;
+          return svn_error_compose_create(err1, err2);
         }
     }


adding a macro to use rgb hex color

adding a macro to use rgb hex color

--- TFTColor/UIColor+TFT.h
+++ TFTColor/UIColor+TFT.h
@@ -7,6 +7,8 @@
 //

 #import <UIKit/UIKit.h>
+
+#define ColorWithRGBHex(hex)    [UIColor colorWithRGBHex:hex]

 @interface UIColor (TFT)


Fix file descriptor leakage in svnsync over ra_serf to ra_local. Limit the
lifetime of the file related pool (delta...) to the lifetime of the commit
editor pool.

This is a follow up to r1102690.

* subversion/libsvn_ra_serf/replay.c
  (start_replay): create file_pool as child of dst_rev_pool...
  (svn_ra_serf__replay): ... not of the global session pool.

--- subversion/libsvn_ra_serf/replay.c
+++ subversion/libsvn_ra_serf/replay.c
@@ -197,6 +197,7 @@

       /* Create a pool for the commit editor. */
       ctx->dst_rev_pool = svn_pool_create(ctx->src_rev_pool);
+      ctx->file_pool = svn_pool_create(ctx->dst_rev_pool);

       /* ### it would be nice to have a proper scratch_pool.  */
       SVN_ERR(svn_ra_serf__select_revprops(&ctx->props,
@@ -653,7 +654,6 @@

   replay_ctx = apr_pcalloc(pool, sizeof(*replay_ctx));
   replay_ctx->src_rev_pool = pool;
-  replay_ctx->file_pool = svn_pool_create(pool);
   replay_ctx->editor = editor;
   replay_ctx->editor_baton = edit_baton;
   replay_ctx->done = FALSE;


First part of 'blame -g' rework.  Instead of commingling the merged and
mainline revisions, uncommingle them into separate lists, and mingle them when
transmitting.

This completely breaks 'blame -g' functionality but...it's been broken
for the last few weeks anyway, and the appropriate tests are already
marked XFail.  This lays the groundwork for a fix to the problem.

[Note: r29069 followed up by fixing 'blame -g'.]

* subversion/libsvn_repos/rev_hunt.c
  (svn_repos_get_file_revs2): Implement a 2-step process for finding the
   mainline and merged revisions
  (get_merged_revisions): New.  Currently a stub.
  (sort_and_scrub_revisions, compare_path_revision_revs): Remove.
  (find_interesting_revisions): Don't mark revisions as merged or not.
  (get_merged_path_revisions): Catch FS_NOT_FOUND error.
  (path_revisions): Update structure.

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

--- subversion/libsvn_repos/rev_hunt.c
+++ subversion/libsvn_repos/rev_hunt.c
@@ -42,7 +42,6 @@
                            svn_revnum_t start,
                            svn_revnum_t end,
                            svn_boolean_t include_merged_revisions,
-                           svn_boolean_t mark_as_merged,
                            apr_hash_t *duplicate_path_revs,
                            svn_repos_authz_func_t authz_read_func,
                            void *authz_read_baton,
@@ -1058,8 +1057,10 @@
   svn_revnum_t revnum;
   const char *path;

-  /* Merged revision flag.  This is set if the path/revision pair is the
-     result of a merge. */
+  /* Does this path_rev have merges to also be included?  */
+  apr_hash_t *merged_mergeinfo;
+
+  /* Is this a merged revision? */
   svn_boolean_t merged_revision;
 };

@@ -1111,12 +1112,13 @@
           /* Search and find revisions to add to the PATH_REVISIONS list. */
           err = find_interesting_revisions(path_revisions, repos, path,
                                            range->start, range->end,
-                                           TRUE, TRUE, duplicate_path_revs,
+                                           TRUE, duplicate_path_revs,
                                            authz_read_func, authz_read_baton,
                                            pool);
           if (err)
             {
-              if (err->apr_err == SVN_ERR_FS_NOT_FILE)
+              if (err->apr_err == SVN_ERR_FS_NOT_FILE
+                    || err->apr_err == SVN_ERR_FS_NOT_FOUND)
                 svn_error_clear(err);
               else
                 return err;
@@ -1137,7 +1139,6 @@
                            svn_revnum_t start,
                            svn_revnum_t end,
                            svn_boolean_t include_merged_revisions,
-                           svn_boolean_t mark_as_merged,
                            apr_hash_t *duplicate_path_revs,
                            svn_repos_authz_func_t authz_read_func,
                            void *authz_read_baton,
@@ -1198,7 +1199,6 @@
         }

       path_rev->path = apr_pstrdup(pool, path_rev->path);
-      path_rev->merged_revision = mark_as_merged;
       APR_ARRAY_PUSH(path_revisions, struct path_revision *) = path_rev;

       /* Add the path/rev pair to the hash, so we can filter out future
@@ -1228,63 +1228,23 @@
   return SVN_NO_ERROR;
 }

-
-static int
-compare_path_revision_revs(const void *a, const void *b)
-{
-  const struct path_revision *a_path_rev = *(const struct path_revision **)a;
-  const struct path_revision *b_path_rev = *(const struct path_revision **)b;
-
-  if (a_path_rev->revnum == b_path_rev->revnum)
-    {
-      int strcmp_result = strcmp(a_path_rev->path, b_path_rev->path);
-
-      if (strcmp_result == 0)
-        {
-          if (a_path_rev->merged_revision == b_path_rev->merged_revision)
-            return 0;
-
-          return a_path_rev->merged_revision == TRUE ? 1 : -1;
-        }
-
-      return strcmp_result;
-    }
-
-  return a_path_rev->revnum < b_path_rev->revnum ? 1 : -1;
-}
-
 static svn_error_t *
-sort_and_scrub_revisions(apr_array_header_t **path_revisions,
-                         apr_pool_t *pool)
+get_merged_revisions(apr_array_header_t *mainline_path_revisions,
+                     apr_array_header_t *merged_path_revisions,
+                     svn_repos_t *repos,
+                     apr_hash_t *duplicate_path_revs,
+                     svn_repos_authz_func_t authz_read_func,
+                     void *authz_read_baton,
+                     apr_pool_t *pool)
 {
   int i;
-  struct path_revision previous_path_rev = { 0, NULL, FALSE };
-  apr_array_header_t *out_path_revisions = apr_array_make(pool, 0,
-                                            sizeof(struct path_revision *));
-
-  /* Sort the path_revision pairs by revnum in descending order, then path. */
-  qsort((*path_revisions)->elts, (*path_revisions)->nelts,
-        (*path_revisions)->elt_size, compare_path_revision_revs);
-
-  /* Filter out duplicat path/revision pairs.  Because we ensured that pairs
-     without the merged_revision flag set are ordered after pair with it set,
-     the following scrubbing process will prefer path/revision pairs from the
-     mainline of history, and not the result of a merge. */
-  for (i = 0; i < (*path_revisions)->nelts; i++)
-    {
-      struct path_revision *path_rev = APR_ARRAY_IDX(*path_revisions, i,
-                                                     struct path_revision *);
-
-      if ( (previous_path_rev.revnum != path_rev->revnum)
-            || (strcmp(previous_path_rev.path, path_rev->path) != 0) )
-        {
-          APR_ARRAY_PUSH(out_path_revisions, struct path_revision *) = path_rev;
-        }
-
-      previous_path_rev = *path_rev;
-    }
-
-  *path_revisions = out_path_revisions;
+
+  /* TODO(hwright): Actually implement the body of this loop! */
+  for (i = 0; i < mainline_path_revisions->nelts; i++)
+    {
+      struct path_revision *main_pr = APR_ARRAY_IDX(mainline_path_revisions, i,
+                                                    struct path_revision *);
+    }

   return SVN_NO_ERROR;
 }
@@ -1376,6 +1336,23 @@
   return SVN_NO_ERROR;
 }

+/* We don't yet support sending revisions in reverse order; the caller wait
+ * until we've traced back through the entire history, and then accept
+ * them from oldest to youngest.  Someday this may change, but in the meantime,
+ * the general algorithm is thus:
+ *
+ *  1) Trace back through the history of an object, adding each revision
+ *     found to the MAINLINE_PATH_REVISIONS array, marking any which were
+ *     merges.
+ *  2) If INCLUDE_MERGED_REVISIONS is TRUE, we repeat Step 1 on each of the
+ *     merged revisions, including them in the MERGED_PATH_REVISIONS, and using
+ *     DUPLICATE_PATH_REVS to avoid tracing the same paths of history multiple
+ *     times.
+ *  3) Send both MAINLINE_PATH_REVISIONS and MERGED_PATH_REVISIONS from
+ *     youngest to oldest, interleaving as appropriate.  This is implemented
+ *     similar to an insertion sort, but instead of inserting into another
+ *     array, we just call the appropriate handler.
+ */
 svn_error_t *
 svn_repos_get_file_revs2(svn_repos_t *repos,
                          const char *path,
@@ -1388,25 +1365,31 @@
                          void *handler_baton,
                          apr_pool_t *pool)
 {
-  apr_array_header_t *path_revisions = apr_array_make(pool, 0,
-                                                sizeof(struct path_revision *));
+  apr_array_header_t *mainline_path_revisions, *merged_path_revisions;
   apr_hash_t *duplicate_path_revs;
   struct send_baton sb;
-  int i;
+  int mainline_pos, merged_pos;

   /* Get the revisions we are interested in. */
   duplicate_path_revs = apr_hash_make(pool);
-  SVN_ERR(find_interesting_revisions(path_revisions, repos, path, start, end,
-                                     include_merged_revisions, FALSE,
-                                     duplicate_path_revs,
+  mainline_path_revisions = apr_array_make(pool, 0,
+                                           sizeof(struct path_revision *));
+  SVN_ERR(find_interesting_revisions(mainline_path_revisions, repos, path,
+                                     start, end, FALSE, duplicate_path_revs,
                                      authz_read_func, authz_read_baton,
                                      pool));

+  /* If we are including merged revisions, go get those, too. */
+  merged_path_revisions = apr_array_make(pool, 0,
+                                         sizeof(struct path_revision *));
   if (include_merged_revisions)
-    SVN_ERR(sort_and_scrub_revisions(&path_revisions, pool));
+    SVN_ERR(get_merged_revisions(merged_path_revisions,
+                                 mainline_path_revisions, repos,
+                                 duplicate_path_revs, authz_read_func,
+                                 authz_read_baton, pool));

   /* We must have at least one revision to get. */
-  assert(path_revisions->nelts > 0);
+  assert(mainline_path_revisions->nelts > 0);

   /* We switch betwwen two pools while looping, since we need information from
      the last iteration to be available. */
@@ -1420,12 +1403,49 @@
   /* Create an empty hash table for the first property diff. */
   sb.last_props = apr_hash_make(sb.last_pool);

-  /* Walk through the revisions in chronological order. */
-  for (i = path_revisions->nelts; i > 0; --i)
-    {
-      struct path_revision *path_rev = APR_ARRAY_IDX(path_revisions, i - 1,
-                                                     struct path_revision *);
-      SVN_ERR(send_path_revision(path_rev, repos, &sb, handler,
+  /* Walk through both mainline and merged revisions, and send them in
+     reverse chronological order, interleaving as appropriate. */
+  mainline_pos = mainline_path_revisions->nelts - 1;
+  merged_pos = merged_path_revisions->nelts - 1;
+  while (mainline_pos >= 0 && merged_pos >= 0)
+    {
+      struct path_revision *main_pr = APR_ARRAY_IDX(mainline_path_revisions,
+                                                    mainline_pos,
+                                                    struct path_revision *);
+      struct path_revision *merged_pr = APR_ARRAY_IDX(merged_path_revisions,
+                                                      merged_pos,
+                                                      struct path_revision *);
+
+      if (main_pr->revnum > merged_pr->revnum)
+        {
+          SVN_ERR(send_path_revision(main_pr, repos, &sb, handler,
+                                     handler_baton));
+          mainline_pos -= 1;
+        }
+      else
+        {
+          SVN_ERR(send_path_revision(merged_pr, repos, &sb, handler,
+                                     handler_baton));
+          merged_pos -= 1;
+        }
+    }
+
+  /* Send any remaining revisions from the mainline list. */
+  for (; mainline_pos >= 0; mainline_pos -= 1)
+    {
+      struct path_revision *main_pr = APR_ARRAY_IDX(mainline_path_revisions,
+                                                    mainline_pos,
+                                                    struct path_revision *);
+      SVN_ERR(send_path_revision(main_pr, repos, &sb, handler, handler_baton));
+    }
+
+  /* Ditto for the merged list. */
+  for (; merged_pos >= 0; merged_pos -= 1)
+    {
+      struct path_revision *merged_pr = APR_ARRAY_IDX(merged_path_revisions,
+                                                      merged_pos,
+                                                      struct path_revision *);
+      SVN_ERR(send_path_revision(merged_pr, repos, &sb, handler,
                                  handler_baton));
     }


fixed up glview

fixed up glview

--- software/drivers/multisense/src/multisense-glview/main.c
+++ software/drivers/multisense/src/multisense-glview/main.c
@@ -33,8 +33,9 @@

 // 800x800 - vrc
 // 1024x544 - drc (real sensor)
+// 1024x1024 - extended HFOV real sensor
 int width = 1024;
-int height = 544;
+int height = 1024;

 GLuint gl_leftpane_tex;
 int32_t left_color_format;
@@ -297,6 +298,7 @@
 	           "  -c channel  Subscribe channel name\n"
                    "  -h          This help message\n",
         	   "  -o path     Save frames to PNG\n",
+                   "  -p          Use previous resolution (1024x544)\n",
                    g_path_get_basename(progname));
   exit(1);
 }
@@ -375,44 +377,13 @@

 int main(int argc, char **argv)
 {
-  int res;
-
-  int npixels = width*height;
-
-  depth_img_data = malloc(npixels*3);
-  depth_uncompress_buffer = malloc(npixels*sizeof(uint16_t));
-  left_img_data = malloc(npixels*3);
-  right_img_data = malloc(npixels*3);
-  rightpane_is_depth = 0;
-
-  int i;
-  for (i=0; i<DEPTH_VAL; i++) {
-    float v = i/(float)DEPTH_VAL;
-    v = powf(v, 3)* 6;
-    t_gamma[i] = v*6*256;
-  }
-
-  glutInit(&argc, argv);
-
-  glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
-  glutInitWindowSize(width*2, height);
-  glutInitWindowPosition(0, 0);
-
-  window = glutCreateWindow("Multisense LCM viewer");
-
-  glutDisplayFunc(&DrawGLScene);
-  glutIdleFunc(&DrawGLScene);
-  glutReshapeFunc(&ReSizeGLScene);
-  glutKeyboardFunc(&keyPressed);
-
-  InitGL(width*2, height);

   char channelName[512];
   strcpy(channelName, "CAMERA");
+  char *lcm_url = NULL;

   int c;
-  char *lcm_url = NULL;
-  while ((c = getopt (argc, argv, "hl:c:o:")) >= 0) {
+  while ((c = getopt (argc, argv, "hl:c:o:p")) >= 0) {
     switch (c) {
     case 'l':
       lcm_url = strdup(optarg);
@@ -427,12 +398,48 @@
       printf("Capturing PNGs to %s\n", outputPath);
       doOutput = 1;
       break;
+    case 'p' :
+      width = 1024;
+      height = 544;
+      break;
     case 'h':
     case '?':
       usage(argv[0]);
     }
   }
-  lcm = lcm_create(lcm_url);
+  lcm = lcm_create(lcm_url);
+
+  int npixels = width*height;
+
+  depth_img_data = malloc(npixels*3);
+  depth_uncompress_buffer = malloc(npixels*sizeof(uint16_t));
+  left_img_data = malloc(npixels*3);
+  right_img_data = malloc(npixels*3);
+  rightpane_is_depth = 0;
+
+  int i;
+  for (i=0; i<DEPTH_VAL; i++) {
+    float v = i/(float)DEPTH_VAL;
+    v = powf(v, 3)* 6;
+    t_gamma[i] = v*6*256;
+  }
+
+  glutInit(&argc, argv);
+
+  glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
+  //glutInitWindowSize(width*2, height);
+  glutInitWindowSize(width, height/2);
+  glutInitWindowPosition(0, 0);
+
+  window = glutCreateWindow("Multisense LCM viewer");
+
+  glutDisplayFunc(&DrawGLScene);
+  glutIdleFunc(&DrawGLScene);
+  glutReshapeFunc(&ReSizeGLScene);
+  glutKeyboardFunc(&keyPressed);
+
+  InitGL(width*2, height);
+

   multisense_images_t_subscribe(lcm, channelName, on_frame, NULL);


lib-storage: Message size/sent date could have been set as 0 in some cases. It doesn't look like it ever happened with the current storage backends or use cases.

--- src/lib-storage/index/index-mail.c
+++ src/lib-storage/index/index-mail.c
@@ -330,6 +330,7 @@
 {
 	struct index_mail *mail = (struct index_mail *)_mail;
 	struct index_mail_data *data = &mail->data;
+	struct mail_sent_date sentdate;

 	data->cache_fetch_fields |= MAIL_FETCH_DATE;
 	if (data->sent_date.time != (uint32_t)-1) {
@@ -338,9 +339,9 @@
 		return 0;
 	}

-	(void)index_mail_get_fixed_field(mail, MAIL_CACHE_SENT_DATE,
-					 &data->sent_date,
-					 sizeof(data->sent_date));
+	if (index_mail_get_fixed_field(mail, MAIL_CACHE_SENT_DATE,
+				       &sentdate, sizeof(sentdate)))
+		data->sent_date = sentdate;

 	if (index_mail_cache_sent_date(mail) < 0)
 		return -1;
@@ -374,12 +375,15 @@
 bool index_mail_get_cached_virtual_size(struct index_mail *mail, uoff_t *size_r)
 {
 	struct index_mail_data *data = &mail->data;
+	uoff_t size;

 	data->cache_fetch_fields |= MAIL_FETCH_VIRTUAL_SIZE;
 	if (data->virtual_size == (uoff_t)-1) {
-		if (!index_mail_get_cached_uoff_t(mail,
-						  MAIL_CACHE_VIRTUAL_FULL_SIZE,
-						  &data->virtual_size)) {
+		if (index_mail_get_cached_uoff_t(mail,
+						 MAIL_CACHE_VIRTUAL_FULL_SIZE,
+						 &size))
+			data->virtual_size = size;
+		else {
 			if (!get_cached_msgpart_sizes(mail))
 				return FALSE;
 		}
@@ -442,12 +446,15 @@
 {
 	struct index_mail *mail = (struct index_mail *)_mail;
 	struct index_mail_data *data = &mail->data;
+	uoff_t size;

 	data->cache_fetch_fields |= MAIL_FETCH_PHYSICAL_SIZE;
 	if (data->physical_size == (uoff_t)-1) {
-		if (!index_mail_get_cached_uoff_t(mail,
-						  MAIL_CACHE_PHYSICAL_FULL_SIZE,
-						  &data->physical_size))
+		if (index_mail_get_cached_uoff_t(mail,
+						 MAIL_CACHE_PHYSICAL_FULL_SIZE,
+						 &size))
+			data->physical_size = size;
+		else
 			(void)get_cached_msgpart_sizes(mail);
 	}
 	*size_r = data->physical_size;


lib-storage: Fixed assert-crash when BODYSTRUCTURE parsing fails due to broken mail size.

--- src/lib-storage/index/index-mail.c
+++ src/lib-storage/index/index-mail.c
@@ -847,17 +847,21 @@
 		i_stream_ref(parser_input);
 		ret = message_parser_deinit(&mail->data.parser_ctx,
 					    &mail->data.parts) < 0 ? 0 : 1;
-		if (parser_input->stream_errno == 0 ||
-		    parser_input->stream_errno == EPIPE) {
-			/* EPIPE = input already closed. allow the caller to
-			   decide if that is an error or not. (for example we
-			   could be coming here from IMAP APPEND when IMAP
-			   client has closed the connection too early. we
-			   don't want to log an error in that case.) */
-			i_assert(!success ||
-				 (i_stream_read(parser_input) == -1 &&
-				  !i_stream_have_bytes_left(parser_input)));
-		} else {
+		if (success && (parser_input->stream_errno == 0 ||
+				parser_input->stream_errno == EPIPE)) {
+			/* do one final read, which verifies that the message
+			   size is correct. */
+			if (i_stream_read(parser_input) != -1 ||
+			    i_stream_have_bytes_left(parser_input))
+				i_unreached();
+		}
+		/* EPIPE = input already closed. allow the caller to
+		   decide if that is an error or not. (for example we
+		   could be coming here from IMAP APPEND when IMAP
+		   client has closed the connection too early. we
+		   don't want to log an error in that case.) */
+		if (parser_input->stream_errno != 0 &&
+		    parser_input->stream_errno != EPIPE) {
 			index_mail_stream_log_failure_for(mail, parser_input);
 			ret = -1;
 		}


rpc-transport/rdma: send disconnect event only if the transport is already connected.

- A disconnect event can be sent before a connect event to rpc, if some error
    happens during rdma handshake.
  - Also call rdma_quota_put only if peer is not NULL.

Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>

BUG: 513 (Introduce 0 copy rdma)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=513

--- rpc/rpc-transport/rdma/src/rdma.c
+++ rpc/rpc-transport/rdma/src/rdma.c
@@ -3493,7 +3493,8 @@
                                 if ((ret == 0)
                                     && (wc.status == IBV_WC_SUCCESS)
                                     && !is_request
-                                    && (post->type == RDMA_SEND_POST)) {
+                                    && (post->type == RDMA_SEND_POST)
+                                    && (peer != NULL)) {
                                         /* An RDMA_RECV_POST can end up in
                                          * rdma_send_completion_proc for
                                          * rdma-reads, and we do not take
@@ -4226,7 +4227,7 @@
 {
         rdma_private_t *priv = this->private;
         int32_t ret = 0;
-        char need_unref = 0;
+        char need_unref = 0, connected = 0;

         gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
                 "%s: peer disconnected, cleaning up",
@@ -4236,6 +4237,7 @@
         {
                 __rdma_teardown (this);

+                connected = priv->connected;
                 if (priv->sock != -1) {
                         event_unregister (this->ctx->event_pool,
                                           priv->sock, priv->idx);
@@ -4267,7 +4269,9 @@
         }
         pthread_mutex_unlock (&priv->write_mutex);

-        rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this);
+        if (connected) {
+                rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this);
+        }

         if (need_unref)
                 rpc_transport_unref (this);


mail_update_flags(): Allow removing recent flag from message.

--HG--
branch : HEAD

--- src/lib-storage/index/index-mail.c
+++ src/lib-storage/index/index-mail.c
@@ -1402,10 +1402,27 @@
 	(void)index_mail_parse_body_finish(mail, 0);
 }

+static void index_mail_drop_recent_flag(struct index_mail *imail)
+{
+	const struct mail_index_header *hdr;
+	uint32_t first_recent_uid = imail->mail.mail.uid + 1;
+
+	hdr = mail_index_get_header(imail->trans->trans_view);
+	if (hdr->first_recent_uid < first_recent_uid) {
+		mail_index_update_header(imail->trans->trans,
+			offsetof(struct mail_index_header, first_recent_uid),
+			&first_recent_uid, sizeof(first_recent_uid), FALSE);
+	}
+}
+
 void index_mail_update_flags(struct mail *mail, enum modify_type modify_type,
 			     enum mail_flags flags)
 {
 	struct index_mail *imail = (struct index_mail *)mail;
+
+	if ((flags & MAIL_RECENT) == 0 &&
+	    index_mailbox_is_recent(imail->ibox, mail->uid))
+		index_mail_drop_recent_flag(imail);

 	flags &= MAIL_FLAGS_NONRECENT | MAIL_INDEX_MAIL_FLAG_BACKEND;
 	mail_index_update_flags(imail->trans->trans, mail->seq, modify_type,


Fix the gc_instrumentation test on toolchain bots.

The compiler now inserts explicit references to the suspension flag, which then
fails to link when the flag is not present.

BUG=none
TEST=run_gc_instrumentation_test # with freshly uploaded toolchain

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

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@6962 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

--- tests/gc_instrumentation/gc_noinst.c
+++ tests/gc_instrumentation/gc_noinst.c
@@ -1,7 +1,7 @@
 /*
- * Copyright 2010 The Native Client Authors.  All rights reserved.
- * Use of this source code is governed by a BSD-style license that can
- * be found in the LICENSE file.
+ * Copyright (c) 2011 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
  */

 /*
@@ -13,7 +13,8 @@
 /* TODO(elijahtaylor): This will need to be changed
  *  when the compiler instrumentation changes.
  */
+volatile int __nacl_thread_suspension_needed = 1;
+
 void __nacl_suspend_thread_if_needed() {
   thread_suspend_if_needed_count++;
 }
-


Update descriptions

Update descriptions

--- lib/node_modules/@stdlib/ndarray/base/unary/include/stdlib/ndarray/base/unary/typedefs.h
+++ lib/node_modules/@stdlib/ndarray/base/unary/include/stdlib/ndarray/base/unary/typedefs.h
@@ -27,9 +27,9 @@
 * Function pointer type for an ndarray function.
 *
 * @param arrays   array containing pointers to input and output ndarrays
-* @param fcn      callback
+* @param data     function "data" (e.g., a callback)
 * @return         status code
 */
-typedef int8_t (*ndarrayFcn)( struct ndarray *arrays[], void *fcn );
+typedef int8_t (*ndarrayFcn)( struct ndarray *arrays[], void *data );

 #endif // !STDLIB_NDARRAY_BASE_UNARY_TYPEDEFS_H


New visilibity statements for .so builds (currently not used).

--- termbox.h
+++ termbox.h
@@ -2,6 +2,13 @@
 #define TERMBOX_H

 #include <stdint.h>
+
+/* for shared objects */
+#if __GNUC__ >= 4
+ #define SO_IMPORT __attribute__((visibility("default")))
+#else
+ #define SO_IMPORT
+#endif

 #ifdef __cplusplus
 extern "C" {
@@ -124,26 +131,26 @@
 #define TB_EFAILED_TO_OPEN_TTY		-2
 #define TB_EPIPE_TRAP_ERROR		-3

-int tb_init();
-void tb_shutdown();
+SO_IMPORT int tb_init();
+SO_IMPORT void tb_shutdown();

-unsigned int tb_width();
-unsigned int tb_height();
+SO_IMPORT unsigned int tb_width();
+SO_IMPORT unsigned int tb_height();

-void tb_clear();
-void tb_present();
+SO_IMPORT void tb_clear();
+SO_IMPORT void tb_present();

 #define TB_HIDE_CURSOR			-1
-void tb_set_cursor(int cx, int cy);
+SO_IMPORT void tb_set_cursor(int cx, int cy);

-void tb_put_cell(unsigned int x, unsigned int y, const struct tb_cell *cell);
-void tb_change_cell(unsigned int x, unsigned int y, uint32_t ch, uint16_t fg, uint16_t bg);
-void tb_blit(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const struct tb_cell *cells);
+SO_IMPORT void tb_put_cell(unsigned int x, unsigned int y, const struct tb_cell *cell);
+SO_IMPORT void tb_change_cell(unsigned int x, unsigned int y, uint32_t ch, uint16_t fg, uint16_t bg);
+SO_IMPORT void tb_blit(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const struct tb_cell *cells);

 #define TB_INPUT_ESC 1
 #define TB_INPUT_ALT 2
 /* with 0 returns current input mode */
-int tb_select_input_mode(int mode);
+SO_IMPORT int tb_select_input_mode(int mode);

 /* returns:
 	0 - no events, no errors,
@@ -157,17 +164,17 @@
 #define TB_EVENT_KEY 1
 #define TB_EVENT_RESIZE 2

-int tb_peek_event(struct tb_event *event, unsigned int timeout);
-int tb_poll_event(struct tb_event *event);
+SO_IMPORT int tb_peek_event(struct tb_event *event, unsigned int timeout);
+SO_IMPORT int tb_poll_event(struct tb_event *event);

 /* glib based interface */
 /* TODO */

 /* utility utf8 functions */
 #define TB_EOF -1
-int utf8_char_length(char c);
-int utf8_char_to_unicode(uint32_t *out, const char *c);
-int utf8_unicode_to_char(char *out, uint32_t c);
+SO_IMPORT int utf8_char_length(char c);
+SO_IMPORT int utf8_char_to_unicode(uint32_t *out, const char *c);
+SO_IMPORT int utf8_unicode_to_char(char *out, uint32_t c);

 #ifdef __cplusplus
 }


Match export macros to library

Match export macros to library

--- virvo/virvo/vvdicom.h
+++ virvo/virvo/vvdicom.h
@@ -106,7 +106,7 @@
 @author George J. Grevera
 @author Jurgen Schulze
 */
-class VIRVOEXPORT vvDicom
+class VIRVO_FILEIOEXPORT vvDicom
 {
   private:


Bugfix to recursive 'meta-' getkey code - handle buffcount too

--- termkey.c
+++ termkey.c
@@ -372,21 +372,23 @@

     // Try another key there
     tk->buffstart++;
+    tk->buffcount--;

     // Run the full driver
     termkey_result metakey_result = (*tk->driver.getkey)(tk, key, force);
+
+    tk->buffstart--;
+    tk->buffcount++;

     switch(metakey_result) {
       case TERMKEY_RES_KEY:
         key->modifiers |= TERMKEY_KEYMOD_ALT;
-        tk->buffstart--;
         (*tk->method.eat_bytes)(tk, 1);
         break;

       case TERMKEY_RES_NONE:
       case TERMKEY_RES_EOF:
       case TERMKEY_RES_AGAIN:
-        tk->buffstart--;
         break;
     }


fix memory leak

fix memory leak

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

--- src/tests/recovery_fileops_stress.c
+++ src/tests/recovery_fileops_stress.c
@@ -79,6 +79,9 @@

 static void update_crash_timer(void) {
     if ( --crash_timer == 0 ) {
+        // close the states table before we crash
+        int r = states->close(states, 0);
+        CKERR(r);
         if ( verbose ) {
             printf("%s : crash\n", __FILE__);
             fflush(stdout);
@@ -236,7 +239,7 @@
     }
 }

-static void run_test(int iter, int crash){
+static void run_test(int iter){
     u_int32_t recovery_flags = DB_INIT_LOG | DB_INIT_TXN;
     int r, i;

@@ -367,46 +370,34 @@
     db_env_set_checkpoint_callback(NULL, NULL);
     db_env_set_checkpoint_callback2(NULL, NULL);

-
     // after checkpoint
     if ( verbose ) printf("%s : after checkpoint #2\n", __FILE__);
     do_random_fileops();

-    // close the states table before we crash
-    r = states->close(states, 0);                                                                         CKERR(r);
-    crash = crash;
-    if (iter > 10 ) {
-        if ( verbose ) printf("%s : crash\n", __FILE__);
-        crash_it();
-    }
-
-    if ( verbose ) printf("%s : done\n", __FILE__);
-
     r = env->txn_checkpoint(env, 0, 0, 0);                                                                CKERR(r);

     for (i=0;i<NUM_DICTIONARIES;i++) {
         db = db_array[i];
         state = get_state(i);
         if ( state == CREATED || state == OPEN ) {
-            r = db->close(db, 0);                                                                        CKERR(r);
+            r = db->close(db, 0);                                                                         CKERR(r);
             db = NULL;
         }
     }

-    r = env->close(env, 0);
-//    assert((r == 0) || (r == EINVAL)); // OK to have open transactions prior to close
-    CKERR(r);
+    r = states->close(states, 0);                                                                         CKERR(r);
+    r = env->close(env, 0);                                                                               CKERR(r);
+    if ( verbose ) printf("%s : done\n", __FILE__);
 }

 // ------------ infrastructure ----------
 static void do_args(int argc, char *argv[]);

 static int iter_arg = 0;
-static int do_crash = 0;

 int test_main(int argc, char **argv) {
     do_args(argc, argv);
-    run_test(iter_arg,do_crash);
+    run_test(iter_arg);
     return 0;
 }

@@ -423,13 +414,11 @@
 	} else if (strcmp(argv[0], "-h")==0) {
 	    resultcode=0;
 	do_usage:
-	    fprintf(stderr, "Usage:\n%s [-v|-q]* [-h] [-i] [-C] \n", cmd);
+	    fprintf(stderr, "Usage:\n%s [-v|-q]* [-h] [-i] \n", cmd);
 	    exit(resultcode);
 	} else if (strcmp(argv[0], "-i")==0) {
             argc--; argv++;
             iter_arg = atoi(argv[0]);
-	} else if (strcmp(argv[0], "-C")==0) {
-            do_crash = 1;
 	} else {
 	    fprintf(stderr, "Unknown arg: %s\n", argv[0]);
 	    resultcode=1;


Render smart objects too.

Render smart objects too.

--- src/lib/canvas/evas_object_proxy.c
+++ src/lib/canvas/evas_object_proxy.c
@@ -350,8 +350,12 @@
    ctx = e->engine.func->context_new(e->engine.data.output);
    if (source->smart.smart)
      {
-   //     EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(source), obj2)
-     //      evas_render_mapped(e, obj2, ctx, surface, 0, 0, 1);
+        EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(source), obj2){
+           obj2->func->render(obj2, e->engine.data.output, ctx,
+                              source->proxy.surface,
+                              -source->cur.geometry.x,
+                              -source->cur.geometry.y);
+        }
      }
    else
      {


Delete second argument to FB_LINK_REQUIRE_

Summary: It is now always NAME.

Reviewed By: adamjernst

Differential Revision: D13577665

fbshipit-source-id: 9d9330fd17b7e214ef807760d0314c34bd06ebd5

--- iOS/FBDefines/FBMacros.h
+++ iOS/FBDefines/FBMacros.h
@@ -1,13 +1,13 @@
-/*
- *  Copyright (c) 2004-present, Facebook, Inc.
- *
- *  This source code is licensed under the MIT license found in the LICENSE
- *  file in the root directory of this source tree.
- *
- */
-#ifndef FB_SK_MACROS_H
- #define FB_SK_MACROS_H
-     #define FB_LINK_REQUIRE_(NAME, UNIQUE)
-    #define FB_LINKABLE(NAME)
-    #define FB_LINK_REQUIRE(NAME)
+/*
+ *  Copyright (c) 2004-present, Facebook, Inc.
+ *
+ *  This source code is licensed under the MIT license found in the LICENSE
+ *  file in the root directory of this source tree.
+ *
+ */
+#ifndef FB_SK_MACROS_H
+ #define FB_SK_MACROS_H
+    #define FB_LINK_REQUIRE_(NAME)
+    #define FB_LINKABLE(NAME)
+    #define FB_LINK_REQUIRE(NAME)
  #endif


make evas_object_smart_members*get return NULL for non-smart objs...not sure I need to changelog this?

git-svn-id: 6d771e449150288cc513807b7f4d2af31e9482bd@72178 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/canvas/evas_object_smart.c
+++ src/lib/canvas/evas_object_smart.c
@@ -270,6 +270,7 @@
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    return NULL;
    MAGIC_CHECK_END();
+   if (!obj->smart.smart) return NULL;
    o = (Evas_Object_Smart *)(obj->object_data);
    MAGIC_CHECK(o, Evas_Object_Smart, MAGIC_OBJ_SMART);
    return NULL;
@@ -290,6 +291,7 @@
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    return NULL;
    MAGIC_CHECK_END();
+   if (!obj->smart.smart) return NULL;
    o = (Evas_Object_Smart *)(obj->object_data);
    MAGIC_CHECK(o, Evas_Object_Smart, MAGIC_OBJ_SMART);
    return NULL;


evas_object_smart - trivial changes.

evas_object_smart - trivial changes.

git-svn-id: 6d771e449150288cc513807b7f4d2af31e9482bd@63514 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/canvas/evas_object_smart.c
+++ src/lib/canvas/evas_object_smart.c
@@ -785,16 +785,10 @@
    obj->parent_cache_valid = 0;

    o = (Evas_Object_Smart *)(obj->object_data);
-   if (o->magic != MAGIC_OBJ_SMART)
-     return;
+   if (o->magic != MAGIC_OBJ_SMART) return;

    for (l = o->contained; l; l = l->next)
-     {
-        Evas_Object *obj2;
-
-        obj2 = (Evas_Object *)l;
-        evas_object_smart_member_cache_invalidate(obj2);
-     }
+     evas_object_smart_member_cache_invalidate((Evas_Object *) l);
 }

 void


fix build on systems w/o xinerama support

git-svn-id: 70cf712206e5b8426a8d7451e052914a94f8fa22@13197 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/ecore_x/ecore_x_xinerama.c
+++ src/lib/ecore_x/ecore_x_xinerama.c
@@ -6,8 +6,10 @@
 #include "Ecore_X.h"
 #include "Ecore_X_Atoms.h"

+#ifdef ECORE_XINERAMA
 static XineramaScreenInfo *_xin_info = NULL;
 static int _xin_scr_num = 0;
+#endif

 int
 ecore_x_xinerama_screen_count_get(void)


prov: remove TODO in der_rsa_key.c

prov: remove TODO in der_rsa_key.c

Fixes #14365

Reviewed-by: Shane Lontis <452ce16516ceed26291fe7de3f8b53540d83864e@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14565)

--- providers/common/der/der_rsa_key.c
+++ providers/common/der/der_rsa_key.c
@@ -18,7 +18,8 @@
 #include "prov/der_rsa.h"
 #include "prov/der_digests.h"

-/* More complex pre-compiled sequences.  TODO(3.0) refactor? */
+/* More complex pre-compiled sequences. */
+
 /*-
  * From https://tools.ietf.org/html/rfc8017#appendix-A.2.1
  *


reenable guard!

reenable guard!

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@13663 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- psc_fsutil_libs/psc_util/journal.c
+++ psc_fsutil_libs/psc_util/journal.c
@@ -196,7 +196,7 @@
 {
 	struct psc_journal_xidhndl *xh;

-	xh = psc_alloc(sizeof(*xh), PAF_NOGUARD);
+	xh = psc_alloc(sizeof(*xh), 0);

 	xh->pjx_pj = pj;
 	INIT_SPINLOCK(&xh->pjx_lock);
@@ -216,7 +216,7 @@
 {
 	psc_assert(psclist_disjoint(&xh->pjx_lentry1));
 	psc_assert(psclist_disjoint(&xh->pjx_lentry2));
-	psc_free(xh, PAF_NOGUARD);
+	psc_free(xh, 0);
 }

 void
@@ -582,7 +582,7 @@

 			/* Okay, we need to keep this log entry for now. */
 			tmppje = psc_alloc(PJ_PJESZ(pj), PAF_PAGEALIGN |
-			    PAF_LOCK | PAF_NOGUARD);
+			    PAF_LOCK);
 			memcpy(tmppje, pje, pje->pje_len +
 			    offsetof(struct psc_journal_enthdr, pje_data));
 			psc_dynarray_add(&pj->pj_bufs, tmppje);
@@ -715,7 +715,7 @@
 	int n;

 	DYNARRAY_FOREACH(pje, n, &pj->pj_bufs)
-		psc_free(pje, PAF_NOGUARD | PAF_LOCK | PAF_PAGEALIGN, PJ_PJESZ(pj));
+		psc_free(pje, PAF_LOCK | PAF_PAGEALIGN, PJ_PJESZ(pj));
 	psc_dynarray_free(&pj->pj_bufs);
 	psc_free(pj->pj_hdr, PAF_LOCK | PAF_PAGEALIGN, pj->pj_hdr->pjh_iolen);
 	PSCFREE(pj);
@@ -1015,8 +1015,7 @@
 				nerrs++;
 		}
 #endif
-		psc_free(pje, PAF_NOGUARD | PAF_LOCK | PAF_PAGEALIGN,
-		    PJ_PJESZ(pj));
+		psc_free(pje, PAF_LOCK | PAF_PAGEALIGN, PJ_PJESZ(pj));
 	}
 	psc_dynarray_free(&pj->pj_bufs);


libhost1x: print error message on framebuffer_init error

framebuffer_init may fail and then grate test exits silently, that's not nice.

--- src/libhost1x/host1x-framebuffer.c
+++ src/libhost1x/host1x-framebuffer.c
@@ -102,6 +102,7 @@
 	if (host1x->framebuffer_init) {
 		err = host1x->framebuffer_init(host1x, fb);
 		if (err < 0) {
+			host1x_error("framebuffer_init failed: %d\n", err);
 			host1x_framebuffer_free(fb);
 			fb = NULL;
 		}


Fix a dumb bug in .lzma decoder which was introduced in the previous commit. (Probably the previous commit has other bugs too, it wasn't tested.)

--- src/liblzma/common/alone_decoder.c
+++ src/liblzma/common/alone_decoder.c
@@ -104,27 +104,26 @@
 	case SEQ_UNCOMPRESSED_SIZE:
 		coder->uncompressed_size
 				|= (lzma_vli)(in[*in_pos]) << (coder->pos * 8);
-
-		if (++coder->pos == 8) {
-			// Another hack to ditch false positives: Assume that
-			// if the uncompressed size is known, it must be less
-			// than 256 GiB. Again, if someone complains, this
-			// will be reconsidered.
-			if (coder->uncompressed_size != LZMA_VLI_UNKNOWN
-					&& coder->uncompressed_size
-						>= (LZMA_VLI_C(1) << 38))
-				return LZMA_FORMAT_ERROR;
-
-			coder->pos = 0;
-			coder->sequence = SEQ_CODER_INIT;
-		}
-
 		++*in_pos;
+		if (++coder->pos < 8)
+			break;
+
+		// Another hack to ditch false positives: Assume that
+		// if the uncompressed size is known, it must be less
+		// than 256 GiB. Again, if someone complains, this
+		// will be reconsidered.
+		if (coder->uncompressed_size != LZMA_VLI_UNKNOWN
+				&& coder->uncompressed_size
+					>= (LZMA_VLI_C(1) << 38))
+			return LZMA_FORMAT_ERROR;

 		// Calculate the memory usage so that it is ready
 		// for SEQ_CODER_INIT.
 		coder->memusage = lzma_lzma_decoder_memusage(&coder->options)
 				+ LZMA_MEMUSAGE_BASE;
+
+		coder->pos = 0;
+		coder->sequence = SEQ_CODER_INIT;

 	// Fall through


kernel/armv8/apm88xxxx: Implement platform_get_info

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

--- kernel/arch/armv8/plat_apm88xxxx.c
+++ kernel/arch/armv8/plat_apm88xxxx.c
@@ -100,7 +100,8 @@

 void platform_get_info(struct platform_info *pi)
 {
-
+    pi->arch = PI_ARCH_ARMV8A;
+    pi->platform = PI_PLATFORM_APM88XXXX;
 }

 void armv8_get_info(struct arch_info_armv8 *ai)


kernel: Enhance memory pool block deallocation routine

Revises algorithm to call an existing routine to free an allocated
block, rather than duplicating the logic to do the freeing.

Also enhances comments to make it easier to understand what is
going on.

Change-Id: Ie7a83a8a2e978e8a685c27e07acb5b70aea37afa
Signed-off-by: Allan Stephens <1038bc33971d2c23c8e2eee8dd6938c077db52dc@windriver.com>

--- kernel/microkernel/k_memory_pool.c
+++ kernel/microkernel/k_memory_pool.c
@@ -635,62 +635,45 @@
 void _k_mem_pool_block_release(struct k_args *A)
 {
 	struct pool_struct *P;
-	struct pool_block *block;
-	struct block_stat *blockstat;
 	int Pid;
 	int start_size, offset;
-	int i, j;

 	Pid = A->args.p1.pool_id;

-
 	P = _k_mem_pool_list + OBJ_INDEX(Pid);

-	/* calculate size */
+	/* determine block set that block belongs to */
+
 	start_size = P->minblock_size;
 	offset = P->nr_of_frags - 1;

 	while (A->args.p1.req_size > start_size) {
-		start_size = start_size << 2; /* try one larger */
+		start_size = start_size << 2;
 		offset--;
 	}

-	/* startsize==the available size that contains the requested block size */
-	/* offset: index in fragtable of the block */
-
-	j = 0;
-	block = P->frag_tab + offset;
-
-	while ((j < block->nr_of_entries) &&
-	       ((blockstat = block->blocktable + j)->mem_blocks != 0)) {
-		for (i = 0; i < 4; i++) {
-			if (A->args.p1.rep_poolptr ==
-			    (blockstat->mem_blocks +
-			     (OCTET_TO_SIZEOFUNIT(i * block->block_size)))) {
-				/* we've found the right pointer, so free it */
-				blockstat->mem_status &= ~(1 << i);
-
-				/* waiters? */
-				if (P->waiters != NULL) {
-					struct k_args *NewGet;
-					/*
-					 * get new command packet that calls
-					 * the function that reallocate blocks
-					 * for the waiting tasks
-					 */
-					GETARGS(NewGet);
-					*NewGet = *A;
-					NewGet->Comm = _K_SVC_BLOCK_WAITERS_GET;
-					/* push on command stack */
-					TO_ALIST(&_k_command_stack, NewGet);
-				}
-				if (A->alloc) {
-					FREEARGS(A);
-				}
-				return;
-			}
-		}
-		j++;
+	/* mark the block as unused */
+
+	free_existing_block(A->args.p1.rep_poolptr, P, offset);
+
+	/* reschedule anybody waiting for a block */
+
+	if (P->waiters != NULL) {
+		struct k_args *NewGet;
+
+		/*
+		 * create a command packet to re-try block allocation
+		 * for the waiting tasks, and add it to the command stack
+		 */
+
+		GETARGS(NewGet);
+		*NewGet = *A;
+		NewGet->Comm = _K_SVC_BLOCK_WAITERS_GET;
+		TO_ALIST(&_k_command_stack, NewGet);
+	}
+
+	if (A->alloc) {
+		FREEARGS(A);
 	}
 }


Added control key handling to keyboard driver

--- kernel/modules/ps2keybd/ps2keybd.c
+++ kernel/modules/ps2keybd/ps2keybd.c
@@ -154,7 +154,13 @@
 		} else {
 			if ( buf ){
 				keybd_sem = 0;
+
+				char *ctrl_seq = "\e";
+				if ( metastatus & KEYMETA_CTRL )
+					pipe_write( keyboard_pipe, ctrl_seq, (unsigned)strlen( ctrl_seq ));
+
 				pipe_write( keyboard_pipe, buf, (unsigned)strlen( buf ));
+
 				keybd_sem = 1;
 				//kprintf( "[%s] Got buffer \"%s\", meta keys: 0x%x\n", __func__, buf, metastatus );
 			}


lib/commit: Drop some conditionals/clarify code in content path

Both callers of `commit_loose_object_trusted()` were passing
`OSTREE_OBJECT_TYPE_FILE`, so drop that parameter.  This in turn
allows us to drop lots of checking of that inside the function.

Add a doc comment, and rename to `commit_loose_content_object()` for clarity.

Closes: #914
Approved by: alexlarsson

--- src/libostree/ostree-repo-commit.c
+++ src/libostree/ostree-repo-commit.c
@@ -179,10 +179,13 @@
   return TRUE;
 }

+/* Given either a file or symlink, apply the final metadata to it depending on
+ * the repository mode. Note that @checksum is assumed to have been validated by
+ * the caller.
+ */
 static gboolean
-commit_loose_object_trusted (OstreeRepo        *self,
+commit_loose_content_object (OstreeRepo        *self,
                              const char        *checksum,
-                             OstreeObjectType   objtype,
                              const char        *temp_filename,
                              gboolean           object_is_symlink,
                              guint32            uid,
@@ -239,7 +242,7 @@
     }
   else
     {
-      if (objtype == OSTREE_OBJECT_TYPE_FILE && self->mode == OSTREE_REPO_MODE_BARE)
+      if (self->mode == OSTREE_REPO_MODE_BARE)
         {
           if (TEMP_FAILURE_RETRY (fchown (fd, uid, gid)) < 0)
             return glnx_throw_errno_prefix (error, "fchown");
@@ -254,9 +257,7 @@
                 return FALSE;
             }
         }
-
-      if (objtype == OSTREE_OBJECT_TYPE_FILE &&
-          self->mode == OSTREE_REPO_MODE_BARE_USER)
+      else if (self->mode == OSTREE_REPO_MODE_BARE_USER)
         {
           if (!write_file_metadata_to_xattr (fd, uid, gid, mode, xattrs, error))
             return FALSE;
@@ -272,8 +273,7 @@
                 return glnx_throw_errno_prefix (error, "fchmod");
             }
         }
-      else if (objtype == OSTREE_OBJECT_TYPE_FILE &&
-               self->mode == OSTREE_REPO_MODE_BARE_USER_ONLY
+      else if (self->mode == OSTREE_REPO_MODE_BARE_USER_ONLY
                && !object_is_symlink)
         {
           guint32 invalid_modebits = (mode & ~S_IFMT) & ~0775;
@@ -285,7 +285,7 @@
             return glnx_throw_errno_prefix (error, "fchmod");
         }

-      if (objtype == OSTREE_OBJECT_TYPE_FILE && _ostree_repo_mode_is_bare (self->mode))
+      if (_ostree_repo_mode_is_bare (self->mode))
         {
           /* To satisfy tools such as guile which compare mtimes
            * to determine whether or not source files need to be compiled,
@@ -306,7 +306,7 @@
         }
     }

-  if (!_ostree_repo_commit_loose_final (self, checksum, objtype,
+  if (!_ostree_repo_commit_loose_final (self, checksum, OSTREE_OBJECT_TYPE_FILE,
                                         self->tmp_dir_fd, fd, temp_filename,
                                         cancellable, error))
     return FALSE;
@@ -508,7 +508,7 @@

   if (state->fd != -1)
     {
-      if (!commit_loose_object_trusted (self, checksum, OSTREE_OBJECT_TYPE_FILE,
+      if (!commit_loose_content_object (self, checksum,
                                         state->temp_filename,
                                         FALSE, uid, gid, mode,
                                         xattrs, state->fd,
@@ -756,8 +756,7 @@
   const guint32 uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
   const guint32 gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid");
   const guint32 mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
-  if (!commit_loose_object_trusted (self, actual_checksum,
-                                    OSTREE_OBJECT_TYPE_FILE,
+  if (!commit_loose_content_object (self, actual_checksum,
                                     temp_filename,
                                     object_is_symlink,
                                     uid, gid, mode,


Better conversion table from CapRTL to Unicode.

--- charset/fribidi-char-sets-cap-rtl.c
+++ charset/fribidi-char-sets-cap-rtl.c
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-char-sets-cap-rtl.c - CapRTL character set conversion routines
  *
- * $Id: fribidi-char-sets-cap-rtl.c,v 1.9 2004-06-15 11:52:02 behdad Exp $
+ * $Id: fribidi-char-sets-cap-rtl.c,v 1.10 2005-01-10 06:43:53 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-15 11:52:02 $
- * $Revision: 1.9 $
+ * $Date: 2005-01-10 06:43:53 $
+ * $Revision: 1.10 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cap-rtl.c,v $
  *
  * Authors:
@@ -80,15 +80,24 @@
   FriBidiCharType to_type[_FRIBIDI_NUM_TYPES];
   int num_types = 0, j, count = 0;
   FriBidiCharType i;
+  char mark[CAPRTL_CHARS];

   caprtl_to_unicode =
     (FriBidiChar *) fribidi_malloc (CAPRTL_CHARS *
 				    sizeof caprtl_to_unicode[0]);
   for (i = 0; i < CAPRTL_CHARS; i++)
-    if (fribidi_get_mirror_char (i, NULL))
+    if (CapRTLCharTypes[i] == fribidi_get_bidi_type(i))
+    {
       caprtl_to_unicode[i] = i;
+      mark[i] = 1;
+    }
     else
       {
+	caprtl_to_unicode[i] = FRIBIDI_UNICODE_CHARS;
+	mark[i] = 0;
+        if (fribidi_get_mirror_char (i, NULL))
+	  DBG ("warning: I could not map mirroring character map to itself in CapRTL");
+
 	for (j = 0; j < num_types; j++)
 	  if (to_type[j] == CapRTLCharTypes[i])
 	    break;
@@ -101,25 +110,36 @@
 	request[j]++;
 	count++;
       }
-  for (i = 1; i < 0x10000 && count; i++)	/* Assign BMP chars to CapRTL entries */
-    if (!fribidi_get_mirror_char (i, NULL))
+  for (i = 0; i < 0x10000 && count; i++)	/* Assign BMP chars to CapRTL entries */
+    if (!fribidi_get_mirror_char (i, NULL) && !(i < CAPRTL_CHARS && mark[i]))
       {
 	int j, k;
+	FriBidiCharType t = fribidi_get_bidi_type (i);
 	for (j = 0; j < num_types; j++)
-	  if (to_type[j] == fribidi_get_bidi_type (i))
+	  if (to_type[j] == t)
 	    break;
 	if (!request[j])	/* Do not need this type */
 	  continue;
 	for (k = 0; k < CAPRTL_CHARS; k++)
-	  if (!caprtl_to_unicode[k] && to_type[j] == CapRTLCharTypes[k])
-	    break;
-	if (k < CAPRTL_CHARS)
+	  if (caprtl_to_unicode[k] == FRIBIDI_UNICODE_CHARS && to_type[j] == CapRTLCharTypes[k])
 	  {
 	    request[j]--;
 	    count--;
 	    caprtl_to_unicode[k] = i;
+	    break;
 	  }
       }
+  if (count)
+  {
+    int j;
+
+    DBG ("warning: could not find a mapping for CapRTL to Unicode:");
+    for (j = 0; j < num_types; j++)
+      if (request[j])
+	DBG2 ("  need this type: %s", fribidi_get_bidi_type_name
+	    (to_type[j]));
+
+  }
 }

 static char


xim: Fix for new style code

xim: Fix for new style code

--- modules/input/gtkimcontextxim.c
+++ modules/input/gtkimcontextxim.c
@@ -1755,14 +1755,19 @@
 on_status_window_draw (GtkWidget *widget,
                        cairo_t   *cr)
 {
-  GtkStyle *style;
-
-  style = gtk_widget_get_style (widget);
-
-  gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
+  GtkStyleContext *style;
+  GdkRGBA color;
+
+  style = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_get_background_color (style, 0, &color);
+  gdk_cairo_set_source_rgba (cr, &color);
   cairo_paint (cr);

-  gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
+  gtk_style_context_get_color (style, 0, &color);
+  gdk_cairo_set_source_rgba (cr, &color);
+  cairo_paint (cr);
+
   cairo_rectangle (cr,
                    0, 0,
                    gtk_widget_get_allocated_width (widget) - 1,
@@ -1772,26 +1777,6 @@
   return FALSE;
 }

-/* We watch the ::style-set signal for our label widget
- * and use that to change it's foreground color to match
- * the 'text' color of the toplevel window. The text/base
- * pair of colors might be reversed from the fg/bg pair
- * that are normally used for labels.
- */
-static void
-on_status_window_style_set (GtkWidget *toplevel,
-			    GtkStyle  *previous_style,
-			    GtkWidget *label)
-{
-  GtkStyle *style;
-  gint i;
-
-  style = gtk_widget_get_style (toplevel);
-
-  for (i = 0; i < 5; i++)
-    gtk_widget_modify_fg (label, i, &style->text[i]);
-}
-
 /* Creates the widgets for the status window; called when we
  * first need to show text for the status window.
  */
@@ -1811,8 +1796,6 @@
   gtk_misc_set_padding (GTK_MISC (status_label), 1, 1);
   gtk_widget_show (status_label);

-  g_signal_connect (window, "style-set",
-		    G_CALLBACK (on_status_window_style_set), status_label);
   gtk_container_add (GTK_CONTAINER (window), status_label);

   g_signal_connect (window, "draw",


tracing/events: fix concurrent access to ftrace_events list, fix

In filter_add_subsystem_pred() we should release event_mutex before
calling filter_free_subsystem_preds(), since both functions hold
event_mutex.

[ Impact: fix deadlock when writing invalid pred into subsystem filter ]

Signed-off-by: Li Zefan <5dc16b054e85ffba6c8d314d8e55ae95dcab12a5@cn.fujitsu.com>
Cc: ca42f6846873622f2a6dc51a5106ba83ffbdaf95@gmail.com
Cc: 645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl
Cc: e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com
Cc: 43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org
LKML-Reference: <bdf669ebe8b526f007ec53eb994f5d1ad47f51c6@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- kernel/trace/trace_events_filter.c
+++ kernel/trace/trace_events_filter.c
@@ -636,14 +636,15 @@

 		err = filter_add_pred(ps, call, pred);
 		if (err) {
+			mutex_unlock(&event_mutex);
 			filter_free_subsystem_preds(system);
 			parse_error(ps, FILT_ERR_BAD_SUBSYS_FILTER, 0);
-			break;
+			goto out;
 		}
 		replace_filter_string(call->filter, filter_string);
 	}
 	mutex_unlock(&event_mutex);
-
+out:
 	return err;
 }


parasite: Don't show hicolor as an icon theme

It really isn't.

--- modules/other/parasite/themes.c
+++ modules/other/parasite/themes.c
@@ -148,6 +148,92 @@
 }

 static void
+fill_icons (const char *path, GHashTable *t)
+{
+  const gchar *dir_entry;
+  GDir *dir = g_dir_open (path, 0, NULL);
+
+  if (!dir)
+    return;
+
+  while ((dir_entry = g_dir_read_name (dir)))
+    {
+      char *filename = g_build_filename (path, dir_entry, "index.theme", NULL);
+
+      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
+          g_strcmp0 (dir_entry, "hicolor") != 0 &&
+          !g_hash_table_contains (t, dir_entry))
+        g_hash_table_add (t, g_strdup (dir_entry));
+
+      g_free (filename);
+    }
+}
+
+static void
+icons_changed (GtkComboBox *c, ParasiteThemes *pt)
+{
+  char *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
+
+  g_object_set (gtk_settings_get_default (),
+                "gtk-icon-theme-name", theme,
+                NULL);
+  g_free (theme);
+}
+
+static GtkWidget *
+create_icons (ParasiteThemes *pt)
+{
+  GtkWidget *b, *l, *c;
+  GHashTable *t;
+  char *theme, *default_theme, *path;
+  GHashTableIter iter;
+  int i, pos;
+  GSettings *settings;
+
+  b = g_object_new (GTK_TYPE_BOX,
+                    "orientation", GTK_ORIENTATION_HORIZONTAL,
+                    "margin", 10,
+                    NULL);
+
+  l = g_object_new (GTK_TYPE_LABEL,
+                    "label", "Icon Theme",
+                    "hexpand", TRUE,
+                    "xalign", 0.0,
+                    NULL);
+  gtk_container_add (GTK_CONTAINER (b), l);
+
+  t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  fill_icons (GTK_DATADIR "/icons", t);
+  path = g_build_filename (g_get_user_data_dir (), "icons", NULL);
+  fill_icons (path, t);
+  g_free (path);
+
+  c = gtk_combo_box_text_new ();
+  gtk_container_add (GTK_CONTAINER (b), c);
+
+  settings = g_settings_new ("org.gnome.desktop.interface");
+  default_theme = g_settings_get_string (settings, "icon-theme");
+  g_object_unref (settings);
+
+  g_hash_table_iter_init (&iter, t);
+  pos = i = 0;
+  while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
+    {
+      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (c), theme);
+      if (g_strcmp0 (theme, default_theme) == 0)
+        pos = i;
+      i++;
+    }
+  g_hash_table_destroy (t);
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (c), pos);
+  g_signal_connect (c, "changed", G_CALLBACK (icons_changed), pt);
+
+  return b;
+}
+
+static void
 constructed (GObject *object)
 {
   ParasiteThemes *pt = PARASITE_THEMES (object);
@@ -159,6 +245,7 @@

   gtk_container_add (box, create_dark (pt));
   gtk_container_add (box, create_gtk (pt));
+  gtk_container_add (box, create_icons (pt));
 }

 static void


lukki

lukki

--- vtrc-common/vtrc-stub-wrapper.h
+++ vtrc-common/vtrc-stub-wrapper.h
@@ -27,7 +27,6 @@
         google::protobuf::RpcChannel                    *channel_;
         stub_type                                        stub_;

-    public:

         template <typename ReqType, typename ResType>
         struct protobuf_call {
@@ -44,13 +43,15 @@

         template <typename RequestType, typename ResponseType>
         struct call_args <void (stub_type::*)
-              (google::protobuf::RpcController *,
-               const RequestType *, ResponseType *,
-               google::protobuf::Closure * )>
+                               (google::protobuf::RpcController *,
+                                const RequestType *, ResponseType *,
+                                google::protobuf::Closure * )>
         {
             typedef RequestType  req_type;
             typedef ResponseType res_type;
         };
+
+    public:

         stub_wrapper(google::protobuf::RpcChannel *channel)
             :channel_(channel)


binding for UDP, extra args

binding for UDP, extra args

--- TraficGen/trafic_gen.c
+++ TraficGen/trafic_gen.c
@@ -2,7 +2,7 @@

 #define BUF_SIZE 200

-void trafic_generator(int proto_id, int packet_size){
+void trafic_generator(char* host, int port, int proto_id, int packet_size){
   int s, s2;
   char* proto;

@@ -21,35 +21,30 @@
   }

   s = i_socket_proto(proto);
-
-  /*if(i_connect(s, "localhost", 8080) < 0) {
+  if(i_connect(s, host, port) < 0) {
     fprintf(stderr, "connection refused\n");
     exit(1);
   }
-
+
+  // Attribution du port 1234 à la socket (cas UDP)
+  if (proto_id == 0) {
+    if(i_bind(s, 1234) < 0) {
+      fprintf(stderr, "tr_gen bind failed\n");
+      exit(1);
+    }
+  }
+  /*
   n = 0;
   while((cnt=read(s, buf, size)) > 0) {
     printf("%s\n", buf);
     n += cnt;
     if(n >= 12) break;
   }
-  close(s);*/
+  close(s);

-  // Attribution du port 8080 à la socket
-  if(i_bind(s, 1234) < 0) {
-    fprintf(stderr, "tr_gen bind failed\n");
-    exit(1);
-  }
+

-  for(;;) {
-    s2 = i_accept(s);
-    fprintf(stderr, "connexion client: %d\n", s2);
-
-    write(s2, response, sizeof(response));
-
-    close(s2);
-    fprintf(stderr, "déconnexion\n");
-  }
+  */
 }

 int main(int argc, char **argv) {
@@ -60,15 +55,15 @@
     return -1;
   }

+  if(atoi(argv[1]) > 1 || atoi(argv[1]) < 0){
+    printf("    Error: PROTOCOL = 0 (UDP) or 1 (TCP)\n");
+    return -1;
+  }
   if (atoi(argv[2]) > 1500 || atoi(argv[2]) < 64) {
     printf("    Error: 64 <= PACKET_SIZE <= 1500\n");
     return -1;
   }
-  if(atoi(argv[1]) > 1 || atoi(argv[1]) < 0){
-    printf("    Error: PROTOCOL = 0 (UDP) or 1 (TCP)\n");
-    return -1;
-  }

-  trafic_generator(atoi(argv[1]), atoi(argv[2]));
+  trafic_generator("localhost", 8080, atoi(argv[1]), atoi(argv[2]));
   return 0;
 }


fts: Fixed running attachment decoder scripts.

--- src/plugins/fts/fts-parser-script.c
+++ src/plugins/fts/fts-parser-script.c
@@ -108,10 +108,11 @@

 static bool script_support_content(struct mail_user *user,
 				   const char **content_type,
-				   const char *extension)
+				   const char *filename)
 {
 	struct fts_parser_script_user *suser = SCRIPT_USER_CONTEXT(user);
 	const struct content *content;
+	const char *extension;

 	if (suser == NULL) {
 		suser = p_new(user->pool, struct fts_parser_script_user, 1);
@@ -123,9 +124,13 @@
 			return FALSE;
 	}

-	if (strcmp(*content_type, "application/octet-stream") != 0) {
+	if (strcmp(*content_type, "application/octet-stream") == 0) {
+		if (filename == NULL)
+			return FALSE;
+		extension = strrchr(filename, '.');
 		if (extension == NULL)
 			return FALSE;
+		extension = filename + 1;

 		array_foreach(&suser->content, content) {
 			if (content->extensions != NULL &&
@@ -144,13 +149,13 @@
 }

 static void parse_content_disposition(const char *content_disposition,
-				      const char **extension_r)
+				      const char **filename_r)
 {
 	struct rfc822_parser_context parser;
 	const char *const *results;
 	string_t *str;

-	*extension_r = NULL;
+	*filename_r = NULL;

 	if (content_disposition == NULL)
 		return;
@@ -167,7 +172,7 @@
 	(void)rfc2231_parse(&parser, &results);
 	for (; *results != NULL; results += 2) {
 		if (strcasecmp(results[0], "filename") == 0) {
-			*extension_r = results[1];
+			*filename_r = results[1];
 			break;
 		}
 	}
@@ -179,11 +184,11 @@
 			   const char *content_disposition)
 {
 	struct script_fts_parser *parser;
-	const char *extension, *path, *cmd;
-	int fd;
-
-	parse_content_disposition(content_disposition, &extension);
-	if (script_support_content(user, &content_type, extension) <= 0)
+	const char *filename, *path, *cmd;
+	int fd;
+
+	parse_content_disposition(content_disposition, &filename);
+	if (script_support_content(user, &content_type, filename) <= 0)
 		return NULL;

 	fd = script_connect(user, &path);


Revert "vp8: Real-time mode: reduce mode_check_freq thresh for speed 10."

This reverts commit 4a7424adba7a65766a92635dc67b6e7d94646693.

Reason for revert: <INSERT REASONING HERE>
Possibly causing test failures in roll into chromium.

Original change's description:
> vp8: Real-time mode: reduce mode_check_freq thresh for speed 10.
>
> Reduces quality regression at speed 10 for real-time mode.
>
> Change-Id: I9f624bea9ca262dab32ce9de7d6d91175d6becc8
>

TBR=marpan@google.com,builds@webmproject.org,jianj@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I1defcb74e78a5a3bd29b7d1b21a96a79fa26a457

--- vp8/encoder/onyx_if.c
+++ vp8/encoder/onyx_if.c
@@ -728,7 +728,6 @@
   SPEED_FEATURES *sf = &cpi->sf;
   int Mode = cpi->compressor_speed;
   int Speed = cpi->Speed;
-  int Speed2;
   int i;
   VP8_COMMON *cm = &cpi->common;
   int last_improved_quant = sf->improved_quant;
@@ -830,16 +829,9 @@
   cpi->mode_check_freq[THR_V_PRED] = cpi->mode_check_freq[THR_H_PRED] =
       cpi->mode_check_freq[THR_B_PRED] =
           speed_map(Speed, mode_check_freq_map_vhbpred);
-
-  // For real-time mode at speed 10 keep the mode_check_freq threshold
-  // for NEW1 similar to that of speed 9.
-  Speed2 = Speed;
-  if (cpi->Speed == 10 && Mode == 2) Speed2 = RT(9);
-  cpi->mode_check_freq[THR_NEW1] = speed_map(Speed2, mode_check_freq_map_new1);
-
+  cpi->mode_check_freq[THR_NEW1] = speed_map(Speed, mode_check_freq_map_new1);
   cpi->mode_check_freq[THR_NEW2] = cpi->mode_check_freq[THR_NEW3] =
       speed_map(Speed, mode_check_freq_map_new2);
-
   cpi->mode_check_freq[THR_SPLIT1] =
       speed_map(Speed, mode_check_freq_map_split1);
   cpi->mode_check_freq[THR_SPLIT2] = cpi->mode_check_freq[THR_SPLIT3] =


corrected IXUS v name

corrected IXUS v name

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@1906 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/canon/canon.c
+++ camlibs/canon/canon.c
@@ -77,7 +77,7 @@
 	{ "Canon PowerShot A20", 	0x04A9, 0x304E, 0 },
 	{ "Canon PowerShot A10", 	0x04A9, 0x304F, 0 },
 	{ "Canon PowerShot S110",	0x04A9, 0x3051, 0 },
-	{ "Canon Digital IXUS v",       0x04A9, 0x3052, 0 },
+	{ "Canon DIGITAL IXUS v",       0x04A9, 0x3052, 0 },
 	{ 0, 0, 0}
 };


C++: Remove unimplemented function in LookupContext

Should have been removed in fbb756cd.

Change-Id: I86e0fd556ac031e6a88e9397a039d67ded5f7bd7
Reviewed-by: Nikolai Kosjar <9571db158ca61a0d070db010803474231fa0cbab@theqtcompany.com>

--- src/libs/cplusplus/LookupContext.h
+++ src/libs/cplusplus/LookupContext.h
@@ -133,7 +133,6 @@
                                   Clone &cloner,
                                   Subst &subst,
                                   ClassOrNamespace *enclosingTemplateClassInstantiation);
-    bool isInstantiateNestedClassNeeded(const QList<Symbol *>& symbols, const Subst &subst) const;
     ClassOrNamespace *findSpecialization(const TemplateNameId *templId,
                                          const TemplateNameIdTable &specializations);


Fixed an encoder debug/relese mismatch in x86_64-win64-vs8

Visual c++ compiler uses xmm registers for floating point
operations for 64 bit architecture, therefore its calling
convention requires the preservation of xmm6-xmm15 in any
function that have used these registers. However, the sse2
functions, that were originally written for 32 bit windows,
may have used xmm6 and xmm7 without preserving the content.
In this particular case, the compiler used xmm6 to save
the variable "two_pass_min_rate", the value of the variable
is mucked up by our sse2 optimized loop filter functions,
hence the results of release/debug mismatching.

--- vp8/encoder/onyx_if.c
+++ vp8/encoder/onyx_if.c
@@ -4738,7 +4738,6 @@
 #if !(CONFIG_REALTIME_ONLY)
 static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
 {
-    double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);

     if (!cpi->common.refresh_alt_ref_frame)
         vp8_second_pass(cpi);
@@ -4747,7 +4746,11 @@
     cpi->bits_left -= 8 * *size;

     if (!cpi->common.refresh_alt_ref_frame)
+    {
+        double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
+            *cpi->oxcf.two_pass_vbrmin_section / 100);
         cpi->bits_left += (long long)(two_pass_min_rate / cpi->oxcf.frame_rate);
+    }
 }
 #endif


corrected Digital Ixus 300 model string thanks to Marc Schiffbauer

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@1837 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/canon/psa50.c
+++ camlibs/canon/psa50.c
@@ -1055,7 +1055,7 @@
       A5=0;
       return 1;
     }
-    else if ((!strcmp("DIGITAL IXUS 300",cs->ident))
+    else if ((!strcmp("Canon DIGITAL IXUS 300",cs->ident))
 	     || (!strcmp("Canon IXY DIGITAL 300",cs->ident))
 	     || (!strcmp("Canon PowerShot S300",cs->ident))) {
       gp_frontend_status(camera, "Detected a Digital IXUS 300 / IXY DIGITAL 300 / Powershot S300");
@@ -1231,7 +1231,7 @@
 	gp_frontend_status(camera, "Detected a Digital IXUS / IXY DIGITAL / Powershot S100");
 	cs->model = CANON_PS_S100;
 	A5=0;
-    } else if ((!strcmp("DIGITAL IXUS 300",psa50_id))
+    } else if ((!strcmp("Canon DIGITAL IXUS 300",psa50_id))
 	       || (!strcmp("Canon IXY DIGITAL 300",psa50_id))
 	       || (!strcmp("Canon PowerShot S300",psa50_id)))
       {


highlevel: fix null pointer bug

highlevel: fix null pointer bug

--- src/libs/highlevel/elektra_error.c
+++ src/libs/highlevel/elektra_error.c
@@ -264,8 +264,12 @@
 	error->reason = reason;
 	error->errorKey = key;

-	kdb_long_t warningCount;
-	elektraKeyToLong (keyGetMeta (key, "warnings"), &warningCount);
+	kdb_long_t warningCount = 0;
+	const Key * warningsKey = keyGetMeta (key, "warnings");
+	if (warningsKey != NULL)
+	{
+		elektraKeyToLong (warningsKey, &warningCount);
+	}

 	error->warningCount = warningCount;
 	if (warningCount > 0)


*** empty log message ***

*** empty log message ***

--- modules/svg_loader/svg_parser.c
+++ modules/svg_loader/svg_parser.c
@@ -1,7 +1,7 @@
 /*
  *					GPAC Multimedia Framework
  *
- *			Authors: Cyril Concolato - Jean le Feuvre
+ *			Authors: Cyril Concolato - Jean le Feuvre - Jean-Claude Moissinac
  *				Copyright (c) 2005-200X ENST
  *					All rights reserved
  *
@@ -40,7 +40,255 @@
 	SVGElement *parent;
 } defered_element;

+Bool SVG_hasBeenIDed(SVGParser *parser, xmlChar *node_name);
+u32 svg_get_node_id(SVGParser *parser, xmlChar *nodename);
 SVGElement *svg_parse_element(SVGParser *parser, xmlNodePtr node, SVGElement *parent);
+
+#define  MAXCHARS		100
+
+void svg_convert_length_unit_to_user_unit(SVGParser *parser, SVG_Length *length);
+void svg_parse_attribute(SVGParser *parser, GF_FieldInfo *info, SVGElement *n, xmlChar *attribute_content, u8 anim_value_type, u8 transform_anim_datatype);
+void svg_parse_style(SVGParser *parser, SVGElement *elt, char *style);
+
+typedef enum {
+	UNDEF		= 0,
+	STARTSVG	= 1,
+	SVGCONTENT	= 2,
+	UNKNOWN		= 3,
+	FINISHSVG	= 4,
+	ERROR		= 5
+} SVGParserStatesEnum;
+
+typedef struct  parserState {
+    s32					return_val;
+    SVGParserStatesEnum	state;
+    SVGParserStatesEnum	prev_state;
+	s32					unknown_depth;
+	SVGParser		*	parser; // initial full doc parser structure
+	GF_List			*	svg_node_stack; // to know the current parent of following nodes
+	xmlSAXHandlerPtr	sax; // sax handler used by libxml
+} GP_ParserState;
+
+static void svg_init_root_element(SVGParser *parser, SVGsvgElement *root_svg)
+{
+	svg_convert_length_unit_to_user_unit(parser, &(root_svg->width));
+	svg_convert_length_unit_to_user_unit(parser, &(root_svg->height));
+	if (root_svg->width.type != SVG_LENGTH_PERCENTAGE) {
+		parser->svg_w = FIX2INT(root_svg->width.number);
+		parser->svg_h = FIX2INT(root_svg->height.number);
+		gf_sg_set_scene_size_info(parser->graph, parser->svg_w, parser->svg_h, 1);
+	} else {
+		/* if unit for width & height is in percentage, then the only meaningful value for
+		width and height is 100 %. In this case, we don't specify a value. It will be assigned by the renderer */
+		parser->svg_w = parser->svg_h = 0;
+	}
+	gf_sg_set_root_node(parser->graph, (GF_Node *)root_svg);
+}
+
+void svg_start_document(void *user_data)
+{
+	GP_ParserState	*ps = (GP_ParserState *)user_data;
+	ps->state = STARTSVG;
+	ps->unknown_depth = 0;
+}
+
+void svg_end_document(void *user_data)
+{
+	GP_ParserState	*ps = (GP_ParserState *)user_data;
+	ps->state = FINISHSVG;
+}
+
+xmlEntityPtr svg_get_entity(void * user_data, const xmlChar *name)
+{
+	GP_ParserState	*ps = (GP_ParserState *)user_data;
+	return xmlGetPredefinedEntity(name);
+}
+
+Bool is_svg_text_element(SVGElement *elt)
+{
+	u32 tag = elt->sgprivate->tag;
+	return ((tag==TAG_SVG_text)||(tag==TAG_SVG_textArea)||(tag==TAG_SVG_tspan));
+}
+
+void svg_characters(void *user_data, const xmlChar *ch, s32 len)
+{
+	GP_ParserState	*ps = (GP_ParserState *)user_data;
+	SVGElement *elt = (SVGElement *)gf_list_get(ps->svg_node_stack,gf_list_count(ps->svg_node_stack)-1);
+	if (is_svg_text_element(elt))
+	{
+		// TODO verify if the libxml SAX parser gives a brute force string
+		// or a cleaned string
+		SVGtextElement *text = (SVGtextElement *)elt;
+		//if (text->xml_space.string && !strcmp(text->xml_space.string, "preserve")) {
+		//	text->textContent = strdup(ch);
+		//} else
+		{
+			text->textContent = (char *)malloc(len+1);
+			strncpy(text->textContent, ch, len); // TODO vérifier ce qui se passe en fct du jeu de char
+			text->textContent[len]=0;
+		}
+	}
+}
+
+void svg_parse_element_id(SVGParser *parser,
+						  SVGElement *elt,
+						  char *nodename)
+{
+	u32 id = 0;
+	SVGElement *unided_elt;
+
+	unided_elt = (SVGElement *)gf_sg_find_node_by_name(parser->graph, nodename);
+	if (unided_elt) {
+		id = gf_node_get_id((GF_Node *)unided_elt);
+		if (SVG_hasBeenIDed(parser, nodename)) unided_elt = NULL;
+	} else {
+		id = svg_get_node_id(parser, nodename);
+	}
+	gf_node_set_id((GF_Node *)elt, id, nodename);
+	if (unided_elt) gf_node_replace((GF_Node *)unided_elt, (GF_Node *)elt, 0);
+
+	gf_list_add(parser->ided_nodes, elt);
+}
+
+SVGElement *svg_create_node(GP_ParserState	*ps, const xmlChar *name, const xmlChar **attrs, SVGElement *parent)
+{
+	u32 tag;
+	u8 anim_datatype = 0;
+	u8 anim_transform_type = 0;
+	SVGElement *elt;
+	s32 attribute_index = 0;
+
+	/* Translates the node type (called name) from a String into a unique numeric identifier in GPAC */
+	tag = SVG_GetTagByName(name);
+	if (tag == TAG_UndefinedNode) {
+		ps->parser->last_error = GF_SG_UNKNOWN_NODE;
+		return NULL;
+	}
+
+	/* Creates a node in the current scene graph */
+	elt = SVG_NewNode(ps->parser->graph, tag);
+	if (!elt) {
+		ps->parser->last_error = GF_SG_UNKNOWN_NODE;
+		return NULL;
+	}
+	gf_node_register((GF_Node *)elt, (GF_Node *)parent);
+	if (parent && elt) gf_list_add(parent->children, elt);
+
+	/* Parsing the style attribute */
+	attribute_index=0;
+	if (attrs)
+	while (attrs[attribute_index]!=NULL) {
+		if (stricmp(attrs[attribute_index],"style")==0) {
+			svg_parse_style(ps->parser, elt, (xmlChar *)attrs[attribute_index+1]);
+			break;
+		}
+		attribute_index+=2;
+	}
+
+	/* Parsing all the other attributes, with a special case of id */
+	attribute_index=0;
+	if (attrs)
+	while (attrs[attribute_index]) {
+		if (!stricmp(attrs[attribute_index], "id")) {
+			svg_parse_element_id(ps->parser, elt, (xmlChar *)attrs[attribute_index+1]);
+		} else if (!stricmp(attrs[attribute_index], "attributeName")) {
+			/* already dealt with above */
+		} else if (!stricmp(attrs[attribute_index], "type")) {
+			if (tag == TAG_SVG_animateTransform) {
+			/* already dealt with above */
+			} else {
+				GF_FieldInfo info;
+				if (!gf_node_get_field_by_name((GF_Node *)elt, "type", &info)) {
+					svg_parse_attribute(ps->parser, &info, elt, (xmlChar *)attrs[attribute_index+1], anim_datatype, anim_transform_type);
+				}
+			}
+		} else if (!stricmp(attrs[attribute_index], "href")) {
+			if (tag == TAG_SVG_set ||
+					tag == TAG_SVG_animate ||
+					tag == TAG_SVG_animateColor ||
+					tag == TAG_SVG_animateTransform ||
+					tag == TAG_SVG_animateMotion ||
+					tag == TAG_SVG_discard) {
+			/* already dealt with above */
+			} else {
+				GF_FieldInfo info;
+				if (!gf_node_get_field_by_name((GF_Node *)elt, "xlink:href", &info)) {
+					svg_parse_attribute(ps->parser, &info, elt, (xmlChar *)attrs[attribute_index+1], anim_datatype, anim_transform_type);
+				}
+			}
+		} else {
+			GF_FieldInfo info;
+			if (!gf_node_get_field_by_name((GF_Node *)elt, (char *)attrs[attribute_index], &info)) {
+				svg_parse_attribute(ps->parser, &info, elt, (xmlChar *)attrs[attribute_index+1], anim_datatype, anim_transform_type);
+			}
+		}
+		attribute_index+=2;
+	}
+	/* We need to init the node at the end of the parsing, after parsing all attributes */
+	if (elt) gf_node_init((GF_Node *)elt);
+	return elt;
+}
+
+void svg_start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
+{
+	GP_ParserState	*ps = (GP_ParserState *)user_data;
+	SVGElement *elt;
+
+	switch(ps->state) {
+	case STARTSVG:
+		if (!stricmp((char *)name, "svg")) {
+			elt = svg_create_node(ps, name, attrs, NULL);
+			if (!elt) {
+				ps->parser->last_error = GF_SG_UNKNOWN_NODE;
+				ps->state = ERROR;
+				return;
+			} else {
+				svg_init_root_element(ps->parser, (SVGsvgElement *)elt);
+			}
+			ps->svg_node_stack = gf_list_new();
+			if (!ps->svg_node_stack) {
+				ps->state = ERROR;
+				return;
+			}
+			gf_list_add(ps->svg_node_stack, elt);
+			ps->state = SVGCONTENT;
+		} else {
+			ps->prev_state = STARTSVG;
+			ps->unknown_depth++;
+			ps->state = UNKNOWN;
+		}
+		break;
+	case SVGCONTENT:
+		elt = svg_create_node(ps, name, attrs,
+							  (SVGElement *)gf_list_get(ps->svg_node_stack,gf_list_count(ps->svg_node_stack)-1));
+		if (elt)
+			gf_list_add(ps->svg_node_stack, elt);
+		else {
+			ps->prev_state = SVGCONTENT;
+			ps->unknown_depth++;
+			ps->state = UNKNOWN;
+		}
+		break;
+	case UNKNOWN:
+		ps->unknown_depth++;
+		break;
+	}
+}
+void svg_end_element(void *user_data, const xmlChar *name)
+{
+	GP_ParserState	*ps = (GP_ParserState *)user_data;
+	switch(ps->state) {
+	case STARTSVG:
+		break;
+	case SVGCONTENT:
+		gf_list_rem(ps->svg_node_stack,gf_list_count(ps->svg_node_stack)-1);
+		break;
+	case UNKNOWN:
+		ps->unknown_depth--;
+		if (ps->unknown_depth==0) ps->state = ps->prev_state;
+		break;
+	}
+}

 /* Generic Scene Graph handling functions for ID */
 Bool SVG_hasBeenIDed(SVGParser *parser, xmlChar *node_name)
@@ -280,8 +528,7 @@
 		if (strstr(str, "%")) is_percentage = 1;
 		str = strstr(str, "(");
 		str++;
-		sscanf(str, "%f", &_val);
-		col->red = FLT2FIX(_val);
+		sscanf(str, "%f", &_val); col->red = FLT2FIX(_val);
 		str = strstr(str, ",");
 		str++;
 		sscanf(str, "%f", &_val); col->green = FLT2FIX(_val);
@@ -1947,32 +2194,12 @@

 }

-void svg_parse_element_id(SVGParser *parser,
-						  SVGElement *elt,
-						  char *nodename)
-{
-	u32 id = 0;
-	SVGElement *unided_elt;
-
-	unided_elt = (SVGElement *)gf_sg_find_node_by_name(parser->graph, nodename);
-	if (unided_elt) {
-		id = gf_node_get_id((GF_Node *)unided_elt);
-		if (SVG_hasBeenIDed(parser, nodename)) unided_elt = NULL;
-	} else {
-		id = svg_get_node_id(parser, nodename);
-	}
-	gf_node_set_id((GF_Node *)elt, id, nodename);
-	if (unided_elt) gf_node_replace((GF_Node *)unided_elt, (GF_Node *)elt, 0);
-
-	gf_list_add(parser->ided_nodes, elt);
-}
-
 /* Parses all the attributes of an element except id */
-void svg_parse_attributes(SVGParser *parser,
-						  xmlNodePtr node,
-						  SVGElement *elt,
-						  u8 anim_value_type,
-						  u8 anim_transform_type)
+void svg_parse_attributes_from_node(SVGParser *parser,
+									xmlNodePtr node,
+									SVGElement *elt,
+									u8 anim_value_type,
+									u8 anim_transform_type)
 {
 	xmlAttrPtr attributes;
 	char *style;
@@ -2066,9 +2293,7 @@
 	}
 }

-void svg_parse_element_inside(SVGParser *parser,
-							  xmlNodePtr node,
-							  SVGElement *elt)
+void svg_parse_children_elements(SVGParser *parser, xmlNodePtr node, SVGElement *elt)
 {
 	xmlNodePtr children;
 	u32 tag;
@@ -2160,9 +2385,9 @@
 		}
 	}

-	svg_parse_attributes(parser, node, elt, anim_value_type, anim_transform_type);
-
-	svg_parse_element_inside(parser, node, elt);
+	svg_parse_attributes_from_node(parser, node, elt, anim_value_type, anim_transform_type);
+
+	svg_parse_children_elements(parser, node, elt);
 	/* We need to init the node at the end of the parsing, after parsing all attributes */
 	if (elt) gf_node_init((GF_Node *)elt);
 }
@@ -2214,9 +2439,9 @@
 		return elt;
 	}

-	svg_parse_attributes(parser, node, elt, 0, 0);
-
-	svg_parse_element_inside(parser, node, elt);
+	svg_parse_attributes_from_node(parser, node, elt, 0, 0);
+
+	svg_parse_children_elements(parser, node, elt);
 	/* We need to init the node at the end of the parsing, after parsing all attributes */
 	if (elt) gf_node_init((GF_Node *)elt);
 	return elt;
@@ -2252,9 +2477,6 @@
 		xmllib_is_init=1;
 	}

-	/* determine document wallclock begin time (cf SMIL spec)*/
-	//gf_utc_time_since_1970(&(parser->begin_sec), &(parser->begin_ms));
-
 	doc = xmlParseFile(parser->fileName);
 	if (doc == NULL) return GF_BAD_PARAM;
 	root = xmlDocGetRootElement(doc);
@@ -2272,21 +2494,7 @@
 	parser->defered_animation_elements = gf_list_new();

 	n = svg_parse_element(parser, root, NULL);
-	if (n) {
-		SVGsvgElement *root_svg = (SVGsvgElement *)n;
-		svg_convert_length_unit_to_user_unit(parser, &(root_svg->width));
-		svg_convert_length_unit_to_user_unit(parser, &(root_svg->height));
-		if (root_svg->width.type != SVG_LENGTH_PERCENTAGE) {
-			parser->svg_w = FIX2INT(root_svg->width.number);
-			parser->svg_h = FIX2INT(root_svg->height.number);
-			gf_sg_set_scene_size_info(parser->graph, parser->svg_w, parser->svg_h, 1);
-		} else {
-			/* if unit for width & height is in percentage, then the only meaningful value for
-			width and height is 100 %. In this case, we don't specify a value. It will be assigned by the renderer */
-			parser->svg_w = parser->svg_h = 0;
-		}
-		gf_sg_set_root_node(parser->graph, (GF_Node *)n);
-	}
+	if (n) svg_init_root_element(parser, (SVGsvgElement *)n);

 	/* Resolve time elements */
 	while (gf_list_count(parser->unresolved_timing_elements) > 0) {
@@ -2321,129 +2529,98 @@
 	return GF_OK;
 }

-
-GF_Err SVGParser_ParseFragmentedDoc(SVGParser *parser)
-{
-	xmlDocPtr doc = NULL;
-	xmlNodePtr root = NULL;
-	FILE *input;
-	SVGElement *n;
-	SVGElement *parent;
-	char szTmpFile[GF_MAX_PATH];
-	char b[0xFFF0];
-	u32 ret;
-	u8 fin = 0;
-	u8 intern_segment = 0;
-	FILE *tmp;
-
+static GF_Err SVGParser_ParseProgressiveDoc(SVGParser *parser)
+{
+	xmlDocPtr doc		= NULL;
+	xmlNodePtr root		= NULL;
+    xmlSAXHandlerPtr	sax;
+	xmlParserCtxtPtr	ctxt;
+    char				inputbuffer[MAXCHARS];
+    s32					res;
+	GP_ParserState		svg_parser_state;
+	FILE				*desc;
+
 	if (!parser->fileName) return GF_BAD_PARAM;
-	input = fopen(parser->fileName, "rt");
-	if (!input) return GF_EOS;
-
-	memset(b, 0, 0xFFF0);

 	/* XML Related code */
+	if (!xmllib_is_init) {
+		xmlInitParser();
+		LIBXML_TEST_VERSION
+		xmllib_is_init=1;
+	}
+
+    desc = fopen(parser->fileName, "rb");
+    if (desc == NULL) return GF_IO_ERR;
+
+	svg_parser_state.state	= UNDEF;
+	svg_parser_state.parser = parser;
+    /*
+     * Read a few first byte to check the input used for the
+     * encoding detection at the parser level.
+     */
+    res = fread(inputbuffer, 1, 4, desc);
+    if (res <= 0)  return GF_IO_ERR; /* TODO verify cleanup: fclose... */
+
+	sax = (xmlSAXHandlerPtr)calloc(1, sizeof(xmlSAXHandler));
+	sax->startDocument	= svg_start_document;
+	sax->endDocument	= svg_end_document;
+	sax->characters		= svg_characters;
+	sax->endElement		= svg_end_element;
+	sax->startElement	= svg_start_element;
+	sax->getEntity		= svg_get_entity;

-	xmlInitParser();
-	LIBXML_TEST_VERSION
-
-	sprintf(szTmpFile, "%s%creconstruct.svgm", parser->temp_dir, GF_PATH_SEPARATOR);
-
-	/*check we begin with <g> or <svg>*/
-	ret = fread(b, 1, 0xFFF0, input);
-	if (strncmp(b, "<g", 2)) {
-		intern_segment = 0;
-		tmp = fopen(szTmpFile, "wt");
-	} else {
-		//ici, le début du fichier est <g...
-		//d plus, si ce segment est la fin du fchier,il faut le détecter
-		//on va d'ailleurs initialiser un booléen (intern_segment)pour que ce soit pris en compte
-		intern_segment = 1;
-		tmp = fopen(szTmpFile,"wt");
-		fwrite("<g xmlns:xlink=\"toto\">", 1, strlen("<g xmlns:xlink=\"toto\">"), tmp);
-	}
-#if 0
-	/*move to end*/
-	fseek(input, 50, SEEK_END);
-	fread(b, 1, 50, input);
-	fseek(input, 0, SEEK_SET);
-#endif
-
-
-	if (ret == 0xFFF0){
-		fwrite(b, 1, ret, tmp);
-		while ((ret = fread(b, 1, 0xFFF0, input)) == 0xFFF0) {
-			fwrite(b, 1, ret, tmp);
-		}
-	}
-
-	if (!((b[ret-8] == '<') && (b[ret-7] == '/') && (b[ret-6] == 's') && (b[ret-5] == 'v') && (b[ret-4] == 'g') && (b[ret-3] == '>'))) {
-		//pas </svg> à la fin
-		if (!(intern_segment)) {
-		//intern_segment == 0
-		//svg au début, pas à la fin
-			strcat (b, "</svg>");
-			fwrite(b, 1, ret+6, tmp);
-		} else {
-			strcat (b, "</g>");
-			fwrite(b, 1, ret+4, tmp);
-		}
-	}else{
-	//svg à la fin
-		fin = 1;
-		if (intern_segment){
-			//intern_segment == 1
-			//</svg> à la fin, mais g au début... on retire svg
-			fwrite(b, 1, ret-7, tmp);
-			fwrite("/g>", 1, 3, tmp);
-		}else{
-			//intern_segment == 0
-			//</svg> à la fin
-			fwrite(b, 1, ret, tmp);
-		}
-	}
-	fclose(tmp);
-
-	doc = xmlParseFile(szTmpFile);
-
-	if (doc == NULL) return GF_BAD_PARAM;
-
-	root = xmlDocGetRootElement(doc);
-
-	if (stricmp(root->name, "svg")){
-		parent = (SVGElement *) gf_sg_get_root_node(parser->graph);
-	}else{
-		parent = NULL;
-	}
-	/*fin d tests*/
-
+	svg_parser_state.sax = sax;
+
 	/* Scene Graph related code */
 	parser->ided_nodes = gf_list_new();
-
-	n = svg_parse_element(parser, root, parent);
-	if (parent != NULL) {
-		gf_list_add(parent->children, n);
-	}
-	if (parent == NULL) {
-		SVGsvgElement *root_svg = (SVGsvgElement *)n;
-		svg_convert_length_unit_to_user_unit(parser, &(root_svg->width));
-		svg_convert_length_unit_to_user_unit(parser, &(root_svg->height));
-		parser->svg_w = FIX2INT(root_svg->width.number);
-		parser->svg_h = FIX2INT(root_svg->height.number);
-		gf_sg_set_scene_size_info(parser->graph, parser->svg_w, parser->svg_h, 1);
-		gf_sg_set_root_node(parser->graph, (GF_Node *)n);
-	}
-
-	if (fin) return GF_EOS;
+
+	/* List of elements to be after parsing but before rendering */
+	parser->unresolved_timing_elements = gf_list_new();
+
+	/*
+     * Create a progressive parsing context, the 2 first arguments
+     * are not used since we want to build a tree and not use a SAX
+     * parsing interface. We also pass the first bytes of the document
+     * to allow encoding detection when creating the parser but this
+     * is optional.
+     */
+    ctxt = xmlCreatePushParserCtxt(sax, &svg_parser_state,
+                                   inputbuffer, res, parser->fileName);
+    if (ctxt == NULL)  return GF_IO_ERR; /* TODO setup a better error value and verify cleanup: fclose... */
+
+    /*
+     * loop on the input getting the document data,
+	 * must be replaced by a more realistic access to data
+     */
+    while ((res = fread(inputbuffer, 1, MAXCHARS, desc)) > 0) {
+        xmlParseChunk(ctxt, inputbuffer, res, 0);
+    }
+
+    /*
+     * there is no more input, indicate the parsing is finished.
+     */
+    xmlParseChunk(ctxt, inputbuffer, 0, 1);
+
+    /*
+     * destroy the parser context.
+     */
+    xmlFreeParserCtxt(ctxt);
+
+	fclose(desc);
+
+    /*
+     * Cleanup function for the XML library.
+     */
+    xmlCleanupParser();
+
 	return GF_OK;
 }

-
 GF_Err SVGParser_Parse(SVGParser *parser)
 {
-	if (parser->oti == 2) return SVGParser_ParseFullDoc(parser);
-	else if (parser->oti == 3) return SVGParser_ParseFragmentedDoc(parser);
-	else if (parser->oti == 4) return SVGParser_ParseLASeR(parser);
+	if (parser->oti == 3)		return SVGParser_ParseFullDoc(parser);
+	else if (parser->oti == 2)	return SVGParser_ParseProgressiveDoc(parser);
+	else if (parser->oti == 4)	return SVGParser_ParseLASeR(parser);
 	return GF_BAD_PARAM;
 }


Replace the array initialization using the gcc-specific format [constant] value with the C99 format [constant] = value

--- sys/netgraph/atm/uni/ng_uni_cust.h
+++ sys/netgraph/atm/uni/ng_uni_cust.h
@@ -140,11 +140,11 @@

 #define	UNICORE								\
 size_t unimem_sizes[UNIMEM_TYPES] = {					\
-	[UNIMEM_INS]	sizeof(struct uni),				\
-	[UNIMEM_ALL]	sizeof(struct uni_all),				\
-	[UNIMEM_SIG]	sizeof(struct sig),				\
-	[UNIMEM_CALL]	sizeof(struct call),				\
-	[UNIMEM_PARTY]	sizeof(struct party)				\
+	[UNIMEM_INS]	= sizeof(struct uni),				\
+	[UNIMEM_ALL]	= sizeof(struct uni_all),			\
+	[UNIMEM_SIG]	= sizeof(struct sig),				\
+	[UNIMEM_CALL]	= sizeof(struct call),				\
+	[UNIMEM_PARTY]	= sizeof(struct party)				\
 };

 #define	memmove(T, F, L) bcopy((F), (T), (L))


added Canon S45 and S230 in PTP mode

added Canon S45 and S230 in PTP mode

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@5562 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/ptp/library.c
+++ camlibs/ptp/library.c
@@ -212,6 +212,12 @@
 	/* Nikon D100 has a PTP mode: westin 2002.10.16 */
 	{"Nikon DSC D100", 0x04b0, 0x0402},

+	/* (at least some) newer Canon cameras can be switched between
+	 * PTP and "normal" (i.e. Canon) mode
+	 */
+	{"Canon PowerShot S45 (PTP mode)", 0x04A9, 0x306D}, /* 0x306C is S45 in normal (canon) mode */
+	{"Canon PowerShot S230 (PTP mode)", 0x04A9, 0x3071}, /* 0x3070 is S230 in normal (canon) mode */
+
 	/* more comming soon :) */
 	{NULL, 0, 0}
 };


On large fiels (over 50M) deletion takes over 3 seconds

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@4372 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/ptp/library.c
+++ camlibs/ptp/library.c
@@ -938,8 +938,9 @@
 	/* the transaction_id is incemente before sending, thus it means 0x0 */
 	camera->pl->params.transaction_id=0xffffffff;

+	/* On large fiels (over 50M) deletion takes over 3 seconds */
+	CR (gp_port_set_timeout (camera->port, 6000));
 	/* Configure the port */
-	CR (gp_port_set_timeout (camera->port, 3000));
 	CR (gp_port_get_settings (camera->port, &settings));

 	/* Use the defaults the core parsed */


unsigned loop bounds

unsigned loop bounds

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@14519 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/ptp2/config.c
+++ camlibs/ptp2/config.c
@@ -202,7 +202,7 @@
 		return translate_ptp_result (ret);
 	}
 	if (dpd.FormFlag == PTP_DPFF_Enumeration) {
-		int			i;
+		unsigned int	i;
 		for (i=0;i<dpd.FORM.Enum.NumberOfValues;i++) {
 			if (dpd.FORM.Enum.SupportedValue[i].u32 != PTP_CANON_EOS_CAPTUREDEST_HD) {
 				cardval = dpd.FORM.Enum.SupportedValue[i].u32;
@@ -6190,10 +6190,11 @@
 {
 	CameraWidget		*section, *widget, *subwindow;
 	uint16_t		ret2;
-	int			menuno, submenuno, ret;
+	unsigned int		menuno, submenuno;
+	int			ret;
 	PTPParams		*params = &camera->pl->params;
 	PTPPropertyValue	propval;
-	int			i;
+	unsigned int		i;
 	CameraAbilities		ab;


anaglyph: dead code

anaglyph: dead code

--- modules/video_filter/anaglyph.c
+++ modules/video_filter/anaglyph.c
@@ -45,8 +45,7 @@
  * color schemes */
 enum scheme_e
 {
-    unknown = 0,
-    red_green,
+    red_green = 1,
     red_blue,
     red_cyan,
     trioscopic,
@@ -156,9 +155,6 @@
             p_sys->left = 0xff00ff;
             p_sys->right = 0x00ffff;
             break;
-        case unknown:
-            msg_Err(p_filter, "Oops");
-            break;
     }

     p_filter->pf_video_filter = Filter;


fixed build on older compilers

fixed build on older compilers

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@9586 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/ptp2/config.c
+++ camlibs/ptp2/config.c
@@ -1739,15 +1739,14 @@
 static int
 _get_nikon_list_wifi_profiles (CONFIG_GET_ARGS)
 {
-	gp_widget_new (GP_WIDGET_SECTION, _(menu->label), widget);
-	gp_widget_set_name (*widget, menu->name);
-
 	CameraWidget *child;
-
 	int ret;
 	char buffer[4096];
 	int i;
 	PTPParams *params = &(camera->pl->params);
+
+	gp_widget_new (GP_WIDGET_SECTION, _(menu->label), widget);
+	gp_widget_set_name (*widget, menu->name);

 	if (params->deviceinfo.VendorExtensionID != PTP_VENDOR_NIKON)
 		return (GP_ERROR_NOT_SUPPORTED);