Further work on libxml binding.
This is now has support for enough node types to allow the XML-based testsuite to run sensibly. (The core library is missing a bunch of functionality that the testsuite requires, like the creation of nodes)
Insertion of DocumentType nodes into a Document is mostly there -- the remainder is waiting on a suitable API in the core library.

svn path=/trunk/dom/; revision=3461

--- bindings/xml/xmlparser.c
+++ bindings/xml/xmlparser.c
@@ -37,6 +37,14 @@
 static void xml_parser_add_element_node(xml_parser *parser,
 		struct dom_node *parent, xmlNodePtr child);
 static void xml_parser_add_text_node(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child);
+static void xml_parser_add_cdata_section(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child);
+static void xml_parser_add_entity_reference(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child);
+static void xml_parser_add_comment(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child);
+static void xml_parser_add_document_type(xml_parser *parser,
 		struct dom_node *parent, xmlNodePtr child);

 static void xml_parser_internal_subset(void *ctx, const xmlChar *name,
@@ -81,6 +89,8 @@
 	bool complete;			/**< Indicate stream completion */

 	struct dom_string *udkey;	/**< Key for DOM node user data */
+
+	struct dom_implementation *impl;/**< DOM implementation */

 	xml_alloc alloc;		/**< Memory (de)allocation function */
 	void *pw;			/**< Pointer to client data */
@@ -141,6 +151,7 @@
 		xml_alloc alloc, void *pw)
 {
 	xml_parser *parser;
+	struct dom_string *features;
 	dom_exception err;

 	UNUSED(enc);
@@ -162,7 +173,7 @@
 	parser->complete = false;

 	/* Create key for user data registration */
-	err = dom_string_create_from_ptr_no_doc(alloc, pw,
+	err = dom_string_create_from_ptr_no_doc((dom_alloc) alloc, pw,
 			(const uint8_t *) "__xmlnode", SLEN("__xmlnode"),
 			&parser->udkey);
 	if (err != DOM_NO_ERR) {
@@ -171,6 +182,31 @@
 		return NULL;
 	}

+	/* Get DOM implementation */
+	/* Create a string representation of the features we want */
+	err = dom_string_create_from_ptr_no_doc((dom_alloc) alloc, pw,
+			(const uint8_t *) "XML", SLEN("XML"), &features);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(parser->udkey);
+		xmlFreeParserCtxt(parser->xml_ctx);
+		alloc(parser, 0, pw);
+		return NULL;
+	}
+
+	/* Now, try to get an appropriate implementation from the registry */
+	err = dom_implregistry_get_dom_implementation(features,
+			&parser->impl, (dom_alloc) alloc, pw);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(features);
+		dom_string_unref(parser->udkey);
+		xmlFreeParserCtxt(parser->xml_ctx);
+		alloc(parser, 0, pw);
+		return NULL;
+	}
+
+	/* No longer need the features string */
+	dom_string_unref(features);
+
 	parser->alloc = alloc;
 	parser->pw = pw;

@@ -184,6 +220,8 @@
  */
 void xml_parser_destroy(xml_parser *parser)
 {
+	dom_implementation_unref(parser->impl);
+
 	dom_string_unref(parser->udkey);

 	xmlFreeParserCtxt(parser->xml_ctx);
@@ -257,48 +295,29 @@
 void xml_parser_start_document(void *ctx)
 {
 	xml_parser *parser = (xml_parser *) ctx;
-	struct dom_implementation *impl;
-	struct dom_string *features;
 	struct dom_document *doc;
 	dom_exception err;

 	/* Invoke libxml2's default behaviour */
 	xmlSAX2StartDocument(parser->xml_ctx);

-	/* Create a string representation of the features we want */
-	err = dom_string_create_from_ptr_no_doc((dom_alloc) parser->alloc,
-			parser->pw, (const uint8_t *) "XML", SLEN("XML"),
-			&features);
-	if (err != DOM_NO_ERR)
-		return;
-
-	/* Now, try to get an appropriate implementation from the registry */
-	err = dom_implregistry_get_dom_implementation(features, &impl,
-			(dom_alloc) parser->alloc, parser->pw);
-	if (err != DOM_NO_ERR) {
-		dom_string_unref(features);
-		return;
-	}
-
-	/* No longer need the features string */
-	dom_string_unref(features);
-
 	/* Attempt to create a document */
-	err = dom_implementation_create_document(impl, /* namespace */ NULL,
-			/* qname */ NULL, /* doctype */ NULL,
-			&doc, (dom_alloc) parser->alloc, parser->pw);
-	if (err != DOM_NO_ERR) {
-		dom_implementation_unref(impl);
-		return;
-	}
-
-	/* No longer need the implementation */
-	dom_implementation_unref(impl);
+	err = dom_implementation_create_document(parser->impl,
+			/* namespace */ NULL,
+			/* qname */ NULL,
+			/* doctype */ NULL,
+			&doc,
+			(dom_alloc) parser->alloc,
+			parser->pw);
+	if (err != DOM_NO_ERR) {
+		return;
+	}

 	/* Link nodes together */
 	err = xml_parser_link_nodes(parser, (struct dom_node *) doc,
 			(xmlNodePtr) parser->xml_ctx->myDoc);
 	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) doc);
 		return;
 	}

@@ -514,6 +533,31 @@
 void xml_parser_add_node(xml_parser *parser, struct dom_node *parent,
 		xmlNodePtr child)
 {
+	static const char *node_types[] = {
+		"THIS_IS_NOT_A_NODE",
+		"XML_ELEMENT_NODE",
+		"XML_ATTRIBUTE_NODE",
+		"XML_TEXT_NODE",
+		"XML_CDATA_SECTION_NODE",
+		"XML_ENTITY_REF_NODE",
+		"XML_ENTITY_NODE",
+		"XML_PI_NODE",
+		"XML_COMMENT_NODE",
+		"XML_DOCUMENT_NODE",
+		"XML_DOCUMENT_TYPE_NODE",
+		"XML_DOCUMENT_FRAG_NODE",
+		"XML_NOTATION_NODE",
+		"XML_HTML_DOCUMENT_NODE",
+		"XML_DTD_NODE",
+		"XML_ELEMENT_DECL",
+		"XML_ATTRIBUTE_DECL",
+		"XML_ENTITY_DECL",
+		"XML_NAMESPACE_DECL",
+		"XML_XINCLUDE_START",
+		"XML_XINCLUDE_END",
+		"XML_DOCB_DOCUMENT_NODE"
+	};
+
 	switch (child->type) {
 	case XML_ELEMENT_NODE:
 		xml_parser_add_element_node(parser, parent, child);
@@ -522,11 +566,20 @@
 		xml_parser_add_text_node(parser, parent, child);
 		break;
 	case XML_CDATA_SECTION_NODE:
+		xml_parser_add_cdata_section(parser, parent, child);
+		break;
 	case XML_ENTITY_REF_NODE:
+		xml_parser_add_entity_reference(parser, parent, child);
+		break;
 	case XML_COMMENT_NODE:
+		xml_parser_add_comment(parser, parent, child);
+		break;
 	case XML_DTD_NODE:
+		xml_parser_add_document_type(parser, parent, child);
+		break;
 	default:
-		fprintf(stderr, "Unsupported node type: %d\n", child->type);
+		fprintf(stderr, "Unsupported node type: %s\n",
+				node_types[child->type]);
 	}
 }

