Document optional/required errors to handle.

--- MSAL/src/public/MSALError.h
+++ MSAL/src/public/MSALError.h
@@ -135,7 +135,7 @@
     MSALErrorInternal                            = -50000,

     /*!
-     Workplace join is required to proceed.
+     Workplace join is required to proceed. Handling of this error is optional.
      */
     MSALErrorWorkplaceJoinRequired               = -50001,

@@ -144,7 +144,7 @@
      returned by the authentication service. In all cases the proper response
      is to use a MSAL interactive AcquireToken call with the same parameters.
      For more details check MSALOAuthErrorKey and MSALOAuthErrorDescriptionKey
-     in the userInfo dictionary.
+     in the userInfo dictionary. Handling of this error is required.
      */
     MSALErrorInteractionRequired                 = -50002,

@@ -152,20 +152,21 @@
      The request was not fully completed and some scopes were not granted access to.
      This can be caused by a user declining consent on certain scopes.
      For more details check MSALGrantedScopesKey and MSALDeclinedScopesKey
-     in the userInfo dictionary.
+     in the userInfo dictionary. Handling of this error is required.
      */
     MSALErrorServerDeclinedScopes                = -50003,

     /*!
      The requested resource is protected by an Intune Conditional Access policy.
      The calling app should integrate the Intune SDK and call the remediateComplianceForIdentity:silent: API,
-     please see https://aka.ms/intuneMAMSDK for more information.
+     please see https://aka.ms/intuneMAMSDK for more information. Handling of this error is optional (handle it only
+     if you are going to access resources protected by an Intune Conditional Access policy).
      */
     MSALErrorServerProtectionPoliciesRequired    = -50004,

     /*!
-     The user cancelled the web auth session by tapping the "Done" button on the
-     SFSafariViewController.
+     The user cancelled the web auth session by tapping the "Done" button on the SFSafariViewController.
+     Handling of this error is optional.
      */
     MSALErrorUserCanceled                        = -50005,
 };


MdeModulePkg/DisplayEngine: Return the selectable menu correctly

When returning selectable menu, should return the menu in current form,
the codes miss to do the check. Now returning the selectable menu behind
the codes "if ((UINTN) Distance + NextMenuOption->Skip > GapToTop)".
Then can cover the check, can return the menu correctly.

https://bugzilla.tianocore.org/show_bug.cgi?id=232

Cc: Liming Gao <6480311aeeb4b006862f6d13ebabddc03f51e507@intel.com>
Cc: Eric Dong <fa9eeec52367040ac98013bc4b2913db170588f8@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <1e8692d8ed8470b17e8ddd7612a0f029768dcb56@intel.com>
Reviewed-by: Eric Dong <fa9eeec52367040ac98013bc4b2913db170588f8@intel.com>

--- MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -1050,18 +1050,21 @@
       UpdateOptionSkipLines (NextMenuOption);
     }

-    if (IsSelectable (NextMenuOption)) {
-      break;
-    }
-
-    //
-    // In this case, still can't find the selectable menu,
+    //
+    // Check whether the menu is beyond current showing form,
     // return the first one beyond the showing form.
     //
     if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) {
       if (FindInForm) {
         NextMenuOption = PreMenuOption;
       }
+      break;
+    }
+
+    //
+    // return the selectable menu in the showing form.
+    //
+    if (IsSelectable (NextMenuOption)) {
       break;
     }


Update TSTwoDimensionalArray.h

Update TSTwoDimensionalArray.h

--- Classes/TSTwoDimensionalArray.h
+++ Classes/TSTwoDimensionalArray.h
@@ -23,4 +23,6 @@

 - (NSUInteger)rowCount;

+- (void)removeAllObjects;
+
 @end


Fix parameter passing

Fix parameter passing

--- src/hardware_dep/dpdk/dpdk_nicon.c
+++ src/hardware_dep/dpdk/dpdk_nicon.c
@@ -17,7 +17,6 @@
 #include "util.h"
 #include "dpdk_nicon.h"

-
 extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
 extern void dpdk_init_nic();

@@ -181,10 +180,10 @@

 // ------------------------------------------------------

