back up work

back up work

--- dlm-kernel/src2/lock.c
+++ dlm-kernel/src2/lock.c
@@ -10,9 +10,15 @@
 *******************************************************************************
 ******************************************************************************/

-/* DLM locking routines to replace locking.c/lockqueue.c
-   This file should be split up. */
-
+#include "dlm_internal.h"
+#include "memory.h"
+#include "lowcomms.h"
+#include "requestqueue.h"
+#include "util.h"
+#include "dir.h"
+#include "member.h"
+#include "lockspace.h"
+#include "astd.h"

 /* Central locking logic has four stages:

@@ -62,6 +68,10 @@
    L: receive_xxxx_reply()     <-  R: send_xxxx_reply()
 */

+struct list_head dlm_waiters;
+struct semaphore dlm_waiters_sem;
+struct list_head ast_queue;
+struct semaphore ast_queue_lock;

 /*
  * Threads cannot use the lockspace while it's being recovered
@@ -82,6 +92,16 @@
 	return down_read_trylock(&ls->ls_in_recovery);
 }

+int dlm_dir_remove(struct dlm_rsb *r)
+{
+	int to_nodeid = dlm_dir_nodeid(r);
+
+	if (to_nodeid != dlm_our_nodeid())
+		send_remove(r);
+	else
+		dlm_dir_remove_entry(r->res_ls, 0, r->res_name, r->res_length);
+	return 0;
+}

 /*
  * Basic operations on rsb's and lkb's
@@ -104,13 +124,13 @@
 	INIT_LIST_HEAD(&r->res_grantqueue);
 	INIT_LIST_HEAD(&r->res_convertqueue);
 	INIT_LIST_HEAD(&r->res_waitqueue);
-	INIT_LIST_HEAD(&r->res_rootres);
+	INIT_LIST_HEAD(&r->res_rootlist);

 	return r;
 }

 int search_rsb_list(struct list_head *head, char *name, int len,
-		    unsigned int flags struct dlm_rsb **r_ret)
+		    unsigned int flags, struct dlm_rsb **r_ret)
 {
 	struct dlm_rsb *r;
 	int error = 0;
@@ -170,11 +190,13 @@
  * excessive master lookups and removals if we don't delay the release.
  */

+#if 0
 #define R_MASTER		(1)	/* create/add rsb if not found */
 #define R_CREATE		(2)	/* only return rsb if it's a master */
+#endif

 int find_rsb(struct dlm_ls *ls, char *name, int namelen, unsigned int flags,
-	     struct dlm_rsb **r_ret);
+	     struct dlm_rsb **r_ret)
 {
 	struct dlm_rsb *r, *tmp;
 	uint32_t bucket;
@@ -205,7 +227,6 @@
 		goto out;

 	r->res_bucket = bucket;
-	r->res_root = r;
 	r->res_nodeid = -1;
 	kref_init(&r->res_ref);

@@ -236,11 +257,12 @@
 void toss_rsb(struct kref *kref)
 {
 	struct dlm_rsb *r = container_of(kref, struct dlm_rsb, res_ref);
+	struct dlm_ls *ls = r->res_ls;

 	DLM_ASSERT(list_empty(&r->res_rootlist),);
 	list_del(&r->res_hashchain);
 	kref_init(&r->res_ref);
-	list_add(&r->res_hashchain, &ls->ls_rsbtbl[bucket].toss);
+	list_add(&r->res_hashchain, &ls->ls_rsbtbl[r->res_bucket].toss);
 	r->res_toss_time = jiffies;
 }

@@ -249,7 +271,9 @@

 void put_rsb(struct dlm_rsb *r)
 {
+	struct dlm_ls *ls = r->res_ls;
 	uint32_t bucket = r->res_bucket;
+
 	write_lock(&ls->ls_rsbtbl[bucket].lock);
 	kref_put(&r->res_ref, toss_rsb);
 	write_unlock(&ls->ls_rsbtbl[bucket].lock);
@@ -259,7 +283,8 @@

 void unhold_rsb(struct dlm_rsb *r)
 {
-	DLM_ASSERT(!kref_put(&r->res_ref, toss_rsb),);
+	/* DLM_ASSERT(!kref_put(&r->res_ref, toss_rsb),); */
+	kref_put(&r->res_ref, toss_rsb);
 }

 void kill_rsb(struct kref *kref)
@@ -273,12 +298,14 @@

 void shrink_rsb_list(struct dlm_ls *ls, struct list_head *head)
 {
+#if 0
 	struct dlm_rsb *r, *safe;

 	list_for_each_entry_safe(r, safe, head, res_hashchain) {
 		if (toss_time_due(ls, r))
 			kref_put(&r->res_ref, kill_rsb);
 	}
+#endif
 }

 void shrink_tossed_rsbs(struct dlm_ls *ls)
@@ -339,12 +366,29 @@

 void lock_rsb(struct dlm_rsb *r)
 {
-	down(&r->res_sema);
+	down(&r->res_sem);
 }

 void unlock_rsb(struct dlm_rsb *r)
 {
-	up(&r->res_sema);
+	up(&r->res_sem);
+}
+
+/* Attaching/detaching lkb's from rsb's is for rsb reference counting.
+   The rsb must exist as long as any lkb's for it do. */
+
+void attach_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb)
+{
+	hold_rsb(r);
+	lkb->lkb_resource = r;
+}
+
+void detach_lkb(struct dlm_lkb *lkb)
+{
+	if (lkb->lkb_resource) {
+		put_rsb(lkb->lkb_resource);
+		lkb->lkb_resource = NULL;
+	}
 }

 void kill_lkb(struct kref *kref)
@@ -424,10 +468,13 @@

 int put_lkb(struct dlm_lkb *lkb)
 {
+	struct dlm_ls *ls = lkb->lkb_resource->res_ls;
 	uint16_t bucket = lkb->lkb_id & 0xFFFF;
-	int rv;
+	int rv = 0;
+
 	write_lock(&ls->ls_lkbtbl[bucket].lock);
-	rv = kref_put(&lkb->lkb_ref, kill_lkb);
+	/* rv = kref_put(&lkb->lkb_ref, kill_lkb); */
+	kref_put(&lkb->lkb_ref, kill_lkb);
 	write_unlock(&ls->ls_lkbtbl[bucket].lock);
 	return rv;
 }
@@ -439,7 +486,8 @@

 void unhold_lkb(struct dlm_lkb *lkb)
 {
-	DLM_ASSERT(!kref_put(&lkb->lkb_ref, kill_lkb),);
+	/* DLM_ASSERT(!kref_put(&lkb->lkb_ref, kill_lkb),); */
+	kref_put(&lkb->lkb_ref, kill_lkb);
 }

 /* add lkb to rsb's grant/convert/wait queue */
@@ -485,23 +533,6 @@
 	unhold_lkb(lkb);
 }

-/* Attaching/detaching lkb's from rsb's is for rsb reference counting.
-   The rsb must exist as long as any lkb's for it do. */
-
-void attach_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb)
-{
-	hold_rsb(r);
-	lkb->lkb_resource = r;
-}
-
-void detach_lkb(struct dlm_lkb *lkb)
-{
-	if (lkb->lkb_resource) {
-		put_rsb(lkb->lkb_resource);
-		lkb->lkb_resource = NULL;
-	}
-}
-
 void add_to_waiters(struct dlm_lkb *lkb, int mstype)
 {
 	down(&dlm_waiters_sem);
@@ -516,7 +547,7 @@
 	up(&dlm_waiters_sem);
 }

-int _remove_from_waiters(dlm_lkb *lkb)
+int _remove_from_waiters(struct dlm_lkb *lkb)
 {
 	int error = 0;

@@ -532,23 +563,13 @@
 	return error;
 }

-int remove_from_waiters(dlm_lkb *lkb)
+int remove_from_waiters(struct dlm_lkb *lkb)
 {
 	int error;
 	down(&dlm_waiters_sem);
 	error = _remove_from_waiters(lkb);
 	up(&dlm_waiters_sem);
 	return error;
-}
-
-int dlm_dir_remove(struct dlm_rsb *r)
-{
-	int to_nodeid = dlm_dir_nodeid(r);
-
-	if (to_nodeid != dlm_our_nodeid())
-		send_remove(r);
-	else
-		dlm_dir_remove_entry(0, r->res_name, r->res_namelen);
 }

@@ -666,7 +687,7 @@
 	return rv;
 }

-int set_unlock_args(struct dlm_ls *ls, struct dlm_lks *lkb, uint32_t flags,
+int set_unlock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, uint32_t flags,
 		    struct dlm_lksb *lksb, void *astarg)
 {
 	int rv = -EINVAL;
@@ -698,7 +719,7 @@
  * These are called on the node making the request.
  */

-int dlm_lock(void *lockspace,
+int dlm_lock(dlm_lockspace_t *lockspace,
 	     int mode,
 	     struct dlm_lksb *lksb,
 	     uint32_t flags,
@@ -721,7 +742,7 @@
 	lock_recovery(ls);

 	if (flags & DLM_LKF_CONVERT)
-		error = find_lkb(ls, lksb->sb_id, &lkb);
+		error = find_lkb(ls, lksb->sb_lkid, &lkb);
 	else
 		error = create_lkb(ls, &lkb);

@@ -750,7 +771,7 @@
 	return error;
 }

-int dlm_unlock(void *lockspace,
+int dlm_unlock(dlm_lockspace_t *lockspace,
 	       uint32_t lkid,
 	       uint32_t flags,
 	       struct dlm_lksb *lksb,
@@ -874,6 +895,8 @@

 int set_master(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
+	int error;
+
 	if (r->res_trial_lkb == lkb) {
 		r->res_nodeid = -1;
 		lkb->lkb_nodeid = -1;
@@ -943,7 +966,7 @@
 {
 	struct dlm_lkb *lkb, *safe;

-	if (!test_bit((RESFL_MASTER_UNCERTAIN, &r->res_flags)))
+	if (!test_bit(RESFL_MASTER_UNCERTAIN, &r->res_flags))
 		return;

 	if (rv == 0 || rv == -EBUSY) {
@@ -969,7 +992,8 @@
 		/* clearing MASTER_WAIT allows this lkb to become the
 		   trial lkb when _request_lock calls set_master */

-		lkb = list_entry(r->res_lookup.next);
+		lkb = list_entry(r->res_lookup.next, struct dlm_lkb,
+				 lkb_rsb_lookup);
 		list_del(&lkb->lkb_rsb_lookup);
 		clear_bit(RESFL_MASTER_WAIT, &r->res_flags);
 		_request_lock(r, lkb);
@@ -999,7 +1023,7 @@
 	unlock_rsb(r);
 	put_rsb(r);

-	lkb->lkb_lksb->sb_id = lkb->lkb_id;
+	lkb->lkb_lksb->sb_lkid = lkb->lkb_id;
 	return error;
 }

@@ -1137,13 +1161,24 @@
  * (Many routines from locking.c can be used here with minor change.)
  */

+void add_ast_list(struct dlm_lkb *lkb, int type)
+{
+	down(&ast_queue_lock);
+	if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) {
+		kref_get(&lkb->lkb_ref);
+		list_add_tail(&lkb->lkb_astqueue, &ast_queue);
+	}
+	lkb->lkb_ast_type |= type;
+	up(&ast_queue_lock);
+}
+
 void queue_cast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv)
 {
 	if (is_master_copy(lkb))
 		return;

-	lkb->lkb_lksb.sb_status = rv;
-	lkb->lkb_lksb.sb_flags = lkb->lkb_sbflags;
+	lkb->lkb_lksb->sb_status = rv;
+	lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags;

 	add_ast_list(lkb, AST_COMP);
 }
@@ -1158,25 +1193,14 @@
 	}
 }

-void add_ast_list(struct dlm_lkb *lkb, int type)
-{
-	down(&ast_queue_lock);
-	if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) {
-		kref_get(&lkb->lkb_ref);
-		list_add_tail(&lkb->lkb_astqueue, &ast_queue);
-	}
-	lkb->lkb_ast_type |= type;
-	up(&ast_queue_lock);
-}
-
-void process_asts(void)
+void dlm_process_asts(void)
 {
 	struct dlm_ls *ls = NULL;
 	struct dlm_rsb *r = NULL;
 	struct dlm_lkb *lkb;
 	void (*cast) (long param);
 	void (*bast) (long param, int mode);
-	int type, found;
+	int type, found, bmode;

 	for (;;) {
 		found = FALSE;
@@ -1305,7 +1329,7 @@
 	if (!(lkb->lkb_flags & DLM_IFL_RETURNLVB))
 		return;

-	memcpy(lkb->lkb_lvb, ms->m_lvb, DLM_LVB_SIZE);
+	memcpy(lkb->lkb_lvbptr, ms->m_lvb, DLM_LVB_LEN);
 	lkb->lkb_lvbseq = ms->m_lvbseq;
 }

@@ -1472,6 +1496,7 @@
 {
 	/* same as current, but DEMOTED set in lkb_sbflags and
 	   check DLM_LKF flags in lkb->lkb_exflags */
+	return 0;
 }

 int can_be_queued(struct dlm_lkb *lkb)
@@ -1492,24 +1517,23 @@
 int is_remote(struct dlm_rsb *r)
 {
 	DLM_ASSERT(r->res_nodeid >= 0, );
-	return (r->res_nodeid ? 1 : 0);
+	return r->res_nodeid;
 }

 int is_local_copy(struct dlm_lkb *lkb)
 {
-	return (!lkb->lkb_nodeid && !(lkb->lkb_flags & DLM_LKF_MSTCPY));
+	return (!lkb->lkb_nodeid && !(lkb->lkb_flags & DLM_IFL_MSTCPY));
 }

 int is_process_copy(struct dlm_lkb *lkb)
 {
-	return (lkb->lkb_nodeid && !(lkb->lkb_flags & DLM_LKF_MSTCPY));
+	return (lkb->lkb_nodeid && !(lkb->lkb_flags & DLM_IFL_MSTCPY));
 }

 int is_master_copy(struct dlm_lkb *lkb)
 {
-	return (lkb->lkb_nodeid && (lkb->lkb_flags & DLM_LKF_MSTCPY));
-}
-
+	return (lkb->lkb_nodeid && (lkb->lkb_flags & DLM_IFL_MSTCPY));
+}

 /*
  * Four stage 4 varieties:
@@ -1522,7 +1546,7 @@
 {
 	int error = 0;

-	if (can_be_granted(r, lkb, TRUE))
+	if (can_be_granted(r, lkb, TRUE)) {
 		grant_lock(r, lkb);
 		queue_cast(r, lkb, 0);
 		goto out;
@@ -1550,7 +1574,7 @@

 	/* changing an existing lock may allow others to be granted */

-	if (can_be_granted(r, lkb, TRUE))
+	if (can_be_granted(r, lkb, TRUE)) {
 		grant_lock(r, lkb);
 		queue_cast(r, lkb, 0);
 		grant_pending_locks(r);
@@ -1559,7 +1583,7 @@

 	if (can_be_queued(lkb)) {
 		if (is_demoted(lkb))
-			grant_pending_locks(r, lkb);
+			grant_pending_locks(r);
 		error = -EBUSY;
 		add_lkb(r, lkb, DLM_LKSTS_CONVERT);
 		send_blocking_asts(r, lkb);
@@ -1670,7 +1694,9 @@

 int send_message(struct dlm_mhandle *mh)
 {
+	/* FIXME: add byte order munging */
 	lowcomms_commit_buffer(mh);
+	return 0;
 }

 void send_args(struct dlm_rsb *r, struct dlm_lkb *lkb, struct dlm_message *ms)
@@ -1695,18 +1721,13 @@
 	if (lkb->lkb_astaddr)
 		ms->m_asts |= AST_COMP;

-	if (lkb->lkb_parent) {
-		ms->m_lkid_parent = lkb->lkb_parent->lkb_id;
-		ms->m_remlkid_parent = lkb->lkb_parent->lkb_remid;
-	}
-
 	if (lkb->lkb_range) {
 		ms->m_range[0] = lkb->lkb_range[RQ_RANGE_START];
 		ms->m_range[1] = lkb->lkb_range[RQ_RANGE_END];
 	}

 	if (lkb->lkb_lvbptr)
-		memcpy(ms->m_lvb, lkb->lkb_lvbptr, DLM_LVB_SIZE);
+		memcpy(ms->m_lvb, lkb->lkb_lvbptr, DLM_LVB_LEN);

 	if (ms->m_type == DLM_MSG_REQUEST || ms->m_type == DLM_MSG_LOOKUP)
 		memcpy(ms->m_name, r->res_name, r->res_length);
@@ -1951,8 +1972,7 @@
 	return (ms->m_header.h_length - sizeof(struct dlm_message));
 }

-int receive_range(struct dlm_ls *ls, struct dlm_lkb *lkb,
-		  struct dlm_message *ms)
+int receive_range(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_message *ms)
 {
 	if (lkb->lkb_flags & DLM_IFL_RANGE) {
 		lkb->lkb_range = allocate_range(ls);
@@ -1961,10 +1981,10 @@
 		lkb->lkb_range[RQ_RANGE_START] = ms->m_range[0];
 		lkb->lkb_range[RQ_RANGE_END] = ms->m_range[1];
 	}
-}
-
-int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb,
-		struct dlm_message *ms)
+	return 0;
+}
+
+int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_message *ms)
 {
 	if (lkb->lkb_exflags & DLM_LKF_VALBLK) {
 		if (!lkb->lkb_lvbptr) {
@@ -1974,10 +1994,10 @@
 		}
 		memcpy(lkb->lkb_lvbptr, ms->m_lvb, DLM_LVB_LEN);
 	}
-}
-
-int receive_request_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
-			 struct dlm_message *ms)
+	return 0;
+}
+
+int receive_request_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_message *ms)
 {
 	lkb->lkb_nodeid = ms->m_header.h_nodeid;
 	lkb->lkb_ownpid = ms->m_pid;
@@ -1986,7 +2006,6 @@
 	lkb->lkb_rqmode = ms->m_rqmode;
 	lkb->lkb_bastaddr = (void *) (long) (ms->m_asts & AST_BAST);
 	lkb->lkb_astaddr = (void *) (long) (ms->m_asts & AST_COMP);
-	lkb->lkb_parent = ms->m_remlkid_parent;

 	if (receive_range(ls, lkb, ms))
 		return -ENOMEM;
@@ -1997,8 +2016,7 @@
 	return 0;
 }