@@ -809,6 +862,249 @@
 	dom_node_unref((struct dom_node *) text);
 }

+/**
+ * Add a cdata section to the DOM
+ *
+ * \param parser  The parser context
+ * \param parent  The parent DOM node
+ * \param child   The xmlNode to mirror in the DOM as a child of parent
+ */
+void xml_parser_add_cdata_section(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child)
+{
+	struct dom_text *cdata, *ins_cdata;
+	struct dom_string *data;
+	dom_exception err;
+
+	/* Create DOM string data for cdata section */
+	err = dom_string_create_from_const_ptr(parser->doc, child->content,
+			strlen((const char *) child->content), &data);
+	if (err != DOM_NO_ERR)
+		return;
+
+	/* Create text node */
+	err = dom_document_create_cdata_section(parser->doc, data, &cdata);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(data);
+		return;
+	}
+
+	/* No longer need data */
+	dom_string_unref(data);
+
+	/* Append cdata section to parent */
+	err = dom_node_append_child(parent, (struct dom_node *) cdata,
+			(struct dom_node **) &ins_cdata);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) cdata);
+		return;
+	}
+
+	/* We're not interested in the inserted cdata section */
+	if (ins_cdata != NULL)
+		dom_node_unref((struct dom_node *) ins_cdata);
+
+	/* Link nodes together */
+	err = xml_parser_link_nodes(parser, (struct dom_node *) cdata,
+			child);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) cdata);
+		return;
+	}
+
+	/* No longer interested in cdata section */
+	dom_node_unref((struct dom_node *) cdata);
+}
+
+/**
+ * Add an entity reference to the DOM
+ *
+ * \param parser  The parser context
+ * \param parent  The parent DOM node
+ * \param child   The xmlNode to mirror in the DOM as a child of parent
+ */
+void xml_parser_add_entity_reference(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child)
+{
+	struct dom_node *entity, *ins_entity;
+	struct dom_string *name;
+	xmlNodePtr c;
+	dom_exception err;
+
+	/* Create name of entity reference */
+	err = dom_string_create_from_const_ptr(parser->doc, child->name,
+			strlen((const char *) child->name), &name);
+	if (err != DOM_NO_ERR)
+		return;
+
+	/* Create text node */
+	err = dom_document_create_entity_reference(parser->doc, name,
+			&entity);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(name);
+		return;
+	}
+
+	/* No longer need name */
+	dom_string_unref(name);
+
+	/* Mirror subtree (reference value) */
+	for (c = child->children; c != NULL; c = c->next) {
+		xml_parser_add_node(parser, (struct dom_node *) entity, c);
+	}
+
+	/* Append entity reference to parent */
+	err = dom_node_append_child(parent, (struct dom_node *) entity,
+			(struct dom_node **) &ins_entity);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) entity);
+		return;
+	}
+
+	/* We're not interested in the inserted entity reference */
+	if (ins_entity != NULL)
+		dom_node_unref((struct dom_node *) ins_entity);
+
+	/* Link nodes together */
+	err = xml_parser_link_nodes(parser, (struct dom_node *) entity,
+			child);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) entity);
+		return;
+	}
+
+	/* No longer interested in entity reference */
+	dom_node_unref((struct dom_node *) entity);
+}
+
+/**
+ * Add a comment to the DOM
+ *
+ * \param parser  The parser context
+ * \param parent  The parent DOM node
+ * \param child   The xmlNode to mirror in the DOM as a child of parent
+ */
+void xml_parser_add_comment(xml_parser *parser, struct dom_node *parent,
+		xmlNodePtr child)
+{
+	struct dom_characterdata *comment, *ins_comment;
+	struct dom_string *data;
+	dom_exception err;
+
+	/* Create DOM string data for comment */
+	err = dom_string_create_from_const_ptr(parser->doc, child->content,
+			strlen((const char *) child->content), &data);
+	if (err != DOM_NO_ERR)
+		return;
+
+	/* Create comment */
+	err = dom_document_create_comment(parser->doc, data, &comment);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(data);
+		return;
+	}
+
+	/* No longer need data */
+	dom_string_unref(data);
+
+	/* Append comment to parent */
+	err = dom_node_append_child(parent, (struct dom_node *) comment,
+			(struct dom_node **) &ins_comment);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) comment);
+		return;
+	}
+
+	/* We're not interested in the inserted comment */
+	if (ins_comment != NULL)
+		dom_node_unref((struct dom_node *) ins_comment);
+
+	/* Link nodes together */
+	err = xml_parser_link_nodes(parser, (struct dom_node *) comment,
+			child);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) comment);
+		return;
+	}
+
+	/* No longer interested in comment */
+	dom_node_unref((struct dom_node *) comment);
+}
+
+/**
+ * Add a document type to the DOM
+ *
+ * \param parser  The parser context
+ * \param parent  The parent DOM node
+ * \param child   The xmlNode to mirror in the DOM as a child of parent
+ */
+void xml_parser_add_document_type(xml_parser *parser,
+		struct dom_node *parent, xmlNodePtr child)
+{
+	xmlDtdPtr dtd = (xmlDtdPtr) child;
+	struct dom_document_type *doctype;
+	struct dom_string *qname, *public_id, *system_id;
+	dom_exception err;
+
+	/* Create qname for doctype */
+	err = dom_string_create_from_const_ptr(parser->doc, dtd->name,
+			strlen((const char *) dtd->name), &qname);
+	if (err != DOM_NO_ERR)
+		return;
+
+	/* Create public ID for doctype */
+	err = dom_string_create_from_const_ptr(parser->doc,
+			dtd->ExternalID,
+			strlen((const char *) dtd->ExternalID),
+			&public_id);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(qname);
+		return;
+	}
+
+	/* Create system ID for doctype */
+	err = dom_string_create_from_const_ptr(parser->doc,
+			dtd->SystemID,
+			strlen((const char *) dtd->SystemID),
+			&system_id);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(public_id);
+		dom_string_unref(qname);
+		return;
+	}
+
+	/* Create doctype */
+	err = dom_implementation_create_document_type(parser->impl,
+			qname, public_id, system_id, &doctype,
+			(dom_alloc) parser->alloc, parser->pw);
+	if (err != DOM_NO_ERR) {
+		dom_string_unref(system_id);
+		dom_string_unref(public_id);
+		dom_string_unref(qname);
+		return;
+	}
+
+	/* No longer need qname, public_id, system_id */
+	dom_string_unref(system_id);
+	dom_string_unref(public_id);
+	dom_string_unref(qname);
+
+	/** \todo Add doctype to document (requires some libdom-internal API
+	 * -- doctypes are immutable in the DOM) */
+	UNUSED(parent);
+
+	/* Link nodes together */
+	err = xml_parser_link_nodes(parser, (struct dom_node *) doctype,
+			child);
+	if (err != DOM_NO_ERR) {
+		dom_node_unref((struct dom_node *) doctype);
+		return;
+	}
+
+	/* No longer interested in doctype */
+	dom_node_unref((struct dom_node *) doctype);
+}
+
 /*                                                                         */
 /* ------------------------------------------------------------------------*/
 /*                                                                         */


