action: comment fixes

action: comment fixes

--- plugins/action/action.h
+++ plugins/action/action.h
@@ -39,7 +39,7 @@
     };

     /**
-     * Returns a human-readable English string for an Action::Result.
+     * Returns a human-readable English string for an `Action::Result`.
      */
     static const char *result_str(Result);

@@ -56,7 +56,7 @@
     /**
      * Disarms the drone (synchronous).
      *
-     * This will disarm a drone if it considers itself landed. If flying in-air, the drone should
+     * This will disarm a drone if it considers itself landed. If flying, the drone should
      * reject the disarm command. Disarming means that all motors will stop.
      *
      * @return result of request
@@ -66,7 +66,7 @@
     /**
      * Kills the drone (synchronous).
      *
-     * This will disarm a drone no matter if still landed or still in-air.
+     * This will disarm a drone irrespective of whether it is landed or flying.
      * Note that the drone will fall out of the sky if you use this command while flying.
      *
      * @return result of request
@@ -74,10 +74,12 @@
     Result kill() const;

     /**
-     * Commands the drone to take off and hover at a set takeoff altitude (synchronous).
+     * Commands the drone to take off and hover (synchronous).
      *
      * This switches the drone into position control mode and commands it to take off and hover at
-     * set takeoff altitude.
+     * the takeoff altitude set using `set_takeoff_altitude()`.
+     *
+     * Note that the vehicle needs to be armed before it can take off.
      *
      * @return result of request
      */
@@ -86,15 +88,12 @@
     /**
      * Commands the drone to land at the current position (synchronous).
      *
-     * This switches the drone into position control mode and commands it to take off and hover at
-     * set takeoff altitude.
-     *
      * @return result of request
      */
     Result land() const;

     /**
-     * Commands the drone to return to the launch (takeoff) position and land there (synchronous).
+     * Commands the drone to return to the launch (takeoff) position and land there (asynchronous).
      *
      * This switches the drone into RTL mode which generally means it will rise up to a certain
      * altitude to clear any obstacles before heading back to the launch (takeoff) position and
@@ -105,7 +104,7 @@
     Result return_to_launch() const;

     /**
-     * Callback type for async action calls.
+     * Callback type for async `Action` calls.
      */
     typedef std::function<void(Result)> result_callback_t;

@@ -122,7 +121,7 @@
     /**
      * Disarms the drone (asynchronous).
      *
-     * This will disarm a drone if it considers itself landed. If flying in-air, the drone should
+     * This will disarm a drone if it considers itself landed. If flying, the drone should
      * reject the disarm command. Disarming means that all motors will stop.
      *
      * @param callback function to call with result of request
@@ -132,7 +131,7 @@
     /**
      * Kills the drone (asynchronous).
      *
-     * This will disarm a drone no matter if still landed or still in-air.
+     * This will disarm a drone irrespective of whether it is landed or flying.
      * Note that the drone will fall out of the sky if you use this command while flying.
      *
      * @param callback function to call with result of request
@@ -140,10 +139,12 @@
     void kill_async(result_callback_t callback);

     /**
-     * Commands the drone to take off and hover at a set takeoff altitude (asynchronous).
+     * Commands the drone to take off and hover (asynchronous).
      *
      * This switches the drone into position control mode and commands it to take off and hover at
-     * set takeoff altitude.
+     * the takeoff altitude set set using `set_takeoff_altitude()`.
+     *
+     * Note that the vehicle needs to be armed before it can take off.
      *
      * @param callback function to call with result of request
      */
@@ -151,9 +152,6 @@

     /**
      * Commands the drone to land at the current position (asynchronous).
-     *
-     * This switches the drone into position control mode and commands it to take off and hover at
-     * set takeoff altitude.
      *
      * @param callback function to call with result of request
      */
@@ -178,21 +176,21 @@
     void set_takeoff_altitude(float relative_altitude_m);

     /**
-     * Gets the takeoff altitude above ground.
+     * Gets the takeoff altitude.
      *
      * @return takeoff altitude relative to takeoff location in meters
      */
     float get_takeoff_altitude_m() const;

     /**
-     * Sets maximum speed that drone is set to fly at.
+     * Sets vehicle maximum speed.
      *
      * @param speed_m_s maximum speed in meters/second
      */
     void set_max_speed(float speed_m_s);

     /**
-     * Gets maximum speed that drone is set to fly at.
+     * Gets the vehicle maximum speed.
      *
      * @return maximum speed in meters/second
      */


prog_util: always use 64-bit utime() on Windows


plugins: add missing 'elif'; fix indentation of MSVS2008 'if' block.

--- plugins/mumble_plugin.h
+++ plugins/mumble_plugin.h
@@ -36,10 +36,10 @@

 // Visual Studio 2008 x86
 #if _MSC_VER == 1500 && defined(_M_X86)
-#define MUMBLE_PLUGIN_MAGIC     0xd63ab7ef
-#define MUMBLE_PLUGIN_MAGIC_2   0xd63ab7fe
+# define MUMBLE_PLUGIN_MAGIC     0xd63ab7ef
+# define MUMBLE_PLUGIN_MAGIC_2   0xd63ab7fe
 // Visual Studio 2010 x86
-#if _MSC_VER == 1600 && defined(_M_X86)
+#elif _MSC_VER == 1600 && defined(_M_X86)
 # define MUMBLE_PLUGIN_MAGIC    0xd63ab7f0
 # define MUMBLE_PLUGIN_MAGIC_2  0xd63ab7ff
 // Visual Studio 2013 x86


Oops.  Fix typo in query

Oops.  Fix typo in query


Don't use deprecated gtk_style_context_get_background_color()

--- champlain-gtk/gtk-champlain-embed.c
+++ champlain-gtk/gtk-champlain-embed.c
@@ -288,6 +288,18 @@
   color->blue = CLAMP (gdk_rgba_color->blue * 255, 0, 255);
   color->alpha = CLAMP (gdk_rgba_color->alpha * 255, 0, 255);
 }
+
+static void
+get_background_color (GtkStyleContext *context,
+    GtkStateFlags state,
+    GdkRGBA *color)
+{
+  GdkRGBA *c;
+
+  gtk_style_context_get (context, state, "background-color", &c, NULL);
+  *color = *c;
+  gdk_rgba_free (c);
+}
 #endif

@@ -343,8 +355,8 @@
     }
   champlain_marker_set_selection_text_color (&color);

-  gtk_style_context_get_background_color (style, gtk_style_context_get_state (style),
-                                          &gdk_rgba_color);
+  get_background_color (style, gtk_style_context_get_state (style),
+                        &gdk_rgba_color);
   gdk_rgba_to_clutter_color (&gdk_rgba_color, &color);
   if (color.alpha == 0)
     color.alpha = 255;


* tsmf: OSS now work, but only with ffmpeg, and sound is bad (like with alsa), ffmpeg code possible have bug with wrong resample

--- channels/tsmf/client/oss/tsmf_oss.c
+++ channels/tsmf/client/oss/tsmf_oss.c
@@ -122,7 +122,6 @@
 	int tmp;
 	TSMFOssAudioDevice *oss = (TSMFOssAudioDevice*)audio;

-	WLog_INFO(TAG, "tsmf_oss_set_format");
 	if (oss == NULL || oss->pcm_handle == -1)
 		return FALSE;

@@ -136,16 +135,14 @@
 	tmp = channels;
 	if (ioctl(oss->pcm_handle, SNDCTL_DSP_CHANNELS, &tmp) == -1)
 		OSS_LOG_ERR("SNDCTL_DSP_CHANNELS failed", errno);
-	tmp = bits_per_sample;
+	tmp = sample_rate;
 	if (ioctl(oss->pcm_handle, SNDCTL_DSP_SPEED, &tmp) == -1)
 		OSS_LOG_ERR("SNDCTL_DSP_SPEED failed", errno);
-	tmp = 4096;//((bits_per_sample / 8) * channels * sample_rate);
+	tmp = ((bits_per_sample / 8) * channels * sample_rate);
 	if (ioctl(oss->pcm_handle, SNDCTL_DSP_SETFRAGMENT, &tmp) == -1)
 		OSS_LOG_ERR("SNDCTL_DSP_SETFRAGMENT failed", errno);

 	DEBUG_TSMF("sample_rate %d channels %d bits_per_sample %d",
-	    sample_rate, channels, bits_per_sample);
-	WLog_INFO(TAG, "tsmf_oss_set_format: sample_rate %d channels %d bits_per_sample %d",
 	    sample_rate, channels, bits_per_sample);

 	return TRUE;
@@ -157,7 +154,6 @@
 	TSMFOssAudioDevice *oss = (TSMFOssAudioDevice*)audio;

 	DEBUG_TSMF("tsmf_oss_play: data_size %d", data_size);
-	WLog_INFO(TAG, "tsmf_oss_play: data_size %d", data_size);

 	if (oss == NULL || oss->pcm_handle == -1)
 		return FALSE;
@@ -177,7 +173,6 @@
 		}
 		offset += status;
 	}
-	WLog_INFO(TAG, "tsmf_oss_play");

 	free(data);
 	return TRUE;
@@ -191,7 +186,7 @@
 		return 0;

 	//latency = ((oss->data_size_last / (oss->bits_per_sample / 8)) * oss->sample_rate);
-	WLog_INFO(TAG, "latency: %zu", latency);
+	//WLog_INFO(TAG, "latency: %zu", latency);
 	return latency;
 }


unix/moduselect: Raise OSError(ENOENT) if obj to modify is not in poller

Previously, the function silently succeeded. The new behavior is consistent
with both baremetal uselect implementation and CPython 3.

--- ports/unix/moduselect.c
+++ ports/unix/moduselect.c
@@ -158,13 +158,13 @@
     for (int i = self->len - 1; i >= 0; i--) {
         if (entries->fd == fd) {
             entries->events = mp_obj_get_int(eventmask_in);
-            break;
+            return mp_const_none;
         }
         entries++;
     }

-    // TODO raise KeyError if obj didn't exist in map
-    return mp_const_none;
+    // obj doesn't exist in poller
+    mp_raise_OSError(MP_ENOENT);
 }
 MP_DEFINE_CONST_FUN_OBJ_3(poll_modify_obj, poll_modify);


client/tarantool: interactive mode empty line leak fix

--- client/tarantool/tnt.c
+++ client/tarantool/tnt.c
@@ -235,14 +235,12 @@
 	char *cmd;
 	while ((cmd = readline(prompt))) {
 		if (!cmd[0])
-			continue;
+			goto next;
 		if (reconnect) {
 reconnect: 		if (reconnect_do(t, a))
 				reconnect = 0;
-			else {
-				free(cmd);
-				continue;
-			}
+			else
+				goto next;
 		}
 		if (tnt_query_is(cmd, strlen(cmd))) {
 			if (query(t, cmd) == -1) {
@@ -263,6 +261,7 @@
 		add_history(cmd);
 		if (reconnect)
 			goto reconnect;
+next:
 		free(cmd);
 	}


Mark static method defined in header as inline

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

--- net/base/cert_status_flags.h
+++ net/base/cert_status_flags.h
@@ -27,8 +27,8 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-#ifndef NET_BASE_CERT_STATUS_FLAGS_H__
-#define NET_BASE_CERT_STATUS_FLAGS_H__
+#ifndef NET_BASE_CERT_STATUS_FLAGS_H_
+#define NET_BASE_CERT_STATUS_FLAGS_H_

 namespace net {

@@ -54,10 +54,10 @@
 };

 // Returns true if the specified cert status has an error set.
-static bool IsCertStatusError(int status) {
+static inline bool IsCertStatusError(int status) {
   return (CERT_STATUS_ALL_ERRORS & status) != 0;
 }

 }  // namespace net

-#endif  // NET_BASE_CERT_STATUS_FLAGS_H__
+#endif  // NET_BASE_CERT_STATUS_FLAGS_H_


TTY: ircomm, define carrier routines

TTY: ircomm, define carrier routines

These will be used by the tty_port wait_til_ready later. (Now they are
used by our code.)

Signed-off-by: Jiri Slaby <dfbf39eb5bf303a3db5454d815cb8c8888cbadf9@suse.cz>
Cc: Samuel Ortiz <c16aab9fe3288df0fb8fc1d24990a300b6b8f299@sortiz.org>
Cc: 1099b3bee480025a15c1b622ecdea77a1d6d7166@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- net/irda/ircomm/ircomm_tty.c
+++ net/irda/ircomm/ircomm_tty.c
@@ -104,6 +104,35 @@
 #endif /* CONFIG_PROC_FS */
 };

+static void ircomm_port_raise_dtr_rts(struct tty_port *port, int raise)
+{
+	struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb,
+			port);
+	/*
+	 * Here, we use to lock those two guys, but as ircomm_param_request()
+	 * does it itself, I don't see the point (and I see the deadlock).
+	 * Jean II
+	 */
+	if (raise)
+		self->settings.dte |= IRCOMM_RTS | IRCOMM_DTR;
+	else
+		self->settings.dte &= ~(IRCOMM_RTS | IRCOMM_DTR);
+
+	ircomm_param_request(self, IRCOMM_DTE, TRUE);
+}
+
+static int ircomm_port_carrier_raised(struct tty_port *port)
+{
+	struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb,
+			port);
+	return self->settings.dce & IRCOMM_CD;
+}
+
+static const struct tty_port_operations ircomm_port_ops = {
+	.dtr_rts = ircomm_port_raise_dtr_rts,
+	.carrier_raised = ircomm_port_carrier_raised,
+};
+
 /*
  * Function ircomm_tty_init()
  *
@@ -290,15 +319,8 @@
 	port->blocked_open++;

 	while (1) {
-		if (tty->termios->c_cflag & CBAUD) {
-			/* Here, we use to lock those two guys, but
-			 * as ircomm_param_request() does it itself,
-			 * I don't see the point (and I see the deadlock).
-			 * Jean II */
-			self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR;
-
-			ircomm_param_request(self, IRCOMM_DTE, TRUE);
-		}
+		if (tty->termios->c_cflag & CBAUD)
+			tty_port_raise_dtr_rts(port);

 		current->state = TASK_INTERRUPTIBLE;