-int receive_convert_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
-			 struct dlm_message *ms)
+int receive_convert_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_message *ms)
 {
 	lkb->lkb_rqmode = ms->m_rqmode;
 	lkb->lkb_lvbseq = ms->m_lvbseq;
@@ -2015,8 +2033,7 @@
 	return 0;
 }

-int receive_unlock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
-			struct dlm_message *ms)
+int receive_unlock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_message *ms)
 {
 	if (receive_lvb(ls, lkb, ms))
 		return -ENOMEM;
@@ -2108,7 +2125,7 @@
 		goto fail;

 	receive_flags(lkb, ms);
-	error = receive_unlock_args(lkb, ms);
+	error = receive_unlock_args(ls, lkb, ms);
 	if (error) {
 		put_lkb(lkb);
 		goto fail;
@@ -2142,7 +2159,7 @@

 	receive_flags(lkb, ms);

-	r = lkb->resource;
+	r = lkb->lkb_resource;

 	hold_rsb(r);
 	lock_rsb(r);
@@ -2218,7 +2235,7 @@

 	len = receive_namelen(ms);

-	dir_nodeid = name_to_directory_nodeid(ls, ms->m_name, namelen);
+	dir_nodeid = name_to_directory_nodeid(ls, ms->m_name, len);
 	if (dir_nodeid != dlm_our_nodeid()) {
 		error = -EINVAL;
 		ret_nodeid = -1;
@@ -2232,7 +2249,7 @@

 void receive_remove(struct dlm_ls *ls, struct dlm_message *ms)
 {
-	int len, error, dir_nodeid, from_nodeid;
+	int len, dir_nodeid, from_nodeid;

 	from_nodeid = ms->m_header.h_nodeid;

@@ -2245,10 +2262,7 @@
 		return;
 	}

-	error = dlm_dir_remove_entry(from_nodeid, ms->m_name, len);
-	if (error)
-		log_error(ls, "remove dir entry error %d from %d",
-			  error, from_nodeid);
+	dlm_dir_remove_entry(ls, from_nodeid, ms->m_name, len);
 }

 void receive_request_reply(struct dlm_ls *ls, struct dlm_message *ms)
@@ -2491,7 +2505,7 @@
 	/* now follow pattern of xxx_lock() functions.
 	   this is basically request_lock() again */

-	r = lkb->resource;
+	r = lkb->lkb_resource;
 	hold_rsb(r);
 	lock_rsb(r);

@@ -2517,7 +2531,6 @@
 void receive_fail_reply(struct dlm_ls *ls, struct dlm_message *ms)
 {
 	struct dlm_lkb *lkb;
-	struct dlm_rsb *r;
 	int error;

 	error = find_lkb(ls, ms->m_lkid, &lkb);
@@ -2536,7 +2549,7 @@
 	}

 	/* not clear what to do here, a completion ast with m_result? */
-
+ out:
 	put_lkb(lkb);
 }

@@ -2544,6 +2557,9 @@
 {
 	struct dlm_message *ms = (struct dlm_message *) hd;
 	struct dlm_ls *ls;
+	int error;
+
+	/* FIXME: do byte swapping here */

 	ls = find_lockspace_global(hd->h_lockspace);
 	if (!ls)
@@ -2580,77 +2596,78 @@

 	/* messages sent to a master node */

-	DLM_MSG_REQUEST:
+	case DLM_MSG_REQUEST:
 		receive_request(ls, ms);
 		break;

-	DLM_MSG_CONVERT:
+	case DLM_MSG_CONVERT:
 		receive_convert(ls, ms);
 		break;

-	DLM_MSG_UNLOCK:
+	case DLM_MSG_UNLOCK:
 		receive_unlock(ls, ms);
 		break;

-	DLM_MSG_CANCEL:
+	case DLM_MSG_CANCEL:
 		receive_cancel(ls, ms);
 		break;

 	/* messages sent from a master node (replies to above) */

-	DLM_MSG_REQUEST_REPLY:
+	case DLM_MSG_REQUEST_REPLY:
 		receive_request_reply(ls, ms);
 		break;

-	DLM_MSG_CONVERT_REPLY:
+	case DLM_MSG_CONVERT_REPLY:
 		receive_convert_reply(ls, ms);
 		break;

-	DLM_MSG_UNLOCK_REPLY:
+	case DLM_MSG_UNLOCK_REPLY:
 		receive_unlock_reply(ls, ms);
 		break;

-	DLM_MSG_CANCEL_REPLY:
+	case DLM_MSG_CANCEL_REPLY:
 		receive_cancel_reply(ls, ms);
 		break;

-	DLM_MSG_FAIL_REPLY:
+	case DLM_MSG_FAIL_REPLY:
 		receive_fail_reply(ls, ms);
 		break;

 	/* messages sent from a master node (only two types of async msg) */

-	DLM_MSG_GRANT:
+	case DLM_MSG_GRANT:
 		receive_grant(ls, ms);
 		break;

-	DLM_MSG_BAST:
+	case DLM_MSG_BAST:
 		receive_bast(ls, ms);
 		break;

 	/* messages sent to a dir node */

-	DLM_MSG_LOOKUP:
+	case DLM_MSG_LOOKUP:
 		receive_lookup(ls, ms);
 		break;

-	DLM_MSG_REMOVE:
+	case DLM_MSG_REMOVE:
 		receive_remove(ls, ms);
 		break;

 	/* messages sent from a dir node */

-	DLM_MSG_LOOKUP_REPLY:
+	case DLM_MSG_LOOKUP_REPLY:
 		receive_lookup_reply(ls, ms);
 		break;

 	default:
-		log_error("unknown message type %d", ms->m_type);
+		log_error(ls, "unknown message type %d", ms->m_type);
 	}

 	unlock_recovery(ls);
+ out:
 	put_lockspace(ls);
-	wake_astd();
+	dlm_astd_wake();
 	return 0;
 }

@@ -2670,7 +2687,7 @@
 		/* we only need to do pre-recovery if the node the lkb
 		   is waiting on is gone */

-		if (!dlm_node_gone(r->res_nodeid))
+		if (!dlm_is_removed(ls, r->res_nodeid))
 			continue;

 		log_debug(ls, "pre recover waiter lkid %x type %d flags %x %s",
@@ -2679,11 +2696,11 @@

 		switch (lkb->lkb_wait_type) {

-		DLM_MSG_REQUEST:
+		case DLM_MSG_REQUEST:
 			lkb->lkb_flags |= DLM_IFL_RESEND;
 			break;

-		DLM_MSG_CONVERT:
+		case DLM_MSG_CONVERT:
 			lkb->lkb_flags |= DLM_IFL_RESEND;

 			/* FIXME: don't think this flag is needed any more
@@ -2692,7 +2709,7 @@
 			lkb->lkb_flags |= DLM_IFL_CONVERTING;
 			break;

-		DLM_MSG_UNLOCK:
+		case DLM_MSG_UNLOCK:
 			/* follow receive_unlock_reply() and pretend we
 			   received an unlock reply from the former master */

@@ -2719,7 +2736,7 @@
 			put_lkb(lkb);
 			break;

-		DLM_MSG_CANCEL:
+		case DLM_MSG_CANCEL:
 			/* follow receive_cancel_reply() and pretend we
 			   received a cancel reply from the former master */

@@ -2741,7 +2758,7 @@
 			put_lkb(lkb);
 			break;

-		DLM_MSG_LOOKUP:
+		case DLM_MSG_LOOKUP:
 			/* all outstanding lookups, regardless of dest.
 			   will be resent after recovery is done */
 			break;
@@ -2848,17 +2865,19 @@
 	return error;
 }

+#if 0
+
 /*
  * Lock block
  *
  * A lock can be one of three types:
  *
  * local copy      lock is mastered locally
- *                 (lkb_nodeid is zero and DLM_LKF_MSTCPY is not set)
+ *                 (lkb_nodeid is zero and DLM_IFL_MSTCPY is not set)
  * process copy    lock is mastered on a remote node
- *                 (lkb_nodeid is non-zero and DLM_LKF_MSTCPY is not set)
+ *                 (lkb_nodeid is non-zero and DLM_IFL_MSTCPY is not set)
  * master copy     master node's copy of a lock owned by remote node
- *                 (lkb_nodeid is non-zero and DLM_LKF_MSTCPY is set)
+ *                 (lkb_nodeid is non-zero and DLM_IFL_MSTCPY is set)
  *
  * lkb_exflags: a copy of the most recent flags arg provided to dlm_lock or
  * dlm_unlock.  The dlm does not modify these or use any private flags in
@@ -3042,6 +3061,9 @@
 #define DLM_HEADER_MAJOR	(0x00020000)
 #define DLM_HEADER_MINOR	(0x00000001)

+#define DLM_MSG			(1)
+#define DLM_RCOM		(2)
+
 struct dlm_header {
 	uint32_t		h_version;
 	uint32_t		h_lockspace;
@@ -3050,6 +3072,21 @@
 	uint8_t			h_cmd;		/* DLM_MSG, DLM_RCOM */
 	uint8_t			h_pad;
 };
+
+#define DLM_MSG_REQUEST		(1)
+#define DLM_MSG_CONVERT		(2)
+#define DLM_MSG_UNLOCK		(3)
+#define DLM_MSG_CANCEL		(4)
+#define DLM_MSG_REQUEST_REPLY	(5)
+#define DLM_MSG_CONVERT_REPLY	(6)
+#define DLM_MSG_UNLOCK_REPLY	(7)
+#define DLM_MSG_CANCEL_REPLY	(8)
+#define DLM_MSG_FAIL_REPLY	(9)
+#define DLM_MSG_GRANT		(10)
+#define DLM_MSG_BAST		(11)
+#define DLM_MSG_LOOKUP		(12)
+#define DLM_MSG_REMOVE		(13)
+#define DLM_MSG_LOOKUP_REPLY	(14)

 struct dlm_message {
 	struct dlm_header	m_header;
@@ -3075,13 +3112,22 @@
 	char			m_name[0];
 };

+#define DLM_RCOM_STATUS		(1)
+#define DLM_RCOM_NAMES		(2)
+#define DLM_RCOM_LOOKUP		(3)
+#define DLM_RCOM_LOCKS		(4)
+#define DLM_RCOM_STATUS_REPLY	(5)
+#define DLM_RCOM_NAMES_REPLY	(6)
+#define DLM_RCOM_LOOKUP_REPLY	(7)
+#define DLM_RCOM_LOCKS_REPLY	(8)
+
 struct dlm_rcom {
-	struct dlm_header	m_header;
-
+	struct dlm_header	rc_header;
+	uint32_t		rc_type;	/* DLM_RCOM_ */
+	uint32_t		rc_msgid;
+	uint32_t		rc_datalen;
+	char			rc_buf[1];
 };

-struct dlm_query_request {
-	struct dlm_header	m_header;
-
-}
-
+#endif
+


typo fix

typo fix

--- src/library/internal_include/rocfft_transpose_kernel.h
+++ src/library/internal_include/rocfft_transpose_kernel.h
@@ -12,5 +12,5 @@

 //include the definations of kernel templates here
 #include "rocfft_transpose_kernel.cu"
-#include "rotfft_transpose_kernel_check_boundary.cu"
+#include "rocfft_transpose_kernel_check_boundary.cu"
 #endif


