mesa: re-implement _mesa_ProgramEnvParameter4fvARB() with memcpy()

This is faster and ensures that NaN floats get stored properly.
Before, NaN values (which might be used with UP2H, UP2US, UP4B and
UP4UB) weren't getting stored properly with gcc -O3.

This is the second part of the fix for the piglit fp-unpack-01 failure
(bug 25973).

--- src/mesa/shader/arbprogram.c
+++ src/mesa/shader/arbprogram.c
@@ -561,6 +561,8 @@
    }
 }

+
+
 /**
  * Set a program env parameter register.
  * \note Called from the GL API dispatcher.
@@ -569,10 +571,35 @@
  */
 void GLAPIENTRY
 _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
-                                   const GLfloat *params)
-{
-   _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1],
-                                  params[2], params[3]);
+                                const GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
+
+   if (target == GL_FRAGMENT_PROGRAM_ARB
+       && ctx->Extensions.ARB_fragment_program) {
+      if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter4fv(index)");
+         return;
+      }
+      memcpy(ctx->FragmentProgram.Parameters[index], params,
+             4 * sizeof(GLfloat));
+   }
+   else if (target == GL_VERTEX_PROGRAM_ARB /* == GL_VERTEX_PROGRAM_NV */
+       && (ctx->Extensions.ARB_vertex_program || ctx->Extensions.NV_vertex_program)) {
+      if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter4fv(index)");
+         return;
+      }
+      memcpy(ctx->VertexProgram.Parameters[index], params,
+             4 * sizeof(GLfloat));
+   }
+   else {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter4fv(target)");
+      return;
+   }
 }


Fix vompilation of bdcsvd with ICC.

Fix vompilation of bdcsvd with ICC.