@@ -315,7 +337,7 @@
 		 * ready
 		 */
 		if (!test_bit(ASYNCB_CLOSING, &port->flags) &&
-		    (do_clocal || (self->settings.dce & IRCOMM_CD)) &&
+		    (do_clocal || tty_port_carrier_raised(port)) &&
 		    self->state == IRCOMM_TTY_READY)
 		{
 			break;
@@ -379,6 +401,7 @@
 		}

 		tty_port_init(&self->port);
+		self->port.ops = &ircomm_port_ops;
 		self->magic = IRCOMM_TTY_MAGIC;
 		self->flow = FLOW_STOP;


netfilter: xt_hashlimit: fix namespace destroy path

recent_net_exit() is called before recent_mt_destroy() in the
destroy path of network namespaces. Make sure there are no entries
in the parent proc entry xt_recent before removing it.

Signed-off-by: Vitaly E. Lavrov <85ba808bed9df4f7188a0c7fcc0fd3eb89d42d70@guap.ru>
Signed-off-by: Pablo Neira Ayuso <707d14912bb250caf67dfe0ea4035681fbfc4f56@netfilter.org>

--- net/netfilter/xt_hashlimit.c
+++ net/netfilter/xt_hashlimit.c
@@ -329,7 +329,10 @@
 		parent = hashlimit_net->ipt_hashlimit;
 	else
 		parent = hashlimit_net->ip6t_hashlimit;
-	remove_proc_entry(hinfo->pde->name, parent);
+
+	if(parent != NULL)
+		remove_proc_entry(hinfo->pde->name, parent);
+
 	htable_selective_cleanup(hinfo, select_all);
 	vfree(hinfo);
 }
@@ -873,6 +876,27 @@

 static void __net_exit hashlimit_proc_net_exit(struct net *net)
 {
+	struct xt_hashlimit_htable *hinfo;
+	struct hlist_node *pos;
+	struct proc_dir_entry *pde;
+	struct hashlimit_net *hashlimit_net = hashlimit_pernet(net);
+
+	/* recent_net_exit() is called before recent_mt_destroy(). Make sure
+	 * that the parent xt_recent proc entry is is empty before trying to
+	 * remove it.
+	 */
+	mutex_lock(&hashlimit_mutex);
+	pde = hashlimit_net->ipt_hashlimit;
+	if (pde == NULL)
+		pde = hashlimit_net->ip6t_hashlimit;
+
+	hlist_for_each_entry(hinfo, pos, &hashlimit_net->htables, node)
+		remove_proc_entry(hinfo->pde->name, pde);
+
+	hashlimit_net->ipt_hashlimit = NULL;
+	hashlimit_net->ip6t_hashlimit = NULL;
+	mutex_unlock(&hashlimit_mutex);
+
 	proc_net_remove(net, "ipt_hashlimit");
 #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
 	proc_net_remove(net, "ip6t_hashlimit");
@@ -889,9 +913,6 @@

 static void __net_exit hashlimit_net_exit(struct net *net)
 {
-	struct hashlimit_net *hashlimit_net = hashlimit_pernet(net);
-
-	BUG_ON(!hlist_empty(&hashlimit_net->htables));
 	hashlimit_proc_net_exit(net);
 }


istream-dot unit test updated.

istream-dot unit test updated.


lib-master: If accept() fails, stop listening only temporarily, not permanently.

--- src/lib-master/master-service.c
+++ src/lib-master/master-service.c
@@ -779,7 +779,9 @@
 		} else {
 			errno = orig_errno;
 			i_error("net_accept() failed: %m");
-			master_service_error(service);
+			/* try again later after one of the existing
+			   connections has died */
+			master_service_io_listeners_remove(service);
 			return;
 		}
 		/* use the "listener" as the connection fd and stop the


On the 'move-tracking-2' branch: Tweak, completing r1708952.

* subversion/libsvn_delta/compat3e.c
  (editor3_sequence_point): Use svn_branch_revision_root_get_branches()
    instead of direct access.

git-svn-id: 486ec3464084f62cfe8608152673c827b947faa2@1708963 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_delta/compat3e.c
+++ subversion/libsvn_delta/compat3e.c
@@ -1910,18 +1910,18 @@
   apr_array_header_t *branches;
   int i;

-  /* first, purge elements in each branch */
-  for (i = 0; i < eb->edited_rev_root->branches->nelts; i++)
-    {
-      svn_branch_state_t *b
-        = APR_ARRAY_IDX(eb->edited_rev_root->branches, i, void *);
-
-      svn_branch_purge(b, scratch_pool);
-    }
-
-  /* second, purge branches that are no longer nested */
   branches = svn_branch_revision_root_get_branches(eb->edited_rev_root,
                                                    scratch_pool);
+
+  /* first, purge elements in each branch */
+  for (i = 0; i < branches->nelts; i++)
+    {
+      svn_branch_state_t *b = APR_ARRAY_IDX(branches, i, void *);
+
+      svn_branch_purge(b, scratch_pool);
+    }
+
+  /* second, purge branches that are no longer nested */
   for (i = 0; i < branches->nelts; i++)
     {
       svn_branch_state_t *b = APR_ARRAY_IDX(branches, i, void *);


Restrict the specializations of the 'MultTrait' and 'DivTrait' class templates for scalar multiplications and divisions with a 'HermitianMatrix'

--- blaze/math/adaptors/HermitianMatrix.h
+++ blaze/math/adaptors/HermitianMatrix.h
@@ -69,9 +69,10 @@
 #include <blaze/math/typetraits/RemoveAdaptor.h>
 #include <blaze/math/typetraits/Rows.h>
 #include <blaze/util/Assert.h>
-#include <blaze/util/constraints/Numeric.h>
+#include <blaze/util/EnableIf.h>
 #include <blaze/util/mpl/If.h>
 #include <blaze/util/typetraits/IsBuiltin.h>
+#include <blaze/util/typetraits/IsNumeric.h>
 #include <blaze/util/Unused.h>
 #include <blaze/util/valuetraits/IsTrue.h>

@@ -1009,17 +1010,15 @@
 //*************************************************************************************************
 /*! \cond BLAZE_INTERNAL */
 template< typename MT, bool SO, bool DF, typename T >
-struct MultTrait< HermitianMatrix<MT,SO,DF>, T >
+struct MultTrait< HermitianMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
 {
    typedef HermitianMatrix< typename MultTrait<MT,T>::Type >  Type;
-   BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE( T );
 };

 template< typename T, typename MT, bool SO, bool DF >
-struct MultTrait< T, HermitianMatrix<MT,SO,DF> >
+struct MultTrait< T, HermitianMatrix<MT,SO,DF>, typename EnableIf< IsNumeric<T> >::Type >
 {
    typedef HermitianMatrix< typename MultTrait<T,MT>::Type >  Type;
-   BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE( T );
 };

 template< typename MT, bool SO, bool DF, typename T, size_t N >
@@ -1174,10 +1173,9 @@
 //*************************************************************************************************
 /*! \cond BLAZE_INTERNAL */
 template< typename MT, bool SO, bool DF, typename T >
-struct DivTrait< HermitianMatrix<MT,SO,DF>, T >
+struct DivTrait< HermitianMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
 {
    typedef HermitianMatrix< typename DivTrait<MT,T>::Type >  Type;
-   BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE( T );
 };
 /*! \endcond */
 //*************************************************************************************************


For now, disable elimination of the identical suffix for diff (and diff3
(merge) and diff4), so working copies of people running trunk don't get
corrupted (when merging files with more than 50 lines of identical suffix,
the identical suffix is truncated after the 50th common line).

I expect/hope this to be a temporary fix.

* subversion/libsvn_diff/diff_file.c
  (datasources_open): Disable suffix scanning for now.

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

--- subversion/libsvn_diff/diff_file.c
+++ subversion/libsvn_diff/diff_file.c
@@ -736,7 +736,11 @@
   if (!reached_one_eof)
     /* No file consisted totally of identical prefix,
      * so there may be some identical suffix.  */
-    SVN_ERR(find_identical_suffix(files, datasources_len, file_baton->pool));
+    /* ### jcorve0: disable for now, because this causes wc corruption
+     * when merging files with more than 50 lines of identical suffix
+     * (identical suffix is truncated after the 50th common line). */
+    if (FALSE)
+      SVN_ERR(find_identical_suffix(files, datasources_len, file_baton->pool));

   /* Copy local results back to baton. */
   for (i = 0; i < datasources_len; i++)


Add the 'set' member functions to the 'VectorAccessProxy' class template

--- blaze/math/sparse/VectorAccessProxy.h
+++ blaze/math/sparse/VectorAccessProxy.h
@@ -213,6 +213,8 @@
    inline size_t   nonZeros() const;
    inline size_t   nonZeros( size_t i ) const;
    inline void     reset( size_t i ) const;
+   inline Iterator set( size_t index, const ElementType& value ) const;
+   inline Iterator set( size_t i, size_t j, const ElementType& value ) const;
    inline Iterator insert( size_t index, const ElementType& value ) const;
    inline Iterator insert( size_t i, size_t j, const ElementType& value ) const;
    inline void     append( size_t index, const ElementType& value, bool check=false ) const;
@@ -987,23 +989,23 @@

 //*************************************************************************************************
-/*!\brief Inserting an element into the represented sparse vector.
+/*!\brief Setting an element of the represented sparse vector.
 //
 // \param index The index of the new element. The index has to be in the range \f$[0..N-1]\f$.
-// \param value The value of the element to be inserted.
-// \return Reference to the inserted value.
+// \param value The value of the element to be set.
+// \return Reference to the set value.
 // \exception std::invalid_argument Invalid compressed vector access index.
 //
-// In case the access proxy represents a vector-like data structure that provides an insert()
-// function, this function inserts a new element into the sparse vector. However, duplicate
-// elements are not allowed. In case the sparse vector already contains an element with index
-// \a index, a \a std::invalid_argument exception is thrown.
+// In case the access proxy represents a vector-like data structure that provides a set() function,
+// this function sets the value of an element of the sparse vector. In case the sparse vector
+// already contains an element with index \a index its value is modified, else a new element with
+// the given \a value is inserted.
 */
 template< typename VT >  // Type of the sparse vector
 inline typename VectorAccessProxy<VT>::Iterator
-   VectorAccessProxy<VT>::insert( size_t index, const ElementType& value ) const
-{
-   return get().insert( index, value );
+   VectorAccessProxy<VT>::set( size_t index, const ElementType& value ) const
+{
+   return get().set( index, value );
 }
 //*************************************************************************************************

@@ -1017,7 +1019,52 @@
 // \return Iterator to the newly inserted element.
 // \exception std::invalid_argument Invalid sparse matrix access index.
 //
+// In case the access proxy represents a matrix-like data structure that provides a set() function,
+// this function sets the value of an element of the sparse matrix. In case the sparse matrix
+// already contains an element with row index \a i and column index \a j its value is modified,
+// else a new element with the given \a value is inserted.
+*/
+template< typename VT >  // Type of the sparse vector
+inline typename VectorAccessProxy<VT>::Iterator
+   VectorAccessProxy<VT>::set( size_t i, size_t j, const ElementType& value ) const
+{
+   return get().set( i, j, value );
+}
+//*************************************************************************************************
+
+
+//*************************************************************************************************
+/*!\brief Inserting an element into the represented sparse vector.
+//
+// \param index The index of the new element. The index has to be in the range \f$[0..N-1]\f$.
+// \param value The value of the element to be inserted.
+// \return Reference to the inserted value.
+// \exception std::invalid_argument Invalid compressed vector access index.
+//
 // In case the access proxy represents a vector-like data structure that provides an insert()
+// function, this function inserts a new element into the sparse vector. However, duplicate
+// elements are not allowed. In case the sparse vector already contains an element with index
+// \a index, a \a std::invalid_argument exception is thrown.
+*/
+template< typename VT >  // Type of the sparse vector
+inline typename VectorAccessProxy<VT>::Iterator
+   VectorAccessProxy<VT>::insert( size_t index, const ElementType& value ) const
+{
+   return get().insert( index, value );
+}
+//*************************************************************************************************
+
+
+//*************************************************************************************************
+/*!\brief Inserting an element into the represented sparse matrix.
+//
+// \param i The row index of the new element. The index has to be in the range \f$[0..M-1]\f$.
+// \param j The column index of the new element. The index has to be in the range \f$[0..N-1]\f$.
+// \param value The value of the element to be inserted.
+// \return Iterator to the newly inserted element.
+// \exception std::invalid_argument Invalid sparse matrix access index.
+//
+// In case the access proxy represents a matrix-like data structure that provides an insert()
 // function, this function inserts a new element into the sparse matrix. However, duplicate
 // elements are not allowed. In case the sparse matrix already contains an element with row
 // index \a i and column index \a j, a \a std::invalid_argument exception is thrown.


* ecore: Fix ecore_file_dir_get.

	* ecore: Fix ecore_file_dir_get.

SVN revision: 45283

--- src/lib/ecore_file/ecore_file.c
+++ src/lib/ecore_file/ecore_file.c
@@ -13,6 +13,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <libgen.h>

 #ifndef _FILE_OFFSET_BITS
 # define _FILE_OFFSET_BITS  64
@@ -600,13 +601,8 @@
    char buf[PATH_MAX];

    strncpy(buf, file, PATH_MAX);
-   p = strrchr(buf, '/');
-   if (!p) return strdup(file);
-
-   if (p == buf) return strdup("/");
-
-   *p = 0;
-   return strdup(buf);
+   p = dirname(buf);
+   return strdup(p);
 }

 /**


* subversion/libsvn_fs_fs/rev_file.c
  (init_revision_file): Add missing docstring. No functional change.

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

--- subversion/libsvn_fs_fs/rev_file.c
+++ subversion/libsvn_fs_fs/rev_file.c
@@ -31,6 +31,8 @@
 #include "private/svn_io_private.h"
 #include "svn_private_config.h"

+/* Initialize the *FILE structure for REVISION in filesystem FS.  Set its
+ * pool member to the provided POOL. */
 static void
 init_revision_file(svn_fs_fs__revision_file_t *file,
                    svn_fs_t *fs,


formatting

formatting

SVN revision: 35791

--- src/lib/ecore_file/ecore_file.c
+++ src/lib/ecore_file/ecore_file.c
@@ -311,49 +311,49 @@
 	     stat(src, &st);
 	     if (S_ISREG(st.st_mode))
 	       {
-                  // Since we can't directly rename, try to
-                  // copy to temp file in the dst directory
-                  // and then rename.
-                  snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX",
-                           ecore_file_dir_get(dst),
-                           ecore_file_file_get(dst));
-                  fd = mkstemp(buf);
-                  if(fd < 0)
-                    {
-                       perror("mkstemp");
-                       goto FAIL;
-                    }
-                  close(fd);
-
-                  // Copy to temp file
-                  if(!ecore_file_cp(src,buf))
-                    goto FAIL;
-
-                  // Set file permissions of temp file to match src
-                  chmod(buf, st.st_mode);
-
-                  // Try to atomically move temp file to dst
-                  if (rename(buf, dst))
-                    {
-                       // If we still cannot atomically move
-                       // do a normal copy and hope for the best.
-                       if(!ecore_file_cp(buf, dst))
-                           goto FAIL;
-                    }
-
-                  // Delete temporary file and src
-                  ecore_file_unlink(buf);
-                  ecore_file_unlink(src);
-                  goto PASS;
+		  // Since we can't directly rename, try to
+		  // copy to temp file in the dst directory
+		  // and then rename.
+		  snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX",
+			   ecore_file_dir_get(dst),
+			   ecore_file_file_get(dst));
+		  fd = mkstemp(buf);
+		  if (fd < 0)
+		    {
+		       perror("mkstemp");
+		       goto FAIL;
+		    }
+		  close(fd);
+
+		  // Copy to temp file
+		  if (!ecore_file_cp(src, buf))
+		    goto FAIL;
+
+		  // Set file permissions of temp file to match src
+		  chmod(buf, st.st_mode);
+
+		  // Try to atomically move temp file to dst
+		  if (rename(buf, dst))
+		    {
+		       // If we still cannot atomically move
+		       // do a normal copy and hope for the best.
+		       if (!ecore_file_cp(buf, dst))
+			 goto FAIL;
+		    }
+
+		  // Delete temporary file and src
+		  ecore_file_unlink(buf);
+		  ecore_file_unlink(src);
+		  goto PASS;
 	       }
 	  }
 	goto FAIL;
      }