-void init_queues(struct lcore_data lcdata) {
-    for (unsigned i = 0; i < lcdata.conf->hw.n_rx_queue; i++) {
-        unsigned portid = lcdata.conf->hw.rx_queue_list[i].port_id;
-        uint8_t queueid = lcdata.conf->hw.rx_queue_list[i].queue_id;
+void init_queues(struct lcore_data* lcdata) {
+    for (unsigned i = 0; i < lcdata->conf->hw.n_rx_queue; i++) {
+        unsigned portid = lcdata->conf->hw.rx_queue_list[i].port_id;
+        uint8_t queueid = lcdata->conf->hw.rx_queue_list[i].queue_id;
         RTE_LOG(INFO, P4_FWD, " -- lcoreid=%u portid=%u rxqueueid=%hhu\n", rte_lcore_id(), portid, queueid);
     }
 }
@@ -202,7 +201,7 @@
     if (lcdata.is_valid) {
         RTE_LOG(INFO, P4_FWD, "entering main loop on lcore %u\n", rte_lcore_id());

-        init_queues(lcdata);
+        init_queues(&lcdata);
     } else {
         RTE_LOG(INFO, P4_FWD, "lcore %u has nothing to do\n", rte_lcore_id());
     }
@@ -212,7 +211,7 @@

 // ------------------------------------------------------

-bool core_is_working(struct lcore_data lcdata) {
+bool core_is_working(struct lcore_data* lcdata) {
     return true;
 }

@@ -220,8 +219,8 @@
     return true;
 }

-bool receive_packet(packet_descriptor_t* pd, struct lcore_data lcdata, unsigned pkt_idx) {
-    packet* p = lcdata.pkts_burst[pkt_idx];
+bool receive_packet(packet_descriptor_t* pd, struct lcore_data* lcdata, unsigned pkt_idx) {
+    packet* p = lcdata->pkts_burst[pkt_idx];
     rte_prefetch0(rte_pktmbuf_mtod(p, void *));
     pd->data = rte_pktmbuf_mtod(p, uint8_t *);
     pd->wrapper = p;
@@ -260,21 +259,21 @@
 void main_loop_post_single_rx(struct lcore_data* lcdata, bool got_packet) {
 }

-uint32_t get_portid(struct lcore_data lcdata, unsigned queue_idx) {
-    return lcdata.conf->hw.rx_queue_list[queue_idx].port_id;
+uint32_t get_portid(struct lcore_data* lcdata, unsigned queue_idx) {
+    return lcdata->conf->hw.rx_queue_list[queue_idx].port_id;
 }

 void main_loop_rx_group(struct lcore_data* lcdata, unsigned queue_idx) {
     uint8_t queue_id = lcdata->conf->hw.rx_queue_list[queue_idx].queue_id;
-    lcdata->nb_rx = rte_eth_rx_burst((uint8_t) get_portid(*lcdata, queue_idx), queue_id, lcdata->pkts_burst, MAX_PKT_BURST);
-}
-
-unsigned get_pkt_count_in_group(struct lcore_data lcdata) {
-    return lcdata.nb_rx;
-}
-
-unsigned get_queue_count(struct lcore_data lcdata) {
-    return lcdata.conf->hw.n_rx_queue;
+    lcdata->nb_rx = rte_eth_rx_burst((uint8_t) get_portid(lcdata, queue_idx), queue_id, lcdata->pkts_burst, MAX_PKT_BURST);
+}
+
+unsigned get_pkt_count_in_group(struct lcore_data* lcdata) {
+    return lcdata->nb_rx;
+}
+
+unsigned get_queue_count(struct lcore_data* lcdata) {
+    return lcdata->conf->hw.n_rx_queue;
 }

 void initialize_nic() {


[hash] Add strict bytes.

[hash] Add strict bytes.

--- src/hash/include/primitives/hash.h
+++ src/hash/include/primitives/hash.h
@@ -117,11 +117,14 @@

 namespace primitives::hash {

-struct bytes : std::basic_string<std::byte> {
-    using base = std::basic_string<std::byte>;
+struct bytes : std::vector<std::byte> {
+    using base = std::vector<std::byte>;
     using base::base;

-    bytes(const std::vector<uint8_t> &v) : base((std::byte *)v.data(), v.size()) {}
+    bytes(const std::vector<uint8_t> &v) : base((std::byte *)v.data(), (std::byte *)v.data() + v.size()) {}
+    /*operator const std::vector<uint8_t> &() const {
+        return (const std::vector<uint8_t> &)(*this);
+    }*/
     operator std::vector<uint8_t>() const {
         std::vector<uint8_t> v(size());
         std::memcpy(v.data(), data(), size());
@@ -144,10 +147,25 @@
             operator[](i / 2) = std::byte(hi | lo);
         }
     }
-    operator std::string() const { return bytes_to_string(std::string((const char*)data(), size())); }
+    operator std::string() const { return bytes_to_string((const uint8_t*)data(), size()); }
 };

 PRIMITIVES_HASH_API
 bytes generate_strong_random_bytes(uint32_t len);

+template <size_t sz, auto = []{}>
+struct bytes_strict : bytes {
+    static_assert(sz > 0);
+
+    bytes_strict() : bytes(generate_strong_random_bytes(sz)) {}
+    bytes_strict(const std::vector<uint8_t> &v) : bytes(v) {
+        if (size() != sz)
+            throw SW_LOGIC_ERROR("bad bytes size, must be " + std::to_string(sz) + ", got " + std::to_string(size()));
+    }
+    bytes_strict(const std::string &v) : bytes(v) {
+        if (size() != sz)
+            throw SW_LOGIC_ERROR("bad bytes size, must be " + std::to_string(sz) + ", got " + std::to_string(size()));
+    }
+};
+
 }


Fixed typos in API manager header documentation.

--- Code/Controllers/LSAPIManager.h
+++ Code/Controllers/LSAPIManager.h
@@ -32,7 +32,7 @@
 @property (nonatomic, readonly) LSSession *authenticatedSession;

 /**
- @abstract The current authenticated URL Session configuration or `nil` if not yet authenticated.
+ @abstract The current authenticated URL session configuration or `nil` if not yet authenticated.
  */
 @property (nonatomic, readonly) NSURLSessionConfiguration *authenticatedURLSessionConfiguration;

@@ -42,32 +42,32 @@
 ///------------------------------------

 /**
- @abstract Registers a new user with the Layer sample backend rails applicaiton
- @param user The model object representing the user attempting to authenticate
- @param completion The completion block that will be called upon completion of the registration operation. Completion block cannot be `nil`
+ @abstract Registers a new user with the Layer sample backend Rails application.
+ @param user The model object representing the user attempting to authenticate.
+ @param completion The completion block that will be called upon completion of the registration operation. Completion block cannot be `nil`.
  */
 - (void)registerUser:(LSUser *)user completion:(void(^)(LSUser *user, NSError *error))completion;

 /**
- @abstract Autheticates an existing users with the Layer sample backend rails applicaiton. This method takes a nonce value that must be
- obtained from LayerKit. It returns an identity token in the completion block that can be used to authenticate LayerKit
- @param email The email address for the user attempting to authenticate
- @param password The password for the user attempting to authenticate
- @param nonce The nonce obtained from LayerKit
+ @abstract Authenticates an existing user with the Layer sample backend Rails application. This method takes a nonce value that must be
+ obtained from LayerKit. It returns an identity token in the completion block that can be used to authenticate LayerKit.
+ @param email The email address for the user attempting to authenticate.
+ @param password The password for the user attempting to authenticate.
+ @param nonce The nonce obtained from LayerKit.
  @param completion The completion block that is called upon completion of the authentication operation. Upon succesful authentication,
- an identityToken will be returned. Completion block cannot be `nil`
+ an identityToken will be returned. Completion block cannot be `nil`.
  */
 - (void)authenticateWithEmail:(NSString *)email password:(NSString *)password nonce:(NSString *)nonce completion:(void(^)(NSString *identityToken, NSError *error))completion;

 /**
- @abstract Loads all contacts from the Layer sample backend rails application
- @param completion The completion block that is called upon succesfull load of contacts. Completion block cannot be `nil`
+ @abstract Loads all contacts from the Layer sample backend Rails application.
+ @param completion The completion block that is called upon successfully loading contacts. Completion block cannot be `nil`.
  */
 - (void)loadContactsWithCompletion:(void(^)(NSSet *contacts, NSError *error))completion;

 /**
- @abstract Deletes all contacts from the Layer sample backend rails application
- @param completion The completion block that is call upon succesfull deletion of all contacts. Completion block cannot be `nil`
+ @abstract Deletes all contacts from the Layer sample backend Rails application.
+ @param completion The completion block that is call upon successful deletion of all contacts. Completion block cannot be `nil`.
  */
 - (void)deleteAllContactsWithCompletion:(void(^)(BOOL completion, NSError *error))completion;

@@ -76,15 +76,15 @@
 ///------------------------------

 /**
- @abstract Resumes a Layer sample app session
- @param session The model object for the current session
- @param error   A reference to an `NSError` object that will contain error information in case the action was not successful.
- @return A Boolean value that indicates if the application has a valid session
+ @abstract Resumes a Layer sample app session.
+ @param session The model object for the current session.
+ @param error A reference to an `NSError` object that will contain error information in case the action was not successful.
+ @return A boolean value that indicates if the manager has a valid session.
  */
 - (BOOL)resumeSession:(LSSession *)session error:(NSError **)error;

 /**
- @abstract Deauthenticates the Layer Sample app by discarding it's `LSSession` object.
+ @abstract Deauthenticates the Layer sample app by discarding its `LSSession` object.
  */
 - (void)deauthenticate;


lib/file/io: fail IO requests against directories

Signed-off-by: David Disseldorp <589a549dc9f982d9f46aeeb82a09ab6d87ccf1d8@suse.de>

--- lib/file/io.c
+++ lib/file/io.c
@@ -48,6 +48,12 @@
 		goto err_out;
 	}

+	if (fh->open_flags & ELASTO_FOPEN_DIRECTORY) {
+		dbg(1, "invalid IO request for directory handle\n");
+		ret = -EINVAL;
+		goto err_out;
+	}
+
 	dbg(3, "%s range at %" PRIu64 ", len %" PRIu64 "\n",
 	    (src_data == NULL ? "clearing" : "writing"),
 	    dest_off, dest_len);
@@ -83,6 +89,12 @@
 		goto err_out;
 	}

+	if (fh->open_flags & ELASTO_FOPEN_DIRECTORY) {
+		dbg(1, "invalid IO request for directory handle\n");
+		ret = -EINVAL;
+		goto err_out;
+	}
+
 	dbg(3, "reading range at %" PRIu64 ", len %" PRIu64 "\n",
 	    src_off, src_len);

@@ -107,6 +119,12 @@
 		goto err_out;
 	}

+	if (fh->open_flags & ELASTO_FOPEN_DIRECTORY) {
+		dbg(1, "invalid IO request for directory handle\n");
+		ret = -EINVAL;
+		goto err_out;
+	}
+
 	dbg(3, "truncating to len %" PRIu64 "\n", len);

 	ret = fh->ops.truncate(fh->mod_priv, fh->conn, len);


small API fix

small API fix

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

--- filters/include/pcl/filters/covariance_sampling.h
+++ filters/include/pcl/filters/covariance_sampling.h
@@ -70,10 +70,9 @@
       typedef typename FilterIndices<PointT>::PointCloud Cloud;
       typedef typename Cloud::Ptr CloudPtr;
       typedef typename Cloud::ConstPtr CloudConstPtr;
-      typedef typename pcl::PointCloud<PointNT>::Ptr NormalsPtr;
+      typedef typename pcl::PointCloud<PointNT>::ConstPtr NormalsConstPtr;

     public:
-
       typedef boost::shared_ptr< CovarianceSampling<PointT, PointNT> > Ptr;
       typedef boost::shared_ptr< const CovarianceSampling<PointT, PointNT> > ConstPtr;

@@ -97,11 +96,11 @@
         * \param[in] normals the normals computed for the input cloud
         */
       inline void
-      setNormals (const NormalsPtr &normals)
+      setNormals (const NormalsConstPtr &normals)
       { input_normals_ = normals; }

       /** \brief Get the normals computed on the input point cloud */
-      inline NormalsPtr
+      inline NormalsConstPtr
       getNormals () const
       { return (input_normals_); }

@@ -118,7 +117,7 @@
       unsigned int num_samples_;

       /** \brief The normals computed at each point in the input cloud */
-      NormalsPtr input_normals_;
+      NormalsConstPtr input_normals_;

       std::vector<Eigen::Vector3f> scaled_points_;


net: use sock_valbool_flag to set/clear SOCK_RXQ_OVFL

There's no point in open-coding sock_valbool_flag().

Signed-off-by: Johannes Berg <bff32994ff0f8d048f262a8388145a71b6071bfe@intel.com>
Acked-by: Neil Horman <3316dc2d77df57653443c0391a5296176d6ca9c3@tuxdriver.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/core/sock.c
+++ net/core/sock.c
@@ -738,10 +738,7 @@
 		/* We implement the SO_SNDLOWAT etc to
 		   not be settable (1003.1g 5.3) */
 	case SO_RXQ_OVFL:
-		if (valbool)
-			sock_set_flag(sk, SOCK_RXQ_OVFL);
-		else
-			sock_reset_flag(sk, SOCK_RXQ_OVFL);
+		sock_valbool_flag(sk, SOCK_RXQ_OVFL, valbool);
 		break;
 	default:
 		ret = -ENOPROTOOPT;


rhashtable-test: Get rid of ptr in test_obj structure

This only blows up the size of the test structure for no gain
in test coverage. Reduces size of test_obj from 24 to 16 bytes.

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

--- lib/test_rhashtable.c
+++ lib/test_rhashtable.c
@@ -22,7 +22,6 @@
 #include <linux/slab.h>

-#define TEST_PTR	((void *) 0xdeadbeef)
 #define MAX_ENTRIES	1000000

 static int entries = 50000;
@@ -46,7 +45,6 @@
 MODULE_PARM_DESC(size, "Initial size hint of table (default: 8)");

 struct test_obj {
-	void			*ptr;
 	int			value;
 	struct rhash_head	node;
 };
@@ -78,9 +76,9 @@
 				key);
 			return -EEXIST;
 		} else if (expected && obj) {
-			if (obj->ptr != TEST_PTR || obj->value != i) {
-				pr_warn("Test failed: Lookup value mismatch %p!=%p, %u!=%u\n",
-					obj->ptr, TEST_PTR, obj->value, i);
+			if (obj->value != i) {
+				pr_warn("Test failed: Lookup value mismatch %u!=%u\n",
+					obj->value, i);
 				return -EINVAL;
 			}
 		}
@@ -153,7 +151,6 @@
 			goto error;
 		}

-		obj->ptr = TEST_PTR;
 		obj->value = i * 2;

 		err = rhashtable_insert_fast(ht, &obj->node, test_rht_params);


it doesn't matter what kind of interface it is if the bridge_iflist allocation fails..  it's still ENOMEM.

--- net/if_bridge.c
+++ net/if_bridge.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_bridge.c,v 1.41 2000/11/07 05:38:53 jason Exp $	*/
+/*	$OpenBSD: if_bridge.c,v 1.42 2000/11/10 05:24:58 jason Exp $	*/

 /*
  * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -319,9 +319,10 @@

 		p = (struct bridge_iflist *) malloc(
 		    sizeof(struct bridge_iflist), M_DEVBUF, M_NOWAIT);
-		if (p == NULL && ifs->if_type == IFT_ETHER) {
+		if (p == NULL) {
+			if (ifs->if_type == IFT_ETHER)
+				ifpromisc(ifs, 0);
 			error = ENOMEM;
-			ifpromisc(ifs, 0);
 			break;
 		}


ipv4: Fix ipmr unregister device oops

ipv4: Fix ipmr unregister device oops

An oops happens during device unregister.

The following oops happened when I add two tunnels, which
use a same device, and then delete one tunnel.
Obviously deleting tunnel "A" causes device unregister, which
send a notification, and after receiving notification, ipmr do
unregister again for tunnel "B" which also use same device.
That is wrong.
After receiving notification, ipmr only needs to decrease reference
count and don't do duplicated unregister.
Fortunately, IPv6 side doesn't add tunnel in ip6mr, so it's clean.

This patch fixs:
- unregister device oops
- using after dev_put()

Here is the oops:
===
Jul 11 15:39:29 wangchen kernel: ------------[ cut here ]------------
Jul 11 15:39:29 wangchen kernel: kernel BUG at net/core/dev.c:3651!
Jul 11 15:39:29 wangchen kernel: invalid opcode: 0000 [#1]
Jul 11 15:39:29 wangchen kernel: Modules linked in: ipip tunnel4 nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs ipv6 snd_pcm_oss snd_mixer_oss snd_seq snd_seq_device af_packet binfmt_misc button battery ac loop dm_mod usbhid ff_memless pcmcia firmware_class ohci1394 8139too mii ieee1394 yenta_socket rsrc_nonstatic pcmcia_core ide_cd_mod cdrom snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm i2c_i801 snd_timer snd i2c_core soundcore snd_page_alloc rng_core shpchp ehci_hcd uhci_hcd pci_hotplug intel_agp agpgart usbcore ext3 jbd ata_piix ahci libata dock edd fan thermal processor thermal_sys piix sd_mod scsi_mod ide_disk ide_core [last unloaded: freq_table]
Jul 11 15:39:29 wangchen kernel:
Jul 11 15:39:29 wangchen kernel: Pid: 4102, comm: mroute Not tainted (2.6.26-rc9-default #69)
Jul 11 15:39:29 wangchen kernel: EIP: 0060:[<c024636b>] EFLAGS: 00010202 CPU: 0
Jul 11 15:39:29 wangchen kernel: EIP is at rollback_registered+0x61/0xe3
Jul 11 15:39:29 wangchen kernel: EAX: 00000001 EBX: ecba6000 ECX: 00000000 EDX: ffffffff
Jul 11 15:39:29 wangchen kernel: ESI: 00000001 EDI: ecba6000 EBP: c03de2e8 ESP: ed8e7c3c
Jul 11 15:39:29 wangchen kernel:  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
Jul 11 15:39:29 wangchen kernel: Process mroute (pid: 4102, ti=ed8e6000 task=ed41e830 task.ti=ed8e6000)
Jul 11 15:39:29 wangchen kernel: Stack: ecba6000 c024641c 00000028 c0284e1a 00000001 c03de2e8 ecba6000 eecff360
Jul 11 15:39:29 wangchen kernel:        c0284e4c c03536f4 fffffff8 00000000 c029a819 ecba6000 00000006 ecba6000
Jul 11 15:39:29 wangchen kernel:        00000000 ecba6000 c03de2c0 c012841b ffffffff 00000000 c024639f ecba6000
Jul 11 15:39:29 wangchen kernel: Call Trace:
Jul 11 15:39:29 wangchen kernel:  [<c024641c>] unregister_netdevice+0x2f/0x51
Jul 11 15:39:29 wangchen kernel:  [<c0284e1a>] vif_delete+0xaf/0xc3
Jul 11 15:39:29 wangchen kernel:  [<c0284e4c>] ipmr_device_event+0x1e/0x30
Jul 11 15:39:29 wangchen kernel:  [<c029a819>] notifier_call_chain+0x2a/0x47
Jul 11 15:39:29 wangchen kernel:  [<c012841b>] raw_notifier_call_chain+0x9/0xc
Jul 11 15:39:29 wangchen kernel:  [<c024639f>] rollback_registered+0x95/0xe3
Jul 11 15:39:29 wangchen kernel:  [<c024641c>] unregister_netdevice+0x2f/0x51
Jul 11 15:39:29 wangchen kernel:  [<c0284e1a>] vif_delete+0xaf/0xc3
Jul 11 15:39:29 wangchen kernel:  [<c0285eee>] ip_mroute_setsockopt+0x47a/0x801
Jul 11 15:39:29 wangchen kernel:  [<eea5a70c>] do_get_write_access+0x2df/0x313 [jbd]
Jul 11 15:39:29 wangchen kernel:  [<c01727c4>] __find_get_block_slow+0xda/0xe4
Jul 11 15:39:29 wangchen kernel:  [<c0172a7f>] __find_get_block+0xf8/0x122
Jul 11 15:39:29 wangchen kernel:  [<c0172a7f>] __find_get_block+0xf8/0x122
Jul 11 15:39:29 wangchen kernel:  [<eea5d563>] journal_cancel_revoke+0xda/0x110 [jbd]
Jul 11 15:39:29 wangchen kernel:  [<c0263501>] ip_setsockopt+0xa9/0x9ee
Jul 11 15:39:29 wangchen kernel:  [<eea5d563>] journal_cancel_revoke+0xda/0x110 [jbd]
Jul 11 15:39:29 wangchen kernel:  [<eea5a70c>] do_get_write_access+0x2df/0x313 [jbd]
Jul 11 15:39:29 wangchen kernel:  [<eea69287>] __ext3_get_inode_loc+0xcf/0x271 [ext3]
Jul 11 15:39:29 wangchen kernel:  [<eea743c7>] __ext3_journal_dirty_metadata+0x13/0x32 [ext3]
Jul 11 15:39:29 wangchen kernel:  [<c0116434>] __wake_up+0xf/0x15
Jul 11 15:39:29 wangchen kernel:  [<eea5a424>] journal_stop+0x1bd/0x1c6 [jbd]
Jul 11 15:39:29 wangchen kernel:  [<eea703a7>] __ext3_journal_stop+0x19/0x34 [ext3]
Jul 11 15:39:29 wangchen kernel:  [<c014291e>] get_page_from_freelist+0x94/0x369
Jul 11 15:39:29 wangchen kernel:  [<c01408f2>] filemap_fault+0x1ac/0x2fe
Jul 11 15:39:29 wangchen kernel:  [<c01a605e>] security_sk_alloc+0xd/0xf
Jul 11 15:39:29 wangchen kernel:  [<c023edea>] sk_prot_alloc+0x36/0x78
Jul 11 15:39:29 wangchen kernel:  [<c0240037>] sk_alloc+0x3a/0x40
Jul 11 15:39:29 wangchen kernel:  [<c0276062>] raw_hash_sk+0x46/0x4e
Jul 11 15:39:29 wangchen kernel:  [<c0166aff>] d_alloc+0x1b/0x157
Jul 11 15:39:29 wangchen kernel:  [<c023e4d1>] sock_common_setsockopt+0x12/0x16
Jul 11 15:39:29 wangchen kernel:  [<c023cb1e>] sys_setsockopt+0x6f/0x8e
Jul 11 15:39:29 wangchen kernel:  [<c023e105>] sys_socketcall+0x15c/0x19e
Jul 11 15:39:29 wangchen kernel:  [<c0103611>] sysenter_past_esp+0x6a/0x99
Jul 11 15:39:29 wangchen kernel:  [<c0290000>] unix_poll+0x69/0x78
Jul 11 15:39:29 wangchen kernel:  =======================
Jul 11 15:39:29 wangchen kernel: Code: 83 e0 01 00 00 85 c0 75 1f 53 53 68 12 81 31 c0 e8 3c 30 ed ff ba 3f 0e 00 00 b8 b9 7f 31 c0 83 c4 0c 5b e9 f5 26 ed ff 48 74 04 <0f> 0b eb fe 89 d8 e8 21 ff ff ff 89 d8 e8 62 ea ff ff c7 83 e0
Jul 11 15:39:29 wangchen kernel: EIP: [<c024636b>] rollback_registered+0x61/0xe3 SS:ESP 0068:ed8e7c3c
Jul 11 15:39:29 wangchen kernel: ---[ end trace c311acf85d169786 ]---
===

Signed-off-by: Wang Chen <219c2d1deaa4657b30fff97438f3730a4ddbd37c@cn.fujitsu.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/ipv4/ipmr.c
+++ net/ipv4/ipmr.c
@@ -184,6 +184,7 @@

 			if (dev_open(dev))
 				goto failure;
+			dev_hold(dev);
 		}
 	}
 	return dev;
@@ -250,6 +251,8 @@
 	if (dev_open(dev))
 		goto failure;

+	dev_hold(dev);
+
 	return dev;

 failure:
@@ -264,9 +267,10 @@

 /*
  *	Delete a VIF entry
- */
-
-static int vif_delete(int vifi)
+ *	@notify: Set to 1, if the caller is a notifier_call
+ */
+
+static int vif_delete(int vifi, int notify)
 {
 	struct vif_device *v;
 	struct net_device *dev;
@@ -309,7 +313,7 @@
 		ip_rt_multicast_event(in_dev);
 	}

-	if (v->flags&(VIFF_TUNNEL|VIFF_REGISTER))
+	if (v->flags&(VIFF_TUNNEL|VIFF_REGISTER) && !notify)
 		unregister_netdevice(dev);

 	dev_put(dev);
@@ -435,6 +439,7 @@
 		err = dev_set_allmulti(dev, 1);
 		if (err) {
 			unregister_netdevice(dev);
+			dev_put(dev);
 			return err;
 		}
 		break;
@@ -446,6 +451,7 @@
 		err = dev_set_allmulti(dev, 1);
 		if (err) {
 			ipmr_del_tunnel(dev, vifc);
+			dev_put(dev);
 			return err;
 		}
 		break;
@@ -453,10 +459,11 @@
 		dev = ip_dev_find(&init_net, vifc->vifc_lcl_addr.s_addr);
 		if (!dev)
 			return -EADDRNOTAVAIL;
-		dev_put(dev);
 		err = dev_set_allmulti(dev, 1);
-		if (err)
+		if (err) {
+			dev_put(dev);
 			return err;
+		}
 		break;
 	default:
 		return -EINVAL;
@@ -487,7 +494,6 @@

 	/* And finish update writing critical data */
 	write_lock_bh(&mrt_lock);
-	dev_hold(dev);
 	v->dev=dev;
 #ifdef CONFIG_IP_PIMSM
 	if (v->flags&VIFF_REGISTER)
@@ -834,7 +840,7 @@
 	 */
 	for (i=0; i<maxvif; i++) {
 		if (!(vif_table[i].flags&VIFF_STATIC))
-			vif_delete(i);
+			vif_delete(i, 0);
 	}

 	/*
@@ -947,7 +953,7 @@
 		if (optname==MRT_ADD_VIF) {
 			ret = vif_add(&vif, sk==mroute_socket);
 		} else {
-			ret = vif_delete(vif.vifc_vifi);
+			ret = vif_delete(vif.vifc_vifi, 0);
 		}
 		rtnl_unlock();
 		return ret;
@@ -1126,7 +1132,7 @@
 	v=&vif_table[0];
 	for (ct=0;ct<maxvif;ct++,v++) {
 		if (v->dev==dev)
-			vif_delete(ct);
+			vif_delete(ct, 1);
 	}
 	return NOTIFY_DONE;
 }


test/crypto: fix misleading trace message

Test was reporting digest verification failed for all operation errors.
Fixed so it only reports this if the PMD actually reports an auth failure.

Fixes: 9c0eed2f06ae ("app/test: rework crypto AES unit test")
Cc: stable@dpdk.org

Signed-off-by: Fiona Trahe <7ba562cc372916cd557d0be347608f8b4da4f746@intel.com>
Acked-by: Pablo de Lara <28355d9cfe41bb8148aea0fb24f47aae8f4217a1@intel.com>

--- test/test/test_cryptodev_blockcipher.c
+++ test/test/test_cryptodev_blockcipher.c
@@ -401,13 +401,14 @@

 	/* Verify results */
 	if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
-		if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
+		if ((t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) &&
+			(op->status == RTE_CRYPTO_OP_STATUS_AUTH_FAILED))
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: Digest verification failed "
 				"(0x%X)", __LINE__, op->status);
 		else
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
-				"FAILED: Digest verification failed "
+				"FAILED: Operation failed "
 				"(0x%X)", __LINE__, op->status);
 		status = TEST_FAILED;
 		goto error_exit;