zerocopy crypto_secretbox_easy()

zerocopy crypto_secretbox_easy()

--- src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
+++ src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
@@ -5,48 +5,60 @@
 #include <stdlib.h>
 #include <string.h>

+#include "crypto_core_hsalsa20.h"
+#include "crypto_onetimeauth_poly1305.h"
 #include "crypto_secretbox.h"
+#include "crypto_stream_salsa20.h"
 #include "utils.h"
+
+static const unsigned char sigma[16] = {
+    'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};

 int
 crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
                       unsigned long long mlen, const unsigned char *n,
                       const unsigned char *k)
 {
-    unsigned char *c_boxed;
-    unsigned char *m_boxed;
-    size_t         c_boxed_len;
-    size_t         m_boxed_len;
-    int            rc;
+    crypto_onetimeauth_poly1305_state state;
+    unsigned char                     block0[64U];
+    unsigned char                     subkey[crypto_stream_salsa20_KEYBYTES];
+    unsigned long long                i;
+    unsigned long long                mlen0;

-    if (mlen > SIZE_MAX - crypto_secretbox_ZEROBYTES) {
+    if (mlen > SIZE_MAX - crypto_secretbox_MACBYTES) {
         return -1;
     }
-    (void) sizeof(char[crypto_secretbox_ZEROBYTES >=
-                       crypto_secretbox_BOXZEROBYTES ? 1 : -1]);
-    m_boxed_len = (size_t) mlen + crypto_secretbox_ZEROBYTES;
-    if ((m_boxed = (unsigned char *) malloc((size_t) m_boxed_len)) == NULL) {
-        return -1;
+    crypto_core_hsalsa20(subkey, n, k, sigma);
+
+    memset(block0, 0U, crypto_secretbox_ZEROBYTES);
+    (void) sizeof(int[64U > crypto_secretbox_ZEROBYTES ? 1 : -1]);
+    mlen0 = mlen;
+    if (mlen0 > 64U - crypto_secretbox_ZEROBYTES) {
+        mlen0 = 64U - crypto_secretbox_ZEROBYTES;
     }
-    c_boxed_len = (size_t) mlen + crypto_secretbox_ZEROBYTES;
-    if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
-        free(m_boxed);
-        return -1;
+    for (i = 0U; i < mlen0; i++) {
+        block0[i + crypto_secretbox_ZEROBYTES] = m[i];
     }
-    memset(m_boxed, 0, crypto_secretbox_ZEROBYTES);
-    memcpy(m_boxed + crypto_secretbox_ZEROBYTES, m, mlen);
-    rc = crypto_secretbox(c_boxed, m_boxed, m_boxed_len, n, k);
-    sodium_memzero(m_boxed, m_boxed_len);
-    free(m_boxed);
-    if (rc != 0) {
-        free(c_boxed);
-        return -1;
+    crypto_stream_salsa20_xor(block0, block0,
+                              mlen0 + crypto_secretbox_ZEROBYTES,
+                              n + 16, subkey);
+    crypto_onetimeauth_poly1305_init(&state, block0);
+
+    memcpy(c + crypto_secretbox_MACBYTES,
+           block0 + crypto_secretbox_ZEROBYTES, mlen0);
+    sodium_memzero(block0, sizeof block0);
+    if (mlen > mlen0) {
+        crypto_stream_salsa20_xor_ic(c + crypto_secretbox_MACBYTES + mlen0,
+                                     m + mlen0, mlen - mlen0,
+                                     n + 16, 1U, subkey);
     }
-    assert(m_boxed_len - crypto_secretbox_BOXZEROBYTES ==
-           mlen + crypto_secretbox_MACBYTES);
-    memcpy(c, c_boxed + crypto_secretbox_BOXZEROBYTES,
-           mlen + crypto_secretbox_MACBYTES);
-    free(c_boxed);
+    sodium_memzero(subkey, sizeof subkey);
+
+    crypto_onetimeauth_poly1305_update
+        (&state, c + crypto_secretbox_MACBYTES, mlen);
+    crypto_onetimeauth_poly1305_final(&state, c);
+    sodium_memzero(&state, sizeof state);

     return 0;
 }
@@ -63,7 +75,7 @@
     int            rc;

     (void) sizeof(int[crypto_secretbox_BOXZEROBYTES + crypto_secretbox_MACBYTES
-                      == crypto_secretbox_ZEROBYTES]);
+                      == crypto_secretbox_ZEROBYTES ? 1 : -1]);
     if (clen < crypto_secretbox_MACBYTES ||
         clen > SIZE_MAX - crypto_secretbox_BOXZEROBYTES) {
         return -1;


common: changes energy update functions

common: changes energy update functions

- fixes bug: NS(Particles_get_energy_value) does not contain the term for the rest
  energy of the particle (ouch!)

- fixes bug: NS(Particles_get_energy_value) and NS(Particles_add_to_energy_value) does not take
  mass-ratios different than 1 into account

- fixes bug: NS(Particles_add_to_energy_value) does not properly update psigma from ptau and the
  zeta value is only now properly rescaled due to the changs in the rvv ratios ->
  this should be fixed now

Additional changes:
- adds functions to scale zeta, get and set mass ratios to the API
- removes functions that try to set the total energy -> this *should* work but
  needs more saveguards for negative sqrt arguments when the rest mass is taken into account properly

--- sixtracklib/common/particles.h
+++ sixtracklib/common/particles.h
@@ -948,6 +948,10 @@
     NS(particle_num_elements_t) const ii,
     NS(particle_real_t) const zeta_value );

+SIXTRL_STATIC SIXTRL_FN void NS(Particles_scale_zeta_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC  NS(Particles)* SIXTRL_RESTRICT particles,
+    NS(particle_num_elements_t) const ii, NS(particle_real_t) const factor );
+
 SIXTRL_STATIC SIXTRL_FN void NS(Particles_assign_ptr_to_zeta)(
     SIXTRL_PARTICLE_ARGPTR_DEC  NS(Particles)* SIXTRL_RESTRICT particles,
     NS(particle_real_ptr_t) ptr_to_zetas );
@@ -1010,17 +1014,13 @@

 /* ------------------------------------------------------------------------- */

+SIXTRL_STATIC SIXTRL_FN NS(particle_real_t) NS(Particles_get_energy0_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC const NS(Particles) *const SIXTRL_RESTRICT p,
+    NS(particle_num_elements_t) const index );
+
 SIXTRL_STATIC SIXTRL_FN NS(particle_real_t) NS(Particles_get_energy_value)(
-    SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
+    SIXTRL_PARTICLE_ARGPTR_DEC const NS(Particles) *const SIXTRL_RESTRICT p,
     NS(particle_num_elements_t) const index );
-
-SIXTRL_STATIC SIXTRL_FN void NS(Particles_set_energy_value)(
-    SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
-    NS(particle_num_elements_t) const index, NS(particle_real_t) const energy );
-
-SIXTRL_STATIC SIXTRL_FN void NS(Particles_set_energy)(
-    SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
-    NS(particle_real_const_ptr_t) SIXTRL_RESTRICT ptr_to_energies );

 SIXTRL_STATIC SIXTRL_FN void NS(Particles_add_to_energy_value)(
     SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
@@ -1206,6 +1206,17 @@
 SIXTRL_STATIC SIXTRL_FN NS(particle_real_t) NS(Particles_get_m_value)(
     SIXTRL_PARTICLE_ARGPTR_DEC const NS(Particles) *const SIXTRL_RESTRICT p,
     NS(particle_num_elements_t) const ii );
+
+/* ------------------------------------------------------------------------- */
+
+SIXTRL_STATIC SIXTRL_FN NS(particle_real_t) NS(Particles_get_mass_ratio_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC  const NS(Particles) *const SIXTRL_RESTRICT p,
+    NS(particle_num_elements_t) const ii );
+
+SIXTRL_STATIC SIXTRL_FN void NS(Particles_set_mass_ratio_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC  NS(Particles)* SIXTRL_RESTRICT particles,
+    NS(particle_num_elements_t) const ii,
+    NS(particle_real_t) const mass_ratio_value );

 /* ------------------------------------------------------------------------- */

@@ -5010,6 +5021,16 @@
     return;
 }

+SIXTRL_INLINE void NS(Particles_scale_zeta_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC  NS(Particles)* SIXTRL_RESTRICT particles,
+    NS(particle_num_elements_t) const ii, NS(particle_real_t) const scale )
+{
+    SIXTRL_ASSERT( ( particles != SIXTRL_NULLPTR ) &&
+                   ( ii < NS(Particles_get_num_of_particles)( particles ) ) );
+
+    particles->zeta[ ii ] *= scale;
+}
+
 SIXTRL_INLINE void NS(Particles_assign_ptr_to_zeta)(
     SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT particles,
     NS(particle_real_ptr_t) ptr_to_zetas )
@@ -5196,86 +5217,76 @@

 /* ------------------------------------------------------------------------- */

+SIXTRL_INLINE NS(particle_real_t) NS(Particles_get_energy0_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC const NS(Particles) *const SIXTRL_RESTRICT p,
+    NS(particle_num_elements_t) const index )
+{
+    typedef NS(particle_real_t) real_t;
+
+    #if defined( __cplusplus ) && !defined( _GPUCODE )
+    using std::sqrt;
+    #endif /* defined( __cplusplus ) && !defined( _GPUCODE ) */
+
+    real_t const p0c = NS(Particles_get_p0c_value)( p, index );
+    real_t const m0  = NS(Particles_get_mass0_value)( p, index );
+
+    return sqrt( p0c * p0c + m0 * m0 );
+}
+
 SIXTRL_INLINE NS(particle_real_t) NS(Particles_get_energy_value)(
-    SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
+    SIXTRL_PARTICLE_ARGPTR_DEC const NS(Particles) *const SIXTRL_RESTRICT p,
     NS(particle_num_elements_t) const index )
 {
     typedef NS(particle_real_t) real_t;

-    real_t const p0c    = NS(Particles_get_p0c_value)( p, index );
-    real_t const beta0  = NS(Particles_get_beta0_value)( p, index );
-    real_t const psigma = NS(Particles_get_psigma_value)( p, index );
-    real_t const ptau   = psigma * beta0;
-    real_t const energy = ptau * p0c;
-
-    return energy;
-
-}
-
-SIXTRL_INLINE void NS(Particles_set_energy_value)(
-    SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
-    NS(particle_num_elements_t) const index, NS(particle_real_t) const energy )
-{
-    typedef NS(particle_real_t) real_t;
-
-    real_t const beta0       = NS(Particles_get_beta0_value)( p, index );
-    real_t const p0c         = NS(Particles_get_p0c_value)( p, index );
-
-    real_t const ptau_beta0  = ( beta0 * energy ) / p0c;
-    real_t const beta0_squ   = beta0 * beta0;
-    real_t const beta0_plus_delta_beta0 = sqrt(
-        ptau_beta0 * ptau_beta0 + ( real_t )2 * ptau_beta0 + beta0_squ );
-
-    real_t const psigma = ptau_beta0 / beta0_squ;
-    real_t const delta  = ( beta0_plus_delta_beta0 - beta0 ) / beta0;
-    real_t const rpp    = beta0 / beta0_plus_delta_beta0;
-    real_t const rvv    = ( beta0_plus_delta_beta0 ) /
-                          ( beta0 + ptau_beta0 * beta0 );
-
-    SIXTRL_ASSERT( beta0     > ( real_t )0 );
-    SIXTRL_ASSERT( p0c       > ( real_t )0 );
-    SIXTRL_ASSERT( beta0_squ > ( real_t )0 );
-    SIXTRL_ASSERT( ( ptau_beta0 * ptau_beta0 +
-        ( real_t )2 * ptau_beta0 + beta0_squ ) > ( real_t )0 );
-
-    NS(Particles_set_delta_value)(  p, index, delta  );
-    NS(Particles_set_rpp_value)(    p, index, rpp    );
-    NS(Particles_set_rvv_value)(    p, index, rvv    );
-    NS(Particles_set_psigma_value)( p, index, psigma );
-
-    return;
-}
-
-SIXTRL_INLINE void NS(Particles_set_energy)(
-    SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
-    NS(particle_real_const_ptr_t) SIXTRL_RESTRICT ptr_to_energies )
-{
-    NS(particle_num_elements_t) const num_particles =
-        NS(Particles_get_num_of_particles)( p );
-
-    NS(particle_num_elements_t) ii = ( NS(particle_num_elements_t) )0u;
-
-    SIXTRL_ASSERT( ptr_to_energies != SIXTRL_NULLPTR );
-
-    for( ; ii < num_particles ; ++ii )
-    {
-        NS(Particles_set_energy_value)( p, ii, ptr_to_energies[ ii ] );
-    }
-
-    return;
+    #if defined( __cplusplus ) && !defined( _GPUCODE )
+    using std::sqrt;
+    #endif /* defined( __cplusplus ) && !defined( _GPUCODE ) */
+
+    real_t const p0c   = NS(Particles_get_p0c_value)( p, index );
+    real_t const mass0 = NS(Particles_get_mass0_value)( p, index );
+
+    return ( NS(Particles_get_psigma_value)( p, index ) *
+             NS(Particles_get_beta0_value)(  p, index ) * p0c +
+                sqrt( p0c * p0c + mass0 * mass0 ) ) *
+                    NS(Particles_get_mass_ratio_value)( p, index );
 }

 SIXTRL_INLINE void NS(Particles_add_to_energy_value)(
     SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT p,
-    NS(particle_num_elements_t) const index,
+    NS(particle_num_elements_t) const ii,
     NS(particle_real_t) const delta_energy )
 {
     typedef NS(particle_real_t) real_t;

-    real_t const current_energy = NS(Particles_get_energy_value)( p, index );
-    NS(Particles_set_energy_value)( p, index, current_energy + delta_energy );
-
-    return;
+    #if !defined( _GPUCODE ) && defined( __cplusplus )
+    using std::sqrt;
+    #endif /* !defined( _GPUCODE ) && defined( __cplusplus ) */
+
+    SIXTRL_STATIC_VAR real_t const ONE = ( real_t )1.0;
+
+    real_t const beta0 = NS(Particles_get_beta0_value)( p, ii );
+    real_t const delta_beta0 = NS(Particles_get_delta_value)( p, ii ) * beta0;
+
+    real_t const ptau_beta0 =
+        delta_energy / NS(Particles_get_energy0_value)( p, ii ) +
+        sqrt( delta_beta0 * delta_beta0 + ( real_t )2.0 * delta_beta0 * beta0
+                + ONE ) - ONE;
+
+    real_t const ptau   = ptau_beta0 / beta0;
+    real_t const psigma = ptau / beta0;
+    real_t const delta = sqrt( ptau * ptau + ( real_t )2 * psigma + ONE ) - ONE;
+
+    real_t const one_plus_delta = delta + ONE;
+    real_t const rvv = one_plus_delta / ( ONE + ptau_beta0 );
+
+    NS(Particles_set_delta_value)(  p, ii, delta );
+    NS(Particles_set_psigma_value)( p, ii, psigma );
+    NS(Particles_scale_zeta_value)( p, ii,
+        rvv / NS(Particles_get_rvv_value)( p, ii ) );
+
+    NS(Particles_set_rvv_value)( p, ii, rvv );
+    NS(Particles_set_rpp_value)( p, ii, ONE / one_plus_delta );
 }

 SIXTRL_INLINE void NS(Particles_add_to_energy_detailed)(
@@ -5807,6 +5818,34 @@

 /* ------------------------------------------------------------------------- */

+SIXTRL_INLINE NS(particle_real_t) NS(Particles_get_mass_ratio_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC  const NS(Particles) *const SIXTRL_RESTRICT p,
+    NS(particle_num_elements_t) const ii )
+{
+    SIXTRL_ASSERT( p != SIXTRL_NULLPTR );
+    SIXTRL_ASSERT( NS(Particles_get_num_of_particles)( p ) > ii );
+
+    return NS(Particles_get_charge_ratio_value)( p, ii ) /
+           NS(Particles_get_chi_value)( p, ii );
+}
+
+SIXTRL_INLINE void NS(Particles_set_mass_ratio_value)(
+    SIXTRL_PARTICLE_ARGPTR_DEC  NS(Particles)* SIXTRL_RESTRICT p,
+    NS(particle_num_elements_t) const ii,
+    NS(particle_real_t) const mass_ratio_value )
+{
+    SIXTRL_ASSERT( p != SIXTRL_NULLPTR );
+    SIXTRL_ASSERT( NS(Particles_get_num_of_particles)( p ) > ii );
+
+    NS(particle_real_t) const charge_ratio_value =
+        NS(Particles_get_charge_ratio_value)( p, ii );
+
+    NS(Particles_set_chi_value)(
+        p, ii, charge_ratio_value / mass_ratio_value );
+}
+
+/* ------------------------------------------------------------------------- */
+
 SIXTRL_INLINE NS(particle_index_t) NS(Particles_get_particle_id_value)(
     SIXTRL_PARTICLE_ARGPTR_DEC const NS(Particles)
         *const SIXTRL_RESTRICT particles,


added tests for length limit

added tests for length limit

--- skeletons/tests/check-length.c
+++ skeletons/tests/check-length.c
@@ -53,12 +53,12 @@
 	}

 	buf_off = 0;
-	erval = der_encode(&asn1_DEF_OCTET_STRING,
+	erval = der_encode(&asn_DEF_OCTET_STRING,
 		os, write_to_buf, 0);
 	assert(erval.encoded == buf_off);
 	assert(buf_off > size);

-	rval = ber_decode(&asn1_DEF_OCTET_STRING, (void **)&nos, buf, buf_off);
+	rval = ber_decode(0, &asn_DEF_OCTET_STRING, (void **)&nos, buf, buf_off);
 	assert(rval.code == RC_OK);
 	assert(rval.consumed == buf_off);

@@ -76,12 +76,17 @@
 	}

-	asn1_DEF_OCTET_STRING.free_struct(&asn1_DEF_OCTET_STRING, os, 0);
-	asn1_DEF_OCTET_STRING.free_struct(&asn1_DEF_OCTET_STRING, nos, 0);
+	asn_DEF_OCTET_STRING.free_struct(&asn_DEF_OCTET_STRING, os, 0);
+	asn_DEF_OCTET_STRING.free_struct(&asn_DEF_OCTET_STRING, nos, 0);
 }

 int
 main() {
+	uint8_t buf1[] = { 0x85, 0x00, 0x01, 0x02, 0x03, 0x04 };
+	uint8_t buf2[] = { 0x85, 0x00, 0x7f, 0xff, 0x03, 0x04 };
+	uint8_t buf3[] = { 0x85, 0x00, 0x7f, 0xff, 0xff, 0x04 };
+	ber_tlv_len_t tlv_len;
+	ssize_t ret;
 	int i;

 	for(i = 0; i < 66000; i++) {
@@ -89,5 +94,17 @@
 		check(i);
 	}

+	ret = ber_fetch_length(0, buf1, sizeof(buf1), &tlv_len);
+	printf("ret=%d, len=%d\n", ret, tlv_len);
+	assert(ret == sizeof(buf1));
+
+	ret = ber_fetch_length(0, buf2, sizeof(buf2), &tlv_len);
+	printf("ret=%d, len=%d\n", ret, tlv_len);
+	assert(ret == sizeof(buf2));
+
+	ret = ber_fetch_length(0, buf3, sizeof(buf3), &tlv_len);
+	printf("ret=%d\n", ret);
+	assert(ret == -1);
+
 	return 0;
 }


ALSA: hda - Apply ideapad quirk to Acer laptops with Cxt5066

Multiple Acer laptops with the SSID 1025:04xx require the quirk
mode=ideapad, so let's use mask to apply to all these.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/hda/patch_conexant.c
+++ sound/pci/hda/patch_conexant.c
@@ -3093,8 +3093,7 @@
 };

 static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
