NbtkTooltip: apply font-size and font-name style properties

--- nbtk/nbtk-tooltip.c
+++ nbtk/nbtk-tooltip.c
@@ -101,11 +101,16 @@
 {
   ClutterColor *color = NULL;
   NbtkTooltipPrivate *priv;
+  gchar *font_name;
+  gint font_size;
+  gint font_string;

   priv = NBTK_TOOLTIP (self)->priv;

   nbtk_stylable_get (NBTK_STYLABLE (self),
                      "color", &color,
+                     "font-name", &font_name,
+                     "font-size", &font_size,
                      NULL);

   if (color)
@@ -113,6 +118,23 @@
       clutter_label_set_color (CLUTTER_LABEL (priv->label), color);
       clutter_color_free (color);
     }
+
+  if (font_name && font_size)
+    {
+      font_string = g_strdup_printf ("%s %dpx", font_name, font_size);
+      g_free (font_name);
+    }
+  else
+    if (!font_name && font_size)
+      font_string = g_strdup_printf ("%dpx", font_size);
+    else
+      if (!font_size && font_name)
+        font_string = font_name;
+
+  clutter_label_set_font_name (CLUTTER_LABEL (priv->label), font_string);
+
+  g_free (font_string);
+

   if (NBTK_WIDGET_CLASS (nbtk_tooltip_parent_class)->style_changed)
     NBTK_WIDGET_CLASS (nbtk_tooltip_parent_class)->style_changed (self);


Bluetooth: fix shutdown on SCO sockets

Bluetooth: fix shutdown on SCO sockets

shutdown should wait for SCO link to be properly disconnected before
detroying the socket, otherwise an application using the socket may
assume link is properly disconnected before it really happens which
can be a problem when e.g synchronizing profile switch.

Signed-off-by: Luiz Augusto von Dentz <0ff13d9eac9bca1413249ff7411a890960a6113a@nokia.com>
Signed-off-by: Gustavo F. Padovan <8463bae6aa74c6c37654a5ac7ce3bbb9fe6ffff8@profusion.mobi>

--- net/bluetooth/sco.c
+++ net/bluetooth/sco.c
@@ -369,6 +369,15 @@

 	case BT_CONNECTED:
 	case BT_CONFIG:
+		if (sco_pi(sk)->conn) {
+			sk->sk_state = BT_DISCONN;
+			sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
+			hci_conn_put(sco_pi(sk)->conn->hcon);
+			sco_pi(sk)->conn->hcon = NULL;
+		} else
+			sco_chan_del(sk, ECONNRESET);
+		break;
+
 	case BT_CONNECT:
 	case BT_DISCONN:
 		sco_chan_del(sk, ECONNRESET);
@@ -819,7 +828,9 @@
 		conn->sk = NULL;
 		sco_pi(sk)->conn = NULL;
 		sco_conn_unlock(conn);
-		hci_conn_put(conn->hcon);
+
+		if (conn->hcon)
+			hci_conn_put(conn->hcon);
 	}

 	sk->sk_state = BT_CLOSED;


Bluetooth: Track authentication method in SMP context

For Secure Connections we'll select the authentication method as soon as
we receive the public key, but only use it later (both when actually
triggering the method as well as when determining the quality of the
resulting LTK). Store the method therefore in the SMP context.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>
Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>

--- net/bluetooth/smp.c
+++ net/bluetooth/smp.c
@@ -79,6 +79,7 @@
 	struct smp_irk	*remote_irk;
 	u8		*link_key;
 	unsigned long	flags;
+	u8		method;

 	/* Secure Connections variables */
 	u8			local_pk[64];
@@ -688,7 +689,6 @@
 	struct hci_conn *hcon = conn->hcon;
 	struct l2cap_chan *chan = conn->smp;
 	struct smp_chan *smp = chan->data;
-	u8 method;
 	u32 passkey = 0;
 	int ret = 0;

@@ -705,26 +705,28 @@
 	 * table.
 	 */
 	if (!(auth & SMP_AUTH_MITM))
-		method = JUST_CFM;
+		smp->method = JUST_CFM;
 	else
-		method = get_auth_method(smp, local_io, remote_io);
+		smp->method = get_auth_method(smp, local_io, remote_io);

 	/* Don't confirm locally initiated pairing attempts */
-	if (method == JUST_CFM && test_bit(SMP_FLAG_INITIATOR, &smp->flags))
-		method = JUST_WORKS;
+	if (smp->method == JUST_CFM && test_bit(SMP_FLAG_INITIATOR,
+						&smp->flags))
+		smp->method = JUST_WORKS;

 	/* Don't bother user space with no IO capabilities */
-	if (method == JUST_CFM && hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT)
-		method = JUST_WORKS;
+	if (smp->method == JUST_CFM &&
+	    hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT)
+		smp->method = JUST_WORKS;

 	/* If Just Works, Continue with Zero TK */
-	if (method == JUST_WORKS) {
+	if (smp->method == JUST_WORKS) {
 		set_bit(SMP_FLAG_TK_VALID, &smp->flags);
 		return 0;
 	}

 	/* Not Just Works/Confirm results in MITM Authentication */
-	if (method != JUST_CFM) {
+	if (smp->method != JUST_CFM) {
 		set_bit(SMP_FLAG_MITM_AUTH, &smp->flags);
 		if (hcon->pending_sec_level < BT_SECURITY_HIGH)
 			hcon->pending_sec_level = BT_SECURITY_HIGH;
@@ -733,15 +735,15 @@
 	/* If both devices have Keyoard-Display I/O, the master
 	 * Confirms and the slave Enters the passkey.
 	 */
-	if (method == OVERLAP) {
+	if (smp->method == OVERLAP) {
 		if (hcon->role == HCI_ROLE_MASTER)
-			method = CFM_PASSKEY;
+			smp->method = CFM_PASSKEY;
 		else
-			method = REQ_PASSKEY;
+			smp->method = REQ_PASSKEY;
 	}

 	/* Generate random passkey. */
-	if (method == CFM_PASSKEY) {
+	if (smp->method == CFM_PASSKEY) {
 		memset(smp->tk, 0, sizeof(smp->tk));
 		get_random_bytes(&passkey, sizeof(passkey));
 		passkey %= 1000000;
@@ -750,10 +752,10 @@
 		set_bit(SMP_FLAG_TK_VALID, &smp->flags);
 	}

-	if (method == REQ_PASSKEY)
+	if (smp->method == REQ_PASSKEY)
 		ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst,
 						hcon->type, hcon->dst_type);
-	else if (method == JUST_CFM)
+	else if (smp->method == JUST_CFM)
 		ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
 						hcon->type, hcon->dst_type,
 						passkey, 1);


Bluetooth: Fix MITM flag when initiating SMP pairing

The pairing process initiated through mgmt sets the conn->auth_type
value regardless of BR/EDR or LE pairing. This value will contain the
MITM flag if the local IO capability allows it. When sending the SMP
pairing request we should check the value and ensure that the MITM bit
gets correctly set in the bonding flags.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>
Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>

--- net/bluetooth/smp.c
+++ net/bluetooth/smp.c
@@ -908,6 +908,12 @@
 		return 1;

 	authreq = seclevel_to_authreq(sec_level);
+
+	/* hcon->auth_type is set by pair_device in mgmt.c. If the MITM
+	 * flag is set we should also set it for the SMP request.
+	 */
+	if ((hcon->auth_type & 0x01))
+		authreq |= SMP_AUTH_MITM;

 	if (hcon->link_mode & HCI_LM_MASTER) {
 		struct smp_cmd_pairing cp;


[DECNET] address: Rename rtmsg_ifa() to dn_ifaddr_notify()

The name rtmsg_ifa is heavly overused and confusing.

Signed-off-by: Thomas Graf <17c2d8920621522552b392f72d8fdb4d1e866b44@suug.ch>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/decnet/dn_dev.c
+++ net/decnet/dn_dev.c
@@ -73,7 +73,7 @@

 static struct dn_dev *dn_dev_create(struct net_device *dev, int *err);
 static void dn_dev_delete(struct net_device *dev);
-static void rtmsg_ifa(int event, struct dn_ifaddr *ifa);
+static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa);

 static int dn_eth_up(struct net_device *);
 static void dn_eth_down(struct net_device *);
@@ -440,7 +440,7 @@
 		}
 	}

-	rtmsg_ifa(RTM_DELADDR, ifa1);
+	dn_ifaddr_notify(RTM_DELADDR, ifa1);
 	blocking_notifier_call_chain(&dnaddr_chain, NETDEV_DOWN, ifa1);
 	if (destroy) {
 		dn_dev_free_ifa(ifa1);
@@ -475,7 +475,7 @@
 	ifa->ifa_next = dn_db->ifa_list;
 	dn_db->ifa_list = ifa;

-	rtmsg_ifa(RTM_NEWADDR, ifa);
+	dn_ifaddr_notify(RTM_NEWADDR, ifa);
 	blocking_notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa);

 	return 0;
@@ -749,7 +749,7 @@
         return -1;
 }

-static void rtmsg_ifa(int event, struct dn_ifaddr *ifa)
+static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa)
 {
 	struct sk_buff *skb;
 	int err = -ENOBUFS;


[IPV4]: Kill redundant rcu_dereference on fa_info

This patch kills a redundant rcu_dereference on fa->fa_info in fib_trie.c.
As this dereference directly follows a list_for_each_entry_rcu line, we
have already taken a read barrier with respect to getting an entry from
the list.

This read barrier guarantees that all values read out of fa are valid.
In particular, the contents of structure pointed to by fa->fa_info is
initialised before fa->fa_info is actually set (see fn_trie_insert);
the setting of fa->fa_info itself is further separated with a write
barrier from the insertion of fa into the list.

Therefore by taking a read barrier after obtaining fa from the list
(which is given by list_for_each_entry_rcu), we can be sure that
fa->fa_info contains a valid pointer, as well as the fact that the
data pointed to by fa->fa_info is itself valid.

Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>
Acked-by: Paul E. McKenney <1e0ce936bb9b355d257bf5790d2513c3f28be22b@us.ibm.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@mandriva.com>

--- net/ipv4/fib_trie.c
+++ net/ipv4/fib_trie.c
@@ -2404,7 +2404,7 @@
 		prefix = htonl(l->key);

 		list_for_each_entry_rcu(fa, &li->falh, fa_list) {
-			const struct fib_info *fi = rcu_dereference(fa->fa_info);
+			const struct fib_info *fi = fa->fa_info;
 			unsigned flags = fib_flag_trans(fa->fa_type, mask, fi);

 			if (fa->fa_type == RTN_BROADCAST


[IPV4] fib_trie: dump message multiple part flag

Match fib_hash, and set NLM_F_MULTI to handle multiple part messages.

Signed-off-by: Stephen Hemminger <a072e933f45880fe04500ea083d5c7f6e81a06f0@vyatta.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/ipv4/fib_trie.c
+++ net/ipv4/fib_trie.c
@@ -1898,7 +1898,7 @@
 				  xkey,
 				  plen,
 				  fa->fa_tos,
-				  fa->fa_info, 0) < 0) {
+				  fa->fa_info, NLM_F_MULTI) < 0) {
 			cb->args[4] = i;
 			return -1;
 		}


Add documentation to the public methods

Add documentation to the public methods

--- Notifiable-iOS/FWTNotifiableManager.h
+++ Notifiable-iOS/FWTNotifiableManager.h
@@ -29,10 +29,15 @@
 */
 @interface FWTNotifiableManager : NSObject

+/** Notifiable-Rails gem server URL */
 @property (nonatomic, readonly) NSURL *baseUrl;
+/** Number of times that the manager will try to resend the informations in case of error */
 @property (nonatomic, assign) NSInteger retryAttempts;
+/** Delay between retries  */
 @property (nonatomic, assign) NSTimeInterval retryDelay;
+/** Level of the informations that will be logged by the manager */
 @property (nonatomic, assign) FWTNotifiableLogLevel debugLevel;
+/** Token associated with the current device  */
 @property (nonatomic, readonly) NSString *deviceToken;

 + (BOOL)userAllowsPushNotificationsForType:(UIUserNotificationType)types;
@@ -55,41 +60,121 @@
                andSecretKey:(NSString *)secretKey;

 #pragma mark - Register Anonymous device
+/**
+ Register a device without a user associated to it. If the token already exists in the server,
+ the device configuration in the server will not change, otherwise, a new device will be created.
+
+ @param token   The device token.
+ @param handler Block called once that the operation is finished.
+*/
 - (void)registerAnonymousToken:(NSData *)token
              completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)hanlder;

+/**
+ Register a device, without a user associated to it. If the token already exists in the server,
+ the device locale will be updated. Otherwise, a new device will be created with the token
+ and locale provided.
+
+ @param token   The device token.
+ @param locale  The locale of the device.
+ @param handler Block called once that the operation is finished.
+*/
 - (void)registerAnonymousToken:(NSData *)token
                     withLocale:(NSLocale *)locale
              completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)hanlder;

 #pragma mark - Register device to a specific user
+/**
+ Register a device with a user associated to it. If the token already exists in the server,
+ the device configuration in the server will not change, otherwise, a new device will be created.
+ If the user alias doesn't exist, a new user will be created.
+
+ @param token       The device token.
+ @param userAlias   The alias of the user in the server.
+ @param handler     Block called once that the operation is finished.
+*/
 - (void)registerToken:(NSData *)token
         withUserAlias:(NSString *)userAlias
     completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)hanlder;

+/**
+ Register a device, with a user associated to it. If the token already exists in the server,
+ the device locale will be updated. Otherwise, a new device will be created with the token
+ and locale provided. If the user alias doesn't exist, a new user will be created.
+
+ @param token       The device token.
+ @param locale      The locale of the device.
+ @param userAlias   The alias of the user in the server.
+ @param handler     Block called once that the operation is finished.
+*/
 - (void)registerToken:(NSData *)token
         withUserAlias:(NSString *)userAlias
             andLocale:(NSLocale *)locale
     completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)hanlder;

 #pragma mark - Update device information