Adding __NR_futex workaround for riscv32. (#9501)

--- runtime/src/iree/base/internal/synchronization.c
+++ runtime/src/iree/base/internal/synchronization.c
@@ -24,6 +24,12 @@
 #include <linux/futex.h>
 #include <sys/syscall.h>
 #include <unistd.h>
+
+#if defined(IREE_ARCH_RISCV_32) && defined(__NR_futex_time64) && \
+    !defined(__NR_futex)
+// RV32 uses 64-bit times by default (unlike other 32-bit archs).
+#define __NR_futex __NR_futex_time64
+#endif  // IREE_ARCH_RISCV_32

 // Oh Android...
 #ifndef SYS_futex


resolve CHANGE use new LYXP_ eval flags

resolve CHANGE use new LYXP_ eval flags

--- src/resolve.c
+++ src/resolve.c
@@ -3536,11 +3536,11 @@
     }

     for (i = 0; i < must_size; ++i) {
-        if (lyxp_eval(must[i].expr, node, &set, 1)) {
+        if (lyxp_eval(must[i].expr, node, &set, LYXP_MUST)) {
             return -1;
         }

-        lyxp_set_cast(&set, LYXP_SET_BOOLEAN, node, 1);
+        lyxp_set_cast(&set, LYXP_SET_BOOLEAN, node, LYXP_MUST);

         if (!set.value.bool) {
             LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "Must", must[i].expr);
@@ -3669,7 +3669,7 @@
     memset(&set, 0, sizeof set);

     if (!(node->schema->nodetype & (LYS_NOTIF | LYS_RPC)) && (((struct lys_node_container *)node->schema)->when)) {
-        rc = lyxp_eval(((struct lys_node_container *)node->schema)->when->cond, node, &set, 1);
+        rc = lyxp_eval(((struct lys_node_container *)node->schema)->when->cond, node, &set, LYXP_WHEN);
         if (rc) {
             if (rc == 1) {
                 LOGVAL(LYE_INWHEN, LY_VLOG_LYD, node, ((struct lys_node_container *)node->schema)->when->cond);
@@ -3678,7 +3678,7 @@
         }

         /* set boolean result of the condition */
-        lyxp_set_cast(&set, LYXP_SET_BOOLEAN, node, 1);
+        lyxp_set_cast(&set, LYXP_SET_BOOLEAN, node, LYXP_WHEN);
         if (!set.value.bool) {
             ly_vlog_hide(1);
             LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "When", ((struct lys_node_container *)node->schema)->when->cond);
@@ -3701,7 +3701,7 @@
                     return -1;
                 }
             }
-            rc = lyxp_eval(((struct lys_node_uses *)parent)->when->cond, ctx_node, &set, 1);
+            rc = lyxp_eval(((struct lys_node_uses *)parent)->when->cond, ctx_node, &set, LYXP_WHEN);
             if (rc) {
                 if (rc == 1) {
                     LOGVAL(LYE_INWHEN, LY_VLOG_LYD, node, ((struct lys_node_uses *)parent)->when->cond);
@@ -3709,7 +3709,7 @@
                 return rc;
             }

-            lyxp_set_cast(&set, LYXP_SET_BOOLEAN, ctx_node, 1);
+            lyxp_set_cast(&set, LYXP_SET_BOOLEAN, ctx_node, LYXP_WHEN);
             if (!set.value.bool) {
                 ly_vlog_hide(1);
                 LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "When", ((struct lys_node_uses *)parent)->when->cond);
@@ -3728,7 +3728,7 @@
                     return -1;
                 }
             }
-            rc = lyxp_eval(((struct lys_node_augment *)parent->parent)->when->cond, ctx_node, &set, 1);
+            rc = lyxp_eval(((struct lys_node_augment *)parent->parent)->when->cond, ctx_node, &set, LYXP_WHEN);
             if (rc) {
                 if (rc == 1) {
                     LOGVAL(LYE_INWHEN, LY_VLOG_LYD, node, ((struct lys_node_augment *)parent->parent)->when->cond);
@@ -3736,7 +3736,7 @@
                 return rc;
             }

-            lyxp_set_cast(&set, LYXP_SET_BOOLEAN, ctx_node, 1);
+            lyxp_set_cast(&set, LYXP_SET_BOOLEAN, ctx_node, LYXP_WHEN);

             if (!set.value.bool) {
                 ly_vlog_hide(1);


0.1.3 288 Use rm_tcp_rx instead of rm_tcp_read

--- src/rm_core.c
+++ src/rm_core.c
@@ -186,7 +186,7 @@
             if (*body_raw == NULL) {
                 return RM_ERR_MEM;
             }
-            err = rm_tcp_read(fd, *body_raw, bytes_n);
+            err = rm_tcp_rx(fd, *body_raw, bytes_n);
             if (err != RM_ERR_OK) {
                 free(*body_raw);
                 *body_raw = NULL;


win32-specific integer definitions

win32-specific integer definitions

--- lib/isc/win32/include/isc/int.h
+++ lib/isc/win32/include/isc/int.h
@@ -15,10 +15,14 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */

-/* $Id: int.h,v 1.7 2001/01/09 21:59:02 bwelling Exp $ */
+/* $Id: int.h,v 1.9 2001/07/08 05:09:25 mayer Exp $ */

 #ifndef ISC_INT_H
 #define ISC_INT_H 1
+
+#define _INTEGRAL_MAX_BITS 64
+#include <limits.h>
+

 typedef __int8				isc_int8_t;
 typedef unsigned __int8			isc_uint8_t;
@@ -29,4 +33,25 @@
 typedef __int64				isc_int64_t;
 typedef unsigned __int64		isc_uint64_t;

+#define ISC_INT8_MIN	-128
+#define ISC_INT8_MAX	127
+#define ISC_UINT8_MAX	255
+
+#define ISC_INT16_MIN	-32768
+#define ISC_INT16_MAX	32767
+#define ISC_UINT16_MAX	65535
+
+/*
+ * Note that "int" is 32 bits on all currently supported Unix-like operating
+ * systems, but "long" can be either 32 bits or 64 bits, thus the 32 bit
+ * constants are not qualified with "L".
+ */
+#define ISC_INT32_MIN	_I32_MIN
+#define ISC_INT32_MAX	_I32_MAX
+#define ISC_UINT32_MAX	_UI32_MAX
+
+#define ISC_INT64_MIN	_I64_MIN
+#define ISC_INT64_MAX	_I64_MAX
+#define ISC_UINT64_MAX	_UI64_MAX
+
 #endif /* ISC_INT_H */


capture header send rc but not handle it yet

--- src/rstatic.c
+++ src/rstatic.c
@@ -101,7 +101,8 @@
     file_fd = open (path, O_RDONLY);
     if (file_fd == -1) {
         if (errno == ENOENT) {
-            write (client->fd, default_response, strlen (default_response));
+            rc = write (client->fd, default_response, strlen (default_response));
+            /* TODO handle rc */
             client->state = FINISHED;
             return;
         } else {


dom: fix format-nonliteral warnings

dom: fix format-nonliteral warnings

--- src/arvdomparser.c
+++ src/arvdomparser.c
@@ -157,6 +157,10 @@
 }

 #if 1
+static void arv_dom_parser_warning (void *user_data, const char *msg, ...) G_GNUC_PRINTF(2,3);
+static void arv_dom_parser_error (void *user_data, const char *msg, ...) G_GNUC_PRINTF(2,3);
+static void arv_dom_parser_fatal_error (void *user_data, const char *msg, ...) G_GNUC_PRINTF(2,3);
+
 static void
 arv_dom_parser_warning (void *user_data, const char *msg, ...)
 {


Fixed reallocating to size 0.

Fixed reallocating to size 0.

--- src/runtime.c
+++ src/runtime.c
@@ -108,7 +108,7 @@

 void* RTrealloc(void *rt_ptr, size_t size){
     void *tmp=realloc(rt_ptr,size);
-    if (tmp==NULL) Fatal(0,error,"out of memory trying to resize to %zu bytes",
+    if (tmp==NULL && size !=0) Fatal(0,error,"out of memory trying to resize to %zu bytes",
                          size);
     return tmp;
 }


cosmetic: reindent

cosmetic: reindent

--- src/scanner.c
+++ src/scanner.c
@@ -186,7 +186,7 @@

 static void
 scanner_readdir (scanner_t *scanner,
-                  const char *path, const char *dir, int recursive, int *files)
+                 const char *path, const char *dir, int recursive, int *files)
 {
   DIR *dirp;
   struct dirent dp;
@@ -297,7 +297,7 @@

       path->nb_files = 0;
       scanner_readdir (scanner,
-                        path->location, NULL, path->recursive, &path->nb_files);
+                       path->location, NULL, path->recursive, &path->nb_files);

       valhalla_log (VALHALLA_MSG_INFO, "[%s] End scanning   : %i files",
                     __FUNCTION__, path->nb_files);


fixed negative number scanning

fixed negative number scanning

--- src/scanner.c
+++ src/scanner.c
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <execpath.h>
 #include "macros.h"
+#include "interpreter.h"

 static size_t source_len;
 static size_t current; // is used to keep track of source current
@@ -410,7 +411,8 @@
 			}
 			break;
 		case '-':
-			if (is_digit(peek())) {
+			if (t_curr == 0 || (is_digit(peek()) &&
+					precedence(tokens[t_curr - 1]))) {
 				advance();
 				handle_number();
 			}


bpf: fix a typo

bpf: fix a typo

This trivial patch fixes a typo in rte_bpf_ethdev.h,

Fixes: a93ff62a8938 ("bpf: introduce basic Rx/Tx filters")
Cc: stable@dpdk.org

Signed-off-by: Rami Rosen <d906574dd7f018d5d95e7b7a8107cdf708745f05@gmail.com>
Acked-by: Konstantin Ananyev <cbd5212b59ab42a210d72992d23a3aa17cfd3eaf@intel.com>

--- lib/librte_bpf/rte_bpf_ethdev.h
+++ lib/librte_bpf/rte_bpf_ethdev.h
@@ -75,7 +75,7 @@
  * @param prm
  *  Parameters used to create and initialise the BPF exeution context.
  * @param flags
- *  Flags that define expected expected behavior of the loaded filter
+ *  Flags that define expected behavior of the loaded filter
  *  (i.e. jited/non-jited version to use).
  * @return
  *   Zero on successful completion or negative error code otherwise.


Fix numerous bugs in the Scanner.

Fix numerous bugs in the Scanner.

--- src/scanner.c
+++ src/scanner.c
@@ -1011,10 +1011,12 @@
     /* Move the queue head. */

     parser->tokens[parser->tokens_head++] = NULL;
-    if (parser->tokens_head == parser->tokens_size)
-        parser->tokens_head = 0;

     parser->tokens_parsed++;
+
+    if (token->type == YAML_STREAM_END_TOKEN) {
+        parser->stream_end_produced = 1;
+    }

     return token;
 }
@@ -1080,7 +1082,7 @@

     memset(new_buffer+string->size, 0, string->size);

-    string->pointer = new_buffer + (string->buffer-string->pointer);
+    string->pointer = new_buffer + (string->pointer-string->buffer);
     string->buffer = new_buffer;
     string->size *= 2;

@@ -1103,6 +1105,7 @@
     }

     memcpy(string1->pointer, string2->buffer, string2->pointer-string2->buffer);
+    string1->pointer += string2->pointer-string2->buffer;

     return 1;
 }
@@ -1138,7 +1141,7 @@
         return 0;
     }

-    memset(new_buffer+(*size), 0, item_size*(*size));
+    memset(new_buffer+item_size*(*size), 0, item_size*(*size));

     *buffer = new_buffer;
     *size *= 2;
@@ -1159,6 +1162,8 @@
     parser->context_mark = context_mark;
     parser->problem = problem;
     parser->problem_mark = yaml_parser_get_mark(parser);
+
+    return 0;
 }

 /*
@@ -1204,6 +1209,9 @@
         else
         {
             /* Check if any potential simple key may occupy the head position. */
+
+            if (!yaml_parser_stale_simple_keys(parser))
+                return 0;

             for (k = 0; k <= parser->flow_level; k++) {
                 yaml_simple_key_t *simple_key = parser->simple_keys[k];
@@ -1251,6 +1259,11 @@
     if (!yaml_parser_scan_to_next_token(parser))
         return 0;

+    /* Remove obsolete potential simple keys. */
+
+    if (!yaml_parser_stale_simple_keys(parser))
+        return 0;
+
     /* Check the indentation level against the current column. */

     if (!yaml_parser_unroll_indent(parser, parser->column))
@@ -1330,12 +1343,12 @@

     /* Is it the key indicator? */

-    if (CHECK(parser, '?') && (!parser->flow_level || IS_BLANKZ_AT(parser, 1)))
+    if (CHECK(parser, '?') && (parser->flow_level || IS_BLANKZ_AT(parser, 1)))
         return yaml_parser_fetch_key(parser);

     /* Is it the value indicator? */

-    if (CHECK(parser, ':') && (!parser->flow_level || IS_BLANKZ_AT(parser, 1)))
+    if (CHECK(parser, ':') && (parser->flow_level || IS_BLANKZ_AT(parser, 1)))
         return yaml_parser_fetch_value(parser);

     /* Is it an alias? */
@@ -1382,7 +1395,8 @@
      *      '#', '&', '*', '!', '|', '>', '\'', '\"',
      *      '%', '@', '`'.
      *
-     * In the block context, it may also start with the characters
+     * In the block context (and, for the '-' indicator, in the flow context
+     * too), it may also start with the characters
      *
      *      '-', '?', ':'
      *
@@ -1398,9 +1412,9 @@
                 || CHECK(parser, '!') || CHECK(parser, '|') || CHECK(parser, '>')
                 || CHECK(parser, '\'') || CHECK(parser, '"') || CHECK(parser, '%')
                 || CHECK(parser, '@') || CHECK(parser, '`')) ||
+            (CHECK(parser, '-') && !IS_BLANK_AT(parser, 1)) ||
             (!parser->flow_level &&
-             (CHECK(parser, '-') || CHECK(parser, '?') || CHECK(parser, ':')) &&
-             IS_BLANKZ_AT(parser, 1)))
+             (CHECK(parser, '?') || CHECK(parser, ':')) && !IS_BLANKZ_AT(parser, 1)))
         return yaml_parser_fetch_plain_scalar(parser);

     /*
@@ -1435,7 +1449,7 @@
          */

         if (simple_key && (simple_key->line < parser->line ||
-                    simple_key->index < parser->index+1024)) {
+                    simple_key->index+1024 < parser->index)) {

             /* Check if the potential simple key to be removed is required. */

@@ -1789,9 +1803,12 @@
     if (!yaml_parser_unroll_indent(parser, -1))
         return 0;

-    /* We have finished. */
-
-    parser->stream_end_produced = 1;
+    /* Reset simple keys. */
+
+    if (!yaml_parser_remove_simple_key(parser))
+        return 0;
+
+    parser->simple_key_allowed = 0;

     /* Create the STREAM-END token. */

@@ -2204,7 +2221,7 @@

         /* In the block context, we may need to add the BLOCK-MAPPING-START token. */

-        if (!yaml_parser_roll_indent(parser, parser->column,
+        if (!yaml_parser_roll_indent(parser, simple_key->column,
                     simple_key->token_number,
                     YAML_BLOCK_MAPPING_START_TOKEN, simple_key->mark))
             return 0;
@@ -2989,6 +3006,16 @@
             if (!handle) goto error;
             handle[0] = '!';
             handle[1] = '\0';
+
+            /*
+             * A special case: the '!' tag.
+             */
+
+            if (suffix[0] == '\0') {
+                yaml_char_t *tmp = handle;
+                handle = suffix;
+                suffix = tmp;
+            }
         }
     }

@@ -3068,12 +3095,13 @@
     else
     {
         /*
-         * It's not really a tag handle.  If it's a %TAG directive, it's an
-         * error.  If it's a tag token, it must be a part of URI.
+         * It's either the '!' tag or not really a tag handle.  If it's a %TAG
+         * directive, it's an error.  If it's a tag token, it must be a part of
+         * URI.
          */

-        if (directive) {
-            yaml_parser_set_scanner_error(parser, "while parsing a directive",
+        if (directive && !(string.buffer[0] == '!' && string.buffer[1] == '\0')) {
+            yaml_parser_set_scanner_error(parser, "while parsing a tag directive",
                     start_mark, "did not find expected '!'");
             goto error;
         }
@@ -3107,11 +3135,15 @@
         if (!yaml_parser_resize_string(parser, &string)) goto error;
     }

-    /* Copy the head if needed. */
-
-    if (length) {
-        memcpy(string.buffer, head, length);
-        string.pointer += length;
+    /*
+     * Copy the head if needed.
+     *
+     * Note that we don't copy the leading '!' character.
+     */
+
+    if (length > 1) {
+        memcpy(string.buffer, head+1, length-1);
+        string.pointer += length-1;
     }

     /* Scan the tag. */
@@ -3672,6 +3704,10 @@
                         *(string.pointer++) = '\'';
                         break;

+                    case '\\':
+                        *(string.pointer++) = '\\';
+                        break;
+
                     case 'N':   /* NEL (#x85) */
                         *(string.pointer++) = '\xC2';
                         *(string.pointer++) = '\x85';
@@ -3691,7 +3727,7 @@
                     case 'P':   /* PS (#x2029) */
                         *(string.pointer++) = '\xE2';
                         *(string.pointer++) = '\x80';
-                        *(string.pointer++) = '\xA8';
+                        *(string.pointer++) = '\xA9';
                         break;

                     case 'x':
@@ -3800,6 +3836,9 @@
                     if (!RESIZE(parser, whitespaces)) goto error;
                     COPY(parser, whitespaces);
                 }
+                else {
+                    FORWARD(parser);
+                }
             }
             else
             {
@@ -3931,7 +3970,7 @@

         while (!IS_BLANKZ(parser))
         {
-            /* Check for 'x:x' in the flow context. */
+            /* Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". */

             if (parser->flow_level && CHECK(parser, ':') && !IS_BLANKZ_AT(parser, 1)) {
                 yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
@@ -4010,7 +4049,7 @@
                 if (leading_blanks && parser->column < indent && IS_TAB(parser)) {
                     yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
                             start_mark, "found a tab character that violate intendation");
-                    break;
+                    goto error;
                 }

                 /* Consume a space or a tab character. */
@@ -4018,6 +4057,9 @@
                 if (!leading_blanks) {
                     if (!RESIZE(parser, whitespaces)) goto error;
                     COPY(parser, whitespaces);
+                }
+                else {
+                    FORWARD(parser);
                 }
             }
             else
@@ -4043,7 +4085,7 @@

         /* Check intendation level. */

-        if (parser->column < indent)
+        if (!parser->flow_level && parser->column < indent)
             break;
     }


i40e: remove endian.h include

i40e: remove endian.h include

endian.h is not needed for the compilation of i40e_rxtx.c and its
inclusion prevents building on FreeBSD systems.

Signed-off-by: Bruce Richardson <66b9e8e8fbd5e9f41f91b0af050876182ce9d0e4@intel.com>
Acked-by: Thomas Monjalon <ee2fa8b2681c737f775687e475dcbf2028a412f1@6wind.com>

--- lib/librte_pmd_i40e/i40e_rxtx.c
+++ lib/librte_pmd_i40e/i40e_rxtx.c
@@ -31,7 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

-#include <endian.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>


Minor refactoring of scatter

Minor refactoring of scatter

* functional style

* slightly faster EIGEN algorithm (now same as SIMD)

--- src/scatter.h
+++ src/scatter.h
@@ -270,50 +270,41 @@
   public:
     StructureFactorPBC(int q_multiplier) : p_max(q_multiplier){}

-    template <class Tpositions> void sample(const Tpositions &positions, const Point &boxlength) {
+    template <typename Tpositions> void sample(const Tpositions& positions, const Point& boxlength) {
         // https://gcc.gnu.org/gcc-9/porting_to.html#ompdatasharing
         // #pragma omp parallel for collapse(2) default(none) shared(directions, p_max, boxlength) shared(positions)
         #pragma omp parallel for collapse(2) default(shared)
-        for (int i = 0; i < directions.size(); ++i) {
+        for (size_t i = 0; i < directions.size(); ++i) {
             for (int p = 1; p <= p_max; ++p) {                                         // loop over multiples of q
                 const Point q = 2.0 * pc::pi * p * directions[i].cwiseQuotient(boxlength); // scattering vector
+                T sum_cos = 0.0;
                 T sum_sin = 0.0;
-                T sum_cos = 0.0;
                 if constexpr (method == SIMD) {
-                    // When sine and cosine is computed in separate loops, advanced sine and cosine implementation
-                    // utilizing SIMD instructions may be used to get at least 4 times performance boost.
-                    // As of January 2020, only GCC exploits this using libmvec library if --ffast-math is enabled.
-                    std::vector<T> qr_std(positions.size());
-                    std::transform(positions.begin(), positions.end(), qr_std.begin(),
-                                   [&q](auto &r) { return q.dot(r); });
-                    // as of January 2020 the std::transform_reduce is not implemented in libc++
-                    for (auto &qr : qr_std) {
-                        sum_sin += std::sin(qr);
-                    }
-                    // as of January 2020 the std::transform_reduce is not implemented in libc++
-                    for (auto &qr : qr_std) {
-                        sum_cos += std::cos(qr);
-                    }
+                    // When sine and cosine is computed in separate loops, sine and cosine SIMD
+                    // instructions may be used to get at least 4 times performance boost.
+                    // Note January 2020: only GCC exploits this using libmvec library if --ffast-math is enabled.
+                    auto dot_product = [q](const auto& pos) { return static_cast<T>(q.dot(pos)); };
+                    auto qdotr = positions | ranges::cpp20::views::transform(dot_product) | ranges::to<std::vector>;
+                    std::for_each(qdotr.begin(), qdotr.end(), [&](auto qr) { sum_cos += std::cos(qr); });
+                    std::for_each(qdotr.begin(), qdotr.end(), [&](auto qr) { sum_sin += std::sin(qr); });
                 } else if constexpr (method == EIGEN) {
-                    // Map is a Nx3 matrix facade into original std::vector. Eigen does not accept `float`,
-                    // hence `double` must be used instead of the template parameter T here.
-                    auto qr = Eigen::Map<Eigen::MatrixXd, 0, Eigen::Stride<1, 3>>((double *)positions.data(),
-                        positions.size(), 3) * q;
-                    sum_sin = qr.array().cast<T>().sin().sum();
-                    sum_cos = qr.array().cast<T>().cos().sum();
+                    // Map is a Nx3 matrix facade into original positions (std::vector)
+                    using namespace Eigen;
+                    static_assert(std::is_same_v<Tpositions, std::vector<Point>>);
+                    auto r = Map<MatrixXd, 0, Stride<1, 3>>((double*)positions.data(), positions.size(), 3);
+                    auto qdotr = (r * q).array().cast<T>().eval(); // explicitly evaluate dot products
+                    sum_cos = qdotr.cos().sum();
+                    sum_sin = qdotr.sin().sum();
                 } else if constexpr (method == GENERIC) {
-                    // TODO: Optimize also for other compilers than GCC by using a vector math library, e.g.,
-                    // TODO: https://github.com/vectorclass/version2
-                    for (auto &r : positions) { // loop over positions
-                        T qr = q.dot(r);        // scalar product q*r
-                        sum_sin += sin(qr);
-                        sum_cos += cos(qr);
+                    for (const auto& r : positions) {
+                        const auto qr = static_cast<T>(q.dot(r));
+                        sum_cos += cos(qr); // sine and cosine in same loop obstructs
+                        sum_sin += sin(qr); // vectorization on most compilers...
                     }
                 };
                 // collect average, `norm()` gives the scattering vector length
-                const T sf = (sum_sin * sum_sin + sum_cos * sum_cos) / (T)(positions.size());
-                #pragma omp critical
-                // avoid race conditions when updating the map
+                const auto sf = std::norm(std::complex<T>(sum_cos, sum_sin)) / static_cast<T>(positions.size());
+#pragma omp critical // avoid race conditions when updating the map
                 addSampling(q.norm(), sf, 1.0);
             }
         }


Reconnect if ldap_search() returns a failure related to connection problems. Also if ldap_result() doesn't return a connection related failure, don't reconnect.

--- src/auth/db-ldap.c
+++ src/auth/db-ldap.c
@@ -150,7 +150,7 @@
 	if (ret != LDAP_SUCCESS) {
 		i_error("LDAP: Can't get error number: %s",
 			ldap_err2string(ret));
-		return -1;
+		return LDAP_UNAVAILABLE;
 	}

 	return err;
@@ -193,17 +193,66 @@
 	conn->retrying = FALSE;
 }

+static void ldap_conn_reconnect(struct ldap_connection *conn)
+{
+	ldap_conn_close(conn, FALSE);
+
+	if (db_ldap_connect(conn) < 0) {
+		/* failed to reconnect. fail all requests. */
+		ldap_conn_close(conn, TRUE);
+	}
+}
+
+static void ldap_handle_error(struct ldap_connection *conn)
+{
+	int err = ldap_get_errno(conn);
+
+	switch (err) {
+	case LDAP_SUCCESS:
+		i_unreached();
+	case LDAP_SIZELIMIT_EXCEEDED:
+	case LDAP_TIMELIMIT_EXCEEDED:
+	case LDAP_NO_SUCH_ATTRIBUTE:
+	case LDAP_UNDEFINED_TYPE:
+	case LDAP_INAPPROPRIATE_MATCHING:
+	case LDAP_CONSTRAINT_VIOLATION:
+	case LDAP_TYPE_OR_VALUE_EXISTS:
+	case LDAP_INVALID_SYNTAX:
+	case LDAP_NO_SUCH_OBJECT:
+	case LDAP_ALIAS_PROBLEM:
+	case LDAP_INVALID_DN_SYNTAX:
+	case LDAP_IS_LEAF:
+	case LDAP_ALIAS_DEREF_PROBLEM:
+	case LDAP_FILTER_ERROR:
+		/* invalid input */
+		break;
+	case LDAP_SERVER_DOWN:
+	case LDAP_TIMEOUT:
+	case LDAP_UNAVAILABLE:
+	case LDAP_BUSY:
+#ifdef LDAP_CONNECT_ERROR
+	case LDAP_CONNECT_ERROR:
+#endif
+	case LDAP_LOCAL_ERROR:
+	case LDAP_INVALID_CREDENTIALS:
+	default:
+		/* connection problems */
+		ldap_conn_reconnect(conn);
+		break;
+	}
+}
+
 void db_ldap_search(struct ldap_connection *conn, struct ldap_request *request,
 		    int scope)
 {
-	int msgid;
+	int try, msgid = -1;

 	if (db_ldap_connect(conn) < 0) {
 		request->callback(conn, request, NULL);
 		return;
 	}

-	if (conn->connected && !conn->binding) {
+	for (try = 0; conn->connected && !conn->binding && try < 2; try++) {
 		if (conn->last_auth_bind) {
 			/* switch back to the default dn before doing the
 			   search request. */
@@ -211,8 +260,7 @@
 				request->callback(conn, request, NULL);
 				return;
 			}
-			db_ldap_add_delayed_request(conn, request);
-			return;
+			break;
 		}

 		msgid = ldap_search(conn->ld, request->base, scope,
@@ -220,13 +268,14 @@
 		if (msgid == -1) {
 			i_error("LDAP: ldap_search() failed (filter %s): %s",
 				request->filter, ldap_get_error(conn));
-			request->callback(conn, request, NULL);
-			return;
-		}
+			ldap_handle_error(conn);
+		}
+	}
+
+	if (msgid != -1)
 		hash_insert(conn->requests, POINTER_CAST(msgid), request);
-	} else {
+	else
 		db_ldap_add_delayed_request(conn, request);
-	}
 }

 static void ldap_conn_retry_requests(struct ldap_connection *conn)
@@ -305,16 +354,6 @@
 	i_assert(conn->delayed_requests_head == NULL);
 	conn->delayed_requests_tail = NULL;
 	conn->retrying = FALSE;
-}
-
-static void ldap_conn_reconnect(struct ldap_connection *conn)
-{
-	ldap_conn_close(conn, FALSE);
-
-	if (db_ldap_connect(conn) < 0) {
-		/* failed to reconnect. fail all requests. */
-		ldap_conn_close(conn, TRUE);
-	}
 }

 static void ldap_input(struct ldap_connection *conn)
@@ -354,9 +393,8 @@
 	}

 	if (ret < 0) {
-		i_error("LDAP: ldap_result() failed: %s",
-			ldap_get_error(conn));
-		ldap_conn_reconnect(conn);
+		i_error("LDAP: ldap_result() failed: %s", ldap_get_error(conn));
+		ldap_handle_error(conn);
 	} else {
 		if (!conn->binding)
 			db_ldap_handle_next_delayed_request(conn);


auth ldap: Moved more LDAP fatal checks to db_ldap_init()

--- src/auth/db-ldap.c
+++ src/auth/db-ldap.c
@@ -1106,13 +1106,6 @@
 	}
 #endif

-	if (conn->set.ldap_version < 3) {
-		if (conn->set.sasl_bind)
-			i_fatal("LDAP: sasl_bind=yes requires ldap_version=3");
-		if (conn->set.tls)
-			i_fatal("LDAP: tls=yes requires ldap_version=3");
-	}
-
 	ldap_version = conn->set.ldap_version;
 	db_ldap_set_opt(conn, LDAP_OPT_PROTOCOL_VERSION, &ldap_version,
 			"protocol_version", dec2str(ldap_version));
@@ -1797,6 +1790,12 @@
 	if (conn->set.sasl_bind)
 		i_fatal("LDAP: sasl_bind=yes but no SASL support compiled in");
 #endif
+	if (conn->set.ldap_version < 3) {
+		if (conn->set.sasl_bind)
+			i_fatal("LDAP %s: sasl_bind=yes requires ldap_version=3", config_path);
+		if (conn->set.tls)
+			i_fatal("LDAP %s: tls=yes requires ldap_version=3", config_path);
+	}

 	if (*conn->set.ldaprc_path != '\0') {
 		str = getenv("LDAPRC");


Login processes started by inetd aren't ours, don't treat them as such.

--HG--
branch : HEAD

--- src/master/login-process.c
+++ src/master/login-process.c
@@ -435,7 +435,8 @@
 }

 static struct login_process *
-login_process_new(struct login_group *group, pid_t pid, int fd)
+login_process_new(struct login_group *group, pid_t pid, int fd,
+		  bool inetd_child)
 {
 	struct login_process *p;

@@ -447,10 +448,12 @@
 	p->refcount = 2; /* once for fd close, another for process exit */
 	p->pid = pid;
 	p->fd = fd;
+	p->inetd_child = inetd_child;
 	p->io = io_add(fd, IO_READ, login_process_input, p);
 	p->output = o_stream_create_fd(fd, sizeof(struct master_login_reply)*10,
 				       FALSE);
-	child_process_add(pid, &p->process);
+	if (!inetd_child)
+		child_process_add(pid, &p->process);

 	p->state = LOGIN_STATE_LISTENING;

@@ -627,7 +630,7 @@

 		net_set_nonblock(fd[0], TRUE);
 		fd_close_on_exec(fd[0], TRUE);
-		(void)login_process_new(group, pid, fd[0]);
+		(void)login_process_new(group, pid, fd[0], FALSE);
 		(void)close(fd[1]);
 		(void)close(log_fd);
 		return pid;
@@ -907,9 +910,8 @@
 		net_set_nonblock(fd, TRUE);
 		fd_close_on_exec(fd, TRUE);

-		p = login_process_new(NULL, ++login_pid_counter, fd);
+		p = login_process_new(NULL, ++login_pid_counter, fd, TRUE);
 		p->initialized = TRUE;
-		p->inetd_child = TRUE;
 	}
 }


Finish icon creation code, a little feeble now, but works big feature:   passes in window class - no moew xprop nonsense :)