-	SND_PCI_QUIRK(0x1025, 0x040a, "Acer", CXT5066_IDEAPAD),
-	SND_PCI_QUIRK(0x1025, 0x043d, "Acer", CXT5066_IDEAPAD),
+	SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO),
 	SND_PCI_QUIRK(0x1028, 0x02f5, "Dell",
 		      CXT5066_DELL_LAPTOP),


[ALSA] hda-codec - Fix Oops with probing sigmatel codec chips

When a device is unkown, the driver tries to set up the codec based on
the BIOS information.  Then it may result in Oops if BIOS is broken.
The patch fixes the issue, falling back to a reference model in such a
case.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>
Signed-off-by: Jaroslav Kysela <72edd5e1a572f82f059ccbb83c92b74d6cb051ff@suse.cz>

--- sound/pci/hda/patch_sigmatel.c
+++ sound/pci/hda/patch_sigmatel.c
@@ -1800,6 +1800,7 @@
 	spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
 							stac925x_models,
 							stac925x_cfg_tbl);
+ again:
 	if (spec->board_config < 0) {
 		snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x, using BIOS defaults\n");
 		err = stac92xx_save_bios_config_regs(codec);
@@ -1825,6 +1826,15 @@
 	spec->mixer = stac925x_mixer;

 	err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
+	if (!err) {
+		if (spec->board_config < 0) {
+			printk(KERN_WARNING "hda_codec: No auto-config is "
+			       "available, default to model=ref\n");
+			spec->board_config = STAC_925x_REF;
+			goto again;
+		}
+		err = -EINVAL;
+	}
 	if (err < 0) {
 		stac92xx_free(codec);
 		return err;
@@ -1850,6 +1860,7 @@
 	spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
 							stac922x_models,
 							stac922x_cfg_tbl);
+ again:
 	if (spec->board_config < 0) {
 		snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
 			"using BIOS defaults\n");
@@ -1875,6 +1886,15 @@
 	spec->multiout.dac_nids = spec->dac_nids;

 	err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
+	if (!err) {
+		if (spec->board_config < 0) {
+			printk(KERN_WARNING "hda_codec: No auto-config is "
+			       "available, default to model=ref\n");
+			spec->board_config = STAC_D945_REF;
+			goto again;
+		}
+		err = -EINVAL;
+	}
 	if (err < 0) {
 		stac92xx_free(codec);
 		return err;
@@ -1903,6 +1923,7 @@
 	spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
 							stac927x_models,
 							stac927x_cfg_tbl);
+ again:
 	if (spec->board_config < 0) {
                 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
 		err = stac92xx_save_bios_config_regs(codec);
@@ -1945,6 +1966,15 @@
 	spec->multiout.dac_nids = spec->dac_nids;

 	err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
+	if (!err) {
+		if (spec->board_config < 0) {
+			printk(KERN_WARNING "hda_codec: No auto-config is "
+			       "available, default to model=ref\n");
+			spec->board_config = STAC_D965_REF;
+			goto again;
+		}
+		err = -EINVAL;
+	}
 	if (err < 0) {
 		stac92xx_free(codec);
 		return err;
@@ -1970,6 +2000,7 @@
 	spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
 							stac9205_models,
 							stac9205_cfg_tbl);
+ again:
 	if (spec->board_config < 0) {
 		snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
 		err = stac92xx_save_bios_config_regs(codec);
@@ -2008,6 +2039,15 @@
 			    AC_VERB_SET_GPIO_MASK, 0x00000001);

 	err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
+	if (!err) {
+		if (spec->board_config < 0) {
+			printk(KERN_WARNING "hda_codec: No auto-config is "
+			       "available, default to model=ref\n");
+			spec->board_config = STAC_9205_REF;
+			goto again;
+		}
+		err = -EINVAL;
+	}
 	if (err < 0) {
 		stac92xx_free(codec);
 		return err;


[ALSA] snd_hda_intel: fix for intel imac

Add handling of Intel-iMac-specific pinconfig of the sound card.
Intel-iMac now handled as a separated subsystem.

Signed-off-by: Sylvain FORET <b99747ec5dc041d5bf7ed423eb461527d2b83ab7@anu.edu.au>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>
Signed-off-by: Jaroslav Kysela <72edd5e1a572f82f059ccbb83c92b74d6cb051ff@suse.cz>

--- sound/pci/hda/patch_sigmatel.c
+++ sound/pci/hda/patch_sigmatel.c
@@ -62,6 +62,7 @@
 	STAC_MACBOOK,
 	STAC_MACBOOK_PRO_V1,
 	STAC_MACBOOK_PRO_V2,
+	STAC_IMAC_INTEL,
 	STAC_922X_MODELS
 };

@@ -536,6 +537,12 @@
 	0x400000fc, 0x400000fb,
 };

+static unsigned int imac_intel_pin_configs[10] = {
+	0x0121e230, 0x90a70120, 0x9017e110, 0x400000fe,
+	0x400000fd, 0x0181e021, 0x1145e040, 0x400000fa,
+	0x400000fc, 0x400000fb,
+};
+
 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
 	[STAC_D945_REF] = ref922x_pin_configs,
 	[STAC_D945GTP3] = d945gtp3_pin_configs,
@@ -544,6 +551,7 @@
 	[STAC_MACBOOK] = macbook_pro_v1_pin_configs,
 	[STAC_MACBOOK_PRO_V1] = macbook_pro_v1_pin_configs,
 	[STAC_MACBOOK_PRO_V2] = macbook_pro_v2_pin_configs,
+	[STAC_IMAC_INTEL] = imac_intel_pin_configs,
 };

 static const char *stac922x_models[STAC_922X_MODELS] = {
@@ -554,6 +562,7 @@
 	[STAC_MACBOOK]	= "macbook",
 	[STAC_MACBOOK_PRO_V1]	= "macbook-pro-v1",
 	[STAC_MACBOOK_PRO_V2]	= "macbook-pro",
+	[STAC_IMAC_INTEL] = "imac-intel",
 };

 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
@@ -1920,6 +1929,9 @@
 		case 0x106b1e00: /* MacBook Pro second generation */
 			spec->board_config = STAC_MACBOOK_PRO_V2;
 			break;
+		case 0x106b0700: /* Intel-based iMac */
+			spec->board_config = STAC_IMAC_INTEL;
+			break;
 		}
 	}


ASoC: tlv320dac33: Change nsample switch to FIFO mode enum

In order to have support for more FIFO modes supported by
tlv320dac33, the switch for enabling/disabling the FIFO
use has to be replaced with an enum.

Signed-off-by: Peter Ujfalusi <e5c0b4cdf99ae1d408b9c497159e74b54e02e008@nokia.com>
Acked-by: Liam Girdwood <a57ef363056e61beffa2efa59c68550d40db03b0@slimlogic.co.uk>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/codecs/tlv320dac33.c
+++ sound/soc/codecs/tlv320dac33.c
@@ -59,6 +59,12 @@
 	DAC33_FLUSH,
 };

+enum dac33_fifo_modes {
+	DAC33_FIFO_BYPASS = 0,
+	DAC33_FIFO_MODE1,
+	DAC33_FIFO_LAST_MODE,
+};
+
 #define DAC33_NUM_SUPPLIES 3
 static const char *dac33_supply_names[DAC33_NUM_SUPPLIES] = {
 	"AVDD",
@@ -82,7 +88,7 @@
 					 * this */
 	unsigned int nsample_max;	/* nsample should not be higher than
 					 * this */
-	unsigned int nsample_switch;	/* Use FIFO or bypass FIFO switch */
+	enum dac33_fifo_modes fifo_mode;/* FIFO mode selection */
 	unsigned int nsample;		/* burst read amount from host */

 	enum dac33_state state;
@@ -381,38 +387,47 @@
 	return ret;
 }

-static int dac33_get_nsample_switch(struct snd_kcontrol *kcontrol,
+static int dac33_get_fifo_mode(struct snd_kcontrol *kcontrol,
 			 struct snd_ctl_elem_value *ucontrol)
 {
 	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
 	struct tlv320dac33_priv *dac33 = codec->private_data;

-	ucontrol->value.integer.value[0] = dac33->nsample_switch;
-
-	return 0;
-}
-
-static int dac33_set_nsample_switch(struct snd_kcontrol *kcontrol,
+	ucontrol->value.integer.value[0] = dac33->fifo_mode;
+
+	return 0;
+}
+
+static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol,
 			 struct snd_ctl_elem_value *ucontrol)
 {
 	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
 	struct tlv320dac33_priv *dac33 = codec->private_data;
 	int ret = 0;

-	if (dac33->nsample_switch == ucontrol->value.integer.value[0])
+	if (dac33->fifo_mode == ucontrol->value.integer.value[0])
 		return 0;
 	/* Do not allow changes while stream is running*/
 	if (codec->active)
 		return -EPERM;

 	if (ucontrol->value.integer.value[0] < 0 ||
-	    ucontrol->value.integer.value[0] > 1)
+	    ucontrol->value.integer.value[0] >= DAC33_FIFO_LAST_MODE)
 		ret = -EINVAL;
 	else
-		dac33->nsample_switch = ucontrol->value.integer.value[0];
+		dac33->fifo_mode = ucontrol->value.integer.value[0];

 	return ret;
 }
+
+/* Codec operation modes */
+static const char *dac33_fifo_mode_texts[] = {
+	"Bypass", "Mode 1"
+};
+
+static const struct soc_enum dac33_fifo_mode_enum =
+	SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dac33_fifo_mode_texts),
+			    dac33_fifo_mode_texts);

 /*
  * DACL/R digital volume control:
@@ -436,8 +451,8 @@
 static const struct snd_kcontrol_new dac33_nsample_snd_controls[] = {
 	SOC_SINGLE_EXT("nSample", 0, 0, 5900, 0,
 		 dac33_get_nsample, dac33_set_nsample),
-	SOC_SINGLE_EXT("nSample Switch", 0, 0, 1, 0,
-		 dac33_get_nsample_switch, dac33_set_nsample_switch),
+	SOC_ENUM_EXT("FIFO Mode", dac33_fifo_mode_enum,
+		 dac33_get_fifo_mode, dac33_set_fifo_mode),
 };

 /* Analog bypass */