-- (void)updateDeviceToken:(NSData *)token;
+/**
+ Update the token of the device
+
+ @param token   New device token.
+ @param handler Block called once that the operation is finished.
+*/
+- (void)updateDeviceToken:(NSData *)token
+        completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;
+/**
+ Update the device locale.
+
+ @param locale  New device locale.
+ @param handler Block called once that the operation is finished.
+*/
 - (void)updateDeviceLocale:(NSLocale *)locale
-         completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;;
+         completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;
+/**
+ Update the device token and locale.
+
+ @param token   New device token.
+ @param locale  New device locale.
+ @param handler Block called once that the operation is finished.
+ */
 - (void)updateDeviceToken:(NSData *)token
               andLocation:(NSLocale *)locale
-        completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;;
+        completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;

 #pragma mark - Device/user relationship
+/**
+ Associate an anonymous device to a user. If the user alias doesn't exist,
+ a new user will be created.
+
+ @param userAlias   The alias of the user in the server.
+ @param handler     Block called once that the operation is finished.
+*/
 - (void)associateDeviceToUser:(NSString *)userAlias
             completionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;
+
+/**
+ Remove a token from a specific user and anonymise it.
+
+ @warning   The device id and configuration will remain the same in the server.
+
+ @param handler Block called once that the operation is finished.
+*/
 - (void)anonymiseTokenWithCompletionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)handler;

 #pragma mark - Unregister
+/**
+ Delete the device from the server.
+
+ @param handler Block called once that the operation is finished.
+*/
 - (void)unregisterTokenWithCompletionHandler:(_Nullable FWTNotifiableOperationCompletionHandler)hanlder;

 #pragma mark - Read receipts can be delivered back to server via this method
+/**
+ Notify the server that a notification was read.
+
+ @param notificationInfo    The information of the notification given by the system
+*/
 - (void)applicationDidReceiveRemoteNotification:(NSDictionary *)notificationInfo;

 @end


net: l2tp_eth: fix kernel panic on rmmod l2tp_eth

We must prevent module unloading if some devices are still attached to
l2tp_eth driver.

Signed-off-by: Eric Dumazet <312c7d941f03386814be517ffdb3e0eb6624e275@google.com>
Reported-by: Denys Fedoryshchenko <d29de71aea38aad3a87d486929cb0aad173ae612@visp.net.lb>
Tested-by: Denys Fedoryshchenko <d29de71aea38aad3a87d486929cb0aad173ae612@visp.net.lb>
Cc: James Chapman <d87d459960487ecb1b999dfc309f5d5f521df082@katalix.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/l2tp/l2tp_eth.c
+++ net/l2tp/l2tp_eth.c
@@ -162,6 +162,7 @@
 		if (dev) {
 			unregister_netdev(dev);
 			spriv->dev = NULL;
+			module_put(THIS_MODULE);
 		}
 	}
 }
@@ -249,6 +250,7 @@
 	if (rc < 0)
 		goto out_del_dev;

+	__module_get(THIS_MODULE);
 	/* Must be done after register_netdev() */
 	strlcpy(session->ifname, dev->name, IFNAMSIZ);


mac80211: only create default STA interface if supported

Drivers will support this, obviously, but this forces them to
set it up properly.

(This includes the fix posted as "mac80211: fix ifmodes check" and
tested in wireless-testing by Hin-Tak and others. -- JWL)

Signed-off-by: Johannes Berg <8398eb9892c5ab2ff439ca0b5e4b0706dd9ebef9@sipsolutions.net>
Reported-by: Larry Finger <ed0f1d78b8c21b2970494a178da4bdfa8beba2a7@lwfinger.net>
Tested-by: Hin-Tak Leung <ec51f4bc3298ae58770617c0319da1091a2df7dd@users.sourceforge.net>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- net/mac80211/main.c
+++ net/mac80211/main.c
@@ -886,12 +886,14 @@

 	local->mdev->select_queue = ieee80211_select_queue;

-	/* add one default STA interface */
-	result = ieee80211_if_add(local, "wlan%d", NULL,
-				  NL80211_IFTYPE_STATION, NULL);
-	if (result)
-		printk(KERN_WARNING "%s: Failed to add default virtual iface\n",
-		       wiphy_name(local->hw.wiphy));
+	/* add one default STA interface if supported */
+	if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
+		result = ieee80211_if_add(local, "wlan%d", NULL,
+					  NL80211_IFTYPE_STATION, NULL);
+		if (result)
+			printk(KERN_WARNING "%s: Failed to add default virtual iface\n",
+			       wiphy_name(local->hw.wiphy));
+	}

 	rtnl_unlock();


mac80211: don't react to beacon loss if HW monitoring

If the HW is monitoring connection loss (as advertised
by IEEE80211_HW_CONNECTION_MONITOR) but not filtering
beacons (IEEE80211_VIF_BEACON_FILTER) then mac80211 will
still start the beacon loss timer and if a few beacons
are lost, e.g. due to scanning, drop the connection.

If the hardware doesn't advertise connection monitoring,
then it won't drop the connection right away but probe
the AP, which is intended, but due to the logic in the
timer when connection monitoring is done it assumes the
connection was actually lost.

Fix this problem by not starting the timer when the HW
does connection monitoring.

Signed-off-by: Johannes Berg <bff32994ff0f8d048f262a8388145a71b6071bfe@intel.com>

--- net/mac80211/mlme.c
+++ net/mac80211/mlme.c
@@ -144,6 +144,9 @@
 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata)
 {
 	if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)
+		return;
+
+	if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
 		return;

 	mod_timer(&sdata->u.mgd.bcn_mon_timer,


Added AxisAlignedBox::distance(Vector3) - returns smallest distance of point from any box surface

--- OgreMain/include/OgreAxisAlignedBox.h
+++ OgreMain/include/OgreAxisAlignedBox.h
@@ -759,6 +759,34 @@
                    mMinimum.y <= v.y && v.y <= mMaximum.y &&
                    mMinimum.z <= v.z && v.z <= mMaximum.z;
         }
+
+		/** Returns the minimum distance between a given point and any part of the box. */
+		Real distance(const Vector3& v) const
+		{
+
+			if (this->contains(v))
+				return 0;
+			else
+			{
+				Real maxDist = std::numeric_limits<Real>::min();
+
+				if (v.x < mMinimum.x)
+					maxDist = std::max(maxDist, mMinimum.x - v.x);
+				if (v.y < mMinimum.y)
+					maxDist = std::max(maxDist, mMinimum.y - v.y);
+				if (v.z < mMinimum.z)
+					maxDist = std::max(maxDist, mMinimum.z - v.z);
+
+				if (v.x > mMaximum.x)
+					maxDist = std::max(maxDist, v.x - mMaximum.x);
+				if (v.y > mMaximum.y)
+					maxDist = std::max(maxDist, v.y - mMaximum.y);
+				if (v.z > mMaximum.z)
+					maxDist = std::max(maxDist, v.z - mMaximum.z);
+
+				return maxDist;
+			}
+		}

         /** Tests whether another box contained by this box.
         */


mac80211: fix cfg80211 interaction on auth/assoc request

If authentication (or association with FT) is requested by
userspace, mac80211 currently doesn't tell cfg80211 that it
disconnected from the AP. That leaves inconsistent state:
cfg80211 thinks it's connected while mac80211 thinks it's
not. Typically this won't last long, as soon as mac80211
reports the new association to cfg80211 the old one goes
away. If, however, the new authentication or association
doesn't succeed, then cfg80211 will forever think the old
one still exists and will refuse attempts to authenticate
or associate with the AP it thinks it's connected to.

Anders reported that this leads to it taking a very long
time to reconnect to a network, or never even succeeding.
I tested this with an AP hacked to never respond to auth
frames, and one that works, and with just those two the
system never recovers because one won't work and cfg80211
thinks it's connected to the other so refuses connections
to it.

To fix this, simply make mac80211 tell cfg80211 when it is
no longer connected to the old AP, while authenticating or
associating to a new one.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Reported-by: Anders Kaseorg <087231934ba8fcf78bc142ce37d193b895ac03c4@mit.edu>
Signed-off-by: Johannes Berg <bff32994ff0f8d048f262a8388145a71b6071bfe@intel.com>

--- net/mac80211/mlme.c
+++ net/mac80211/mlme.c
@@ -3964,8 +3964,16 @@
 	/* prep auth_data so we don't go into idle on disassoc */
 	ifmgd->auth_data = auth_data;

-	if (ifmgd->associated)
-		ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
+	if (ifmgd->associated) {
+		u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
+
+		ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
+				       WLAN_REASON_UNSPECIFIED,
+				       false, frame_buf);
+
+		__cfg80211_send_deauth(sdata->dev, frame_buf,
+				       sizeof(frame_buf));
+	}

 	sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid);

@@ -4025,8 +4033,16 @@

 	mutex_lock(&ifmgd->mtx);

-	if (ifmgd->associated)
-		ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
+	if (ifmgd->associated) {
+		u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
+
+		ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
+				       WLAN_REASON_UNSPECIFIED,
+				       false, frame_buf);
+
+		__cfg80211_send_deauth(sdata->dev, frame_buf,
+				       sizeof(frame_buf));
+	}

 	if (ifmgd->auth_data && !ifmgd->auth_data->done) {
 		err = -EBUSY;


[NET_SCHED]: Fix warning

[NET_SCHED]: Fix warning

net/sched/sch_api.c: In function 'psched_show':
net/sched/sch_api.c:1219: warning: format '%08x' expects type 'unsigned int', but argument 6 has type 's64'

Signed-off-by: Patrick McHardy <3a4d625ce225e891399f98db96a382ac4a84080b@trash.net>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/sched/sch_api.c
+++ net/sched/sch_api.c
@@ -1216,7 +1216,8 @@
 {
 	seq_printf(seq, "%08x %08x %08x %08x\n",
 		   (u32)NSEC_PER_USEC, (u32)PSCHED_US2NS(1),
-		   1000000, (u32)NSEC_PER_SEC/ktime_to_ns(KTIME_MONOTONIC_RES));
+		   1000000,
+		   (u32)NSEC_PER_SEC/(u32)ktime_to_ns(KTIME_MONOTONIC_RES));

 	return 0;
 }


grab_single_ref(): rewrite to take an object_id argument

Signed-off-by: Michael Haggerty <c24c152f145c57791e809b126db9e61bd1c1782d@alum.mit.edu>
Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- builtin/for-each-ref.c
+++ builtin/for-each-ref.c
@@ -840,7 +840,8 @@
  * A call-back given to for_each_ref().  Filter refs and keep them for
  * later object processing.
  */