Changed variable name

Changed variable name

--- cquel.h
+++ cquel.h
@@ -311,10 +311,10 @@
 int cq_get_fields(struct dbconn con, const char *table, size_t *out_fieldc,
         char **out_names, size_t nblen);

-int cq_func_arr(struct dbconn con, const char *routine, char * const *args,
+int cq_func_arr(struct dbconn con, const char *func, char * const *args,
         size_t num_args);

-int cq_func_drow(struct dbconn con, const char *routine, struct drow row);
+int cq_func_drow(struct dbconn con, const char *func, struct drow row);

 #ifdef __cplusplus
 }


[IPv6] ESP: Discard dummy packets introduced in rfc4303

RFC4303 introduces dummy packets with a nexthdr value of 59
to implement traffic confidentiality. Such packets need to
be dropped silently and the payload may not be attempted to
be parsed as it consists of random chunk.

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

--- net/ipv6/esp6.c
+++ net/ipv6/esp6.c
@@ -230,6 +230,12 @@
 		}
 		/* ... check padding bits here. Silly. :-) */

+		/* RFC4303: Drop dummy packets without any error */
+		if (nexthdr[1] == IPPROTO_NONE) {
+			ret = -EINVAL;
+			goto out;
+		}
+
 		pskb_trim(skb, skb->len - alen - padlen - 2);
 		ret = nexthdr[1];
 	}


add method get_crc_mask()

add method get_crc_mask()

--- crc_t.h
+++ crc_t.h
@@ -76,6 +76,7 @@

         uint64_t get_crc_init()const { return crc_init;} //crc_init = reflect(init, bits) if RefIn, else = init
         uint64_t get_top_bit() const { return top_bit; }
+        uint64_t get_crc_mask()const { return crc_mask;}


Ref: divided the init_crc_table function into two functions normal\reflected

--- crc_t.h
+++ crc_t.h
@@ -119,9 +119,9 @@
         bool     get_ref_in()  const { return RefIn; }
         bool     get_ref_out() const { return RefOut;}

-        CRC_Type get_crc_init()const { return crc_init;} //crc_init = reflect(Init, Bits) if RefIn, else = Init
         CRC_Type get_top_bit() const { return (CRC_Type)1 << (Bits - 1);      }
         CRC_Type get_crc_mask()const { return ( (get_top_bit() - 1) << 1) | 1;}
+        CRC_Type get_crc_init()const { return crc_init;} //crc_init = reflect(Init, Bits) if RefIn, else = Init
         CRC_Type get_check()   const;                    //crc for ASCII string "123456789" (i.e. 313233... (hexadecimal)).

@@ -144,7 +144,8 @@

         CRC_Type reflect(CRC_Type data, uint8_t num_bits) const;
-        void     init_crc_table();
+        void     init_normal_crc_table();
+        void     init_reflected_crc_table();

         int      get_crc(CRC_Type &crc, std::ifstream& ifs, void* buf, size_t size_buf) const;
 };
@@ -159,12 +160,15 @@
 {

     if(RefIn)
+    {
         crc_init = reflect(Init, Bits);
+        init_reflected_crc_table();
+    }
     else
+    {
         crc_init = Init;
-
-
-    init_crc_table();
+        init_normal_crc_table();
+    }
 }

@@ -302,22 +306,22 @@

 template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
-void CRC_t<Bits, Poly, Init, RefIn, RefOut, XorOut>::init_crc_table()
-{
-    //Calculation of the standard CRC table for byte.
-    for(int i = 0; i < 256; i++)
+void CRC_t<Bits, Poly, Init, RefIn, RefOut, XorOut>::init_normal_crc_table()
+{
+    //Calculation of the Normal CRC table for byte.
+    for(int byte = 0; byte < 256; byte++)
     {

         CRC_Type crc = 0;

-        for(uint8_t mask = 0x80; mask; mask >>= 1)
+        for(int bit = 0x80; bit; bit >>= 1)
         {

-            if ( i & mask )
+            if( byte & bit )
                 crc ^= get_top_bit();

-            if (crc & get_top_bit())
+            if( crc & get_top_bit() )
             {
                 crc <<= 1;
                 crc ^= Poly;
@@ -327,16 +331,41 @@
         }

         crc &= get_crc_mask(); //for CRC not power 2
-
-        if(RefIn)
-            crc_table[reflect(i, 8)] = reflect(crc, Bits);
-        else
-            crc_table[i] = crc;
+        crc_table[byte] = crc;
      }
 }

+template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
+void CRC_t<Bits, Poly, Init, RefIn, RefOut, XorOut>::init_reflected_crc_table()
+{
+    //Calculation of the Reflected CRC table for byte.
+    CRC_Type ref_poly = reflect(Poly, Bits);
+
+    for(int byte = 0; byte < 256; byte++)
+    {
+
+        CRC_Type crc = byte;
+
+        for(int bit = 0x80; bit; bit >>= 1)
+        {
+
+            if( crc & 1 )
+            {
+                crc >>= 1;
+                crc ^= ref_poly;
+            }
+            else
+                crc >>= 1;
+        }
+
+        crc_table[byte] = crc;
+    }
+}
+
+
+

 #endif // CRC_T_H


[SCTP]: seq_printf format warning. (fixed)

sctp_association->hbinterval is unsigned long. Replace %8d with %8lu.

Signed-off-by: Denis V. Lunev <0e1ddfe761f44f291037b4efb98a5f5f36ee23b3@openvz.org>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


fix typo 'modifyh'

fix typo 'modifyh'

Signed-off-by: PARKJIHOON <5c5a7be3b186ffab2bad9da5aa820bd176deed88@samsung.com>

--- targets/TARGET_Samsung/security_subsystem/drivers/mb_cmd_rng.c
+++ targets/TARGET_Samsung/security_subsystem/drivers/mb_cmd_rng.c
@@ -45,7 +45,7 @@
  *  @ingroup    SECURITY_SSS_MAILBOX
  *  @brief      mailbox api for random number generation
  *  @version    v0.50 : 2016.8.13 Init. release version
- *  @version    v0.51 : 2018.01.13 Modifyh for S111 SRAM code
+ *  @version    v0.51 : 2018.01.13 Modified for S111 SRAM code
  *  @param[out] random_number   : array of random number
  *  @param[in]  random_wlen     : word length of random number
  *  @retval     SUCCESS         : Success


tipc: remove obsolete flush of stale reassembly buffer

Each link instance has a periodic job checking if there is a stale
ongoing message reassembly associated to the link. If no new
fragment has been received during the last 4*[link_tolerance] period,
it is assumed the missing fragment will never arrive. As a consequence,
the reassembly buffer is discarded, and a gap in the message sequence
occurs.

This assumption is wrong. After we abandoned our ambition to develop
packet routing for multi-cluster networks, only single-hop packet
transfer remains as an option. For those, all packets are guaranteed
to be delivered in sequence to the defragmentation layer. Any failure
to achieve sequenced delivery will eventually lead to link reset, and
the reassembly buffer will be flushed anyway.

So we just remove this periodic check, which is now obsolete.

Signed-off-by: Erik Hugne <527d9b95423f3946c01de0ba884fdd8bb4a3759d@ericsson.com>
Acked-by: Ying Xue <c1cbb87de349443b90fa63f6d2cc5403843bc133@windriver.com>
Signed-off-by: Jon Maloy <0e60c7c02f6d30eccc82572d2a89766b1b2a3d45@ericsson.com>
[PG: also delete get/inc_timer count, since they are now unused]
Signed-off-by: Paul Gortmaker <ae947f3c8df96e1dc851c5e3e5a930ce6d3f1f74@windriver.com>

--- net/tipc/link.c
+++ net/tipc/link.c
@@ -97,7 +97,6 @@
 				    struct iovec const *msg_sect,
 				    u32 num_sect, unsigned int total_len,
 				    u32 destnode);
-static void link_check_defragm_bufs(struct tipc_link *l_ptr);
 static void link_state_event(struct tipc_link *l_ptr, u32 event);
 static void link_reset_statistics(struct tipc_link *l_ptr);
 static void link_print(struct tipc_link *l_ptr, const char *str);
@@ -271,7 +270,6 @@
 	}

 	/* do all other link processing performed on a periodic basis */
-	link_check_defragm_bufs(l_ptr);

 	link_state_event(l_ptr, TIMEOUT_EVT);

@@ -2497,16 +2495,6 @@
 	msg_set_bcast_ack(buf_msg(buf), exp);
 }

-static u32 get_timer_cnt(struct sk_buff *buf)
-{
-	return msg_reroute_cnt(buf_msg(buf));
-}
-
-static void incr_timer_cnt(struct sk_buff *buf)
-{
-	msg_incr_reroute_cnt(buf_msg(buf));
-}
-
 /*
  * tipc_link_recv_fragment(): Called with node lock on. Returns
  * the reassembled buffer if message is complete.
@@ -2583,38 +2571,6 @@
 	}
 	kfree_skb(fbuf);
 	return 0;
-}
-
-/**
- * link_check_defragm_bufs - flush stale incoming message fragments
- * @l_ptr: pointer to link
- */
-static void link_check_defragm_bufs(struct tipc_link *l_ptr)
-{
-	struct sk_buff *prev = NULL;
-	struct sk_buff *next = NULL;
-	struct sk_buff *buf = l_ptr->defragm_buf;
-
-	if (!buf)
-		return;
-	if (!link_working_working(l_ptr))
-		return;
-	while (buf) {
-		u32 cnt = get_timer_cnt(buf);
-
-		next = buf->next;
-		if (cnt < 4) {
-			incr_timer_cnt(buf);
-			prev = buf;
-		} else {
-			if (prev)
-				prev->next = buf->next;
-			else
-				l_ptr->defragm_buf = buf->next;
-			kfree_skb(buf);
-		}
-		buf = next;
-	}
 }

 static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)


Push @/2 and/or :/2 in compileSubclause() rather than returning non-compilable.

--- src/pl-comp.c
+++ src/pl-comp.c
@@ -885,6 +885,26 @@

   return TRUE;
 }
+
+
+static int
+pushTargetModule(target_module *tm, functor_t functor, CompileInfo ci)
+{ Output_1(ci, B_FUNCTOR, functor);
+
+  if ( ci->colon_context.type == TM_MODULE )
+  { Output_1(ci, B_CONST, ci->colon_context.module->name);
+  } else
+  { int index = ci->colon_context.var_index;
+
+    if ( index < 3 )
+      Output_0(ci, B_VAR0+index);
+    else
+      Output_1(ci, B_VAR, VAROFFSET(index));
+  }
+
+  return TRUE;
+}
+

 		 /*******************************
@@ -1958,16 +1978,24 @@
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
   if ( isIndexedVarTerm(*arg PASS_LD) >= 0 )
   { int rc;
-
-    if ( ci->colon_context.type != TM_NONE )
-      return NOT_AT_CALLABLE;
+    int pop=0;
+
 #ifdef O_CALL_AT_MODULE
     if ( ci->at_context.type != TM_NONE )
-      return NOT_AT_CALLABLE;
+    { pushTargetModule(&ci->colon_context, FUNCTOR_xpceref2, ci);
+      pop++;
+    }
 #endif
+    if ( ci->colon_context.type != TM_NONE )
+    { pushTargetModule(&ci->colon_context, FUNCTOR_colon2, ci);
+      pop++;
+    }

     if ( (rc=compileArgument(arg, A_BODY, ci PASS_LD)) < 0 )
       return rc;
+    while(--pop >=0 )
+      Output_0(ci, B_POP);
+
     Output_0(ci, I_USERCALL0);
     succeed;
   }


Penalty and augmented Lagrange contact formulations

Ticket #1432

r13976

--- framework/include/geomsearch/PenetrationLocator.h
+++ framework/include/geomsearch/PenetrationLocator.h
@@ -97,6 +97,7 @@
   std::map<unsigned int, bool> _has_penetrated;
   std::map<unsigned int, unsigned> _locked_this_step;
   std::map<unsigned int, unsigned> _unlocked_this_step;
+  std::map<unsigned int, Real> _lagrange_multiplier;

   void setUpdate(bool update);
   void setTangentialTolerance(Real tangential_tolerance);


Minor pokes.

Minor pokes.

--- Classes/Helpers/UKXattrMetadataStore.h
+++ Classes/Helpers/UKXattrMetadataStore.h
@@ -29,6 +29,8 @@
 	should be made like bundle identifiers, e.g. @"de.zathras.myattribute".
 */

+#define UKXDEPRECATED(x, y) __attribute__((availability(swift, unavailable, message="Use '" x "' instead"))) __attribute__((deprecated("Use '" y "' instead")))
+
 // -----------------------------------------------------------------------------
 //	Class declaration:
 // -----------------------------------------------------------------------------
@@ -60,7 +62,7 @@
  *	@discussion	Returns an \c NSArray of NSStrings containing all xattr names currently set
  *				for the file at the specified path.
  */
-+(nullable NSArray<NSString*>*) allKeysAtPath:(NSString*)path traverseLink:(BOOL)travLnk DEPRECATED_ATTRIBUTE NS_SWIFT_UNAVAILABLE("");
++(NSArray<NSString*>*) allKeysAtPath:(NSString*)path traverseLink:(BOOL)travLnk UKXDEPRECATED("allKeys(atPath:traverseLink:) throws", "+allKeysAtPath:traverseLink:error:");

 /*!
  *	@method		allKeysAtPath:traverseLink:
@@ -94,7 +96,7 @@
  *	@deprecated	This method throws an Obj-C exception. No other error information is provided, not even if it was successful.
  */
 +(void) setString:(NSString*)str forKey:(NSString*)key
-		   atPath:(NSString*)path traverseLink:(BOOL)travLnk DEPRECATED_ATTRIBUTE NS_SWIFT_UNAVAILABLE("Use 'setString(_:forKey:atPath:traverseLink:) throws' instead");
+		   atPath:(NSString*)path traverseLink:(BOOL)travLnk UKXDEPRECATED("setString(_:forKey:atPath:traverseLink:) throws", "+setString:forKey:atPath:traverseLink:error:");

 /*!
  *	@method		setString:forKey:atPath:traverseLink:error:
@@ -130,7 +132,7 @@
  *	@deprecated	This method has no error handling.
  */
 +(nullable NSString*) stringForKey:(NSString*)key atPath:(NSString*)path
-					  traverseLink:(BOOL)travLnk DEPRECATED_ATTRIBUTE NS_SWIFT_UNAVAILABLE("Use 'string(forKey:atPath:traverseLink:) throws' instead");
+					  traverseLink:(BOOL)travLnk UKXDEPRECATED("string(forKey:atPath:traverseLink:) throws", "+stringForKey:atPath:traverseLink:error:");

 /*!
  *	@method		stringForKey:atPath:traverseLink:error:
@@ -165,7 +167,7 @@
  *	@deprecated	This method has no way of indicating success or failure.
  */
 +(void) setData:(NSData*)data forKey:(NSString*)key