@@ -586,7 +601,7 @@
 	unsigned int pwr_ctrl;

 	/* Stop pending workqueue */
-	if (dac33->nsample_switch)
+	if (dac33->fifo_mode)
 		cancel_work_sync(&dac33->work);

 	mutex_lock(&dac33->mutex);
@@ -714,7 +729,7 @@

 	dac33_oscwait(codec);

-	if (dac33->nsample_switch) {
+	if (dac33->fifo_mode) {
 		/* 50-51 : ASRC Control registers */
 		dac33_write(codec, DAC33_ASRC_CTRL_A, (1 << 4)); /* div=2 */
 		dac33_write(codec, DAC33_ASRC_CTRL_B, 1); /* ??? */
@@ -734,7 +749,7 @@
 		dac33_write(codec, DAC33_ASRC_CTRL_B, 0); /* ??? */
 	}

-	if (dac33->nsample_switch)
+	if (dac33->fifo_mode)
 		fifoctrl_a &= ~DAC33_FBYPAS;
 	else
 		fifoctrl_a |= DAC33_FBYPAS;
@@ -742,13 +757,13 @@

 	dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_A, aictrl_a);
 	reg_tmp = dac33_read_reg_cache(codec, DAC33_SER_AUDIOIF_CTRL_B);
-	if (dac33->nsample_switch)
+	if (dac33->fifo_mode)
 		reg_tmp &= ~DAC33_BCLKON;
 	else
 		reg_tmp |= DAC33_BCLKON;
 	dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_B, reg_tmp);

-	if (dac33->nsample_switch) {
+	if (dac33->fifo_mode) {
 		/* 20: BCLK divide ratio */
 		dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 3);

@@ -828,7 +843,7 @@
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		if (dac33->nsample_switch) {
+		if (dac33->fifo_mode) {
 			dac33->state = DAC33_PREFILL;
 			queue_work(dac33->dac33_wq, &dac33->work);
 		}
@@ -836,7 +851,7 @@
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		if (dac33->nsample_switch) {
+		if (dac33->fifo_mode) {
 			dac33->state = DAC33_FLUSH;
 			queue_work(dac33->dac33_wq, &dac33->work);
 		}
@@ -1125,7 +1140,7 @@
 	dac33->irq = client->irq;
 	dac33->nsample = NSAMPLE_MAX;
 	/* Disable FIFO use by default */
-	dac33->nsample_switch = 0;
+	dac33->fifo_mode = DAC33_FIFO_BYPASS;

 	tlv320dac33_codec = codec;


ASoC: ep93xx-ac97: use devm_* helpers to cleanup probe

Use the devm_* helpers to cleanup the probe routine. This also eliminates
having to carry the mem and irq values in the private data for the remove.

Signed-off-by: H Hartley Sweeten <382ff55d8e07d1082d179e669636cd1552da4f36@visionengravers.com>
Tested-by: Mika Westerberg <afb75201fb002d7fdd2b0b231e006999e00db8a9@iki.fi>
Acked-by: Mika Westerberg <afb75201fb002d7fdd2b0b231e006999e00db8a9@iki.fi>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/ep93xx/ep93xx-ac97.c
+++ sound/soc/ep93xx/ep93xx-ac97.c
@@ -87,17 +87,13 @@
  * struct ep93xx_ac97_info - EP93xx AC97 controller info structure
  * @lock: mutex serializing access to the bus (slot 1 & 2 ops)
  * @dev: pointer to the platform device dev structure
- * @mem: physical memory resource for the registers
  * @regs: mapped AC97 controller registers
- * @irq: AC97 interrupt number
  * @done: bus ops wait here for an interrupt
  */
 struct ep93xx_ac97_info {
 	struct mutex		lock;
 	struct device		*dev;
-	struct resource		*mem;
 	void __iomem		*regs;
-	int			irq;
 	struct completion	done;
 };

@@ -359,11 +355,30 @@
 static int __devinit ep93xx_ac97_probe(struct platform_device *pdev)
 {
 	struct ep93xx_ac97_info *info;
+	struct resource *res;
+	unsigned int irq;
 	int ret;

-	info = kzalloc(sizeof(struct ep93xx_ac97_info), GFP_KERNEL);
+	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	info->regs = devm_request_and_ioremap(&pdev->dev, res);
+	if (!info->regs)
+		return -ENXIO;
+
+	irq = platform_get_irq(pdev, 0);
+	if (!irq)
+		return -ENODEV;
+
+	ret = devm_request_irq(&pdev->dev, irq, ep93xx_ac97_interrupt,
+			       IRQF_TRIGGER_HIGH, pdev->name, info);
+	if (ret)
+		goto fail;

 	dev_set_drvdata(&pdev->dev, info);

@@ -371,54 +386,19 @@
 	init_completion(&info->done);
 	info->dev = &pdev->dev;

-	info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!info->mem) {
-		ret = -ENXIO;
-		goto fail_free_info;
-	}
-
-	info->irq = platform_get_irq(pdev, 0);
-	if (!info->irq) {
-		ret = -ENXIO;
-		goto fail_free_info;
-	}
-
-	if (!request_mem_region(info->mem->start, resource_size(info->mem),
-				pdev->name)) {
-		ret = -EBUSY;
-		goto fail_free_info;
-	}
-
-	info->regs = ioremap(info->mem->start, resource_size(info->mem));
-	if (!info->regs) {
-		ret = -ENOMEM;
-		goto fail_release_mem;
-	}
-
-	ret = request_irq(info->irq, ep93xx_ac97_interrupt, IRQF_TRIGGER_HIGH,
-			  pdev->name, info);
-	if (ret)
-		goto fail_unmap_mem;
-
 	ep93xx_ac97_info = info;
 	platform_set_drvdata(pdev, info);

 	ret = snd_soc_register_dai(&pdev->dev, &ep93xx_ac97_dai);
 	if (ret)
-		goto fail_free_irq;
+		goto fail;

 	return 0;

-fail_free_irq:
+fail:
 	platform_set_drvdata(pdev, NULL);
-	free_irq(info->irq, info);
-fail_unmap_mem:
-	iounmap(info->regs);
-fail_release_mem:
-	release_mem_region(info->mem->start, resource_size(info->mem));
-fail_free_info:
-	kfree(info);
-
+	ep93xx_ac97_info = NULL;
+	dev_set_drvdata(&pdev->dev, NULL);
 	return ret;
 }

@@ -431,11 +411,9 @@
 	/* disable the AC97 controller */
 	ep93xx_ac97_write_reg(info, AC97GCR, 0);

-	free_irq(info->irq, info);
-	iounmap(info->regs);
-	release_mem_region(info->mem->start, resource_size(info->mem));
 	platform_set_drvdata(pdev, NULL);
-	kfree(info);
+	ep93xx_ac97_info = NULL;
+	dev_set_drvdata(&pdev->dev, NULL);

 	return 0;
 }


ALSA: caiaq - Version 1.3.10

ALSA: caiaq - Version 1.3.10

Increase the version number in module info to indicate the fixes.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/usb/caiaq/caiaq-device.c
+++ sound/usb/caiaq/caiaq-device.c
@@ -42,7 +42,7 @@
 #endif

 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
-MODULE_DESCRIPTION("caiaq USB audio, version 1.3.9");
+MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
 			 "{Native Instruments, RigKontrol3},"


Old select function now get transformations calculated every time. Stopped forcing render mode to be RENDER which was mucking up SELECT mode picking for old select function (causing mirage node editor to be unable to pick anything).

--- source/graphics/scene_viewer.c
+++ source/graphics/scene_viewer.c
@@ -819,7 +819,6 @@
 						stencil_bits=0;
 					}
 					/*???RC. Is this the best place to set line width and point size? */
-					glRenderMode(GL_RENDER);
 					glLineWidth((GLfloat)global_line_width);
 					glPointSize((GLfloat)global_point_size);
 					/*???RC temporary: turn on point and line antialiasing */
@@ -1159,8 +1158,8 @@
 							glFlush();
 						}
 					}
