Add gsl_noexcept to iterator creators begin() etc.

--- include/gsl/gsl-lite.h
+++ include/gsl/gsl-lite.h
@@ -869,42 +869,42 @@
         return span( this->data() + offset, count );
     }

-    gsl_api gsl_constexpr14 iterator begin() const
+    gsl_api gsl_constexpr14 iterator begin() const gsl_noexcept
     {
         return iterator( begin_ );
     }

-    gsl_api gsl_constexpr14 iterator end() const
+    gsl_api gsl_constexpr14 iterator end() const gsl_noexcept
     {
         return iterator( end_ );
     }

-    gsl_api gsl_constexpr14 const_iterator cbegin() const
+    gsl_api gsl_constexpr14 const_iterator cbegin() const gsl_noexcept
     {
         return const_iterator( begin() );
     }

-    gsl_api gsl_constexpr14 const_iterator cend() const
+    gsl_api gsl_constexpr14 const_iterator cend() const gsl_noexcept
     {
         return const_iterator( end() );
     }

-    gsl_api gsl_constexpr14 reverse_iterator rbegin() const
+    gsl_api gsl_constexpr14 reverse_iterator rbegin() const gsl_noexcept
     {
         return reverse_iterator( end() );
     }

-    gsl_api gsl_constexpr14 reverse_iterator rend() const
+    gsl_api gsl_constexpr14 reverse_iterator rend() const gsl_noexcept
     {
         return reverse_iterator( begin() );
     }

-    gsl_api gsl_constexpr14 const_reverse_iterator crbegin() const
+    gsl_api gsl_constexpr14 const_reverse_iterator crbegin() const gsl_noexcept
     {
         return const_reverse_iterator( cend() );
     }

-    gsl_api gsl_constexpr14 const_reverse_iterator crend() const
+    gsl_api gsl_constexpr14 const_reverse_iterator crend() const gsl_noexcept
     {
         return const_reverse_iterator( cbegin() );
     }


AWSF_CMP_INVISIBLE was missing

AWSF_CMP_INVISIBLE was missing

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@9554 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/iaws/awsdefs.h
+++ include/iaws/awsdefs.h
@@ -21,5 +21,6 @@
 const unsigned int AWSF_CMP_HIDDEN      = 8; // set if component is hidden
 const unsigned int AWSF_CMP_TRANSPARENT = 2; // set if component is transparent
 const unsigned int AWSF_CMP_ALWAYSERASE = 4; // set if component always needs erased by parent first
+const unsigned int AWSF_CMP_INVISIBLE   = 16; // set if component is so small it gets invisible

 #endif


isl_ctx_free: clarify error message

isl_ctx_free: clarify error message

When isl_ctx_free gets called when it is still being referenced
by some objects, an error gets printed and the isl_ctx object
is not freed.  However, the original error message sounds
as if the isl_ctx object is getting freed.
Clarify that this is not the case.

Requested-by: Victor Minden <49267bc9516539e9507fb01fb27c89890043b309@cerebras.net>
Signed-off-by: Sven Verdoolaege <dd860110a62b19214c4ee03aec0abffecb4e86b8@cerebras.net>

--- isl_ctx.c
+++ isl_ctx.c
@@ -291,7 +291,7 @@
 		return;
 	if (ctx->ref != 0)
 		isl_die(ctx, isl_error_invalid,
-			"isl_ctx freed, but some objects still reference it",
+			"isl_ctx not freed as some objects still reference it",
 			return);

 	if (ctx->opt->print_stats)


add LIBJ_MUTABLE_TEMPLATE

add LIBJ_MUTABLE_TEMPLATE

--- include/libj/mutable.h
+++ include/libj/mutable.h
@@ -17,7 +17,7 @@
     typedef LIBJ_CPTR(Mutable) CPtr;

     static Ptr null() {
-        LIBJ_NULL_PTR_DEF(Mutable, nullp);
+        static LIBJ_NULL_PTR_DEF(Mutable, nullp);
         return nullp;
     }

@@ -57,6 +57,9 @@
 #define LIBJ_MUTABLE(T) public libj::Mutable { \
     LIBJ_MUTABLE_DEFS(T, libj::Mutable)

+#define LIBJ_MUTABLE_TEMPLATE(T) public libj::Mutable { \
+    LIBJ_MUTABLE_TEMPLATE_DEFS(T, libj::Mutable)
+
 }  // namespace libj

 #endif  // LIBJ_MUTABLE_H_


isl_map_is_subset: add special case for singleton maps

--- isl_map.c
+++ isl_map.c
@@ -4104,6 +4104,150 @@
 	return isl_map_is_empty((struct isl_map *)set);
 }

+/* Return 1 if "bmap" contains a single element.
+ */
+int isl_basic_map_is_singleton(__isl_keep isl_basic_map *bmap)
+{
+	if (!bmap)
+		return -1;
+	if (bmap->n_div)
+		return 0;
+	if (bmap->n_ineq)
+		return 0;
+	return bmap->n_eq == isl_basic_map_total_dim(bmap);
+}
+
+/* Return 1 if "map" contains a single element.
+ */
+int isl_map_is_singleton(__isl_keep isl_map *map)
+{
+	if (!map)
+		return -1;
+	if (map->n != 1)
+		return 0;
+
+	return isl_basic_map_is_singleton(map->p[0]);
+}
+
+/* Given a singleton basic map, extract the single element
+ * as an isl_vec.
+ */
+static __isl_give isl_vec *singleton_extract_point(__isl_keep isl_basic_map *bmap)
+{
+	int i, j;
+	unsigned dim;
+	struct isl_vec *point;
+	isl_int m;
+
+	if (!bmap)
+		return NULL;
+
+	dim = isl_basic_map_total_dim(bmap);
+	isl_assert(bmap->ctx, bmap->n_eq == dim, return NULL);
+	point = isl_vec_alloc(bmap->ctx, 1 + dim);
+	if (!point)
+		return NULL;
+
+	isl_int_init(m);
+
+	isl_int_set_si(point->el[0], 1);
+	for (j = 0; j < bmap->n_eq; ++j) {
+		int s;
+		int i = dim - 1 - j;
+		isl_assert(bmap->ctx,
+		    isl_seq_first_non_zero(bmap->eq[j] + 1, i) == -1,
+		    goto error);
+		isl_assert(bmap->ctx,
+		    isl_int_is_one(bmap->eq[j][1 + i]) ||
+		    isl_int_is_negone(bmap->eq[j][1 + i]),
+		    goto error);
+		isl_assert(bmap->ctx,
+		    isl_seq_first_non_zero(bmap->eq[j]+1+i+1, dim-i-1) == -1,
+		    goto error);
+
+		isl_int_gcd(m, point->el[0], bmap->eq[j][1 + i]);
+		isl_int_divexact(m, bmap->eq[j][1 + i], m);
+		isl_int_abs(m, m);
+		isl_seq_scale(point->el, point->el, m, 1 + i);
+		isl_int_divexact(m, point->el[0], bmap->eq[j][1 + i]);
+		isl_int_neg(m, m);
+		isl_int_mul(point->el[1 + i], m, bmap->eq[j][0]);
+	}
+
+	isl_int_clear(m);
+	return point;
+error:
+	isl_int_clear(m);
+	isl_vec_free(point);
+	return NULL;
+}
+
+/* Return 1 if "bmap" contains the point "point".
+ * "bmap" is assumed to have known divs.
+ * The point is first extended with the divs and then passed
+ * to basic_map_contains.
+ */
+static int basic_map_contains_point(__isl_keep isl_basic_map *bmap,
+	__isl_keep isl_vec *point)
+{
+	int i;
+	struct isl_vec *vec;
+	unsigned dim;
+	int contains;
+
+	if (!bmap || !point)
+		return -1;
+	if (bmap->n_div == 0)
+		return basic_map_contains(bmap, point);
+
+	dim = isl_basic_map_total_dim(bmap) - bmap->n_div;
+	vec = isl_vec_alloc(bmap->ctx, 1 + dim + bmap->n_div);
+	if (!vec)
+		return -1;
+
+	isl_seq_cpy(vec->el, point->el, point->size);
+	for (i = 0; i < bmap->n_div; ++i) {
+		isl_seq_inner_product(bmap->div[i] + 1, vec->el,
+					1 + dim + i, &vec->el[1+dim+i]);
+		isl_int_fdiv_q(vec->el[1+dim+i], vec->el[1+dim+i],
+				bmap->div[i][0]);
+	}
+
+	contains = basic_map_contains(bmap, vec);
+
+	isl_vec_free(vec);
+	return contains;
+}
+
+/* Return 1 is the singleton map "map1" is a subset of "map2",
+ * i.e., if the single element of "map1" is also an element of "map2".
+ */
+static int map_is_singleton_subset(__isl_keep isl_map *map1,
+	__isl_keep isl_map *map2)
+{
+	int i;
+	int is_subset = 0;
+	struct isl_vec *point;
+
+	if (!map1 || !map2)
+		return -1;
+	if (map1->n != 1)
+		return -1;
+
+	point = singleton_extract_point(map1->p[0]);
+	if (!point)
+		return -1;
+
+	for (i = 0; i < map2->n; ++i) {
+		is_subset = basic_map_contains_point(map2->p[i], point);
+		if (is_subset)
+			break;
+	}
+
+	isl_vec_free(point);
+	return is_subset;
+}
+
 int isl_map_is_subset(struct isl_map *map1, struct isl_map *map2)
 {
 	int is_subset = 0;
@@ -4121,7 +4265,13 @@
 	if (isl_map_fast_is_universe(map2))
 		return 1;

-	diff = isl_map_subtract(isl_map_copy(map1), isl_map_copy(map2));
+	map2 = isl_map_compute_divs(isl_map_copy(map2));
+	if (isl_map_is_singleton(map1)) {
+		is_subset = map_is_singleton_subset(map1, map2);
+		isl_map_free(map2);
+		return is_subset;
+	}
+	diff = isl_map_subtract(isl_map_copy(map1), map2);
 	if (!diff)
 		return -1;


cgroup: clean up cgroup.h

cgroup: clean up cgroup.h

- replace old name 'cont' with 'cgrp' (Paul Menage did this cleanup for
  cgroup.c in commit bd89aabc6761de1c35b154fe6f914a445d301510)
- remove a duplicate declaration of cgroup_path()

Signed-off-by: Li Zefan <5dc16b054e85ffba6c8d314d8e55ae95dcab12a5@cn.fujitsu.com>
Acked-by: Paul Menage <a4e32ff3ad614f63c49bddfcf4b7598c6857b687@google.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- include/linux/cgroup.h
+++ include/linux/cgroup.h
@@ -186,15 +186,15 @@
 	char name[MAX_CFTYPE_NAME];
 	int private;
 	int (*open) (struct inode *inode, struct file *file);
-	ssize_t (*read) (struct cgroup *cont, struct cftype *cft,
+	ssize_t (*read) (struct cgroup *cgrp, struct cftype *cft,
 			 struct file *file,
 			 char __user *buf, size_t nbytes, loff_t *ppos);
 	/*
 	 * read_uint() is a shortcut for the common case of returning a
 	 * single integer. Use it in place of read()
 	 */
-	u64 (*read_uint) (struct cgroup *cont, struct cftype *cft);
-	ssize_t (*write) (struct cgroup *cont, struct cftype *cft,
+	u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft);
+	ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
 			  struct file *file,
 			  const char __user *buf, size_t nbytes, loff_t *ppos);

@@ -203,7 +203,7 @@
 	 * a single integer (as parsed by simple_strtoull) from
 	 * userspace. Use in place of write(); return 0 or error.
 	 */
-	int (*write_uint) (struct cgroup *cont, struct cftype *cft, u64 val);
+	int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val);

 	int (*release) (struct inode *inode, struct file *file);
 };
@@ -218,41 +218,41 @@

 /* Add a new file to the given cgroup directory. Should only be
  * called by subsystems from within a populate() method */
-int cgroup_add_file(struct cgroup *cont, struct cgroup_subsys *subsys,
+int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
 		       const struct cftype *cft);

 /* Add a set of new files to the given cgroup directory. Should
  * only be called by subsystems from within a populate() method */
-int cgroup_add_files(struct cgroup *cont,
+int cgroup_add_files(struct cgroup *cgrp,
 			struct cgroup_subsys *subsys,
 			const struct cftype cft[],
 			int count);

-int cgroup_is_removed(const struct cgroup *cont);
-
-int cgroup_path(const struct cgroup *cont, char *buf, int buflen);
-
-int cgroup_task_count(const struct cgroup *cont);
+int cgroup_is_removed(const struct cgroup *cgrp);
+
+int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
+
+int cgroup_task_count(const struct cgroup *cgrp);

 /* Return true if the cgroup is a descendant of the current cgroup */
-int cgroup_is_descendant(const struct cgroup *cont);
+int cgroup_is_descendant(const struct cgroup *cgrp);

 /* Control Group subsystem type. See Documentation/cgroups.txt for details */

 struct cgroup_subsys {
 	struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
-						  struct cgroup *cont);
-	void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
-	void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
+						  struct cgroup *cgrp);
+	void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
+	void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
 	int (*can_attach)(struct cgroup_subsys *ss,
-			  struct cgroup *cont, struct task_struct *tsk);
-	void (*attach)(struct cgroup_subsys *ss, struct cgroup *cont,
-			struct cgroup *old_cont, struct task_struct *tsk);
+			  struct cgroup *cgrp, struct task_struct *tsk);
+	void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
+			struct cgroup *old_cgrp, struct task_struct *tsk);
 	void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
 	void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
 	int (*populate)(struct cgroup_subsys *ss,
-			struct cgroup *cont);
-	void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cont);
+			struct cgroup *cgrp);
+	void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
 	void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
 	int subsys_id;
 	int active;
@@ -273,9 +273,9 @@
 #undef SUBSYS

 static inline struct cgroup_subsys_state *cgroup_subsys_state(
-	struct cgroup *cont, int subsys_id)
-{
-	return cont->subsys[subsys_id];
+	struct cgroup *cgrp, int subsys_id)
+{
+	return cgrp->subsys[subsys_id];
 }

 static inline struct cgroup_subsys_state *task_subsys_state(
@@ -289,8 +289,6 @@
 {
 	return task_subsys_state(task, subsys_id)->cgroup;
 }
-
-int cgroup_path(const struct cgroup *cont, char *buf, int buflen);

 int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss);