-		 atPath:(NSString*)path traverseLink:(BOOL)travLnk DEPRECATED_ATTRIBUTE NS_SWIFT_UNAVAILABLE("Use 'setData(_:forKey:atPath:traverseLink:) throws' instead");
+		 atPath:(NSString*)path traverseLink:(BOOL)travLnk UKXDEPRECATED("setData(_:forKey:atPath:traverseLink:) throws", "+setData:forKey:atPath:traverseLink:error:");
 /*!
  *	@method		setData:forKey:atPath:traverseLink:error:
  *	@brief		Set the xattr with name \c key to the raw data in data.
@@ -200,7 +202,7 @@
  *	@deprecated	This method throws an Obj-C exception. No other error information is provoded on failure.
  */
 +(nullable NSData*) dataForKey:(NSString*)key atPath:(NSString*)path
-				  traverseLink:(BOOL)travLnk DEPRECATED_ATTRIBUTE NS_SWIFT_UNAVAILABLE("Use 'data(forKey:atPath:traverseLink:) throws' instead");
+				  traverseLink:(BOOL)travLnk UKXDEPRECATED("data(forKey:atPath:traverseLink:) throws", "+dataForKey:atPath:traverseLink:error:");
 /*!
  *	@method		dataForKey:atPath:traverseLink:error:
  *	@brief		Get the xattr with name \c key as raw data.
@@ -235,7 +237,7 @@
  *				not even if it was successful.
  */
 +(void) setObject:(id)obj forKey:(NSString*)key atPath:(NSString*)path
-	 traverseLink:(BOOL)travLnk DEPRECATED_ATTRIBUTE NS_SWIFT_UNAVAILABLE("Use 'setObject(_:forKey:atPath:traverseLink:) throws' instead");
+	 traverseLink:(BOOL)travLnk UKXDEPRECATED("setObject(_:forKey:atPath:traverseLink:format:) throws", "+setObject:forKey:atPath:traverseLink:format:error:");

 /*!
  *	@method		setObject:forKey:atPath:traverseLink:error:


Comment

Comment

--- src/pl-comp.c
+++ src/pl-comp.c
@@ -1957,6 +1957,10 @@

 The context left operators @/2 and   :/2 are available as ci->at_context
 and ci->colon_context.
+
+TBD: A remaining problem is that  calls   to  compiler reserved code and
+system predicates is still subject to  meta-calling if the colon-context
+is unbound (e.g. Var:true).
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 static int


Fix API documentation.

Fix API documentation.

--- ext/apache2/Application.h
+++ ext/apache2/Application.h
@@ -475,12 +475,12 @@
 	 *   session->sendHeaders(...);
 	 *   session->sendBodyBlock(...);
 	 *   // Done sending data, so we close the writer channel.
-	 *   session->closeWriter();
+	 *   session->shutdownWriter();
 	 *
 	 *   // Now read the HTTP response.
 	 *   string responseData = readAllDataFromSocket(session->getReader());
 	 *   // Done reading data, so we close the reader channel.
-	 *   session->closeReader();
+	 *   session->shutdownReader();
 	 *
 	 *   // This session has now finished, so we close the session by resetting
 	 *   // the smart pointer to NULL (thereby destroying the Session object).


FIXED: resort nested dicts when loading from a .qlf file or saved state

--- src/pl-dict.c
+++ src/pl-dict.c
@@ -979,12 +979,8 @@
 }

 int
-resortDictsInClause(Clause clause)
-{ Code PC, end;
-
-  PC  = clause->codes;
-  end = &PC[clause->code_size];
-
+resortDictsInCodes(Code PC, Code end)
+{
   for( ; PC < end; PC = stepPC(PC) )
   { code op = fetchop(PC);

@@ -1016,7 +1012,8 @@
 	  fields_start = PC;

 	  for(f = 0; f < fields; f++)
-	  { code op = fetchop(PC);
+	  { Code PCv;
+	    code op = fetchop(PC);

 	    kv_pos[f].start = PC-fields_start;

@@ -1032,7 +1029,12 @@
 		return TRUE;		/* not a dict */
 	    }
 	    PC = stepPC(PC);		/* skip key */
+	    PCv = PC;
 	    PC = skipArgs(PC, 1);	/* skip value */
+
+	    if ( !resortDictsInCodes(PCv, PC) )
+	    { return FALSE;
+	    }

 	    kv_pos[f].len = PC-fields_start-kv_pos[f].start;

@@ -1075,6 +1077,16 @@
   }

   return TRUE;
+}
+
+int
+resortDictsInClause(Clause clause)
+{ Code PC, end;
+
+  PC  = clause->codes;
+  end = &PC[clause->code_size];
+
+  return resortDictsInCodes(PC, end);
 }


Kill compiler warnings

Kill compiler warnings

--- ext/gtk+/php_gtk+_types.c
+++ ext/gtk+/php_gtk+_types.c
@@ -300,9 +300,9 @@

 static HashTable* style_helper_get_properties(zval *object TSRMLS_DC)
 {
-    int i;
+ /* int i;
     zval *result;
-    zval offset;
+    zval offset; */
     style_helper *sh = (style_helper *) zend_object_store_get_object(object TSRMLS_CC);

     /*


* Fixed wait_for_input/3 to look in Prolog stream buffer before using select.

--- src/pl-file.c
+++ src/pl-file.c
@@ -1101,6 +1101,8 @@
   term_t head      = PL_new_term_ref();
   term_t streams   = PL_copy_term_ref(Streams);
   term_t available = PL_copy_term_ref(Available);
+  term_t ahead     = PL_new_term_ref();
+  int from_buffer  = 0;

   FD_ZERO(&fds);
   while( PL_get_list(streams, head, streams) )
@@ -1115,6 +1117,14 @@
 		      PL_new_atom("file_stream"), head);
     }
     releaseStream(s);
+					/* check for input in buffer */
+    if ( s->bufp < s->limitp )
+    { if ( !PL_unify_list(available, ahead, available) ||
+	   !PL_unify(ahead, head) )
+	fail;
+      from_buffer++;
+    }
+
     streammap[fd] = PL_copy_term_ref(head);

     FD_SET(fd, &fds);
@@ -1126,6 +1136,9 @@
   if ( !PL_get_float(timeout, &time) )
     return PL_error("wait_for_input", 3, NULL, ERR_TYPE, ATOM_float, timeout);

+  if ( from_buffer > 0 )
+    return PL_unify_nil(available);
+
   if ( time > 0.0 )
   { t.tv_sec  = (int)time;
     t.tv_usec = ((int)(time * 1000000) % 1000000);
@@ -1137,14 +1150,13 @@

   for(n=0; n <= max; n++)
   { if ( FD_ISSET(n, &fds) )
-    { if ( !PL_unify_list(available, head, available) ||
-	   !PL_unify(head, streammap[n]) )
+    { if ( !PL_unify_list(available, ahead, available) ||
+	   !PL_unify(ahead, streammap[n]) )
 	fail;
     }
   }
-  PL_unify_nil(available);
-
-  succeed;
+
+  return PL_unify_nil(available);
 }

 #endif /* HAVE_SELECT */


hack to make dota 2 menus work

hack to make dota 2 menus work

--- src/intel/vulkan/genX_cmd_buffer.c
+++ src/intel/vulkan/genX_cmd_buffer.c
@@ -721,8 +721,8 @@
    const VkRect2D *render_area = &pRenderPassBegin->renderArea;

    anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_DRAWING_RECTANGLE),
-                  .ClippedDrawingRectangleYMin = render_area->offset.y,
-                  .ClippedDrawingRectangleXMin = render_area->offset.x,
+                  .ClippedDrawingRectangleYMin = MAX2(render_area->offset.y, 0),
+                  .ClippedDrawingRectangleXMin = MAX2(render_area->offset.x, 0),
                   .ClippedDrawingRectangleYMax =
                      render_area->offset.y + render_area->extent.height - 1,
                   .ClippedDrawingRectangleXMax =


Fixed: Windows close_on_exec working the wrong way around.  Matt Lilley.

--- src/pl-file.c
+++ src/pl-file.c
@@ -1520,7 +1520,7 @@
   }
 #elif defined __WINDOWS__
   { if ( !SetHandleInformation((HANDLE)_get_osfhandle(fd),
-			       HANDLE_FLAG_INHERIT, val) )
+			       HANDLE_FLAG_INHERIT, !val) )
       return FALSE;
   }
 #else


Remove completed TODO

Remove completed TODO

--- ext/uri_parse/uri_parse.c
+++ ext/uri_parse/uri_parse.c
@@ -1,6 +1,3 @@
-/*
- * TODO: change from class to module (?)
-*/
 #include "uri_parse.h"
 #include "parse_machine.h"


anv/cmd_buffer: Emit CS push constants after binding tables

Emitting binding tables can cause push constants to be dirtied if the
shader uses images so we need to handle push constants later.

--- src/intel/vulkan/genX_cmd_buffer.c
+++ src/intel/vulkan/genX_cmd_buffer.c
@@ -1580,24 +1580,24 @@
       anv_batch_emit_batch(&cmd_buffer->batch, &pipeline->batch);
    }

-   if (cmd_buffer->state.push_constants_dirty & VK_SHADER_STAGE_COMPUTE_BIT) {
-      struct anv_state push_state =
-         anv_cmd_buffer_cs_push_constants(cmd_buffer);
-
-      if (push_state.alloc_size) {
-         anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_CURBE_LOAD), curbe) {
-            curbe.CURBETotalDataLength    = push_state.alloc_size;
-            curbe.CURBEDataStartAddress   = push_state.offset;
-         }
-      }
-   }
-
    if ((cmd_buffer->state.descriptors_dirty & VK_SHADER_STAGE_COMPUTE_BIT) ||
        (cmd_buffer->state.compute_dirty & ANV_CMD_DIRTY_PIPELINE)) {
       /* FIXME: figure out descriptors for gen7 */
       result = flush_compute_descriptor_set(cmd_buffer);
       assert(result == VK_SUCCESS);
       cmd_buffer->state.descriptors_dirty &= ~VK_SHADER_STAGE_COMPUTE_BIT;
+   }
+
+   if (cmd_buffer->state.push_constants_dirty & VK_SHADER_STAGE_COMPUTE_BIT) {
+      struct anv_state push_state =
+         anv_cmd_buffer_cs_push_constants(cmd_buffer);
+
+      if (push_state.alloc_size) {
+         anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_CURBE_LOAD), curbe) {
+            curbe.CURBETotalDataLength    = push_state.alloc_size;
+            curbe.CURBEDataStartAddress   = push_state.offset;
+         }
+      }
    }

    cmd_buffer->state.compute_dirty = 0;


FIXED: #predicate statistics when using temporary modules

--- src/pl-proc.c
+++ src/pl-proc.c
@@ -162,6 +162,7 @@
   }
   freeHeap(proc, sizeof(*proc));
   ATOMIC_SUB(&m->code_size, sizeof(*proc));
+  GD->statistics.predicates--;
 }


Fix buffer overflow that can occur in sta_set_eapaka in WTS 9.0.0

Member username defined in caStaSetEapAKA_t has lenght 32, but
in WTS 9.0.0 11N TC 5.2.24_ExS20 the username in sta_set_eapaka
command is longer than that, causing buffer overflow.

This patch increase the size of member username to 64.

Signed-off-by: Cedric Baudelet <5c53cc2331ed90787ee3e6a5db0968afba6f4c87@intel.com>