-					if (scene_viewer->fast_changing ||
-						Scene_has_fast_changing_objects(scene_viewer->scene))
+					if (!picking_on&&(scene_viewer->fast_changing ||
+						Scene_has_fast_changing_objects(scene_viewer->scene)))
 					{
 						scene_viewer->swap_buffers=0;
 						/* Set up projection */
@@ -1590,15 +1589,17 @@
 static int Scene_viewer_input_select_old(struct Scene_viewer *scene_viewer,
 	XEvent *event)
 /*******************************************************************************
-LAST MODIFIED : 18 May 1998
+LAST MODIFIED : 20 July 2000

 DESCRIPTION :
 Converts mouse button-press and motion events into viewing transformations in
 <scene_viewer>.
 ==============================================================================*/
 {
+	Dimension xwidth, xheight;
 	double near_x,near_y,near_z,far_x,far_y,far_z,view[3];
-	int return_code,pointer_x,pointer_y,scene_input_modifier;
+	int return_code,pointer_x,pointer_y,scene_input_modifier,
+		viewport_height,viewport_width;
 	XButtonEvent *button_event;
 #if defined (DEBUG)
 	XKeyEvent *key_event;
@@ -1611,6 +1612,12 @@
 	if (scene_viewer&&event)
 	{
 		return_code=1;
+		XtVaGetValues(scene_viewer->drawing_widget,
+			XmNwidth,&xwidth,XmNheight,&xheight,NULL);
+		viewport_width = (int)xwidth;
+		viewport_height = (int)xheight;
+		Scene_viewer_calculate_transformation(scene_viewer,
+			viewport_width,viewport_height);
 		/* get direction we are viewing along */
 		view[0]=scene_viewer->lookatx-scene_viewer->eyex;
 		view[1]=scene_viewer->lookaty-scene_viewer->eyey;


Accidently added a debug output printf without surrounding it in #defined DEBUG.

--- source/graphics/scene_viewer.c
+++ source/graphics/scene_viewer.c
@@ -5686,7 +5686,9 @@
 		*opengl_vendor=(char *)glGetString(GL_VENDOR);
 		*opengl_extensions=(char *)glGetString(GL_EXTENSIONS);

+#if defined (DEBUG)
 		printf("%s\n", *opengl_extensions);
+#endif /* defined (DEBUG) */

 		Graphics_buffer_get_visual_id(scene_viewer->graphics_buffer, visual_id);
 		Graphics_buffer_get_colour_buffer_depth(scene_viewer->graphics_buffer,


lower auto increment page size to support all current targets

--- source/hif_hal/target_config.h
+++ source/hif_hal/target_config.h
@@ -32,7 +32,7 @@
 */

 // This can vary from target to target and should be in the structure or flash blob
-#define TARGET_AUTO_INCREMENT_PAGE_SIZE    (4096)
+#define TARGET_AUTO_INCREMENT_PAGE_SIZE    (1024)

 /**
  @struct target_cfg_t


check if *value is non-NULL before setting it

--- ziplist.c
+++ ziplist.c
@@ -87,13 +87,13 @@
 unsigned char *ziplistPop(unsigned char *zl, sds *value, int where) {
     unsigned int curlen = ZIPLIST_BYTES(zl), len, rlen;
     unsigned char *p;
-    *value = NULL;
+    if (value) *value = NULL;

     /* Get pointer to element to remove */
     p = (where == ZIPLIST_HEAD) ? ziplistHead(zl) : ziplistTail(zl);
     if (*p == ZIP_END) return zl;
     len = zipDecodeLength(p);
-    *value = sdsnewlen(p+zipEncodeLength(NULL,len),len);
+    if (value) *value = sdsnewlen(p+zipEncodeLength(NULL,len),len);

     /* Move list to front when popping from the head */
     rlen = zipRawEntryLength(p);


Cast a const SQLCHAR * to const char * to make the compiler happy.

--- sql/src/odbc/driver/ODBCUtil.c
+++ sql/src/odbc/driver/ODBCUtil.c
@@ -171,7 +171,7 @@
 		return NULL;
 	}
 	if (length == SQL_NTS)
-		length = strlen(s);
+		length = strlen((const char *) s);
 	else if (length < 0)
 		return "Invalid length parameter";


rel_optimizer.c:1714: variable o was set but never used

--- sql/src/server/rel_optimizer.c
+++ sql/src/server/rel_optimizer.c
@@ -1711,9 +1711,8 @@
 		node *n, *m;

 		for (n=rel->exps->h; n; n = n->next) {
-			sql_exp *o, *e1 = n->data;
-
-			o = e1;
+			sql_exp *e1 = n->data;
+
 			if (e1->type != e_column && e1->type != e_atom && e1->name) {
 				for (m=nexps->h; m; m = m->next){
 					sql_exp *e2 = m->data;


Update Flute instrument.

Update Flute instrument.


Let the mmap thread start the pcm stream when it's full Instead of filling it with silence and starting it before the thread is active

--- Alc/alsa.c
+++ Alc/alsa.c
@@ -274,46 +274,6 @@
     return 0;
 }

-static void fill_silence(snd_pcm_t *pcmHandle, snd_pcm_format_t alsaFormat, int channels)
-{
-    const snd_pcm_channel_area_t *areas = NULL;
-    snd_pcm_sframes_t avail, commitres;
-    snd_pcm_uframes_t offset, frames;
-    int err;
-
-    avail = psnd_pcm_avail_update(pcmHandle);
-    if(avail < 0)
-    {
-        AL_PRINT("available update failed: %s\n", psnd_strerror(avail));
-        return;
-    }
-
-    // it is possible that contiguous areas are smaller, thus we use a loop
-    while (avail > 0)
-    {
-        frames = avail;
-
-        err = psnd_pcm_mmap_begin(pcmHandle, &areas, &offset, &frames);
-        if (err < 0)
-        {
-            AL_PRINT("mmap begin error: %s\n", psnd_strerror(err));
-            break;
-        }
-
-        psnd_pcm_areas_silence(areas, offset, channels, frames, alsaFormat);
-
-        commitres = psnd_pcm_mmap_commit(pcmHandle, offset, frames);
-        if (commitres < 0 || (commitres-frames) != 0)
-        {
-            AL_PRINT("mmap commit error: %s\n",
-                     psnd_strerror(commitres >= 0 ? -EPIPE : commitres));
-            break;
-        }
-
-        avail -= frames;
-    }
-}
-
 static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
 {
     snd_pcm_uframes_t bufferSizeInFrames;
@@ -461,18 +421,6 @@
         if(i < 0)
         {
             AL_PRINT("prepare error: %s\n", psnd_strerror(i));
-            psnd_pcm_close(data->pcmHandle);
-            free(data->buffer);
-            free(data);
-            return ALC_FALSE;
-        }
-
-        fill_silence(data->pcmHandle, data->format, device->Channels);
-
-        i = psnd_pcm_start(data->pcmHandle);
-        if(i < 0)
-        {
-            AL_PRINT("start error: %s\n", psnd_strerror(i));
             psnd_pcm_close(data->pcmHandle);
             free(data->buffer);
             free(data);


Use %zd for size_t types

Use %zd for size_t types

--- Alc/alsa.c
+++ Alc/alsa.c
@@ -291,7 +291,7 @@
                strcmp(deviceName, alsaDeviceList[idx]) == 0)
             {
                 if(idx > 0)
-                    sprintf(driver, "hw:%d,0", idx-1);
+                    sprintf(driver, "hw:%zd,0", idx-1);
                 goto open_alsa;
             }
         }


Check the right size for the in-progress mhr update

--- Alc/hrtf.c
+++ Alc/hrtf.c
@@ -746,9 +746,9 @@
     ALubyte (*delays)[2] = NULL;
     ALsizei i, j;

-    if(datalen < 6)
-    {
-        ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 6, datalen);
+    if(datalen < 8)
+    {
+        ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 8, datalen);
         return NULL;
     }


Fix 8-bit output with the Wave Writer

Fix 8-bit output with the Wave Writer

--- Alc/wave.c
+++ Alc/wave.c
@@ -101,7 +101,12 @@
                 ALubyte *bytes = data->buffer;
                 ALuint i;

-                if(aluBytesFromFormat(pDevice->Format) == 2)
+                if(aluBytesFromFormat(pDevice->Format) == 1)
+                {
+                    for(i = 0;i < data->size;i++)
+                        fputc(bytes[i], data->f);
+                }
+                else if(aluBytesFromFormat(pDevice->Format) == 2)
                 {
                     for(i = 0;i < data->size;i++)
                         fputc(bytes[i^1], data->f);


const keywords

const keywords


Fixed up the comments/docs.

Fixed up the comments/docs.

--- BaseType.h
+++ BaseType.h
@@ -17,6 +17,9 @@

 /*
  * $Log: BaseType.h,v $
+ * Revision 1.57  2000/09/11 16:33:29  jimg
+ * Fixed up the comments/docs.
+ *
  * Revision 1.56  2000/08/02 22:46:48  jimg
  * Merged 3.1.8
  *
@@ -712,13 +715,14 @@

 	@memo Reads the data into a local buffer.

-	@return The function returns a boolean value, with TRUE indicating that
-	read() should be called again because there's more data to read, and
-	FALSE indicating there's no more data to read. Note that this behavior
-	is necessary to properly handle variables that contain Sequences.
-
-	@param dataset A string naming the dataset from which the data is to be
-	read. The meaning of this string will vary among data APIs.
+	@return The function returns a boolean value, with TRUE indicating
+	that read() should be called again because there's more data to read,
+	and FALSE indicating there's no more data to read. Note that this
+	behavior is necessary to properly handle variables that contain
+	Sequences.
+
+	@param dataset A string naming the dataset from which the data is to
+	be read. The meaning of this string will vary among data APIs.

 	@param error An integer indicating a returned error condition. The
 	exact meaning of this integer will vary among data APIs. However, for


avcodec: skip nonref-frames if we don't need output picture

--- modules/codec/avcodec/video.c
+++ modules/codec/avcodec/video.c
@@ -770,12 +770,11 @@
             msg_Warn( p_dec, "More than 11 late frames, dropping frame" );
             return NULL;
         }
-
-        if( !b_need_output_picture )
-        {
-            p_context->skip_frame = __MAX( p_context->skip_frame,
-                                                  AVDISCARD_NONREF );
-        }
+    }
+    if( !b_need_output_picture )
+    {
+        p_context->skip_frame = __MAX( p_context->skip_frame,
+                                              AVDISCARD_NONREF );
     }

     /*


Scratch that

Scratch that

--- Cerberus.h
+++ Cerberus.h
@@ -30,35 +30,27 @@
     tmp[i] = U(Rt[i]);
   }

-  TransformationMatrixToAngleAxisAndTranslation(tmp, result);
-}
-
-template <typename T> void TransformationMatrixToAngleAxisAndTranslation(T *Rt, T *result) {
-  RotationMatrixToAngleAxis<T>(MatrixAdapter<const T, 4, 1>(Rt), result);
-  result[3] = Rt[3];
-  result[4] = Rt[7];
-  result[5] = Rt[11];
+  RotationMatrixToAngleAxis<U>(MatrixAdapter<const U, 4, 1>(tmp), result);
+  result[3] = tmp[3];
+  result[4] = tmp[7];
+  result[5] = tmp[11];
 }

 // At is a 6-dimensional vector with first three terms representing axis,
 // magnitude angle, and the last three terms represent translation. Rt is a
-// 4x3 transformation matrix of the form [R|t]. Two typenames because Ceres
-// requires doubles.
+// 4x3 transformation matrix of the form [R|t]. Two typenames
+// because Ceres requires doubles.
 template <typename T, typename U> void AngleAxisAndTranslationToTransformationMatrix(const U *At, T *result) {
   U tmp[12];

-  AngleAxisAndTranslationToTransformationMatrix(At, tmp);
+  AngleAxisToRotationMatrix<U>(At, MatrixAdapter<U, 4, 1>(tmp));
+  tmp[3] = At[3];
+  tmp[7] = At[4];
+  tmp[11] = At[5];

   for (int i = 0; i < 12; i++) {
     result[i] = T(tmp[i]);
   }
 }

-template <typename T> void AngleAxisAndTranslationToTransformationMatrix(const T *At, T *result) {
-  AngleAxisToRotationMatrix<T>(At, MatrixAdapter<T, 4, 1>(result));
-  result[3] = At[3];
-  result[7] = At[4];
-  result[11] = At[5];
-}
-
 #endif


Bug fix in clausifyAs.

Bug fix in clausifyAs.

--- Clausify.h
+++ Clausify.h
@@ -182,7 +182,9 @@

     void clausifyAs    (Sig  x, Lit a){ clausifyAs(gate(x), a ^ sign(x)); }
     void clausifyAs    (Gate g, Lit a){
-        // This is a naive implementation:
+        vmap         .growTo(circ.lastGate(), lit_Undef);
+        clausify_mark.growTo(circ.lastGate(), mark_undef);
+
         if (clausify_mark[g] == mark_done){
             Lit b = clausify(g);
             solver.addClause(~a,  b);


Fixed a bug where writing to NR52 affected channels 1 and 2’s duty pattern in DMG mode. Fixed NR43 being written to NR44 as well.

--- Core/apu.c
+++ Core/apu.c
@@ -423,13 +423,15 @@
                 }
                 memset(&gb->apu, 0, sizeof(gb->apu));
                 memset(gb->io_registers + GB_IO_NR10, 0, GB_IO_WAV_START - GB_IO_NR10);
+                old_nrx1[0] &= 0x3F;
+                old_nrx1[1] &= 0x3F;

                 gb->apu.global_enable = false;
             }

             if (!gb->is_cgb && (value & 0x80)) {
-                GB_apu_write(gb, GB_IO_NR11, old_nrx1[0] & 0x3F);
-                GB_apu_write(gb, GB_IO_NR21, old_nrx1[1] & 0x3F);
+                GB_apu_write(gb, GB_IO_NR11, old_nrx1[0]);
+                GB_apu_write(gb, GB_IO_NR21, old_nrx1[1]);
                 GB_apu_write(gb, GB_IO_NR31, old_nrx1[2]);
                 GB_apu_write(gb, GB_IO_NR41, old_nrx1[3]);
             }
@@ -638,6 +640,7 @@
                due to how the frequency is actually calculated in the noise channel, which is probably
                not by calculating the effective sample length and counting simiarly to the other channels.
                This is not emulated correctly. */
+            break;
         }

         case GB_IO_NR44: {


Removed duplicate includes

Removed duplicate includes

--- Middlewares/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
+++ Middlewares/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
@@ -59,9 +59,7 @@
  */

 #include "usbd_cdc.h"
-#include "usbd_desc.h"
 #include "usbd_ctlreq.h"
-#include "usbd_conf.h"

 /** @addtogroup STM32_USB_DEVICE_LIBRARY
  * @{ */


BUG: Dropped OffsetTable assumptions from ShapedImageNeighborhoodRange

Bradley Lowekamp informed me that the assumption made in
ShapedImageNeighborhoodRange that image.GetOffsetTable()[0] is always
1 is wrong: It is a violation of the data model of ITK.
https://discourse.itk.org/t/is-image-getoffsettable-0-always-equal-to-1/893/2
Moreover, the range class also assumes that offsetTable[i] >= 0, for
unsigned i < ImageDimension, and that offsetTable[1] == imageSize[0].
These two assumptions may also be false.

This commit drops all these assumptions. It removes the asserts and
the performance optimizations that are based on these assumptions.
It declares m_OffsetTable as OffsetType, instead of using
std::array<ImageSizeValueType, ImageDimension>, and adapts
operator*() to take into account 'offsetTable[0]', without assuming
that it's always equal to 1.

With this commit, operator*() also has some style improvements,
including a rename of its private helper function, GetClampedIndex.

Unfortunately, this commit may cause a significant performance drop.
Using MSVC2015, a ~15% increase of runtime duration was observed on
a HoughTransform2DCirclesImageFilter::Update() call.

Change-Id: Iebfb0326aeeabfffcdc27e70f34b84a86229e2a6

--- Modules/Core/Common/include/itkShapedImageNeighborhoodRange.h
+++ Modules/Core/Common/include/itkShapedImageNeighborhoodRange.h
@@ -19,7 +19,6 @@
 #ifndef itkShapedImageNeighborhoodRange_h
 #define itkShapedImageNeighborhoodRange_h

-#include <array>
 #include <algorithm> // For copy_n.
 #include <cassert>
 #include <cstddef> // For ptrdiff_t.
@@ -319,7 +318,7 @@
     ImageSizeType m_ImageSize;

     // A copy of the offset table of the image.
-    std::array<ImageSizeValueType, ImageDimension> m_OffsetTable;
+    OffsetType m_OffsetTable;

     // A reference to the accessor of the image.
     const NeighborhoodAccessorFunctorType& m_NeighborhoodAccessor;
@@ -331,7 +330,9 @@
     const OffsetType* m_CurrentOffset;

     // Clamps the index between [0 .. imageSizeValue>
-    static IndexValueType GetClampedIndex(const IndexValueType indexValue, const ImageSizeValueType imageSizeValue) ITK_NOEXCEPT
+    static IndexValueType GetClampedIndexValue(
+      const IndexValueType indexValue,
+      const ImageSizeValueType imageSizeValue) ITK_NOEXCEPT
     {
       return (indexValue <= 0) ? 0 :
         (static_cast<ImageSizeValueType>(indexValue) < imageSizeValue) ? indexValue : static_cast<IndexValueType>(imageSizeValue - 1);
@@ -342,7 +343,7 @@
     QualifiedIterator(
       QualifiedInternalPixelType* const imageBufferPointer,
       const ImageSizeType& imageSize,
-      const std::array<ImageSizeValueType, ImageDimension>& offsetTable,
+      const OffsetType& offsetTable,
       const NeighborhoodAccessorFunctorType& neighborhoodAccessor,
       const IndexType& location,
       const OffsetType* const offset) ITK_NOEXCEPT
@@ -357,8 +358,6 @@
     m_CurrentOffset{offset}
     {
       assert(m_ImageBufferPointer != nullptr);
-      assert(offsetTable.front() == 1);
-      assert((ImageDimension == 1) || (static_cast<ImageSizeValueType>(offsetTable[1]) == m_ImageSize[0]));
     }

   public:
@@ -388,14 +387,15 @@
     reference operator*() const ITK_NOEXCEPT
     {
       const OffsetType currentOffset = (*m_CurrentOffset);
-      auto* result = m_ImageBufferPointer + GetClampedIndex(currentOffset[0] + m_Location[0], m_ImageSize[0]);
-
-      for (ImageDimensionType i = 1; i < ImageDimension; ++i)
+      QualifiedInternalPixelType* internalPixelPointer = m_ImageBufferPointer;
+
+      for (ImageDimensionType i = 0; i < ImageDimension; ++i)
       {
-        result += GetClampedIndex(currentOffset[i] + m_Location[i], m_ImageSize[i]) * m_OffsetTable[i];
+        internalPixelPointer += m_OffsetTable[i] *
+          GetClampedIndexValue(currentOffset[i] + m_Location[i], m_ImageSize[i]);
       }

-      return reference(result, m_NeighborhoodAccessor);
+      return reference(internalPixelPointer, m_NeighborhoodAccessor);
     }

@@ -491,7 +491,7 @@
   ImageSizeType m_ImageSize;

   // A copy of the offset table of the image.
-  std::array<ImageSizeValueType, ImageDimension> m_OffsetTable;
+  OffsetType m_OffsetTable;

   NeighborhoodAccessorFunctorType m_NeighborhoodAccessor;

@@ -532,8 +532,7 @@
   {
     assert(m_ImageBufferPointer != nullptr);
     const OffsetValueType* const offsetTable = image.GetOffsetTable();
-    assert((offsetTable != nullptr) && (offsetTable[0] == 1));
-    assert((ImageDimension == 1) || ( static_cast<ImageSizeValueType>(offsetTable[1]) == m_ImageSize[0] ));
+    assert(offsetTable != nullptr);

     std::copy_n(offsetTable, ImageDimension, m_OffsetTable.begin());


ENH: Add helper macro to log scope entry and exit

error: pathspec 'Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h' did not match any file(s) known to git

--- Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h
+++ Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h
@@ -0,0 +1,59 @@
+//----------------------------------------------------------------------------
+//
+// "Copyright Centre National d'Etudes Spatiales"
+//
+// License:  LGPL-2
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+
+#ifndef ossimTraceHelpers_h
+#define ossimTraceHelpers_h
+
+#include <ossim/base/ossimTrace.h>
+#include <ossim/base/ossimNotify.h>
+
+namespace ossimplugins {
+   /** Helper class to log automatically entering and leaving scopes.
+    * @warning Not meant to be used directly. Use \c SCOPED_LOG instead.
+    */
+   struct ScopedLogger
+   {
+      ScopedLogger(ossimTrace & channel, char const* module, ossimNotifyLevel level = ossimNotifyLevel_DEBUG)
+         : m_channel(channel)
+         , MODULE(module)
+         {
+            if (m_channel()) {
+               ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
+            }
+         }
+
+      ~ScopedLogger() {
+         if (m_channel()) {
+            ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " left...\n";
+         }
+      }
+   private:
+      ScopedLogger(ScopedLogger const&);
+      ScopedLogger& operator=(ScopedLogger const&);
+
+      ossimTrace & m_channel;
+      char const* MODULE;
+   };
+
+
+#define SCOPED_LOG(channel, msg) \
+   SCOPED_LOG_NAME(__LINE__)(channel, msg)
+
+#define SCOPED_LOG_NAME(x) \
+   SCOPED_LOG_NAME0(x)
+
+#define SCOPED_LOG_NAME0(x) \
+   ossimplugins::ScopedLogger slog ## x
+} // ossimplugins namespace
+
+
+#endif // ossimTraceHelpers_h


no message

no message

--- firmware/SocketIOClient.h
+++ firmware/SocketIOClient.h
@@ -26,6 +26,9 @@
 	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 	OTHER DEALINGS IN THE SOFTWARE.
 */
+#ifndef SOCKETIOCLIENT_H
+#define SOCKETIOCLIENT_H
+

 #include "spark_wiring_tcpclient.h"

@@ -59,3 +62,5 @@
 		bool waitForInput(void);
 		void eatHeader(void);
 };
+
+#endif


cambiar el periodo del PWM a 10 ciclos de la red

--- firmware/horno/inc/init.h
+++ firmware/horno/inc/init.h
@@ -18,7 +18,7 @@
 #define ADC_LM35 ADC_CH6     // ADC LM35
 #define PERIODO_MUESTREO 100 // muestreo del ADC en ms
 #define PERIODO_PROMEDIO 1   // muestreo total en seg (tiempo promediando)
-#define PWM_PERIODO 500      // periodo del PWM en ms
+#define PWM_PERIODO 200      // periodo del PWM en ms

 void Horno_Init (void);


Add more assertions to move operators

Add more assertions to move operators

--- demo/VulkanRenderer.h
+++ demo/VulkanRenderer.h
@@ -81,6 +81,9 @@
 	}

 	Buffer &operator=(Buffer &&other) {
+		assert(!buffer);
+		assert(!memory);
+
 		buffer                = other.buffer;
 		ringBufferAlloc       = other.ringBufferAlloc;
 		memory                = other.memory;
@@ -135,6 +138,8 @@
 	}

 	DescriptorSetLayout &operator=(DescriptorSetLayout &&other) {
+		assert(!layout);
+
 		layout       = other.layout;
 		descriptors  = std::move(other.descriptors);

@@ -166,6 +171,8 @@
 	}

 	VertexShader &operator=(VertexShader &&other) {
+		assert(!shaderModule);
+
 		shaderModule       = other.shaderModule;
 		other.shaderModule = vk::ShaderModule();


i965: Declare read-only input to level/layer check const

Signed-off-by: Topi Pohjolainen <749697f19798b7f640b17221fd283b903825f071@intel.com>
Reviewed-by: Jason Ekstrand <68c46a606457643eab92053c1c05574abb26f861@jlekstrand.net>

--- src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -805,7 +805,7 @@

 /** \brief Assert that the level and layer are valid for the miptree. */
 static inline void
-intel_miptree_check_level_layer(struct intel_mipmap_tree *mt,
+intel_miptree_check_level_layer(const struct intel_mipmap_tree *mt,
                                 uint32_t level,
                                 uint32_t layer)
 {


debugger: Remove obsolete TODO comment.

debugger: Remove obsolete TODO comment.

std::string usage was already replaced by SkString.

R=chudy@google.com, tomhudson@google.com

Review URL: https://codereview.appspot.com/6596043

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@5738 2bbb7eff-a529-9590-31e7-b0007b416f81

--- debugger/SkObjectParser.h
+++ debugger/SkObjectParser.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2012 Google Inc.
  *
@@ -6,17 +5,16 @@
  * found in the LICENSE file.
  */

-
 #ifndef SKOBJECTPARSER_H_
 #define SKOBJECTPARSER_H_

 #include "SkCanvas.h"
 #include "SkString.h"
+
 /** \class SkObjectParser

     The ObjectParser is used to return string information about parameters
     in each draw command.
-    TODO(chudy): Change std::string to SkString
  */
 class SkObjectParser {
 public:


Security: fix Lua struct package offset handling.

After the first fix to the struct package I found another similar
problem, which is fixed by this patch. It could be reproduced easily by
running the following script:

    return struct.unpack('f', "xxxxxxxxxxxxx",-3)

The above will access bytes before the 'data' pointer.

--- deps/lua/src/lua_struct.c
+++ deps/lua/src/lua_struct.c
@@ -293,14 +293,18 @@
   const char *fmt = luaL_checkstring(L, 1);
   size_t ld;
   const char *data = luaL_checklstring(L, 2, &ld);
-  size_t pos = luaL_optinteger(L, 3, 1) - 1;
+  size_t pos = luaL_optinteger(L, 3, 1);
+  luaL_argcheck(L, pos > 0, 3, "offset must be 1 or greater");
+  pos--; /* Lua indexes are 1-based, but here we want 0-based for C
+          * pointer math. */
   int n = 0;  /* number of results */
   defaultoptions(&h);
   while (*fmt) {
     int opt = *fmt++;
     size_t size = optsize(L, opt, &fmt);
     pos += gettoalign(pos, &h, opt, size);
-    luaL_argcheck(L, pos+size <= ld, 2, "data string too short");
+    luaL_argcheck(L, size <= ld && pos <= ld - size,
+                   2, "data string too short");
     /* stack space for item + next position */
     luaL_checkstack(L, 2, "too many results");
     switch (opt) {


bugfix: rpc_port was set to gms_port.

bugfix: rpc_port was set to gms_port.

--- derecho/multicast_group.h
+++ derecho/multicast_group.h
@@ -65,7 +65,7 @@
                   unsigned int window_size = 3,
                   unsigned int timeout_ms = 1,
                   rdmc::send_algorithm type = rdmc::BINOMIAL_SEND,
-                  uint32_t rpc_port = derecho::getConfInt32(CONF_DERECHO_GMS_PORT))
+                  uint32_t rpc_port = derecho::getConfInt32(CONF_DERECHO_RPC_PORT))
             : max_payload_size(max_payload_size),
               sst_max_payload_size(sst_max_payload_size),
               block_size(block_size),
@@ -369,7 +369,7 @@
             uint32_t total_num_subgroups,
             const std::map<subgroup_id_t, SubgroupSettings>& subgroup_settings_by_id,
             const persistence_manager_callbacks_t& _persistence_manager_callbacks,
-            std::vector<char> already_failed = {}, uint32_t rpc_port = derecho::getConfInt32(CONF_DERECHO_GMS_PORT));
+            std::vector<char> already_failed = {}, uint32_t rpc_port = derecho::getConfInt32(CONF_DERECHO_RPC_PORT));

     ~MulticastGroup();


broadcom never ceases to amaze us.  the fifos on their 16550a serial chips are apparently 15 bytes not 16 bytes.  reported to me by the option driver author

--- dev/cardbus/com_cardbus.c
+++ dev/cardbus/com_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com_cardbus.c,v 1.12 2005/06/29 18:22:49 deraadt Exp $ */
+/* $OpenBSD: com_cardbus.c,v 1.13 2005/07/04 18:44:53 deraadt Exp $ */
 /* $NetBSD: com_cardbus.c,v 1.4 2000/04/17 09:21:59 joda Exp $ */

 /*
@@ -86,6 +86,7 @@
 	cardbustag_t		cc_tag;
 	cardbusreg_t		cc_reg;
 	int			cc_type;
+	u_char			cc_bug;
 };

 #define DEVNAME(CSC) ((CSC)->cc_com.sc_dev.dv_xname)
@@ -100,7 +101,7 @@
 struct csdev *com_cardbus_find_csdev(struct cardbus_attach_args *);
 int	com_cardbus_gofigure(struct cardbus_attach_args *,
     struct com_cardbus_softc *);
-void	com_cardbus_attach2(struct com_softc *);
+void	com_cardbus_attach2(struct com_softc *, u_char);

 #if NCOM_CARDBUS
 struct cfattach com_cardbus_ca = {
@@ -114,11 +115,14 @@
 };
 #endif

+#define BUG_BROADCOM	0x01
+
 static struct csdev {
-	int		vendor;
-	int		product;
+	u_short		vendor;
+	u_short		product;
 	cardbusreg_t	reg;
-	int		type;
+	u_char		type;
+	u_char		bug;
 } csdevs[] = {
 	{ PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_MODEM56,
 	  CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
@@ -131,7 +135,7 @@
 	{ PCI_VENDOR_3COM, PCI_PRODUCT_3COM_GLOBALMODEM56,
 	  CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
 	{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_SERIAL,
-	  CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO }
+	  CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO, BUG_BROADCOM }
 };

 static const int ncsdevs = sizeof(csdevs) / sizeof(csdevs[0]);
@@ -163,7 +167,7 @@
 	    (ca->ca_cis.funce.serial.uart_type == 0 ||	/* 8250 */
 	    ca->ca_cis.funce.serial.uart_type == 1 ||	/* 16450 */
 	    ca->ca_cis.funce.serial.uart_type == 2))	/* 16550 */
-	    return (1);
+		return (1);

 	return (0);
 }
@@ -181,6 +185,7 @@
 	if (cp != NULL) {
 		csc->cc_reg = cp->reg;
 		csc->cc_type = cp->type;
+		csc->cc_bug = cp->bug;
 		return (0);
 	}

@@ -285,7 +290,7 @@
 	if (com_cardbus_enable(sc))
 		printf(": function enable failed\n");
 	sc->enabled = 1;
-	com_cardbus_attach2(sc);
+	com_cardbus_attach2(sc, csc->cc_bug);
 }

 void
@@ -383,8 +388,7 @@
  * XXX This should be handled by a generic attach
  */
 void
-com_cardbus_attach2(sc)
-	struct com_softc *sc;
+com_cardbus_attach2(struct com_softc *sc, u_char bug)
 {
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
@@ -492,6 +496,12 @@
 		printf("ns16550, no working fifo\n");
 		break;
 	case COM_UART_16550A:
+		if (bug & BUG_BROADCOM) {
+			printf("Broadcom ns16550a, 15 byte fifo\n");
+			SET(sc->sc_hwflags, COM_HW_FIFO);
+			sc->sc_fifolen = 15;
+			break;
+		}
 		printf("ns16550a, 16 byte fifo\n");
 		SET(sc->sc_hwflags, COM_HW_FIFO);
 		sc->sc_fifolen = 16;


hungarian keymap; from thuglife@bsd.hu

hungarian keymap; from thuglife@bsd.hu

--- dev/pckbc/wskbdmap_mfii.c
+++ dev/pckbc/wskbdmap_mfii.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: wskbdmap_mfii.c,v 1.21 2003/01/04 13:40:08 maja Exp $ */
+/*	$OpenBSD: wskbdmap_mfii.c,v 1.22 2003/09/25 23:38:23 mickey Exp $ */
 /*	$NetBSD: wskbdmap_mfii.c,v 1.15 2000/05/19 16:40:04 drochner Exp $	*/

 /*-
@@ -793,6 +793,46 @@
     KC(184), KS_Mode_switch,	KS_Multi_key,
 };

+static const keysym_t pckbd_keydesc_hu[] = {
+/*  pos      normal		shifted		altgr		shift-altgr */
+    KC(2),   KS_1,		KS_apostrophe,	KS_asciitilde,
+    KC(3),   KS_2,		KS_quotedbl,
+    KC(4),   KS_3,		KS_plus,	KS_asciicircum,
+    KC(5),   KS_4,		KS_exclam,
+    KC(6),   KS_5,		KS_percent,
+    KC(7),   KS_6,		KS_slash,
+    KC(8),   KS_7,		KS_equal,KS_grave,
+    KC(9),   KS_8,		KS_parenleft,
+    KC(10),  KS_9,		KS_parenright,	KS_acute,
+    KC(11),  KS_odiaeresis,	KS_Odiaeresis,
+    KC(12),  KS_udiaeresis,	KS_Udiaeresis,
+    KC(13),  KS_oacute,		KS_Oacute,
+    KC(16),  KS_q,		KS_Q,		KS_backslash,
+    KC(17),  KS_w,		KS_W,KS_bar,
+    KC(21),  KS_z,		KS_Z,
+    KC(23),  KS_i,		KS_I,		KS_iacute,
+    KC(26),  KS_odoubleacute,	KS_Odoubleacute,	KS_division,
+    KC(27),  KS_uacute,		KS_Uacute,	KS_multiply,
+    KC(33),  KS_f,		KS_F,		KS_bracketleft,
+    KC(34),  KS_g,		KS_G,		KS_bracketright,
+    KC(36),  KS_j,		KS_J,		KS_iacute,
+    KC(39),  KS_eacute,		KS_Eacute,	KS_dollar,
+    KC(40),  KS_aacute,		KS_Aacute,	KS_ssharp,
+    KC(41),  KS_0,		KS_section,
+    KC(43),  KS_udoubleacute,	KS_Udoubleacute,	KS_currency,
+    KC(44),  KS_y,		KS_Y,		KS_greater,
+    KC(45),  KS_x,		KS_X,		KS_numbersign,
+    KC(46),  KS_c,		KS_C,		KS_ampersand,
+    KC(47),  KS_v,		KS_V,		KS_at,
+    KC(48),  KS_b,		KS_B,		KS_braceleft,
+    KC(49),  KS_n,		KS_N,		KS_braceright,
+    KC(51),  KS_comma,		KS_question,	KS_semicolon,
+    KC(52),  KS_period,		KS_colon,
+    KC(53),  KS_minus,		KS_underscore,	KS_asterisk,
+    KC(86),  KS_iacute,		KS_Iacute,	KS_less,
+    KC(184), KS_Mode_switch,	KS_Multi_key,
+};
+
 #define KBD_MAP(name, base, map) \
 			{ name, base, sizeof(map)/sizeof(keysym_t), map }

@@ -836,6 +876,7 @@
 	KBD_MAP(KB_TR,			KB_US,	pckbd_keydesc_tr),
 	KBD_MAP(KB_TR | KB_NODEAD,	KB_TR,	pckbd_keydesc_tr_nodead),
 	KBD_MAP(KB_PL,			KB_US,	pckbd_keydesc_pl),
+	KBD_MAP(KB_HU,			KB_US,	pckbd_keydesc_hu),
 	{0, 0, 0, 0}
 };


Update LightCullingCompareAtomicCS.h

Update LightCullingCompareAtomicCS.h

--- SOCEngine/SOCEngine/ShaderCodes/LightCullingCompareAtomicCS.h
+++ SOCEngine/SOCEngine/ShaderCodes/LightCullingCompareAtomicCS.h
@@ -18,10 +18,10 @@

 	for(uint sampleIdx=0; sampleIdx<MSAA_SAMPLES_COUNT; ++sampleIdx)
 	{
-		float opaqueDepth			= g_tDepth.Load(uint2(globalIdx.x, globalIdx.y), sampleIdx).x;
+		float opaqueDepth		= g_tDepth.Load(uint2(globalIdx.x, globalIdx.y), sampleIdx).x;
 		float opaqueDepthToView		= InvertProjDepthToView(opaqueDepth);
 #if defined(ENABLE_BLEND)
-		float blendedDepth			= g_tBlendedDepth.Load(uint2(globalIdx.x, globalIdx.y), sampleIdx).x;
+		float blendedDepth		= g_tBlendedDepth.Load(uint2(globalIdx.x, globalIdx.y), sampleIdx).x;
 		float blendedDepthToView	= InvertProjDepthToView(blendedDepth);

 		if(blendedDepth != 0.0f)
@@ -49,11 +49,11 @@
 void CalcDepthBound(uint2 globalIdx)
 {
 	float opaqueDepth		= g_tDepth.Load( uint3(globalIdx.x, globalIdx.y, 0) ).x;
-	float opaqueDepthToView	= InvertProjDepthToView(opaqueDepth);
-	uint opaqueZ = asuint(opaqueDepthToView);
+	float opaqueDepthToView		= InvertProjDepthToView(opaqueDepth);
+	uint opaqueZ			= asuint(opaqueDepthToView);

 #if defined(ENABLE_BLEND)
-	float blendedDepth			= g_tBlendedDepth.Load( uint3(globalIdx.x, globalIdx.y, 0) ).x;
+	float blendedDepth		= g_tBlendedDepth.Load( uint3(globalIdx.x, globalIdx.y, 0) ).x;
 	float blendedDepthToView	= InvertProjDepthToView(blendedDepth);

 	uint blendedZ = asuint(blendedDepthToView);
@@ -83,28 +83,26 @@

 	float4 frustumPlaneNormal[4];
 	{
-		float2 tl =					float2(	(float)(LIGHT_CULLING_TILE_RES * groupIdx.x),
-											(float)(LIGHT_CULLING_TILE_RES * groupIdx.y));
-		float2 br =					float2(	(float)(LIGHT_CULLING_TILE_RES * (groupIdx.x + 1)),
-											(float)(LIGHT_CULLING_TILE_RES * (groupIdx.y + 1)));
-		float2 totalThreadLength =	float2(	(float)(LIGHT_CULLING_TILE_RES * GetNumTilesX()),
-											(float)(LIGHT_CULLING_TILE_RES * GetNumTilesY()) );
-											//ũ ȼ  ص ,
-											// ư ü x  ?
-
+		float2 tl =			float2(	(float)(LIGHT_CULLING_TILE_RES * groupIdx.x),
+							(float)(LIGHT_CULLING_TILE_RES * groupIdx.y));
+		float2 br =			float2(	(float)(LIGHT_CULLING_TILE_RES * (groupIdx.x + 1)),
+							(float)(LIGHT_CULLING_TILE_RES * (groupIdx.y + 1)));
+		float2 totalThreadLength =	float2(	(float)(LIGHT_CULLING_TILE_RES * GetNumTilesX()),	//스크린 픽셀 사이즈라 생각해도 좋고,
+							(float)(LIGHT_CULLING_TILE_RES * GetNumTilesY()) );	//현재 돌아가는 전체 가로x세로 스레드 수?
+
 		float4 frustum[4];
 		frustum[0] = ProjToView( float4( tl.x / totalThreadLength.x * 2.f - 1.f,
-												(totalThreadLength.y - tl.y) / totalThreadLength.y * 2.f - 1.f,
-												1.f, 1.f) ); //TL
+					(totalThreadLength.y - tl.y) / totalThreadLength.y * 2.f - 1.f,
+					1.f, 1.f) ); //TL
 		frustum[1] = ProjToView( float4( br.x / totalThreadLength.x * 2.f - 1.f,
-												(totalThreadLength.y - tl.y) / totalThreadLength.y * 2.f - 1.f,
-												1.f, 1.f) ); //TR
+					(totalThreadLength.y - tl.y) / totalThreadLength.y * 2.f - 1.f,
+					1.f, 1.f) ); //TR
 		frustum[2] = ProjToView( float4( br.x / totalThreadLength.x * 2.f - 1.f,
-												(totalThreadLength.y - br.y) / totalThreadLength.y * 2.f - 1.f,
-												1.f, 1.f) ); //BR
+					(totalThreadLength.y - br.y) / totalThreadLength.y * 2.f - 1.f,
+					1.f, 1.f) ); //BR
 		frustum[3] = ProjToView( float4( tl.x / totalThreadLength.x * 2.f - 1.f,
-												(totalThreadLength.y - br.y) / totalThreadLength.y * 2.f - 1.f,
-												1.f, 1.f) ); //BL
+					(totalThreadLength.y - br.y) / totalThreadLength.y * 2.f - 1.f,
+					1.f, 1.f) ); //BL

 		for(uint i=0; i<4; ++i)
 			frustumPlaneNormal[i] = CreatePlaneNormal(frustum[i], frustum[(i+1) & 3]);