-static int grab_single_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+static int grab_single_ref(const char *refname, const struct object_id *oid,
+			   int flag, void *cb_data)
 {
 	struct grab_ref_cbdata *cb = cb_data;
 	struct refinfo *ref;
@@ -878,7 +879,7 @@
 	 */
 	ref = xcalloc(1, sizeof(*ref));
 	ref->refname = xstrdup(refname);
-	hashcpy(ref->objectname, sha1);
+	hashcpy(ref->objectname, oid->hash);
 	ref->flag = flag;

 	cnt = cb->grab_cnt;
@@ -1072,8 +1073,6 @@
 	int maxcount = 0, quote_style = 0;
 	struct refinfo **refs;
 	struct grab_ref_cbdata cbdata;
-	struct each_ref_fn_sha1_adapter wrapped_grab_single_ref =
-		{grab_single_ref, &cbdata};

 	struct option opts[] = {
 		OPT_BIT('s', "shell", &quote_style,
@@ -1113,7 +1112,7 @@

 	memset(&cbdata, 0, sizeof(cbdata));
 	cbdata.grab_pattern = argv;
-	for_each_rawref(each_ref_fn_adapter, &wrapped_grab_single_ref);
+	for_each_rawref(grab_single_ref, &cbdata);
 	refs = cbdata.grab_array;
 	num_refs = cbdata.grab_cnt;


receive-pack: reorder some code in unpack()

This is the preparation for adding --shallow-file to both
unpack-objects and index-pack. To sum up:

 - struct argv_array used instead of const char **

 - status/code, ip/child, unpacker/keeper are moved out to function
   top level

 - successful flow now ends at the end of the function

Signed-off-by: Nguyễn Thái Ngọc Duy <024f400cd820cb2ddbe54c7fecfd01e45f30bb96@gmail.com>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- builtin/receive-pack.c
+++ builtin/receive-pack.c
@@ -13,6 +13,7 @@
 #include "string-list.h"
 #include "sha1-array.h"
 #include "connected.h"
+#include "argv-array.h"
 #include "version.h"

 static const char receive_pack_usage[] = "git receive-pack <git-dir>";
@@ -822,8 +823,11 @@
 static const char *unpack(int err_fd)
 {
 	struct pack_header hdr;
+	struct argv_array av = ARGV_ARRAY_INIT;
 	const char *hdr_err;
+	int status;
 	char hdr_arg[38];
+	struct child_process child;
 	int fsck_objects = (receive_fsck_objects >= 0
 			    ? receive_fsck_objects
 			    : transfer_fsck_objects >= 0
@@ -840,63 +844,49 @@
 			"--pack_header=%"PRIu32",%"PRIu32,
 			ntohl(hdr.hdr_version), ntohl(hdr.hdr_entries));

+	memset(&child, 0, sizeof(child));
 	if (ntohl(hdr.hdr_entries) < unpack_limit) {
-		int code, i = 0;
-		struct child_process child;
-		const char *unpacker[5];
-		unpacker[i++] = "unpack-objects";
+		argv_array_pushl(&av, "unpack-objects", hdr_arg, NULL);
 		if (quiet)
-			unpacker[i++] = "-q";
+			argv_array_push(&av, "-q");
 		if (fsck_objects)
-			unpacker[i++] = "--strict";
-		unpacker[i++] = hdr_arg;
-		unpacker[i++] = NULL;
-		memset(&child, 0, sizeof(child));
-		child.argv = unpacker;
+			argv_array_push(&av, "--strict");
+		child.argv = av.argv;
 		child.no_stdout = 1;
 		child.err = err_fd;
 		child.git_cmd = 1;
-		code = run_command(&child);
-		if (!code)
-			return NULL;
-		return "unpack-objects abnormal exit";
+		status = run_command(&child);
+		if (status)
+			return "unpack-objects abnormal exit";
 	} else {
-		const char *keeper[7];
-		int s, status, i = 0;
+		int s;
 		char keep_arg[256];
-		struct child_process ip;

 		s = sprintf(keep_arg, "--keep=receive-pack %"PRIuMAX" on ", (uintmax_t) getpid());
 		if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
 			strcpy(keep_arg + s, "localhost");

-		keeper[i++] = "index-pack";
-		keeper[i++] = "--stdin";
+		argv_array_pushl(&av, "index-pack",
+				 "--stdin", hdr_arg, keep_arg, NULL);
 		if (fsck_objects)
-			keeper[i++] = "--strict";
+			argv_array_push(&av, "--strict");
 		if (fix_thin)
-			keeper[i++] = "--fix-thin";
-		keeper[i++] = hdr_arg;
-		keeper[i++] = keep_arg;
-		keeper[i++] = NULL;
-		memset(&ip, 0, sizeof(ip));
-		ip.argv = keeper;
-		ip.out = -1;
-		ip.err = err_fd;
-		ip.git_cmd = 1;
-		status = start_command(&ip);
-		if (status) {
+			argv_array_push(&av, "--fix-thin");
+		child.argv = av.argv;
+		child.out = -1;
+		child.err = err_fd;
+		child.git_cmd = 1;
+		status = start_command(&child);
+		if (status)
 			return "index-pack fork failed";
-		}
-		pack_lockfile = index_pack_lockfile(ip.out);
-		close(ip.out);
-		status = finish_command(&ip);
-		if (!status) {
-			reprepare_packed_git();
-			return NULL;
-		}
-		return "index-pack abnormal exit";
-	}
+		pack_lockfile = index_pack_lockfile(child.out);
+		close(child.out);
+		status = finish_command(&child);
+		if (status)
+			return "index-pack abnormal exit";
+		reprepare_packed_git();
+	}
+	return NULL;
 }

 static const char *unpack_with_sideband(void)


BDA: remove unneeded variable.

BDA: remove unneeded variable.

--- modules/access/bda/bda.c
+++ modules/access/bda/bda.c
@@ -541,7 +541,7 @@
 static int Control( access_t *p_access, int i_query, va_list args )
 {
     bool   *pb_bool, b_bool;
-    int          *pi_int, i_int;
+    int          i_int;
     int64_t      *pi_64;

     switch( i_query )


coding style

coding style

--- modules/access/pvr/pvr.c
+++ modules/access/pvr/pvr.c
@@ -2,7 +2,7 @@
  * pvr.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: pvr.c,v 1.12 2004/02/20 15:38:40 bigben Exp $
+ * $Id: pvr.c,v 1.13 2004/02/20 16:29:31 bigben Exp $
  *
  * Authors: Eric Petit <titer@videolan.org>
  *
@@ -130,7 +130,7 @@
     p_sys->i_standard = V4L2_STD_UNKNOWN;
     p_sys->i_width = -1;
     p_sys->i_height = -1;
-    p_sys->i_frequency = -1; /* M6 ;) */
+    p_sys->i_frequency = -1;
     p_sys->i_framerate = -1;
     p_sys->i_bitrate = -1;
     p_sys->i_bitrate_peak = -1;
@@ -247,12 +247,12 @@
                 if (!strncmp( psz_parser_init, "vbr" ,
                                                 psz_parser - psz_parser_init ) )
                     {
-                    p_sys->i_bitrate_mode = 0;
+                         p_sys->i_bitrate_mode = 0;
                     }
                 else if  (!strncmp( psz_parser_init, "cbr" ,
                                                 psz_parser - psz_parser_init ) )
                     {
-                    p_sys->i_bitrate_mode = 1;
+                        p_sys->i_bitrate_mode = 1;
                     }
             }

@@ -302,150 +302,163 @@
         return VLC_EGENERIC;
     }
     else
-      msg_Dbg( p_input, "using video device: %s",psz_device);
+    {
+        msg_Dbg( p_input, "using video device: %s",psz_device);
+    }

     free( psz_device );

     /* set the input */
     if( p_sys->i_input != -1)
-      {
-	if(ioctl( p_sys->i_fd, VIDIOC_S_INPUT, &p_sys->i_input ) < 0 )
-	  {
-	    msg_Warn( p_input, "VIDIOC_S_INPUT failed" );
-	  }
-	else
-	  msg_Dbg( p_input,"input set to:%d",p_sys->i_input);
-      }
+    {
+	    if(ioctl( p_sys->i_fd, VIDIOC_S_INPUT, &p_sys->i_input ) < 0 )
+	    {
+	        msg_Warn( p_input, "VIDIOC_S_INPUT failed" );
+	    }
+	    else
+        {
+	        msg_Dbg( p_input,"input set to:%d",p_sys->i_input);
+        }
+    }

       /* set the video standard */
-      if(p_sys->i_standard != V4L2_STD_UNKNOWN)
+    if(p_sys->i_standard != V4L2_STD_UNKNOWN)
 	{
-	  if(ioctl( p_sys->i_fd, VIDIOC_S_STD, &p_sys->i_standard ) < 0 )
-	    {
-	      msg_Warn( p_input, "VIDIOC_S_STD failed" );
-	    }
-	  else
-	    msg_Dbg( p_input,"video standard set to:%x",p_sys->i_standard);
+	    if(ioctl( p_sys->i_fd, VIDIOC_S_STD, &p_sys->i_standard ) < 0 )
+	    {
+	        msg_Warn( p_input, "VIDIOC_S_STD failed" );
+	    }
+	    else
+        {
+	        msg_Dbg( p_input,"video standard set to:%x",p_sys->i_standard);
+        }
 	}

       /* set the picture size */
-      if(p_sys->i_width != -1 || p_sys->i_height != -1)
+    if(p_sys->i_width != -1 || p_sys->i_height != -1)
 	{
-	  if(ioctl( p_sys->i_fd, VIDIOC_G_FMT, &vfmt ) < 0 )
-	    {
-	      msg_Warn( p_input, "VIDIOC_G_FMT failed" );
-	    }
-	  else
-	    {
-	      if(p_sys->i_width != -1)
-		vfmt.fmt.pix.width = p_sys->i_width;
+	    if(ioctl( p_sys->i_fd, VIDIOC_G_FMT, &vfmt ) < 0 )
+	    {
+	        msg_Warn( p_input, "VIDIOC_G_FMT failed" );
+	    }
+	    else
+	    {
+	        if(p_sys->i_width != -1)
+            {
+		        vfmt.fmt.pix.width = p_sys->i_width;
+            }

-	      if(p_sys->i_height != -1)
-		vfmt.fmt.pix.height = p_sys->i_height;
-
-	      if( ioctl( p_sys->i_fd, VIDIOC_S_FMT, &vfmt ) < 0 )
-		{
-		  msg_Warn( p_input, "VIDIOC_S_FMT failed" );
-		}
-	      else
-		{
-		  msg_Dbg( p_input,"picture size set to:%dx%d",vfmt.fmt.pix.width, vfmt.fmt.pix.height);
-		}
+	        if(p_sys->i_height != -1)
+            {
+		        vfmt.fmt.pix.height = p_sys->i_height;
+	        }
+
+	        if( ioctl( p_sys->i_fd, VIDIOC_S_FMT, &vfmt ) < 0 )
+		    {
+		        msg_Warn( p_input, "VIDIOC_S_FMT failed" );
+		    }
+	        else
+		    {
+		        msg_Dbg( p_input,"picture size set to:%dx%d",vfmt.fmt.pix.width, vfmt.fmt.pix.height);
+		    }
 	    }
 	}

       /* set the frequency */
-      if (p_sys->i_frequency != -1)
+    if (p_sys->i_frequency != -1)
 	{
-	  vf.tuner = 0; /* TODO: let the user choose the tuner */
-	  if( ioctl( p_sys->i_fd, VIDIOC_G_FREQUENCY, &vf ) < 0 )
-	    {
-	      msg_Warn( p_input, "VIDIOC_G_FREQUENCY failed (%s)",
+	    vf.tuner = 0; /* TODO: let the user choose the tuner */
+	    if( ioctl( p_sys->i_fd, VIDIOC_G_FREQUENCY, &vf ) < 0 )
+	    {
+	        msg_Warn( p_input, "VIDIOC_G_FREQUENCY failed (%s)",
 			strerror( errno ) );
 	    }
-	  else
-	    {
-	      vf.frequency = p_sys->i_frequency * 16 / 1000;
-	      if( ioctl( p_sys->i_fd, VIDIOC_S_FREQUENCY, &vf ) < 0 )
-		{
-		  msg_Warn( p_input, "VIDIOC_S_FREQUENCY failed (%s)",
+	    else
+	    {
+	        vf.frequency = p_sys->i_frequency * 16 / 1000;
+	        if( ioctl( p_sys->i_fd, VIDIOC_S_FREQUENCY, &vf ) < 0 )
+		    {
+		        msg_Warn( p_input, "VIDIOC_S_FREQUENCY failed (%s)",
 			    strerror( errno ) );
-		}
-	      else
-		{
-		  msg_Dbg( p_input,"Tuner frequency set to:%d",p_sys->i_frequency);
-		}
+		    }
+	        else
+		    {
+		        msg_Dbg( p_input,"Tuner frequency set to:%d",p_sys->i_frequency);
+		    }
 	    }
 	}

       /* codec parameters */
-      if(p_sys->i_framerate != -1
-	 || p_sys->i_bitrate_mode != -1
-	 || p_sys->i_bitrate_peak != -1
-	 || p_sys->i_bitrate != -1
-	 )
+        if(p_sys->i_framerate != -1
+	        || p_sys->i_bitrate_mode != -1
+	        || p_sys->i_bitrate_peak != -1
+	        || p_sys->i_bitrate != -1)
+	    {
+	        if( ioctl( p_sys->i_fd, IVTV_IOC_G_CODEC, &codec ) < 0 )
+	        {
+	            msg_Warn( p_input, "IVTV_IOC_G_CODEC failed" );
+	        }
+	    else
+	    {
+	        if(p_sys->i_framerate != -1)
+		    {
+		        switch( p_sys->i_framerate )
+		        {
+		            case 30:
+		                codec.framerate = 0;
+		            break;
+
+		            case 25:
+		                codec.framerate = 1;
+		            break;
+
+		            default:
+		                msg_Warn( p_input, "invalid framerate, reverting to 25" );
+		                codec.framerate = 1;
+		            break;
+		        }
+		    }
+
+	        if(p_sys->i_bitrate != -1)
+            {
+		        codec.bitrate = p_sys->i_bitrate;
+            }
+
+	        if(p_sys->i_bitrate_peak != -1)
+            {
+		        codec.bitrate_peak = p_sys->i_bitrate_peak;
+            }
+
+	        if(p_sys->i_bitrate_mode != -1)
+            {
+		        codec.bitrate_mode = p_sys->i_bitrate_mode;
+            }
+
+	        if( ioctl( p_sys->i_fd, IVTV_IOC_S_CODEC, &codec ) < 0 )
+		    {
+		        msg_Warn( p_input, "IVTV_IOC_S_CODEC failed" );
+		    }
+	        else
+		    {
+		        msg_Dbg( p_input, "Setting codec parameters to:  framerate: %d, bitrate: %d/%d/%d",
+			   codec.framerate, codec.bitrate, codec.bitrate_peak, codec.bitrate_mode);
+		    }
+        }
+	}
+
+      /* do a quick read */
+    if(p_sys->i_fd)
 	{
-
-	  if( ioctl( p_sys->i_fd, IVTV_IOC_G_CODEC, &codec ) < 0 )
-	    {
-	      msg_Warn( p_input, "IVTV_IOC_G_CODEC failed" );
-	    }
-	  else
-	    {
-
-	      if(p_sys->i_framerate != -1)
-		{
-		  switch( p_sys->i_framerate )
-		    {
-		    case 30:
-		      codec.framerate = 0;
-		      break;
-
-		    case 25:
-		      codec.framerate = 1;
-		      break;
-
-		    default:
-		      msg_Warn( p_input, "invalid framerate, reverting to 25" );
-		      codec.framerate = 1;
-		      break;
-		    }
-		}
-
-	      if(p_sys->i_bitrate != -1)
-		codec.bitrate = p_sys->i_bitrate;
-
-	      if(p_sys->i_bitrate_peak != -1)
-		codec.bitrate_peak = p_sys->i_bitrate_peak;
-
-	      if(p_sys->i_bitrate_mode != -1)
-		codec.bitrate_mode = p_sys->i_bitrate_mode;
-
-	      if( ioctl( p_sys->i_fd, IVTV_IOC_S_CODEC, &codec ) < 0 )
-		{
-		  msg_Warn( p_input, "IVTV_IOC_S_CODEC failed" );
-		}
-	      else
-		{
-		  msg_Dbg( p_input, "Setting codec parameters to:  framerate: %d, bitrate: %d/%d/%d",
-			   codec.framerate, codec.bitrate, codec.bitrate_peak, codec.bitrate_mode);
-		}
-      	    }
+	    if(read(p_sys->i_fd,&"   ",1))
+	    {
+	        msg_Dbg(p_input, "Could read byte from device");
+	    }
+	    else
+	    {
+	        msg_Warn(p_input, "Could not read byte from device");
+	    }
 	}
-
-      /* do a quick read */
-      if(p_sys->i_fd)
-	{
-	  if(read(p_sys->i_fd,&"   ",1))
-	    {
-	      msg_Dbg(p_input, "Could read byte from device");
-	    }
-	  else
-	    {
-	      msg_Warn(p_input, "Could not read byte from device");
-	    }
-	}
-     return VLC_SUCCESS;
+        return VLC_SUCCESS;
 }

 /*****************************************************************************


m6stat is a static variable (ip6_mroute.c).  sync w/kame

--- netinet6/pim6_var.h
+++ netinet6/pim6_var.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pim6_var.h,v 1.5 2002/03/14 03:16:11 millert Exp $	*/
+/*	$OpenBSD: pim6_var.h,v 1.6 2002/09/23 23:02:08 itojun Exp $	*/
 /*	$KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $	*/

 /*
@@ -52,8 +52,6 @@
 };

 #if (defined(KERNEL)) || (defined(_KERNEL))
-extern struct pim6stat pim6stat;
-
 int pim6_input(struct mbuf **, int *, int);
 #endif /* KERNEL */


make more portable to OpenBSD

make more portable to OpenBSD

--- network/netlocals.c
+++ network/netlocals.c
@@ -33,8 +33,9 @@
 // with too many packets in too short a time) and how long to linger
 // after all the packets have been sent. laggy networks (e.g. wifi) will
 // probably need a longer linger)
-#define SEND_DELAY_MICROSEC 333
-#define LINGER_MICROSEC 333333
+#define SEND_DELAY_MICROSEC 100
+#define LINGER_MICROSEC 100000
+#define POLL_WAIT_MILLISEC 10

 // data for the sender thread
 struct thargs {
@@ -159,9 +160,11 @@
 	switch (sig) {
 	case SIGALRM:
 		Seen_Sig = 1;
+		fprintf(stderr, "ALRM\n");
 		break;
 	case SIGUSR2:
 		Send_Done = 1;
+		fprintf(stderr, "USR2\n");
 		break;
 	}
 }
@@ -222,6 +225,9 @@
 	if (pthread_create(&thsend, NULL, handle_send, (void *) &tharg))
 		err(1, "pthread_create failed");

+	struct itimerval itimer = {0};
+	itimer.it_value.tv_usec = LINGER_MICROSEC;
+
 	while (1) {
 		struct cmsghdr hdr;
 		struct msghdr m;
@@ -231,15 +237,14 @@

 		if (Seen_Sig) break;
 		if (Send_Done) {
-			struct itimerval itimer = {0};
-			itimer.it_value.tv_usec = LINGER_MICROSEC;
+			Send_Done = 0;
 			setitimer(ITIMER_REAL, &itimer, NULL);
 		}

 		pfd.fd     = recvfd;
 		pfd.events = POLLIN;

-		if (poll(&pfd, 1, -1) <= 0) continue;
+		if (poll(&pfd, 1, POLL_WAIT_MILLISEC) <= 0) continue;

 		m.msg_name    = &peer;
 		m.msg_namelen = sizeof(peer);


Adding backwards and passed pawns evaluations

--- src/fast-chess.c
+++ src/fast-chess.c
@@ -745,24 +745,48 @@

 BOOL isDoubledPawn(Bitboard position, int board[]) {
 	char pieceColor = board[bb2index(position)]&COLOR_MASK;
+
 	if (countPieces( getPawns(board)&getColoredPieces(board, pieceColor)&fileFilter(position) ) > 1)
 		return TRUE;
 	return FALSE;
 }

 BOOL isIsolatedPawn(Bitboard position, int board[]) {
-	Bitboard sides = fileFilter(east(position) | west(position));
+	Bitboard sideFiles = fileFilter(east(position) | west(position));
 	char pieceColor = board[bb2index(position)]&COLOR_MASK;
-	if (countPieces( getPawns(board)&getColoredPieces(board, pieceColor)&sides ) == 0)
+
+	if (countPieces( getPawns(board)&getColoredPieces(board, pieceColor)&sideFiles ) == 0)
 		return TRUE;
 	return FALSE;
 }

-BOOL isBackwardsPawn(Bitboard position, int board[]) { // TODO
+BOOL isBackwardsPawn(Bitboard position, int board[]) {
+	Bitboard squaresFilter = east(position) | west(position);
+	char pieceColor = board[bb2index(position)]&COLOR_MASK;
+
+	if ( pieceColor == BLACK ) {
+		squaresFilter |= northRay(squaresFilter);
+	} else {
+		squaresFilter |= southRay(squaresFilter);
+	}
+
+	if (countPieces( getPawns(board)&getColoredPieces(board, pieceColor)&squaresFilter ) == 0)
+		return TRUE;
 	return FALSE;
 }

-BOOL isPassedPawn(Bitboard position, int board[]) { // TODO
+BOOL isPassedPawn(Bitboard position, int board[]) {
+	Bitboard squaresFilter = 0;
+	char pieceColor = board[bb2index(position)]&COLOR_MASK;
+
+	if ( pieceColor == BLACK ) {
+		squaresFilter |= southRay(east(position)) | southRay(west(position)) | southRay(position);
+	} else {
+		squaresFilter |= northRay(east(position)) | northRay(west(position)) | northRay(position);
+	}
+
+	if (countPieces( getPawns(board)&getColoredPieces(board, opposingColor(pieceColor))&squaresFilter ) == 0)
+		return TRUE;
 	return FALSE;
 }

@@ -1415,12 +1439,13 @@

 				if (isDoubledPawn(i, evalBoard))
 					bonus -= DOUBLED_PAWN_PENALTY/2;
+				if (isPassedPawn(i, evalBoard))
+					bonus += PASSED_PAWN_BONUS;
+
 				if (isIsolatedPawn(i, evalBoard))
 					bonus -= ISOLATED_PAWN_PENALTY;
-				if (isBackwardsPawn(i, evalBoard))
+				else if (isBackwardsPawn(i, evalBoard))
 					bonus -= BACKWARDS_PAWN_PENALTY;
-				if (isPassedPawn(i, evalBoard))
-					bonus += PASSED_PAWN_BONUS;

 				break;


UPDATE TO V0.12.5F BETA

UPDATE TO V0.12.5F BETA

--- src/fasterhttp.c
+++ src/fasterhttp.c
@@ -686,7 +686,7 @@
 		len = (long)SSL_read( ssl , b->fill_ptr , 1 ) ;
 	if( len == -1 )
 	{
-		if( errno == EWOULDBLOCK )
+		if( errno == EAGAIN || errno == EWOULDBLOCK )
 			return FASTERHTTP_INFO_NEED_MORE_HTTP_BUFFER;
 		else if( errno == ECONNRESET )
 			return FASTERHTTP_ERROR_TCP_CLOSE;
@@ -1815,6 +1815,8 @@
 {
 	struct HttpBuffer	*b = GetHttpResponseBuffer(e) ;

+	char			*version = NULL ;
+	int			version_len ;
 	char			*p_status_code_s = NULL ;
 	char			*p_status_text = NULL ;

@@ -1823,134 +1825,149 @@
 	if( status_code <= 0 )
 		status_code = HTTP_INTERNAL_SERVER_ERROR ;

-	switch( status_code )
-	{
-		case HTTP_CONTINUE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_CONTINUE_S " " HTTP_CONTINUE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_SWITCHING_PROTOCOL :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_SWITCHING_PROTOCOL_S " " HTTP_SWITCHING_PROTOCOL_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_OK :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_OK_S " " HTTP_OK_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_CREATED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_CREATED_S " " HTTP_CREATED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_ACCEPTED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_ACCEPTED_S " " HTTP_ACCEPTED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_NON_AUTHORITATIVE_INFORMATION :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_NON_AUTHORITATIVE_INFORMATION_S " " HTTP_NON_AUTHORITATIVE_INFORMATION_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_NO_CONTENT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_NO_CONTENT_S " " HTTP_NO_CONTENT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_RESET_CONTENT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_RESET_CONTENT_S " " HTTP_RESET_CONTENT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_PARTIAL_CONTENT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_PARTIAL_CONTENT_S " " HTTP_PARTIAL_CONTENT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_MULTIPLE_CHOICES :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_MULTIPLE_CHOICES_S " " HTTP_MULTIPLE_CHOICES_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_MOVED_PERMANNETLY :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_MOVED_PERMANNETLY_S " " HTTP_MOVED_PERMANNETLY_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_FOUND :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_FOUND_S " " HTTP_FOUND_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_SEE_OTHER :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_SEE_OTHER_S " " HTTP_SEE_OTHER_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_NOT_MODIFIED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_NOT_MODIFIED_S " " HTTP_NOT_MODIFIED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_USE_PROXY :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_USE_PROXY_S " " HTTP_USE_PROXY_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_TEMPORARY_REDIRECT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_TEMPORARY_REDIRECT_S " " HTTP_TEMPORARY_REDIRECT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_BAD_REQUEST :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_BAD_REQUEST_S " " HTTP_BAD_REQUEST_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_UNAUTHORIZED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_UNAUTHORIZED_S " " HTTP_UNAUTHORIZED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_PAYMENT_REQUIRED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_PAYMENT_REQUIRED_S " " HTTP_PAYMENT_REQUIRED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_FORBIDDEN :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_FORBIDDEN_S " " HTTP_FORBIDDEN_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_NOT_FOUND :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_NOT_FOUND_S " " HTTP_NOT_FOUND_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_METHOD_NOT_ALLOWED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_METHOD_NOT_ALLOWED_S " " HTTP_METHOD_NOT_ALLOWED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_NOT_ACCEPTABLE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_NOT_ACCEPTABLE_S " " HTTP_NOT_ACCEPTABLE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_PROXY_AUTHENTICATION_REQUIRED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_PROXY_AUTHENTICATION_REQUIRED_S " " HTTP_PROXY_AUTHENTICATION_REQUIRED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_REQUEST_TIMEOUT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_REQUEST_TIMEOUT_S " " HTTP_REQUEST_TIMEOUT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_CONFLICT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_CONFLICT_S " " HTTP_CONFLICT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_GONE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_GONE_S " " HTTP_GONE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_LENGTH_REQUIRED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_LENGTH_REQUIRED_S " " HTTP_LENGTH_REQUIRED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_PRECONDITION_FAILED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_PRECONDITION_FAILED_S " " HTTP_PRECONDITION_FAILED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_REQUEST_ENTITY_TOO_LARGE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_REQUEST_ENTITY_TOO_LARGE_S " " HTTP_REQUEST_ENTITY_TOO_LARGE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_URI_TOO_LONG :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_URI_TOO_LONG_S " " HTTP_URI_TOO_LONG_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_UNSUPPORTED_MEDIA_TYPE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_UNSUPPORTED_MEDIA_TYPE_S " " HTTP_UNSUPPORTED_MEDIA_TYPE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_REQUESTED_RANGE_NOT_SATISFIABLE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_S " " HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_EXPECTATION_FAILED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_EXPECTATION_FAILED_S " " HTTP_EXPECTATION_FAILED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_INTERNAL_SERVER_ERROR :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_INTERNAL_SERVER_ERROR_S " " HTTP_INTERNAL_SERVER_ERROR_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_NOT_IMPLEMENTED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_NOT_IMPLEMENTED_S " " HTTP_NOT_IMPLEMENTED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_BAD_GATEWAY :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_BAD_GATEWAY_S " " HTTP_BAD_GATEWAY_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_SERVICE_UNAVAILABLE :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_SERVICE_UNAVAILABLE_S " " HTTP_SERVICE_UNAVAILABLE_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_GATEWAY_TIMEOUT :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_GATEWAY_TIMEOUT_S " " HTTP_GATEWAY_TIMEOUT_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		case HTTP_VERSION_NOT_SUPPORTED :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_VERSION_NOT_SUPPORTED_S " " HTTP_VERSION_NOT_SUPPORTED_T HTTP_RETURN_NEWLINE ) ;
-			break;
-		default :
-			nret = StrcpyHttpBuffer( b , HTTP_VERSION_1_1 " " HTTP_INTERNAL_SERVER_ERROR_S " " HTTP_INTERNAL_SERVER_ERROR_T HTTP_RETURN_NEWLINE ) ;
-			break;
-	}
+	version = GetHttpHeaderPtr_VERSION( e , & version_len );
+	if( version == NULL )
+		return -1;
+
+	nret = StrcpyfHttpBuffer( b , "%.*s" , version_len , version ) ;
 	if( nret )
 		return nret;
+
+	switch( status_code )
+	{
+		case HTTP_CONTINUE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_CONTINUE_S " " HTTP_CONTINUE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_SWITCHING_PROTOCOL :
+			nret = StrcatfHttpBuffer( b , " " HTTP_SWITCHING_PROTOCOL_S " " HTTP_SWITCHING_PROTOCOL_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_OK :
+			nret = StrcatfHttpBuffer( b , " " HTTP_OK_S " " HTTP_OK_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_CREATED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_CREATED_S " " HTTP_CREATED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_ACCEPTED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_ACCEPTED_S " " HTTP_ACCEPTED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_NON_AUTHORITATIVE_INFORMATION :
+			nret = StrcatfHttpBuffer( b , " " HTTP_NON_AUTHORITATIVE_INFORMATION_S " " HTTP_NON_AUTHORITATIVE_INFORMATION_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_NO_CONTENT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_NO_CONTENT_S " " HTTP_NO_CONTENT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_RESET_CONTENT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_RESET_CONTENT_S " " HTTP_RESET_CONTENT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_PARTIAL_CONTENT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_PARTIAL_CONTENT_S " " HTTP_PARTIAL_CONTENT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_MULTIPLE_CHOICES :
+			nret = StrcatfHttpBuffer( b , " " HTTP_MULTIPLE_CHOICES_S " " HTTP_MULTIPLE_CHOICES_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_MOVED_PERMANNETLY :
+			nret = StrcatfHttpBuffer( b , " " HTTP_MOVED_PERMANNETLY_S " " HTTP_MOVED_PERMANNETLY_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_FOUND :
+			nret = StrcatfHttpBuffer( b , " " HTTP_FOUND_S " " HTTP_FOUND_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_SEE_OTHER :
+			nret = StrcatfHttpBuffer( b , " " HTTP_SEE_OTHER_S " " HTTP_SEE_OTHER_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_NOT_MODIFIED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_NOT_MODIFIED_S " " HTTP_NOT_MODIFIED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_USE_PROXY :
+			nret = StrcatfHttpBuffer( b , " " HTTP_USE_PROXY_S " " HTTP_USE_PROXY_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_TEMPORARY_REDIRECT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_TEMPORARY_REDIRECT_S " " HTTP_TEMPORARY_REDIRECT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_BAD_REQUEST :
+			nret = StrcatfHttpBuffer( b , " " HTTP_BAD_REQUEST_S " " HTTP_BAD_REQUEST_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_UNAUTHORIZED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_UNAUTHORIZED_S " " HTTP_UNAUTHORIZED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_PAYMENT_REQUIRED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_PAYMENT_REQUIRED_S " " HTTP_PAYMENT_REQUIRED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_FORBIDDEN :
+			nret = StrcatfHttpBuffer( b , " " HTTP_FORBIDDEN_S " " HTTP_FORBIDDEN_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_NOT_FOUND :
+			nret = StrcatfHttpBuffer( b , " " HTTP_NOT_FOUND_S " " HTTP_NOT_FOUND_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_METHOD_NOT_ALLOWED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_METHOD_NOT_ALLOWED_S " " HTTP_METHOD_NOT_ALLOWED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_NOT_ACCEPTABLE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_NOT_ACCEPTABLE_S " " HTTP_NOT_ACCEPTABLE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_PROXY_AUTHENTICATION_REQUIRED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_PROXY_AUTHENTICATION_REQUIRED_S " " HTTP_PROXY_AUTHENTICATION_REQUIRED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_REQUEST_TIMEOUT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_REQUEST_TIMEOUT_S " " HTTP_REQUEST_TIMEOUT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_CONFLICT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_CONFLICT_S " " HTTP_CONFLICT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_GONE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_GONE_S " " HTTP_GONE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_LENGTH_REQUIRED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_LENGTH_REQUIRED_S " " HTTP_LENGTH_REQUIRED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_PRECONDITION_FAILED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_PRECONDITION_FAILED_S " " HTTP_PRECONDITION_FAILED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_REQUEST_ENTITY_TOO_LARGE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_REQUEST_ENTITY_TOO_LARGE_S " " HTTP_REQUEST_ENTITY_TOO_LARGE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_URI_TOO_LONG :
+			nret = StrcatfHttpBuffer( b , " " HTTP_URI_TOO_LONG_S " " HTTP_URI_TOO_LONG_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_UNSUPPORTED_MEDIA_TYPE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_UNSUPPORTED_MEDIA_TYPE_S " " HTTP_UNSUPPORTED_MEDIA_TYPE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_REQUESTED_RANGE_NOT_SATISFIABLE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_S " " HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_EXPECTATION_FAILED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_EXPECTATION_FAILED_S " " HTTP_EXPECTATION_FAILED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_INTERNAL_SERVER_ERROR :
+			nret = StrcatfHttpBuffer( b , " " HTTP_INTERNAL_SERVER_ERROR_S " " HTTP_INTERNAL_SERVER_ERROR_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_NOT_IMPLEMENTED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_NOT_IMPLEMENTED_S " " HTTP_NOT_IMPLEMENTED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_BAD_GATEWAY :
+			nret = StrcatfHttpBuffer( b , " " HTTP_BAD_GATEWAY_S " " HTTP_BAD_GATEWAY_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_SERVICE_UNAVAILABLE :
+			nret = StrcatfHttpBuffer( b , " " HTTP_SERVICE_UNAVAILABLE_S " " HTTP_SERVICE_UNAVAILABLE_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_GATEWAY_TIMEOUT :
+			nret = StrcatfHttpBuffer( b , " " HTTP_GATEWAY_TIMEOUT_S " " HTTP_GATEWAY_TIMEOUT_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		case HTTP_VERSION_NOT_SUPPORTED :
+			nret = StrcatfHttpBuffer( b , " " HTTP_VERSION_NOT_SUPPORTED_S " " HTTP_VERSION_NOT_SUPPORTED_T HTTP_RETURN_NEWLINE ) ;
+			break;
+		default :
+			nret = StrcatfHttpBuffer( b , " " HTTP_INTERNAL_SERVER_ERROR_S " " HTTP_INTERNAL_SERVER_ERROR_T HTTP_RETURN_NEWLINE ) ;
+			break;
+	}
+	if( nret )
+		return nret;
+
+	if( CheckHttpKeepAlive(e) )
+	{
+		nret = StrcatHttpBuffer( b , "Connection: keep-alive" HTTP_RETURN_NEWLINE ) ;
+		if( nret )
+			return nret;
+	}

 	if( format )
 	{
@@ -1971,11 +1988,10 @@

 	if( fill_body_with_status_flag )
 	{
-		nret = StrcatfHttpBuffer( b	, "Content-length: %d%s"
+		nret = StrcatfHttpBuffer( b	, "Content-length: %d" HTTP_RETURN_NEWLINE
+						HTTP_RETURN_NEWLINE
 						"%s"
-						"%s %s"
-						, strlen(p_status_text) , HTTP_RETURN_NEWLINE
-						, HTTP_RETURN_NEWLINE
+						, strlen(p_status_text)
 						, p_status_text
 						) ;
 		if( nret )
@@ -2701,8 +2717,6 @@

 	return 0;
 }
-
-#include "LOGC.h"

 int StrcatfHttpBuffer( struct HttpBuffer *b , char *format , ... )
 {


new mtp device

new mtp device

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

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -912,6 +912,8 @@

 	/* Reported by Stefan Voss <svoss@web.de> to libmtp */
 	{"Trekstor:Vibez 8/12GB",		0x066f, 0x842a, PTP_MTP|PTP_MTP_PROPLIST_WORKS},
+	/* Cristi Magherusan <majeru@gentoo.ro> to libmtp */
+	{"Trekstor:i.Beat sweez 2GB",		0x0402, 0x0611, PTP_MTP|PTP_MTP_PROPLIST_WORKS},

 	{"Disney:MixMax",			0x0aa6, 0x6021, PTP_MTP|PTP_MTP_PROPLIST_WORKS}
 };


fix(examples): Make client_encryption.c clang-analyzer clean

--- examples/encryption/client_encryption.c
+++ examples/encryption/client_encryption.c
@@ -34,7 +34,7 @@
     size_t trustListSize = 0;
     if(argc > MIN_ARGS)
         trustListSize = (size_t)argc-MIN_ARGS;
-    UA_STACKARRAY(UA_ByteString, trustList, trustListSize);
+    UA_STACKARRAY(UA_ByteString, trustList, trustListSize+1);
     for(size_t trustListCount = 0; trustListCount < trustListSize; trustListCount++)
         trustList[trustListCount] = loadFile(argv[trustListCount+4]);


[doc] Document FHSToken

[doc] Document FHSToken

--- FHSTwitterEngine/FHSTwitterEngine.h
+++ FHSTwitterEngine/FHSTwitterEngine.h
@@ -82,8 +82,19 @@
 /** FHSTwitterEngine token object. */
 @interface FHSToken : NSObject

+/**
+ Token key.
+ */
 @property (nonatomic, strong) NSString *key;
+
+/**
+ Token secret.
+ */
 @property (nonatomic, strong) NSString *secret;
+
+/**
+ Token verifier.
+ */
 @property (nonatomic, strong) NSString *verifier;

 /**


g_type_init called, some backends need it

--- test/account-store.c
+++ test/account-store.c
@@ -92,6 +92,7 @@
   gchar *output = NULL;
   gboolean success;

+  g_type_init ();
   g_set_application_name (argv[0]);

   if (argc < 3)


file/keydb: refix windows compilation.

file/keydb: refix windows compilation.

--- src/file/keydb.h
+++ src/file/keydb.h
@@ -1,10 +1,7 @@

 /* encrypted keys */

-static const uint8_t internal_dk_list[][23] = {
-  {
-  },
-};
+static const uint8_t internal_dk_list[][23] = {0};

 static const uint8_t internal_pk_list[][16] = {0};


comment overflow 처리

comment overflow 처리

--- modules/mod_qp/mod_qp2.c
+++ modules/mod_qp/mod_qp2.c
@@ -2664,6 +2664,7 @@
 		vd->relevancy += list->doc_hits[i].hitratio;
 		vd->dochits = &list->doc_hits[i];
 		vd->dochit_cnt++;
+		vd->comment_cnt++;

 		if(rule->type == DOCATTR) {
 			if (sb_run_docattr_get_field_integer_function(vd->docattr,
@@ -2693,6 +2694,7 @@
 		    if(virtual_id == next_virtual_id) {
 				vd->relevancy += list->doc_hits[i].hitratio;
 				vd->dochit_cnt++;
+		        vd->comment_cnt++;
             } else {
                 break;
             }
@@ -3497,13 +3499,13 @@

     for(i = 0; i < g_vdl->cnt; i++) {
 		if(cmt_idx >= COMMENT_LIST_SIZE) {
-			g_vdl->data[i].dochit_cnt = 0;
+			g_vdl->data[i].comment_cnt = 0;
 			warn("over comment max count[%d]", COMMENT_LIST_SIZE);
 		} else {
 			for(j = 0; j < g_vdl->data[i].dochit_cnt && cmt_idx < COMMENT_LIST_SIZE; j++) {
 				get_comment(&g_vdl->data[i].dochits[j], &req->select_list, res->comments[cmt_idx++].s);
 		        if(cmt_idx >= COMMENT_LIST_SIZE) {
-			        g_vdl->data[i].dochit_cnt = j+1;
+			        g_vdl->data[i].comment_cnt = j+1;
 					warn("over comment max count[%d]", COMMENT_LIST_SIZE);
 					break;
 				}


test/io-cancel: fix file mode and user data check

Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@kernel.dk>

--- test/io-cancel.c
+++ test/io-cancel.c
@@ -120,7 +120,7 @@
 			goto err;
 		}
 		if (do_partial && cqe->user_data) {
-			if (!cqe->user_data & 1) {
+			if (!(cqe->user_data & 1)) {
 				if (cqe->res != BS) {
 					fprintf(stderr, "IO %d wasn't cancelled but got error %d\n", (unsigned) cqe->user_data, cqe->res);
 					goto err;
@@ -185,7 +185,7 @@
 	unsigned to_wait;
 	int fd, ret;

-	fd = open(file, O_RDONLY | O_DIRECT);
+	fd = open(file, O_RDWR | O_DIRECT);
 	if (fd < 0) {
 		perror("file open");
 		goto err;


added powershot s2 is

added powershot s2 is

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

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -453,6 +453,7 @@
 	{"Canon:EOS 1D Mark II (PTP mode)",     0x04a9, 0x30ea, PTPBUG_DCIM_WRONG_PARENT},
  	{"Canon:EOS 20D (PTP mode)",            0x04a9, 0x30ec, PTPBUG_DCIM_WRONG_PARENT},
 	{"Canon:EOS 350D (PTP mode)",           0x04a9, 0x30ef, PTPBUG_DCIM_WRONG_PARENT},
+	{"Canon:PowerShot S2 IS (PTP mode)",    0x04a9, 0x30f0, 0},
 	{"Canon:Digital IXUS 700 (PTP mode)",   0x04a9, 0x30f2, 0},
 	{"Canon:PowerShot SD500 (PTP mode)",    0x04a9, 0x30f2, 0},
 	/* Nick Richards <nick@nedrichards.com> */


[plugins] director: working around "private member not used" Clang compiler warning

--- plugins/director/FastCgiProtocol.h
+++ plugins/director/FastCgiProtocol.h
@@ -53,7 +53,7 @@

 struct Record
 {
-private:
+protected:
 	uint8_t version_;
 	uint8_t type_;
 	uint16_t requestId_;
@@ -169,7 +169,7 @@
 /** parses a PARAM stream and reads out name/value paris. */
 class CgiParamStreamReader
 {
-private:
+protected:
 	enum {
 		NAME,
 		VALUE
@@ -196,7 +196,7 @@

 struct UnknownTypeRecord : public Record
 {
-private:
+protected:
 	uint8_t unknownType_;
 	uint8_t reserved_[7];


filereader gets track metadata

filereader gets track metadata

dispatches a new track message

--- src/filereader.c
+++ src/filereader.c
@@ -81,15 +81,20 @@
   return bfromcstr("");
 }

-void debug_ov(OggVorbis_File *vf) {
-  char **ptr=ov_comment(vf,-1)->user_comments;
-  vorbis_info *vi=ov_info(vf,-1);
-  while(*ptr){
-    fprintf(stderr,"%s\n",*ptr);
+TrackInfo *get_track_info(OggVorbis_File *vf) {
+  char **ptr = ov_comment(vf, -1)->user_comments;
+  bstring artist;
+  bstring title;
+  while(*ptr) {
+    if (strncmp(*ptr, "ARTIST", strlen("ARTIST")) == 0) {
+      artist = bfromcstr(*ptr);
+    } else if (strncmp(*ptr, "TITLE", strlen("TITLE")) == 0) {
+      title = bfromcstr(*ptr);
+    }
     ++ptr;
   }
-  fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
-  fprintf(stderr,"Encoded by: %s\n\n",ov_comment(vf,-1)->vendor);
+  TrackInfo *track_info = track_info_create(artist, title);
+  return track_info;
 }

 int ov_channels(OggVorbis_File *vf) {
@@ -107,6 +112,7 @@
   AudioBuffer *out_audio = NULL;
   Message *out_message = NULL;
   long read_amount = 0;
+  TrackInfo *track_info = NULL;

   srand(time(NULL));

@@ -140,7 +146,6 @@
       check_mem(vf);

       int ovopen_err = ov_fopen(bdata(newfile), vf);
-      log_info("done");
       if (ovopen_err) {
         log_err("FileReader: Could not open input file. Trying another");
         opened = false;
@@ -156,8 +161,11 @@
         continue;
       }
       opened = true;
-      log_info("Debugging file");
-      debug_ov(vf);
+      track_info = get_track_info(vf);
+      out_message = new_track_message(track_info);
+      check(out_message != NULL,
+            "FileReader: Could not create track info message");
+      rb_push(info->audio_out, out_message);
       bdestroy(newfile);

     } else if (!rb_full(info->audio_out)) {


limit osdqueue size

limit osdqueue size

--- FirmwareManager/src/task/FPGATask.h
+++ FirmwareManager/src/task/FPGATask.h
@@ -21,6 +21,8 @@

 #define NBP_STATE_RESET 31
 #define NBP_STATE_CHECK 63
+#define MAX_OSD_QUEUE_SIZE 4
+#define MAX_RW_QUEUE_SIZE 256

 typedef std::function<void(uint16_t controller_data, bool isRepeat)> FPGAEventHandlerFunction;
 typedef std::function<void(uint8_t shiftcode, uint8_t chardata, bool isRepeat)> FPGAKeyboardHandlerFunction;
@@ -109,6 +111,16 @@
             data.left = len;
             data.localAddress = data.row * 40 + data.column;
             data.handler = handler;
+            if (osdqueue.size() > MAX_OSD_QUEUE_SIZE) {
+                //DEBUG2("osdqueue.size() exceeded: %d\n", osdqueue.size());
+                osddata_t &data = osdqueue.front();
+                // handle as if osd write was already done
+                free(data.charData); data.charData = NULL;
+                if (data.handler != NULL) {
+                    data.handler();
+                }
+                osdqueue.pop();
+            }
             osdqueue.push(data);
         }

@@ -121,6 +133,10 @@
             data.address = address;
             data.value = value;
             data.handler = handler;
+            if (writequeue.size() > MAX_RW_QUEUE_SIZE) {
+                DEBUG2("writequeue.size() exceeded: %d\n", writequeue.size());
+                writequeue.pop();
+            }
             writequeue.push(data);
         }

@@ -129,6 +145,10 @@
             data.address = address;
             data.len = len;
             data.handler = handler;
+            if (readqueue.size() > MAX_RW_QUEUE_SIZE) {
+                DEBUG2("readqueue.size() exceeded: %d\n", readqueue.size());
+                readqueue.pop();
+            }
             readqueue.push(data);
         }


fix include

fix include

--- CppImport/src/macro/MacroExpansion.h
+++ CppImport/src/macro/MacroExpansion.h
@@ -28,7 +28,7 @@

 #include "cppimport_api.h"

-#include <OOModel/src/expressions/MetaCallExpression.h>
+#include "OOModel/src/expressions/MetaCallExpression.h"

 namespace CppImport {


Flapjack: Enable link time optimization

Flapjack: Enable link time optimization

Signed-off-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>

BUG=b/129746223,b/127720872
BRANCH=none
TEST=buildall

Change-Id: Idb2940893598f87add54c378bbf6573bb19f2dc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663261
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Commit-Queue: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Tested-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Auto-Submit: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>

--- board/flapjack/board.h
+++ board/flapjack/board.h
@@ -58,7 +58,7 @@
 /* By default, set hcdebug to off */
 #undef CONFIG_HOSTCMD_DEBUG_MODE
 #define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-#undef CONFIG_LTO
+#define CONFIG_LTO
 #define CONFIG_POWER_BUTTON
 #define CONFIG_POWER_BUTTON_IGNORE_LID
 #define CONFIG_POWER_TRACK_HOST_SLEEP_STATE


mime type updates for new MTP format codes

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

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -835,7 +835,7 @@
 	{PTP_OFC_MP3,		"audio/mpeg"},
 	{PTP_OFC_AVI,		GP_MIME_AVI},
 	{PTP_OFC_MPEG,		"video/mpeg"},
-	{PTP_OFC_ASF,		"video/x-asf"},
+	{PTP_OFC_ASF,		"video/x-ms-asf"},
 	{PTP_OFC_QT,		"video/quicktime"},
 	{PTP_OFC_EXIF_JPEG,	GP_MIME_JPEG},
 	{PTP_OFC_TIFF_EP,	"image/x-tiffep"},
@@ -853,6 +853,23 @@
 	{PTP_OFC_TIFF_IT,	"image/x-tiffit"},
 	{PTP_OFC_JP2,		"image/x-jpeg2000bff"},
 	{PTP_OFC_JPX,		"image/x-jpeg2000eff"},
+	{PTP_OFC_MTP_OGG,	"application/ogg"},
+	{PTP_OFC_MTP_FLAC,	"audio/x-flac"},
+	{PTP_OFC_MTP_MP2,	"video/mpeg"},
+	{PTP_OFC_MTP_M4A,	"audio/x-m4a"},
+	{PTP_OFC_MTP_MP4,	"video/mp4"},
+	{PTP_OFC_MTP_3GP,	"audio/3gpp"},
+	{PTP_OFC_MTP_WMV,	"video/x-ms-wmv"},
+	{PTP_OFC_MTP_WMA,	"audio/x-ms-wma"},
+	{PTP_OFC_MTP_AAC,	"audio/MP4A-LATM"},
+	{PTP_OFC_MTP_XMLDocument, "text/xml"},
+	{PTP_OFC_MTP_MSWordDocument, "application/msword"},
+	{PTP_OFC_MTP_MSExcelSpreadsheetXLS, "vnd.ms-excel"},
+	{PTP_OFC_MTP_MSPowerpointPresentationPPT, "vnd.ms-powerpoint"},
+	{PTP_OFC_MTP_vCard2, "text/directory"},
+	{PTP_OFC_MTP_vCard3, "text/directory"},
+	{PTP_OFC_MTP_vCalendar1, "text/calendar"},
+	{PTP_OFC_MTP_vCalendar2, "text/calendar"},
 	{0,			NULL}
 };


Fix compiling for Android.

Fix compiling for Android.

Patch from Janne Hyvärinen <cse@sci.fi>.

--- src/flac/utils.c
+++ src/flac/utils.c
@@ -171,13 +171,13 @@
 int get_console_width(void)
 {
 	int width = 80;
-#ifdef _WIN32
+#if defined _WIN32
 	width = win_get_console_width();
 #elif defined __EMX__
-        int s[2];
-        _scrsize (s);
-        width = s[0];
-#else
+	int s[2];
+	_scrsize (s);
+	width = s[0];
+#elif !defined __ANDROID__
 	struct winsize w;
 	if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1)	width = w.ws_col;
 #endif


Homestar: set TCPC product id as PS8805

Homestar: set TCPC product id as PS8805

Homestar will only support TCPC PS8805, set the product id to PS8805
directly.

BRANCH=trogdor
BUG=b:194737342
TEST=emerge-strongbad chromeos-ec

Change-Id: Iea9f12ddaa4dffb73d9f40f23b66af826225642e
Signed-off-by: xuxinxiong <536c7d28797b6891fd85a905f18e564398d3473c@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054221
Reviewed-by: Mike Lee <255a368def86bc53ab15e64f578878686d4eb313@huaqin.corp-partner.google.com>
Reviewed-by: Bob Moragues <f5049d5b5df4f96d121308a63d9e3c0dfa5ed2dc@chromium.org>
Reviewed-by: Wai-Hong Tam <04b587fdf5845741a0c5a8b9cd59ca72d73ef8fc@google.com>
Reviewed-by: Philip Chen <3ee404f9ef892bc3fda6e6a76e65843b5fa44db2@chromium.org>
Commit-Queue: Bob Moragues <f5049d5b5df4f96d121308a63d9e3c0dfa5ed2dc@chromium.org>

--- board/homestar/board.c
+++ board/homestar/board.c
@@ -450,11 +450,7 @@

 __overridable uint16_t board_get_ps8xxx_product_id(int port)
 {
-	/* Coachz board rev 2+ changes TCPC from 8805 to 8755*/
-	if (system_get_board_version() < 2)
-		return PS8805_PRODUCT_ID;
-
-	return PS8755_PRODUCT_ID;
+	return PS8805_PRODUCT_ID;
 }

 void board_tcpc_init(void)


Fixed iocon incorrect definition

Fixed iocon incorrect definition


Fix/accescontrol default (#1113)

Fix/accescontrol default (#1113)

* Fixed mismatching function declaration and the resulting build error

* Fix #1112

--- plugins/ua_accesscontrol_default.c
+++ plugins/ua_accesscontrol_default.c
@@ -56,7 +56,7 @@
        &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]) {
         const UA_UserNameIdentityToken *token =
             (UA_UserNameIdentityToken*)userIdentityToken->content.decoded.data;
-        if(!UA_String_equal(&token->policyId, &username_policy))
+        if(!UA_String_equal(&token->policyId, &username_policy) || token->encryptionAlgorithm.length > 0)
             return UA_STATUSCODE_BADIDENTITYTOKENINVALID;

         /* Empty username and password */


GCC export fixes

GCC export fixes

--- interface/ogre_interface.h
+++ interface/ogre_interface.h
@@ -29,11 +29,15 @@
 #			define DLL extern "C" __declspec(dllexport)
 #		endif
 #	else
-#		if defined( __GNUC__ ) && __GNUC__ >= 4
-#			define DLL __attribute__ ((visibility("default")))
-#		else
-#			define DLL
-#		endif
+#       ifndef OgreInterface_EXPORTS
+#           define DLL
+#       else
+#           if defined( __GNUC__ ) && __GNUC__ >= 4
+#               define DLL extern "C" __attribute__ ((visibility("default")))
+#           else
+#               define DLL extern "C"
+#           endif
+#       endif
 #	endif
 #else
 #	define DLL


added a fuji and a new sony

added a fuji and a new sony

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

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -482,6 +482,8 @@
 	{"Sony:DSC-U10 (PTP mode)",   0x054c, 0x004e, 0},
 	/* new id?! Reported by Ruediger Oertel. */
 	{"Sony:DSC-W200 (PTP mode)",  0x054c, 0x02f8, 0},
+	/* http://sourceforge.net/tracker/index.php?func=detail&aid=1946931&group_id=8874&atid=308874 */
+	{"Sony:DSC-W130 (PTP mode)",  0x054c, 0x0343, 0},

 	/* Nikon Coolpix 2500: M. Meissner, 05 Oct 2003 */
 	{"Nikon:Coolpix 2500 (PTP mode)", 0x04b0, 0x0109, 0},
@@ -815,6 +817,8 @@
 	{"Fuji:FinePix A800",			0x04cb, 0x01d2, 0},
 	/* Teppo Jalava <tjjalava@gmail.com> */
 	{"Fuji:FinePix F50fd",			0x04cb, 0x01d4, 0},
+	/* https://sourceforge.net/tracker/?func=detail&atid=108874&aid=1945259&group_id=8874 */
+	{"Fuji:FinePix Z100fd",			0x04cb, 0x01d8, 0},

 	{"Ricoh:Caplio R5 (PTP mode)",          0x05ca, 0x0110, 0},
 	{"Ricoh:Caplio GX (PTP mode)",          0x05ca, 0x0325, 0},


Olivier forgot to update this file

Olivier forgot to update this file

--- poedit/src/resources/xrc_strings.h
+++ poedit/src/resources/xrc_strings.h
@@ -11,6 +11,7 @@
 _("String to find:");
 _("Case sensitive");
 _("Start from the first item");
+_("Whole words only");
 _("Find in original strings");
 _("Find in translations");
 _("Find in comments");


added nikon coolpix l20

added nikon coolpix l20

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

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -677,6 +677,8 @@
 	{"Nikon:Coolpix P60 (PTP mode)",  0x04b0, 0x0311, PTP_CAP|PTP_NIKON_BROKEN_CAP},
 	/* Stas Timokhin <st@ngs.ru> */
 	{"Nikon:Coolpix L16 (PTP mode)",  0x04b0, 0x0315, PTP_CAP|PTP_NIKON_BROKEN_CAP},
+	/* https://sourceforge.net/tracker/index.php?func=detail&aid=2977303&group_id=8874&atid=358874 */
+	{"Nikon:Coolpix L20 (PTP mode)",  0x04b0, 0x0317, PTP_CAP|PTP_NIKON_BROKEN_CAP},
 	/* https://sourceforge.net/tracker/index.php?func=detail&aid=2947644&group_id=8874&atid=108874 */
 	{"Nikon:Coolpix L19 (PTP mode)",  0x04b0, 0x0318, PTP_CAP|PTP_NIKON_BROKEN_CAP},
 	/* Nikon D100 has a PTP mode: westin 2002.10.16 */


plugin: add support for config format

plugin: add support for config format

Signed-off-by: Eduardo Silva <81f705dc2ce1a61a2621e0e4b442a9474e1d0c70@calyptia.com>

--- src/flb_plugin.c
+++ src/flb_plugin.c
@@ -23,6 +23,8 @@
 #include <fluent-bit/flb_mem.h>
 #include <fluent-bit/flb_log.h>
 #include <fluent-bit/flb_error.h>
+#include <fluent-bit/flb_kv.h>
+#include <fluent-bit/flb_config_format.h>
 #include <fluent-bit/flb_utils.h>
 #include <fluent-bit/flb_plugin.h>
 #include <fluent-bit/flb_plugin_proxy.h>
@@ -327,12 +329,12 @@
     int ret;
     char tmp[PATH_MAX + 1];
     const char *cfg = NULL;
-    struct mk_rconf *fconf;
-    struct mk_rconf_section *section;
-    struct mk_rconf_entry *entry;
     struct mk_list *head;
     struct mk_list *head_e;
     struct stat st;
+    struct flb_cf *cf;
+    struct flb_cf_section *section;
+    struct flb_kv *entry;

 #ifndef FLB_HAVE_STATIC_CONF
     ret = stat(file, &st);
@@ -353,38 +355,39 @@
     }

     flb_debug("[plugin] opening configuration file %s", cfg);
-    fconf = mk_rconf_open(cfg);
+
+    cf = flb_cf_create_from_file(NULL, cfg);
 #else
-    fconf = flb_config_static_open(file);
+    cf = flb_config_static_open(file);
 #endif

-    if (!fconf) {
-        return -1;
-    }
-
-    /* Read all [PLUGINS] sections */
-    mk_list_foreach(head, &fconf->sections) {
-        section = mk_list_entry(head, struct mk_rconf_section, _head);
-        if (strcasecmp(section->name, "PLUGINS") != 0) {
+    if (!cf) {
+        return -1;
+    }
+
+    /* read all 'plugins' sections */
+    mk_list_foreach(head, &cf->sections) {
+        section = mk_list_entry(head, struct flb_cf_section, _head);
+        if (strcasecmp(section->name, "plugins") != 0) {
             continue;
         }

-        mk_list_foreach(head_e, &section->entries) {
-            entry = mk_list_entry(head_e, struct mk_rconf_entry, _head);
-            if (strcasecmp(entry->key, "Path") != 0) {
+        mk_list_foreach(head_e, &section->properties) {
+            entry = mk_list_entry(head_e, struct flb_kv, _head);
+            if (strcasecmp(entry->key, "path") != 0) {
                 continue;
             }

             /* Load plugin with router function */
             ret = flb_plugin_load_router(entry->val, config);
             if (ret == -1) {
-                mk_rconf_free(fconf);
+                flb_cf_destroy(cf);
                 return -1;
             }
         }
     }

-    mk_rconf_free(fconf);
+    flb_cf_destroy(cf);
     return 0;
 }


add running seconds to thermal log

add running seconds to thermal log

git-svn-id: 97ee0374337b904e4860f9ce78362f550003d14d@12047 db81c003-b5ea-0310-aa99-ed7f6e1db739

--- modules/thermalmanager.c
+++ modules/thermalmanager.c
@@ -447,9 +447,17 @@
       }
   }

+  int now = time(0);
+  static int start_time = 0;
+
+  if (!start_time) {
+      start_time = now;
+  }
+
   fprintf(log_file,
-          "%d %d %s\n",
-          (int)time(0),
+          "%d %d %d %s\n",
+          now,
+          now - start_time,
           temperature,
           status_string(thermal_object->status));
   fflush(log_file);


libmetrics: freebsd: avoid unitialized values and spurious casts

if the system uses a smaller buffer than the one suggested the frequency will
return randomly high values

--- libmetrics/freebsd/metrics.c
+++ libmetrics/freebsd/metrics.c
@@ -204,9 +204,10 @@
     * machdep.tsc_freq exists on some i386/amd64 machines and gives the
     * CPU speed in Hz.  If it exists it's a decent value.
     */
+   tscfreq = 0;
    len = sizeof(tscfreq);
    if (sysctlbyname("machdep.tsc_freq", &tscfreq, &len, NULL, 0) != -1) {
-      freq = (double)tscfreq / 1e6;
+      freq = tscfreq / 1e6;
       goto done;
    }


Changed log format.

Changed log format.

--- test/parseklog.c
+++ test/parseklog.c
@@ -162,6 +162,7 @@
 struct shmat_retvals {
 	int    call;
 	u_long size;
+	u_long raddr;
 };

 struct set_thread_area_retvals {
@@ -172,6 +173,11 @@
 	u_long          dev;
 	u_long          ino;
 	struct timespec mtime;
+};
+
+struct splice_retvals {
+	loff_t off_in;
+	loff_t off_out;
 };

 u_long scount[512];
@@ -504,7 +510,19 @@
 				case 209: size = (psr.retval >= 0) ? (sizeof(uid_t)*3) : 0; break;
 				case 211: size = (psr.retval >= 0) ? sizeof(gid_t)*3 : 0; break;
 				case 220: size = psr.retval; break;
-				case 221: size = sizeof(struct flock64); break;
+				case 221: {
+					int val;
+					rc = read (fd, &val, sizeof(int));
+					if (rc != sizeof(int)) {
+						printf ("cannot read fcntl64 value\n");
+						return rc;
+					}
+					if (stats) {
+						bytes[psr.sysnum] += sizeof(int);
+					}
+					size = val - sizeof(int);
+					break;
+				}
 				case 229: size = (psr.retval > 0) ? psr.retval : 0; break;
 				case 230: size = (psr.retval > 0) ? psr.retval : 0; break;
 				case 239: size = sizeof(struct sendfile64_retvals); break;
@@ -513,7 +531,9 @@
 				case 265: size = sizeof(struct timespec); break;
 				case 266: size = sizeof(struct timespec); break;
 				case 268: size = 84; break; /* statfs 64 */
+				case 269: size = 84; break; /* statfs 64 */
 				case 300: size = sizeof(struct stat64); break;
+				case 313: size = sizeof(struct splice_retvals); break;
 			        case 340: size = sizeof(struct rlimit64); break;
 				default:
 					size = 0;


test/generate_test: add standard CLooG macros to output

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

--- test/generate_test.c
+++ test/generate_test.c
@@ -56,6 +56,17 @@
 ;

 static const char *call[] = {"good", "test"};
+
+static void print_macros(FILE *file)
+{
+	fprintf(file, "/* Useful macros. */\n") ;
+	fprintf(file,
+	    "#define floord(n,d) (((n)<0) ? -((-(n)+(d)-1)/(d)) : (n)/(d))\n");
+	fprintf(file,
+	    "#define ceild(n,d) (((n)<0) ? -((-(n))/(d)) : ((n)+(d)-1)/(d))\n");
+	fprintf(file, "#define max(x,y)    ((x) > (y) ? (x) : (y))\n") ;
+	fprintf(file, "#define min(x,y)    ((x) < (y) ? (x) : (y))\n\n") ;
+}

 int main()
 {
@@ -128,6 +139,7 @@
 	}
 	printf(" assert(h_good == h_test);");
 	printf(" } while (0)\n");
+	print_macros(stdout);
 	cloog_program_pprint(stdout, p, options);
 	printf("%s", postamble);


added ixus 120 is alias

added ixus 120 is alias

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

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -1017,6 +1017,7 @@
 	{"Canon:PowerShot SX20 IS",		0x04a9, 0x31e4, PTPBUG_DELETE_SENDS_EVENT},
 	/* http://sourceforge.net/tracker/index.php?func=detail&aid=2918540&group_id=8874&atid=358874 */
 	{"Canon:IXY 220 IS",			0x04a9, 0x31e6, PTPBUG_DELETE_SENDS_EVENT},
+	{"Canon:Digital IXUS 120 IS",		0x04a9, 0x31e6, PTPBUG_DELETE_SENDS_EVENT},
 	{"Canon:PowerShot SD940 IS",		0x04a9, 0x31e6, PTPBUG_DELETE_SENDS_EVENT},

 	/* Konica-Minolta PTP cameras */


for the changes done to file_handler.c

for the changes done to file_handler.c

git-svn-id: fbb392d5347ebc45c06187f72dfd8bab02595dbf@374621 13f79535-47bb-0310-9956-ffa450edef68

--- modules/util/file_diff.c
+++ modules/util/file_diff.c
@@ -32,9 +32,9 @@
     int j = 0, k = 0;
    	axis2_char_t *buffer1, *buffer2;
    	int flag1 = 0, flag2 = 0;
-	expected_file = axis2_file_handler_open(expected_file_name,"rt", &env);
+	expected_file = axis2_file_handler_open(expected_file_name,"rt");

-	actual_file = axis2_file_handler_open(actual_file_name,"rt", &env);
+	actual_file = axis2_file_handler_open(actual_file_name,"rt");

 	if( expected_file == NULL || actual_file == NULL ) {
 		/*printf("Unable to open one of datafile %s, %s\n", expected_file_name


gabble_ft_manager_handle_si_request: initialize the struct tm

Thanks strptime...

--- src/ft-manager.c
+++ src/ft-manager.c
@@ -538,6 +538,8 @@
     {
       struct tm tm;

+      memset (&tm, 0, sizeof (struct tm));
+
       /* FIXME: this assume the timezone is always UTC */
       if (strptime (date_str, "%FT%H:%M:%SZ", &tm) != NULL)
         date = (guint64) mktime (&tm);


ports/nrf/modules/music: Removing initialization of softpwm and ticker upon music module load. Updating microbit_music_init0 to register low priority ticker callback for the music module.

--- ports/nrf/modules/music/modmusic.c
+++ ports/nrf/modules/music/modmusic.c
@@ -77,10 +77,7 @@
 STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin);

 void microbit_music_init0(void) {
-    softpwm_init();
-    ticker_init(microbit_music_tick);
-    ticker_start();
-    pwm_start();
+    ticker_register_low_pri_callback(microbit_music_tick);
 }

 void microbit_music_tick(void) {
@@ -460,8 +457,6 @@

 static mp_obj_t music_init(void) {
-    microbit_music_init0();
-
     music_data = m_new_obj(music_data_t);
     music_data->bpm = DEFAULT_BPM;
     music_data->ticks = DEFAULT_TICKS;


Move arch_perfAnalyze outside of for loop

--- linux/arch.c
+++ linux/arch.c
@@ -276,7 +276,6 @@
             continue;
         }
         if (pid == -1 && errno == ECHILD) {
-            arch_perfAnalyze(hfuzz, fuzzer, perfFd);
             LOGMSG(l_DEBUG, "No more processes to track");
             break;
         }
@@ -294,7 +293,6 @@
             continue;
         }
         if (pid == childPid && (WIFEXITED(status) || WIFSIGNALED(status))) {
-            arch_perfAnalyze(hfuzz, fuzzer, perfFd);
             break;
         }
         if (pid == childPid) {
@@ -304,6 +302,7 @@
         arch_ptraceAnalyze(hfuzz, status, pid, fuzzer);
     }
     arch_removeTimer(&timerid);
+    arch_perfAnalyze(hfuzz, fuzzer, perfFd);
     return;
 }


Disconnect client on string read error, incorrect protocol, and incorrect protocol version.

--- library/read_handle_server.c
+++ library/read_handle_server.c
@@ -25,17 +25,21 @@
 	if(mqtt3_read_remaining_length(context, &remaining_length)) return 1;
 	if(mqtt3_read_string(context, &protocol_name)) return 1;
 	if(!protocol_name){
+		mqtt3_cleanup_context(context);
 		return 3;
 	}
 	if(strcmp(protocol_name, PROTOCOL_NAME)){
 		free(protocol_name);
+		mqtt3_cleanup_context(context);
 		return 1;
 	}
 	if(mqtt3_read_byte(context, &protocol_version)) return 1;
 	if(protocol_version != PROTOCOL_VERSION){
 		free(protocol_name);
 		// FIXME - should disconnect as well
-		return mqtt3_raw_connack(context, 1);
+		mqtt3_raw_connack(context, 1);
+		mqtt3_cleanup_context(context);
+		return 1;
 	}

 	printf("Received CONNECT for protocol %s version %d\n", protocol_name, protocol_version);


also add sony qx capture to trigger capture

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -5839,6 +5839,52 @@

 		return GP_OK;
 	}
+
+	/* Sony QX */
+	if (	(params->deviceinfo.VendorExtensionID == PTP_VENDOR_SONY) &&
+		ptp_operation_issupported(params, PTP_OC_SONY_QX_SetControlDeviceB)
+	) {
+		PTPPropertyValue	propval;
+		struct timeval		event_start;
+		PTPContainer		event;
+		PTPDevicePropDesc	dpd;
+
+		/* half-press */
+		propval.u16 = 2;
+		C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_QX_AutoFocus, &propval, PTP_DTC_UINT16));
+
+		/* full-press */
+		propval.u16 = 2;
+		C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_QX_Capture, &propval, PTP_DTC_UINT16));
+
+			GP_LOG_D ("holding down shutterbutton for 2 seconds");
+			event_start = time_now();
+			do {
+				/* needed on older cameras like the a58, check for events ... */
+				C_PTP (ptp_check_event (params));
+				if (ptp_get_one_event(params, &event)) {
+					GP_LOG_D ("during event.code=%04x Param1=%08x", event.Code, event.Param1);
+				}
+
+				/* Alternative code in case we miss the event */
+
+				C_PTP (ptp_sony_qx_getalldevicepropdesc (params)); /* avoid caching */
+				C_PTP (ptp_generic_getdevicepropdesc (params, PTP_DPC_SONY_FocusFound, &dpd));
+			} while (time_since (event_start) < 2000);
+
+		GP_LOG_D ("releasing shutterbutton");
+
+		/* release full-press */
+		propval.u16 = 1;
+		C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_QX_Capture, &propval, PTP_DTC_UINT16));
+
+		/* release half-press */
+		propval.u16 = 1;
+		C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_QX_AutoFocus, &propval, PTP_DTC_UINT16));
+
+		return GP_OK;
+	}
+
 	if (	(params->deviceinfo.VendorExtensionID == PTP_VENDOR_FUJI) &&
 		ptp_operation_issupported(params, PTP_OC_InitiateCapture)
 	) {


linux: fix arch_perfInit if Intel PT is not available

If files_readFileToBufMax returns -1 then perfIntel(Pt|Bts)PerfType
was set to something based on uninitialized memory.
(After a stack buffer underflow happened)

--- linux/perf.c
+++ linux/perf.c
@@ -347,7 +347,7 @@
 bool arch_perfInit(honggfuzz_t * hfuzz UNUSED)
 {
     uint8_t buf[PATH_MAX + 1];
-    size_t sz =
+    ssize_t sz =
         files_readFileToBufMax("/sys/bus/event_source/devices/intel_pt/type", buf, sizeof(buf) - 1);
     if (sz > 0) {
         buf[sz] = '\0';


baseparse: try first frame pts and dts for a valid start timestamp

--- libs/gst/base/gstbaseparse.c
+++ libs/gst/base/gstbaseparse.c
@@ -3885,6 +3885,9 @@
   /* need initial positions; start and end */
   lpos = parse->priv->first_frame_offset;
   ltime = parse->priv->first_frame_pts;
+  /* try other one if no luck */
+  if (!GST_CLOCK_TIME_IS_VALID (ltime))
+    ltime = parse->priv->first_frame_dts;
   if (!gst_base_parse_get_duration (parse, GST_FORMAT_TIME, &htime)) {
     GST_DEBUG_OBJECT (parse, "Unknown time duration, cannot bisect");
     return GST_FLOW_ERROR;


Use the correct word.

Use the correct word.

--- bin/varnishd/cache/cache_req_fsm.c
+++ bin/varnishd/cache/cache_req_fsm.c
@@ -454,7 +454,7 @@
 			 * like a pass
 			 */
 			VSLb(req->vsl, SLT_VCL_Error,
-			    "vcl_hit{} returns fetch without busy object."
+			    "vcl_hit{} returns miss without busy object."
 			    "  Doing pass.");
 			req->req_step = R_STP_PASS;
 		}


trivial: Print the fingerprint of the sig used for verification

--- src/fu-keyring.c
+++ src/fu-keyring.c
@@ -322,6 +322,7 @@

 	/* look at each signature */
 	for (s = result->signatures; s != NULL ; s = s->next ) {
+		g_debug ("returned signature fingerprint %s", s->fpr);
 		ret = fu_keyring_check_signature (s, error);
 		if (!ret)
 			goto out;
@@ -411,6 +412,7 @@

 	/* look at each signature */
 	for (s = result->signatures; s != NULL ; s = s->next ) {
+		g_debug ("returned signature fingerprint %s", s->fpr);
 		ret = fu_keyring_check_signature (s, error);
 		if (!ret)
 			goto out;


dfbtest_layer: Call Flip after SetSourceRectangle

--- tests/dfbtest_layer.c
+++ tests/dfbtest_layer.c
@@ -153,6 +153,7 @@

           layer->SetSourceRectangle( layer, x, y, size.w - sw3, size.h - sh3 );

+          surface->Flip( surface, NULL, DSFLIP_UPDATE );

           if (dx > 0) {
                if (x == size.w/3) {


Added new marker which indicates start of new segment in case of long-lasting events in order to properly set timestamp on event packets

--- libs/mpf/include/mpf_frame.h
+++ libs/mpf/include/mpf_frame.h
@@ -40,6 +40,7 @@
 	MPF_MARKER_NONE,           /**< none */
 	MPF_MARKER_START_OF_EVENT, /**< start of event */
 	MPF_MARKER_END_OF_EVENT,   /**< end of event */
+	MPF_MARKER_NEW_SEGMENT,    /**< start of new segment (long-lasting events) */
 } mpf_frame_marker_e;

 /** Media frame declaration */


tests/epoll_create1.c: use libtests

tests/epoll_create1.c: use libtests

* tests/epoll_create1.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert and perror_msg_and_skip.

--- tests/epoll_create1.c
+++ tests/epoll_create1.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,19 +26,25 @@
  */

 #include "tests.h"
+#include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/syscall.h>

+#if defined __NR_epoll_create1 && defined O_CLOEXEC
+
 int
 main(void)
 {
-#if defined __NR_epoll_create1 && defined O_CLOEXEC
 	(void) close(0);
 	if (syscall(__NR_epoll_create1, O_CLOEXEC))
-		return 77;
-	return syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) >= 0;
+		perror_msg_and_skip("epoll_create1 O_CLOEXEC");
+	assert(syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) == -1);
+	return 0;
+}
+
 #else
-        return 77;
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_create1 && O_CLOEXEC")
+
 #endif
-}


base64.c: #include "config.h"

base64.c: #include "config.h"

darcs-hash:20060925182121-65a35-5fa570c12267413a0d4177a05aace33daccf9093.gz

--- libsofia-sip-ua/ipt/base64.c
+++ libsofia-sip-ua/ipt/base64.c
@@ -29,6 +29,8 @@
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  */
+
+#include "config.h"

 #include <stdio.h>
 #include <string.h>


Fixed errors in stunc command-line usage.

darcs-hash:20060711230656-7659e-169aa81a5907518b84c969aec0561151165b9aea.gz

--- libsofia-sip-ua/stun/stunc.c
+++ libsofia-sip-ua/stun/stunc.c
@@ -162,8 +162,8 @@
 	  "  -b\tmake a binding request\n"
 	  "  -l\tperform NAT lifetime check\n"
 	  "  -n\tperform NAT type check\n"
+	  "  -r\trandomize the local port",
 	  "  -s\trequest shared-secret over TLS (combined with -[bln])\n"
-	  "  -l\tperform NAT type check (combined with -[bln]\n",
 	  SOFIA_SIP_NAME_VERSION, name);
   exit(1);
 }


removed OSX specific code from su_wait.c

darcs-hash:20060928154457-1b897-6bf2e1ad4902c07dea33166a9e68458508547098.gz

--- libsofia-sip-ua/su/su_wait.c
+++ libsofia-sip-ua/su/su_wait.c
@@ -140,9 +140,7 @@

   *newwait = h;

-#elif SU_HAVE_OSX_CF_API
-  CFSocketRef cf_socket;
-  CFRunLoopRef rl = CFRunLoopGetCurrent();
+#elif SU_HAVE_POLL

   if (newwait == NULL || events == 0 || socket == INVALID_SOCKET) {
     su_seterrno(EINVAL);
@@ -152,28 +150,6 @@
   newwait->fd = socket;
   newwait->events = events;
   newwait->revents = 0;
-
-  cf_socket = CFSocketCreateWithNative(kCFAllocatorDefault,
-				       (CFSocketNativeHandle) socket,
-				       events,
-				       NULL, NULL);
-
-  newwait->w_source =
-    CFSocketCreateRunLoopSource(kCFAllocatorDefault, cf_socket, 0);
-
-  /* XXX -- mela: shall we do this already here? */
-  CFRunLoopAddSource(rl, newwait->w_source, kCFRunLoopDefaultMode);
-
-#elif SU_HAVE_POLL
-
-  if (newwait == NULL || events == 0 || socket == INVALID_SOCKET) {
-    su_seterrno(EINVAL);
-    return -1;
-  }
-
-  newwait->fd = socket;
-  newwait->events = events;
-  newwait->revents = 0;
 #endif

   return 0;
@@ -194,14 +170,6 @@
   su_wait_t w0 = NULL;
   if (*waitobj)
     WSACloseEvent(*waitobj);
-#elif SU_HAVE_OSX_CF_API
-  su_wait_t w0 = { INVALID_SOCKET, 0, 0, NULL };
-  CFRunLoopRef rl = CFRunLoopGetCurrent();
-  if (waitobj && waitobj->w_source) {
-    CFRunLoopRemoveSource(rl, waitobj->w_source, kCFRunLoopDefaultMode);
-    CFRunLoopSourceInvalidate(waitobj->w_source);
-  }
-  /* XXX -- mela: should we also remove from RunLoop? */
 #elif SU_HAVE_POLL
   su_wait_t w0 = { INVALID_SOCKET, 0, 0 };
 #endif


su_wait: function to get fd easily

su_wait: function to get fd easily

darcs-hash:20060113034931-1b897-986bc453b7d30346f273c3b7ece891769ba67f79.gz

--- libsofia-sip-ua/su/su_wait.h
+++ libsofia-sip-ua/su/su_wait.h
@@ -337,6 +337,12 @@
 int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout);
 int su_wait_events(su_wait_t *wait, su_socket_t s);
 int su_wait_mask(su_wait_t *dst, su_socket_t s, int events);
+
+static inline
+su_socket_t su_wait_socket(su_wait_t *wait)
+{
+  return wait->fd;
+}

 /* Root */
 su_root_t *su_root_create(su_root_magic_t *magic)


Add M05 code, fix G0 code

Add M05 code, fix G0 code

--- src/gcodeinter.c
+++ src/gcodeinter.c
@@ -170,8 +170,8 @@
 void ExcuteGCode(char *gcode){
     struct Exist exist;
     // G00 G01 G02 G03 G90 G91 G92 M02 M03 M04 M17 M18
-    if (strncmp(gcode, "G00", 3) == 0){// ||
-        //strncmp(gcode, "G0", 2) == 0  ){ will sucks all other commands away
+    if (strncmp(gcode, "G00", 3) == 0 ||
+        strncmp(gcode, "G0 ", 3) == 0  ){

         CheckExist(gcode, &exist);
         line_move(0, gcode, &exist);
@@ -187,9 +187,10 @@
     }else if (strncmp(gcode, "G91", 3) == 0){
         abs_mode = 0;
     }else if (strncmp(gcode, "M03", 3) == 0){
-
         CheckExist(gcode, &exist);
         M03(gcode, &exist);
+    }else if (strncmp(gcode, "M05", 3) == 0){
+        CNC_SetSpindleSpeed(0);
     }else if (strncmp(gcode, "M17", 3) == 0){
         CNC_EnableStepper();
     }else if (strncmp(gcode, "M18", 3) == 0){


Moved dashboard header rendering code to its own function unit.

--- src/gdashboard.c
+++ src/gdashboard.c
@@ -639,15 +639,35 @@
   *x += module_data->hits_len + DASH_SPACE;
 }

+static void
+render_header (WINDOW * win, GDashModule * module_data, int *y)
+{
+  char *hd;
+  int k, w, h;
+
+  getmaxyx (win, h, w);
+  (void) h;
+
+  k = module_data->module + 1;
+  hd = xmalloc (snprintf (NULL, 0, "%d - %s", k, module_data->head) + 1);
+  sprintf (hd, "%d - %s", k, module_data->head);
+
+  draw_header (win, hd, " %s", (*y), 0, w, 1, 0);
+  free (hd);
+
+  render_total_label (win, module_data, (*y));
+  module_data->pos_y = (*y);
+  (*y)++;
+}
+
 /* render dashboard content */
 static void
 render_content (WINDOW * win, GDashModule * module_data, int *y, int *offset,
                 int *total, GScrolling * scrolling)
 {
-  char *hd;
   GModule module = module_data->module;
   int expanded = 0, sel = 0, host_bars = 0, size;
-  int i, k, j, x = 0, w, h;
+  int i, j, x = 0, w, h;

   if (!conf.skip_term_resolver)
     host_bars = 1;
@@ -664,18 +684,8 @@
   size = module_data->dash_size;
   for (i = *offset, j = 0; i < size; i++) {
     /* header */
-    if ((i % size) == DASH_HEAD_POS) {
-      k = module + 1;
-      hd = xmalloc (snprintf (NULL, 0, "%d - %s", k, module_data->head) + 1);
-      sprintf (hd, "%d - %s", k, module_data->head);
-
-      draw_header (win, hd, " %s", (*y), 0, w, 1, 0);
-      free (hd);
-
-      render_total_label (win, module_data, (*y));
-      module_data->pos_y = (*y);
-      (*y)++;
-    }
+    if ((i % size) == DASH_HEAD_POS)
+      render_header (win, module_data, y);
     /* description */
     else if ((i % size) == DASH_DESC_POS)
       draw_header (win, module_data->desc, " %s", (*y)++, 0, w, 2, 0);


Remove the flags hiding variable in certain versions when setting the variable

Exception: The "version 7 and higher" flag is not removed when setting variable
on version 6

--- libswfdec/swfdec_as_object.c
+++ libswfdec/swfdec_as_object.c
@@ -257,6 +257,17 @@
   } else {
     if (var->flags & SWFDEC_AS_VARIABLE_CONSTANT)
       return;
+    // remove the flags that could make this variable hidden
+    if (object->context->version == 6) {
+      // version 6, so let's forget SWFDEC_AS_VARIABLE_VERSION_7_UP flag, oops!
+      // we will still set the value though, even if that flag is set
+      var->flags &= ~(SWFDEC_AS_VARIABLE_VERSION_6_UP |
+	  SWFDEC_AS_VARIABLE_VERSION_NOT_6 | SWFDEC_AS_VARIABLE_VERSION_8_UP);
+    } else {
+      var->flags &= ~(SWFDEC_AS_VARIABLE_VERSION_6_UP |
+	  SWFDEC_AS_VARIABLE_VERSION_NOT_6 | SWFDEC_AS_VARIABLE_VERSION_7_UP |
+	  SWFDEC_AS_VARIABLE_VERSION_8_UP);
+    }
   }
   if (var->get) {
     if (var->set) {


Reduce latency a bit.

Reduce latency a bit.


fix missing assert declaration

fix missing assert declaration

git-svn-id: 14be032f8f42541b1a281b51ae8ea69814daf20e@1579 4b44e086-7f34-40ce-a3bd-00e031736276

--- tests/linux-libnuma.c
+++ tests/linux-libnuma.c
@@ -5,6 +5,7 @@

 #include <private/config.h>
 #include <hwloc.h>
+#include <assert.h>
 #define NUMA_VERSION1_COMPATIBILITY
 #include <hwloc/linux-libnuma.h>


Changed starting pos.

Changed starting pos.

--- src/gexfparser.c
+++ src/gexfparser.c
@@ -7,8 +7,8 @@
 #include <string.h>
 #include <assert.h>

-#define NODE_START_X 100
-#define NODE_START_Y 100
+#define NODE_START_X 10
+#define NODE_START_Y 10

 xmlNode* xmlwGetChild(xmlNode* node, const char* name)
 {
@@ -47,11 +47,11 @@
 void gexfParseVertex(xmlNode* n, float* vertexXLoc, float* vertexYLoc, int *vertexIds)
 {
   if (!n || !vertexXLoc || !vertexYLoc) return;
-  *vertexXLoc = NODE_START_X;
-  *vertexYLoc = NODE_START_Y;
   const char* id = (const char*) xmlGetProp(n, (const xmlChar*) "id");
   assert(id != NULL);
   *vertexIds = atoi(id);
+  *vertexXLoc = NODE_START_X * (1 + *vertexIds);
+  *vertexYLoc = NODE_START_Y * (1 + *vertexIds);
 }

 void gexfParseEdge(xmlNode* n, unsigned int* edgeSource,