--- inc/wfa_cmds.h
+++ inc/wfa_cmds.h
@@ -166,7 +166,7 @@
 {
     char intf[WFA_IF_NAME_LEN];
     char ssid[WFA_SSID_NAME_LEN];
-    char username[32];
+    char username[64];
     char passwd[96];
     char keyMgmtType[8];
     char encrptype[9];


* Make compile with -DO_DEBUG

* Make compile with -DO_DEBUG

--- src/pl-prof.c
+++ src/pl-prof.c
@@ -820,7 +820,6 @@
 { call_node *node = current;

   accounting = TRUE;
-  DEBUG(1, Sdprintf("profCall(%s)\n", predicateName(def)));

   if ( !node )				/* root-node of the profile */
   { for(node = roots; node; node=node->next)
@@ -922,12 +921,8 @@
   accounting = TRUE;
   assert(!node || node->magic == PROFNODE_MAGIC);

-  DEBUG(1, Sdprintf("profExit(%s)\n",
-		    node ? predicateName(node->def) : "NULL"));
-
   for(n=current; n && n != node; n=n->parent)
-  { DEBUG(1, Sdprintf("\texit %s\n", predicateName(n->def)));
-    n->exits++;
+  { n->exits++;
   }
   accounting = FALSE;

@@ -940,8 +935,7 @@
 { assert(!node || node->magic == PROFNODE_MAGIC);

   if ( node )
-  { DEBUG(1, Sdprintf("profRedo(%s)\n", predicateName(node->def)));
-    node->redos++;
+  { node->redos++;
   }
   current = node;
 }


add include point to aabb

add include point to aabb

--- include/aabb.h
+++ include/aabb.h
@@ -43,6 +43,16 @@
         }
         return Y;
     }
+
+    void include(float _x, float _y) {
+        float x0 = std::min(m_min.x, _x);
+        float x1 = std::max(m_max.x, _x);
+        float y0 = std::min(m_min.y, _y);
+        float y1 = std::max(m_max.y, _y);
+
+        m_min = {x0, y0};
+        m_max = {x1 - x0, y1 - y0};
+    }

     void* m_userData;

@@ -51,7 +61,7 @@

 };

-static AABB unionAABB(const AABB& _aabb1, const AABB& _aabb2) {
+static inline AABB unionAABB(const AABB& _aabb1, const AABB& _aabb2) {
     AABB aabb;

     aabb.m_min.x = std::min(_aabb1.m_min.x, _aabb2.m_min.x);


Updated docs.

Updated docs.

--- include/bgfx.h
+++ include/bgfx.h
@@ -1210,6 +1210,17 @@

 	/// Set view view and projection matrices, all draw primitives in this
 	/// view will use these matrices.
+	///
+	/// @param _id View id.
+	/// @param _view View matrix.
+	/// @param _projL Projection matrix. When using stereo rendering this projection matrix
+	///   represent projection matrix for left eye.
+	/// @param _flags View flags. Use
+	///   - `BGFX_VIEW_NONE` - View will be rendered only once if stereo mode is enabled.
+	///   - `BGFX_VIEW_STEREO` - View will be rendered for both eyes if stereo mode is enabled. When
+	///     stereo mode is disabled this flag doesn't have effect.
+	/// @param _projR Projection matrix for right eye in stereo mode.
+	///
 	void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags = BGFX_VIEW_STEREO, const void* _projR = NULL);

 	/// Post submit view reordering.


block sync functions for bits-class

block sync functions for bits-class

--- include/bits.h
+++ include/bits.h
@@ -3,6 +3,8 @@
 #include <cstdint>
 #include <boost/preprocessor/repetition/repeat.hpp>
 #include <boost/preprocessor/tuple/elem.hpp>
+
+#include <memory/block.h>

 namespace giecs
 {
@@ -65,12 +67,21 @@
 		{ \
 			return Bits(this->value op v); \
 		} \
+		Bits operator op (Bits const v) const \
+		{ \
+			return Bits(this->value op v.value); \
+		} \

 #define OPERATOR_EQ(op) \
 		template <typename T> \
 		Bits& operator op (T const v) \
 		{ \
 			this->value op v; \
+			return *this; \
+		} \
+		Bits& operator op (Bits const v) \
+		{ \
+			this->value op v.value; \
 			return *this; \
 		} \

@@ -113,5 +124,94 @@
     return bitsize<T>();
 }

+namespace memory
+{
+/*  E X A M P L E
+ *  page_size = 2
+ *  block_size = 2
+ *                          offset = 1 (x align_t)
+ *                          V
+ *          |     buf[0]    |      buf[1]   |
+ *   – – – –|– – – – – – – –|– – – – – – – –|– – – –   buf (align_t)
+ *          |            P A G E            |
+ *  –––––––––––––––––––––––––––––––––––––––––––––––––
+ *  |       B L O C K       |       B L O C K       |
+ *  |– – – – – –|– – – – – –|– – – – – –|– – – – – –|  block (val_t)
+ *  |block[i-1] | block[i]  |  block[0] | block[1]  |
+ *
+ *  ^       ^ boff = 8 bits ^
+ *  |       |_ _ _ _ _ _ _ _|
+ *  |
+ *  |           ^ ioff = 1  ^
+ *  |           | i = 1     |
+ *  |       ^   ^
+ *  |       |_ _| bitoff = 2 bits
+ *  |
+ *  block_id = -1
+ */
+
+template <size_t page_size, int N_align, int N_val>
+void read_block(TypeBlock<page_size, Bits<N_align>, Bits<N_val>> const& block, int off, int bitoff, Bits<N_align>* buf)
+{
+    int i = 0;
+    if(off < 0)
+    {
+        i -= (off * N_align + bitoff) / N_val;
+        off = 0;
+    }
+
+    size_t  block_size = 4;
+    while(off < page_size && i <= block_size)
+    {
+        Bits<N_align> a = Bits<N_align>();
+
+        if(bitoff > 0 && i > 0)
+            a = Bits<N_align>(block[i-1] >> (N_val - bitoff));
+
+        while(bitoff < N_align && i < block_size)
+        {
+            if(bitoff < 0)
+                a = Bits<N_align>(block[i++] >> (-bitoff));
+            else
+                a |= Bits<N_align>(block[i++]) << bitoff;
+            bitoff += N_val;
+        }
+        bitoff -= N_align;
+        buf[off++] |= a;
+    }
+}
+
+template <size_t page_size, int N_align, int N_val>
+void write_block(TypeBlock<page_size, Bits<N_align>, Bits<N_val>> const& block, int off, int bitoff, Bits<N_align> const* buf)
+{
+    int i = 0;
+    if(off < 0)
+    {
+        i -= (off * N_align + bitoff) / N_val;
+        off = 0;
+    }
+
+    size_t block_size = 4;
+    while(off < page_size && i <= block_size)
+    {
+        Bits<N_align> a = buf[off++];
+
+        if(bitoff > 0 && i > 0)
+            block[i-1] |= Bits<N_val>(a) << (N_val - bitoff);
+
+        while(bitoff < N_align && i < block_size)
+        {
+            if(bitoff < 0)
+                block[i++] |= Bits<N_val>(a) << (-bitoff);
+            else
+                block[i++] |= Bits<N_val>(a >> bitoff);
+            bitoff += N_val;
+        }
+        bitoff -= N_align;
+    }
+}
+
+} // namespace memory
+
 } // namespace giecs


space

space

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@11907 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- include/bmap.h
+++ include/bmap.h
@@ -273,7 +273,7 @@
 					    BMAPGETF_LOAD, (bp))

 #define bmap_get_noretr(f, n, rw, bp)   bmap_getf((f), (n), (rw),	\
-				  BMAPGETF_LOAD|BMAPGETF_NORETRIEVE, (bp))
+					  BMAPGETF_LOAD | BMAPGETF_NORETRIEVE, (bp))

 #define bmap_op_start_type(b, type)					\
 	do {								\


Bumped version for 2.2.0

Bumped version for 2.2.0

--- include/czmq.h
+++ include/czmq.h
@@ -33,7 +33,7 @@
 //  CZMQ version macros for compile-time API detection

 #define CZMQ_VERSION_MAJOR 2
-#define CZMQ_VERSION_MINOR 1
+#define CZMQ_VERSION_MINOR 2
 #define CZMQ_VERSION_PATCH 0

 #define CZMQ_MAKE_VERSION(major, minor, patch) \


add lefty, dotty, lneato to graphviz2 tree

error: pathspec 'cmd/lefty/ws/gtk/gcanvas.c' did not match any file(s) known to git

--- cmd/lefty/ws/gtk/gcanvas.c
+++ cmd/lefty/ws/gtk/gcanvas.c
@@ -0,0 +1,1192 @@
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+
+#include "common.h"
+#include "g.h"
+#include "gcommon.h"
+
+#define WCU widget->u.c
+#define WINDOW widget->u.c->window
+#define GC widget->u.c->gc
+#define ISVISIBLE(r) ( \
+	(r.o.x <= WCU->clip.c.x) && (r.c.x >= WCU->clip.o.x) && \
+	(r.o.y <= WCU->clip.c.y) && (r.c.y >= WCU->clip.o.y) \
+)
+
+#define IS8BIT(font) ((font)->min_byte1 == 0 && (font)->max_byte1 == 0)
+#define max(a, b) (((a) >= (b)) ? (a) : (b))
+#define min(a, b) (((a) <= (b)) ? (a) : (b))
+
+#define SETFONT(font) { \
+	if(font != WCU->font) { \
+		WCU->font = font; \
+		gdk_gc_set_font(GC, font); \
+	} \
+}
+
+Gwidget_t *canvas;
+static int curcursori = -1;
+
+static gchar gstyles[][2] = {
+    /* G_SOLID */ {16},
+    /* G_DASHED */ {4, 4},
+    /* G_DOTTED */ {2, 2},
+    /* G_LONGDASHED */ {4, 12},
+    /* G_SHORTDASHED */ {12, 4}
+};
+
+static char grays[][4] = {
+    {0x00, 0x00, 0x00, 0x00,},
+    {0x08, 0x00, 0x00, 0x00,},
+    {0x08, 0x00, 0x02, 0x00,},
+    {0x0A, 0x00, 0x02, 0x00,},
+    {0x0A, 0x00, 0x0A, 0x00,},
+    {0x0A, 0x04, 0x0A, 0x00,},
+    {0x0A, 0x04, 0x0A, 0x01,},
+    {0x0A, 0x05, 0x0A, 0x01,},
+    {0x0A, 0x05, 0x0A, 0x05,},
+    {0x0E, 0x05, 0x0A, 0x05,},
+    {0x0E, 0x05, 0x0B, 0x05,},
+    {0x0F, 0x05, 0x0B, 0x05,},
+    {0x0F, 0x05, 0x0F, 0x05,},
+    {0x0F, 0x0D, 0x0F, 0x05,},
+    {0x0F, 0x0D, 0x0F, 0x07,},
+    {0x0F, 0x0F, 0x0F, 0x07,},
+    {0x0F, 0x0F, 0x0F, 0x0F,},
+};
+
+static void setgattr(Gwidget_t *, Ggattr_t *);
+
+static PIXrect_t rdrawtopix(Gwidget_t *, Grect_t);
+static PIXpoint_t pdrawtopix(Gwidget_t *, Gpoint_t);
+static PIXsize_t sdrawtopix(Gwidget_t *, Gsize_t);
+static Gpoint_t Gppixtodraw(Gwidget_t *, PIXpoint_t);
+static Gsize_t spixtodraw(Gwidget_t *, PIXsize_t);
+static Grect_t rpixtodraw(Gwidget_t *, PIXrect_t);
+static PIXrect_t rdrawtobpix(Gbitmap_t *, Grect_t);
+static PIXpoint_t pdrawtobpix(Gbitmap_t *, Gpoint_t);
+static void adjustclip(Gwidget_t *);
+
+
+int GCcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
+		   int attrn, Gwattr_t * attrp)
+{
+    PIXsize_t ps;
+    int width, height;
+    int ai, i;
+    GdkGCValues gcv;
+    int r, g, b, color;
+    GdkColor *cp;
+
+    if (!parent) {
+	Gerr(POS, G_ERRNOPARENTWIDGET);
+	return -1;
+    }
+
+    canvas = widget;
+    WCU->func = NULL;
+    WCU->needredraw = FALSE;
+    WCU->buttonsdown = 0;
+    WCU->bstate[0] = WCU->bstate[1] = WCU->bstate[2] = 0;
+    ps.x = ps.y = MINCWSIZE;
+
+    for (ai = 0; ai < attrn; ai++) {
+	switch (attrp[ai].id) {
+	case G_ATTRSIZE:
+	    GETSIZE(attrp[ai].u.s, ps, MINCWSIZE);
+	    break;
+	case G_ATTRBORDERWIDTH:
+	    break;
+#ifdef FEATURE_GMAP
+	case G_ATTRMODE:
+	    if (Strcmp("gmap", attrp[ai].u.t) == 0) {
+		gmapmode = TRUE;
+	    } else {
+		Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+		return -1;
+	    }
+	    break;
+#endif
+	case G_ATTRCURSOR:
+	    break;
+	case G_ATTRCOLOR:
+	    break;
+	case G_ATTRVIEWPORT:
+	    break;
+	case G_ATTRWINDOW:
+	    break;
+	case G_ATTRWINDOWID:
+	    Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
+	    return -1;
+	case G_ATTREVENTCB:
+	    WCU->func = (Gcanvascb) attrp[ai].u.func;
+	    break;
+	case G_ATTRUSERDATA:
+	    widget->udata = attrp[ai].u.u;
+	    break;
+	default:
+	    Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
+	    return -1;
+	}
+    }
+/*    	XtSetValues (widget->w, argp, argn);	*/
+
+    widget->w = gtk_drawing_area_new();
+    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(parent->w),
+					  widget->w);
+    gtk_drawing_area_size(GTK_DRAWING_AREA(widget->w), ps.x, ps.y);
+
+    gtk_widget_add_events(widget->w, GDK_ALL_EVENTS_MASK);
+    gtk_signal_connect(GTK_OBJECT(widget->w), "key_release_event",
+		       GTK_SIGNAL_FUNC(Gcwkeyaction), NULL);
+    gtk_signal_connect(GTK_OBJECT(widget->w), "key_press_event",
+		       GTK_SIGNAL_FUNC(Gcwkeyaction), NULL);
+    gtk_signal_connect(G_OBJECT(widget->w), "button_press_event",
+		       GTK_SIGNAL_FUNC(Gcwbutaction), NULL);
+    gtk_signal_connect(G_OBJECT(widget->w), "button_release_event",
+		       GTK_SIGNAL_FUNC(Gcwbutaction), NULL);
+    gtk_signal_connect(G_OBJECT(widget->w), "visibility_notify_event",
+		       GTK_SIGNAL_FUNC(cweventhandler), NULL);
+    gtk_signal_connect(G_OBJECT(widget->w), "expose_event",
+		       GTK_SIGNAL_FUNC(exposeeventhandler), NULL);
+    gtk_signal_connect(G_OBJECT(widget->w), "motion_notify_event",
+		       GTK_SIGNAL_FUNC(cweventhandler), NULL);
+
+    gtk_widget_show(widget->w);
+    gtk_widget_show(parent->w);
+
+    GC = gdk_gc_new(widget->w->window);
+    WCU->cmap = gdk_colormap_get_system();
+    WCU->colors[0].color.pixel = WCU->colors[1].color.pixel = 1000000;
+    if (WCU->colors[0].color.pixel == 1000000) {
+	gdk_gc_get_values(GC, &gcv);
+	WCU->colors[0].color = gcv.background;
+    }
+    if (WCU->colors[1].color.pixel == 1000000) {
+	gdk_gc_get_values(GC, &gcv);
+	WCU->colors[1].color = gcv.foreground;
+    }
+
+    WCU->colors[0].color.red = 65535;
+    WCU->colors[0].color.green = 65535;
+    WCU->colors[0].color.blue = 65535;
+    WCU->colors[1].color.red = 0;
+    WCU->colors[1].color.green = 0;
+    WCU->colors[1].color.blue = 0;
+
+    gdk_colormap_alloc_color(WCU->cmap, &WCU->colors[0].color, FALSE,
+			     TRUE);
+    WCU->colors[0].inuse = TRUE;
+    gdk_colormap_alloc_color(WCU->cmap, &WCU->colors[1].color, FALSE,
+			     TRUE);
+    WCU->colors[1].inuse = TRUE;
+
+    WCU->allocedcolor[0] = WCU->allocedcolor[1] = FALSE;
+    for (i = 2; i < G_MAXCOLORS; i++)
+	WCU->colors[i].inuse = FALSE;
+
+    WCU->gattr.color = 1;
+/*	gdk_gc_set_background(GC, widget->w->style->white_gc);
+	gdk_gc_set_foreground(GC, widget->w->style->black_gc);
+*/
+
+    WCU->gattr.width = 0;
+    WCU->gattr.mode = 0;
+    WCU->gattr.fill = 0;
+    WCU->gattr.style = 0;
+    WCU->defgattr = WCU->gattr;
+    WCU->font = NULL;
+    WCU->wrect.o.x = 0.0, WCU->wrect.o.y = 0.0;
+    WCU->wrect.c.x = 1.0, WCU->wrect.c.y = 1.0;
+    WCU->vsize.x = ps.x, WCU->vsize.y = ps.y;
+
+    for (ai = 0; ai < attrn; ai++) {
+	switch (attrp[ai].id) {
+	case G_ATTRCURSOR:
+	    if (Strcmp(attrp[ai].u.t, "default") == 0) {
+		curcursori = -1;
+	    }
+	    break;
+	case G_ATTRCOLOR:
+	    color = attrp[ai].u.c.index;
+	    if (color < 0 || color > G_MAXCOLORS) {
+		Gerr(POS, G_ERRBADCOLORINDEX, color);
+		return -1;
+	    }
+	    r = attrp[ai].u.c.r * 257;
+	    g = attrp[ai].u.c.g * 257;
+	    b = attrp[ai].u.c.b * 257;
+	    cp = &WCU->colors[color].color;
+	    if (WCU->colors[color].inuse)
+		if (cp->red != r || cp->green != g || cp->blue != b)
+		    if (color > 1 || WCU->allocedcolor[color])
+			gdk_colormap_free_colors(WCU->cmap, cp, 1);
+
+	    cp->red = r, cp->green = g, cp->blue = b;
+	    if (gdk_colormap_alloc_color(WCU->cmap, cp, TRUE, TRUE)) {
+		WCU->colors[color].inuse = TRUE;
+		if (color <= 1)
+		    WCU->allocedcolor[color] = TRUE;
+	    }
+	    cp->red = r, cp->green = g, cp->blue = b;
+	    if (color == WCU->gattr.color)
+		WCU->gattr.color = -1;
+	    break;
+	case G_ATTRVIEWPORT:
+	    WCU->vsize.x = (int) (attrp[ai].u.s.x + 0.5);
+	    WCU->vsize.y = (int) (attrp[ai].u.s.y + 0.5);
+	    break;
+	case G_ATTRWINDOW:
+	    WCU->wrect = attrp[ai].u.r;
+	    break;
+	}
+    }
+    adjustclip(widget);
+    return 0;
+}
+
+
+int GCsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
+{
+    PIXsize_t ps;
+    int ai, r, g, b, color;
+    GdkColor *cp;
+
+    for (ai = 0; ai < attrn; ai++) {
+	switch (attrp[ai].id) {
+	case G_ATTRSIZE:
+	    GETSIZE(attrp[ai].u.s, ps, MINCWSIZE);
+	    gtk_drawing_area_size(GTK_DRAWING_AREA(widget->w), ps.x, ps.y);
+	    break;
+	case G_ATTRBORDERWIDTH:
+	    break;
+	case G_ATTRCURSOR:
+	    if (Strcmp(attrp[ai].u.t, "watch") == 0) {
+		gdk_window_set_cursor(widget->w->window,
+				      gdk_cursor_new(GDK_WATCH));
+	    } else {
+		gdk_window_set_cursor(widget->w->window,
+				      gdk_cursor_new(GDK_LEFT_PTR));
+	    }
+	    Gsync();
+	    break;
+	case G_ATTRCOLOR:
+	    color = attrp[ai].u.c.index;
+	    if (color < 0 || color > G_MAXCOLORS) {
+		Gerr(POS, G_ERRBADCOLORINDEX, color);
+		return -1;
+	    }
+	    r = attrp[ai].u.c.r * 257;
+	    g = attrp[ai].u.c.g * 257;
+	    b = attrp[ai].u.c.b * 257;
+	    cp = &WCU->colors[color].color;
+	    if (WCU->colors[color].inuse)
+		if (cp->red != r || cp->green != g || cp->blue != b)
+		    if (color > 1 || WCU->allocedcolor[color])
+			gdk_colormap_free_colors(WCU->cmap, cp, 1);
+
+	    cp->red = r, cp->green = g, cp->blue = b;
+	    if (gdk_colormap_alloc_color(WCU->cmap, cp, TRUE, TRUE)) {
+		WCU->colors[color].inuse = TRUE;
+		if (color <= 1)
+		    WCU->allocedcolor[color] = TRUE;
+	    }
+	    cp->red = r, cp->green = g, cp->blue = b;
+	    if (color == WCU->gattr.color)
+		WCU->gattr.color = -1;
+	    break;
+	case G_ATTRVIEWPORT:
+	    WCU->vsize.x = (int) (attrp[ai].u.s.x + 0.5);
+	    WCU->vsize.y = (int) (attrp[ai].u.s.y + 0.5);
+	    break;
+	case G_ATTRWINDOW:
+	    WCU->wrect = attrp[ai].u.r;
+	    adjustclip(widget);
+	    break;
+	case G_ATTRWINDOWID:
+	    Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
+	    return -1;
+	case G_ATTREVENTCB:
+	    WCU->func = (Gcanvascb) attrp[ai].u.func;
+	    break;
+	case G_ATTRUSERDATA:
+	    widget->udata = attrp[ai].u.u;
+	    break;
+	default:
+	    Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
+	    return -1;
+	}
+    }
+    return 0;
+}
+
+
+int GCgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
+{
+    GdkColor *cp;
+    int width, height;
+    int ai, color;
+
+    for (ai = 0; ai < attrn; ai++) {
+	switch (attrp[ai].id) {
+	case G_ATTRSIZE:
+	    attrp[ai].u.s.x = width, attrp[ai].u.s.y = height;
+	    break;
+	case G_ATTRBORDERWIDTH:
+	    attrp[ai].u.i = width;
+	    break;
+	case G_ATTRCURSOR:
+/*				attrp[ai].u.t = (curcursori == -1) ? "default" : cursormap[curcursori].name;
+*/
+	    attrp[ai].u.t = (curcursori == -1) ? "default" : "watch";
+	    break;
+	case G_ATTRCOLOR:
+	    color = attrp[ai].u.c.index;
+	    if (color < 0 || color > G_MAXCOLORS) {
+		Gerr(POS, G_ERRBADCOLORINDEX, color);
+		return -1;
+	    }
+	    if (WCU->colors[color].inuse) {
+		cp = &WCU->colors[color].color;
+		attrp[ai].u.c.r = cp->red / 257.0;
+		attrp[ai].u.c.g = cp->green / 257.0;
+		attrp[ai].u.c.b = cp->blue / 257.0;
+	    } else {
+		attrp[ai].u.c.r = -1;
+		attrp[ai].u.c.g = -1;
+		attrp[ai].u.c.b = -1;
+	    }
+	    break;
+	case G_ATTRVIEWPORT:
+	    attrp[ai].u.s = WCU->vsize;
+	    break;
+	case G_ATTRWINDOW:
+	    attrp[ai].u.r = WCU->wrect;
+	    break;
+	case G_ATTRWINDOWID:
+	    sprintf(&Gbufp[0], "0x%lx", (unsigned long) widget->w);
+	    break;
+	case G_ATTREVENTCB:
+	    attrp[ai].u.func = WCU->func;
+	    break;
+	case G_ATTRUSERDATA:
+	    attrp[ai].u.u = widget->udata;
+	    break;
+	default:
+	    Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
+	    return -1;
+	}
+    }
+    return 0;
+}
+
+
+int GCdestroywidget(Gwidget_t * widget)
+{
+    gtk_widget_destroy(widget->w);
+    return 0;
+}
+
+
+int GCsetgfxattr(Gwidget_t * widget, Ggattr_t * ap)
+{
+    setgattr(widget, ap);
+    WCU->defgattr = WCU->gattr;
+    return 0;
+}
+
+
+int GCarrow(Gwidget_t * widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t * ap)
+{
+
+    PIXpoint_t pp1, pp2, pa, pb, pd;
+    Grect_t gr;
+    double tangent, l;
+
+    if (gp1.x < gp2.x)
+	gr.o.x = gp1.x, gr.c.x = gp2.x;
+    else
+	gr.o.x = gp2.x, gr.c.x = gp1.x;
+    if (gp1.y < gp2.y)
+	gr.o.y = gp1.y, gr.c.y = gp2.y;
+    else
+	gr.o.y = gp2.y, gr.c.y = gp1.y;
+
+    pp1 = pdrawtopix(widget, gp1), pp2 = pdrawtopix(widget, gp2);
+    pd.x = pp1.x - pp2.x, pd.y = pp1.y - pp2.y;
+    if (pd.x == 0 && pd.y == 0)
+	return 0;
+    tangent = atan2((double) pd.y, (double) pd.x);
+    if ((l = sqrt((double) (pd.x * pd.x + pd.y * pd.y))) > 30)
+	l = 30;
+    pa.x = l * cos(tangent + M_PI / 7) + pp2.x;
+    pa.y = l * sin(tangent + M_PI / 7) + pp2.y;
+    pb.x = l * cos(tangent - M_PI / 7) + pp2.x;
+    pb.y = l * sin(tangent - M_PI / 7) + pp2.y;
+    setgattr(widget, ap);
+
+    gdk_draw_line(widget->w->window, GC, pp1.x, pp1.y, pp2.x, pp2.y);
+    gdk_draw_line(widget->w->window, GC, pa.x, pa.y, pp2.x, pp2.y);
+    gdk_draw_line(widget->w->window, GC, pb.x, pb.y, pp2.x, pp2.y);
+    return 0;
+}
+
+
+int GCline(Gwidget_t * widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t * ap)
+{
+    PIXpoint_t pp1, pp2;
+    Grect_t gr;
+
+    if (gp1.x < gp2.x)
+	gr.o.x = gp1.x, gr.c.x = gp2.x;
+    else
+	gr.o.x = gp2.x, gr.c.x = gp1.x;
+    if (gp1.y < gp2.y)
+	gr.o.y = gp1.y, gr.c.y = gp2.y;
+    else
+	gr.o.y = gp2.y, gr.c.y = gp1.y;
+
+/*	if(!ISVISIBLE(gr))
+		return 1;
+*/
+
+    pp1 = pdrawtopix(widget, gp1), pp2 = pdrawtopix(widget, gp2);
+    setgattr(widget, ap);
+    gdk_draw_line(widget->w->window, GC, pp1.x, pp1.y, pp2.x, pp2.y);
+    return 0;
+}
+
+
+int GCbox(Gwidget_t * widget, Grect_t gr, Ggattr_t * ap)
+{
+    PIXrect_t pr;
+    Gxy_t p;
+
+    if (gr.o.x > gr.c.x)
+	p.x = gr.o.x, gr.o.x = gr.c.x, gr.c.x = p.x;
+    if (gr.o.y > gr.c.y)
+	p.y = gr.o.y, gr.o.y = gr.c.y, gr.c.y = p.y;
+/*	if(!ISVISIBLE(gr))
+		return 1;
+*/
+
+    pr = rdrawtopix(widget, gr);
+    setgattr(widget, ap);
+    if (WCU->gattr.fill)
+	gdk_draw_rectangle(widget->w->window, GC, TRUE, pr.o.x, pr.o.y,
+			   pr.c.x - pr.o.x, pr.c.y - pr.o.y);
+    else {
+	gdk_draw_rectangle(widget->w->window, GC, FALSE, pr.o.x, pr.o.y,
+			   pr.c.x - pr.o.x, pr.c.y - pr.o.y);
+    }
+
+    return 0;
+}
+
+
+int GCpolygon(Gwidget_t * widget, int gpn, Gpoint_t * gpp, Ggattr_t * ap)
+{
+
+    Grect_t gr;
+    int n, i;
+
+    if (gpn == 0)
+	return 0;
+
+    gr.o = gpp[0], gr.c = gpp[0];
+    for (i = 1; i < gpn; i++) {
+	gr.o.x = min(gr.o.x, gpp[i].x);
+	gr.o.y = min(gr.o.y, gpp[i].y);
+	gr.c.x = min(gr.c.x, gpp[i].x);
+	gr.c.y = min(gr.c.y, gpp[i].y);
+    }
+/*	if(!ISVISIBLE(gr))
+		return 1;
+*/
+    if (gpn + 1 > Gppn) {
+	n = (((gpn + 1) + PPINCR - 1) / PPINCR) * PPINCR;
+	Gppp = Marraygrow(Gppp, (long) n * PPSIZE);
+	Gppn = n;
+    }
+    for (i = 0; i < gpn; i++)
+	Gppp[i] = pdrawtopix(widget, gpp[i]);
+
+    setgattr(widget, ap);
+    if (WCU->gattr.fill) {
+	if (Gppp[gpn - 1].x != Gppp[0].x || Gppp[gpn - 1].y != Gppp[0].y)
+	    Gppp[gpn] = Gppp[0], gpn++;
+
+	gdk_draw_polygon(widget->w, GC, TRUE, Gppp, gpn);
+    } else
+	gdk_draw_polygon(widget->w, GC, FALSE, Gppp, gpn);
+
+    return 0;
+}
+
+
+static void bezier(PIXpoint_t p0, PIXpoint_t p1, PIXpoint_t p2,
+		   PIXpoint_t p3)
+{
+
+    Gpoint_t gp0, gp1, gp2;
+    Gsize_t s;
+    PIXpoint_t p;
+    double t;
+    int n, i, steps;
+
+    if ((s.x = p3.x - p0.x) < 0)
+	s.x = -s.x;
+    if ((s.y = p3.y - p0.y) < 0)
+	s.y = -s.y;
+    if (s.x > s.y)
+	steps = s.x / 5 + 1;
+    else
+	steps = s.y / 5 + 1;
+    for (i = 0; i <= steps; i++) {
+	t = i / (double) steps;
+	gp0.x = p0.x + t * (p1.x - p0.x);
+	gp0.y = p0.y + t * (p1.y - p0.y);
+	gp1.x = p1.x + t * (p2.x - p1.x);
+	gp1.y = p1.y + t * (p2.y - p1.y);
+	gp2.x = p2.x + t * (p3.x - p2.x);
+	gp2.y = p2.y + t * (p3.y - p2.y);
+	gp0.x = gp0.x + t * (gp1.x - gp0.x);
+	gp0.y = gp0.y + t * (gp1.y - gp0.y);
+	gp1.x = gp1.x + t * (gp2.x - gp1.x);
+	gp1.y = gp1.y + t * (gp2.y - gp1.y);
+	p.x = gp0.x + t * (gp1.x - gp0.x) + 0.5;
+	p.y = gp0.y + t * (gp1.y - gp0.y) + 0.5;
+	if (Gppi >= Gppn) {
+	    n = (((Gppi + 1) + PPINCR - 1) / PPINCR) * PPINCR;
+	    Gppp = Marraygrow(Gppp, (long) n * PPSIZE);
+	    Gppn = n;
+	}
+	Gppp[Gppi++] = p;
+    }
+}
+
+
+int GCsplinegon(Gwidget_t * widget, int gpn, Gpoint_t * gpp, Ggattr_t * ap)
+{
+
+    PIXpoint_t p0, p1, p2, p3;
+    Grect_t gr;
+    int n, i;
+
+    if (gpn == 0)
+	return 0;
+
+    gr.o = gpp[0], gr.c = gpp[0];
+    for (i = 1; i < gpn; i++) {
+	gr.o.x = min(gr.o.x, gpp[i].x);
+	gr.o.y = min(gr.o.y, gpp[i].y);
+	gr.c.x = max(gr.c.x, gpp[i].x);
+	gr.c.x = max(gr.c.x, gpp[i].y);
+    }
+
+    Gppi = 1;
+    if (Gppi >= Gppn) {
+	n = (((Gppi + 1) + PPINCR - 1) / PPINCR) * PPINCR;
+	Gppp = Marraygrow(Gppp, (long) n * PPSIZE);
+	Gppn = n;
+    }
+    Gppp[0] = p3 = pdrawtopix(widget, gpp[0]);
+    for (i = 1; i < gpn; i += 3) {
+	p0 = p3;
+	p1 = pdrawtopix(widget, gpp[i]);
+	p2 = pdrawtopix(widget, gpp[i + 1]);
+	p3 = pdrawtopix(widget, gpp[i + 2]);
+	bezier(p0, p1, p2, p3);
+    }
+    setgattr(widget, ap);
+    gdk_draw_lines(widget->w->window, GC, Gppp, Gppi);
+    return 0;
+}
+
+
+int GCarc(Gwidget_t * widget, Gpoint_t gc, Gsize_t gs, double ang1,
+	  double ang2, Ggattr_t * ap)
+{
+
+    PIXpoint_t pc;
+    PIXsize_t ps;
+    Grect_t gr;
+
+    gr.o.x = gc.x - gs.x, gr.o.y = gc.y - gs.y;
+    gr.c.x = gc.x + gs.x, gr.c.y = gc.y + gs.y;
+/*	if(!ISVISIBLE(gr))
+		return 1;
+*/
+
+    pc = pdrawtopix(widget, gc), ps = sdrawtopix(widget, gs);
+    setgattr(widget, ap);
+
+    if (WCU->gattr.fill) {
+	gdk_draw_arc(widget->w->window, GC, TRUE, pc.x - ps.x, pc.y - ps.y,
+		     ps.x * 2, ps.y * 2, (int) (ang1 * 64), (ang2 * 64));
+    } else {
+	gdk_draw_arc(widget->w->window, GC, FALSE, pc.x - ps.x,
+		     pc.y - ps.y, ps.x * 2, ps.y * 2, (int) (ang1 * 64),
+		     (ang2 * 64));
+    }
+    return 0;
+}
+
+
+static GdkFont *findfont(char *name, int size)
+{
+    GdkFont *font;
+    int fi, n, i;
+
+    if (name[0] == '\000')
+	return Gfontp[0].font;
+
+    sprintf(&Gbufp[0], name, size);
+    for (fi = 0; fi < Gfontn; fi++)
+	if (Strcmp(&Gbufp[0], Gfontp[fi].name) == 0)
+	    return Gfontp[fi].font;
+
+    if (!(font = gdk_font_load(&Gbufp[0]))) {
+	n = strlen(&Gbufp[0]) + 1;
+	for (i = 1; i < size; i++) {
+	    sprintf(&Gbufp[n], name, size - i);
+	    if ((font = gdk_font_load(&Gbufp[n])))
+		break;
+	    sprintf(&Gbufp[n], name, size + i);
+	    if ((font = gdk_font_load(&Gbufp[n])))
+		break;
+	}
+    }
+    if (!font)
+	font = Gfontp[0].font;
+
+    Gfontp = Marraygrow(Gfontp, (long) (Gfontn + 1) * FONTSIZE);
+    Gfontp[Gfontn].name = strdup(&Gbufp[0]);
+    Gfontp[Gfontn].font = font;
+    Gfontn++;
+    return font;
+}
+
+
+int GCtext(Gwidget_t * widget, Gtextline_t * tlp, int n, Gpoint_t go,
+	   char *fn, double fs, char *justs, Ggattr_t * ap)
+{
+
+    Gsize_t gs;
+    PIXpoint_t po;
+    PIXsize_t ps;
+    PIXrect_t pr;
+    Grect_t gr;
+    GdkFont *font;
+    int dir, asc, des, x = 0, y, w, h, i;
+    int lbearing, rbearing, width;
+
+    po = pdrawtopix(widget, go);
+    gs.x = 0, gs.y = fs;
+    ps = sdrawtopix(widget, gs);
+    if (!(font = findfont(fn, ps.y))) {
+	printf("NO FONT\n");
+	gdk_draw_rectangle(widget->w, GC, FALSE, po.x, po.y, 1, 1);
+	return 0;
+    }
+
+    setgattr(widget, ap);
+    SETFONT(font);
+
+    for (w = h = 0, i = 0; i < n; i++) {
+	gdk_text_extents(font, tlp[i].p, tlp[i].n, &lbearing, &rbearing,
+			 &width, &asc, &des);
+
+	tlp[i].w = width, tlp[i].h = asc + des;
+	w = max(w, width), h += asc + des;
+
+    }
+
+    switch (justs[0]) {
+    case 'l':
+	po.x += w / 2;
+	break;
+    case 'r':
+	po.x -= w / 2;
+	break;
+    }
+    switch (justs[1]) {
+    case 'd':
+	po.y -= h;
+	break;
+    case 'c':
+	po.y -= h / 2;
+	break;
+    }
+    pr.o.x = po.x - w / 2, pr.o.y = po.y;
+    pr.c.x = po.x + w / 2, pr.c.y = po.y + h;
+    gr = rpixtodraw(widget, pr);
+
+/*	if(!ISVISIBLE(gr))
+		return 1;
+*/
+
+    for (i = 0; i < n; i++) {
+	switch (tlp[i].j) {
+	case 'l':
+	    x = po.x - w / 2;
+	    break;
+	case 'n':
+	    x = po.x - tlp[i].w / 2;
+	    break;
+	case 'r':
+	    x = po.x - (tlp[i].w - w / 2);
+	    break;
+	}
+	y = po.y + (i + 1) * tlp[i].h - des;
+
+	gdk_draw_text(widget->w->window, font, GC, x, y, tlp[i].p,
+		      tlp[i].n);
+    }
+
+    return 0;
+}
+
+
+int GCgettextsize(Gwidget_t * widget, Gtextline_t * tlp, int n, char *fn,
+		  double fs, Gsize_t * gsp)
+{
+
+    Gsize_t gs;
+    PIXsize_t ps;
+    GdkFont *font;
+    int i, dir, asc, des, rbearing, lbearing, width;
+
+    gs.x = 0, gs.y = fs;
+    ps = sdrawtopix(widget, gs);
+    if (!(font = findfont(fn, ps.y))) {
+	gsp->x = 1, gsp->y = 1;
+	return 0;
+    }
+    SETFONT(font);
+    for (ps.x = ps.y = 0, i = 0; i < n; i++) {
+	gdk_text_extents(font, tlp[i].p, tlp[i].n, &lbearing, &rbearing,
+			 &width, &asc, &des);
+	ps.x = max(ps.x, width), ps.y += asc + des;
+    }
+
+    *gsp = spixtodraw(widget, ps);
+    return 0;
+}
+
+
+int GCcreatebitmap(Gwidget_t * widget, Gbitmap_t * bitmap, Gsize_t s)
+{
+
+    return 0;
+}
+
+
+int GCdestroybitmap(Gbitmap_t * bitmap)
+{
+
+    return 0;
+}
+
+
+int GCreadbitmap(Gwidget_t * widget, Gbitmap_t * bitmap, FILE * fp)
+{
+
+    return 0;
+}
+
+
+int GCwritebitmap(Gbitmap_t * bitmap, FILE * fp)
+{
+
+    return 0;
+}
+
+
+int GCbitblt(Gwidget_t * widget, Gpoint_t gp, Grect_t gr,
+	     Gbitmap_t * bitmap, char *mode, Ggattr_t * ap)
+{
+}
+
+
+int GCgetmousecoords(Gwidget_t * widget, Gpoint_t * gpp, int *count)
+{
+    PIXpoint_t pp;
+    int state;
+
+    gdk_window_get_pointer(widget->w->window, &pp.x, &pp.y, &state);
+    *gpp = Gppixtodraw(widget, pp);
+    *count = 1;
+
+    return 0;
+}
+
+
+int GCcanvasclear(Gwidget_t * widget)
+{
+    int gotit;
+    GdkDrawable *drawable;
+    GtkWidget *drawing_area = widget->w;
+    drawable = drawing_area->window;
+
+    gdk_window_clear(widget->w->window);
+    gdk_draw_rectangle(drawable, drawing_area->style->white_gc, TRUE, 0, 0,
+		       drawing_area->allocation.width,
+		       drawing_area->allocation.height);
+    WCU->needredraw = FALSE;
+    gotit = FALSE;
+
+
+    if (gotit)
+	adjustclip(widget);
+    return 0;
+}
+
+
+int GCgetgfxattr(Gwidget_t * widget, Ggattr_t * ap)
+{
+
+    if ((ap->flags & G_GATTRCOLOR))
+	ap->color = WCU->gattr.color;
+    if ((ap->flags & G_GATTRWIDTH))
+	ap->width = WCU->gattr.width;
+    if ((ap->flags & G_GATTRMODE))
+	ap->mode = WCU->gattr.mode;
+    if ((ap->flags & G_GATTRFILL))
+	ap->fill = WCU->gattr.fill;
+    if ((ap->flags & G_GATTRSTYLE))
+	ap->style = WCU->gattr.style;
+    return 0;
+}
+
+
+gint Gcwbutaction(GtkWidget * w, GdkEvent * event, gpointer data)
+{
+    Gwidget_t *widget;
+    Gevent_t gev;
+    int xtype, bn, wi;
+    PIXpoint_t pp;
+
+    widget = findwidget((unsigned long) w, G_CANVASWIDGET);
+    switch ((xtype = event->type)) {
+    case GDK_BUTTON_PRESS:
+    case GDK_2BUTTON_PRESS:
+    case GDK_3BUTTON_PRESS:
+    case GDK_BUTTON_RELEASE:
+
+	gev.type = G_MOUSE;
+	gev.code = (xtype == GDK_BUTTON_PRESS) ? G_DOWN : G_UP;
+
+	gev.data = event->button.button - 1;
+	pp.x = event->button.x, pp.y = event->button.y;
+	gev.p = Gppixtodraw(widget, pp);
+	bn = WCU->bstate[gev.data];
+	WCU->bstate[gev.data] = (xtype == GDK_BUTTON_PRESS) ? 1 : 0;
+	bn = WCU->bstate[gev.data] - bn;
+	WCU->buttonsdown += bn;
+	Gbuttonsdown += bn;
+	break;
+    default:
+	break;
+    }
+
+    wi = gev.wi = widget - &Gwidgets[0];
+    Gpopdownflag = FALSE;
+    if (WCU->func) {
+	(*WCU->func) (&gev);
+    }
+
+    if (Gpopdownflag) {
+	Gpopdownflag = FALSE;
+	if (gev.code == G_DOWN) {
+
+	    gev.code = G_UP;
+	    widget = &Gwidgets[wi];
+	    WCU->bstate[gev.data] = 0;
+	    WCU->buttonsdown--;
+	    Gbuttonsdown--;
+	    if (widget->inuse && WCU->func)
+		(*WCU->func) (&gev);
+	}
+    }
+    return TRUE;
+}
+
+
+void Gcwkeyaction(GtkWidget * w, GdkEventKey * event, gpointer data)
+{
+    Gwidget_t *widget;
+    Gevent_t gev;
+    int xtype, bn, wi, state;
+    PIXpoint_t pp;
+    unsigned int mask;
+    char c;
+
+    widget = findwidget((unsigned long) canvas->w, G_CANVASWIDGET);
+    switch ((xtype = event->type)) {
+    case GDK_KEY_PRESS:
+    case GDK_KEY_RELEASE:
+	gdk_window_get_pointer(event->window, &pp.x, &pp.y, &state);
+	gev.type = G_KEYBD;
+	gev.code = (xtype == GDK_KEY_PRESS) ? G_DOWN : G_UP;
+	gev.data = event->keyval;
+	gev.p = Gppixtodraw(widget, pp);
+	break;
+    default:
+	return;
+    }
+    gev.wi = widget - &Gwidgets[0];
+    Gpopdownflag = FALSE;
+    if (WCU->func)
+	(*WCU->func) (&gev);
+    if (Gpopdownflag)
+	Gpopdownflag = FALSE;
+
+}
+
+
+gint exposeeventhandler(GtkWidget * w, GdkEvent * event, gpointer data)
+{
+    Gwidget_t *widget;
+
+    widget = findwidget((unsigned long) w, G_CANVASWIDGET);
+    gdk_draw_rectangle(widget->w->window, widget->w->style->white_gc, TRUE,
+		       0, 0, widget->w->allocation.width,
+		       widget->w->allocation.height);
+}
+
+
+gint cweventhandler(GtkWidget * w, GdkEvent * event, gpointer data)
+{
+    Gwidget_t *widget;
+
+    widget = findwidget((unsigned long) w, G_CANVASWIDGET);
+    Gneedredraw = WCU->needredraw = TRUE;
+    adjustclip(widget);
+
+    gtk_signal_connect(G_OBJECT(w), "visibility_notify_event",
+		       GTK_SIGNAL_FUNC(cweventhandler), NULL);
+    gtk_signal_connect(G_OBJECT(w), "motion_notify_event",
+		       GTK_SIGNAL_FUNC(cweventhandler), NULL);
+}
+
+
+static void setgattr(Gwidget_t * widget, Ggattr_t * ap)
+{
+    GdkGCValues gcv;
+    GdkColor c;
+    int color, width, mode, style, pati;
+    double intens;
+
+    if (!(ap->flags & G_GATTRCOLOR))
+	ap->color = WCU->defgattr.color;
+    if (!(ap->flags & G_GATTRWIDTH))
+	ap->width = WCU->defgattr.width;
+    if (!(ap->flags & G_GATTRMODE))
+	ap->mode = WCU->defgattr.mode;
+    if (!(ap->flags & G_GATTRFILL))
+	ap->fill = WCU->defgattr.fill;
+    if (!(ap->flags & G_GATTRSTYLE))
+	ap->style = WCU->defgattr.style;
+    color = ap->color;
+
+    if (color >= G_MAXCOLORS || !(WCU->colors[color].inuse))
+	color = 1;
+
+    if (color != WCU->gattr.color) {
+
+	WCU->gattr.color = color;
+	/*if (ap->mode == GDK_XOR) {
+	   gdk_gc_set_foreground (GC, widget->w->style->white_gc);
+	   }
+	   else {
+	 */
+	gdk_gc_set_foreground(GC, &WCU->colors[WCU->gattr.color].color);
+	/* } */
+
+/*	    if (Gdepth == 1) {
+	        cp = &WCU->colors[color].color;
+	        intens = (0.3 * cp->blue + 0.59 * cp->red +
+	                        0.11 * cp->green) / 65535.0;
+	        pati = (intens <= 0.0625) ? 16 :
+	                    -16.0 * (log (intens) / 2.7725887222);
+	        XSetTile (Gdisplay, GC, WCU->grays[pati]);
+            }
+*/
+    }
+    mode = ap->mode;
+    if (mode != WCU->gattr.mode) {
+	WCU->gattr.mode = mode;
+/*	    XSetFunction (Gdisplay, GC, WCU->gattr.mode);
+	    if (mode == GDK_XOR)
+            	gdk_gc_set_foreground (GC, &WCU->colors[0].color);
+            else
+*/
+	gdk_gc_set_foreground(GC, &WCU->colors[WCU->gattr.color].color);
+    }
+    width = ap->width;
+    if (width != WCU->gattr.width) {
+	gdk_gc_set_line_attributes(GC, width, GDK_LINE_SOLID,
+				   GDK_CAP_NOT_LAST, GDK_JOIN_BEVEL);
+    }
+
+    WCU->gattr.fill = ap->fill;
+    style = ap->style;
+    if (style != WCU->gattr.style) {
+	WCU->gattr.style = style;
+	if (style == G_SOLID) {
+	    gdk_gc_set_line_attributes(GC, width, GDK_LINE_SOLID,
+				       GDK_CAP_NOT_LAST, GDK_JOIN_BEVEL);
+	} else {
+	    gdk_gc_set_dashes(GC, 0, gstyles[style], 2);
+	    gdk_gc_set_line_attributes(GC, width, GDK_LINE_ON_OFF_DASH,
+				       GDK_CAP_NOT_LAST, GDK_JOIN_BEVEL);
+	}
+    }
+}
+
+
+static PIXrect_t rdrawtopix(Gwidget_t * widget, Grect_t gr)
+{
+    PIXrect_t pr;
+    double tvx, tvy, twx, twy;
+
+    tvx = WCU->vsize.x - 1, tvy = WCU->vsize.y - 1;
+    twx = WCU->wrect.c.x - WCU->wrect.o.x;
+    twy = WCU->wrect.c.y - WCU->wrect.o.y;
+    pr.o.x = tvx * (gr.o.x - WCU->wrect.o.x) / twx + 0.5;
+    pr.o.y = tvy * (1.0 - (gr.c.y - WCU->wrect.o.y) / twy) + 0.5;
+    pr.c.x = tvx * (gr.c.x - WCU->wrect.o.x) / twx + 0.5;
+    pr.c.y = tvy * (1.0 - (gr.o.y - WCU->wrect.o.y) / twy) + 0.5;
+    return pr;
+}
+
+
+static PIXpoint_t pdrawtopix(Gwidget_t * widget, Gpoint_t gp)
+{
+    PIXpoint_t pp;
+    double tvx, tvy, twx, twy;
+
+    tvx = WCU->vsize.x - 1, tvy = WCU->vsize.y - 1;
+    twx = WCU->wrect.c.x - WCU->wrect.o.x;
+    twy = WCU->wrect.c.y - WCU->wrect.o.y;
+
+    pp.x = tvx * (gp.x - WCU->wrect.o.x) / twx + 0.5;
+    pp.y = tvy * (1.0 - (gp.y - WCU->wrect.o.y) / twy) + 0.5;
+    return pp;
+}
+
+
+static PIXsize_t sdrawtopix(Gwidget_t * widget, Gsize_t gs)
+{
+    PIXsize_t ps;
+    double tvx, tvy, twx, twy;
+
+    tvx = WCU->vsize.x - 1, tvy = WCU->vsize.y - 1;
+    twx = WCU->wrect.c.x - WCU->wrect.o.x;
+    twy = WCU->wrect.c.y - WCU->wrect.o.y;
+    ps.x = tvx * (gs.x - 1) / twx + 1.5;
+    ps.y = tvy * (gs.y - 1) / twy + 1.5;
+
+    return ps;
+}
+
+
+static Gpoint_t Gppixtodraw(Gwidget_t * widget, PIXpoint_t pp)
+{
+    Gpoint_t gp;
+    double tvx, tvy, twx, twy;
+
+    tvx = WCU->vsize.x - 1, tvy = WCU->vsize.y - 1;
+    twx = WCU->wrect.c.x - WCU->wrect.o.x;
+    twy = WCU->wrect.c.y - WCU->wrect.o.y;
+
+    gp.x = (pp.x / tvx) * twx + WCU->wrect.o.x;
+    gp.y = (1.0 - pp.y / tvy) * twy + WCU->wrect.o.y;
+    return gp;
+}
+
+
+static Gsize_t spixtodraw(Gwidget_t * widget, PIXsize_t ps)
+{
+    Gsize_t gs;
+    double tvx, tvy, twx, twy;
+
+    tvx = WCU->vsize.x - 1, tvy = WCU->vsize.y - 1;
+    twx = WCU->wrect.c.x - WCU->wrect.o.x;
+    twy = WCU->wrect.c.y - WCU->wrect.o.y;
+    gs.x = ((ps.x - 1) / tvx) * twx + 1;
+    gs.y = ((ps.y - 1) / tvy) * twy + 1;
+    return gs;
+}
+
+
+static Grect_t rpixtodraw(Gwidget_t * widget, PIXrect_t pr)
+{
+    Grect_t gr;
+    double tvx, tvy, twx, twy, n;
+
+    tvx = WCU->vsize.x - 1, tvy = WCU->vsize.y - 1;
+    twx = WCU->wrect.c.x - WCU->wrect.o.x;
+    twy = WCU->wrect.c.y - WCU->wrect.o.y;
+
+    gr.o.x = (pr.o.x / tvx) * twx + WCU->wrect.o.x;
+    gr.o.y = (1.0 - pr.c.y / tvy) * twy + WCU->wrect.o.y;
+    gr.c.x = (pr.c.x / tvx) * twx + WCU->wrect.o.x;
+    gr.c.y = (1.0 - pr.o.y / tvy) * twy + WCU->wrect.o.y;
+
+    if (gr.o.x > gr.c.x)
+	n = gr.o.x, gr.o.x = gr.c.x, gr.c.x = n;
+    if (gr.o.y > gr.c.y)
+	n = gr.o.y, gr.o.y = gr.c.y, gr.c.y = n;
+    return gr;
+}
+
+
+static PIXrect_t rdrawtobpix(Gbitmap_t * bitmap, Grect_t gr)
+{
+    PIXrect_t pr;
+    double tvy;
+
+    tvy = (bitmap->size.y - 1) * bitmap->scale.y;
+    pr.o.x = gr.o.x + 0.5;
+    pr.o.y = tvy - gr.c.y + 0.5;
+    pr.c.x = gr.c.x + 0.5;
+    pr.c.y = tvy - gr.o.y + 0.5;
+    return pr;
+}
+
+
+static PIXpoint_t pdrawtobpix(Gbitmap_t * bitmap, Gpoint_t gp)
+{
+    PIXpoint_t pp;
+    double tvy;
+
+    tvy = (bitmap->size.y - 1) * bitmap->scale.y;
+    pp.x = gp.x + 0.5;
+    pp.y = tvy - gp.y + 0.5;
+    return pp;
+}
+
+
+static void adjustclip(Gwidget_t * widget)
+{
+    Gwidget_t *parent;
+    PIXrect_t pr;
+    int width, height;
+
+}