@@ -125,14 +123,14 @@
 	uint pointLightCount = GetNumOfPointLight(tbrParam_packedNumOfLights);
     for(uint pointLightIdx=idxInTile; pointLightIdx<pointLightCount; pointLightIdx+=THREAD_COUNT)
     {
-		float4 center = g_inputPointLightTransformBuffer[pointLightIdx];
-		float r = center.w;
+		float4 center	= g_inputPointLightTransformBuffer[pointLightIdx];
+		float r		= center.w;

-		center.xyz = mul( float4(center.xyz, 1), tbrParam_viewMat ).xyz;
+		center.xy	= mul( float4(center.xyz, 1), tbrParam_viewMat ).xyz;

 		if( ((-center.z + minZ) < r) && ((center.z - maxZ) < r) )
 		{
-			if( InFrustum(center, frustumPlaneNormal[0], r) &&
+			if( 	InFrustum(center, frustumPlaneNormal[0], r) &&
 				InFrustum(center, frustumPlaneNormal[1], r) &&
 				InFrustum(center, frustumPlaneNormal[2], r) &&
 				InFrustum(center, frustumPlaneNormal[3], r) )
@@ -147,20 +145,20 @@

 	GroupMemoryBarrierWithGroupSync();

-	outPointLightCountInTile = s_lightIndexCounter;
-	uint pointLightCountInTile = s_lightIndexCounter;
+	outPointLightCountInTile	= s_lightIndexCounter;
+	uint pointLightCountInTile	= s_lightIndexCounter;

 	uint spotLightCount = GetNumOfSpotLight(tbrParam_packedNumOfLights);
 	for(uint spotLightIdx=idxInTile; spotLightIdx<spotLightCount; spotLightIdx+=THREAD_COUNT)
 	{
-		float4 center = g_inputSpotLightTransformBuffer[spotLightIdx];
-		float r = center.w;
+		float4 center	= g_inputSpotLightTransformBuffer[spotLightIdx];
+		float r		= center.w;

-		center.xyz = mul( float4(center.xyz, 1), tbrParam_viewMat ).xyz;
+		center.xyz	= mul( float4(center.xyz, 1), tbrParam_viewMat ).xyz;

 		if( ((-center.z + minZ) < r) && ((center.z - maxZ) < r) )
 		{
-			if( InFrustum(center, frustumPlaneNormal[0], r) &&
+			if(	InFrustum(center, frustumPlaneNormal[0], r) &&
 				InFrustum(center, frustumPlaneNormal[1], r) &&
 				InFrustum(center, frustumPlaneNormal[2], r) &&
 				InFrustum(center, frustumPlaneNormal[3], r) )
@@ -180,4 +178,4 @@
 #endif
 }

-#endif+#endif


ambicom ethernet address is in rom; 00107A==Ambicom sez hugh

--- dev/pcmcia/if_ne_pcmcia.c
+++ dev/pcmcia/if_ne_pcmcia.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_ne_pcmcia.c,v 1.13 1999/08/13 21:10:48 deraadt Exp $	*/
+/*	$OpenBSD: if_ne_pcmcia.c,v 1.14 1999/08/15 05:32:13 deraadt Exp $	*/
 /*	$NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $	*/

 /*
@@ -138,7 +138,7 @@
     { PCMCIA_STR_AMBICOM_AMB8002T,
       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
       PCMCIA_CIS_AMBICOM_AMB8002T,
-      0, 0x7f0, { 0x00, 0x00, 0xb2 } },
+      0, -1, { 0x00, 0x00, 0xb2 } },

     /*
      * You have to add new entries which contains


Missing init of a bus_space_tag

Missing init of a bus_space_tag

--- dev/isa/pcmcia_pcic.c
+++ dev/isa/pcmcia_pcic.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pcmcia_pcic.c,v 1.14 1997/03/01 22:42:58 niklas Exp $	*/
+/*	$OpenBSD: pcmcia_pcic.c,v 1.15 1997/04/16 23:29:28 niklas Exp $	*/

 /*
  *  Copyright (c) 1995, 1996 John T. Kohl
@@ -956,6 +956,7 @@
 	 * Probe the slots for each of the possible child controllers,
 	 * and if any are there we return a positive indication.
 	 */
+	pcic.sc_iot = iot;
 	pcic.sc_ioh = ioh;
 	for (i = 0; i < 2; i++) {
 		bzero(pcic.slot, sizeof(pcic.slot));


Fix duplicate NS_SWIFT_NAME macro (close #603)

--- Snowplow/Internal/NetworkConnection/SPNetworkControllerImpl.h
+++ Snowplow/Internal/NetworkConnection/SPNetworkControllerImpl.h
@@ -26,7 +26,7 @@

 NS_ASSUME_NONNULL_BEGIN

-NS_SWIFT_NAME(NetworkController)
+NS_SWIFT_NAME(NetworkControllerImpl)
 @interface SPNetworkControllerImpl : NSObject <SPNetworkController>

 - (instancetype)initWithEmitter:(SPEmitter *)emitter;


ok- disable the close - seems librsvg in some versions is so buggy you can't
close it to prevent leaks!

git-svn-id: de1cbd220ac9a29ed59a7cc342d87cbce0beeb96@28571 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/modules/loaders/svg/evas_image_load_svg.c
+++ src/modules/loaders/svg/evas_image_load_svg.c
@@ -86,7 +86,7 @@
 	im->image = evas_common_image_surface_new(im);
 	if (!im->image)
 	  {
-	     rsvg_handle_close(rsvg, NULL);
+//	     rsvg_handle_close(rsvg, NULL);
 	     g_object_unref(rsvg);
 //	     rsvg_handle_free(rsvg);
 	     chdir(pcwd);
@@ -101,7 +101,7 @@
      {
 	evas_common_image_surface_free(im->image);
 	im->image = NULL;
-	rsvg_handle_close(rsvg, NULL);
+//	rsvg_handle_close(rsvg, NULL);
 	g_object_unref(rsvg);
 //	rsvg_handle_free(rsvg);
 	chdir(pcwd);
@@ -137,7 +137,7 @@
    im->image->w = w;
    im->image->h = h;
    im->flags |= RGBA_IMAGE_HAS_ALPHA;
-   rsvg_handle_close(rsvg, NULL);
+//   rsvg_handle_close(rsvg, NULL);
    g_object_unref(rsvg);
 //   rsvg_handle_free(rsvg);
    chdir(pcwd);
@@ -203,7 +203,7 @@
      {
 	evas_common_image_surface_free(im->image);
 	im->image = NULL;
-	rsvg_handle_close(rsvg, NULL);
+//	rsvg_handle_close(rsvg, NULL);
 	g_object_unref(rsvg);
 //	rsvg_handle_free(rsvg);
 	chdir(pcwd);
@@ -244,7 +244,7 @@
      {
 	evas_common_image_surface_free(im->image);
 	im->image = NULL;
-	rsvg_handle_close(rsvg, NULL);
+//	rsvg_handle_close(rsvg, NULL);
 	g_object_unref(rsvg);
 //	rsvg_handle_free(rsvg);
 	chdir(pcwd);
@@ -259,7 +259,7 @@
      {
 	evas_common_image_surface_free(im->image);
 	im->image = NULL;
-	rsvg_handle_close(rsvg, NULL);
+//	rsvg_handle_close(rsvg, NULL);
 	g_object_unref(rsvg);
 //	rsvg_handle_free(rsvg);
 	chdir(pcwd);
@@ -271,7 +271,7 @@
 	cairo_surface_destroy(surface);
 	evas_common_image_surface_free(im->image);
 	im->image = NULL;
-	rsvg_handle_close(rsvg, NULL);
+//	rsvg_handle_close(rsvg, NULL);
 	g_object_unref(rsvg);
 //	rsvg_handle_free(rsvg);
 	chdir(pcwd);
@@ -285,7 +285,7 @@
    cairo_surface_destroy(surface);
    /* need to check if this is required... */
    cairo_destroy(cr);
-   rsvg_handle_close(rsvg, NULL);
+//   rsvg_handle_close(rsvg, NULL);
    g_object_unref(rsvg);
 //   rsvg_handle_free(rsvg);
    chdir(pcwd);


gtk-demo: Adapt textview example for stipple removal

--- demos/gtk-demo/textview.c
+++ demos/gtk-demo/textview.c
@@ -14,17 +14,9 @@

 static void easter_egg_callback (GtkWidget *button, gpointer data);

-#define gray50_width 2
-#define gray50_height 2
-static char gray50_bits[] = {
-  0x02, 0x01
-};
-
 static void
 create_tags (GtkTextBuffer *buffer)
 {
-  GdkBitmap *stipple;
-
   /* Create a bunch of tags. Note that it's also possible to
    * create tags with gtk_text_tag_new() then add them to the
    * tag table for the buffer, gtk_text_buffer_create_tag() is
@@ -74,18 +66,6 @@
   gtk_text_buffer_create_tag (buffer, "red_background",
 			      "background", "red", NULL);

-  stipple = gdk_bitmap_create_from_data (NULL,
-					 gray50_bits, gray50_width,
-					 gray50_height);
-
-  gtk_text_buffer_create_tag (buffer, "background_stipple",
-			      "background_stipple", stipple, NULL);
-
-  gtk_text_buffer_create_tag (buffer, "foreground_stipple",
-			      "foreground_stipple", stipple, NULL);
-
-  g_object_unref (stipple);
-
   gtk_text_buffer_create_tag (buffer, "big_gap_before_line",
 			      "pixels_above_lines", 30, NULL);

@@ -227,17 +207,9 @@
 					    "red_background", NULL);
   gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
   gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
-					    "a stippled red background", -1,
-					    "red_background",
-					    "background_stipple",
-					    NULL);
-
-  gtk_text_buffer_insert (buffer, &iter, " or ", -1);
-  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
-					    "a stippled blue foreground on solid red background", -1,
+					    "a blue foreground on red background", -1,
 					    "blue_foreground",
 					    "red_background",
-					    "foreground_stipple",
 					    NULL);
   gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1);