@@ -313,10 +311,10 @@
  *    - cgroup_scan_tasks() holds the css_set_lock when calling the test_task()
  *      callback, but not while calling the process_task() callback.
  */
-void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it);
-struct task_struct *cgroup_iter_next(struct cgroup *cont,
+void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
+struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
 					struct cgroup_iter *it);
-void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it);
+void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
 int cgroup_scan_tasks(struct cgroup_scanner *scan);
 int cgroup_attach_task(struct cgroup *, struct task_struct *);


Update KZPPlaygroundViewController.h

Update KZPPlaygroundViewController.h

--- Pod/Classes/Playground/KZPPlaygroundViewController.h
+++ Pod/Classes/Playground/KZPPlaygroundViewController.h
@@ -9,5 +9,5 @@
 @import UIKit;

 @interface KZPPlaygroundViewController : UIViewController
-+ (instancetype)playground;
-@end++ (instancetype)playgroundViewController;
+@end


skbuff.h: fix skb_dst kernel-doc

skbuff.h: fix skb_dst kernel-doc

Fix kernel-doc warnings (missing + extra entries) in skbuff.h.

Signed-off-by: Randy Dunlap <e1d10faa7e2a0c027bf1ff1d20e7fd10154be7ea@oracle.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- include/linux/skbuff.h
+++ include/linux/skbuff.h
@@ -264,7 +264,7 @@
  *	@transport_header: Transport layer header
  *	@network_header: Network layer header
  *	@mac_header: Link layer header
- *	@dst: destination entry
+ *	@_skb_dst: destination entry
  *	@sp: the security path, used for xfrm
  *	@cb: Control buffer. Free for use by every layer. Put private vars here
  *	@len: Length of actual data


isl_basic_map_free_inequality: avoid accessing ctx field directly

Signed-off-by: Sven Verdoolaege <235c10dd23b819f81cdc9756a251746bc184cab6@gmail.com>

--- isl_map.c
+++ isl_map.c
@@ -1611,7 +1611,9 @@
 {
 	if (!bmap)
 		return -1;
-	isl_assert(bmap->ctx, n <= bmap->n_ineq, return -1);
+	if (n > bmap->n_ineq)
+		isl_die(isl_basic_map_get_ctx(bmap), isl_error_invalid,
+			"invalid number of inequalities", return -1);
 	bmap->n_ineq -= n;
 	return 0;
 }


Update version number

Update version number

--- include/mega/version.h
+++ include/mega/version.h
@@ -2,8 +2,8 @@
 #define MEGA_MAJOR_VERSION 3
 #endif
 #ifndef MEGA_MINOR_VERSION
-#define MEGA_MINOR_VERSION 5
+#define MEGA_MINOR_VERSION 6
 #endif
 #ifndef MEGA_MICRO_VERSION
-#define MEGA_MICRO_VERSION 4
+#define MEGA_MICRO_VERSION 0
 #endif


minor change in input

minor change in input

--- Semester_1/CS501/Day4/Algorithm2_binary/FibNmod100.c
+++ Semester_1/CS501/Day4/Algorithm2_binary/FibNmod100.c
@@ -51,10 +51,6 @@
 	return C;
 }

-void divideby2(int *N){ // integer array passed
-	if(last > first)
-		last--;
-}

 int power(int A[][2], int *N){ // the no of digits in N is 10^6 // replace int N by int N[]
 	int  Y[2][2] = {{1,0},{0,1}};
@@ -72,10 +68,10 @@
 	return y[1][0];
 }

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

 	FILE *fp;
-	fp = fopen("data_binary.in","r");
+	fp = fopen(argv[1],"r");
 	for(int i = 0; i < l; i++)
 	{
 		fscanf(fp,"%1d",&N[i]);


isl_basic_map_normalize: avoid invalid access on error

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

--- isl_map.c
+++ isl_map.c
@@ -8240,7 +8240,8 @@
 		return bmap;
 	bmap = isl_basic_map_remove_redundancies(bmap);
 	bmap = isl_basic_map_sort_constraints(bmap);
-	ISL_F_SET(bmap, ISL_BASIC_MAP_NORMALIZED);
+	if (bmap)
+		ISL_F_SET(bmap, ISL_BASIC_MAP_NORMALIZED);
 	return bmap;
 }


Update version

Update version

--- include/mega/version.h
+++ include/mega/version.h
@@ -5,5 +5,5 @@
 #define MEGA_MINOR_VERSION 8
 #endif
 #ifndef MEGA_MICRO_VERSION
-#define MEGA_MICRO_VERSION 2
+#define MEGA_MICRO_VERSION 3
 #endif


Avoid inlining

Avoid inlining

--- searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h
+++ searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h
@@ -48,7 +48,7 @@

 class DynamicTeaserDFW : public JuniperTeaserDFW
 {
-    JuniperInput getJuniperInput(GeneralResult *gres);
+    JuniperInput getJuniperInput(GeneralResult *gres) __attribute__((noinline));
     vespalib::string makeDynamicTeaser(uint32_t docid,
                                        vespalib::stringref input,
                                        GetDocsumsState *state);


isl_mat_alloc: accept NULL pointer on zero-size allocation

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

--- isl_mat.c
+++ isl_mat.c
@@ -35,7 +35,7 @@
 	if (isl_blk_is_error(mat->block))
 		goto error;
 	mat->row = isl_alloc_array(ctx, isl_int *, n_row);
-	if (!mat->row)
+	if (n_row && !mat->row)
 		goto error;

 	for (i = 0; i < n_row; ++i)


fixed issue #1631

fixed issue #1631

--- OOps/bus.c
+++ OOps/bus.c
@@ -1484,7 +1484,7 @@
         else if (((STRINGDAT*) p->fp)->data!=NULL)
             strcpy(((STRINGDAT*) p->fp)->data, s);
         csoundSpinUnLock(lock);
-    } return print_chn_err(p, err);
+    } else return print_chn_err(p, err);

     return OK;
 }


*** empty log message ***

*** empty log message ***

--- include/noloadblocks.h
+++ include/noloadblocks.h
@@ -49,7 +49,11 @@
   {
     public:
       NoLoadBlocks( const ResourceModel& resource, const ProcessModel& process )
-        : resourceModel( resource ), processModel( process ) {}
+        : resourceModel( resource ), processModel( process )
+      {
+        body = NULL;
+        file = NULL;
+      }

       NoLoadBlocks( const ResourceModel& resource, const ProcessModel& process,
                     TraceBodyIO *whichBody, TraceStream *whichFile, TRecordTime endTime );


get rid of now empty #if

get rid of now empty #if

Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>
Reviewed-by: Tim Hudson <eb0be8e447f673b41b10eda09d63cd72526b0a42@openssl.org>
Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1079)

--- include/openssl/rand.h
+++ include/openssl/rand.h
@@ -65,10 +65,6 @@
 # endif
 int RAND_poll(void);

-# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-
-# endif
-
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes


Fix sorted_array operator!=

Fix sorted_array operator!=

--- include/sorted_array.h
+++ include/sorted_array.h
@@ -5,14 +5,18 @@
 private:
 	T * array;
 	int _size;
-
-
+
+
 public:
 	sorted_array(int max_size) {
 		array = new T[max_size];
 		_size = 0;
 	}
-
+
+	~sorted_array() {
+		delete[] array;
+	}
+
 	void insert(T t) {
 		array[_size] = t;
 		int i = _size;
@@ -23,7 +27,7 @@
 		}
 		++_size;
 	}
-
+
 	void resort() {
 		for (int i = 0; i < _size; ++i)
 		{
@@ -35,7 +39,7 @@
 			}
 		}
 	}
-
+
 	void erase(int i) {
 		--_size;
 		for (int j = i; j < _size; ++j)
@@ -43,16 +47,16 @@
 			array[j] = array[j+1];
 		}
 	}
-
+
 	int size() {
 		return _size;
 	}
-
-
+
+
 	T & operator[](int i) {
 		return array[i];
 	}
-
+
 	class iterator {
 	private:
 		T * it;
@@ -69,11 +73,11 @@
 		T& operator*() {
 			return *it;
 		}
-		bool operator!=(iterator other) {
-			return *it != *(other.it);
+		bool operator!=(const iterator &other) {
+			return it != other.it;
 		}
 	};
-
+
 	class reverse_iterator {
 	private:
 		T * it;
@@ -90,18 +94,16 @@
 		T& operator*() {
 			return *it;
 		}
-
-		bool operator!=(reverse_iterator other) {
-			return *it != *(other.it);
+
+		bool operator!=(const reverse_iterator &other) {
+			return it != other.it;
 		}
 	};
 	iterator begin() {return iterator(array);}
-
+
 	iterator end() {return iterator(array + _size);}
-
-	reverse_iterator rbegin() {return reverse_iterator(array + (_size - 1));}
-
+
+	reverse_iterator rbegin() {return reverse_iterator(array + _size - 1);}
+
 	reverse_iterator rend() {return reverse_iterator(array - 1);}
-
-
 };


PreParser build fix

PreParser build fix

Patch from Peter Varga <pvarga@inf.u-szeged.hu>.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6773009

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@7430 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- include/v8-preparser.h
+++ include/v8-preparser.h
@@ -73,7 +73,7 @@
       : data_(data), size_(size) { }

   // Create a PreParserData value where stack_overflow reports true.
-  static PreParserData StackOverflow() { return PreParserData(NULL, 0); }
+  static PreParserData StackOverflow() { return PreParserData(0, NULL); }
   // Whether the pre-parser stopped due to a stack overflow.
   // If this is the case, size() and data() should not be used.


Simply tidy up the bracketing of a couple of expressions in tasks.c.

--- Source/tasks.c
+++ Source/tasks.c
@@ -2282,7 +2282,7 @@

 		if( xSchedulerRunning != pdFALSE )
 		{
-			pxCurrentTCB->uxCriticalNesting++;
+			( pxCurrentTCB->uxCriticalNesting )++;
 		}
 	}