Fix build when databases are disabled

Fix build when databases are disabled

--- include/hoel.h
+++ include/hoel.h
@@ -38,17 +38,9 @@
 #include <yder.h>
 #include <orcania.h>

-#ifdef _HOEL_SQLITE
 #define HOEL_DB_TYPE_SQLITE  0
-#endif
-
-#ifdef _HOEL_MARIADB
 #define HOEL_DB_TYPE_MARIADB 1
-#endif
-
-#ifdef _HOEL_PGSQL
 #define HOEL_DB_TYPE_PGSQL   2
-#endif

 #define HOEL_COL_TYPE_INT    0
 #define HOEL_COL_TYPE_DOUBLE 1
@@ -336,7 +328,6 @@
  */
 int h_clean_connection(struct _h_connection * conn);

-#ifdef _HOEL_SQLITE
 /**
  * h_connect_sqlite
  * Opens a database connection to a sqlite3 db file
@@ -392,9 +383,7 @@
  * return H_OK on success
  */
 int h_execute_query_json_sqlite(const struct _h_connection * conn, const char * query, json_t ** j_result);
-#endif
-
-#ifdef _HOEL_MARIADB
+
 /**
  * h_connect_mariadb
  * Opens a database connection to a mariadb server
@@ -448,9 +437,6 @@
  */
 struct _h_data * h_get_mariadb_value(const char * value, const unsigned long length, const int m_type);