-   PASS:
+PASS:
    return 1;

-   FAIL:
+FAIL:
    return 0;
 }


ra_serf: fix authz_tests 10. When creating an activity is forbidden, raise
the correct error instead of aborting.
Note: ra_serf will try to delete the activity when creation failed. The delete
isn't strictly necessary, and will also be forbidden by the server.

* subversion/libsvn_ra_serf/commit.c
  (open_root): replace abort() with error.
  (abort_edit): add 403 forbidden as acceptable status.

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

--- subversion/libsvn_ra_serf/commit.c
+++ subversion/libsvn_ra_serf/commit.c
@@ -1017,7 +1017,12 @@

   if (mkact_ctx->status != 201)
     {
-      abort();
+      return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+                               _("%s of '%s': %d %s (%s://%s)"),
+                               handler->method, handler->path,
+                               mkact_ctx->status, mkact_ctx->reason,
+                               ctx->session->repos_url.scheme,
+                               ctx->session->repos_url.hostinfo);
     }

   SVN_ERR(svn_ra_serf__discover_root(&vcc_url, NULL,
@@ -1845,9 +1850,13 @@
   SVN_ERR(svn_ra_serf__context_run_wait(&delete_ctx->done, ctx->session,
                                         pool));

-  /* 204 if deleted, 404 if the activity wasn't found. */
+  /* 204 if deleted,
+     403 if DELETE was forbidden (indicates MKACTIVITY was forbidded too,
+     404 if the activity wasn't found. */
   if (delete_ctx->status != 204 &&
-      delete_ctx->status != 404)
+      delete_ctx->status != 403 &&
+      delete_ctx->status != 404
+      )
     {
       abort();
     }


Directory list should sort case-insensitive. Anything else is counter-intuitive and annoying. :)

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

--- src/lib/ecore_file/ecore_file.c
+++ src/lib/ecore_file/ecore_file.c
@@ -247,7 +247,7 @@
 	     ecore_list_goto_first(list);
 	     while ((file = ecore_list_current(list)))
 	       {
-		  if (strcmp(file, dp->d_name) > 0)
+		  if (strcasecmp(file, dp->d_name) > 0)
 		    {
 		       f = strdup(dp->d_name);
 		       ecore_list_insert(list, f);
@@ -259,7 +259,7 @@
 	     if (!file)
 	       {
 		  f = strdup(dp->d_name);
-		  ecore_list_append(list, f);
+		  ecore_list_insert(list, f);
 	       }
 	  }
      }


ra_serf: Properly init two fields to NULL.

* subversion/libsvn_ra_serf/update.c
  (svn_ra_serf__do_update): Init ->free_info and ->free_state to NULL;

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

--- subversion/libsvn_ra_serf/update.c
+++ subversion/libsvn_ra_serf/update.c
@@ -1012,8 +1012,9 @@
   report->update_baton = update_baton;
   report->active_fetches = NULL;
   report->active_propfinds = NULL;
+  report->free_info = NULL;
+  report->free_state = NULL;
   report->done = FALSE;
-  report->free_info = 0;

   /* Create our XML parser */
   report->xmlp = XML_ParserCreate(NULL);


* subversion/libsvn_repos/reporter.c
  (update_entry): Style nit: Replace "if (a) b = TRUE;" with "b = (a);"

Suggested by: hwright

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

--- subversion/libsvn_repos/reporter.c
+++ subversion/libsvn_repos/reporter.c
@@ -807,8 +807,8 @@
           && (!info || (!info->start_empty && !info->lock_token))
           && (requested_depth <= wc_depth || t_entry->kind == svn_node_file))
         return SVN_NO_ERROR;
-      else if (distance != -1 || b->ignore_ancestry)
-        related = TRUE;
+
+      related = (distance != -1 || b->ignore_ancestry);
     }

   /* If there's a source and it's not related to the target, nuke it. */


* subversion/libsvn_repos/reporter.c: Code indentation fix only.