@@ -2297,7 +2297,7 @@
 	{
 		if( pxCurrentTCB->uxCriticalNesting > 0 )
 		{
-			pxCurrentTCB->uxCriticalNesting--;
+			( pxCurrentTCB->uxCriticalNesting )--;

 			if( pxCurrentTCB->uxCriticalNesting == 0 )
 			{


changes to the hash function

changes to the hash function

--- facerecogntion-facecleaner/src/core.c
+++ facerecogntion-facecleaner/src/core.c
@@ -17,7 +17,7 @@
 		exit(EXIT_FAILURE);
 	}
 	char* filename = argv[1];
-	char* tmp_filename_base = crypt(filename, "$1$1x134d$");
+	char* tmp_filename_base = crypt(filename, filename);
 	char* output_name = (char*) clean_and_save(filename, tmp_filename_base);
 	printf("%s\n", output_name);
 	return(EXIT_SUCCESS);


Update the comments to describe the purpose of Removable array.

Signed-off-by: niruiyu
Reviewed-by: li-elvin

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@11709 6f19259b-4bc3-4df7-8a09-765794883524

--- IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -1430,8 +1430,6 @@
   EFI_IMAGE_OPTIONAL_HEADER_UNION       HdrData;
   EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr;

-  Removable[0]  = FALSE;
-  Removable[1]  = TRUE;
   FloppyNumber  = 0;
   CdromNumber   = 0;
   UsbNumber     = 0;
@@ -1484,8 +1482,13 @@
   BdsDeleteAllInvalidEfiBootOption ();

   //
-  // Parse removable media followed by fixed media
-  //
+  // Parse removable media followed by fixed media.
+  // The Removable[] array is used by the for-loop below to create removable media boot options
+  // at first, and then to create fixed media boot options.
+  //
+  Removable[0]  = FALSE;
+  Removable[1]  = TRUE;
+
   gBS->LocateHandleBuffer (
         ByProtocol,
         &gEfiBlockIoProtocolGuid,


[RF] Bring down includes of RooDerivative

--- roofit/roofitcore/inc/RooDerivative.h
+++ roofit/roofitcore/inc/RooDerivative.h
@@ -20,10 +20,9 @@
 #include "RooRealProxy.h"
 #include "RooSetProxy.h"

-
-#include "Math/WrappedFunction.h"
-#include "Math/RichardsonDerivator.h"
-
+namespace ROOT{ namespace Math {
+class RichardsonDerivator;
+}}

 class RooRealVar;
 class RooArgList ;


Types: Define DBusServicePtr.

Types: Define DBusServicePtr.

--- TelepathyQt/types.h
+++ TelepathyQt/types.h
@@ -77,6 +77,7 @@
 class ContactMessenger;
 class ContactSearchChannel;
 class DBusProxy;
+class DBusService;
 class FileTransferChannel;
 class IncomingFileTransferChannel;
 class IncomingStreamTubeChannel;
@@ -142,6 +143,7 @@
 typedef SharedPtr<ContactMessenger> ContactMessengerPtr;
 typedef SharedPtr<ContactSearchChannel> ContactSearchChannelPtr;
 typedef SharedPtr<DBusProxy> DBusProxyPtr;
+typedef SharedPtr<DBusService> DBusServicePtr;
 typedef SharedPtr<FileTransferChannel> FileTransferChannelPtr;
 typedef SharedPtr<IncomingFileTransferChannel> IncomingFileTransferChannelPtr;
 typedef SharedPtr<IncomingStreamTubeChannel> IncomingStreamTubeChannelPtr;


tests: trivial change to mdevctl test macro

In order to be able to pass a string as user data to the test function,
change the DO_TEST_FULL() macro to expect a pointer and pass it directly
to virTestRun(). Previously we expected the caller to pass a struct
variable and then passed the address of that to virTestRun().

Signed-off-by: Jonathon Jongsma <c7254805a17bd5c41e24c3a278fcbf3afcdfb0fa@redhat.com>
Reviewed-by: Erik Skultety <2c14d38fa47c8799f1b9c16280abe27f8edfec6e@redhat.com>

--- tests/nodedevmdevctltest.c
+++ tests/nodedevmdevctltest.c
@@ -265,13 +265,13 @@
     }

 #define DO_TEST_FULL(desc, func, info) \
-    if (virTestRun(desc, func, &info) < 0) \
+    if (virTestRun(desc, func, info) < 0) \
         ret = -1;

 #define DO_TEST_START_FULL(virt_type, create, filename) \
     do { \
         struct startTestInfo info = { virt_type, create, filename }; \
-        DO_TEST_FULL("mdevctl start " filename, testMdevctlStartHelper, info); \
+        DO_TEST_FULL("mdevctl start " filename, testMdevctlStartHelper, &info); \
        } \
     while (0)


don't allow authentication with a limited GSI proxy credential

--- gssapi-openssh/openssh/kexgss.c
+++ gssapi-openssh/openssh/kexgss.c
@@ -339,6 +339,12 @@
 						 &ret_flags);

 		gss_release_buffer(&min_status,&recv_tok);
+
+#ifdef GSS_C_GLOBUS_LIMITED_PROXY_FLAG
+                if (ret_flags & GSS_C_GLOBUS_LIMITED_PROXY_FLAG) {
+                        fatal("Limited proxy is not allowed.");
+                }
+#endif

 		if (maj_status & GSS_S_CONTINUE_NEEDED) {
 			debug("Sending GSSAPI_CONTINUE");


fixed properties missing NOTIFY

fixed properties missing NOTIFY

--- modules/Qnite/plugin/qniteticker.h
+++ modules/Qnite/plugin/qniteticker.h
@@ -7,8 +7,8 @@
 {
   Q_OBJECT
   Q_PROPERTY(QList<qreal> values READ values WRITE setValues NOTIFY valuesChanged)
-  Q_PROPERTY(QList<qreal> minorTicks READ minorTicks WRITE setMinorTicks)
-  Q_PROPERTY(QList<qreal> midTicks READ midTicks WRITE setMidTicks)
+  Q_PROPERTY(QList<qreal> minorTicks READ minorTicks WRITE setMinorTicks NOTIFY minorTicksChanged)
+  Q_PROPERTY(QList<qreal> midTicks READ midTicks WRITE setMidTicks NOTIFY midTicksChanged)
   Q_PROPERTY(QList<qreal> majorTicks READ majorTicks WRITE setMajorTicks NOTIFY majorTicksChanged)
   Q_PROPERTY(int numSteps READ numSteps WRITE setNumSteps)


rtprtxqueue: Implement support for buffer lists

--- gst/rtpmanager/gstrtprtxqueue.c
+++ gst/rtpmanager/gstrtprtxqueue.c
@@ -64,6 +64,8 @@
     GstEvent * event);
 static GstFlowReturn gst_rtp_rtx_queue_chain (GstPad * pad, GstObject * parent,
     GstBuffer * buffer);
+static GstFlowReturn gst_rtp_rtx_queue_chain_list (GstPad * pad,
+    GstObject * parent, GstBufferList * list);

 static GstStateChangeReturn gst_rtp_rtx_queue_change_state (GstElement *
     element, GstStateChange transition);
@@ -159,6 +161,8 @@
   GST_PAD_SET_PROXY_ALLOCATION (rtx->sinkpad);
   gst_pad_set_chain_function (rtx->sinkpad,
       GST_DEBUG_FUNCPTR (gst_rtp_rtx_queue_chain));
+  gst_pad_set_chain_list_function (rtx->sinkpad,
+      GST_DEBUG_FUNCPTR (gst_rtp_rtx_queue_chain_list));
   gst_element_add_pad (GST_ELEMENT (rtx), rtx->sinkpad);

   rtx->queue = g_queue_new ();
@@ -246,6 +250,16 @@
   gst_pad_push (rtx->srcpad, buffer);
 }

+/* Must be called with rtx->lock */
+static void
+shrink_queue (GstRTPRtxQueue * rtx)
+{
+  if (rtx->max_size_packets) {
+    while (g_queue_get_length (rtx->queue) > rtx->max_size_packets)
+      gst_buffer_unref (g_queue_pop_tail (rtx->queue));
+  }
+}
+
 static GstFlowReturn
 gst_rtp_rtx_queue_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
 {
@@ -257,11 +271,7 @@

   g_mutex_lock (&rtx->lock);
   g_queue_push_head (rtx->queue, gst_buffer_ref (buffer));
-
-  if (rtx->max_size_packets) {
-    while (g_queue_get_length (rtx->queue) > rtx->max_size_packets)
-      gst_buffer_unref (g_queue_pop_tail (rtx->queue));
-  }
+  shrink_queue (rtx);

   pending = rtx->pending;
   rtx->pending = NULL;
@@ -275,6 +285,42 @@
   return ret;
 }

+static gboolean
+push_to_queue (GstBuffer ** buffer, guint idx, gpointer user_data)
+{
+  GQueue *queue = user_data;
+
+  g_queue_push_head (queue, gst_buffer_ref (*buffer));
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_rtp_rtx_queue_chain_list (GstPad * pad, GstObject * parent,
+    GstBufferList * list)
+{
+  GstRTPRtxQueue *rtx;
+  GstFlowReturn ret;
+  GList *pending;
+
+  rtx = GST_RTP_RTX_QUEUE (parent);
+
+  g_mutex_lock (&rtx->lock);
+  gst_buffer_list_foreach (list, push_to_queue, rtx->queue);
+  shrink_queue (rtx);
+
+  pending = rtx->pending;
+  rtx->pending = NULL;
+  g_mutex_unlock (&rtx->lock);
+
+  g_list_foreach (pending, (GFunc) do_push, rtx);
+  g_list_free (pending);
+
+  ret = gst_pad_push_list (rtx->srcpad, list);
+
+  return ret;
+}
+
 static void
 gst_rtp_rtx_queue_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec)


[ 3018141 ] Removed unneeded for() loop

[ 3018141 ] Removed unneeded for() loop

--- providerMgr.c
+++ providerMgr.c
@@ -1317,16 +1317,12 @@
                getInode(ctx->provA.socket), resultSockets.send,
                getInode(resultSockets.send)));

-  for (;;) {
-    // rc=spSendReq(&ctx->provA.socket, &sesultSockets.send, buf, l);
-    rc = spSendReq(&ctx->provA.socket, &sockets.send, buf, l, localMode);
-    if (rc == -2) {
-      mlogf(M_ERROR, M_SHOW, "--- need to reload provider ??\n");
-      SFCB_ASM("int $3");
-      // reloadProviderRequest(ctx);
-      exit(3);
-    } else
-      break;
+  rc = spSendReq(&ctx->provA.socket, &sockets.send, buf, l, localMode);
+  if (rc == -2) {
+    mlogf(M_ERROR, M_SHOW, "--- need to reload provider ??\n");
+    SFCB_ASM("int $3");
+    // reloadProviderRequest(ctx);
+    exit(3);
   }

   free(buf);


vaapivideomemory: category init when object define

Move the Gstreamer debug category initialize to the GObject definition.

--- gst/vaapi/gstvaapivideomemory.c
+++ gst/vaapi/gstvaapivideomemory.c
@@ -579,8 +579,10 @@
 #define GST_VAAPI_IS_VIDEO_ALLOCATOR_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_VAAPI_TYPE_VIDEO_ALLOCATOR))

-G_DEFINE_TYPE (GstVaapiVideoAllocator,
-    gst_vaapi_video_allocator, GST_TYPE_ALLOCATOR);
+G_DEFINE_TYPE_WITH_CODE (GstVaapiVideoAllocator,
+    gst_vaapi_video_allocator, GST_TYPE_ALLOCATOR,
+    GST_DEBUG_CATEGORY_INIT (gst_debug_vaapivideomemory, "vaapivideomemory", 0,
+        "VA-API video memory allocator"));

 static void
 gst_vaapi_video_allocator_free (GstAllocator * allocator, GstMemory * mem)
@@ -605,9 +607,6 @@
 {
   GObjectClass *const object_class = G_OBJECT_CLASS (klass);
   GstAllocatorClass *const allocator_class = GST_ALLOCATOR_CLASS (klass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_debug_vaapivideomemory,
-      "vaapivideomemory", 0, "VA-API video memory allocator");

   object_class->finalize = gst_vaapi_video_allocator_finalize;
   allocator_class->free = gst_vaapi_video_allocator_free;


directsound: fix uninitialized mutex and condition variable

Regression from 3044105e9d4664609a7d749469fe0fd6d85e90ff.

(cherry picked from commit 2d3723d149044db9dff5b05035c7efce5e5200f9)

--- modules/audio_output/directsound.c
+++ modules/audio_output/directsound.c
@@ -547,9 +547,12 @@
     vlc_mutex_lock( &p_sys->lock );
     p_sys->b_playing =  true;
     vlc_cond_signal( &p_sys->cond );
+    vlc_mutex_unlock( &p_sys->lock );
     vlc_cancel( p_sys->eraser_thread );
-    vlc_mutex_unlock( &p_sys->lock );
     vlc_join( p_sys->eraser_thread, NULL );
+    vlc_cond_destroy( &p_sys->cond );
+    vlc_mutex_destroy( &p_sys->lock );
+
     if( p_sys->p_notify != NULL )
     {
         IDirectSoundNotify_Release(p_sys->p_notify );
@@ -766,12 +769,19 @@
         }
     }

+    vlc_mutex_init(&sys->lock);
+    vlc_cond_init(&sys->cond);
+
     int ret = vlc_clone(&sys->eraser_thread, PlayedDataEraser, (void*) obj,
                         VLC_THREAD_PRIORITY_LOW);
     if( unlikely( ret ) )
     {
         if( ret != ENOMEM )
             msg_Err( obj, "Couldn't start eraser thread" );
+
+        vlc_cond_destroy(&sys->cond);
+        vlc_mutex_destroy(&sys->lock);
+
         if( sys->p_notify != NULL )
         {
             IDirectSoundNotify_Release( sys->p_notify );
@@ -1086,9 +1096,6 @@
     aout_DeviceReport(aout, dev);
     free(dev);

-    vlc_mutex_init(&sys->s.lock);
-    vlc_cond_init(&sys->s.cond);
-
     return VLC_SUCCESS;
 }

@@ -1096,8 +1103,6 @@
 {
     audio_output_t *aout = (audio_output_t *)obj;
     aout_sys_t *sys = aout->sys;
-    vlc_cond_destroy( &sys->s.cond );
-    vlc_mutex_destroy( &sys->s.lock );

     var_Destroy(aout, "directx-audio-device");
     FreeLibrary(sys->hdsound_dll); /* free DSOUND.DLL */


[ 3018141 ] Removed unneeded count member and updated comments on others

--- providerMgr.h
+++ providerMgr.h
@@ -67,7 +67,6 @@
   unsigned short  type;
   unsigned short  options;
 #define OH_Internal 2
-  unsigned long   count;        // maps to MsgList
   MsgSegment      nameSpace;
   MsgSegment      className;
   union {
@@ -91,7 +90,7 @@
   void           *provId;
   unsigned int    sessionId;
   unsigned int    flags;
-  unsigned long   count;        // maps to MsgList
+  unsigned long   count;        // number of MsgSegments in request
   MsgSegment      object[0];
 } BinRequestHdr;

@@ -102,7 +101,7 @@
   unsigned char   rvValue,
                   chunkedMode,
                   moreChunks;
-  unsigned long   count;        // maps to MsgList
+  unsigned long   count;        // number of MsgSegments in response
   MsgSegment      object[1];
 } BinResponseHdr;


Change to accept Gtk::TextBuffer#get_iter_at(offset) style

--- gtk3/ext/gtk3/rbgtktextbuffer.c
+++ gtk3/ext/gtk3/rbgtktextbuffer.c
@@ -730,7 +730,9 @@
 {
     GtkTextIter iter;

-    if (TYPE(position) == T_HASH) {
+    switch (TYPE(position)) {
+      case T_HASH:
+      {
         VALUE line, offset, index, mark, anchor;
         rbg_scan_options(position,
                          "line", &line,
@@ -769,7 +771,17 @@
                                                      RVAL2GTKTEXTCHILDANCHOR(anchor));
         else
             rb_raise(rb_eArgError, "Invalid arguments.");
-    } else {
+        break;
+      }
+      case T_FIXNUM:
+      {
+        gtk_text_buffer_get_iter_at_offset(_SELF(self),
+                                           &iter,
+                                           NUM2INT(position));
+        break;
+      }
+      default:
+      {
         GType gtype = RVAL2GTYPE(position);

         if (g_type_is_a(gtype, GTK_TYPE_TEXT_MARK))
@@ -782,6 +794,8 @@
                                                      RVAL2GTKTEXTCHILDANCHOR(position));
         else
             rb_raise(rb_eArgError, "Invalid arguments.");
+        break;
+      }
     }

     return GTKTEXTITER2RVAL(&iter);


Highlight both matching brackets, fixes #559128

Patch provided by: Andy Owen

--- gtksourceview/gtksourcebuffer.c
+++ gtksourceview/gtksourcebuffer.c
@@ -113,7 +113,8 @@
 	gint                   constructed:1;

 	GtkTextTag            *bracket_match_tag;
-	GtkTextMark           *bracket_mark;
+	GtkTextMark           *bracket_mark_cursor;
+	GtkTextMark           *bracket_mark_match;
 	guint                  bracket_found:1;

 	GArray                *source_marks;
@@ -410,7 +411,8 @@

 	priv->highlight_syntax = TRUE;
 	priv->highlight_brackets = TRUE;
-	priv->bracket_mark = NULL;
+	priv->bracket_mark_cursor = NULL;
+	priv->bracket_mark_match = NULL;
 	priv->bracket_found = FALSE;

 	priv->source_marks = g_array_new (FALSE, FALSE, sizeof (GtkSourceMark *));
@@ -704,12 +706,66 @@
 	return buffer->priv->bracket_match_tag;
 }

+static gunichar
+bracket_pair (gunichar base_char, gint *direction)
+{
+	gint dir;
+	gunichar pair;
+
+	switch ((int)base_char)
+	{
+		case '{':
+			dir = 1;
+			pair = '}';
+			break;
+		case '(':
+			dir = 1;
+			pair = ')';
+			break;
+		case '[':
+			dir = 1;
+			pair = ']';
+			break;
+		case '<':
+			dir = 1;
+			pair = '>';
+			break;
+		case '}':
+			dir = -1;
+			pair = '{';
+			break;
+		case ')':
+			dir = -1;
+			pair = '(';
+			break;
+		case ']':
+			dir = -1;
+			pair = '[';
+			break;
+		case '>':
+			dir = -1;
+			pair = '<';
+			break;
+		default:
+			dir = 0;
+			pair = 0;
+			break;
+	}
+
+	/* Let direction be NULL if we don't care */
+	if (direction != NULL)
+		*direction = dir;
+
+	return pair;
+}
+
 static void
 gtk_source_buffer_move_cursor (GtkTextBuffer     *buffer,
 			       const GtkTextIter *iter,
 			       GtkTextMark       *mark)
 {
 	GtkTextIter iter1, iter2;
+	gunichar cursor_char;

 	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
 	g_return_if_fail (iter != NULL);
@@ -723,13 +779,25 @@
 	{
 		gtk_text_buffer_get_iter_at_mark (buffer,
 						  &iter1,
-						  GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark);
+						  GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_match);
+
 		iter2 = iter1;
 		gtk_text_iter_forward_char (&iter2);
 		gtk_text_buffer_remove_tag (buffer,
 					    GTK_SOURCE_BUFFER (buffer)->priv->bracket_match_tag,
 					    &iter1,
 					    &iter2);
+
+		gtk_text_buffer_get_iter_at_mark (buffer,
+						  &iter1,
+						  GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_cursor);
+
+		iter2 = iter1;
+		gtk_text_iter_forward_char (&iter2);
+		gtk_text_buffer_remove_tag (buffer,
+					    GTK_SOURCE_BUFFER (buffer)->priv->bracket_match_tag,
+					    &iter1,
+					    &iter2);
 	}

 	if (!GTK_SOURCE_BUFFER (buffer)->priv->highlight_brackets)
@@ -740,30 +808,63 @@
 	                                                     &iter1,
 	                                                     MAX_CHARS_BEFORE_FINDING_A_MATCH))
 	{
-		if (!GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark)
-			GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark =
-				gtk_text_buffer_create_mark (buffer,
-							     NULL,
-							     &iter1,
-							     FALSE);
-		else
-			gtk_text_buffer_move_mark (buffer,
-						   GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark,
-						   &iter1);
-
-		iter2 = iter1;
-		gtk_text_iter_forward_char (&iter2);
-
 		/* allow_bracket_match will allow the bracket match tag to be
 		   applied to the buffer. See apply_tag_real for more
 		   information */
 		GTK_SOURCE_BUFFER (buffer)->priv->allow_bracket_match = TRUE;
+
+		/* Mark matching bracket */
+		if (!GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_match)
+		{
+			GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_match =
+ 				gtk_text_buffer_create_mark (buffer,
+ 							     NULL,
+ 							     &iter1,
+ 							     FALSE);
+ 		}
+ 		else
+ 		{
+ 			gtk_text_buffer_move_mark (buffer,
+						   GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_match,
+ 						   &iter1);
+ 		}
+
+		iter2 = iter1;
+		gtk_text_iter_forward_char (&iter2);
 		gtk_text_buffer_apply_tag (buffer,
 					   get_bracket_match_tag (GTK_SOURCE_BUFFER (buffer)),
 					   &iter1,
 					   &iter2);
+
+		/* Mark the bracket near the cursor */
+		iter1 = *iter;
+		cursor_char = gtk_text_iter_get_char (&iter1);
+		if (bracket_pair (cursor_char, NULL) == 0)
+			gtk_text_iter_backward_char (&iter1);
+
+		if (!GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_cursor)
+		{
+			GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_cursor =
+				gtk_text_buffer_create_mark (buffer,
+							     NULL,
+							     &iter1,
+							     TRUE);
+		}
+		else
+		{
+			gtk_text_buffer_move_mark (buffer,
+						   GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark_cursor,
+						   &iter1);
+		}
+
+		iter2 = iter1;
+		gtk_text_iter_forward_char (&iter2);
+		gtk_text_buffer_apply_tag (buffer,
+					   get_bracket_match_tag (GTK_SOURCE_BUFFER (buffer)),
+					   &iter1,
+					   &iter2);
+
 		GTK_SOURCE_BUFFER (buffer)->priv->allow_bracket_match = FALSE;
-
 		GTK_SOURCE_BUFFER (buffer)->priv->bracket_found = TRUE;
 	}
 	else