--- unsupported/Eigen/src/SVD/BDCSVD.h
+++ unsupported/Eigen/src/SVD/BDCSVD.h
@@ -37,10 +37,14 @@
 template<typename _MatrixType>
 class BDCSVD : public SVDBase<_MatrixType>
 {
+  typedef SVDBase<_MatrixType> Base;

 public:
+  using Base::rows;
+  using Base::cols;
+
   typedef _MatrixType MatrixType;
-  typedef typename SVDBase<_MatrixType>::MatrixType::Scalar Scalar;
+  typedef typename MatrixType::Scalar Scalar;
   typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
   typedef typename MatrixType::Index Index;
   enum {


Fix a problem where remote files could be removed by exploiting race conditions similar to those reported in CERT's CA-91:10a advisory. Obtained from: Hiroshi NAKANO <nakano@rins.ryukoku.ac.jp> by way of CERT.

--- usr.sbin/lpr/common_source/rmjob.c
+++ usr.sbin/lpr/common_source/rmjob.c
@@ -191,6 +191,8 @@
 	while (getline(cfp)) {
 		switch (line[0]) {
 		case 'U':  /* unlink associated files */
+			if (strchr(line+1, '/') || strncmp(line+1, "df", 2))
+				break;
 			if (from != host)
 				printf("%s: ", host);
 			printf(unlink(line+1) ? "cannot dequeue %s\n" :


Fixed adding offset to host side cap manager.

--- usr/drivers/xeon_phi/sysmem_caps.c
+++ usr/drivers/xeon_phi/sysmem_caps.c
@@ -36,6 +36,9 @@
 /// the memory manager for the system memory
 static struct mm sysmem_manager;

+/// offset to the base address
+static lpaddr_t base_offset = 0;
+
 /// the slot allocator
 static struct range_slot_allocator sysmem_allocator;

@@ -60,6 +63,8 @@
     if (err_is_fail(err)) {
         return err;
     }
+
+    base_offset = ret.base;

     XSYSMEM_DEBUG("Initializing memory manager\n");

@@ -132,7 +137,7 @@
     // size = (size+BASE_PAGE_SIZE-1) & ~(BASE_PAGE_SIZE - 1);

     // transform the address into the host memory range
-    base += XEON_PHI_SYSMEM_BASE;
+    base += base_offset;

     err = mm_alloc_range(&sysmem_manager, bits,
                          base, base+(1UL << bits), frame, NULL);


Remove unused variable.

Remove unused variable.

--- usrsctplib/netinet6/sctp6_usrreq.c
+++ usrsctplib/netinet6/sctp6_usrreq.c
@@ -1815,7 +1815,7 @@
 {
 	int error;
 	int family;
-	uint32_t vrf_id;
+
 	family = so->so_proto->pr_domain->dom_family;

 	if (req == PRU_CONTROL) {


Clarified licence

Clarified licence

--- source/APPLICATIONS/QuEasyViz/CSVInputDialog.h
+++ source/APPLICATIONS/QuEasyViz/CSVInputDialog.h
@@ -1,23 +1,3 @@
-/* CSVInputDialog.h
- *
- * Copyright (C) 2009 Marcel Schumann
- *
- * This file is part of QuEasy -- A Toolbox for Automated QSAR Model
- * Construction and Validation.
- * QuEasy is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or (at
- * your option) any later version.
- *
- * QuEasy is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef CSVINPUTDIALOG_H
 #define CSVINPUTDIALOG_H


more docs for RobotState

more docs for RobotState

--- moveit_core/robot_state/include/moveit/robot_state/robot_state.h
+++ moveit_core/robot_state/include/moveit/robot_state/robot_state.h
@@ -189,13 +189,13 @@
     }
   }

-  /** \brief Get the valur of a particular variable. An exception is thrown if the variable is not known. */
+  /** \brief Get the position of a particular variable. An exception is thrown if the variable is not known. */
   const double getVariablePosition(const std::string &variable) const
   {
     return position_[robot_model_->getVariableIndex(variable)];
   }

-  /** \brief Get the valur of a particular variable. The variable is
+  /** \brief Get the position of a particular variable. The variable is
       specified by its index. No checks are performed for the validity
       of the index passed  */
   const double getVariablePosition(int index) const
@@ -237,33 +237,46 @@
     // assume everything is in order in terms of array lengths (for efficiency reasons)
     memcpy(velocity_, velocity, robot_model_->getVariableCount() * sizeof(double));
   }
-
+
+  /** \brief Given an array with velocity values for all variables, set those values as the velocities in this state */
   void setVariableVelocities(const std::vector<double> &velocity)
   {
     assert(robot_model_->getVariableCount() <= velocity.size()); // checked only in debug mode
     setVariableVelocities(&velocity[0]);
   }
-
+
+  /** \brief Set the velocities of a set of variables. If unknown variable names are specified, an exception is thrown. */
   void setVariableVelocities(const std::map<std::string, double> &variable_map);
+
+  /** \brief Set the velocities of a set of variables. If unknown variable names are specified, an exception is thrown.
+      Additionally, \e missing_variables is filled with the names of the variables that are not set. */
   void setVariableVelocities(const std::map<std::string, double> &variable_map, std::vector<std::string>& missing_variables);
+
+  /** \brief Set the velocities of a set of variables. If unknown variable names are specified, an exception is thrown. */
   void setVariableVelocities(const std::vector<std::string>& variable_names, const std::vector<double>& variable_velocity);
-
+
+  /** \brief Set the velocity of a variable. If an unknown variable name is specified, an exception is thrown. */
   void setVariableVelocity(const std::string &variable, double value)
   {
     setVariableVelocity(robot_model_->getVariableIndex(variable), value);
   }
-
+
+  /** \brief Set the velocity of a single variable. The variable is specified by its index (a value associated by the RobotModel to each variable) */
   void setVariableVelocity(int index, double value)
   {
     markVelocity();
     velocity_[index] = value;
   }

+  /** \brief Get the velocity of a particular variable. An exception is thrown if the variable is not known. */
   const double getVariableVelocity(const std::string &variable) const
   {
     return velocity_[robot_model_->getVariableIndex(variable)];
   }

+  /** \brief Get the velocity of a particular variable. The variable is
+      specified by its index. No checks are performed for the validity
+      of the index passed  */
   const double getVariableVelocity(int index) const
   {
     return velocity_[index];
@@ -276,22 +289,27 @@
    *  @{
    */

+  /** \brief By default, if accelerations are never set or initialized, the state remembers that there are no accelerations set. This is
+      useful to know when serializing or copying the state. If hasAccelerations() reports true, hasEffort() will certainly report false. */
   bool hasAccelerations() const
   {
     return has_acceleration_;
   }

+  /** \brief Get raw access to the accelerations of the variables that make up this state. The values are in the same order as reported by getVariableNames(). The area of memory overlaps with effort (effort and acceleration should not be set at the same time) */
   double* getVariableAccelerations()
   {
     markAcceleration();
     return acceleration_;
   }

+  /** \brief Get const raw access to the accelerations of the variables that make up this state. The values are in the same order as reported by getVariableNames() */
   const double* getVariableAccelerations() const
   {
     return acceleration_;
   }

+  /** \brief Given an array with acceleration values for all variables, set those values as the accelerations in this state */
   void setVariableAccelerations(const double *acceleration)
   {
     has_acceleration_ = true;
@@ -301,32 +319,45 @@
     memcpy(acceleration_, acceleration, robot_model_->getVariableCount() * sizeof(double));
   }

+  /** \brief Given an array with acceleration values for all variables, set those values as the accelerations in this state */
   void setVariableAccelerations(const std::vector<double> &acceleration)
   {
     assert(robot_model_->getVariableCount() <= acceleration.size()); // checked only in debug mode
     setVariableAccelerations(&acceleration[0]);
   }
-
+
+  /** \brief Set the accelerations of a set of variables. If unknown variable names are specified, an exception is thrown. */
   void setVariableAccelerations(const std::map<std::string, double> &variable_map);
+
+  /** \brief Set the accelerations of a set of variables. If unknown variable names are specified, an exception is thrown.
+      Additionally, \e missing_variables is filled with the names of the variables that are not set. */
   void setVariableAccelerations(const std::map<std::string, double> &variable_map, std::vector<std::string>& missing_variables);
+
+  /** \brief Set the accelerations of a set of variables. If unknown variable names are specified, an exception is thrown. */
   void setVariableAccelerations(const std::vector<std::string>& variable_names, const std::vector<double>& variable_acceleration);

+  /** \brief Set the acceleration of a variable. If an unknown variable name is specified, an exception is thrown. */
   void setVariableAcceleration(const std::string &variable, double value)
   {
     setVariableAcceleration(robot_model_->getVariableIndex(variable), value);
   }

+  /** \brief Set the acceleration of a single variable. The variable is specified by its index (a value associated by the RobotModel to each variable) */
   void setVariableAcceleration(int index, double value)
   {
     markAcceleration();
     acceleration_[index] = value;
   }

+  /** \brief Get the acceleration of a particular variable. An exception is thrown if the variable is not known. */
   const double getVariableAcceleration(const std::string &variable) const
   {
     return acceleration_[robot_model_->getVariableIndex(variable)];
   }
-
+
+  /** \brief Get the acceleration of a particular variable. The variable is
+      specified by its index. No checks are performed for the validity
+      of the index passed  */
   const double getVariableAcceleration(int index) const
   {
     return acceleration_[index];
@@ -339,22 +370,27 @@
    *  @{
    */

+  /** \brief By default, if effort is never set or initialized, the state remembers that there is no effort set. This is
+      useful to know when serializing or copying the state. If hasEffort() reports true, hasAccelerations() will certainly report false. */
   bool hasEffort() const
   {
     return has_effort_;
   }

+  /** \brief Get raw access to the effort of the variables that make up this state. The values are in the same order as reported by getVariableNames(). The area of memory overlaps with accelerations (effort and acceleration should not be set at the same time) */
   double* getVariableEffort()
   {
     markEffort();
     return effort_;
   }

+  /** \brief Get const raw access to the effort of the variables that make up this state. The values are in the same order as reported by getVariableNames(). */
   const double* getVariableEffort() const
   {
     return effort_;
   }

+  /** \brief Given an array with effort values for all variables, set those values as the effort in this state */
   void setVariableEffort(const double *effort)
   {
     has_effort_ = true;
@@ -363,32 +399,45 @@
     memcpy(effort_, effort, robot_model_->getVariableCount() * sizeof(double));
   }

+  /** \brief Given an array with effort values for all variables, set those values as the effort in this state */
   void setVariableEffort(const std::vector<double> &effort)
   {
     assert(robot_model_->getVariableCount() <= effort.size()); // checked only in debug mode
     setVariableEffort(&effort[0]);
   }

+  /** \brief Set the effort of a set of variables. If unknown variable names are specified, an exception is thrown. */
   void setVariableEffort(const std::map<std::string, double> &variable_map);
+
+  /** \brief Set the effort of a set of variables. If unknown variable names are specified, an exception is thrown.
+      Additionally, \e missing_variables is filled with the names of the variables that are not set. */
   void setVariableEffort(const std::map<std::string, double> &variable_map, std::vector<std::string>& missing_variables);
+
+  /** \brief Set the effort of a set of variables. If unknown variable names are specified, an exception is thrown. */
   void setVariableEffort(const std::vector<std::string>& variable_names, const std::vector<double>& variable_acceleration);
-
+
+  /** \brief Set the effort of a variable. If an unknown variable name is specified, an exception is thrown. */
   void setVariableEffort(const std::string &variable, double value)
   {
     setVariableEffort(robot_model_->getVariableIndex(variable), value);
   }
-
+
+  /** \brief Set the effort of a single variable. The variable is specified by its index (a value associated by the RobotModel to each variable) */
   void setVariableEffort(int index, double value)
   {
     markEffort();
     effort_[index] = value;
   }
-
+
+  /** \brief Get the effort of a particular variable. An exception is thrown if the variable is not known. */
   const double getVariableEffort(const std::string &variable) const
   {
     return effort_[robot_model_->getVariableIndex(variable)];
   }
-
+
+  /** \brief Get the effort of a particular variable. The variable is
+      specified by its index. No checks are performed for the validity
+      of the index passed  */
   const double getVariableEffort(int index) const
   {
     return effort_[index];
@@ -479,7 +528,9 @@
   /** \defgroup setGroupPosition_Fn Getting and setting group positions
    *  @{
    */
-
+
+  /** \brief Given positions for the variables that make up a group, in the order found in the group (including values of mimic joints), set those
+as the new values that correspond to the group */
   void setJointGroupPositions(const std::string &joint_group_name, const double *gstate)
   {
     const JointModelGroup *jmg = robot_model_->getJointModelGroup(joint_group_name);
@@ -487,6 +538,8 @@
       setJointGroupPositions(jmg, gstate);
   }

+  /** \brief Given positions for the variables that make up a group, in the order found in the group (including values of mimic joints), set those
+as the new values that correspond to the group */
   void setJointGroupPositions(const std::string &joint_group_name, const std::vector<double> &gstate)
   {
     const JointModelGroup *jmg = robot_model_->getJointModelGroup(joint_group_name);
@@ -494,13 +547,19 @@
       setJointGroupPositions(jmg, &gstate[0]);
   }

+  /** \brief Given positions for the variables that make up a group, in the order found in the group (including values of mimic joints), set those
+as the new values that correspond to the group */
   void setJointGroupPositions(const JointModelGroup *group, const std::vector<double> &gstate)
   {
     setJointGroupPositions(group, &gstate[0]);
   }

+  /** \brief Given positions for the variables that make up a group, in the order found in the group (including values of mimic joints), set those
+as the new values that correspond to the group */
   void setJointGroupPositions(const JointModelGroup *group, const double *gstate);

+  /** \brief Given positions for the variables that make up a group, in the order found in the group (including values of mimic joints), set those
+as the new values that correspond to the group */
   void setJointGroupPositions(const std::string &joint_group_name, const Eigen::VectorXd& values)
   {
     const JointModelGroup *jmg = robot_model_->getJointModelGroup(joint_group_name);
@@ -508,8 +567,11 @@
       setJointGroupPositions(jmg, values);
   }

+  /** \brief Given positions for the variables that make up a group, in the order found in the group (including values of mimic joints), set those
+as the new values that correspond to the group */
   void setJointGroupPositions(const JointModelGroup *group, const Eigen::VectorXd& values);

+  /** \brief For a given group, copy the position values of the variables that make up the group into another location, in the order that the variables are found in the group. This is not necessarily a contiguous block of memory in the RobotState itself, so we copy instead of returning a pointer.*/
   void copyJointGroupPositions(const std::string &joint_group_name, std::vector<double> &gstate) const
   {
     const JointModelGroup *jmg = robot_model_->getJointModelGroup(joint_group_name);
@@ -520,6 +582,7 @@
     }
   }

+  /** \brief For a given group, copy the position values of the variables that make up the group into another location, in the order that the variables are found in the group. This is not necessarily a contiguous block of memory in the RobotState itself, so we copy instead of returning a pointer.*/
   void copyJointGroupPositions(const std::string &joint_group_name, double *gstate) const
   {
     const JointModelGroup *jmg = robot_model_->getJointModelGroup(joint_group_name);
@@ -527,21 +590,25 @@
       copyJointGroupPositions(jmg, gstate);
   }

+  /** \brief For a given group, copy the position values of the variables that make up the group into another location, in the order that the variables are found in the group. This is not necessarily a contiguous block of memory in the RobotState itself, so we copy instead of returning a pointer.*/
   void copyJointGroupPositions(const JointModelGroup *group, std::vector<double> &gstate) const
   {
     gstate.resize(group->getVariableCount());
     copyJointGroupPositions(group, &gstate[0]);
   }

+  /** \brief For a given group, copy the position values of the variables that make up the group into another location, in the order that the variables are found in the group. This is not necessarily a contiguous block of memory in the RobotState itself, so we copy instead of returning a pointer.*/
   void copyJointGroupPositions(const JointModelGroup *group, double *gstate) const;

+  /** \brief For a given group, copy the position values of the variables that make up the group into another location, in the order that the variables are found in the group. This is not necessarily a contiguous block of memory in the RobotState itself, so we copy instead of returning a pointer.*/
   void copyJointGroupPositions(const std::string &joint_group_name, Eigen::VectorXd& values) const
   {
     const JointModelGroup *jmg = robot_model_->getJointModelGroup(joint_group_name);
     if (jmg)
       copyJointGroupPositions(jmg, values);
   }
-
+
+  /** \brief For a given group, copy the position values of the variables that make up the group into another location, in the order that the variables are found in the group. This is not necessarily a contiguous block of memory in the RobotState itself, so we copy instead of returning a pointer.*/
   void copyJointGroupPositions(const JointModelGroup *group, Eigen::VectorXd& values) const;

   /** \brief If the group this state corresponds to is a chain and a solver is available, then the joint values can be set by computing inverse kinematics.


dont loop forever on read from event fd

--- src/modules/battery/batget.c
+++ src/modules/battery/batget.c
@@ -449,8 +449,8 @@
 			  (errno == EBADF) ||
 			  (errno == EPIPE) ||
 			  (errno == EINVAL) ||
-			  (errno == ENOSPC) ||
-			  (num == 0));
+			  (errno == ENOSPC));
+		  if (num == 0) break;
 	       }
 	  }
 	if (lost)
@@ -820,8 +820,8 @@
 			  (errno == EBADF) ||
 			  (errno == EPIPE) ||
 			  (errno == EINVAL) ||
-			  (errno == ENOSPC) ||
-			  (num == 0));
+			  (errno == ENOSPC));
+		  if (num == 0) break;
 	       }
 	  }
 	if (lost)


adds functionality for dense block matrices

--- src/matrix.h
+++ src/matrix.h
@@ -176,6 +176,99 @@
 } sm_fl_ml_t;

 /**
+ * \brief returns number of row blocks for dense block submatrix A
+ *
+ * \param dense block submatrix A
+ *
+ * \return number of row blocks for A
+ */
+inline ri_t get_number_dense_row_blocks(dbm_fl_t *A)
+{
+  return (ri_t) ceil((float) A->nrows / __GBLA_SIMD_BLOCK_SIZE);
+}
+
+/**
+ * \brief returns number of column blocks for dense block submatrix A
+ *
+ * \param dense block submatrix A
+ *
+ * \return number of column blocks for A
+ */
+inline ci_t get_number_dense_col_blocks(dbm_fl_t *A)
+{
+  return (ci_t) ceil((float) A->ncols / __GBLA_SIMD_BLOCK_SIZE);
+}
+
+/**
+ * \brief Initializes dense block submatrices
+ *
+ * \param dense block submatrix A
+ *
+ * \param number of rows nrows
+ *
+ * \param number of columns ncols
+ */
+inline void init_dbm(dbm_fl_t *A, const ri_t nrows, const ri_t ncols)
+{
+  int i, j;
+
+  // initialize meta data for block submatrices
+  A->nrows  = nrows;  // row dimension
+  A->ncols  = ncols;  // col dimension
+  A->nnz    = 0;      // number nonzero elements
+
+  // allocate memory for blocks
+
+  // row and column loops
+  const ci_t clA  = get_number_dense_col_blocks(A);
+  const ri_t rlA  = get_number_dense_row_blocks(A);
+
+  A->blocks = (dbl_t **)malloc(rlA * sizeof(dbl_t *));
+  for (i=0; i<rlA; ++i) {
+    A->blocks[i]  = (dbl_t *)malloc(clA * sizeof(dbl_t));
+    for (j=0; j<clA; ++j) {
+      A->blocks[i][j].val = NULL;
+    }
+  }
+}
+
+/**
+ * \brief Frees given dense block submatrix A
+ *
+ * \param dense block submatrix A
+ *
+ * \param number of threads for parallel computation
+ */
+inline void free_dense_submatrix(dbm_fl_t **A_in, int nthrds)
+{
+  dbm_fl_t *A     = *A_in;
+  const ci_t clA  = get_number_dense_col_blocks(A);
+  const ri_t rlA  = get_number_dense_row_blocks(A);
+  ri_t j;
+  ci_t i;
+  // free A
+#pragma omp parallel num_threads(nthrds)
+  {
+#pragma omp for private(i,j)
+    for (j=0; j<rlA; ++j) {
+      for (i=0; i<clA; ++i) {
+        if (A->blocks[j][i].val != NULL) {
+          free(A->blocks[j][i].val);
+          A->blocks[j][i].val  = NULL;
+        }
+      }
+      free(A->blocks[j]);
+      A->blocks[j]  = NULL;
+    }
+  }
+  free(A->blocks);
+  A->blocks = NULL;
+  free(A);
+  A = NULL;
+  *A_in  = A;
+}
+
+/**
  * \brief Copies data from block matrix in to input sparse matrix format. If deleteIn
  * is set the input block matrix in is deleted.
  *
@@ -233,7 +326,7 @@
  * \param block height bheight
  *
  * \param block width bwidth
- *
+ -*
  * \param freeing memory? if 1 then memory is freed, otherwise not, free_memory
  *
  * \param number of threads for parallel computations nthrds


silence efm printfs

silence efm printfs

SVN revision: 71942

--- src/modules/fileman/e_fwin.c
+++ src/modules/fileman/e_fwin.c
@@ -1254,14 +1254,14 @@
     */
    snprintf(buf, sizeof(buf), "%s/.directory.desktop", e_fm2_real_path_get(page->fm_obj));
    ef = efreet_desktop_new(buf);
-   printf("EF=%p for %s\n", ef, buf);
+   //printf("EF=%p for %s\n", ef, buf);
    if (ef)
      {
         fwin->wallpaper_file = _e_fwin_custom_file_path_eval(fwin, ef, fwin->wallpaper_file, "X-Enlightenment-Directory-Wallpaper");
         fwin->overlay_file = _e_fwin_custom_file_path_eval(fwin, ef, fwin->overlay_file, "X-Enlightenment-Directory-Overlay");
         fwin->scrollframe_file = _e_fwin_custom_file_path_eval(fwin, ef, fwin->scrollframe_file, "X-Enlightenment-Directory-Scrollframe");
         fwin->theme_file = _e_fwin_custom_file_path_eval(fwin, ef, fwin->theme_file, "X-Enlightenment-Directory-Theme");
-        printf("fwin->wallpaper_file = %s\n", fwin->wallpaper_file);
+        //printf("fwin->wallpaper_file = %s\n", fwin->wallpaper_file);
         efreet_desktop_free(ef);
      }
    else
@@ -1291,7 +1291,7 @@
      }
    if (fwin->over_obj)
      {
-        printf("over obj\n");
+        //printf("over obj\n");
         evas_object_hide(fwin->over_obj);
         if (fwin->overlay_file)
           {


Show pretty-printed help text instead of 'ctrl-c to exit'

Signed-off-by: Joachim Wiberg <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- src/mcjoin.c
+++ src/mcjoin.c
@@ -19,6 +19,7 @@
 #include "config.h"

 #include <arpa/inet.h>		/* inet_pton() on Solaris */
+#include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
@@ -325,9 +326,25 @@
 	PRINT("Uptime: %s", uptime(now - start));
 }

+static void prettyprint(FILE *fp, const char *str)
+{
+	fputs("\e[2m", fp);
+	while (*str) {
+		if (isupper(*str)) {
+			fputs("\e[0m\e[1m", fp);
+			fputc(*str, fp);
+			fputs("\e[0m\e[2m", fp);
+		} else
+			fputc(*str, fp);
+
+		str++;
+	}
+	fputs("\e[0m", fp);
+}
+
 static void redraw(int signo)
 {
-	const char *howto = "ctrl-c to exit";
+	const char *howto = "[Log | Toggle | Quit]";
 	const char *title;

 	if (pres == 1 || !foreground)
@@ -345,7 +362,7 @@
 	gotoxy((width - strlen(title)) / 2, TITLE_ROW);
 	fprintf(stderr, "\e[1m%s\e[0m", title);
 	gotoxy((width - strlen(howto)) / 2, HOSTDATE_ROW);
-	fprintf(stderr, "\e[2m%s\e[0m", howto);
+	prettyprint(stderr, howto);

 	gotoxy(0, LOGHEADING_ROW); /* Thu Nov  5 09:08:59 2020 */
 	fprintf(stderr, "\e[7m%-24s  Log%*s\e[0m", "Time", width - 29, " ");
@@ -440,7 +457,7 @@
 			}
 			break;

-		case 'D':
+		case 'l':
 			if (log_pri == -1)
 				log_pri = log_level(NULL);
 			if (log_level(NULL) != LOG_DEBUG)


Add support for cubic spline keyframe interpolation;

--- src/modules/graphics/model.c
+++ src/modules/graphics/model.c
@@ -248,7 +248,7 @@
 }

 void lovrModelAnimate(Model* model, uint32_t animationIndex, float time, float alpha) {
-  if (alpha == 0.f) {
+  if (alpha <= 0.f) {
     return;
   }

@@ -277,24 +277,39 @@
       float t1 = channel->times[keyframe - 1];
       float t2 = channel->times[keyframe];
       float z = (time - t1) / (t2 - t1);
-      float next[4];
-
-      memcpy(property, channel->data + (keyframe - 1) * n, n * sizeof(float));
-      memcpy(next, channel->data + keyframe * n, n * sizeof(float));

       switch (channel->smoothing) {
         case SMOOTH_STEP:
-          if (z >= .5f) {
-            memcpy(property, next, n * sizeof(float));
+          memcpy(property, channel->data + (z >= .5f ? keyframe : keyframe - 1) * n, n * sizeof(float));
+          break;
+        case SMOOTH_LINEAR:
+          memcpy(property, channel->data + (keyframe - 1) * n, n * sizeof(float));
+          lerp(property, channel->data + keyframe * n, z);
+          break;
+        case SMOOTH_CUBIC: {
+          int stride = 3 * n;
+          float* p0 = channel->data + (keyframe - 1) * stride + 1 * n;
+          float* m0 = channel->data + (keyframe - 1) * stride + 2 * n;
+          float* p1 = channel->data + (keyframe - 0) * stride + 1 * n;
+          float* m1 = channel->data + (keyframe - 0) * stride + 0 * n;
+          float dt = t2 - t1;
+          float z2 = z * z;
+          float z3 = z2 * z;
+          float a = 2.f * z3 - 3.f * z2 + 1.f;
+          float b = 2.f * z3 - 3.f * z2 + 1.f;
+          float c = (-2.f * z3 + 3.f * z2);
+          float d = (z3 * -z2) * dt;
+          for (size_t j = 0; j < n; j++) {
+            property[j] = a * p0[j] + b * m0[j] + c * p1[j] + d * m1[j];
           }
           break;
-        case SMOOTH_LINEAR: lerp(property, next, z); break;
-        case SMOOTH_CUBIC: lovrThrow("Cubic spline interpolation is not supported yet"); break;
-        default: break;
-      }
-    }
-
-    if (alpha == 1.f) {
+        }
+        default:
+          break;
+      }
+    }
+
+    if (alpha >= 1.f) {
       memcpy(transform->properties[channel->property], property, n * sizeof(float));
     } else {
       lerp(transform->properties[channel->property], property, alpha);


[MDITAB] Optimize WM_PAINT.

[MDITAB] Optimize WM_PAINT.

--- src/mditab.c
+++ src/mditab.c
@@ -585,9 +585,10 @@
 }

 static void
-mditab_paint(mditab_t* mditab, HDC dc)
+mditab_paint(mditab_t* mditab, HDC dc, RECT* dirty)
 {
     RECT rect;
+    RECT* rect_item;
     RECT r;
     UINT i;
     HFONT old_font;
@@ -605,10 +606,15 @@

     /* Draw unselected tabs */
     for(i = mditab->item_first_visible; i < MDITAB_COUNT(mditab); i++) {
-        if(!mditab_is_item_visible(mditab, i))
+        rect_item = &MDITAB_ITEM(mditab, i)->rect;
+
+        if(rect_item->left > mditab->rect_main.right)
             break;
+        if(rect_item->right < dirty->left || rect_item->left > dirty->right)
+            continue;
         if(i == mditab->item_selected)
             continue;
+
         mditab_paint_item(mditab, dc, i);
     }

@@ -635,7 +641,9 @@
     }

     /* Draw the selected tab */
-    if(mditab_is_item_visible(mditab, mditab->item_selected))
+    rect_item = &MDITAB_ITEM(mditab, mditab->item_selected)->rect;
+    if((dirty->left <= rect_item->left && rect_item->left <= rect_item->right) ||
+       (dirty->left <= rect_item->right && rect_item->right <= rect_item->right))
         mditab_paint_item(mditab, dc, mditab->item_selected);

     SelectObject(dc, old_font);
@@ -1090,8 +1098,9 @@
     if(def_w != mditab->item_def_width  ||  min_w != mditab->item_min_width) {
         mditab->item_def_width = def_w;
         mditab->item_min_width = min_w;
+        mditab_layout(mditab);
         if(!mditab->no_redraw)
-            InvalidateRect(win, NULL, TRUE);
+            InvalidateRect(win, NULL, TRUE);
     }
     return TRUE;
 }
@@ -1374,9 +1383,15 @@
                 HDC dc = (HDC)wp;
                 PAINTSTRUCT ps;

-                if(wp == 0)
+                if(wp == 0) {
                     dc = BeginPaint(win, &ps);
-                mditab_paint(mditab, dc);
+                } else if(msg == WM_PAINT) {
+                    GetUpdateRect(win, &ps.rcPaint, TRUE);
+                    ValidateRect(win, NULL);
+                } else {
+                    GetClientRect(win, &ps.rcPaint);
+                }
+                mditab_paint(mditab, dc, &ps.rcPaint);
                 if(wp == 0)
                     EndPaint(win, &ps);
             }


iov: Remove unused variable

iov: Remove unused variable

Signed-off-by: Eduardo Silva <b6525c140147034c280e3cd2f39161f32f3f4f62@gmail.com>

--- src/mk_iov.c
+++ src/mk_iov.c
@@ -99,7 +99,6 @@

 int mk_iov_realloc(struct mk_iov *mk_io, int new_size)
 {
-    int i;
     char **new_buf;
     struct iovec *new_io;


Port movlpd

Port movlpd

--- src/native/instructions_0f.c
+++ src/native/instructions_0f.c
@@ -351,9 +351,27 @@
 static void instr_0F10() { unimplemented_sse(); }
 static void instr_0F11() { unimplemented_sse(); }
 static void instr_0F12() { unimplemented_sse(); }
-static void instr_660F12() { unimplemented_sse(); }
+
+static void instr_660F12() {
+    // movlpd xmm, xmm/m64
+    task_switch_test_mmx();
+    read_modrm_byte();
+    union reg64 data = read_xmm_mem64s();
+    write_xmm64(data.u32[0], data.u32[1]);
+}
+
 static void instr_0F13() { unimplemented_sse(); }
-static void instr_660F13() { unimplemented_sse(); }
+
+static void instr_660F13()
+{
+    // movlpd xmm/m64, xmm
+    task_switch_test_mmx();
+    read_modrm_byte();
+    union reg64 data = read_xmm64s();
+    int32_t addr = modrm_resolve(*modrm_byte);
+    safe_write64(addr, data.s32[0], data.s32[1]);
+}
+
 static void instr_0F14() { unimplemented_sse(); }
 static void instr_660F14() { unimplemented_sse(); }
 static void instr_0F15() { unimplemented_sse(); }


Initial Checkin

Initial Checkin

error: pathspec 'lib/commonAPI/coreapi/ext/platform/wm/src/NotificationDefines.h' did not match any file(s) known to git

--- lib/commonAPI/coreapi/ext/platform/wm/src/NotificationDefines.h
+++ lib/commonAPI/coreapi/ext/platform/wm/src/NotificationDefines.h
@@ -0,0 +1,176 @@
+
+//--------------------------------------------------------------------
+// FILENAME:			NtfyDef.h
+//
+// Copyright(c) 1999,2000 Symbol Technologies Inc. All rights reserved.
+//
+// DESCRIPTION:			Constants and types used by notification functions
+//
+// NOTES:				Public
+//
+//
+//--------------------------------------------------------------------
+
+
+#ifndef NTFYDEF_H_
+#define NTFYDEF_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+//--------------------------------------------------------------------
+// Nested Includes
+//--------------------------------------------------------------------
+
+#include <StrucInf.h>
+
+
+//--------------------------------------------------------------------
+// Constants
+//--------------------------------------------------------------------
+
+
+#define NOTIFYAPI WINAPI
+
+#define MAX_OBJECT_NAME MAX_PATH
+
+
+//--------------------------------------------------------------------
+// Types
+//--------------------------------------------------------------------
+
+
+enum tagNOTIFY_OBJECT_TYPES
+{
+	NOTIFY_TYPE_LED			= 0,
+	NOTIFY_TYPE_BEEPER		= 1,
+	NOTIFY_TYPE_VIBRATOR	= 2,
+
+	NOTIFY_TYPE_UNKNOWN		= -1
+};
+
+
+enum tag_NOTIFY_OBJECT_STATES
+{
+	NOTIFY_STATE_OFF		= 0,
+	NOTIFY_STATE_ON			= 1,
+	NOTIFY_STATE_CYCLE		= 2,
+
+	NOTIFY_STATE_UNKNOWN	= -1
+};
+
+
+// Find information structure
+//   Find information structure is filled in by C API by
+//     enumerating and reading the registry keys under
+//     ..\Drivers\Active\..  and ..\Drivers\BuiltIn\..
+
+typedef struct tagNOTIFY_FINDINFO_W
+{
+	STRUCT_INFO 	StructInfo;
+
+	WCHAR szObjectName[MAX_OBJECT_NAME];
+	DWORD dwObjectType;
+	DWORD dwObjectIndex;
+
+} NOTIFY_FINDINFO_W;
+
+typedef NOTIFY_FINDINFO_W FAR * LPNOTIFY_FINDINFO_W;
+
+typedef struct tagNOTIFY_FINDINFO_A
+{
+	STRUCT_INFO 	StructInfo;
+
+	CHAR szObjectName[MAX_OBJECT_NAME];
+	DWORD dwObjectType;
+	DWORD dwObjectIndex;
+
+} NOTIFY_FINDINFO_A;
+
+typedef NOTIFY_FINDINFO_A FAR * LPNOTIFY_FINDINFO_A;
+
+#ifdef UNICODE
+#define NOTIFY_FINDINFO NOTIFY_FINDINFO_W
+#define LPNOTIFY_FINDINFO LPNOTIFY_FINDINFO_W
+#else
+#define NOTIFY_FINDINFO NOTIFY_FINDINFO_A
+#define LPNOTIFY_FINDINFO LPNOTIFY_FINDINFO_A
+#endif
+
+
+// Version information structure
+typedef struct tagNOTIFY_VERSION_INFO
+{
+	STRUCT_INFO 	StructInfo;
+
+	DWORD			dwCAPIVersion;	// HIWORD = major ver LOWORD = minor ver.
+
+} NOTIFY_VERSION_INFO;
+
+typedef NOTIFY_VERSION_INFO FAR * LPNOTIFY_VERSION_INFO;
+
+
+typedef struct tagLED_SPECIFIC
+{
+	DWORD dwOnDuration;		// Duration LED is on per cycle in milliseconds
+
+	DWORD dwOffDuration;	// Duration LED is off per cycle in milliseconds
+
+	DWORD dwCount;			// Number of cycles (on+off) to generate
+
+} LED_SPECIFIC;
+
+
+typedef struct tagBEEPER_SPECIFIC
+{
+	DWORD dwFrequency;		// Frequency of beep in Hertz
+
+	DWORD dwVolume;			// Volume of beep
+
+	DWORD dwDuration;		// Duration of beep in milliseconds
+
+} BEEPER_SPECIFIC;
+
+
+typedef struct tagVIBRATOR_SPECIFIC
+{
+	DWORD dwDuration;		// Duration of vibration in milliseconds
+
+} VIBRATOR_SPECIFIC;
+
+
+typedef union tagOBJECT_TYPE_SPECIFIC
+{
+	DWORD dwUntyped[20];					// For init and anonymous access
+
+	LED_SPECIFIC LedSpecific;
+
+	BEEPER_SPECIFIC BeeperSpecific;
+
+	VIBRATOR_SPECIFIC VibratorSpecific;
+
+} OBJECT_TYPE_SPECIFIC;
+
+
+typedef struct tagCYCLE_INFO
+{
+	STRUCT_INFO 	StructInfo;
+
+	DWORD dwObjectType;
+
+	OBJECT_TYPE_SPECIFIC ObjectTypeSpecific;
+
+} CYCLE_INFO;
+
+typedef CYCLE_INFO FAR * LPCYCLE_INFO;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	// #ifndef NTFYDEF_H_
+


Decrement reference count if insobj2() failed.

--- src/module.c
+++ src/module.c
@@ -244,7 +244,11 @@
     PyObject *v = PyInt_FromLong(value);
     if (v == NULL)
         return -1;
-    return insobj2(d, extra, name, v);
+    if (insobj2(d, extra, name, v) < 0) {
+        Py_DECREF(v);
+        return -1;
+    }
+    return 0;
 }

 #define insint(d, name, value) \


Actually remove static from #3331.

Actually remove static from #3331.

I forgot -a when amending in the previous commit.

--- src/module.c
+++ src/module.c
@@ -1447,8 +1447,7 @@
  * Key API for Sorted Set iterator
  * -------------------------------------------------------------------------- */

-static void zsetKeyReset(RedisModuleKey *key)
-{
+void zsetKeyReset(RedisModuleKey *key) {
     key->ztype = REDISMODULE_ZSET_RANGE_NONE;
     key->zcurrent = NULL;
     key->zer = 1;


implement the rest of netpbm

implement the rest of netpbm

--- src/netpbm.c
+++ src/netpbm.c
@@ -58,15 +58,49 @@
 	return (struct image *)b;
 }

+static unsigned char readvali(struct netpbm_t *b){
+	skipspace(b->f);
+	int val;
+	fscanf(b->f, "%i", &val);
+	return val * 255 / b->maxval;
+}
+
+static unsigned char readvalb(struct netpbm_t *b){
+	int val = fgetc(b->f);
+	return val * 255 / b->maxval;
+}
+
 int netpbm_read(struct image *img){
 	struct netpbm_t *b = (struct netpbm_t *)img;
 	FILE *f = b->f;
 	int a = 0;

 	int left = img->bufwidth * img->bufheight;
-	int j, c;
+	int j, c, val;

-	if(b->format == '4'){
+	if(b->format == '1'){
+		while(left--){
+			skipspace(f);
+			val = fgetc(f);
+			val = val == '1' ? 0 : 255;
+			img->buf[a++] = val;
+			img->buf[a++] = val;
+			img->buf[a++] = val;
+		}
+	}else if(b->format == '2'){
+		while(left--){
+			val = readvali(b);
+			img->buf[a++] = val;
+			img->buf[a++] = val;
+			img->buf[a++] = val;
+		}
+	}else if(b->format == '3'){
+		while(left--){
+			img->buf[a++] = readvali(b);
+			img->buf[a++] = readvali(b);
+			img->buf[a++] = readvali(b);
+		}
+	}else if(b->format == '4'){
 		while(left){
 			c = fgetc(f);
 			for(j = 0; j < 8 && left; j++){
@@ -78,12 +112,18 @@
 				left--;
 			}
 		}
+	}else if(b->format == '5'){
+		while(left--){
+			val = readvalb(b);
+			img->buf[a++] = val;
+			img->buf[a++] = val;
+			img->buf[a++] = val;
+		}
 	}else if(b->format == '6'){
-		while(left){
-			img->buf[a++] = fgetc(f);
-			img->buf[a++] = fgetc(f);
-			img->buf[a++] = fgetc(f);
-			left--;
+		while(left--){
+			img->buf[a++] = readvalb(b);
+			img->buf[a++] = readvalb(b);
+			img->buf[a++] = readvalb(b);
 		}
 	}


A few unit tests for Number

A few unit tests for Number

--- src/number.c
+++ src/number.c
@@ -110,7 +110,29 @@
 void
 test_number()
 {
+    Actor a, b;
+    Integer n, m;
+
     TRACE(fprintf(stderr, "---- test_number ----\n"));
+    TRACE(fprintf(stderr, "a_zero = %p\n", a_zero));
+    a = integer_new(0);
+    if (a_zero != a) { halt("expected a_zero == a"); }
+    a = number_plus_method(a, a_one);
+    if (a_one != a) { halt("expected a_one == a"); }
+    a = number_diff_method(a, a_two);
+    if (a_minus_one != a) { halt("expected a_minus_one == a"); }
 /*
 */
+    a = number_times_method(a_two, a_two);
+    TRACE(fprintf(stderr, "a = %p\n", a));
+    if (beh_integer != BEH(a)) { halt("beh_integer == BEH(a)"); }
+    n = (Integer)a;
+    TRACE(fprintf(stderr, "n->i = %d\n", n->i));
+    b = integer_new(4);
+    TRACE(fprintf(stderr, "b = %p\n", b));
+    if (a == b) { halt("expected a != b"); }
+    if (beh_integer != BEH(b)) { halt("beh_integer == BEH(b)"); }
+    m = (Integer)b;
+    TRACE(fprintf(stderr, "m->i = %d\n", m->i));
+    if (n->i != m->i) { halt("expected n->i == m->i"); }
 }


lgi_object_2c: do not fail if requested type is not specified

I.e. behave as documented in the header file.

--- src/object.c
+++ src/object.c
@@ -260,7 +260,9 @@

   /* Get instance and perform type check. */
   obj = object_check (L, narg);
-  if (!nothrow && (!obj || !g_type_is_a (G_TYPE_FROM_INSTANCE (obj), gtype)))
+  if (!nothrow
+      && (!obj || (gtype != G_TYPE_INVALID
+		   && !g_type_is_a (G_TYPE_FROM_INSTANCE (obj), gtype))))
     object_type_error (L, narg, gtype);

   return obj;


update documentation

update documentation

--- src/odeint.c
+++ src/odeint.c
@@ -304,7 +304,7 @@
  * @param yn    [in,out] at start initial conditions yn=y(t0), at the end yn=y(t)
  * @param t     [in]     end time
  * @param t0    [in]     initial time
- * @param steps [in]     number of steps used
+ * @param steps [in]     number of steps used. If an adaptive step size is used, this parameter will be ignored.
  * @return success 0 if successful, LIBHADES_ERROR_OOM if out of memory, >0 if convergence failed
  */
 int rk4_symplectic_integrate(rk4_symplectic_t *self, matrix_t *yn, double t, double t0, int steps)


Validate option values for out-of-range cases. Tracked On: DSO-5083

Change-Id: I24c514f6d50b1dd007c2204eb1d98f4486bc61cd
(cherry picked from commit 6f71416b7012f2c3f1a9549b1bd7b3ae78d5d9bf)

--- src/option.h
+++ src/option.h
@@ -333,6 +333,9 @@
            if (!std::isnormal(_opt_range.step))
                throw invalid_value_exception(to_string() << "is_valid(...) failed! step is not properly defined. (" << _opt_range.step << ")");

+           if ((value < _opt_range.min) || (value > _opt_range.max))
+               return false;
+
            auto n = (value - _opt_range.min)/_opt_range.step;
            return (fabs(fmod(n, 1)) < std::numeric_limits<float>::min());
        }


Fix(Packer): Add a forgotten verification

--- src/packer.c
+++ src/packer.c
@@ -837,6 +837,9 @@
     bool    ret;
     int     cur = 0;

+    if (ctx->type != PACKER_TYPE_ARCHIVE)
+        return false;
+
     archive = mpm_read_file_from_fn(ctx->str);
     if (archive == NULL)
         return false;


declarations for "remove_watch"

declarations for "remove_watch"

--- src/parrot.h
+++ src/parrot.h
@@ -55,8 +55,11 @@
 gboolean parrot_obj_current_watches(ParrotObject *p_obj,
                                     DBusGMethodInvocation *ctxt);

-gboolean parrot_obj_method_arg(ParrotObject *p_obj, char *fn,
-			       DBusGMethodInvocation *ctxt);
+gboolean parrot_obj_add_watch(ParrotObject *p_obj, char *watch,
+			                  DBusGMethodInvocation *ctxt);
+
+gboolean parrot_obj_remove_watch(ParrotObject *p_obj, char *watch,
+                                 DBusGMethodInvocation *ctxt);

 // Creates the daemon.
 int parrot_daemon(void);
@@ -66,6 +69,8 @@
 int notify_parrot_init(void);

 void parrot_add_watch(char *path);
+
+void parrot_remove_watch(char *path);

 void parrot_mainloop(ParrotObject *p_obj);


drop the old avformat stuff for metadata and use avdict instead

--- src/parser.c
+++ src/parser.c
@@ -284,7 +284,7 @@
   unsigned int i;
   metadata_t *meta = NULL;
   const metadata_t *title_tag = NULL;
-  AVMetadataTag *tag = NULL;
+  AVDictionaryEntry *tag = NULL;
   const metadata_plist_t pl = {
     .metadata = NULL,
     .priority = VALHALLA_METADATA_PL_HIGHEST
@@ -293,20 +293,14 @@
   if (!ctx)
     return NULL;

-#if LIBAVFORMAT_VERSION_MAJOR < 53
-  av_metadata_conv (ctx, NULL, ctx->iformat->metadata_conv);
-#endif /* LIBAVFORMAT_VERSION_MAJOR < 53 */
-
-  while ((tag = av_metadata_get (ctx->metadata,
-                                 "", tag, AV_METADATA_IGNORE_SUFFIX)))
+  while ((tag = av_dict_get (ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
     vh_metadata_add_auto (&meta, tag->key, tag->value,
                           VALHALLA_LANG_UNDEF, &pl);

   for (i = 0; i < ctx->nb_streams; i++)
   {
     AVStream *st = ctx->streams[i];
-    while ((tag = av_metadata_get (st->metadata,
-                                   "", tag, AV_METADATA_IGNORE_SUFFIX)))
+    while ((tag = av_dict_get (st->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
     {
       const char *key = tag->key;


fix wrong logic for katana_print_media_query()

--- src/parser.c
+++ src/parser.c
@@ -1459,7 +1459,7 @@
             return;
         }

-        if ( (NULL != query->type && !strcasecmp(query->type, "all")) || query->restrictor != KatanaMediaQueryRestrictorNone) {
+        if ( (NULL != query->type && strcasecmp(query->type, "all")) || query->restrictor != KatanaMediaQueryRestrictorNone) {
             if ( NULL != query->type ) {
                 katana_print("%s", query->type);
             }


function call causing some conflict

function call causing some conflict

--- src/parser.c
+++ src/parser.c
@@ -536,9 +536,9 @@
 			if (!strcmp(tok->content, "ret")) {
 				parserParseReturnStatement(parser);
 			}
-			else if (parserTokenTypeAndContent(parser, SEPARATOR, "(", 1)) {
-				parserParseFunctionCall(parser);
-			}
+			// else if (parserTokenTypeAndContent(parser, SEPARATOR, "(", 1)) {
+			// 	parserParseFunctionCall(parser);
+			// }
 			else {
 				printf("what is this? %s\n", tok->content);
 			}


testing tag stuff

testing tag stuff

--- src/parser.c
+++ src/parser.c
@@ -619,6 +619,7 @@
 			// LOOP
 			do {

+				// eat the last brace
 				if (check_token_type_and_content(parser, SEPARATOR, BLOCK_CLOSER, 0)) {
 					consume_token(parser);
 					break;


v2: fix compiler warning

v2: fix compiler warning

--- src/parser.c
+++ src/parser.c
@@ -115,7 +115,7 @@
  * @return pointer to c string, NOT to be freed
  */
 #define PARSER_DataForDisplay(ParserName) \
-char * ln_DataForDisplay##ParserName(__attribute__((unused)) ln_ctx ctx, void *const pdata)
+const char * ln_DataForDisplay##ParserName(__attribute__((unused)) ln_ctx ctx, void *const pdata)

 /* parser constructor


remove old code

remove old code

--- src/pfasta.c
+++ src/pfasta.c
@@ -19,13 +19,10 @@
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <malloc.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <unistd.h>

 #include "pfasta.h"
@@ -59,7 +56,7 @@

 #define PF_FAIL_ERRNO(PP)                                                      \
 	do {                                                                       \
-		strerror_r(errno, errstr_buffer, PF_ERROR_STRING_LENGTH);              \
+		(void)strerror_r(errno, errstr_buffer, PF_ERROR_STRING_LENGTH);        \
 		(PP)->errstr = errstr_buffer;                                          \
 		return_code = E_ERRNO;                                                 \
 		goto cleanup;                                                          \
@@ -528,34 +525,11 @@
 	if (!ds->str) PF_FAIL_ERRNO(pp);

 	ds->str[0] = '\0';
-	// ds->capacity = 61;
-	ds->capacity = malloc_usable_size(ds->str);
+	ds->capacity = 61;
 	ds->count = 0;

 cleanup:
 	return return_code;
-}
-
-/** @brief A append a character to a string.
- *
- * @param ds - A reference to the dynstr container.
- * @param c - The new character.
- *
- * @returns 0 iff successful.
- */
-static inline int dynstr_put(dynstr *ds, char c) {
-	if (ds->count >= ds->capacity - 1) {
-		char *neu = reallocarray(ds->str, ds->capacity / 2, 3);
-		if (!neu) {
-			dynstr_free(ds);
-			return -1;
-		}
-		ds->str = neu;
-		ds->capacity = (ds->capacity / 2) * 3;
-	}
-
-	ds->str[ds->count++] = c;
-	return 0;
 }

 /** @brief A append more than one character to a string.
@@ -578,8 +552,7 @@
 			PF_FAIL_ERRNO(pp);
 		}
 		ds->str = neu;
-		// ds->capacity = (required / 2) * 3;
-		ds->capacity = malloc_usable_size(ds->str);
+		ds->capacity = (required / 2) * 3;
 	}

 	memcpy(ds->str + ds->count, str, length);


Skip duplicates when creating the sparse index for a backup.

--- src/phase3.c
+++ src/phase3.c
@@ -310,6 +310,11 @@

 	for(x=0; x<h; x++)
 	{
+		// Skip duplicates.
+		if(x>0 && !hookscmp(
+		  (const struct hooks **)&hooks[x],
+		  (const struct hooks **)&hooks[x-1])) continue;
+
 		if(gzprintf_hooks(tzp, hooks[x]))
 			goto end;
 	}


fixed tip info

fixed tip info

--- src/pinyin.c
+++ src/pinyin.c
@@ -107,8 +107,8 @@
 	php_info_print_table_header(2, "pinyin support", "enabled");
 	php_info_print_table_row(2, "author", "Rex Lee");
 	php_info_print_table_row(2, "version", "0.5.0");
-	php_info_print_table_row(2, "pinyin.words", (!access(INI_STR("pinyin.words"), 4))?INI_STR("pinyin.words"):"error");
-	php_info_print_table_row(2, "pinyin.chars", (!access(INI_STR("pinyin.chars"), 4))?INI_STR("pinyin.chars"):"error");
+	php_info_print_table_row(2, "pinyin.words", (!access(INI_STR("pinyin.words"), 4))?INI_STR("pinyin.words"):"load error");
+	php_info_print_table_row(2, "pinyin.chars", (!access(INI_STR("pinyin.chars"), 4))?INI_STR("pinyin.chars"):"load error");
 	php_info_print_table_row(2, "pinyin.locale", (strlen(INI_STR("pinyin.locale"))>0)?INI_STR("pinyin.locale"):"zh_CN.UTF-8");
 	php_info_print_table_row(2, "function", "string pinyin(string)");
 	php_info_print_table_end();


* Fix in call_cleanup

* Fix in call_cleanup

--- src/pl-wam.c
+++ src/pl-wam.c
@@ -781,7 +781,6 @@
       if ( !rval && ex )
 	PL_raise_exception(ex);
     }
-
   }

 #ifdef O_DEBUGGER
@@ -2548,7 +2547,7 @@
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

     VMI(I_CALLCLEANUP)
-      { if ( BFR->frame == FR && BFR == (Choice)argFrameP(FR, 3) )
+      { if ( BFR->frame == FR && BFR == (Choice)argFrameP(FR, 4) )
 	{ assert(BFR->type == CHP_DEBUG);
 	  BFR->type = CHP_CATCH;
 	} else


FIXED: Avoid // in Windows paths when running Prolog from a different location and restoring QLF files.

--- src/pl-wic.c
+++ src/pl-wic.c
@@ -1266,7 +1266,6 @@

     strcpy(buf, state->load_state->load_dir);
     s = &buf[strlen(buf)];
-    *s++ = '/';
     strcpy(s, tail);
   } else
   { if ( strlen(raw)+1 > MAXPATHLEN )


player: free metadata node from mpv

player: free metadata node from mpv

--- src/player.c
+++ src/player.c
@@ -210,6 +210,8 @@
 			g_variant_builder_add(meta, "{ss}", key, val);
 		}
 	}
+
+	mpv_free_node_contents(&metadata);
 }

 int player_playback_start(void) {


missing notice that frame dropping is supported with MPlayer wrapper

--- src/player.h
+++ src/player.h
@@ -797,6 +797,9 @@
 /**
  * \brief Set frame dropping with video playback.
  *
+ * Wrappers supported (even partially):
+ *  MPlayer
+ *
  * \warning MT-Safe in multithreaded applications.
  * \param[in] player      Player controller.
  * \param[in] fd          Frame dropping type to set.


Changed debugging output to use new function pldebug().  Added static
functions plcmap0_def() and plcmap1_def() for setting up default color maps;
eliminated old global functions plCmap0_init() and plCmap1_init().  Changed
plscmap0n() and plscmap1n() actually allocate the color maps based on the
requested number of colors.  These can be called at any time to change the
number of colors in use by PLplot, although the best time is before driver
initialization (since the drivers are typically not as dynamic).

svn path=/trunk/; revision=1596

--- src/plctrl.c
+++ src/plctrl.c
@@ -1,6 +1,15 @@
 /* $Id$
  * $Log$
- * Revision 1.30  1995/01/14 06:03:45  mjl
+ * Revision 1.31  1995/05/07 03:13:12  mjl
+ * Changed debugging output to use new function pldebug().  Added static
+ * functions plcmap0_def() and plcmap1_def() for setting up default color maps;
+ * eliminated old global functions plCmap0_init() and plCmap1_init().  Changed
+ * plscmap0n() and plscmap1n() actually allocate the color maps based on the
+ * requested number of colors.  These can be called at any time to change the
+ * number of colors in use by PLplot, although the best time is before driver
+ * initialization (since the drivers are typically not as dynamic).
+ *
+ * Revision 1.30  1995/01/14  06:03:45  mjl
  * Fixed plscmap1l documentation and changed call syntax to pass "rev" array.
  *
  * Revision 1.29  1995/01/10  09:38:04  mjl
@@ -46,7 +55,8 @@
  * gcc -Wall.  Lots of cleaning up: got rid of includes of math.h or string.h
  * (now included by plplot.h), and other minor changes.  Now each file has
  * global access to the plstream pointer via extern; many accessor functions
- * eliminated as a result.  */
+ * eliminated as a result.
+*/

 /*	plctrl.c

@@ -54,6 +64,8 @@
 	mode, change color.  Includes some spillage from plcore.c.  If you
 	don't know where it should go, put it here.
 */
+
+#define DEBUG

 #include "plplotP.h"

@@ -80,6 +92,12 @@
 static int
 (*exit_handler) (char *errormsg);

+static void
+plcmap0_def(int imin, int imax);
+
+static void
+plcmap1_def(void);
+
 /* An additional hardwired location for lib files. */
 /* I have no plans to change these again, ever. */

@@ -108,15 +126,15 @@

 #endif

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  *  Routines that deal with colors & color maps.
-\*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*\
+\*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*\
  * plcol0()
  *
- * Set color, map 0.  Argument is integer between 0 and 15.
-\*----------------------------------------------------------------------*/
+ * Set color, map 0.  Argument is integer between 0 and plsc->ncol0.
+\*--------------------------------------------------------------------------*/

 void
 c_plcol0(PLINT icol0)
@@ -125,12 +143,8 @@
 	plabort("plcol0: Please call plinit first");
 	return;
     }
-    if (icol0 < 0 || icol0 > 15) {
+    if (icol0 < 0 || icol0 >= plsc->ncol0) {
 	plabort("plcol0: Invalid color.");
-	return;
-    }
-    if (plsc->cmap0setcol[icol0] == 0) {
-	plabort("plcol0: Requested color not allocated.");
 	return;
     }

@@ -143,11 +157,11 @@
     plP_state(PLSTATE_COLOR0);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plcol1()
  *
  * Set color, map 1.  Argument is a float between 0. and 1.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plcol1(PLFLT col1)
@@ -175,11 +189,11 @@
     plP_state(PLSTATE_COLOR1);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plscolbg()
  *
  * Set the background color (cmap0[0]) by 8 bit RGB value
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plscolbg(PLINT r, PLINT g, PLINT b)
@@ -187,11 +201,11 @@
     plscol0(0, r, g, b);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plgcolbg()
  *
  * Returns the background color (cmap0[0]) by 8 bit RGB value
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plgcolbg(PLINT *r, PLINT *g, PLINT *b)
@@ -199,17 +213,20 @@
     plgcol0(0, r, g, b);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plscol0()
  *
  * Set a given color from color map 0 by 8 bit RGB value
  * Does not result in any additional cells to be allocated.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plscol0(PLINT icol0, PLINT r, PLINT g, PLINT b)
 {
-    if (icol0 < 0 || icol0 > 15) {
+    if (plsc->cmap0 == NULL)
+	plscmap0n(0);
+
+    if (icol0 < 0 || icol0 >= plsc->ncol0) {
 	plabort("plscol0: Illegal color table value");
 	return;
     }
@@ -221,32 +238,30 @@
     plsc->cmap0[icol0].r = r;
     plsc->cmap0[icol0].g = g;
     plsc->cmap0[icol0].b = b;
-    plsc->cmap0setcol[icol0] = 1;

     if (plsc->level > 0)
 	plP_state(PLSTATE_CMAP0);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plgcol0()
  *
  * Returns 8 bit RGB values for given color from color map 0
  * Values are negative if an invalid color id is given
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plgcol0(PLINT icol0, PLINT *r, PLINT *g, PLINT *b)
 {
+    if (plsc->cmap0 == NULL)
+	plscmap0n(0);
+
     *r = -1;
     *g = -1;
     *b = -1;

-    if (icol0 < 0 || icol0 > 15) {
+    if (icol0 < 0 || icol0 > plsc->ncol0) {
 	plabort("plgcol0: Invalid color index");
-	return;
-    }
-    if (plsc->cmap0setcol[icol0] == 0) {
-	plabort("plgcol0: Requested color not allocated");
 	return;
     }

@@ -257,60 +272,19 @@
     return;
 }

-/*----------------------------------------------------------------------*\
- * plscmap0n()
- *
- * Set number of colors in cmap 0
- * Must be <= 16, and the driver is not guaranteed to support all of these.
-\*----------------------------------------------------------------------*/
-
-void
-c_plscmap0n(PLINT ncol0)
-{
-    if (ncol0 > 16 || ncol0 < 1) {
-	plabort("plscmap0n: Number of colors must be between 1 and 16");
-	return;
-    }
-
-    plsc->ncol0 = ncol0;
-}
-
-/*----------------------------------------------------------------------*\
- * plscmap1n()
- *
- * Set number of colors in cmap 1
- * Note that the driver is allowed to disregard this number.
- * In particular, most use far fewer.
-\*----------------------------------------------------------------------*/
-
-void
-c_plscmap1n(PLINT ncol1)
-{
-    if (ncol1 > 256 || ncol1 < 1) {
-	plabort("plscmap1n: Number of colors must be between 1 and 256");
-	return;
-    }
-
-    plsc->ncol1 = ncol1;
-}
-
-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plscmap0()
  *
- * Set color map 0 colors by 8 bit RGB values
- * This also sets the number of colors.
-\*----------------------------------------------------------------------*/
+ * Set color map 0 colors by 8 bit RGB values.  This sets the entire color
+ * map -- only as many colors as specified will be allocated.
+\*--------------------------------------------------------------------------*/

 void
 c_plscmap0(PLINT *r, PLINT *g, PLINT *b, PLINT ncol0)
 {
     int i;

-    if (ncol0 > 16 || ncol0 < 1) {
-	plabort("plscmap0n: Number of colors must be between 1 and 16");
-	return;
-    }
-    plsc->ncol0 = ncol0;
+    plscmap0n(ncol0);

     for (i = 0; i < plsc->ncol0; i++) {
 	if ((r[i] < 0 || r[i] > 255) ||
@@ -327,31 +301,25 @@
 	plsc->cmap0[i].r = r[i];
 	plsc->cmap0[i].g = g[i];
 	plsc->cmap0[i].b = b[i];
-	plsc->cmap0setcol[i] = 1;
     }

     if (plsc->level > 0)
 	plP_state(PLSTATE_CMAP0);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plscmap1()
  *
  * Set color map 1 colors by 8 bit RGB values
  * This also sets the number of colors.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plscmap1(PLINT *r, PLINT *g, PLINT *b, PLINT ncol1)
 {
     int i;

-    if (ncol1 > 256 || ncol1 < 1) {
-	plabort("plscmap1n: Number of colors must be between 1 and 256");
-	return;
-    }
-
-    plsc->ncol1 = ncol1;
+    plscmap1n(ncol1);

     for (i = 0; i < plsc->ncol1; i++) {
 	if ((r[i] < 0 || r[i] > 255) ||
@@ -369,12 +337,11 @@
 	plsc->cmap1[i].b = b[i];
     }

-    plsc->cmap1set = 1;
     if (plsc->level > 0)
 	plP_state(PLSTATE_CMAP1);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plscmap1l()
  *
  * Set color map 1 colors using a piece-wise linear relationship between
@@ -403,7 +370,7 @@
  * position = 0, and the last to position = 1.
  *
  * The hue is interpolated around the "front" of the color wheel
- * (red->green->blue->red) unless the "rev" flag is set, in which case
+ * (red<->green<->blue<->red) unless the "rev" flag is set, in which case
  * interpolation proceeds around the back (reverse) side.  Specifying
  * rev=NULL is equivalent to setting rev[]=0 for every control point.
  *
@@ -423,7 +390,7 @@
  *	coord2[]	second coordinate for each control point
  *	coord3[]	third coordinate for each control point
  *	rev[]		reverse flag for each control point
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plscmap1l(PLINT itype, PLINT npts, PLFLT *pos,
@@ -447,8 +414,10 @@
 	return;
     }

-    if (plsc->ncol1 == 0)
-	plsc->ncol1 = 256;
+/* Allocate if not done yet */
+
+    if (plsc->cmap1 == NULL)
+	plscmap1n(0);

 /* Save control points */

@@ -484,12 +453,12 @@
     plcmap1_calc();
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plcmap1_calc()
  *
  * Bin up cmap 1 space and assign colors to make inverse mapping easy.
  * Always do interpolation in HLS space.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plcmap1_calc(void)
@@ -550,52 +519,137 @@
 	}
     }

-    plsc->cmap1set = 1;
     if (plsc->level > 0)
 	plP_state(PLSTATE_CMAP1);
 }

-/*----------------------------------------------------------------------*\
- * color_def()
- *
- * Initializes color table entries by RGB values.
- * Does nothing if color already set.
-\*----------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*\
+ * plscmap0n()
+ *
+ * Set number of colors in cmap 0, (re-)allocate cmap 0, and fill with
+ * default values for those colors not previously allocated (and less
+ * than index 15, after that you just get grey).
+ *
+ * The driver is not guaranteed to support all of these.
+\*--------------------------------------------------------------------------*/
+
+void
+c_plscmap0n(PLINT ncol0)
+{
+    int ncol, size, imin, imax;
+
+/* No change */
+
+    if (ncol0 > 0 && plsc->ncol0 == ncol0)
+	return;
+
+/* Handle all possible startup conditions */
+
+    if (plsc->ncol0 <= 0 && ncol0 <= 0)
+	ncol = 16;
+    else if (plsc->ncol0 <= 0)
+	ncol = ncol0;
+    else if (ncol0 <= 0)
+	ncol = plsc->ncol0;
+
+    imax = ncol;
+    size = ncol * sizeof(PLColor);
+
+/* Allocate the space */
+
+    if (plsc->cmap0 == NULL) {
+	plsc->cmap0 = (PLColor *) calloc(1, size);
+	imin = 0;
+    }
+    else {
+	plsc->cmap0 = (PLColor *) realloc(plsc->cmap0, size);
+	imin = plsc->ncol0 - 1;
+    }
+
+/* Fill in default entries */
+
+    plsc->ncol0 = ncol;
+    plcmap0_def(imin, imax);
+}
+
+/*--------------------------------------------------------------------------*\
+ * plscmap1n()
+ *
+ * Set number of colors in cmap 1, (re-)allocate cmap 1, and set default
+ * values if this is the first allocation.
+ *
+ * Note that the driver is allowed to disregard this number.
+ * In particular, most use fewer than we use internally.
+\*--------------------------------------------------------------------------*/
+
+void
+c_plscmap1n(PLINT ncol1)
+{
+    int ncol, size;
+
+/* No change */
+
+    if (ncol1 > 0 && plsc->ncol1 == ncol1)
+	return;
+
+/* Handle all possible startup conditions */
+
+    if (plsc->ncol1 <= 0 && ncol1 <= 0)
+	ncol = 128;
+    else if (plsc->ncol1 <= 0)
+	ncol = ncol1;
+    else if (ncol1 <= 0)
+	ncol = plsc->ncol1;
+
+    size = ncol * sizeof(PLColor);
+
+/* Allocate the space */
+
+    if (plsc->ncol1 > 0)
+	plsc->cmap1 = (PLColor *) realloc(plsc->cmap1, size);
+    else
+	plsc->cmap1 = (PLColor *) calloc(ncol, sizeof(PLColor));
+
+/* Fill in default entries */
+
+    plsc->ncol1 = ncol;
+    if (plsc->ncp1 == 0)
+	plcmap1_def();
+    else
+	plcmap1_calc();
+}
+
+/*--------------------------------------------------------------------------*\
+ * color_set()
+ *
+ * Initializes color table entry by RGB values.
+\*--------------------------------------------------------------------------*/

 static void
-color_def(PLINT i, U_CHAR r, U_CHAR g, U_CHAR b)
-{
-    if ( ! plsc->cmap0setcol[i] && i < plsc->ncol0) {
-	plsc->cmap0[i].r = r;
-	plsc->cmap0[i].g = g;
-	plsc->cmap0[i].b = b;
-	plsc->cmap0setcol[i] = 1;
-    }
-}
-
-/*----------------------------------------------------------------------*\
- * plCmap0_init()
- *
- * Initializes color map 0.
- * Do not initialize if already done.
+color_set(PLINT i, U_CHAR r, U_CHAR g, U_CHAR b)
+{
+    plsc->cmap0[i].r = r;
+    plsc->cmap0[i].g = g;
+    plsc->cmap0[i].b = b;
+}
+
+/*--------------------------------------------------------------------------*\
+ * plcmap0_def()
+ *
+ * Initializes specified color map 0 color entry to its default.
  *
  * Initial RGB values for color map 0 taken from HPUX 8.07 X-windows
  * rgb.txt file, and may not accurately represent the described colors on
  * all systems.
- *
- * Note the background color is not set, since the device driver may be
- * able to detect if a monochrome output device is being used, in which
- * case I want to choose the default background color there.
-\*----------------------------------------------------------------------*/
-
-void
-plCmap0_init(void)
-{
-    if (plsc->ncol0 == 0)
-	plsc->ncol0 = 16;
-
-/* Color map 0 */
-/* Any entries already filled by user or unallocated are not touched */
+\*--------------------------------------------------------------------------*/
+
+#define color_def(i, r, g, b) \
+if (i >= imin && i <= imax) color_set(i, r, g, b);
+
+static void
+plcmap0_def(int imin, int imax)
+{
+    int i;

     color_def(0,    0,   0,   0);	/* black */
     color_def(1,  255,   0,   0);	/* red */
@@ -613,30 +667,29 @@
     color_def(13, 255,   0, 255);	/* magenta */
     color_def(14, 233, 150, 122);	/* salmon */
     color_def(15, 255, 255, 255);	/* white */
-}
-
-/*----------------------------------------------------------------------*\
- * plCmap1_init()
+
+/* Any others are just arbitrarily set */
+
+    for (i = 16; i <= imax; i++)
+	color_def(i, 255, 0, 0); 	/* red */
+}
+
+/*--------------------------------------------------------------------------*\
+ * plcmap1_def()
  *
  * Initializes color map 1.
- * Do not initialize if already done.
  *
  * The default initialization uses 4 control points in HLS space, the two
  * inner ones being very close to one of the vertices of the HLS double
  * cone.  The vertex used (black or white) is chosen to be the closer to
  * the background color.  If you don't like these settings you can always
  * initialize it yourself.
-\*----------------------------------------------------------------------*/
-
-void
-plCmap1_init(void)
-{
-    PLFLT i[4], h[4], l[4], s[4], vertex;
-
-/* Return if the user has already filled color map */
-
-    if (plsc->cmap1set)
-	return;
+\*--------------------------------------------------------------------------*/
+
+static void
+plcmap1_def(void)
+{
+    PLFLT i[4], h[4], l[4], s[4], vertex = 0.;

 /* Positions of control points */

@@ -648,8 +701,10 @@
 /* For center control points, pick black or white, whichever is closer to bg */
 /* Be carefult to pick just short of top or bottom else hue info is lost */

-    vertex = ((float) plsc->cmap0[0].r + (float) plsc->cmap0[0].g +
-	      (float) plsc->cmap0[0].b) / 3. / 255.;
+    if (plsc->cmap0 != NULL)
+	vertex = ((float) plsc->cmap0[0].r +
+		  (float) plsc->cmap0[0].g +
+		  (float) plsc->cmap0[0].b) / 3. / 255.;

     if (vertex < 0.5)
 	vertex = 0.01;
@@ -680,11 +735,11 @@
     c_plscmap1l(0, 4, i, h, l, s, NULL);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plscolor()
  *
  * Used to globally turn color output on/off
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plscolor(PLINT color)
@@ -693,12 +748,12 @@
     plsc->color = color;
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plrgb()
  *
  * Set line color by red, green, blue from  0. to 1.
  * Do NOT use this.  Only retained for backward compatibility
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plrgb(PLFLT r, PLFLT g, PLFLT b)
@@ -717,12 +772,12 @@
     plP_state(PLSTATE_COLOR0);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plrgb1()
  *
  * Set line color by 8 bit RGB values.
- * See note to plrgb()
-\*----------------------------------------------------------------------*/
+ * Do NOT use this.  Only retained for backward compatibility
+\*--------------------------------------------------------------------------*/

 void
 c_plrgb1(PLINT r, PLINT g, PLINT b)
@@ -745,13 +800,13 @@
     plP_state(PLSTATE_COLOR0);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plhls()
  *
  * Set current color by hue, lightness, and saturation.
  * Convert hls color coordinates to rgb, then call plrgb.
- * See note to plrgb()
-\*----------------------------------------------------------------------*/
+ * Do NOT use this.  Only retained for backward compatibility
+\*--------------------------------------------------------------------------*/

 void
 c_plhls(PLFLT h, PLFLT l, PLFLT s)
@@ -762,11 +817,11 @@
     plrgb(r, g, b);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void value()
  *
  * Auxiliary function used by plHLS_RGB().
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 static float
 value(double n1, double n2, double hue)
@@ -790,7 +845,7 @@
     return (val);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plHLS_RGB()
  *
  * Convert HLS color to RGB color.
@@ -802,7 +857,7 @@
  * Hue is always mapped onto the interval [0., 360.] regardless of input.
  * Bounds on RGB (output) is always [0., 1.].  Convert to RGB color values
  * by multiplying by 2**nbits (nbits typically 8).
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plHLS_RGB(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b)
@@ -821,7 +876,7 @@
     *p_b = value(m1, m2, h - 120.);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plRGB_HLS()
  *
  * Convert RGB color to HLS color.
@@ -830,7 +885,7 @@
  *	hue		[0., 360.]	degrees
  *	lightness	[0., 1.]	magnitude
  *	saturation	[0., 1.]	magnitude
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plRGB_HLS(PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s)
@@ -875,15 +930,15 @@
     *p_s = s;
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * A grab-bag of various control routines.
-\*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*\
+\*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*\
  * void plwarn()
  *
  * A handy way to issue warnings, if need be.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plwarn(char *errormsg)
@@ -903,13 +958,13 @@
 	plgra();
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plabort()
  *
  * Exactly the same as plwarn(), but appends ", aborting operation" to the
  * error message.  Helps to keep source code uncluttered and provides a
  * convention for error aborts.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plabort(char *errormsg)
@@ -929,7 +984,7 @@
 	plgra();
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plexit()
  *
  * In case of an abort this routine is called.  It just prints out an error
@@ -939,7 +994,7 @@
  * If cleanup needs to be done in the main program, the user should write
  * his/her own exit handler and pass it in via plsexit().  This function
  * should should either call plend() before exiting, or simply return.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plexit(char *errormsg)
@@ -960,11 +1015,11 @@
     exit(status);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plsexit()
  *
  * Sets an optional user exit handler.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plsexit(int (*handler) (char *))
@@ -972,7 +1027,7 @@
     exit_handler = handler;
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plgra()
  *
  * Switches to graphics screen.
@@ -980,7 +1035,7 @@
  * Here and in pltext() it's a good idea to return silently if plinit()
  * hasn't yet been called, since plwarn() calls pltext() and plgra(), and
  * plwarn() may be called at any time.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_plgra(void)
@@ -989,28 +1044,26 @@
 	plP_esc(PLESC_GRAPH, NULL);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void pltext()
  *
  * Switches to text screen.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 c_pltext(void)
 {
-    if (plsc->level > 0) {
+    if (plsc->level > 0)
 	plP_esc(PLESC_TEXT, NULL);
-	plflush();
-    }
-}
-
-/*----------------------------------------------------------------------*\
+}
+
+/*--------------------------------------------------------------------------*\
  * void pl_cmd()
  *
  * Front-end to driver escape function.
  * In principle this can be used to pass just about anything directly
  * to the driver.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 pl_cmd(PLINT op, void *ptr)
@@ -1018,7 +1071,7 @@
     plP_esc(op, ptr);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * char *plFindCommand
  *
  * Looks for the specified executable file.  Search path:
@@ -1029,7 +1082,7 @@
  *
  * The caller must free the returned pointer (points to malloc'ed memory)
  * when finished with it.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 char *
 plFindCommand(char *fn)
@@ -1082,7 +1135,7 @@
     return NULL;
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * FILE *plLibOpen(fn)
  *
  * Return file pointer to lib file.
@@ -1092,7 +1145,7 @@
  *	PLPLOT_HOME_ENV/lib = $(PLPLOT_HOME)/lib
  *	LIB_DIR
  *	PLLIBDEV
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 FILE *
 plLibOpen(char *fn)
@@ -1163,7 +1216,7 @@
     return (file);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * int plFindName
  *
  * Authors: Paul Dubois (LLNL), others?
@@ -1179,7 +1232,7 @@
  * 'p' are changed to the actual pathname if findname is successful.
  *
  * This function is only defined under Unix for now.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 #ifdef __unix
 int
@@ -1190,47 +1243,43 @@
     extern int errno;
     struct stat sbuf;

+    pldebug("plFindName", "Trying to find %s\n", p);
     while ((n = readlink(p, buf, 1024)) > 0) {
-#ifdef DEBUG
-	fprintf(stderr, "Readlink read %d chars at: %s\n", n, p);
-#endif
-	if (buf[0] == '/') {	/* Link is an absolute path */
+	pldebug("plFindName", "Readlink read %d chars at: %s\n", n, p);
+	if (buf[0] == '/') {
+	/* Link is an absolute path */
+
 	    strncpy(p, buf, n);
 	    p[n] = '\0';
-#ifdef DEBUG
-	    fprintf(stderr, "Link is absolute: %s\n", p);
-#endif
+	    pldebug("plFindName", "Link is absolute: %s\n", p);
 	}
-	else {			/* Link is relative to its directory; make it
-				   absolute */
+	else {
+	/* Link is relative to its directory; make it absolute */
+
 	    cp = 1 + strrchr(p, '/');
 	    strncpy(cp, buf, n);
 	    cp[n] = '\0';
-#ifdef DEBUG
-	    fprintf(stderr, "Link is relative: %s\n\tTotal path: %s\n", cp, p);
-#endif
+	    pldebug("plFindName",
+		    "Link is relative: %s\n\tTotal path:%s\n", cp, p);
 	}
     }

-/* SGI machines return ENXIO instead of EINVAL Dubois 11/92 */
-
-    if (errno == EINVAL || errno == ENXIO) {
-#ifdef DEBUG
-	fprintf(stderr, "%s may be the one ...", p);
-#endif
+/* This macro not defined on the NEC SX-3 */
+
 #ifdef SX
 #define S_ISREG(mode)   (mode & S_IFREG)
 #endif
+
+/* SGI machines return ENXIO instead of EINVAL Dubois 11/92 */
+
+    if (errno == EINVAL || errno == ENXIO) {
+	pldebug("plFindName", "%s may be the one...\n", p);
 	if ((stat(p, &sbuf) == 0) && S_ISREG(sbuf.st_mode)) {
-#ifdef DEBUG
-	    fprintf(stderr, "regular file\n");
-#endif
+	    pldebug("plFindName", "%s is a regular file\n", p);
 	    return (access(p, X_OK));
 	}
     }
-#ifdef DEBUG
-    fprintf(stderr, "not executable\n");
-#endif
+    pldebug("plFindName", "%s found but is not executable\n", p);
     return (errno ? errno : -1);
 }

@@ -1242,14 +1291,14 @@
 }
 #endif

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void plGetName()
  *
  * Gets search name for file by concatenating the dir, subdir, and file
  * name, allocating memory as needed.  The appropriate delimiter is added
  * after the dir specification as necessary.  The caller is responsible
  * for freeing the malloc'ed memory.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 void
 plGetName(char *dir, char *subdir, char *filename, char **filespec)
@@ -1275,13 +1324,13 @@
     }
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * void strcat_delim()
  *
  * Append path name deliminator if necessary (does not add one if one's
  * there already, or if dealing with a colon-terminated device name as
  * used on the Amiga).
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 static void
 strcat_delim(char *dirspec)
@@ -1301,11 +1350,11 @@
 #endif
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plGetInt()
  *
  * Prompts human to input an integer in response to given message.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 PLINT
 plGetInt(char *s)
@@ -1330,11 +1379,11 @@
     return (0);
 }

-/*----------------------------------------------------------------------*\
+/*--------------------------------------------------------------------------*\
  * plGetFlt()
  *
  * Prompts human to input a float in response to given message.
-\*----------------------------------------------------------------------*/
+\*--------------------------------------------------------------------------*/

 PLFLT
 plGetFlt(char *s)


Modifications to the Power 4 PAPI Presets...Surely these still aren't correct. Upon checkin on preset maps from IBM on the Linxu/PPC64, we will calibrate the two.

--- src/power4.c
+++ src/power4.c
@@ -8,7 +8,6 @@

 static hwi_search_t _papi_hwd_PWR4_preset_map[] = {
    {PAPI_L1_DCM, {DERIVED_ADD, {PNE_PM_LD_MISS_L1, PNE_PM_ST_MISS_L1, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},      /*Level 1 data cache misses */
-   {PAPI_L2_DCM, {0, {PNE_PM_DATA_FROM_L3, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},      /*Level 1 data cache misses */
    {PAPI_L1_DCA, {DERIVED_ADD, {PNE_PM_LD_REF_L1, PNE_PM_ST_REF_L1, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},        /*Level 1 data cache access */
    {PAPI_FXU_IDL, {0, {PNE_PM_FXU_IDLE, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},      /*Cycles integer units are idle */
    {PAPI_L1_LDM, {0, {PNE_PM_LD_MISS_L1,PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},     /*Level 1 load misses */
@@ -32,6 +31,17 @@
    {PAPI_LD_INS, {0, {PNE_PM_LD_REF_L1, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},      /*Load instructions*/
    {PAPI_SR_INS, {0, {PNE_PM_ST_REF_L1, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},      /*Store instructions*/
    {PAPI_LST_INS, {DERIVED_ADD, {PNE_PM_ST_REF_L1, PNE_PM_LD_REF_L1, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},      /*Load and Store instructions*/
+/* Start editing here */
+   {PAPI_BR_INS, {0, {PNE_PM_BR_ISSUED, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},
+   {PAPI_BR_MSP, {DERIVED_ADD, {PNE_PM_BR_MPRED_CR, PNE_PM_BR_MPRED_TA, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}},
+   {PAPI_L2_DCR,{DERIVED_ADD,{PNE_PM_DATA_FROM_L2, PNE_PM_DATA_FROM_L25_MOD,PNE_PM_DATA_FROM_L25_SHR,PNE_PM_DATA_FROM_L275_MOD,PNE_PM_DATA_FROM_L275_SHR,PAPI_NULL,PAPI_NULL,PAPI_NULL},0}},
+   {PAPI_L2_DCM,{DERIVED_ADD,{PNE_PM_DATA_FROM_L3, PNE_PM_DATA_FROM_L35, PNE_PM_DATA_FROM_MEM, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL},0}}, /* Level 2 cache misses */
+   {PAPI_L3_DCR,{DERIVED_ADD,{PNE_PM_DATA_FROM_L3, PNE_PM_DATA_FROM_L35, PNE_PM_DATA_FROM_MEM, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL},0}}, /* Level 2 cache misses */
+   {PAPI_L3_DCM,{DERIVED_ADD,{PNE_PM_DATA_FROM_MEM, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL},0}}, /* Level 3 cache misses */
+   {PAPI_L1_ICH,{0, {PNE_PM_INST_FROM_L1, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL},0}},
+   {PAPI_L2_ICH,{0, {PNE_PM_INST_FROM_L2, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL},0}},
+   {PAPI_L3_ICH,{0, {PNE_PM_INST_FROM_L3, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL},0}},
+/* Stop editing here */
    {0, {0, {PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL, PAPI_NULL}, 0}}        /* end of list */
 };
 hwi_search_t *preset_search_map;


Add BSD 3-clause open source header

Add BSD 3-clause open source header

--- src/pubsub.c
+++ src/pubsub.c
@@ -1,3 +1,34 @@
+/*
+ * Copyright (c) 2013, Court of the University of Glasgow
+ * All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the University of Glasgow nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 /*
  * tables for mapping from id to subscriptions and vice versa
  */


Updated the pusher by removing dead code

--- src/pusher.c
+++ src/pusher.c
@@ -64,7 +64,7 @@
         curr->next = tail;
         tail = curr;

-        printf("Added entry of length %d\n", numRead + 8);
+        printf("Added entry (interest) of length %d\n", numRead + 8);
     }

     Node *head = tail->next;
@@ -75,7 +75,7 @@
     servaddr.sin_addr.s_addr = inet_addr(serverIPAddress);
     servaddr.sin_port = htons(serverPort);

-    printf("Starting the piper\n");
+    printf("Starting the packet pusher\n");

     int numPackets = 0;
     TimeBlock(stdout, {
@@ -90,13 +90,15 @@
             head = head->next;
             numPackets++;

-            bytesReceived = recv(socketfd, serverResponseBuffer, MTU, 0);
-            totalBytesRcvd += bytesReceived;
-            fprintf(stderr, "Received [%d]: \n", bytesReceived);
-            for (int i = 0; i < bytesReceived; i++) {
-                printf("%02x", serverResponseBuffer[i]);
+            if (head == NULL) { // quick test, remove later
+                bytesReceived = recv(socketfd, serverResponseBuffer, MTU, 0);
+                totalBytesRcvd += bytesReceived;
+                fprintf(stderr, "Received [%d]: \n", bytesReceived);
+                for (int i = 0; i < bytesReceived; i++) {
+                    printf("%02x", serverResponseBuffer[i]);
+                }
+                printf("\n");
             }
-            printf("\n");
         }
     });


msvc seems to have a hard time with quoted defines

--- src/pycurl.c
+++ src/pycurl.c
@@ -207,9 +207,17 @@
     (PYCURL_MEMGROUP_ATTRDICT | PYCURL_MEMGROUP_EASY | \
     PYCURL_MEMGROUP_MULTI | PYCURL_MEMGROUP_SHARE)

+#if defined(WIN32)
+# define PYCURL_STRINGIZE_IMP(x) #x
+# define PYCURL_STRINGIZE(x) PYCURL_STRINGIZE_IMP(x)
+# define PYCURL_VERSION_STRING PYCURL_STRINGIZE(PYCURL_VERSION)
+#else
+# define PYCURL_VERSION_STRING PYCURL_VERSION
+#endif
+
 /* Keep some default variables around */
 static const char g_pycurl_useragent [] =
-    "PycURL/" PYCURL_VERSION " libcurl/" LIBCURL_VERSION;
+    "PycURL/" PYCURL_VERSION_STRING " libcurl/" LIBCURL_VERSION;

 /* Type objects */
 static PyObject *ErrorObject = NULL;
@@ -4449,7 +4457,7 @@

     /* Add version strings to the module */
     insobj2(d, NULL, "version",
-            PyText_FromFormat("PycURL/" PYCURL_VERSION " %s", curl_version()));
+            PyText_FromFormat("PycURL/" PYCURL_VERSION_STRING " %s", curl_version()));
     insstr(d, "COMPILE_DATE", __DATE__ " " __TIME__);
     insint(d, "COMPILE_PY_VERSION_HEX", PY_VERSION_HEX);
     insint(d, "COMPILE_LIBCURL_VERSION_NUM", LIBCURL_VERSION_NUM);


Fix compilation warning: be sure we call the base class copy constructor.

--- src/report.h
+++ src/report.h
@@ -123,7 +123,7 @@
     TRACE_CTOR(report_t, "session_t&");
   }
   report_t(const report_t& report)
-    : session(report.session),
+    : scope_t(report), session(report.session),
       output_stream(report.output_stream),
       terminus(report.terminus),
       budget_flags(report.budget_flags) {


resolv: resend arp packet after timeout

resolv: resend arp packet after timeout

This reduces the timeout to 1 second but does 5 tries before failing since the
ARP packet may have been lost.

--- src/resolv.c
+++ src/resolv.c
@@ -71,6 +71,9 @@
 	struct pkt *pkt = NULL;
 	uint8_t buf[ETH_PKTLEN + ARP_PKTLEN];

+	uint16_t tries = 5;
+	uint64_t start, timeout = 1000000;
+
 	saddr = htonl(saddr);
 	daddr = htonl(daddr);

@@ -90,10 +93,13 @@
 	if (len < 0)
 		fail_printf("Error packing ARP packet");

+again:
+	if (tries-- <= 0)
+		return -1;
+
 	netif->inject(netif, buf, len);

-	uint64_t start   = time_now();
-	uint64_t timeout = 5000000; /* 5 seconds in microseconds */
+	start = time_now();

 	while (1) {
 		int rsp_len, n;
@@ -101,7 +107,7 @@

 		const uint8_t *rsp = netif->capture(netif, &rsp_len);
 		if ((time_now() - start) > timeout)
-			return -1;
+			goto again;

 		if (rsp == NULL)
 			continue;


retryq: Hide not-my-vbucket return codes

This is rather unfortunate, however currently most applications do not
have codepaths handling this error.

Change-Id: Ic076d9450fe59f4d714c822d956a14242d9bd31f
Reviewed-on: http://review.couchbase.org/39925
Tested-by: Mark Nunberg <e7d42768707bf23038325b0b68d4b577e5f6064a@haskalah.org>
Reviewed-by: Brett Lawson <c8c4369773d7d7226e031f0c4af62e3f38a08510@gmail.com>

--- src/retryq.c
+++ src/retryq.c
@@ -76,6 +76,10 @@
 static void
 assign_error(lcb_RETRYOP *op, lcb_error_t err)
 {
+    if (err == LCB_NOT_MY_VBUCKET) {
+        err = LCB_ETIMEDOUT; /* :( */
+    }
+
     if (op->origerr == LCB_SUCCESS) {
         op->origerr = err;
     }


GabbleRosterItemEdit: allow removal from all other groups

This is necessary to implement SetContactGroups().

--- src/roster.c
+++ src/roster.c
@@ -103,6 +103,7 @@
   gchar *new_name;
   TpHandleSet *add_to_groups;
   TpHandleSet *remove_from_groups;
+  gboolean remove_from_all_other_groups;
 };

 typedef struct _GabbleRosterItem GabbleRosterItem;
@@ -2320,12 +2321,13 @@
       edited_item.name = edits->new_name;
     }

-  if (edits->add_to_groups || edits->remove_from_groups)
+  if (edits->add_to_groups != NULL || edits->remove_from_groups != NULL ||
+      edits->remove_from_all_other_groups)
     {
 #ifdef ENABLE_DEBUG
       if (DEBUGGING)
         {
-          if (edits->add_to_groups)
+          if (edits->add_to_groups != NULL)
             {
               GString *str = g_string_new ("Adding to groups: ");
               tp_intset_foreach (tp_handle_set_peek (edits->add_to_groups),
@@ -2336,7 +2338,13 @@
             {
               DEBUG ("Not adding to any groups");
             }
-          if (edits->remove_from_groups)
+
+          if (edits->remove_from_all_other_groups)
+            {
+              DEBUG ("Removing from all other groups");
+            }
+
+          if (edits->remove_from_groups != NULL)
             {
               GString *str = g_string_new ("Removing from groups: ");
               tp_intset_foreach (tp_handle_set_peek (edits->remove_from_groups),
@@ -2350,18 +2358,18 @@
         }
 #endif
       edited_item.groups = tp_handle_set_new (group_repo);
-      intset = tp_handle_set_update (edited_item.groups,
-          tp_handle_set_peek (item->groups));
-      tp_intset_destroy (intset);
+
+      if (!edits->remove_from_all_other_groups)
+        {
+          intset = tp_handle_set_update (edited_item.groups,
+              tp_handle_set_peek (item->groups));
+          tp_intset_destroy (intset);
+        }

       if (edits->add_to_groups)
         {
           intset = tp_handle_set_update (edited_item.groups,
               tp_handle_set_peek (edits->add_to_groups));
-          if (tp_intset_size (intset) > 0)
-            {
-              altered = TRUE;
-            }
           tp_intset_destroy (intset);
         }

@@ -2369,12 +2377,12 @@
         {
           intset = tp_handle_set_difference_update (edited_item.groups,
               tp_handle_set_peek (edits->remove_from_groups));
-          if (tp_intset_size (intset) > 0)
-            {
-              altered = TRUE;
-            }
           tp_intset_destroy (intset);
         }
+
+      if (!tp_intset_is_equal (tp_handle_set_peek (edited_item.groups),
+            tp_handle_set_peek (item->groups)))
+          altered = TRUE;
     }

 #ifdef ENABLE_DEBUG


roster: ignore contacts whose subscription requests were denied

20061120122033-01440-1264ac2c13b472247b7a8294bd13b4be16725e7c.gz

--- src/roster.c
+++ src/roster.c
@@ -407,12 +407,6 @@

   if (attr != NULL)
     return FALSE;
-
-  /* allow items that have rejected a subscription */
-  attr = lm_message_node_get_attribute (item_node, "gr:rejected");
-
-  if (!g_strdiff (attr, "true"))
-    return TRUE;

   /* allow items that we've requested a subscription from */
   if (item->ask_subscribe)


Eleminate send_routing_response().

Eleminate send_routing_response().

--- src/router.c
+++ src/router.c
@@ -147,22 +147,6 @@
 	}
 }

-static int send_routing_response(const struct peer *p, const cJSON *origin_request_id, cJSON *response, const char *result_type)
-{
-	cJSON *result_response = create_result_response(p, origin_request_id, response, result_type);
-	if (likely(result_response != NULL)) {
-		int ret = format_and_send_response(p, result_response);
-		cJSON_Delete(result_response);
-		return ret;
-	} else {
-		log_peer_err(p, "Could not create %s response!\n", result_type);
-		cJSON_Delete(response);
-		return -1;
-	}
-
-	return 0;
-}
-
 static uint64_t convert_seconds_to_nsec(double seconds)
 {
 	return (uint64_t)(seconds * 1000000000.0);
@@ -176,8 +160,15 @@
 		if (likely(ret == HASHTABLE_SUCCESS)) {
 			if (likely(request->origin_request_id != NULL)) {
 				cJSON *response = create_error_object(request->requesting_peer, INTERNAL_ERROR, "reason", "timeout for routed request");
-				send_routing_response(request->requesting_peer, request->origin_request_id, response, "error");
-				//cJSON_Delete(response);
+				cJSON *result_response = create_result_response(request->requesting_peer, request->origin_request_id, response, "error");
+				if (likely(result_response != NULL)) {
+					format_and_send_response(request->requesting_peer, result_response);
+					cJSON_Delete(result_response);
+				} else {
+					log_peer_err(request->requesting_peer, "Could not create %s response!\n", "error");
+					cJSON_Delete(response);
+				}
+
 				cjet_timer_destroy(&request->timer);
 				cJSON_Delete(request->origin_request_id);
 			}
@@ -251,7 +242,14 @@
 		if (likely(request->origin_request_id != NULL)) {
 			cJSON *response_copy = cJSON_Duplicate(response, 1);
 			if (likely(response_copy != NULL)) {
-				ret = send_routing_response(request->requesting_peer, request->origin_request_id, response_copy, result_type);
+				cJSON *result_response = create_result_response(request->requesting_peer, request->origin_request_id, response_copy, result_type);
+				if (likely(result_response != NULL)) {
+					format_and_send_response(request->requesting_peer, result_response);
+					cJSON_Delete(result_response);
+				} else {
+					log_peer_err(request->requesting_peer, "Could not create %s response!\n", result_type);
+					cJSON_Delete(response_copy);
+				}
 			} else {
 				log_peer_err(p, "Could not copy response!\n");
 				ret = -1;


added some model animation using transformation updates to sample

--- src/sample.c
+++ src/sample.c
@@ -40,6 +40,7 @@
 static GLFWwindow *window;
 static ShovelerMaterial *material;
 static ShovelerDrawable *cube;
+static ShovelerModel *model;
 static ShovelerScene *scene;
 static ShovelerCamerasPerspective *perspectiveCamera;
 static float previousCursorX;
@@ -58,7 +59,7 @@
 	shovelerOpenGLCheckSuccess();

 	cube = shovelerDrawablesCubeCreate();
-	ShovelerModel *model = shovelerModelCreate(cube, material);
+	model = shovelerModelCreate(cube, material);

 	scene = shovelerSceneCreate();
 	shovelerSceneAddModel(scene, model);
@@ -77,6 +78,12 @@
 void shovelerSampleRender(float dt)
 {
 	handleMovement(dt);
+
+	model->translation.values[0] += dt;
+	model->rotation.values[0] += 0.1f * dt;
+	model->scale.values[0] += 0.1f * dt;
+	shovelerModelUpdateTransformation(model);
+
 	shovelerSceneRender(scene, perspectiveCamera->camera);
 }