--- subversion/libsvn_repos/reporter.c
+++ subversion/libsvn_repos/reporter.c
@@ -1015,7 +1015,7 @@
                   /* There is no corresponding target entry, so delete. */
                   e_fullpath = svn_path_join(e_path, s_entry->name, subpool);
                   SVN_ERR(svn_repos_deleted_rev(svn_fs_root_fs(b->t_root),
-                                               svn_path_join(t_path,
+                                                svn_path_join(t_path,
                                                               s_entry->name,
                                                               subpool),
                                                 s_rev, b->t_rev,


Make "blame -g" more efficient on the server when svn:mergeinfo is
large.

* subversion/libsvn_repos/rev_hunt.c
  (get_merged_mergeinfo): Use the FS path_changed API to check
   for property changes before doing expensive svn:mergeinfo
   manipulations, don't treat newly created paths as a merge,
   avoid allocating some empty hashes.

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

--- subversion/libsvn_repos/rev_hunt.c
+++ subversion/libsvn_repos/rev_hunt.c
@@ -1036,7 +1036,8 @@
 };

 /* Check for merges in OLD_PATH_REV->PATH at OLD_PATH_REV->REVNUM.  Store
-   the mergeinfo difference in MERGED_MERGEINFO, allocated in POOL. */
+   the mergeinfo difference in *MERGED_MERGEINFO, allocated in POOL.  The
+   returned *MERGED_MERGEINFO will be NULL if there are no changes. */
 static svn_error_t *
 get_merged_mergeinfo(apr_hash_t **merged_mergeinfo,
                      svn_repos_t *repos,
@@ -1046,6 +1047,30 @@
   apr_pool_t *subpool = svn_pool_create(pool);
   apr_hash_t *curr_mergeinfo, *prev_mergeinfo, *deleted, *changed;
   svn_error_t *err;
+  svn_fs_root_t *root;
+  apr_hash_t *changed_paths;
+  const char *path = old_path_rev->path;
+
+  /* Getting/parsing/diffing svn:mergeinfo is expensive, so only do it
+     if there is a property change. */
+  SVN_ERR(svn_fs_revision_root(&root, repos->fs, old_path_rev->revnum,
+                               subpool));
+  SVN_ERR(svn_fs_paths_changed2(&changed_paths, root, subpool));
+  while (1)
+    {
+      svn_fs_path_change2_t *changed_path = apr_hash_get(changed_paths,
+                                                         path,
+                                                         APR_HASH_KEY_STRING);
+      if (changed_path && changed_path->prop_mod)
+        break;
+      if (svn_dirent_is_root(path, strlen(path)))
+        {
+          svn_pool_destroy(subpool);
+          *merged_mergeinfo = NULL;
+          return SVN_NO_ERROR;
+        }
+      path = svn_path_dirname(path, subpool);
+    }

   /* First, find the mergeinfo difference for old_path_rev->revnum, and
      old_path_rev->revnum - 1. */
@@ -1055,10 +1080,12 @@
                            old_path_rev->revnum - 1, subpool);
   if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
     {
-      /* If the path doesn't exist in the previous revision, assume empty
-         mergeinfo. */
+      /* If the path doesn't exist in the previous revision, assume no
+         merges */
       svn_error_clear(err);
-      prev_mergeinfo = apr_hash_make(subpool);
+      svn_pool_destroy(subpool);
+      *merged_mergeinfo = NULL;
+      return SVN_NO_ERROR;
     }
   else
     SVN_ERR(err);
@@ -1066,10 +1093,14 @@
   /* Then calculate and merge the differences. */
   SVN_ERR(svn_mergeinfo_diff(&deleted, &changed, prev_mergeinfo, curr_mergeinfo,
                              FALSE, subpool));
-  SVN_ERR(svn_mergeinfo_merge(changed, deleted, subpool));
+  if (apr_hash_count(deleted))
+    SVN_ERR(svn_mergeinfo_merge(changed, deleted, subpool));

   /* Store the result. */
-  *merged_mergeinfo = svn_mergeinfo_dup(changed, pool);
+  if (apr_hash_count(changed))
+    *merged_mergeinfo = svn_mergeinfo_dup(changed, pool);
+  else
+    *merged_mergeinfo = NULL;

   svn_pool_destroy(subpool);


* subversion/libsvn_wc/adm_crawler.c
  (svn_wc_crawl_revisions5): Remove an irrelevant/misplaced comment.

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

--- subversion/libsvn_wc/adm_crawler.c
+++ subversion/libsvn_wc/adm_crawler.c
@@ -1012,8 +1012,6 @@
           if (err)
             goto abort_report;

-          /* Split PATH into parent PDIR and basename BNAME. */
-
           if (strcmp(repos_relpath,
                      svn_relpath_join(parent_repos_relpath, base, pool)) != 0)
             {


Update g_sys.h

Update g_sys.h

--- module/gsystem/inc/g_sys.h
+++ module/gsystem/inc/g_sys.h
@@ -22,52 +22,55 @@

 namespace gsys {

-typedef enum
+class GSystem
 {
-	G_SHELL_R = 1,
-	G_SHELL_W
-} GShellMode;
-
-/**
- * @brief sleep
- * @param [in] time : second
- * @note
- */
-static void sleep(const GUint64 time);
-
-/**
- * @brief usleep
- * @param [in] time : millisecond
- * @note
- */
-static void usleep(const GUint64 time);
-
-/**
- * @brief usleep
- * @param [out] buffer : out buffer
- * @param [in] size : out buffer size
- * @param [in] args : parameters
- * @return string size
- * @note
- */
-static GUint64 format(GInt8* buffer, const GUint64 size, const GInt8* args, ...);
-
-/**
- * @brief execute shell commond
- * @param [in] cmd : commond line
- * @param [in] mode : read/write for pipe
- * @param [out] buffer : output buffer
- * @param [in] size : output buffer size
- * @return G_YES/G_NO
- * @note
- */
-static GResult shell(const GInt8* cmd, const GShellMode mode, GInt8* buffer, const GUint32 size);
-
-/**
- * @brief get system time
- * @return time(microsecond)
- * @note
- */
-static GUint64 getSysTime();
+	/**
+	 * @brief sleep
+	 * @param [in] time : second
+	 * @note
+	 */
+	static void sleep(const GUint64 time);
+
+	/**
+	 * @brief usleep
+	 * @param [in] time : millisecond
+	 * @note
+	 */
+	static void usleep(const GUint64 time);
+
+	/**
+	 * @brief usleep
+	 * @param [out] buffer : out buffer
+	 * @param [in] size : out buffer size
+	 * @param [in] args : parameters
+	 * @return string size
+	 * @note
+	 */
+	static GUint64 format(GInt8* buffer, const GUint64 size, const GInt8* args, ...);
+
+	/**
+	 * @brief execute shell commond
+	 * @param [in] cmd : commond line
+	 * @return G_YES/G_NO
+	 * @note
+	 */
+	static GResult shell(const GInt8* cmd);
+
+	/**
+	 * @brief execute shell commond
+	 * @param [in] cmd : commond line
+	 * @param [out] buffer : output buffer
+	 * @param [in] size : output buffer size
+	 * @return G_YES/G_NO
+	 * @note
+	 */
+	static GResult shell(const GInt8* cmd, GInt8* buffer, const GUint32 size);
+
+	/**
+	 * @brief get system time
+	 * @return time(microsecond)
+	 * @note
+	 */
+	static GUint64 getSysTime();
 };
 }


Add an ifdef to make sure it still runs on linux

--- mc-sema/tests/x86_64/demo_driver_fpu1.c
+++ mc-sema/tests/x86_64/demo_driver_fpu1.c
@@ -6,6 +6,23 @@

 extern void demo_fpu1_entry(RegState *);

+#ifdef __linux__
+long double DoDemoFpu1(long double k) {
+    RegState            rState = {0};
+    unsigned long   stack[4096*10];
+    nativefpu n;
+
+    //set up the stack
+    memcpy(&stack[0x8ff5], &k, sizeof(k));
+    rState.RSP = (unsigned long) &stack[0x8ff4];
+
+    demo_fpu1_entry(&rState);
+
+    // read ST(0)
+    n = FPU_GET_REG(&rState, 0);
+    return NATIVEFPU_TO_LD(&n);
+}
+#else
 long double DoDemoFpu1(long double k) {
     __m128d foo;
     RegState            rState = {0};
@@ -22,6 +39,7 @@
     //return NATIVEFPU_TO_LD((nativefpu*)(rState.XMM0.tag));
     return bar;
 }
+#endif

 int main(int argc, char *argv[]) {


I2C: Match the kernel's I2C address path.

The device address must have 4 characters. This was causing
some problems in IIO, because it was not possible to find the
correct path in the sysfs.

Signed-off-by: Guilherme Iscaro <cb2533f884a82b148f26e9601523457e695503d6@intel.com>

--- src/lib/io/sol-i2c-impl-linux.c
+++ src/lib/io/sol-i2c-impl-linux.c
@@ -1060,7 +1060,7 @@
                 sol_util_strerrora(errno));
         }

-        r = snprintf(path, PATH_MAX, "%s/%s/%s-00%x",
+        r = snprintf(path, PATH_MAX, "%s/%s/%s-%04x",
             dir_path, ent->d_name, ent->d_name + strlen("i2c-"),
             result->dev_number);
         if (r < 0 || r >= PATH_MAX) {


rectified a mistake in sorting

rectified a mistake in sorting

--- bubble_sort/using_array/bubble_sort.c
+++ bubble_sort/using_array/bubble_sort.c
@@ -10,8 +10,8 @@
         return -2;
     }
     int i = 0, j = 0;
-    for (; i < size - 2; i++) {
-        for (j = 0; j < size-1-i; j++) {
+    for (; i <= size - 2; i++) {
+        for (j = 0; j <= size-1-i; j++) {
             if (array[j+1] < array[j]) {
                 swap(array, j, j+1);
             }


shared/frame: NULL check before attempting to deref

Signed-off-by: U. Artie Eoff <32aece0d55055227b44d04b7d0051cf3d04ee871@intel.com>

--- shared/frame.c
+++ shared/frame.c
@@ -736,15 +736,15 @@
 {
 	struct frame_pointer *pointer = frame_pointer_get(frame, data);
 	struct frame_pointer_button *button;
-	enum theme_location location;
+	enum theme_location location = THEME_LOCATION_EXTERIOR;
+
+	if (!pointer)
+		return location;

 	location = theme_get_location(frame->theme, pointer->x, pointer->y,
 				      frame->width, frame->height,
 				      frame->flags & FRAME_FLAG_MAXIMIZED ?
 				      THEME_FRAME_MAXIMIZED : 0);
-
-	if (!pointer)
-		return location;

 	if (state == FRAME_BUTTON_PRESSED) {
 		button = malloc(sizeof *button);
@@ -784,7 +784,7 @@
 	if (id > 0)
 		return;

-	if (button) {
+	if (touch && button) {
 		touch->button = button;
 		frame_button_press(touch->button);
 		return;
@@ -822,10 +822,9 @@
 	if (id > 0)
 		return;

-	if (touch->button) {
+	if (touch && touch->button) {
 		frame_button_release(touch->button);
 		frame_touch_destroy(touch);
-		return;
 	}
 }


fixed logic issue which could result in repeat log entries

--- apps/log/src/oskar_log_write.c
+++ apps/log/src/oskar_log_write.c
@@ -65,7 +65,7 @@
     }

     /* Write the entry to the log file */
-    else if (log && log->file && should_print_file_entry(log, priority))
+    else if (is_file && log && log->file && should_print_file_entry(log, priority))
     {
 #ifdef _OPENMP
         omp_set_lock(&log->mutex); /* lock the mutex */


setting errno on failure of pthread_mutex_init()

--- src/lib/threadpool/threadpool.c
+++ src/lib/threadpool/threadpool.c
@@ -173,16 +173,22 @@
     }

     err = pthread_mutex_init(&pool->mutex_queue_in, NULL);
-    if(err)
+    if(err) {
+        errno = err;
         goto cleanup1;
+    }

     err = pthread_mutex_init(&pool->mutex_queue_out, NULL);
-    if(err)
+    if(err) {
+        errno = err;
         goto cleanup2;
+    }

     err = pthread_mutex_init(&pool->mutex_map, NULL);
-    if(err)
+    if(err) {
+        errno = err;
         goto cleanup3;
+    }

     err = sem_init(&pool->sem_queue_in, 0, 0);
     if(err < 0)


Reset the actor context on runtime initialisation (#2047)

Not reinitialising the context could result in the runtime referencing
an invalid actor if the runtime was stopped and restarted.

--- src/libponyrt/sched/scheduler.c
+++ src/libponyrt/sched/scheduler.c
@@ -371,6 +371,7 @@
   bool pinasio)
 {
   pony_register_thread();
+  this_scheduler->ctx.current = NULL;

   use_yield = !noyield;


explicit export of function (WIN32)

explicit export of function (WIN32)

--- src/lilypond/messagesHandling.h
+++ src/lilypond/messagesHandling.h
@@ -15,6 +15,8 @@

 #include <iomanip> // for 'setw()'
 #include <set>     // for 'setw()'
+
+#include "exports.h"

 namespace MusicXML2
@@ -108,7 +110,7 @@
 extern std::set<int> gWarningsInputLineNumbers;
 extern std::set<int> gErrorsInputLineNumbers;

-void displayWarningsAndErrorsInputLineNumbers ();
+EXP void displayWarningsAndErrorsInputLineNumbers ();

 }


implement Function#name

implement Function#name

--- src/lv5/teleporter_jsfunction.h
+++ src/lv5/teleporter_jsfunction.h
@@ -22,7 +22,8 @@
  public:
   JSCodeFunction(Context* ctx,
                  const FunctionLiteral* func,
-                 JSScript* script, JSEnv* env)
+                 JSScript* script,
+                 JSEnv* env)
     : function_(func),
       script_(script),
       env_(env) {
@@ -44,12 +45,20 @@
         DataDescriptor(this,
                        PropertyDescriptor::WRITABLE |
                        PropertyDescriptor::CONFIGURABLE),
-                       false, &e);
+        false, &e);
     DefineOwnProperty(
         ctx, context::prototype_symbol(ctx),
         DataDescriptor(proto,
                        PropertyDescriptor::WRITABLE),
-                       false, &e);
+        false, &e);
+    core::UStringPiece name = GetName();
+    if (!name.empty()) {
+      DefineOwnProperty(
+          ctx, context::Intern(ctx, "name"),
+          DataDescriptor(JSString::New(ctx, name),
+                         PropertyDescriptor::NONE),
+          false, &e);
+    }
     if (ctx->IsStrict()) {
       JSFunction* const throw_type_error = ctx->throw_type_error();
       DefineOwnProperty(ctx, context::caller_symbol(ctx),


Fix typo.

Fix typo.

git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@2043 94b884b6-d6fd-0310-90d3-974f1d3f35e1

--- numpy/core/src/arrayobject.c
+++ numpy/core/src/arrayobject.c
@@ -3228,7 +3228,7 @@
                         return result;
                 case Py_NE:
 			if (other == Py_None) {
-				Py_INCREF(Py_True)
+				Py_INCREF(Py_True);
 				return Py_True;
 			}
                         /* Try to convert other to an array */


Fix #302 by being careful about situations where the index method is defined but the object is a sequence.

--- numpy/core/src/arrayobject.c
+++ numpy/core/src/arrayobject.c
@@ -2812,7 +2812,8 @@
         }

         if (PyInt_Check(index) || PyArray_IsScalar(index, Integer) ||
-            PyLong_Check(index) || PyIndex_Check(index)) {
+            PyLong_Check(index) || (PyIndex_Check(index) &&
+                                    !PySequence_Check(index))) {
                 intp value;
                 value = PyArray_PyIntAsIntp(index);
                 if (PyErr_Occurred())
@@ -2920,7 +2921,8 @@
         intp vals[MAX_DIMS];

         if (PyInt_Check(op) || PyArray_IsScalar(op, Integer) || \
-            PyLong_Check(op) || PyIndex_Check(op)) {
+            PyLong_Check(op) || (PyIndex_Check(op) &&
+                                 !PySequence_Check(op))) {
                 intp value;
                 value = PyArray_PyIntAsIntp(op);
                 if (PyErr_Occurred())
@@ -3844,8 +3846,8 @@
 static PyObject *
 array_index(PyArrayObject *v)
 {
-        if (PyArray_SIZE(v) != 1 || !PyArray_ISINTEGER(v)) {
-                PyErr_SetString(PyExc_TypeError, "only length-1 integer " \
+        if (v->nd != 0 || !PyArray_ISINTEGER(v)) {
+                PyErr_SetString(PyExc_TypeError, "only 0-d integer"     \
                                 "arrays can be converted to an index");
                 return NULL;
         }


bpf: add search pruning optimization to verifier

consider C program represented in eBPF:
int filter(int arg)
{
    int a, b, c, *ptr;

    if (arg == 1)
        ptr = &a;
    else if (arg == 2)
        ptr = &b;
    else
        ptr = &c;

    *ptr = 0;
    return 0;
}
eBPF verifier has to follow all possible paths through the program
to recognize that '*ptr = 0' instruction would be safe to execute
in all situations.
It's doing it by picking a path towards the end and observes changes
to registers and stack at every insn until it reaches bpf_exit.
Then it comes back to one of the previous branches and goes towards
the end again with potentially different values in registers.
When program has a lot of branches, the number of possible combinations
of branches is huge, so verifer has a hard limit of walking no more
than 32k instructions. This limit can be reached and complex (but valid)
programs could be rejected. Therefore it's important to recognize equivalent
verifier states to prune this depth first search.

Basic idea can be illustrated by the program (where .. are some eBPF insns):
    1: ..
    2: if (rX == rY) goto 4
    3: ..
    4: ..
    5: ..
    6: bpf_exit
In the first pass towards bpf_exit the verifier will walk insns: 1, 2, 3, 4, 5, 6
Since insn#2 is a branch the verifier will remember its state in verifier stack
to come back to it later.
Since insn#4 is marked as 'branch target', the verifier will remember its state
in explored_states[4] linked list.
Once it reaches insn#6 successfully it will pop the state recorded at insn#2 and
will continue.
Without search pruning optimization verifier would have to walk 4, 5, 6 again,
effectively simulating execution of insns 1, 2, 4, 5, 6
With search pruning it will check whether state at #4 after jumping from #2
is equivalent to one recorded in explored_states[4] during first pass.
If there is an equivalent state, verifier can prune the search at #4 and declare
this path to be safe as well.
In other words two states at #4 are equivalent if execution of 1, 2, 3, 4 insns
and 1, 2, 4 insns produces equivalent registers and stack.

Signed-off-by: Alexei Starovoitov <c24c0248770ae98831f8a654310d4c2e07514c61@plumgrid.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


posix-timers: sys_timer_create: cleanup the error handling

Cleanup.

- sys_timer_create() is big and complicated. The code above the "out:"
  label relies on the fact that "error" must be == 0. This is not very
  robust, make the code more explicit. Remove the unneeded initialization
  of error.

- If idr_get_new() succeeds (as it normally should), we check the returned
  value twice. Move the "-EAGAIN" check under "if (error)".

Signed-off-by: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@tv-sign.ru>
Cc: 9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu
Cc: Roland McGrath <0d270388f2f92757a5de0f4bd891d3b392c44c4f@redhat.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- kernel/posix-timers.c
+++ kernel/posix-timers.c
@@ -454,9 +454,8 @@
 		 struct sigevent __user *timer_event_spec,
 		 timer_t __user * created_timer_id)
 {
-	int error = 0;
 	struct k_itimer *new_timer;
-	int new_timer_id;
+	int error, new_timer_id;
 	struct task_struct *process;
 	sigevent_t event;
 	int it_id_set = IT_ID_NOT_SET;
@@ -478,9 +477,9 @@
 	error = idr_get_new(&posix_timers_id, (void *) new_timer,
 			    &new_timer_id);
 	spin_unlock_irq(&idr_lock);
-	if (error == -EAGAIN)
-		goto retry;
-	else if (error) {
+	if (error) {
+		if (error == -EAGAIN)
+			goto retry;
 		/*
 		 * Weird looking, but we return EAGAIN if the IDR is
 		 * full (proper POSIX return value for this)
@@ -541,6 +540,8 @@
 	new_timer->it_process = process;
 	list_add(&new_timer->list, &current->signal->posix_timers);
 	spin_unlock_irq(&current->sighand->siglock);
+
+	return 0;
  	/*
 	 * In the case of the timer belonging to another task, after
 	 * the task is unlocked, the timer is owned by the other task
@@ -548,9 +549,7 @@
 	 * new_timer after the unlock call.
 	 */
 out:
-	if (error)
-		release_posix_timer(new_timer, it_id_set);
-
+	release_posix_timer(new_timer, it_id_set);
 	return error;
 }


ftrace: Add warning if tramp hash does not match nr_trampolines

After adding all the records to the tramp_hash, add a check that makes
sure that the number of records added matches the number of records
expected to match and do a WARN_ON and disable ftrace if they do
not match.

Signed-off-by: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>


Fix VS2019 compile error C4703: potentially uninitialized local pointer variable used.

encode_key2text.c(689): error C4703: potentially uninitialized local pointer variable 'modulus_label' used
encode_key2text.c(691): error C4703: potentially uninitialized local pointer variable 'exponent_label' used

CLA: trivial

Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
Reviewed-by: Tomas Mraz <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@openssl.org>
Reviewed-by: Paul Dale <ddec78389666b4f7c9b4d110380c848489a3e4aa@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12845)

--- providers/implementations/encode_decode/encode_key2text.c
+++ providers/implementations/encode_decode/encode_key2text.c
@@ -633,8 +633,8 @@
 {
     const RSA *rsa = key;
     const char *type_label = "RSA key";
-    const char *modulus_label;
-    const char *exponent_label;
+    const char *modulus_label = NULL;
+    const char *exponent_label = NULL;
     const BIGNUM *rsa_d = NULL, *rsa_n = NULL, *rsa_e = NULL;
     STACK_OF(BIGNUM_const) *factors = NULL;
     STACK_OF(BIGNUM_const) *exps = NULL;


Fix building with profiling enabled

Fix building with profiling enabled

There was an #ifdef'd section of code for profiling that was using the
wrong variable name so it would not build.

Reviewed-by: Emmanuele Bassi <049ee2061f71220e5aaf33f5be422fc2a2b06a44@linux.intel.com>

--- clutter/clutter-main.c
+++ clutter/clutter-main.c
@@ -3737,7 +3737,7 @@

 #ifdef CLUTTER_ENABLE_PROFILE
   if (_clutter_uprof_context != NULL)
-    uprof_context_vtrace_message (_clutter_uprof_context, format, args);
+    uprof_context_vtrace_message (_clutter_uprof_context, format, var_args);
 #endif

   g_free (fmt);


The uma_zone data structure defines the size of its uz_cpu[] array as 1,
but then sizes the containing data structure at run-time to make room
for per-cpu cache data.  Modify libmemstat to separately allocate a
buffer to hold per-cpu cache data, sized based on the run-time mp_maxid
variable when using libkvm to access UMA data.  This avoids reading
invalid cache data from beyond the end of the uma_zone data structure
on the stack, which can result in invalid statistics and/or reads from
invalid kernel addresses.

Foot target practice by:	ps
MFC after:			3 days

--- lib/libmemstat/memstat_uma.c
+++ lib/libmemstat/memstat_uma.c
@@ -40,6 +40,7 @@
 #include <errno.h>
 #include <kvm.h>
 #include <nlist.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -306,7 +307,7 @@
 	LIST_HEAD(, uma_keg) uma_kegs;
 	struct memory_type *mtp;
 	struct uma_bucket *ubp, ub;
-	struct uma_cache *ucp;
+	struct uma_cache *ucp, *ucp_array;
 	struct uma_zone *uzp, uz;
 	struct uma_keg *kzp, kz;
 	int hint_dontsearch, i, mp_maxid, ret;
@@ -340,10 +341,16 @@
 		list->mtl_error = ret;
 		return (-1);
 	}
+	ucp_array = malloc(sizeof(struct uma_cache) * (mp_maxid + 1));
+	if (ucp_array == NULL) {
+		list->mtl_error = MEMSTAT_ERROR_NOMEMORY;
+		return (-1);
+	}
 	for (kzp = LIST_FIRST(&uma_kegs); kzp != NULL; kzp =
 	    LIST_NEXT(&kz, uk_link)) {
 		ret = kread(kvm, kzp, &kz, sizeof(kz), 0);
 		if (ret != 0) {
+			free(ucp_array);
 			_memstat_mtl_empty(list);
 			list->mtl_error = ret;
 			return (-1);
@@ -352,13 +359,24 @@
 		    LIST_NEXT(&uz, uz_link)) {
 			ret = kread(kvm, uzp, &uz, sizeof(uz), 0);
 			if (ret != 0) {
+				free(ucp_array);
 				_memstat_mtl_empty(list);
 				list->mtl_error = ret;
 				return (-1);
 			}
+			ret = kread(kvm, uzp, ucp_array,
+			    sizeof(struct uma_cache) * (mp_maxid + 1),
+			    offsetof(struct uma_zone, uz_cpu[0]));
+			if (ret != 0) {
+				free(ucp_array);
+				_memstat_mtl_empty(list);
+				list->mtl_error = ret;
+				return (-1);
+			}
 			ret = kread_string(kvm, uz.uz_name, name,
 			    MEMTYPE_MAXNAME);
 			if (ret != 0) {
+				free(ucp_array);
 				_memstat_mtl_empty(list);
 				list->mtl_error = ret;
 				return (-1);
@@ -372,6 +390,7 @@
 				mtp = _memstat_mt_allocate(list, ALLOCATOR_UMA,
 				    name);
 			if (mtp == NULL) {
+				free(ucp_array);
 				_memstat_mtl_empty(list);
 				list->mtl_error = MEMSTAT_ERROR_NOMEMORY;
 				return (-1);
@@ -388,7 +407,7 @@
 			for (i = 0; i < mp_maxid + 1; i++) {
 				if ((all_cpus & (1 << i)) == 0)
 					continue;
-				ucp = &uz.uz_cpu[i];
+				ucp = &ucp_array[i];
 				mtp->mt_numallocs += ucp->uc_allocs;
 				mtp->mt_numfrees += ucp->uc_frees;

@@ -396,6 +415,7 @@
 					ret = kread(kvm, ucp->uc_allocbucket,
 					    &ub, sizeof(ub), 0);
 					if (ret != 0) {
+						free(ucp_array);
 						_memstat_mtl_empty(list);
 						list->mtl_error = ret;
 						return (-1);
@@ -406,6 +426,7 @@
 					ret = kread(kvm, ucp->uc_freebucket,
 					    &ub, sizeof(ub), 0);
 					if (ret != 0) {
+						free(ucp_array);
 						_memstat_mtl_empty(list);
 						list->mtl_error = ret;
 						return (-1);
@@ -439,5 +460,6 @@
 			mtp->mt_free += mtp->mt_zonefree;
 		}
 	}
+	free(ucp_array);
 	return (0);
 }


Annotate clutter_threads_add_repaint_func_full()

--- clutter/clutter-main.h
+++ clutter/clutter-main.h
@@ -122,6 +122,7 @@
 guint                   clutter_threads_add_repaint_func        (GSourceFunc    func,
                                                                  gpointer       data,
                                                                  GDestroyNotify notify);
+CLUTTER_AVAILABLE_IN_1_10
 guint                   clutter_threads_add_repaint_func_full   (ClutterRepaintFlags flags,
                                                                  GSourceFunc    func,
                                                                  gpointer       data,


clutter-text: Fix memory leak

clutter-text: Fix memory leak

--- clutter/clutter-text.c
+++ clutter/clutter-text.c
@@ -425,6 +425,8 @@
                   g_slist_free (attributes);
                 }
               while (pango_attr_iterator_next (iter));
+
+              pango_attr_iterator_destroy (iter);
             }
         }
       else if (priv->markup_attrs != NULL)


Integrate topfish and sfdp into main tree, using GTS for triangulation; remove duplicated code

--- lib/topfish/rescale_layout.c
+++ lib/topfish/rescale_layout.c
@@ -33,11 +33,12 @@
 #include <math.h>
 #include <time.h>
 #include "matrix_ops.h"
-#include "hierarchy.h"
+/* #include "hierarchy.h" */
+#include "delaunay.h"
 #include "memory.h"
 #include "arith.h"

-static double *compute_densities(vtx_data * graph, int n, double *x,
+static double *compute_densities(v_data * graph, int n, double *x,
 				 double *y)
 {
 // compute density of every node by calculating the average edge length in a 2-D layout
@@ -58,7 +59,7 @@
     return densities;
 }

-static double *recompute_densities(vtx_data * graph, int n, double *x,
+static double *recompute_densities(v_data * graph, int n, double *x,
 				   double *densities)
 {
 // compute density of every node by calculating the average edge length in a 1-D layout
@@ -193,7 +194,7 @@
 }

 static void
-rescaleLayout(vtx_data * graph, int n, double *x_coords, double *y_coords,
+rescaleLayout(v_data * graph, int n, double *x_coords, double *y_coords,
 	      int interval, double distortion)
 {
     // Rectlinear distortion - auxilliary function
@@ -253,7 +254,7 @@
     int i;
     double minX, maxX, minY, maxY;
     double aspect_ratio;
-    vtx_data *graph;
+    v_data *graph;
     double scaleX;
     double scale_ratio;

@@ -325,7 +326,7 @@
 #define DIST(x1,y1,x2,y2) (sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)))

 static void
-rescale_layout_polarFocus(vtx_data * graph, int n,
+rescale_layout_polarFocus(v_data * graph, int n,
 	  double *x_coords, double *y_coords,
 	  double x_focus, double y_focus, int interval, double distortion)
 {
@@ -406,7 +407,7 @@
     int i;
     double minX, maxX, minY, maxY;
     double aspect_ratio;
-    vtx_data *graph;
+    v_data *graph;
     double scaleX;
     double scale_ratio;


Remove direct access to _setFirstChild( ) from suppressMonotypyByStealingGrandchildren( )

--- otc/tree_operations.h
+++ otc/tree_operations.h
@@ -745,44 +745,17 @@
     assert(monotypic_child->getNextSib() == nullptr);
     LOG(DEBUG) << "suppressing " << (nd->hasOttId() ? nd->getOttId() : long(nd))
                << " by stealing children from " << getDesignator(*monotypic_child) ;
-    auto entryChild = monotypic_child->getPrevSib();
-    assert(entryChild == nullptr);
-    auto exitChild = monotypic_child->getNextSib();
-    assert(exitChild == nullptr);
-    typename T::node_type * f = monotypic_child->getFirstChild();
-    typename T::node_type * c = nullptr;
-    auto citf = iter_child(*monotypic_child);
-    const auto cite = citf.end();
-    for (auto cit = citf.begin(); cit != cite; ++cit) {
-        c = *cit;
-        c->_setParent(nd);
-    }
-    if (entryChild != nullptr) {
-        assert(entryChild->getNextSib() == monotypic_child);
-        if (f == nullptr) {
-            entryChild->_setNextSib(exitChild);
-        } else {
-            entryChild->_setNextSib(f);
-            assert(c != nullptr);
-            c->_setNextSib(exitChild);
-        }
-    } else {
-        if (f != nullptr) {
-            nd->_setFirstChild(f);
-            assert(c != nullptr);
-            c->_setNextSib(exitChild);
-        } else {
-            nd->_setFirstChild(exitChild);
-        }
-    }
-    if (entryChild != nullptr || exitChild != nullptr) {
-        // nd has a different set of descendants than monotypic_child.
-        //  nd was not actually monotypic
-        assert(false);
-        throw OTCError("asserts disabled, but false");
-    } else {
-        replaceMappingsToNodeWithAlias<T>(monotypic_child, nd, tree);
-    }
+
+    while(monotypic_child->hasChildren())
+    {
+        auto x = monotypic_child->getFirstChild();
+        x->_detachThisNode();
+        nd->addChild(x);
+    }
+    monotypic_child->_detachThisNode();
+
+    replaceMappingsToNodeWithAlias<T>(monotypic_child, nd, tree);
+    //    delete monotypic_child;
 }

 template<typename T>


net/l2util: fix addr conversion for BLE

net/l2util: fix addr conversion for BLE

--- sys/net/link_layer/l2util/l2util.c
+++ sys/net/link_layer/l2util/l2util.c
@@ -52,7 +52,8 @@
             else {
                 return -EINVAL;
             }
-#endif  /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) */
+#endif  /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) \
+           defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF) */
 #if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_XBEE)
         case NETDEV_TYPE_IEEE802154:
             switch (addr_len) {
@@ -118,6 +119,11 @@
                 return -EINVAL;
             }
 #endif  /* defined(MODULE_CC110X) || defined(MODULE_NRFMIN) */
+#if defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF)
+        case NETDEV_TYPE_BLE:
+            /* for BLE we don't flip the universal/local flag... */
+            return l2util_eui64_from_addr(dev_type, addr, addr_len, iid);
+#endif  /* defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF) */
         default: {
             int res = l2util_eui64_from_addr(dev_type, addr, addr_len, iid);
             if (res == sizeof(eui64_t)) {
@@ -132,16 +138,22 @@
 int l2util_ipv6_iid_to_addr(int dev_type, const eui64_t *iid, uint8_t *addr)
 {
     switch (dev_type) {
-#if defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) || \
-    defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF)
+#if defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW)
         case NETDEV_TYPE_ETHERNET:
         case NETDEV_TYPE_ESP_NOW:
-        case NETDEV_TYPE_BLE:
             eui48_from_ipv6_iid((eui48_t *)addr, iid);
             return sizeof(eui48_t);
-#endif  /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) || \
-         * defined(MODULE_NORDIC_SOFTDEVICE_BLE) || \
-         * defined(MODULE_NIMBLE_NETIF) */
+#endif  /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) */
+#if defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF)
+        case NETDEV_TYPE_BLE:
+            addr[0] = iid->uint8[0];
+            addr[1] = iid->uint8[1];
+            addr[2] = iid->uint8[2];
+            addr[3] = iid->uint8[5];
+            addr[4] = iid->uint8[6];
+            addr[5] = iid->uint8[7];
+            return sizeof(eui48_t);
+#endif  /* defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF) */
 #if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_XBEE)
         case NETDEV_TYPE_IEEE802154:
             /* assume address was based on EUI-64
@@ -195,7 +207,8 @@
             else {
                 return -EINVAL;
             }
-#endif  /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) */
+#endif  /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) \
+           defined(MODULE_NORDIC_SOFTDEVICE_BLE) || defined(MODULE_NIMBLE_NETIF) */
 #ifdef MODULE_NRFMIN
         case NETDEV_TYPE_NRFMIN:
             (void)opt;


Whitespace fixes

Whitespace fixes

--- clutter/clutter-text.c
+++ clutter/clutter-text.c
@@ -38,8 +38,7 @@
  * #ClutterText is available since Clutter 1.0
  */

-/* TODO: undo/redo hooks?
- */
+/* TODO: undo/redo hooks? */

 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -67,7 +66,7 @@
  * be regenerated at a different width to get the height for the
  * actual allocated width
  */
-#define N_CACHED_LAYOUTS 3
+#define N_CACHED_LAYOUTS        3

 #define CLUTTER_TEXT_GET_PRIVATE(obj)   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_TEXT, ClutterTextPrivate))

@@ -866,7 +865,6 @@
                 }

               g_free (ranges);
-
             }
         }
     }


[text] Queue a redraw when the selection is cleared

If you select all the text in a ClutterText, there is an invisible
cursor position either at the beginning or end. If it's at the beginning,
the bug is that left arrow won't clear the selection. If it's at the end,
the bug is that the right arrow won't.

Here are the ways to reproduce it:

a. Ctrl-A selects all and moves the hidden cursor position to the left.
b. For single line: End, Shift-Home does the same.
c. Or manually moving to the end and doing Shift-Left Arrow to the
   beginning.

These all put it in the state where right arrow will properly clear
selection and move to cursor position 1, but left arrow fails to clear
the selection.

For b and c above, the opposite will give you the end case where right
arrow doesn't work.

Anyway, it turns out clear_selection is getting called, it just doesn't
show up because it's not doing a queue_redraw. So the attached patch
seems to fix things.

Signed-off-by: Emmanuele Bassi <049ee2061f71220e5aaf33f5be422fc2a2b06a44@linux.intel.com>

--- clutter/clutter-text.c
+++ clutter/clutter-text.c
@@ -235,7 +235,11 @@
 {
   ClutterTextPrivate *priv = self->priv;

-  priv->selection_bound = priv->position;
+  if (priv->selection_bound != priv->position)
+    {
+      priv->selection_bound = priv->position;
+      clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
+    }
 }

 static PangoLayout *


ixgbe: link up and down

ixgbe: link up and down

It is implemented by enabling or disabling TX laser.

Signed-off-by: Ouyang Changchun <593bf1f161e79772915ea885e47cf0e95f4498c0@intel.com>
Tested-by: Waterman Cao <8e01f67a90086248c4e0cdea3a53a7cacd141398@intel.com>
Acked by: Ivan Boule <ivan.boule@6wind.com>

--- lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -98,6 +98,8 @@
 static int  ixgbe_dev_configure(struct rte_eth_dev *dev);
 static int  ixgbe_dev_start(struct rte_eth_dev *dev);
 static void ixgbe_dev_stop(struct rte_eth_dev *dev);
+static int  ixgbe_dev_set_link_up(struct rte_eth_dev *dev);
+static int  ixgbe_dev_set_link_down(struct rte_eth_dev *dev);
 static void ixgbe_dev_close(struct rte_eth_dev *dev);
 static void ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
 static void ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
@@ -252,6 +254,8 @@
 	.dev_configure        = ixgbe_dev_configure,
 	.dev_start            = ixgbe_dev_start,
 	.dev_stop             = ixgbe_dev_stop,
+	.dev_set_link_up    = ixgbe_dev_set_link_up,
+	.dev_set_link_down  = ixgbe_dev_set_link_down,
 	.dev_close            = ixgbe_dev_close,
 	.promiscuous_enable   = ixgbe_dev_promiscuous_enable,
 	.promiscuous_disable  = ixgbe_dev_promiscuous_disable,
@@ -1525,6 +1529,65 @@
 }

 /*
+ * Set device link up: enable tx laser.
+ */
+static int
+ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw =
+		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if (hw->mac.type == ixgbe_mac_82599EB) {
+#ifdef RTE_NIC_BYPASS
+		if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
+			/* Not suported in bypass mode */
+			PMD_INIT_LOG(ERR,
+				"\nSet link up is not supported "
+				"by device id 0x%x\n",
+				hw->device_id);
+			return -ENOTSUP;
+		}
+#endif
+		/* Turn on the laser */
+		ixgbe_enable_tx_laser(hw);
+		return 0;
+	}
+
+	PMD_INIT_LOG(ERR, "\nSet link up is not supported by device id 0x%x\n",
+		hw->device_id);
+	return -ENOTSUP;
+}
+
+/*
+ * Set device link down: disable tx laser.
+ */
+static int
+ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw =
+		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if (hw->mac.type == ixgbe_mac_82599EB) {
+#ifdef RTE_NIC_BYPASS
+		if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
+			/* Not suported in bypass mode */
+			PMD_INIT_LOG(ERR,
+				"\nSet link down is not supported "
+				"by device id 0x%x\n",
+				 hw->device_id);
+			return -ENOTSUP;
+		}
+#endif
+		/* Turn off the laser */
+		ixgbe_disable_tx_laser(hw);
+		return 0;
+	}
+
+	PMD_INIT_LOG(ERR,
+		"\nSet link down is not supported by device id 0x%x\n",
+		 hw->device_id);
+	return -ENOTSUP;
+}
+
+/*
  * Reest and stop device.
  */
 static void


util: fix fallback SUB_OVERFLOW() macro

util: fix fallback SUB_OVERFLOW() macro

This only applies when the compiler doesn't provide the
__builtin_sub_overflow() function (before GCC 5.1).

Fixes problem due to integer promotion in overflow macros when result is
a signed type and the subtrahend is an unsigned type with a low value.

SUB_OVERFLOW() still doesn't handle all combinations of signed and
unsigned types in the parameters.

Fixes: ce0d8e2da340 ("util: add macros for arithmetics with overflow checking")
Acked-by: Jerome Forissier <ced78d268b4c9a0a20a59a9feeebd2ad90da03d3@linaro.org>
Signed-off-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

--- lib/libutils/ext/include/compiler.h
+++ lib/libutils/ext/include/compiler.h
@@ -131,11 +131,22 @@
 #define __INTOF_SUB(c, a, b) (__extension__({ \
 	typeof(a) __intofs_a = a; \
 	typeof(b) __intofs_b = b; \
+	int __infos_b_signed = !!__INTOF_MIN(typeof(b)); \
+	int __infos_c_signed = !!__INTOF_MIN(typeof(c)); \
 	\
 	__intofs_b < 1 ? \
 		((__INTOF_MAX(typeof(c)) + __intofs_b >= __intofs_a) ? \
 			__INTOF_ASSIGN((c), __intofs_a - __intofs_b) : 1) : \
-		((__INTOF_MIN(typeof(c)) + __intofs_b <= __intofs_a) ? \
+		/* \
+		 * First deal with special case where c is signed and b is \
+		 * unsigned, and __INTOF_MIN(typeof(c)) + __intofs_b would \
+		 * have been a negative number if the expression wasn't \
+		 * promoted to an unsigned type. \
+		 */ \
+		(((__infos_c_signed && !__infos_b_signed && \
+			  ((uintmax_t)__INTOF_MAX_SIGNED(typeof(c)) >= \
+			   (uintmax_t)__intofs_b)) || \
+		(__INTOF_MIN(typeof(c)) + __intofs_b <= __intofs_a)) ? \
 			__INTOF_ASSIGN((c), __intofs_a - __intofs_b) : 1); \
 }))


This should be the last piece needed to make constructors work (using a native gcc toolchain).  The gcc wrapper still needs some touchups, but we seem to be _there_.  Also some touchups to try and shrink uclinux binary sized by stubbing out unneeded stuff.  -Erik

--- libc/misc/internals/__uClibc_main.c
+++ libc/misc/internals/__uClibc_main.c
@@ -1,5 +1,6 @@
 /*
  * Manuel Novoa III           Feb 2001
+ * Erik Anderseni             Mar 2002
  *
  * __uClibc_main is the routine to be called by all the arch-specific
  * versions of crt0.S in uClibc.
@@ -14,30 +15,25 @@
 #include <stdlib.h>
 #include <unistd.h>

+#if !defined HAVE_ELF || !defined __UCLIBC_HAS_MMU__
+# undef weak_function
+# undef weak_const_function
+# define weak_function
+# define weak_const_function
+# define __USE_WEAK_ALIASES
+#endif

 /*
  * Prototypes.
  */
-
 extern int main(int argc, char **argv, char **envp);
-
-void __uClibc_main(int argc, char **argv, char **envp)
-	 __attribute__ ((__noreturn__));
-
-
-
-#ifdef HAVE_ELF
-weak_alias(__environ, environ);
+extern int weak_function atexit(void (*function)(void));
+extern void weak_function _init(void);
+extern void weak_function _fini(void);
 extern void weak_function _stdio_init(void);
 extern void weak_function _stdio_term(void);
-extern int *weak_const_function __errno_location (void);
-extern int *weak_const_function __h_errno_location (void);
-#else
-extern void _stdio_init(void);
-extern void _stdio_term(void);
-extern int *__errno_location (void);
-extern int *__h_errno_location (void);
-#endif
+extern int *weak_const_function __errno_location(void);
+extern int *weak_const_function __h_errno_location(void);

 /*
  * Declare the __environ global variable and create a weak alias environ.
@@ -46,13 +42,14 @@
  */

 char **__environ = 0;
+weak_alias(__environ, environ);

 /*
  * Now for our main routine.
  */
-
-void __uClibc_main(int argc, char **argv, char **envp)
+void __attribute__ ((__noreturn__))
+__uClibc_main(int argc, char **argv, char **envp)
 {
 	/*
 	 * Initialize the global variable __environ.
@@ -64,25 +61,31 @@
 	 * where the standard file descriptors are not opened.  We have
 	 * to do this only for statically linked applications since
 	 * otherwise the dynamic loader did the work already.  */
-	if (__builtin_expect (__libc_enable_secure, 0))
+	if (unlikely (__libc_enable_secure))
 	    __libc_check_standard_fds ();
 #endif
 	/*
 	 * Initialize stdio here.  In the static library case, this will
 	 * be bypassed if not needed because of the weak alias above.
 	 */
-	if (_stdio_init)
+	if (likely(_stdio_init))
 	  _stdio_init();
+
+	/* Arrange for dtors to run at exit.  */
+	atexit (&_fini);
+	/* Run all ctors now.  */
+	_init();

 	/*
 	 * Note: It is possible that any initialization done above could
 	 * have resulted in errno being set nonzero, so set it to 0 before
 	 * we call main.
 	 */
-	if (__errno_location)
+	if (likely(__errno_location))
 	    *(__errno_location()) = 0;
+
 	/* Set h_errno to 0 as well */
-	if (__h_errno_location)
+	if (likely(__h_errno_location))
 	    *(__h_errno_location()) = 0;

 	/*
@@ -91,7 +94,7 @@
 	exit(main(argc, argv, envp));
 }

-#ifndef HAVE_ELF
+#ifdef __USE_WEAK_ALIASES
 /*
  * Define an empty function and use it as a weak alias for the stdio
  * initialization routine.  That way we don't pull in all the stdio
@@ -102,11 +105,14 @@
  */

 weak_alias(__environ, environ);
-#if 0
 void __uClibc_empty_func(void)
 {
 }
+weak_alias(__uClibc_empty_func, atexit);
+weak_alias(__uClibc_empty_func, _init);
+weak_alias(__uClibc_empty_func, _fini);
+weak_alias(__uClibc_empty_func, __errno_location);
+weak_alias(__uClibc_empty_func, __h_errno_location);
 weak_alias(__uClibc_empty_func, _stdio_init);
 weak_alias(__uClibc_empty_func, _stdio_term);
-#endif
 #endif


Do not grovel about in the ELF header for the page size when running on uClinux, which at runtime uses the FLAT file format.

--- libc/misc/internals/__uClibc_main.c
+++ libc/misc/internals/__uClibc_main.c
@@ -123,10 +123,10 @@
 __uClibc_start_main(int argc, char **argv, char **envp,
 	void (*app_init)(void), void (*app_fini)(void))
 {
+    /* Pull stuff from the ELF header when possible */
+#ifdef __ARCH_HAS_MMU__
     unsigned long *aux_dat;
     Elf32_auxv_t auxvt[AT_EGID + 1];
-
-    /* Pull stuff from the ELF header when possible */
     aux_dat = (unsigned long*)envp;
     while (*aux_dat) {
 	aux_dat++;
@@ -140,6 +140,9 @@
 	aux_dat += 2;
     }
     _dl_pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : 4096;
+#else
+    _dl_pagesize = 4096;
+#endif

     /* If we are dynamically linked the shared lib loader already
      * did this for us.  But if we are statically linked, we need


i386/sigaction.c: slightly more readable form of [rt_]sigreturn definitions

No code changes

Signed-off-by: Denys Vlasenko <50fbbd36fe0f9c8261d4a3c762c8c29ffb35e48f@redhat.com>

--- libc/sysdeps/linux/i386/sigaction.c
+++ libc/sysdeps/linux/i386/sigaction.c
@@ -109,16 +109,16 @@
    appropriate GDB maintainer.  */

 #define RESTORE(name, syscall) RESTORE2(name, syscall)
-#define RESTORE2(name, syscall) \
+
+#ifdef __NR_rt_sigaction
+/* The return code for realtime-signals.  */
+# define RESTORE2(name, syscall) \
 __asm__	(						\
 	".text\n"					\
 	"__" #name ":\n"				\
 	"	movl	$" #syscall ", %eax\n"		\
 	"	int	$0x80\n"			\
 );
-
-#ifdef __NR_rt_sigaction
-/* The return code for realtime-signals.  */
 RESTORE(restore_rt, __NR_rt_sigreturn)
 #endif

@@ -133,6 +133,5 @@
 	"	movl	$" #syscall ", %eax\n"		\
 	"	int	$0x80\n"			\
 );
-
 RESTORE(restore, __NR_sigreturn)
 #endif


Don't allow the CAN_CREATE_ACCOUNT permission when server has no private key

In this situation, the server does not support creating accounts, because
it cannot generate client certificates.

--- libinfinity/server/infd-directory.c
+++ libinfinity/server/infd-directory.c
@@ -209,6 +209,7 @@
   guint node_counter;
   GHashTable* nodes; /* Mapping from id to node */
   InfdDirectoryNode* root;
+  InfAclSheetSet* orig_root_acl; /* in case root->acl is altered */

   GSList* sync_ins;
   GSList* subscription_requests;
@@ -1063,6 +1064,7 @@
 {
   InfdDirectoryPrivate* priv;
   InfBrowserIter iter;
+  InfAclSheetSet* acl;
   gchar* path;
   GError* error;

@@ -1073,11 +1075,17 @@
   {
     infd_directory_node_get_path(node, &path, NULL);
     error = NULL;
+
+    /* In case this is the root node, store the original non-altered ACL. This
+     * allows to keep certain permissions at the original value, even if they
+     * are disabled in the current configuration. */
+    acl = node->acl;
+    if(node == priv->root) acl = priv->orig_root_acl;

     /* TODO: Don't write sheets for transient accounts. It does not make much
      * difference, because the transient user account is not stored, so the
      * sheet will be rejected anyway when it is read from disk next time. */
-    infd_storage_write_acl(priv->storage, path, node->acl, &error);
+    infd_storage_write_acl(priv->storage, path, acl, &error);

     if(error != NULL)
     {
@@ -1113,6 +1121,7 @@

   InfAclSheetSet* sheet_set;
   InfAclSheet* default_sheet;
+  InfAclSheet* sheet;
   InfAclMask default_mask;
   InfAclMask tmp_mask;
   GError* error;
@@ -1121,7 +1130,7 @@

   error = NULL;

-  /* Remove existing user accounts, we are going to lead new ones
+  /* Remove existing user accounts, we are going to load new ones
    * from storage. */
   /* TODO: Emit an account-removed signal,
    * and send it to account_list_connections */
@@ -1253,6 +1262,10 @@
   default_account = g_hash_table_lookup(priv->accounts, "default");
   g_assert(default_account != NULL);

+  /* Will be reset below: */
+  if(priv->orig_root_acl != NULL)
+    inf_acl_sheet_set_free(priv->orig_root_acl);
+
   if(error != NULL)
   {
     g_assert(sheet_set == NULL);
@@ -1286,6 +1299,8 @@
       sheet_set
     );

+    priv->orig_root_acl = inf_acl_sheet_set_copy(priv->root->acl);
+
     infd_directory_announce_acl_sheets(
       directory,
       priv->root,
@@ -1308,6 +1323,32 @@
     inf_acl_mask_or(&default_sheet->perms, &tmp_mask, &default_sheet->perms);

     default_sheet->mask = INF_ACL_MASK_ALL;
+
+    /* Set original ACL as read from disk */
+    priv->orig_root_acl = inf_acl_sheet_set_copy(priv->root->acl);
+    priv->orig_root_acl = inf_acl_sheet_set_merge_sheets(
+      priv->orig_root_acl,
+      sheet_set
+    );
+
+    /* For the actual permissions to use, remove the CAN_ADD_ACCOUNT
+     * permission if we do not have a certificate set, because in that case
+     * we cannot create new accounts. */
+    if(priv->private_key == NULL || priv->certificate == NULL)
+    {
+      g_assert(sheet_set->own_sheets != NULL);
+      for(i = 0; i < sheet_set->n_sheets; ++i)
+      {
+        sheet = &sheet_set->own_sheets[i];
+        if(inf_acl_mask_has(&sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT))
+        {
+          /* Remove the INF_ACL_CAN_CREATE_ACCOUNT flag */
+          inf_acl_mask_set1(&tmp_mask, INF_ACL_CAN_CREATE_ACCOUNT);
+          inf_acl_mask_neg(&tmp_mask, &tmp_mask);
+          inf_acl_mask_and(&sheet->perms, &tmp_mask, &sheet->perms);
+        }
+      }
+    }

     /* Note that the sheets array already includes sheets that clear the
      * existing ACL. */
@@ -6069,6 +6110,8 @@
   InfXmlConnection* conn;
   InfdDirectoryConnectionInfo* info;
   xmlNodePtr reply_xml;
+  guint i;
+  const InfAclSheet* sheet;

   priv = INFD_DIRECTORY_PRIVATE(directory);

@@ -6125,6 +6168,30 @@
     );

     return FALSE;
+  }
+
+  /* Make sure the CAN_CREATE_ACCOUNT permission cannot be activated when
+   * we cannot support it. */
+  if(node == priv->root &&
+     (priv->private_key == NULL || priv->certificate == NULL))
+  {
+    for(i = 0; i < sheet_set->n_sheets; ++i)
+    {
+      sheet = &sheet_set->sheets[i];
+      if(inf_acl_mask_has(&sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT) &&
+         inf_acl_mask_has(&sheet->perms, INF_ACL_CAN_CREATE_ACCOUNT))
+      {
+        g_set_error(
+          error,
+          inf_directory_error_quark(),
+          INF_DIRECTORY_ERROR_OPERATION_UNSUPPORTED,
+          "%s",
+          _("This server does not support account creation")
+        );
+
+        return FALSE;
+      }
+    }
   }

   if(!infd_directory_make_seq(directory, connection, xml, &seq, error))
@@ -6152,6 +6219,13 @@
   );

   node->acl = inf_acl_sheet_set_merge_sheets(node->acl, sheet_set);
+  if(node == priv->root)
+  {
+    priv->orig_root_acl = inf_acl_sheet_set_merge_sheets(
+      priv->orig_root_acl,
+      sheet_set
+    );
+  }

   /* Apply the effect of the new ACL */
   default_account = g_hash_table_lookup(priv->accounts, "default");
@@ -7081,6 +7155,7 @@
     FALSE
   );

+  priv->orig_root_acl = NULL;
   priv->sync_ins = NULL;
   priv->subscription_requests = NULL;

@@ -7215,8 +7290,13 @@

   infd_directory_set_storage(directory, NULL);

+  g_assert(priv->root != NULL);
   infd_directory_node_free(directory, priv->root);
   priv->root = NULL;
+
+  g_assert(priv->orig_root_acl != NULL);
+  inf_acl_sheet_set_free(priv->orig_root_acl);
+  priv->orig_root_acl = NULL;

   g_hash_table_destroy(priv->nodes);
   priv->nodes = NULL;
@@ -8994,8 +9074,18 @@
 {
   InfdDirectoryPrivate* priv;

+  guint i;
+  const InfAclAccount* account;
+  const InfAclSheet* orig_sheet;
+  const InfAclSheet* sheet;
+  InfAclSheetSet* merge_sheets;
+  InfAclSheet* merge_sheet;
+  InfAclMask neg_mask;
+
   g_return_if_fail(INFD_IS_DIRECTORY(directory));
   priv = INFD_DIRECTORY_PRIVATE(directory);
+
+  /* TODO: assert that the key belongs to the certificate */

   if(priv->certificate != NULL)
     inf_certificate_chain_unref(priv->certificate);
@@ -9008,6 +9098,82 @@

   g_object_notify(G_OBJECT(directory), "private-key");
   g_object_notify(G_OBJECT(directory), "certificate");
+
+  merge_sheets = inf_acl_sheet_set_new();
+
+  if(key != NULL && cert != NULL)
+  {
+    /* We have a valid key and certificate set. If the
+     * INF_ACL_CAN_CREATE_ACCOUNT permission was originally set on the root
+     * node, then enable it now. */
+    for(i = 0; i < priv->orig_root_acl->n_sheets; ++i)
+    {
+      orig_sheet = &priv->orig_root_acl->sheets[i];
+      if(inf_acl_mask_has(&orig_sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT) &&
+         inf_acl_mask_has(&orig_sheet->perms, INF_ACL_CAN_CREATE_ACCOUNT))
+      {
+        account = orig_sheet->account;
+        sheet = inf_acl_sheet_set_find_const_sheet(priv->root->acl, account);
+
+        if(sheet == NULL ||
+           (inf_acl_mask_has(&sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT) &&
+            !inf_acl_mask_has(&sheet->perms, INF_ACL_CAN_CREATE_ACCOUNT)))
+        {
+          /* Add a sheet which adds the INF_ACL_CAN_CREATE_ACCOUNT for this
+           * account to the merge sheetset. */
+          merge_sheet = inf_acl_sheet_set_add_sheet(merge_sheets, account);
+          merge_sheet->mask = sheet->mask;
+          merge_sheet->perms = sheet->perms;
+
+          inf_acl_mask_or1(&merge_sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT);
+          inf_acl_mask_or1(&merge_sheet->perms, INF_ACL_CAN_CREATE_ACCOUNT);
+        }
+      }
+    }
+  }
+  else
+  {
+    /* The key and certificate were removed, so revoke the
+     * INF_ACL_CAN_CREATE_ACCOUNT permission, since we no longer can
+     * generate certificates for the new account. */
+    for(i = 0; i < priv->root->acl->n_sheets; ++i)
+    {
+      sheet = &priv->root->acl->sheets[i];
+      if(inf_acl_mask_has(&sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT) &&
+         inf_acl_mask_has(&sheet->perms, INF_ACL_CAN_CREATE_ACCOUNT))
+      {
+        /* Add a sheet which removes the INF_ACL_CAN_CREATE_ACCOUNT for this
+         * account to the merge sheetset. */
+        merge_sheet = inf_acl_sheet_set_add_sheet(merge_sheets, account);
+
+        merge_sheet->mask = sheet->mask;
+        inf_acl_mask_or1(&merge_sheet->mask, INF_ACL_CAN_CREATE_ACCOUNT);
+
+        inf_acl_mask_set1(&neg_mask, INF_ACL_CAN_CREATE_ACCOUNT);
+        inf_acl_mask_neg(&neg_mask, &neg_mask);
+        inf_acl_mask_and(&sheet->perms, &neg_mask, &merge_sheet->perms);
+      }
+    }
+  }
+
+  if(merge_sheets->n_sheets > 0)
+  {
+    priv->root->acl =
+      inf_acl_sheet_set_merge_sheets(priv->root->acl, merge_sheets);
+
+    /* Note that we do not need to call enforce the new ACLs here, since
+     * we only change the INF_ACL_CAN_CREATE_ACCOUNT permission. */
+
+    infd_directory_announce_acl_sheets(
+      directory,
+      priv->root,
+      NULL,
+      merge_sheets,
+      NULL
+    );
+  }
+
+  inf_acl_sheet_set_free(merge_sheets);
 }

 /**


libipt: use sysconf(_SC_PAGESIZE) instead of PAGE_SIZE

This fixes #11.

Change-Id: I45a62dbb10ea84e5e408532ff996b2028d85e93b
Signed-off-by: Markus Metzger <5f675b2b36595f90898e014b548ff7d9bbff2ab7@intel.com>

--- libipt/src/posix/pt_section_posix.c
+++ libipt/src/posix/pt_section_posix.c
@@ -39,7 +39,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
-#include <sys/user.h>
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -111,7 +110,7 @@
 	offset = section->offset;
 	size = section->size;

-	adjustment = offset % PAGE_SIZE;
+	adjustment = offset % sysconf(_SC_PAGESIZE);

 	offset -= adjustment;
 	size += adjustment;


pipeline_gl: use glBindBufferRange() instead of glBindBufferBase()

This will reduce the diff of the next commit adding the ability to bind
a specific buffer range.

--- libnodegl/backends/gl/pipeline_gl.c
+++ libnodegl/backends/gl/pipeline_gl.c
@@ -311,7 +311,7 @@
         const struct buffer_binding *buffer_binding = &bindings[i];
         const struct buffer *buffer = buffer_binding->buffer;
         const struct buffer_gl *buffer_gl = (const struct buffer_gl *)buffer;
-        ngli_glBindBufferBase(gl, buffer_binding->type, buffer_binding->desc.binding, buffer_gl->id);
+        ngli_glBindBufferRange(gl, buffer_binding->type, buffer_binding->desc.binding, buffer_gl->id, 0, buffer->size);
     }
 }


store: trivial: Fix a typo in comment

store: trivial: Fix a typo in comment

--- libappstream-glib/as-store.c
+++ libappstream-glib/as-store.c
@@ -3658,7 +3658,7 @@
 		}
 	}

-	/* check there exists only onle application with a specific name */
+	/* check there exists only one application with a specific name */
 	hash_names = g_hash_table_new_full (g_str_hash, g_str_equal,
 					    g_free, (GDestroyNotify) g_object_unref);


libbpf-tools: fix fentry_try_attach bug

libbpf-tools: fix fentry_try_attach bug

the bpf verifier would complain on program exit without initing R0 but
the buggy implementation makes up one BPF_EXIT instruction only, which
would be rejected by the verifier, and what's worse is that it does not
log any err about the try-to-load failure, which makes all tools use this
api would silently fall back to kprobe unexpectedly.

this patch fixs it and also prints verbose message about the result of the try.

Signed-off-by: Ze Gao <569a7a53eebdfc9dea8a0eb132ce686cb46046cc@outlook.com>

--- libbpf-tools/trace_helpers.c
+++ libbpf-tools/trace_helpers.c
@@ -993,16 +993,25 @@

 static bool fentry_try_attach(int id)
 {
-	struct bpf_insn insns[] = { { .code = BPF_JMP | BPF_EXIT } };
-	LIBBPF_OPTS(bpf_prog_load_opts, opts);
 	int prog_fd, attach_fd;
-
-	opts.expected_attach_type = BPF_TRACE_FENTRY;
-	opts.attach_btf_id = id,
-
-	prog_fd = bpf_prog_load(BPF_PROG_TYPE_TRACING, "test", NULL, insns, 1, &opts);
-	if (prog_fd < 0)
+	char error[4096];
+	struct bpf_insn insns[] = {
+		{ .code = BPF_ALU64 | BPF_MOV | BPF_K, .dst_reg = BPF_REG_0, .imm = 0 },
+		{ .code = BPF_JMP | BPF_EXIT },
+	};
+	LIBBPF_OPTS(bpf_prog_load_opts, opts,
+			.expected_attach_type = BPF_TRACE_FENTRY,
+			.attach_btf_id = id,
+			.log_buf = error,
+			.log_size = sizeof(error),
+	);
+
+	prog_fd = bpf_prog_load(BPF_PROG_TYPE_TRACING, "test", "GPL", insns,
+			sizeof(insns) / sizeof(struct bpf_insn), &opts);
+	if (prog_fd < 0) {
+		fprintf(stderr, "failed to try attaching to fentry: %s\n", error);
 		return false;
+	}

 	attach_fd = bpf_raw_tracepoint_open(NULL, prog_fd);
 	if (attach_fd >= 0)


fluidsynth: implement channel aftertouch event

--- modules/codec/fluidsynth.c
+++ modules/codec/fluidsynth.c
@@ -191,11 +191,15 @@
         case 0x90:
             fluid_synth_noteon (p_sys->synth, channel, p1, p2);
             break;
+        /*case 0xA0: note aftertouch not implemented */
         case 0xB0:
             fluid_synth_cc (p_sys->synth, channel, p1, p2);
             break;
         case 0xC0:
             fluid_synth_program_change (p_sys->synth, channel, p1);
+            break;
+        case 0xA0:
+            fluid_synth_channel_pressure (p_sys->synth, channel, p1);
             break;
         case 0xE0:
             fluid_synth_pitch_bend (p_sys->synth, channel, (p2 << 7) | p1);


fix arg to dr_destroy_prune_stacks

fix arg to dr_destroy_prune_stacks

--- profiler/dag_recorder.c
+++ profiler/dag_recorder.c
@@ -390,7 +390,7 @@
       dr_free_worker_specific_state_array();
       dr_free_worker_specific_state_list();
       /* destroy prune stacks */
-      dr_destroy_prune_stacks(num_workers);
+      dr_destroy_prune_stacks();
     }
     GS.initialized = 0;
   }


Initial commit

Initial commit

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

--- programming/voidfloat.c
+++ programming/voidfloat.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+int main(){
+	float f = 12.34f;	//float variable
+	void *v;		//void pointer
+
+	v = &f;	//void pointer v storing the address of variable f
+
+	float p = *((float *) v);	//variable p taking the value of f through void pointer v
+
+	printf("%f", p);	//printing the value of f which is now stored in p
+	return 0;
+}


Start adding EC support in gen_key

Start adding EC support in gen_key

--- programs/pkey/gen_key.c
+++ programs/pkey/gen_key.c
@@ -51,12 +51,10 @@
 }
 #else

-#define TYPE_RSA                0
-
 #define FORMAT_PEM              0
 #define FORMAT_DER              1

-#define DFL_TYPE                TYPE_RSA
+#define DFL_TYPE                POLARSSL_PK_RSA
 #define DFL_RSA_KEYSIZE         4096
 #define DFL_FILENAME            "keyfile.key"
 #define DFL_FORMAT              FORMAT_PEM
@@ -109,11 +107,11 @@
 }

 #define USAGE \
-    "\n usage: gen_key param=<>...\n"                    \
+    "\n usage: gen_key param=<>...\n"                   \
     "\n acceptable parameters:\n"                       \
-    "    type=rsa              default: rsa\n"          \
-    "    rsa_keysize=%%d      default: 4096\n"          \
-    "    filename=%%s         default: keyfile.key\n"   \
+    "    type=rsa|ec           default: rsa\n"          \
+    "    rsa_keysize=%%d        default: 4096\n"        \
+    "    filename=%%s           default: keyfile.key\n" \
     "    format=pem|der        default: pem\n"          \
     "\n"

@@ -157,7 +155,9 @@
         if( strcmp( p, "type" ) == 0 )
         {
             if( strcmp( q, "rsa" ) == 0 )
-                opt.type = TYPE_RSA;
+                opt.type = POLARSSL_PK_RSA;
+            if( strcmp( q, "ec" ) == 0 )
+                opt.type = POLARSSL_PK_ECKEY;
             else
                 goto usage;
         }
@@ -200,10 +200,15 @@
     printf( "\n  . Generating the private key ..." );
     fflush( stdout );

+    if( ( ret = pk_init_ctx( &key, pk_info_from_type( opt.type ) ) ) != 0 )
+    {
+        printf( " failed\n  !  pk_init_ctx returned -0x%04x", -ret );
+        goto exit;
+    }
+
 #if defined(POLARSSL_RSA_C) && defined(POLARSSL_GENPRIME)
-    if( opt.type == TYPE_RSA )
-    {
-        pk_init_ctx( &key, pk_info_from_type( POLARSSL_PK_RSA ) );
+    if( opt.type == POLARSSL_PK_RSA )
+    {
         ret = rsa_gen_key( pk_rsa( key ), ctr_drbg_random, &ctr_drbg,
                            opt.rsa_keysize, 65537 );
         if( ret != 0 )
@@ -211,20 +216,32 @@
             printf( " failed\n  !  rsa_gen_key returned -0x%04x", -ret );
             goto exit;
         }
-
-        printf( " ok\n" );
     }
     else
 #endif /* POLARSSL_RSA_C */
-    {
-        printf( " failed\n  !  key type not supported in library" );
+#if defined(POLARSSL_ECP_C)
+    if( opt.type == POLARSSL_PK_ECKEY )
+    {
+        // TODO: allow other curves
+        ret = ecp_gen_key( POLARSSL_ECP_DP_SECP256R1, pk_ec( key ),
+                          ctr_drbg_random, &ctr_drbg );
+        if( ret != 0 )
+        {
+            printf( " failed\n  !  rsa_gen_key returned -0x%04x", -ret );
+            goto exit;
+        }
+    }
+    else
+#endif /* POLARSSL_ECP_C */
+    {
+        printf( " failed\n  !  key type not supported\n" );
         goto exit;
     }

     /*
      * 1.2 Print the key
      */
-    printf( "  . Key information    ...\n" );
+    printf( " ok\n  . Key information:\n" );

 #if defined(POLARSSL_RSA_C)
     if( pk_get_type( &key ) == POLARSSL_PK_RSA )
@@ -245,14 +262,13 @@
     if( pk_get_type( &key ) == POLARSSL_PK_ECKEY )
     {
         ecp_keypair *ecp = pk_ec( key );
-        mpi_write_file( "Q(X): ", &ecp->Q.X, 16, NULL );
-        mpi_write_file( "Q(Y): ", &ecp->Q.Y, 16, NULL );
-        mpi_write_file( "Q(Z): ", &ecp->Q.Z, 16, NULL );
-        mpi_write_file( "D   : ", &ecp->d  , 16, NULL );
-    }
-    else
-#endif
-        printf("key type not supported yet\n");
+        mpi_write_file( "X_Q: ", &ecp->Q.X, 16, NULL );
+        mpi_write_file( "Y_Q: ", &ecp->Q.Y, 16, NULL );
+        mpi_write_file( "D  : ", &ecp->d  , 16, NULL );
+    }
+    else
+#endif
+        printf("  ! key type not supported\n");

     write_private_key( &key, opt.filename );


exercise GL_EXT_shadow_funcs

exercise GL_EXT_shadow_funcs

--- progs/demos/shadowtex.c
+++ progs/demos/shadowtex.c
@@ -1,4 +1,4 @@
-/* $Id: shadowtex.c,v 1.5 2002/02/16 14:54:18 brianp Exp $ */
+/* $Id: shadowtex.c,v 1.6 2002/03/23 16:34:18 brianp Exp $ */

 /*
  * Shadow demo using the GL_ARB_depth_texture, GL_ARB_shadow and
@@ -6,6 +6,8 @@
  *
  * Brian Paul
  * 19 Feb 2001
+ *
+ * Added GL_EXT_shadow_funcs support on 23 March 2002
  *
  * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
  *
@@ -66,6 +68,16 @@
 static GLfloat Bias = -0.06;

 static GLboolean Anim = GL_TRUE;
+
+static GLboolean HaveEXTshadowFuncs = GL_FALSE;
+static GLint Operator = 0;
+static const GLenum OperatorFunc[8] = {
+   GL_LEQUAL, GL_LESS, GL_GEQUAL, GL_GREATER,
+   GL_EQUAL, GL_NOTEQUAL, GL_ALWAYS, GL_NEVER };
+static const char *OperatorName[8] = {
+   "GL_LEQUAL", "GL_LESS", "GL_GEQUAL", "GL_GREATER",
+   "GL_EQUAL", "GL_NOTEQUAL", "GL_ALWAYS", "GL_NEVER" };
+

 static GLuint DisplayMode;
 #define SHOW_NORMAL         0
@@ -237,6 +249,7 @@
 {
    GLfloat ar = (GLfloat) WindowWidth / (GLfloat) WindowHeight;
    GLfloat d;
+   GLenum error;

    ComputeLightPos(LightDist, LightLatitude, LightLongitude,
                    LightPos, SpotDir);
@@ -346,6 +359,11 @@
    }

    glutSwapBuffers();
+
+   error = glGetError();
+   if (error) {
+      printf("GL Error: %s\n", gluErrorString(error));
+   }
 }

@@ -415,6 +433,16 @@
       case ' ':
          DisplayMode = SHOW_NORMAL;
          break;
+      case 'o':
+         if (HaveEXTshadowFuncs) {
+            Operator++;
+            if (Operator >= 8)
+               Operator = 0;
+            printf("Operator: %s\n", OperatorName[Operator]);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,
+                            OperatorFunc[Operator]);
+         }
+         break;
       case 'z':
          Zrot -= step;
          break;
@@ -484,6 +512,7 @@
    }
    printf("Using GL_SGIX_depth_texture and GL_SGIX_shadow\n");
 #endif
+   HaveEXTshadowFuncs = glutExtensionSupported("GL_EXT_shadow_funcs");

    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -541,6 +570,8 @@
    printf("  b/B = decrease/increase shadow map Z bias\n");
    printf("  cursor keys = rotate scene\n");
    printf("  <shift> + cursor keys = rotate light source\n");
+   if (HaveEXTshadowFuncs)
+      printf("  o = cycle through comparison modes\n");
 }