--- src/bin/e_border.c
+++ src/bin/e_border.c
@@ -2318,10 +2318,28 @@
      }
    else
      {
+	static char buf[PATH_MAX + 50];
+	char *name, *homedir;
+	int i;
+
+	buf[0] = '\0';
+	/* generate a reasonable file name from the window class */
+	/* FIXME - I think there could be duplicates - how better to do this? */
+	name = strdup(bd->client.icccm.class);
+	for (i = 0; i < strlen(name); i++)
+	  {
+	      if (name[i] == ' ')
+	        name[i] = '_';
+	  }
+	/* previously this could be null, but it will exist now */
+	homedir = e_user_homedir_get();
+
+	snprintf(buf, sizeof(buf),
+		 "--win-class %s %s/.e/e/applications/all/%s.eapp",
+		 bd->client.icccm.class, homedir, name);
         mi = e_menu_item_new(m);
         e_menu_item_label_set(mi, "Create Icon");
-	/* FIXME need to create path for newly created icon */
-	e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, "");
+	e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, buf);
      }

    e_menu_activate_mouse(m, bd->container, x, y, 1, 1,
@@ -2389,7 +2407,7 @@
    full = malloc(strlen(file) + strlen(command) + 1);
    strcpy(full, command);
    strcat(full, file);
-   printf("e_util_eapp_edit %s\n", full);
+   printf("EXEC %s\n", full);
    process = ecore_exe_run(full, NULL);
    if (!process || !ecore_exe_pid_get(process))
      e_error_dialog_show("Icon Edit Error", "Error starting icon editor\n\n \


NULL Check

NULL Check

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@17028 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/bin/e_border.c
+++ src/bin/e_border.c
@@ -7176,7 +7176,7 @@
 	E_Border *bd;

 	bd = l->data;
-	if (e_app_equals(bd->app, app))
+	if ((bd->app) && (e_app_equals(bd->app, app)))
 	  {
 	     bd->changes.icon = 1;
 	     bd->changed = 1;


e17/focus: remove hack waiting for pointer warp to finish

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

--- src/bin/e_border.c
+++ src/bin/e_border.c
@@ -2026,10 +2026,7 @@
              else if ((!bd->focused) || (focus_next && (bd != eina_list_data_get(focus_next))))
                {
                   Eina_List *l;
-
-		  /* waiting for pointer warp timer to reach its window...*/
-		  if (warp_timer) return;
-
+
                   if ((l = eina_list_data_find_list(focus_next, bd)))
                     focus_next = eina_list_promote_list(focus_next, l);
                   else


Forget parent and leader

Forget parent and leader

SVN revision: 16987

--- src/bin/e_border.c
+++ src/bin/e_border.c
@@ -2665,6 +2665,7 @@
 	     if (bd->focused)
 	       e_border_focus_set(bd->parent, 1, 1);
 	  }
+	bd->parent = NULL;
      }
    while (bd->transients)
      {
@@ -2687,6 +2688,7 @@
 	       e_border_focus_set(bd->leader, 1, 1);
 #endif
 	  }
+	bd->leader = NULL;
      }
    while (bd->group)
      {


reject client mouse move if coords match previous position

ensure that random event feeds don't accidentally trigger unwanted
move/resize attempts which can break the compositor

--- src/bin/e_client.c
+++ src/bin/e_client.c
@@ -758,9 +758,7 @@
 _e_client_action_event_grabber_mouse_move(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
 {
    Evas_Event_Mouse_Move *ev = event_info;
-   if (action_client &&
-     ((ev->cur.output.x != action_client->mouse.current.mx) ||
-      (ev->cur.output.y != action_client->mouse.current.my)))
+   if (action_client)
      e_client_mouse_move(action_client, &ev->cur.output);
 }

@@ -3092,6 +3090,7 @@
 {
    EINA_SAFETY_ON_NULL_RETURN(ec);
    if (ec->iconic || e_client_util_ignored_get(ec)) return;
+   if ((ec->mouse.current.mx == output->x) && (ec->mouse.current.my == output->y)) return;
    ec->mouse.current.mx = output->x;
    ec->mouse.current.my = output->y;
    if (ec->moving)


comp - with sw comp tell apps to also use sw - disable accel requests

this addresses a vbox gl asccel issue where gl client apps can cause
al of vbox to crash and users find it unexpected that e is set to
software compositing but apps go and use opengl, so it's more
consistent for users

--- src/bin/e_comp_x.c
+++ src/bin/e_comp_x.c
@@ -5008,6 +5008,14 @@
         if (e_comp_config_get()->engine == E_COMP_ENGINE_GL)
           ecore_job_add(_e_comp_x_add_fail_job, NULL);
         e_comp_gl_set(0);
+        // tell elm and all elm apps to not allow acceleration since comp
+        // can't do it (or doesn't want to), so this may cause issues in
+        // gl drivers etc. - this addresses a vbox crash bug with vm
+        // opengl acceleration
+        elm_config_preferred_engine_set("none");
+        elm_config_accel_preference_override_set(EINA_TRUE);
+        elm_config_all_flush();
+        elm_config_save();
      }

    ecore_x_composite_redirect_subwindows(root, ECORE_X_COMPOSITE_UPDATE_MANUAL);


comp: fix self feeding event loop with shape input events on override wins

so comp would call ecore_x_composite_window_events_enable in
_e_comp_x_client_shape_input_rectangle_set()
_e_comp_x_hook_client_post_new_client() all the time.. because
ec->need_shape_merge was always set.. why was it always set.. because
ecore_x_composite_window_events_enable woudl set shape rectangles to
make the window visible to input events... so e would feed itsefl with
events all day long via x. this shortcuts that to check if event rects
are the SAME then don't set them as the ones that are stored.

--- src/bin/e_comp_x.c
+++ src/bin/e_comp_x.c
@@ -2400,6 +2400,40 @@
 }

 static Eina_Bool
+_shapes_differ(E_Client *ec)
+{
+   Eina_Bool differ = EINA_FALSE;
+   if (ec->shape_input_rects)
+     {
+        Ecore_X_Rectangle *rects;
+        int num = 0, i;
+
+        rects = ecore_x_window_shape_input_rectangles_get
+        (e_client_util_win_get(ec), &num);
+        if (rects)
+          {
+             if (num == (int)ec->shape_input_rects_num)
+               {
+                  for (i = 0; i < num; i++)
+                    {
+                       if ((rects[i].x != ec->shape_input_rects[i].x) ||
+                           (rects[i].y != ec->shape_input_rects[i].y) ||
+                           (rects[i].width != (unsigned int)ec->shape_input_rects[i].w) ||
+                           (rects[i].height != (unsigned int)ec->shape_input_rects[i].h))
+                         {
+                            differ = EINA_TRUE;
+                            break;
+                         }
+                    }
+               }
+             else differ = EINA_TRUE;
+             free(rects);
+          }
+     }
+   return differ;
+}
+
+static Eina_Bool
 _e_comp_x_shape(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Shape *ev)
 {
    E_Client *ec;
@@ -2417,8 +2451,11 @@
      {
         if (ev->type == ECORE_X_SHAPE_INPUT)
           {
-             ec->changes.shape_input = 1;
-             ec->need_shape_merge = 1;
+             if (_shapes_differ(ec))
+               {
+                  ec->changes.shape_input = 1;
+                  ec->need_shape_merge = 1;
+               }
           }
         else
           {


add workaround for xwayland client bug

add workaround for xwayland client bug

sighhhhhhhhhhhhhhhhh

--- src/bin/e_comp_x.c
+++ src/bin/e_comp_x.c
@@ -2175,7 +2175,21 @@
         if (res)
           wc = wl_resource_get_user_data(res);
         if (wc)
-          e_comp_x_xwayland_client_setup(ec, wc);
+          {
+             if (wc->internal)
+               {
+                  e_object_del(E_OBJECT(wc));
+                  e_object_del(E_OBJECT(ec));
+                  /* this is an xwayland bug. somehow the wrong surface is being passed
+                   * and it's an internal surface--internal surfaces are NEVER
+                   * xwayland clients.
+                   *
+                   * ever.
+                   */
+                  return ECORE_CALLBACK_RENEW;
+               }
+             e_comp_x_xwayland_client_setup(ec, wc);
+          }
         else
           {
              ec->comp_data->surface_id = ev->data.l[0];


Load ibox in new config.

Load ibox in new config.

SVN revision: 16282

--- src/bin/e_config.c
+++ src/bin/e_config.c
@@ -422,6 +422,10 @@
 	     em->enabled = 1;
 	     e_config->modules = evas_list_append(e_config->modules, em);
 	     em = E_NEW(E_Config_Module, 1);
+	     em->name = strdup("ibox");
+	     em->enabled = 0;
+	     e_config->modules = evas_list_append(e_config->modules, em);
+	     em = E_NEW(E_Config_Module, 1);
 	     em->name = strdup("dropshadow");
 	     em->enabled = 1;
 	     e_config->modules = evas_list_append(e_config->modules, em);


Make dialog windows transient, so that they are recognized as dialogs.

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@16872 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/bin/e_dialog.c
+++ src/bin/e_dialog.c
@@ -47,6 +47,7 @@
 	free(dia);
 	return NULL;
      }
+   ecore_x_icccm_transient_for_set(dia->win->evas_win, con->win);
    e_win_delete_callback_set(dia->win, _e_dialog_cb_delete);
    dia->win->data = dia;
    e_win_name_class_set(dia->win, "E", "_dialog");


e: remove Space keybinding from e_dialog.

It was preventing typing space inside a text entry for connman. So if you
passphrase included a space you were screewed !

SVN revision: 61451

--- src/bin/e_dialog.c
+++ src/bin/e_dialog.c
@@ -73,9 +73,6 @@
    if (!kg)
       fprintf(stderr,"ERROR: unable to redirect \"KP_Enter\" key events to object %p.\n", o);
    mask = 0;
-   kg = evas_object_key_grab(o, "space", mask, ~mask, 0);
-   if (!kg)
-      fprintf(stderr,"ERROR: unable to redirect \"space\" key events to object %p.\n", o);

    evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _e_dialog_cb_key_down, dia);

@@ -332,8 +329,7 @@
 	  }
      }
    else if (((!strcmp(ev->keyname, "Return")) ||
-	     (!strcmp(ev->keyname, "KP_Enter")) ||
-	     (!strcmp(ev->keyname, "space"))))
+	     (!strcmp(ev->keyname, "KP_Enter"))))
      {
 	Evas_Object *o = NULL;


More gadcon->shelf checks before calling any shelf-specific functions.

SVN revision: 32868

--- src/bin/e_gadcon.c
+++ src/bin/e_gadcon.c
@@ -1159,7 +1159,7 @@
    E_OBJECT_CHECK(gcc);
    E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);

-   if (gcc->gadcon->shelf)
+   if (gcc->gadcon->shelf)
      e_shelf_locked_set(gcc->gadcon->shelf, 1);
    e_menu_post_deactivate_callback_set(menu, _e_gadcon_client_cb_menu_post, gcc);

@@ -2188,8 +2188,9 @@
      {
 	E_Menu *mn;
 	int cx, cy, cw, ch;
-
-	e_shelf_locked_set(gcc->gadcon->shelf, 1);
+
+	if (gcc->gadcon->shelf)
+	  e_shelf_locked_set(gcc->gadcon->shelf, 1);
 	mn = e_menu_new();
 	e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post,
 					    gcc);