-#endif
-
-#ifdef _HOEL_PGSQL
 /**
  * h_connect_pgsql
  * Opens a database connection to a PostgreSQL server
@@ -497,6 +483,5 @@
  * Assuming you use sequences for automatically generated ids
  */
 long long int h_last_insert_id_pgsql(const struct _h_connection * conn);
-#endif

 #endif /* __HOEL_H__ */


Improved generic list interface.

Improved generic list interface.

--- include/list.h
+++ include/list.h
@@ -29,6 +29,15 @@

 #define DECLARE_LIST(name)   struct list name = INIT_LIST(name)
 #define DECLARE_NODE(name)   struct node name = INIT_NODE
+
+/*
+	struct user { char *name; int age; struct node n; };
+
+	DECLARE_LIST(list);
+	struct node *node = DECLARE_ITEM(struct user, n, .name = "", .age = 9);
+	list_add(&list, node);
+*/
+
 #define DECLARE_ITEM(type, node,...) \
         ({ type __o = (type) {.node = INIT_NODE ,## __VA_ARGS__ }; &__o.node;})


Updated List to insert before in a list of items.

--- include/list.h
+++ include/list.h
@@ -22,7 +22,7 @@

   bool prepend(T);
   bool append(T);
-  bool insert(Node<T>*, T);
+  bool insertBefore(Node<T>*, T);

   void clear();

@@ -39,7 +39,8 @@

 template <class T>
 List<T>::~List(){
-  this->clear();
+  if (!this->isEmpty())
+    this->clear();
 }

 template <class T>
@@ -87,24 +88,21 @@
 }

 template <class T>
-bool List<T>::insert(Node<T>* current, T data){
+bool List<T>::insertBefore(Node<T>* current, T data){
   if (this->isEmpty())
     return this->insertFirst(data);

   if (current == this->head)
     return this->prepend(data);

-  if (current == this->tail)
-    return this->append(data);
-
   Node<T>* node = new Node<T>();
   node->data = data;

-  node->next = current->next;
-  node->prev = current;
+  node->prev = current->prev;
+  node->next = current;

-  current->next->prev = node;
-  current->next = node;
+  current->prev->next = node;
+  current->prev = node;

   return true;
 }


Change LLPC interface version

Change LLPC interface version

It is missed by last commit. Set it to 33.

--- include/llpc.h
+++ include/llpc.h
@@ -40,7 +40,7 @@
 #undef Bool

 /// LLPC major interface version.
-#define LLPC_INTERFACE_MAJOR_VERSION 32
+#define LLPC_INTERFACE_MAJOR_VERSION 33

 /// LLPC minor interface version.
 #define LLPC_INTERFACE_MINOR_VERSION 0


solaris

solaris

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@21109 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- include/mkfn.h
+++ include/mkfn.h
@@ -24,6 +24,8 @@
 #ifndef _SL_MKFN_H_
 #define _SL_MKFN_H_

+#include <limits.h>
+
 int	mkfn(char[PATH_MAX], const char *, ...);
 int	mkfnv(char[PATH_MAX], const char *, va_list);
 void	xmkfn(char[PATH_MAX], const char *, ...);


Clean up task.h

Clean up task.h

--- include/task.h
+++ include/task.h
@@ -1,21 +1,21 @@
 #ifndef __TASK_H__
 #define __TASK_H__

-typedef enum TaskState {
+typedef enum TaskState {
 	Active,
 	Ready,
-	Zombie,
+	Zombie,
 	Empty
 } TaskState;

 typedef struct task_descripter {
-	int 		tid;						//id
+	int			tid;						//id
 	int			generation;					//generation
-	TaskState 	state;						//task state
-	int 		priority;					//priority
-	void 		*init_sp;					//poistion in the stack
-	struct 		task_descripter *next;		//next task
-	int 		parent_tid;					//parent
+	TaskState	state;						//task state
+	int			priority;					//priority
+	void		*init_sp;					//poistion in the stack
+	struct		task_descripter *next;		//next task
+	int			parent_tid;					//parent
 } Task;

 typedef struct task_list {
@@ -43,6 +43,4 @@
 Task* popTask(TaskList *tlist, FreeList *flist);

-
-
 #endif //__TASK_H__


Coverity fix 20212

Coverity fix 20212

--- PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.h
+++ PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.h
@@ -30,7 +30,7 @@
   enum { kTrkBit = 0, kTrkCuts, kTrkEta, kTrkDCA, kTrkP, kTrkPt,kTrkPtTOF,kTOFMatching,kTrTOFout,kTrTIME,kTrTOFpid,kAccepted,kNTrkCuts};

- AliSpectraAODTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0), fPCut(0), fPtCut(0), fPtCutTOFMatching(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0) {}
+ AliSpectraAODTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0),fDCACut(0), fPCut(0), fPtCut(0),fYCut(0), fPtCutTOFMatching(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0) {}

   AliSpectraAODTrackCuts(const char *name);
   virtual  ~AliSpectraAODTrackCuts() {} // To be implemented


Date: Mon, 01 Sep 2003 15:37:52 +0900
From: SUGIMOTO Sadahiro
Subject: [SDL] [PATCH] bsd joystick

Hi,
on FreeBSD systems, I had troubles using a USB joystick with SDL.
There are two problems in src/joystick/bsd/SDL_sysjoystick.c .

1. The macro __FreeBSD_version is compared to inappropriate numbers.

According to
http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/usbhid.h
http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/Attic/libusb.h
http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/Attic/libusbhid.h
the APIs of USB HID are common in each following groups of OS versions,
a. 4.1-4.5
b. 4.6-4.8, and 5.0
c. 5.1

2. open() error

$ uname -sr
FreeBSD 5.1-RELEASE
$ ls -l /dev/uhid0
crw-r--r--  1 root  operator  122,   0  8  3 14:06 /dev/uhid0

Then, open("/dev/uhid0", O_RDWR) fails.
It seems that this device file does not need to be writable, so O_RDONLY
may be suitable.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40716

--- src/joystick/bsd/SDL_sysjoystick.c
+++ src/joystick/bsd/SDL_sysjoystick.c
@@ -234,7 +234,7 @@
 	struct report *rep;
 	int fd;

-	fd = open(path, O_RDWR);
+	fd = open(path, O_RDONLY);
 	if (fd == -1) {
 		SDL_SetError("%s: %s", path, strerror(errno));
 		return (-1);
@@ -448,14 +448,12 @@
 	int len;

 #ifdef __FreeBSD__
-# if (__FreeBSD_version >= 470000)
+# if (__FreeBSD_version >= 460000)
 #  if (__FreeBSD_version <= 500111)
 	len = hid_report_size(rd, r->rid, repinfo[repind].kind);
 #  else
 	len = hid_report_size(rd, repinfo[repind].kind, r->rid);
 #  endif
-# elif (__FreeBSD_version == 460002)
-	len = hid_report_size(rd, r->rid, repinfo[repind].kind);
 # else
 	len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
 #endif


use of images for colog analysis

use of images for colog analysis

--- command/src/colog.c
+++ command/src/colog.c
@@ -446,6 +446,7 @@

 private	void	colog_show_detail()
 {
+	int	n;
 	int	from=0;
 	int	to=0;
 	int	items=0;
@@ -487,15 +488,34 @@
 			to = tptr->column;
 		}
 		if ( from > 1 )
-			printf(" ",from-1);
-		if (( (to - from) +1 ) > 1 )
-			printf("",(to-from)+1);
-		else	printf("");
-		printf("&nbsp:");
-		if (( maxcolumns - to ) > 1)
-			printf(" ",(maxcolumns-to));
-		else if ( maxcolumns > to )
-			printf(" ");
+		{
+			n = from-1;
+			while ( n )
+			{
+				printf("	\n");
+				n--;
+			}
+		}
+		printf("	\n");
+
+		n = (to - from);
+		if ( n > 1 )
+		{
+			n -= 1;
+			n = from-1;
+			while ( n )
+			{
+				printf("	\n");
+				n--;
+			}
+		}
+		printf("	\n");
+		n = maxcolumns - to;
+		while ( n)
+		{
+			printf("	\n");
+			n--;
+		}
 	}
 	return;
 }


addition of host information when resolving received request

--- command/src/colog.c
+++ command/src/colog.c
@@ -730,6 +730,15 @@
 			}
 			else
 			{
+				if ((!( xptr->host )) && ( mptr->host ))
+				{
+					if (!( xptr->host = allocate_string( mptr->host ) ))
+					{
+						liberate_request( rptr );
+						return( 27 );
+					}
+					else	xptr->port = mptr->port;
+				}
 				forget_module( mptr );
 				qptr->to = xptr;
 			}


fix copy-paste error

fix copy-paste error

--- src/plproxy.h
+++ src/plproxy.h
@@ -80,7 +80,7 @@
 static inline void plproxy_set_stamp(RowStamp *stamp, HeapTuple tup)
 {
 	stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
-	stamp->tid = procTup->t_self;
+	stamp->tid = tup->t_self;
 }

 static inline bool plproxy_check_stamp(RowStamp *stamp, HeapTuple tup)


Internals: stand-in for large branches to facilitate merging.


MIssing IMGUI_API for a type with non-inline methods.

--- imgui_internal.h
+++ imgui_internal.h
@@ -448,7 +448,7 @@
     }
 };