@@ -957,43 +1058,7 @@
 	base_char = search_char = cur_char;
 	cclass_mask = get_context_class_mask (buffer, &iter);

-	switch ((int) base_char) {
-		case '{':
-			addition = 1;
-			search_char = '}';
-			break;
-		case '(':
-			addition = 1;
-			search_char = ')';
-			break;
-		case '[':
-			addition = 1;
-			search_char = ']';
-			break;
-		case '<':
-			addition = 1;
-			search_char = '>';
-			break;
-		case '}':
-			addition = -1;
-			search_char = '{';
-			break;
-		case ')':
-			addition = -1;
-			search_char = '(';
-			break;
-		case ']':
-			addition = -1;
-			search_char = '[';
-			break;
-		case '>':
-			addition = -1;
-			search_char = '<';
-			break;
-		default:
-			addition = 0;
-			break;
-	}
+	search_char = bracket_pair (base_char, &addition);

 	if (addition == 0)
 		return FALSE;
@@ -1002,7 +1067,8 @@
 	found = FALSE;
 	char_cont = 0;

-	do {
+	do
+	{
 		gint current_mask;

 		gtk_text_iter_forward_chars (&iter, addition);
@@ -1022,7 +1088,8 @@
 		if ((cur_char == search_char || cur_char == base_char) &&
 		    cclass_mask == current_mask)
 		{
-			if ((cur_char == search_char) && counter == 0) {
+			if ((cur_char == search_char) && counter == 0)
+			{
 				found = TRUE;
 				break;
 			}


Suppress more off-by-default warnings

Suppress more off-by-default warnings

--- UVAtlas/pch.h
+++ UVAtlas/pch.h
@@ -19,13 +19,14 @@
 // C4350 behavior change

 // Off by default warnings
-#pragma warning(disable : 4061 4365 4571 4623 4625 4626 4668 4710 4711 4746 4820 4987 5026 5027 5031 5032 5039)
+#pragma warning(disable : 4061 4365 4571 4623 4625 4626 4628 4668 4710 4711 4746 4820 4987 5026 5027 5031 5032 5039)
 // C4061 enumerator 'X' in switch of enum 'X' is not explicitly handled by a case label
 // C4365 signed/unsigned mismatch
 // C4571 behavior change
 // C4623 default constructor was implicitly defined as deleted
 // C4625 copy constructor was implicitly defined as deleted
 // C4626 assignment operator was implicitly defined as deleted
+// C4628 digraphs not supported
 // C4668 not defined as a preprocessor macro
 // C4710 function not inlined
 // C4711 selected for automatic inline expansion


Fix build errors on Windows.
Since this is a C file, variables must be declared at the top of the function
so I'm moving the fix for the warning (inst = NULL) to the bottom of the funciton.
Otherwise, the compiler will complain when it sees int i; on systems that do
not have WEBRTC_BIG_ENDIAN defined.
Review URL: http://webrtc-codereview.appspot.com/139005

git-svn-id: 9b397c5dfe384c04b1b200d5305b653241000171@494 4adac7df-926f-26a2-2b94-8c16560cd09d

--- modules/audio_coding/codecs/PCM16B/main/source/pcm16b.c
+++ modules/audio_coding/codecs/PCM16B/main/source/pcm16b.c
@@ -68,7 +68,6 @@
                                      WebRtc_Word16 *speechOut16b,
                                      WebRtc_Word16* speechType)
 {
-  (void)(inst = NULL);
 #ifdef WEBRTC_BIG_ENDIAN
     WEBRTC_SPL_MEMCPY_W8(speechOut16b, speechIn16b, ((len*sizeof(WebRtc_Word16)+1)>>1));
 #else
@@ -81,6 +80,10 @@
 #endif

     *speechType=1;
+
+    // Avoid warning.
+    (void)(inst = NULL);
+
     return(len>>1);
 }


gutter: small cleanup in on_view_draw()

gutter: small cleanup in on_view_draw()

Remove dead code, and make the loops clearer.

--- gtksourceview/gtksourcegutter.c
+++ gtksourceview/gtksourcegutter.c
@@ -905,7 +905,6 @@
 	GtkTextView *text_view;
 	GArray *sizes;
 	GdkRectangle clip;
-	gint x, y;
 	gint y1, y2;
 	GArray *numbers;
 	GArray *pixels;
@@ -926,8 +925,6 @@
 	gint idx;
 	GtkStyleContext *style_context;
 	GdkRGBA fg_color;
-	GdkDeviceManager *device_manager;
-	GdkDevice *pointer;

 	window = get_window (gutter);

@@ -948,10 +945,6 @@
 	gutter->priv->is_drawing = TRUE;

 	buffer = gtk_text_view_get_buffer (text_view);
-
-	device_manager = gdk_display_get_device_manager (gdk_window_get_display (window));
-	pointer = gdk_device_manager_get_client_pointer (device_manager);
-	gdk_window_get_device_position (window, pointer, &x, &y, NULL);

 	y1 = clip.y;
 	y2 = y1 + clip.height;
@@ -977,9 +970,6 @@
 	sizes = g_array_new (FALSE, FALSE, sizeof (gint));

 	calculate_gutter_size (gutter, sizes);
-
-	i = 0;
-	x = 0;

 	background_area.x = 0;
 	background_area.height = get_lines (text_view,
@@ -1004,9 +994,6 @@

 	cell_area.y = background_area.y;

-	item = gutter->priv->renderers;
-	idx = 0;
-
 	style_context = gtk_widget_get_style_context (GTK_WIDGET (view));

 	gtk_style_context_get_color (style_context,
@@ -1015,13 +1002,15 @@

 	gdk_cairo_set_source_rgba (cr, &fg_color);

-	while (item)
+	for (item = gutter->priv->renderers, idx = 0;
+	     item != NULL;
+	     item = g_list_next (item), idx++)
 	{
 		Renderer *renderer = item->data;
 		gint xpad;
 		gint width;

-		width = g_array_index (sizes, gint, idx++);
+		width = g_array_index (sizes, gint, idx);

 		if (gtk_source_gutter_renderer_get_visible (renderer->renderer))
 		{
@@ -1050,8 +1039,6 @@

 			background_area.x += background_area.width;
 		}
-
-		item = g_list_next (item);
 	}

 	gtk_text_buffer_get_iter_at_mark (buffer,
@@ -1104,9 +1091,9 @@
 		background_area.height = g_array_index (heights, gint, i);
 		background_area.x = 0;

-		idx = 0;
-
-		for (item = gutter->priv->renderers; item; item = g_list_next (item))
+		for (item = gutter->priv->renderers, idx = 0;
+		     item != NULL;
+		     item = g_list_next (item), idx++)
 		{
 			Renderer *renderer;
 			gint width;
@@ -1115,7 +1102,7 @@
 			gint ypad;

 			renderer = item->data;
-			width = g_array_index (sizes, gint, idx++);
+			width = g_array_index (sizes, gint, idx);

 			if (!gtk_source_gutter_renderer_get_visible (renderer->renderer))
 			{
@@ -1182,7 +1169,7 @@
 		gtk_text_iter_forward_line (&start);
 	}

-	for (item = gutter->priv->renderers; item; item = g_list_next (item))
+	for (item = gutter->priv->renderers; item != NULL; item = g_list_next (item))
 	{
 		Renderer *renderer = item->data;

@@ -1195,7 +1182,6 @@
 	g_array_free (numbers, TRUE);
 	g_array_free (pixels, TRUE);
 	g_array_free (heights, TRUE);
-
 	g_array_free (sizes, TRUE);

 	gutter->priv->is_drawing = FALSE;


mac80211: skb leak in mesh_plink_frame_tx()

Although adding an IE is almost guaranteed to succeed since we already
accounted for its length while allocating the skb, we should still free
the skb in case of failure.

Signed-off-by: Thomas Pedersen <5f50a84c1fa3bcff146405017f36aec1a10a9e38@cozybit.com>
Signed-off-by: Johannes Berg <bff32994ff0f8d048f262a8388145a71b6071bfe@intel.com>

--- net/mac80211/mesh_plink.c
+++ net/mac80211/mesh_plink.c
@@ -224,6 +224,7 @@
 	u8 *pos, ie_len = 4;
 	int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) +
 		      sizeof(mgmt->u.action.u.self_prot);
+	int err = -ENOMEM;

 	skb = dev_alloc_skb(local->tx_headroom +
 			    hdr_len +
@@ -267,11 +268,11 @@
 		    mesh_add_rsn_ie(skb, sdata) ||
 		    mesh_add_meshid_ie(skb, sdata) ||
 		    mesh_add_meshconf_ie(skb, sdata))
-			return -1;
+			goto free;
 	} else {	/* WLAN_SP_MESH_PEERING_CLOSE */
 		info->flags |= IEEE80211_TX_CTL_NO_ACK;
 		if (mesh_add_meshid_ie(skb, sdata))
-			return -1;
+			goto free;
 	}

 	/* Add Mesh Peering Management element */
@@ -290,11 +291,12 @@
 		ie_len += 2;	/* reason code */
 		break;
 	default:
-		return -EINVAL;
+		err = -EINVAL;
+		goto free;
 	}

 	if (WARN_ON(skb_tailroom(skb) < 2 + ie_len))
-		return -ENOMEM;
+		goto free;

 	pos = skb_put(skb, 2 + ie_len);
 	*pos++ = WLAN_EID_PEER_MGMT;
@@ -315,14 +317,17 @@
 	if (action != WLAN_SP_MESH_PEERING_CLOSE) {
 		if (mesh_add_ht_cap_ie(skb, sdata) ||
 		    mesh_add_ht_oper_ie(skb, sdata))
-			return -1;
+			goto free;
 	}

 	if (mesh_add_vendor_ies(skb, sdata))
-		return -1;
+		goto free;

 	ieee80211_tx_skb(sdata, skb);
 	return 0;
+free:
+	kfree_skb(skb);
+	return err;
 }

 /**


Delete Resource.h

Delete Resource.h

--- UltraLog/Resource.h
+++ UltraLog/Resource.h
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by UltraLog.RC
-//
-
-// ¶һĬֵ
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-
-#define _APS_NEXT_RESOURCE_VALUE	6000
-#define _APS_NEXT_CONTROL_VALUE		6000
-#define _APS_NEXT_SYMED_VALUE		6000
-#define _APS_NEXT_COMMAND_VALUE		32771
-#endif
-#endif


fixed compiler warnings.

fixed compiler warnings.

--- XmlRpcHttpd.h
+++ XmlRpcHttpd.h
@@ -4,6 +4,7 @@
 #define XMLRPCHTTPD_VERSION 0x0100

 #pragma warning(disable:4018 4503 4530 4786)
+#define _CRT_SECURE_NO_WARNINGS
 #include <sys/types.h>
 #ifdef _WIN32
 #include <winsock2.h>
@@ -137,8 +138,8 @@
 	}
 	static std::string get_realpath(std::string path) {
 		std::replace(path.begin(), path.end(), '\\', '/');
-		int end_pos = path.find_last_of("?#");
-		if (end_pos != -1) path.resize(end_pos);
+		size_t end_pos = path.find_last_of("?#");
+		if (end_pos != std::string::npos) path.resize(end_pos);

 		std::vector<std::string> path_sep = split_string(path, "/");
 		std::vector<std::string>::iterator it;


virtiolib: Fix incorrect assert in get_unused_desc()

The last descriptor does not have a valid next field so it is incorrect
to always expect the VIRTQ_DESC_F_NEXT flag to be set.

The assert fires in drivers that fill virtqueues with buffers, for example
NetKVM and its rx queues.

Instead, assert that we still have at least one unused descriptor using
the num_unused counter.

Signed-off-by: Ladi Prosek <727f16b97cf99ec0710180d99386e4875fb7e2eb@redhat.com>

--- VirtIO/VirtIORing.c
+++ VirtIO/VirtIORing.c
@@ -41,7 +41,7 @@
 static inline u16 get_unused_desc(struct virtqueue *vq)
 {
     u16 idx = vq->first_unused;
-    ASSERT(vq->vring.desc[idx].flags & VIRTQ_DESC_F_NEXT);
+    ASSERT(vq->num_unused > 0);

     vq->first_unused = vq->vring.desc[idx].next;
     vq->num_unused--;


Update version.h

Update version.h

--- src/app/contextBroker/version.h
+++ src/app/contextBroker/version.h
@@ -28,6 +28,6 @@

-#define ORION_VERSION "2.4.0_20200802203650"
+#define ORION_VERSION "2.4.0-next"

 #endif  // SRC_APP_CONTEXTBROKER_VERSION_H_


do_search now needs disc structure parameter

--- examples/main.h
+++ examples/main.h
@@ -1,5 +1,5 @@
 /*
-    $Id: main.h,v 1.13 2005/07/17 09:43:14 airborne Exp $
+    $Id: main.h,v 1.14 2005/07/23 07:19:09 airborne Exp $

     Copyright (C) 2003, 2004, 2005 Kris Verbeeck <airborne@advalvas.be>

@@ -51,4 +51,4 @@

 void do_sites(cddb_conn_t *conn);

-void do_search(cddb_conn_t *conn, const char *str, int quiet);
+void do_search(cddb_conn_t *conn, cddb_disc_t *disc, const char *str, int quiet);


Delete XOrthoLaserMesure.h

Delete XOrthoLaserMesure.h

--- XOrthoLaserMesure.h
+++ XOrthoLaserMesure.h
@@ -1,77 +0,0 @@
-#pragma once
-#include "libXBase/XPt3D.h"
-#include "libXBase/XBase.h"
-//#include "ProjPostProcessSolution.h"
-
-#include "XOrthoLaserPoint.h"
-
-#include <list>
-
-class XOrthoLaserDalle;
-class XError;
-class XOrthoLaserRxp;
-class ProjPostProcessSolution;
-
-class XOrthoLaserMesure : public XPt2D
-{
-protected:
-	bool			m_bValid;		// Indique si la mesure est valide (mesure)
-	float			m_dTime;		// Heure du point rcupre dans la dalle
-	XPt3D			m_terrainLaser;  //coordonnes terrain issues des ortho laser
-
-	XOrthoLaserPoint* m_pt;
-	XOrthoLaserDalle* m_img;
-	std::string		m_strImage;	// nom de image sur laquellle a ete faite la mesure
-public:
-	XOrthoLaserMesure(XOrthoLaserPoint* Pt, XOrthoLaserDalle* img);
-	~XOrthoLaserMesure();
-
-	XError* Error();
-
-	virtual bool XmlWrite(std::ostream* out);
-
-	bool SetMesure(double x, double y);
-	bool SetValuesFromOrtholas();
-
-	void PositionLaser(XPt3D	p){m_terrainLaser = p;  }//coordonnes terrain issues des ottho laser
-	XPt3D PositionLaser(){return m_terrainLaser;}
-
-	inline bool Valid() const { return m_bValid;}
-	void Valid(bool flag) { m_bValid = flag;}
-
-	float Time(){return m_dTime;}// Heure Gps du point
-	void Time(float val){m_dTime = val;}
-	double AbsoluteTime();//une heure qui permet de faire des comparaisons chronologiques
-
-	XOrthoLaserDalle*  Ortho(){	return m_img;}
-	XOrthoLaserRxp*  Rxp();
-	ProjPostProcessSolution* Solution();
-
-	std::string ImageName(){return m_strImage;}
-	void ImageName(std::string str){m_strImage = str;}
-	std::string strIdCouche();
-
-	void  Ortho(XOrthoLaserDalle* img);
-	void DeconnectOrtho();
-
-	XOrthoLaserPoint* Pt() ;
-	void  Pt(XOrthoLaserPoint* pt);
-	uint32 NumPoint();
-	bool SetPointNumFromTime();
-
-	XPt3D Translation();
-
-	bool SetPointPosition();
-	bool UpdateCoordFromPoint();
-
-	void DeconnectPoint();
-
-	bool ConnectSousEch();
-	bool DeconnectSousEch();
-
-	bool EcritureVecteurViewer(std::ostream* out);
-	std::string InfoTxt();
-	bool WriteMesure(std::ostream* out);
-
-
-};


add casette noise to speaker output

add casette noise to speaker output

--- examples/Vic20/vic20.c
+++ examples/Vic20/vic20.c
@@ -1616,10 +1616,12 @@
 		if (amountAdded!=BUFFER_LEN)
 		{
 			int32_t res=0;
+
 			res+=currentDAC[0];
 			res+=currentDAC[1];
 			res+=currentDAC[2];
 			res+=currentDAC[3];
+			res+=casLevel?1024:-1024;

 			audioBuffer[amountAdded]=res>>BUFFER_FORMAT_SHIFT;
 			amountAdded++;


SDL renderer now working, need to clean up and refactor into renderer module

--- example/source/main.c
+++ example/source/main.c
@@ -69,6 +69,7 @@
 	printf("\r\n------------------------------------\r\n");
 	printf("micro-gui (ugui) example application\r\n");
 	printf("Output will appear (while running) in ./test.bmp\r\n");
+	//TODO: notes about SDL, make SDL rendering optional arg
 	printf("Use wasd to for directional navigation, q for back, and e for select\r\n");
 	printf("Note that you will need to press enter following each command\r\n");

@@ -92,9 +93,36 @@
 	ugui_render(gui);

 	while (running > 0) {
-		int event = get_input_event();
+		//int event = get_input_event();
+		//ugui_put_event(gui, event);

-		ugui_put_event(gui, event);
+		//Handle SDL events
+		SDL_Event event;
+		while (SDL_PollEvent(&event)) {
+			if (event.type == SDL_QUIT) {
+				running = 0;
+			}
+			if (event.type == SDL_KEYDOWN) {
+				switch (event.key.keysym.sym) {
+				case SDLK_UP:
+					ugui_put_event(gui, UGUI_EVT_UP);
+					break;
+				case SDLK_DOWN:
+					ugui_put_event(gui, UGUI_EVT_DOWN);
+					break;
+				case SDLK_LEFT:
+					ugui_put_event(gui, UGUI_EVT_LEFT);
+					break;
+				case SDLK_RIGHT:
+					ugui_put_event(gui, UGUI_EVT_RIGHT);
+					break;
+				case SDLK_ESCAPE:
+				case SDLK_q:
+					running = 0;
+					break;
+				}
+			}
+		}

 		ugui_render(gui);

@@ -112,6 +140,8 @@
 		SDL_DestroyTexture(tex);

 		SDL_FreeSurface(bmp);
+
+		usleep(1000);
 	}

 	ugui_destroy(gui);


journal: document internal bindings

journal: document internal bindings

--- journal.c
+++ journal.c
@@ -77,19 +77,19 @@
 #define error_system(message, errno) error_system_error(__func__, message, errno)

 SCM_DEFINE(journal_send, "journal-sendv", 1, 0, 0,
-	   (SCM messages),
-	   "")
+	   (SCM s_fields),
+	   "Send an entry consisting of FIELDS to the journal.")
 {
 	struct iovec *iov;
 	int i, n, r;

-	n = scm_to_int(scm_length(messages));
+	n = scm_to_int(scm_length(s_fields));
 	iov = alloca(n * sizeof(struct iovec));

 	for (i = 0; i < n; i++) {
 		char *msg;

-		msg = scm_to_locale_string(scm_list_ref(messages, scm_from_int(i)));
+		msg = scm_to_locale_string(scm_list_ref(s_fields, scm_from_int(i)));
 		iov[i].iov_base = msg;
 		iov[i].iov_len = strlen(msg);
 	}
@@ -108,7 +108,10 @@

 SCM_DEFINE(journal_open, "journal-open", 1, 0, 0,
 	   (SCM s_flags),
-	   "")
+	   "Open journal using FLAGS and return a journal smob."
+	   "Possible flags are symbols: local-only, runtime-only, system, current-user.\n"
+	   "They map to the journal's internal flags SD_JOURNAL_LOCAL_ONLY,\n"
+	   "SD_JOURNAL_RUNTIME_ONLY, SD_JOURNAL_SYSTEM and SD_JOURNAL_CURRENT_USER respectively.")
 {
 	SCM smob;
 	sd_journal *j;
@@ -146,7 +149,7 @@

 SCM_DEFINE(journal_add_match, "journal-add-match", 2, 0, 0,
 	   (SCM smob, SCM s_match),
-	   "")
+	   "Add MATCH to the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	char *data;
@@ -162,7 +165,7 @@

 SCM_DEFINE(journal_add_conjunction, "journal-add-conjunction", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Add conjunction to the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	int r;
@@ -176,7 +179,7 @@

 SCM_DEFINE(journal_add_disjunction, "journal-add-disjunction", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Add disjunction to the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	int r;
@@ -190,7 +193,7 @@

 SCM_DEFINE(journal_flush_matches, "journal-flush-matches", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Flush all matches from the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);

@@ -200,7 +203,7 @@

 SCM_DEFINE(journal_seek_head, "journal-seek-head", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Seek to the head of the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	int r;
@@ -214,7 +217,7 @@

 SCM_DEFINE(journal_next, "journal-next", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Advance to next entry of the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);

@@ -222,15 +225,15 @@
 }

 SCM_DEFINE(journal_get_data, "journal-get-data", 2, 0, 0,
-	   (SCM smob, SCM field),
-	   "")
+	   (SCM smob, SCM s_field),
+	   "Retrieve FIELD data of the current entry from the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	char *data;
 	size_t length;
 	int r;

-	r = sd_journal_get_data(j, scm_to_locale_string(field), (const void **)&data, &length);
+	r = sd_journal_get_data(j, scm_to_locale_string(s_field), (const void **)&data, &length);
 	if (r < 0)
 		error_system("Failed to retrieve data from journal", -r);

@@ -239,7 +242,7 @@

 SCM_DEFINE(journal_enumerate_data, "journal-enumerate-data", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Enumerate data of the current entry of the journal.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	char *data;
@@ -255,7 +258,7 @@

 SCM_DEFINE(journal_restart_data, "journal-restart-data", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Reset the data enumeration index to the beginning of the entry.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);

@@ -265,7 +268,7 @@

 SCM_DEFINE(journal_get_realtime_usec, "journal-get-realtime-usec", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Get the realtime (wallclock) timestamp of the current journal entry.")
 {
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
 	uint64_t usec;
@@ -334,7 +337,7 @@

 SCM_DEFINE(journal_enumerate_entry, "journal-enumerate-entry", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Return the current entry as an associative list.")
 {
 	SCM alist = SCM_EOL;
 	sd_journal *j = (sd_journal *)SCM_SMOB_DATA(smob);
@@ -361,7 +364,7 @@

 SCM_DEFINE(journal_slurp_data, "journal-slurp-data", 1, 0, 0,
 	   (SCM smob),
-	   "")
+	   "Return all entries of the journal.")
 {
 	SCM array;
 	scm_t_array_handle handle;


minor fix

minor fix

git-svn-id: a7f2a8f7432d210e972fb03898013d213e2b549b@9873 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/core/include/seqan/index/find_pigeonhole.h
+++ seqan/core/include/seqan/index/find_pigeonhole.h
@@ -357,7 +357,7 @@

         TSize minQ = MaxValue<TSize>::VALUE;
         TSize maxQ = 3;
-        TSize maxSeqLen = MinValue<TSize>::VALUE;
+        TSize maxSeqLen = 0;
         for(unsigned seqNo = 0; seqNo < seqCount; ++seqNo)
         {
             // get pattern length and max. allowed errors


Bluetooth: samples/hci_uart: Use proper stack declaration

Use BT_STACK_NOINIT for tx stack declaration. This makes sure stack
it properly alligned and account for k_thread overhead.

Change-Id: I704958fcc3ce02aba913f6eaee13ae50d2a81591
Signed-off-by: Szymon Janc <b8f563e108973ccd513fe259bc96c595c4d39939@tieto.com>

--- samples/bluetooth/hci_uart/src/main.c
+++ samples/bluetooth/hci_uart/src/main.c
@@ -32,14 +32,13 @@

 #include <net/buf.h>
 #include <bluetooth/bluetooth.h>
+#include <bluetooth/log.h>
 #include <bluetooth/hci.h>
 #include <bluetooth/buf.h>
 #include <bluetooth/hci_raw.h>

 static struct device *hci_uart_dev;
-
-#define STACK_SIZE 1024
-static uint8_t tx_thread_stack[STACK_SIZE];
+static BT_STACK_NOINIT(tx_thread_stack, 1024);

 /* HCI command buffers */
 #define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \
@@ -374,8 +373,8 @@
 	/* Spawn the TX thread and start feeding commands and data to the
 	 * controller
 	 */
-	k_thread_spawn(tx_thread_stack, STACK_SIZE, tx_thread, NULL, NULL,
-		       NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
+	k_thread_spawn(tx_thread_stack, sizeof(tx_thread_stack), tx_thread,
+		       NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);

 	while (1) {
 		struct net_buf *buf;


Fixed temporary file bug on Windows (do not try to remove extension)

--- Top/one_file.c
+++ Top/one_file.c
@@ -89,7 +89,7 @@
         }
 #endif
         if (ext != NULL && ext[0] != (char) 0) {
-#ifndef __MACH__
+#if !defined(LINUX) && !defined(__MACH__) && !defined(WIN32)
           char  *p;
           /* remove original extension (does not work on OS X */
           /* and may be a bad idea) */


Fix erroneous edits to histogram enum.

Fix erroneous edits to histogram enum.

The following CL introduced shifting of the enum values, which should not occur:

https://codereview.chromium.org/12769017

Moving a couple of entries around to restore correct order.

BUG=

Review URL: https://chromiumcodereview.appspot.com/12887008

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

--- chrome/browser/extensions/extension_function_histogram_value.h
+++ chrome/browser/extensions/extension_function_histogram_value.h
@@ -305,7 +305,6 @@
   SERIAL_FLUSH,
   BROWSERACTION_SETTITLE,
   BOOKMARKMANAGERPRIVATE_CANEDIT,
-  WALLPAPERPRIVATE_RESETWALLPAPER,
   WALLPAPERPRIVATE_SETCUSTOMWALLPAPER,
   BOOKMARKS_REMOVE,
   INPUT_IME_SETCANDIDATES,
@@ -498,6 +497,7 @@
   DOWNLOADSINTERNAL_DETERMINEFILENAME,
   SYNCFILESYSTEM_GETFILESYNCSTATUSES,
   MEDIAGALLERIESPRIVATE_GETHANDLERS,
+  WALLPAPERPRIVATE_RESETWALLPAPER,
   ENUM_BOUNDARY // Last entry: Add new entries above.
 };


ENH: check that the handler is active before updating the curves

--- Code/Visualization/otbHistogramActionHandler.h
+++ Code/Visualization/otbHistogramActionHandler.h
@@ -90,7 +90,7 @@
     spacePoint[0]     = m_RightAsymptote->GetAbcisse();
     double abcisseR  = m_Curve->TransformPoint(spacePoint)[0];

-    if (widgetId == m_Curve->GetIdentifier())
+    if (widgetId == m_Curve->GetIdentifier() && this->GetIsActive())
       {
       switch (event)
         {


Comments/example

Comments/example

--- Library/Sources/Stroika/Foundation/Traversal/Iterable.h
+++ Library/Sources/Stroika/Foundation/Traversal/Iterable.h
@@ -608,6 +608,13 @@
                  *      VerifyTestResult (c.Select<int> ([] (pair<int,char> p) { return p.first; }).SequnceEquals (Iterable<int> { 1, 2, 3 }));
                  *      \endcode
                  *
+                 *  This can also easily be used to TRANSFORM an iterable.
+                 *  \par Example Usage
+                 *      \code
+                 *      Iterable<int> c { 3, 4, 7 };
+                 *      VerifyTestResult (c.Select<String> ([] (int i) { return Characters::Format (L"%d", i); }).SequnceEquals (Iterable<String> { L"3", L"4", L"7" }));
+                 *      \endcode
+                 *
                  *      @todo provide overload that is more terse, where instead of specifing funciton, you specify ptr-to-member or some such?
                  */
                 template    <typename   T1, typename RESULT = T1>


resolved some problems with warnings (comparison between signed and unsigned ints)

git-svn-id: a7f2a8f7432d210e972fb03898013d213e2b549b@1086 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/projects/library/seqan/align/align_myers.h
+++ seqan/projects/library/seqan/align/align_myers.h
@@ -442,8 +442,7 @@
 	arrayFill(reverseBitMask, reverseBitMask + alphabetSize * blockCount, 0);

 	// encoding the letters as bit-vectors
-    for (unsigned int j = 0; j < len_y; j++)
-	{
+    for (unsigned int j = 0; j < len_y; j++){
 SEQAN_CHECKPOINT
 		forwardBitMask[blockCount * static_cast<unsigned int>(getValue(y,j)) + j/BLOCK_SIZE] = forwardBitMask[blockCount * static_cast<unsigned int>(getValue(y,j)) + j/BLOCK_SIZE] | 1 << (j%BLOCK_SIZE);
 		reverseBitMask[blockCount * static_cast<unsigned int>(getValue(y,len_y - j - 1)) + j/BLOCK_SIZE] = reverseBitMask[blockCount * static_cast<unsigned int>(getValue(y,len_y - j - 1)) + j/BLOCK_SIZE] | 1 << (j%BLOCK_SIZE);
@@ -465,7 +464,7 @@
 		arrayCopy(forwardBitMask, forwardBitMask + alphabetSize * blockCount, fCopyMask);
 		arrayCopy(reverseBitMask, reverseBitMask + alphabetSize * blockCount, rCopyMask);

-		int i,j,m;
+		unsigned int i,j,m;
 		for(i=0;i < alphabetSize;++i)
 		{
 			// iterate over the whole alphabet
@@ -477,7 +476,7 @@
 					unsigned int char_ind_i = blockCount*static_cast<unsigned int>(static_cast<TAlphabet>(i));
 					unsigned int char_ind_j = blockCount*static_cast<unsigned int>(static_cast<TAlphabet>(j));

-					for(int m = 0;m < blockCount;++m)
+					for(m = 0;m < blockCount;++m)
 					{
 						forwardBitMask[char_ind_i] |= fCopyMask[char_ind_j];
 						reverseBitMask[char_ind_i] |= rCopyMask[char_ind_j];


samples: usb: cdc_acm: Update CDC ACM echo sample

Update CDC ACM sample using ring buffer and fifo_fill / fifo_read
functions.

Signed-off-by: Andrei Emeltchenko <a6565233ddc88e4fb9c66c1d70743223493f2ed4@intel.com>

--- samples/subsys/usb/cdc_acm/src/main.c
+++ samples/subsys/usb/cdc_acm/src/main.c
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2016 Intel Corporation
+ * Copyright (c) 2019 Intel Corporation
  *
  * SPDX-License-Identifier: Apache-2.0
  */

 /**
  * @file
- * @brief Sample app for CDC ACM class driver
+ * @brief Sample echo app for CDC ACM class
  *
  * Sample app for USB CDC ACM class driver. The received data is echoed back
  * to the serial port.
@@ -17,108 +17,106 @@
 #include <device.h>
 #include <uart.h>
 #include <zephyr.h>
+#include <ring_buffer.h>

-static const char *banner1 = "Send characters to the UART device\r\n";
-static const char *banner2 = "Characters read:\r\n";
+#include <logging/log.h>
+LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_DBG);

-static volatile bool data_transmitted;
-static volatile bool data_arrived;
-static	char data_buf[64];
+#define RING_BUF_SIZE 1024
+u8_t ring_buffer[RING_BUF_SIZE];
+
+struct ring_buf ringbuf;

 static void interrupt_handler(struct device *dev)
 {
-	uart_irq_update(dev);
+	while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
+		if (uart_irq_rx_ready(dev)) {
+			int recv_len, rb_len;
+			u8_t buffer[64];
+			size_t len = MIN(ring_buf_space_get(&ringbuf),
+					 sizeof(buffer));

-	if (uart_irq_tx_ready(dev)) {
-		data_transmitted = true;
-	}
+			recv_len = uart_fifo_read(dev, buffer, len);

-	if (uart_irq_rx_ready(dev)) {
-		data_arrived = true;
-	}
-}
+			rb_len = ring_buf_put(&ringbuf, buffer, recv_len);
+			if (rb_len < recv_len) {
+				LOG_ERR("Drop %u bytes", recv_len - rb_len);
+			}

-static void write_data(struct device *dev, const char *buf, int len)
-{
-	uart_irq_tx_enable(dev);
+			LOG_DBG("tty fifo -> ringbuf %d bytes", rb_len);

-	while (len) {
-		int written;
-
-		data_transmitted = false;
-		written = uart_fifo_fill(dev, (const u8_t *)buf, len);
-		while (data_transmitted == false) {
-			k_yield();
+			uart_irq_tx_enable(dev);
 		}

-		len -= written;
-		buf += written;
-	}
+		if (uart_irq_tx_ready(dev)) {
+			u8_t buffer[64];
+			int rb_len, send_len;

-	uart_irq_tx_disable(dev);
-}
+			rb_len = ring_buf_get(&ringbuf, buffer, sizeof(buffer));
+			if (!rb_len) {
+				LOG_DBG("Ring buffer empty, disable TX IRQ");
+				uart_irq_tx_disable(dev);
+				continue;
+			}

-static void read_and_echo_data(struct device *dev, int *bytes_read)
-{
-	while (data_arrived == false)
-		;
+			send_len = uart_fifo_fill(dev, buffer, rb_len);
+			if (send_len < rb_len) {
+				LOG_ERR("Drop %d bytes", rb_len - send_len);
+			}

-	data_arrived = false;
-
-	/* Read all data and echo it back */
-	while ((*bytes_read = uart_fifo_read(dev,
-	    (u8_t *)data_buf, sizeof(data_buf)))) {
-		write_data(dev, data_buf, *bytes_read);
+			LOG_DBG("ringbuf -> tty fifo %d bytes", send_len);
+		}
 	}
 }

 void main(void)
 {
 	struct device *dev;
-	u32_t baudrate, bytes_read, dtr = 0U;
+	u32_t baudrate, dtr = 0U;
 	int ret;

 	dev = device_get_binding("CDC_ACM_0");
 	if (!dev) {
-		printf("CDC ACM device not found\n");
+		LOG_ERR("CDC ACM device not found");
 		return;
 	}

-	printf("Wait for DTR\n");
-	while (1) {
+	ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer);
+
+	LOG_DBG("Wait for DTR");
+
+	while (true) {
 		uart_line_ctrl_get(dev, LINE_CTRL_DTR, &dtr);
-		if (dtr)
+		if (dtr) {
 			break;
+		}
 	}
-	printf("DTR set, start test\n");
+
+	LOG_DBG("DTR set");

 	/* They are optional, we use them to test the interrupt endpoint */
 	ret = uart_line_ctrl_set(dev, LINE_CTRL_DCD, 1);
-	if (ret)
-		printf("Failed to set DCD, ret code %d\n", ret);
+	if (ret) {
+		LOG_WRN("Failed to set DCD, ret code %d", ret);
+	}

 	ret = uart_line_ctrl_set(dev, LINE_CTRL_DSR, 1);
-	if (ret)
-		printf("Failed to set DSR, ret code %d\n", ret);
+	if (ret) {
+		LOG_WRN("Failed to set DSR, ret code %d", ret);
+	}

 	/* Wait 1 sec for the host to do all settings */
 	k_busy_wait(1000000);

 	ret = uart_line_ctrl_get(dev, LINE_CTRL_BAUD_RATE, &baudrate);
-	if (ret)
-		printf("Failed to get baudrate, ret code %d\n", ret);
-	else
-		printf("Baudrate detected: %d\n", baudrate);
+	if (ret) {
+		LOG_WRN("Failed to get baudrate, ret code %d", ret);
+	} else {
+		LOG_INF("Baudrate detected: %d", baudrate);
+	}

 	uart_irq_callback_set(dev, interrupt_handler);
-	write_data(dev, banner1, strlen(banner1));
-	write_data(dev, banner2, strlen(banner2));

 	/* Enable rx interrupts */
 	uart_irq_rx_enable(dev);
-
-	/* Echo the received data */
-	while (1) {
-		read_and_echo_data(dev, (int *) &bytes_read);
-	}
 }


Update MOE_Msg.h

Update MOE_Msg.h

--- Core/MOE_Msg.h
+++ Core/MOE_Msg.h
@@ -1,7 +1,7 @@
 /******************************************************************************
 * File       : MOE_Msg.h
 * Function   : Provide message services.
-* description: To be done.
+* Description: To be done.
 * Version    : V1.00
 * Author     : Ian
 * Date       : 26th May 2016
@@ -89,7 +89,7 @@
 * Input      : None
 * Output:    : None
 * Return     : None
-* description: None
+* Description: None
 * Version    : V1.00
 * Author     : Ian
 * Date       : 27 Jun 2016
@@ -107,7 +107,7 @@
 * Output:    : None
 * Return     : SW_OK   Successful.
 *              SW_ERR  Failed.
-* description: To be done.
+* Description: To be done.
 * Version    : V1.00
 * Author     : Ian
 * Date       : 28th May 2016
@@ -124,7 +124,7 @@
 * Output:    : None
 * Return     : SW_OK   Successful.
 *              SW_ERR  Failed.
-* description: Note: If the u8NextTask is the same with u8DestTask, the next task
+* Description: Note: If the u8NextTask is the same with u8DestTask, the next task
 *                    will be set as TASK_NO_TASK, forward the same message to
 *                    itself is meaningless.
 * Version    : V1.00
@@ -142,7 +142,7 @@
 * Output:    : None
 * Return     : SW_OK   Successful.
 *              SW_ERR  Failed.
-* description: To be done.
+* Description: To be done.
 * Version    : V1.00
 * Author     : Ian
 * Date       : 31st May 2016


Improved the absolute value function and tweaked the bitmask generation function

--- Core/globals.h
+++ Core/globals.h
@@ -70,8 +70,11 @@

 // Here are some useful functions

-/** Absolute value function.  Use as an alternate to qAbs(). */
-template <class T> inline T gAbs(const T &v){ return v < 0 ? -v : v; }
+/** Absolute value function which doesn't use branching.  Use as an alternate to qAbs(). */
+template <class T> inline T gAbs(const T &v){
+    const int mask( v >> (sizeof(int) * 8 - 1) );
+    return (v + mask) ^ mask;
+}

 /** Minimum value function.  Use as an alternate to qMin. */
 template <class T> inline T gMin(const T &one, const T &two){
@@ -99,14 +102,12 @@
 extern const char MSB_LOOKUP_TABLE[256];

-/** Generates a 32-bit bitmask where the first n bits are set to 1.
-    \note O(1), takes 4 instructions to generate.
+/** Generates a 32-bit bitmask where all the bits up to index i are set to 1, starting from the least significant bit.
+    \note O(1), takes 3 instructions to generate.
 */
 inline static GUINT32 GEN_BITMASK_32(int n)
 {
-    if(--n < 0) return 0;
-    GINT32 ret(0x80000000);
-    return static_cast<GUINT32>(ret >> n);
+    return ~(GINT32(0x80000000) >> (30 - n));
 }


- use closeonexec flag instead of manually closing fps

--- examples/solv.c
+++ examples/solv.c
@@ -5,6 +5,7 @@
 #include <dirent.h>
 #include <unistd.h>
 #include <zlib.h>
+#include <fcntl.h>
 #include <sys/utsname.h>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -239,6 +240,7 @@
       cio.close = cookie_gzclose;
       return fopencookie(gzf, "r", cio);
     }
+  fcntl(fd, F_SETFD, FD_CLOEXEC);
   return fdopen(fd, "r");
 }

@@ -441,7 +443,7 @@
 }

 void
-runrpm(const char *arg, const char *name, int dupfd3, FILE **newpkgsfps, int newpkgs)
+runrpm(const char *arg, const char *name, int dupfd3)
 {
   pid_t pid;
   int status;
@@ -453,20 +455,13 @@
     }
   if (pid == 0)
     {
-      int i;
-      for (i = 0; i < newpkgs; i++)
-	{
-	  if (!newpkgsfps[i])
-	    continue;
-	  if (dupfd3 != -1 && fileno(newpkgsfps[i]) == dupfd3)
-	    continue;
-	  close(fileno(newpkgsfps[i]));
-	}
       if (dupfd3 != -1 && dupfd3 != 3)
 	{
 	  dup2(dupfd3, 3);
 	  close(dupfd3);
 	}
+      if (dupfd3 != -1)
+	fcntl(3, F_SETFD, 0);	/* clear CLOEXEC */
       if (strcmp(arg, "-e") == 0)
         execlp("rpm", "rpm", arg, "--nodeps", "--nodigest", "--nosignature", name, (char *)0);
       else
@@ -675,6 +670,7 @@
 	  sat_free(newpkgsfps);
 	  sat_free(newpkgsps);
 	  solver_free(solv);
+
 	  printf("\n");
 	  for (i = 0; i < conflicts.count; i += 5)
 	    printf("file %s of package %s conflicts with package %s\n", id2str(pool, conflicts.elements[i]), solvid2str(pool, conflicts.elements[i + 1]), solvid2str(pool, conflicts.elements[i + 3]));
@@ -716,7 +712,7 @@
 	  if (evrp > evr && evrp[0] == ':' && evrp[1])
 	    evr = evrp + 1;
 	  sprintf(rpmname, "%s-%s.%s", id2str(pool, s->name), evr, id2str(pool, s->arch));
-	  runrpm("-e", rpmname, -1, newpkgsfps, newpkgs);
+	  runrpm("-e", rpmname, -1);
 	  break;
 	case SOLVER_TRANSACTION_INSTALL:
 	case SOLVER_TRANSACTION_MULTIINSTALL:
@@ -727,7 +723,7 @@
 	  fp = j < newpkgs ? newpkgsfps[j] : 0;
 	  rewind(fp);
 	  lseek(fileno(fp), 0, SEEK_SET);
-	  runrpm(type == SOLVER_TRANSACTION_MULTIINSTALL ? "-i" : "-U", "/dev/fd/3", fileno(fp), newpkgsfps, newpkgs);
+	  runrpm(type == SOLVER_TRANSACTION_MULTIINSTALL ? "-i" : "-U", "/dev/fd/3", fileno(fp));
 	  fclose(fp);
 	  newpkgsfps[j] = 0;
 	  break;


[xusb] fix Clang warning about unused variable

--- examples/xusb.c
+++ examples/xusb.c
@@ -440,7 +440,6 @@
 	char vid[9], pid[9], rev[5];
 	unsigned char *data;
 	FILE *fd;
-	size_t junk;

 	printf("Reading Max LUN:\n");
 	r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
@@ -516,7 +515,9 @@
 	} else {
 		display_buffer_hex(data, size);
 		if ((binary_dump) && ((fd = fopen(binary_name, "w")) != NULL)) {
-			junk = fwrite(data, 1, (size_t)size, fd);
+			if (fwrite(data, 1, (size_t)size, fd) != size) {
+				perr("   unable to write binary data\n");
+			}
 			fclose(fd);
 		}
 	}


ra_serf: Fix same bug as in r18999 but for dir props.

Passes diff test #24 (diff a prop change on a dir named explicitly).

* subversion/libsvn_ra_serf/commit.c
  (change_dir_prop): Don't ref a NULL value (duh).


fixing include order

fixing include order

--- Util/LuaUtil.h
+++ Util/LuaUtil.h
@@ -27,9 +27,10 @@
     #include <lualib.h>
 }

+#include <boost/filesystem/convenience.hpp>
+
 #include <iostream>
 #include <string>
-#include <boost/filesystem/convenience.hpp>

 template<typename T>
 void LUA_print(T number) {


R-value ref version of Min(), Max(), Clamp() added.

--- DK/DKInclude.h
+++ DK/DKInclude.h
@@ -169,6 +169,10 @@
 	template <typename T> using _UnCV = typename std::remove_cv<T>::type;
 	template <typename T> using _UnRefCV = _UnCV<_UnRef<T>>;

+	template <typename T> auto Max(T&& lhs, T&& rhs)->T&&
+	{
+		return std::forward<T>((lhs > rhs) ? lhs : rhs);
+	}
 	template <typename T, typename U> auto Max(T&& lhs, U&& rhs)->_UnRefCV<T>
 	{
 		return static_cast<_UnRef<T>>(((lhs > rhs) ? lhs : rhs));
@@ -177,6 +181,10 @@
 	{
 		return Max(std::forward<T>(v1), Max(std::forward<U>(v2), std::forward<V>(rest)...));
 	}
+	template <typename T> auto Min(T&& lhs, T&& rhs)->T&&
+	{
+		return std::forward<T>((lhs < rhs) ? lhs : rhs);
+	}
 	template <typename T, typename U> auto Min(T&& lhs, U&& rhs)->_UnRefCV<T>
 	{
 		return static_cast<_UnRef<T>>((lhs < rhs) ? lhs : rhs);
@@ -185,9 +193,9 @@
 	{
 		return Min<T>(std::forward<T>(v1), Min(std::forward<U>(v2), std::forward<V>(rest)...));
 	}
-	template <typename T, typename _MIN, typename _MAX> auto Clamp(T&& v, _MIN&& _min, _MAX&& _max)->_UnRefCV<T>
-	{
-		return Min(Max(std::forward<T>(v),std::forward<_MIN>(_min)), std::forward<_MAX>(_max));
+	template <typename T, typename MinT, typename MaxT> auto Clamp(T&& v, MinT&& _min, MaxT&& _max)->_UnRefCV<T>
+	{
+		return Min(Max(std::forward<T>(v), std::forward<MinT>(_min)), std::forward<MaxT>(_max));
 	}

 	DKLIB_API void DKErrorRaiseException(const char*, const char*, unsigned int, const char*);


set input pull

set input pull

set input pull

--- examples/imagec/gpio.c
+++ examples/imagec/gpio.c
@@ -151,6 +151,9 @@
 		if (pinDirection == kGPIO_DigitalInput)
     {
         base->PDDR &= ~(1U << pin);
+
+
+
     }
     else
     {
@@ -176,6 +179,23 @@
   {
     PORT_SetPinMux(idx2port[idx], idx2pin[idx], kPORT_MuxAsGpio); //<chk
     GPIO_PinInit2(idx2gpio[idx], idx2pin[idx],(gpio_pin_direction_t) pinDirection, 0);
+    if (pinDirection == kGPIO_DigitalInput)
+    {
+      /* Input pin PORT configuration */
+      port_pin_config_t config = {
+          kPORT_PullUp, //kPORT_PullDown
+          kPORT_FastSlewRate,
+          kPORT_PassiveFilterDisable,
+          kPORT_OpenDrainDisable,
+          kPORT_LowDriveStrength,
+          kPORT_MuxAsGpio,
+
+          0,//kPORT_UnLockRegister,
+
+      };
+      /*  Sets the configuration */
+      PORT_SetPinConfig(idx2port[idx]/*PORTC*/, idx2pin[idx]/*5*/, &config);
+    }
   }
   else if ((idx >= 0x10) && (idx < 0xa0))
   {


VoxelStorage added. (still buggy)

VoxelStorage added. (still buggy)

error: pathspec 'VoxelStorage.h' did not match any file(s) known to git

--- VoxelStorage.h
+++ VoxelStorage.h
@@ -0,0 +1,477 @@
+/*
+	This file is part of the Geometry library.
+	Copyright (C) 2014 Claudius Jähn <claudius@uni-paderborn.de>
+
+	This library is subject to the terms of the Mozilla Public License, v. 2.0.
+	You should have received a copy of the MPL along with this library; see the
+	file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+#ifndef VOXEL_STORAGE_H
+#define VOXEL_STORAGE_H
+
+#include "Box.h"
+#include "BoxIntersection.h"
+#include "Vec3.h"
+#include <array>
+#include <cassert>
+#include <iostream>
+#include <stack>
+#include <tuple>
+#include <vector>
+#include <memory>
+
+namespace Geometry {
+
+/*! The Voxelstorage is a spatial data structure for storing voxels(=arbitrary values) at integer positions.
+	Internally, a dynamic octree is used as storage:
+	 - the root node is adjusted automatically
+	 - empty inner nodes are skipped
+	 - subtrees having an uniform value are represented by single nodes
+
+	\todo levels should only be skipped if the value is nullVoxel. Serialization should be easier then.
+*/
+template<typename Voxel_t,unsigned int blockSizePow = 2, typename integer_t = int32_t, typename uinteger_t = uint32_t>
+class VoxelStorage{
+		const Voxel_t nullVoxel;
+
+	public:
+		static const uinteger_t blockSideLength = 1<<blockSizePow;	// e.g. 1<<2 = 4
+		static const uinteger_t blockMask = blockSideLength-1; 		// e.g. 0b00000011
+		static const uint32_t blockSize = blockSideLength*blockSideLength*blockSideLength;
+
+
+		typedef _Vec3<integer_t> Vec3_t;
+		typedef _Box<integer_t> Box_t;
+		typedef std::array<Voxel_t, blockSize> block_t;
+
+		typedef std::pair<
+					std::vector<std::tuple<Vec3_t,uinteger_t,Voxel_t>>,	// uniform areas
+					std::vector<std::tuple<Vec3_t,block_t>> >// blocks
+				serializationData_t;
+
+
+		// ------------
+	private:
+
+		struct Area{
+			const Vec3_t origin;
+			const uinteger_t sideLength;
+
+			union Data_t{
+				std::array<Area*,8> * children;
+				block_t* block;
+			}data;
+			enum class DataType : uint8_t{	CONTAINER,UNIFORM_AREA,BLOCK	}dataType;
+			bool markedForConsolidation;
+
+			Voxel_t uniformValue;
+
+			Area(const Vec3_t & _origin, uinteger_t _sideLength, const Voxel_t &_uniformValue) :
+					origin(_origin), sideLength(_sideLength), dataType(DataType::UNIFORM_AREA), uniformValue(_uniformValue){
+			}
+			~Area(){	clear();	}
+			void clear(){
+				if(isContainer()){
+					delete data.children;
+				}else if(isBlock()){
+					delete data.block;
+				}
+				dataType = DataType::UNIFORM_AREA;
+			}
+			bool contains(const Vec3_t & pos)const{
+				return	pos.x()>=origin.x() && pos.x()<origin.x()+static_cast<integer_t>(sideLength) &&
+						pos.y()>=origin.y() && pos.y()<origin.y()+static_cast<integer_t>(sideLength) &&
+						pos.z()>=origin.z() && pos.z()<origin.z()+static_cast<integer_t>(sideLength);
+			}
+			uint8_t getChildIndex(const Vec3_t & pos)const{
+				const auto hSideLength = static_cast<integer_t>(sideLength) / 2;
+				return	(pos.x()>=origin.x()+hSideLength ? 1 : 0) +
+						(pos.y()>=origin.y()+hSideLength ? 2 : 0) +
+						(pos.z()>=origin.z()+hSideLength ? 4 : 0);
+			}
+			Box_t getOctant(uint8_t i)const{
+				const auto hSideLength = static_cast<integer_t>(sideLength) / 2;
+				const Vec3_t minPos(	origin.x()+((i&1)>0 ? hSideLength : 0),
+										origin.y()+((i&2)>0 ? hSideLength : 0),
+										origin.z()+((i&4)>0 ? hSideLength : 0));
+				return Box_t(minPos,minPos+Vec3_t(hSideLength-1,hSideLength-1,hSideLength-1));
+			}
+			Vec3_t getOctantOrigin(uint8_t i)const{
+				const auto hSideLength = static_cast<integer_t>(sideLength) / 2;
+				return Vec3_t(	origin.x()+((i&1)>0 ? hSideLength : 0),
+								origin.y()+((i&2)>0 ? hSideLength : 0),
+								origin.z()+((i&4)>0 ? hSideLength : 0));
+			}
+			bool isContainer()const			{	return dataType == DataType::CONTAINER;	}
+			bool isBlock()const				{	return dataType == DataType::BLOCK;	}
+			bool isUniform()const			{	return dataType == DataType::UNIFORM_AREA;	}
+
+			const Vec3_t& getOrigin()const	{	return origin;	}
+			Vec3_t getMaxPosition()const	{	return Vec3_t(origin.x()+sideLength-1,origin.y()+sideLength-1,origin.z()+sideLength-1);	}
+			block_t* getBlock()const		{	return isBlock() ? data.block : nullptr;	}
+			Area* getChild(uint8_t i)const	{	return isContainer() ? data.children->at(i) : nullptr;	}
+
+			Box_t getBox()const				{	return Box_t(origin, origin+Vec3_t(sideLength-1,sideLength-1,sideLength-1)); }
+
+			std::array<Area*,8>& assureContainer(){
+				if(!isContainer()){
+					assert(sideLength>blockSideLength);
+					clear();
+					data.children = new std::array<Area*,8>;
+					for(auto& c:*data.children)
+						c = nullptr;
+					dataType = DataType::CONTAINER;
+				}
+				return *data.children;
+			}
+			block_t& assureBlock(){
+				if(!isBlock()){
+					assert(sideLength==blockSideLength);
+					clear();
+					data.block = new block_t;
+					for(auto& v:*data.block)
+						v = uniformValue;
+					dataType = DataType::BLOCK;
+				}
+				return *data.block;
+			}
+			void convertToUniformArea(const Voxel_t &_uniformValue){
+				clear();
+				uniformValue = _uniformValue;
+				markedForConsolidation = false;
+			}
+			Area * insertIntermediateChild(const Vec3_t _origin,uinteger_t _sideLength){
+				assert(_sideLength<sideLength);
+				assert(contains(_origin));
+				auto& children = assureContainer();
+				const uint8_t childIndex = getChildIndex(_origin);
+				Area* newChild = new Area(_origin,_sideLength,uniformValue);
+				Area* oldChild = children[childIndex];
+				children[childIndex] = newChild;
+				if(oldChild){
+					assert(oldChild->sideLength<_sideLength);
+					auto& children2 = newChild->assureContainer();
+					children2[ newChild->getChildIndex(oldChild->origin) ] = oldChild;
+				}
+				return newChild;
+			}
+			void setChild(uint8_t i,Area * child){
+				assureContainer();
+				assert(data.children->at(i)==nullptr);
+				data.children->at(i) = child;
+			}
+		};
+		uint32_t posToBlockIdx(const Vec3_t& pos)const{
+			return	(pos.x()&blockMask) +
+					(pos.y()&blockMask)*blockSideLength +
+					(pos.z()&blockMask)*blockSideLength*blockSideLength;
+		}
+		Vec3_t calcOrigin(const Vec3_t& pos,integer_t sideLength)const{
+			const uint32_t areaMask = ~(sideLength-1);
+			return Vec3_t( pos.x()&areaMask, pos.y()&areaMask, pos.z()&areaMask );
+		}
+
+		std::unique_ptr<Area> root;
+
+		std::pair<Vec3_t,integer_t> getEnclosingAreaBox(const Area& area,const Vec3_t& pos)const{
+			Vec3_t newOrigin = area.getOrigin();
+			uinteger_t newSideLength = area.sideLength;
+//			std::cout << "b: "<<newOrigin<<" : "<<newSideLength<<std::endl;
+			while( !Box_t(newOrigin, newOrigin+Vec3_t(newSideLength-1,newSideLength-1,newSideLength-1)).contains(pos) ){
+				newSideLength*=2;
+				newOrigin = calcOrigin(area.getOrigin(),newSideLength);
+//				std::cout << "b: "<<newOrigin<<" : "<<newSideLength<<std::endl;
+			}
+			return std::make_pair(newOrigin,newSideLength);
+		}
+
+		std::pair<Vec3_t,integer_t> getEnclosingAreaBox(const Box_t& box)const{
+			uinteger_t sideLength = blockSideLength;
+			Vec3_t origin = calcOrigin(box.getMin(),sideLength);
+
+			while( !Box_t(origin, origin+Vec3_t(sideLength-1,sideLength-1,sideLength-1)).contains(box) ){
+				sideLength*=2;
+				origin = calcOrigin(origin,sideLength);
+			}
+			return std::make_pair(origin,sideLength);
+		}
+
+		block_t& findOrCreateBlock(const Vec3_t& pos){
+//			std::cout << "findOrCreateBlock("<<pos<<")"<<std::endl;
+			if(!root){
+				root.reset(new Area(calcOrigin(pos,blockSideLength), blockSideLength, nullVoxel));
+//				std::cout << "creating root: "<<root->origin<<std::endl;
+			}
+
+			if(!root->contains(pos)){
+				const auto commonBox = getEnclosingAreaBox( *root.get(),pos );
+//				std::cout << "resetting root: "<<commonBox.first<<" : "<<commonBox.second<<std::endl;
+				Area * newRoot = new Area(commonBox.first,commonBox.second,nullVoxel);
+				Area * oldRoot = root.release();
+				newRoot->setChild( newRoot->getChildIndex(oldRoot->getOrigin()), oldRoot );
+				root.reset(newRoot);
+			}
+
+			Area * currentArea = root.get();
+
+			while(true){
+//				std::cout << " >("<<currentArea->origin<<" : "<<currentArea->sideLength<< ")"<<std::endl;
+				currentArea->markedForConsolidation = true;
+				if(currentArea->isBlock()){
+					return currentArea->assureBlock();
+				}else if(currentArea->isContainer()){
+					Area * child = currentArea->getChild(currentArea->getChildIndex(pos));
+					if(!child){
+						currentArea = currentArea->insertIntermediateChild(calcOrigin(pos,blockSideLength),blockSideLength);
+					}else if(child->contains(pos)){
+						currentArea = child;
+					}else{ // insert intermediate area
+
+//						std::cout << "B) pos: "<<pos<< " box:"<< currentArea->origin<<":"<<currentArea->sideLength <<" ";
+
+						const auto commonBox =  getEnclosingAreaBox( *child,pos );
+//						std::cout << "child:"<< child->origin<<":"<<child->sideLength <<" ";
+//						std::cout << "commonBox:"<< commonBox.first<<":"<<commonBox.second <<" "<<std::endl;
+
+
+						currentArea = currentArea->insertIntermediateChild(commonBox.first,commonBox.second);
+					}
+				}else {// if(currentArea->isUniform()){
+					if(currentArea->sideLength==blockSideLength){
+						return currentArea->assureBlock();
+					}else{
+						currentArea = currentArea->insertIntermediateChild(calcOrigin(pos,blockSideLength),blockSideLength);
+					}
+				}
+			}
+		}
+		void consolidate(Area* area){
+			if(area && area->markedForConsolidation){
+				area->markedForConsolidation = false;
+
+				if(area->isBlock()){
+					const auto& block = area->assureBlock();
+					Voxel_t value = block[0];
+					for(uint32_t j=1; j<blockSize; ++j){
+						if(block[j]!=value)
+							return;// simplification not possible
+					}
+					area->convertToUniformArea(value);
+				}else if(area->isContainer()){
+					Voxel_t value = area->uniformValue;
+					bool childrenAreUniform = true;
+
+					for(uint8_t i=0; i<8; ++i){
+						Area* child = area->getChild(i);
+						if(child&&child->markedForConsolidation)
+							consolidate(child);
+						if(i==0){ // first child
+							if(child){
+								if(child->isUniform()){
+									value = child->uniformValue;
+								}else{
+									childrenAreUniform = false;
+								}
+							} // else keep area's uniform value
+						}else if(child){
+							if(childrenAreUniform && (!child->isUniform()||child->uniformValue!=value))
+								childrenAreUniform = false;
+						}else{ // else !child
+							if(childrenAreUniform && area->uniformValue != value)
+								childrenAreUniform = false;
+						}
+					}
+					if(childrenAreUniform){
+						area->convertToUniformArea(value);
+//						std::cout << "Consolidated area: "<<area->getBox()<<"\n";
+					}
+				}//else area->isUniform()
+			}
+		}
+	public:
+		VoxelStorage( const Voxel_t& _nullVoxel) : nullVoxel(_nullVoxel){}
+
+		//! Set the value @p voxel at the given @p position without consolidating (combining uniform subtrees)
+		void _set(const Vec3_t& pos, const Voxel_t& voxel){
+			findOrCreateBlock(pos)[ posToBlockIdx(pos) ] = voxel;
+		}
+
+		//! Set the value @p voxel at the given @p position.
+		void set(const Vec3_t& pos, const Voxel_t& voxel){
+			auto & block = findOrCreateBlock(pos);
+			block[ posToBlockIdx(pos) ] = voxel;
+
+			for(uint32_t i=0;i<blockSize;++i){ // check if block became uniform
+				if( block[ i ]!=voxel)
+					return;
+			}
+			consolidate(root.get());
+		}
+		//! Return the value at the given @p position. If the value has not been set, nullVoxel is returned.
+		const Voxel_t& get(const Vec3_t& pos)const{
+			if(!root || !root->contains(pos))
+				return nullVoxel;
+
+			const Area* currentArea = root.get();
+			while(true){
+				const block_t* block = currentArea->getBlock();
+				if(block)
+					return (*block)[ posToBlockIdx(pos) ];
+				const Area* child = currentArea->getChild(currentArea->getChildIndex(pos));
+				if(!child || !child->contains(pos))
+					return currentArea->uniformValue;
+				currentArea = child;
+			}
+		}
+		//! Fill the given @p area with the given value @p voxel.
+		void fill(const Box_t& fillArea,const Voxel_t& voxel){
+//			std::cout << "fill:"<<fillArea<<" "<<std::endl;
+
+			// assure properly sized root node.
+			if(!root || !root->getBox().contains(fillArea)){
+				findOrCreateBlock(fillArea.getMin());
+				findOrCreateBlock(fillArea.getMax());
+			}
+
+//			std::cout << "start filling "<<std::endl;
+
+			std::stack<Area*> todo;
+			todo.push(root.get());
+			while(!todo.empty()){
+				Area* currentArea = todo.top();
+				todo.pop();
+//				std::cout << " > "<<currentArea->getBox()<<std::endl;
+
+
+				const Box_t areaBox(currentArea->getBox());
+				if(fillArea.contains(areaBox)){
+					currentArea->convertToUniformArea(voxel);
+//					std::cout << " >F "<< currentArea->origin<<" : "<<currentArea->sideLength <<std::endl;
+//					std::cout << " >F "<< currentArea->sideLength;
+				}else if(Intersection::isBoxIntersectingBox(areaBox,fillArea) ){
+					currentArea->markedForConsolidation = true;
+					if(currentArea->isBlock()||currentArea->sideLength==blockSideLength){
+						const Box_t intersection = Intersection::getBoxBoxIntersection(areaBox,fillArea);
+						block_t& block = currentArea->assureBlock();
+						for(integer_t x=intersection.getMinX(); x<=intersection.getMaxX(); ++x){
+							for(integer_t y=intersection.getMinY(); y<=intersection.getMaxY(); ++y){
+								for(integer_t z=intersection.getMinZ(); z<=intersection.getMaxZ(); ++z){
+									block[posToBlockIdx(Vec3_t(x,y,z))] = voxel;
+								}
+							}
+						}
+//						std::cout << " >B "<< currentArea->origin<<" : "<<currentArea->sideLength <<std::endl;
+					}else{ // uniform value or container
+						currentArea->assureContainer();
+						for(uint8_t i=0;i<8;++i){
+							const Box_t octantIntersection = Intersection::getBoxBoxIntersection(currentArea->getOctant(i),fillArea);
+							if(octantIntersection.isInvalid()) // no intersection?
+								continue;
+							Area* child = currentArea->getChild(i);
+							if(child&&child->getBox().contains(octantIntersection)){ // fill inside existing child...
+								todo.push( child );
+							}else if(!child){ // create new child covering the filling
+								const auto enclosingBox = getEnclosingAreaBox(octantIntersection);
+//								std::cout << " >>a:              \t"<< currentArea->getOrigin() <<std::endl;
+//								std::cout << " >>octant:"<<static_cast<int>(i)<<"         \t"<< currentArea->getOctant(i) <<std::endl;
+//								std::cout << " >>octantIntersection:\t"<< octantIntersection <<std::endl;
+//								std::cout << " >>enclosingBox:\t"<< enclosingBox.first<<" : "<<enclosingBox.second <<std::endl;
+								todo.push( currentArea->insertIntermediateChild(enclosingBox.first,enclosingBox.second) );
+							}else{ // create an intermediate child covering the filled area and the old child
+//								std::cout << " B ";
+//								std::cout << "\n >> octantIntersection:\t"<<octantIntersection;
+								Box_t b = octantIntersection;
+								b.include(child->getBox());
+//								std::cout << "\n >> childBox:\t"<<child->getBox();
+								const auto enclosingBox = getEnclosingAreaBox(b);
+//								std::cout << "\n >> combined:\t"<<b;
+//								std::cout << "\n >> area:\t"<<enclosingBox.first<<" : "<<enclosingBox.second<<"\n";
+								todo.push( currentArea->insertIntermediateChild(enclosingBox.first,enclosingBox.second) );
+							}
+						}
+					}
+					continue;
+				} // else not intersecting -> skip
+			}
+			consolidate(root.get());
+		}
+//		std::pair<bool,Voxel_t> isUniform(const Box_t& area)bool;
+//		bool isUniform(const Box_t& area,const Voxel_t& voxel)bool;
+		//! Remove all values.
+		void clear(){
+			root.reset();
+		}
+		/*! experimental!
+			\note queryBox must be block-aligned
+			\todo Problem? ContainerArea( default=5, children= NULL,NULL,..., Uniform10) !?!?
+		*/
+		serializationData_t serialize(const Box_t& queryBox)const{
+			return const_cast<VoxelStorage*>(this)->serialize(queryBox); // serialize should be const without this hack!
+		}
+		serializationData_t serialize(const Box_t& queryBox){
+			std::vector<std::tuple<Vec3_t,uinteger_t,Voxel_t>> uniformAreas;
+			std::vector<std::tuple<Vec3_t,block_t>> singleValues;
+
+			consolidate(root.get());
+			std::stack<Area*> todo;
+			if(root)
+				todo.push(root.get());
+			while(!todo.empty()){
+				Area * currentArea = todo.top();
+				todo.pop();
+
+				if(!Intersection::isBoxIntersectingBox(queryBox,currentArea->getBox()))
+					continue;
+				if(currentArea->isBlock()){
+					singleValues.emplace_back( currentArea->getOrigin(), currentArea->assureBlock() );
+				}else if( currentArea->isContainer() ){
+					for(uint8_t i=0; i<8; ++i){
+						Area* child = currentArea->getChild(i);
+						if(child)
+							todo.push(child);
+					}
+				}else{ // currentArea->isUniform
+					if(currentArea->uniformValue!=nullVoxel ) // skip null
+						uniformAreas.emplace_back( currentArea->getOrigin(), currentArea->sideLength, currentArea->uniformValue );
+				}
+			}
+			return std::make_pair(uniformAreas,singleValues);
+		}
+
+		void deserialize(const serializationData_t & data){
+			for(const auto& uniformArea: data.first){
+				const Box_t b( std::get<0>(uniformArea),
+								std::get<0>(uniformArea)+Vec3_t(std::get<1>(uniformArea),std::get<1>(uniformArea),std::get<1>(uniformArea)));
+				fill(b,std::get<2>(uniformArea));
+			}
+			for(const auto& blockData: data.second)
+				findOrCreateBlock(std::get<0>(blockData)) = std::get<1>(blockData);
+			consolidate(root.get());
+		}
+		//! Get the (block aligned) bounding box around the set voxels.
+		Box_t getBlockBounds()const{
+			Box_t b;
+			b.invalidate();
+			std::stack<const Area*> todo;
+			if(root)
+				todo.push(root.get());
+			while(!todo.empty()){
+				const Area * currentArea = todo.top();
+				todo.pop();
+				if( currentArea->isContainer() ){
+					for(uint8_t i=0; i<8; ++i){
+						Area* child = currentArea->getChild(i);
+						if(child && !b.contains(child->getBox()))
+							todo.push(child);
+					}
+				}else if( currentArea->isBlock() || currentArea->uniformValue!=nullVoxel ){
+					b.include(currentArea->getBox());
+				}
+			}
+			return b;
+		}
+};
+
+}
+
+#endif /* VOXEL_STORAGE_H */