-struct ImDrawListSharedData
+struct IMGUI_API ImDrawListSharedData
 {
     ImVec2          TexUvWhitePixel;            // UV of white pixel in the atlas
     ImFont*         Font;                       // Current/default font (optional, for simplified AddText overload)


DispatchPostponedGestureEvent was moved to GestureSequenceDelegate .

--- impl/eweb_view.h
+++ impl/eweb_view.h
@@ -49,6 +49,7 @@
 #include "selection_controller_efl.h"
 #include "web_contents_delegate_efl.h"
 #include "ui/events/gestures/gesture_types.h"
+#include "ui/events/gestures/gesture_sequence.h"
 #include "context_menu_controller_efl.h"
 #include "file_chooser_controller_efl.h"
 #include "ui/gfx/point.h"
@@ -196,7 +197,8 @@

 class EWebView
     : public ui::GestureConsumer
-    , public ui::GestureEventHelper {
+    , public ui::GestureEventHelper
+    , public ui::GestureSequenceDelegate {
  public:
   static bool InitSmartClassInterface(Ewk_View_Smart_Class&);

@@ -444,9 +446,11 @@

   // GestureEventHelper overrides
   virtual bool CanDispatchToConsumer(ui::GestureConsumer* consumer) OVERRIDE;
-  virtual void DispatchPostponedGestureEvent(ui::GestureEvent* event) OVERRIDE;
   virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE;
   virtual void DispatchGestureEvent(ui::GestureEvent*) OVERRIDE;
+
+  // GestureSequenceDelegate overrides
+  virtual void DispatchPostponedGestureEvent(ui::GestureEvent* event) OVERRIDE;

 #if defined(OS_TIZEN_MOBILE)
   bool LaunchCamera(base::string16 mimetype);