diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-05-05 20:16:31 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2019-05-06 18:03:16 -0400 |
commit | 5ee9a5d2de4e50552e50247e745f92b61f9784c0 (patch) | |
tree | c366fd2782abc1001845f9a223f3cfe2bd080668 | |
parent | c9f5ccd2e6c301853ebf1595ca12b377a991a095 (diff) | |
download | xorg-lib-libXt-5ee9a5d2de4e50552e50247e745f92b61f9784c0.tar.gz |
fix gcc warnings when assigning into a bit-field by first masking the value
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | include/X11/IntrinsicI.h | 8 | ||||
-rw-r--r-- | src/Convert.c | 10 | ||||
-rw-r--r-- | src/Event.c | 4 | ||||
-rw-r--r-- | src/PassivGrab.c | 14 | ||||
-rw-r--r-- | src/Selection.c | 2 | ||||
-rw-r--r-- | src/TMparse.c | 8 | ||||
-rw-r--r-- | src/TMstate.c | 4 |
7 files changed, 29 insertions, 21 deletions
diff --git a/include/X11/IntrinsicI.h b/include/X11/IntrinsicI.h index 6369aff..d477c1d 100644 --- a/include/X11/IntrinsicI.h +++ b/include/X11/IntrinsicI.h @@ -101,6 +101,14 @@ SOFTWARE. /**************************************************************** * + * Bit utilities + * + ****************************************************************/ +#define XtSetBits(dst,src,len) dst = (((1U << (len)) - 1) & (unsigned)(src)) +#define XtSetBit(dst,src) XtSetBits(dst,src,1) + +/**************************************************************** + * * Byte utilities * ****************************************************************/ diff --git a/src/Convert.c b/src/Convert.c index f9cafe3..5943c3b 100644 --- a/src/Convert.c +++ b/src/Convert.c @@ -216,11 +216,11 @@ void _XtTableAddConverter( p->converter = converter; p->destructor = destructor; p->num_args = (unsigned short) num_args; - p->global = global; + XtSetBit(p->global, global); args = ConvertArgs(p); while (num_args--) *args++ = *convert_args++; - p->new_style = new_style; + XtSetBit(p->new_style, new_style); p->do_ref_count = False; if (destructor || (cache_type & 0xff)) { p->cache_type = (char) (cache_type & 0xff); @@ -383,9 +383,9 @@ CacheEnter( } if (!to->addr) succeeded = False; - p->conversion_succeeded = succeeded; - p->is_refcounted = do_ref; - p->must_be_freed = do_free; + XtSetBit(p->conversion_succeeded, succeeded); + XtSetBit(p->is_refcounted, do_ref); + XtSetBit(p->must_be_freed, do_free); p->next = *pHashEntry; if (p->next && p->next->has_ext) CEXT(p->next)->prev = &p->next; diff --git a/src/Event.c b/src/Event.c index 4fb3c4c..389cf9c 100644 --- a/src/Event.c +++ b/src/Event.c @@ -1457,8 +1457,8 @@ static XtGrabRec *NewGrabRec( gl = XtNew(XtGrabRec); gl->next = NULL; gl->widget = widget; - gl->exclusive = exclusive; - gl->spring_loaded = spring_loaded; + XtSetBit(gl->exclusive, exclusive); + XtSetBit(gl->spring_loaded, spring_loaded); return gl; } diff --git a/src/PassivGrab.c b/src/PassivGrab.c index 42907d9..7d7efdd 100644 --- a/src/PassivGrab.c +++ b/src/PassivGrab.c @@ -166,11 +166,11 @@ static XtServerGrabPtr CreateGrab( : 0)); grab->next = NULL; grab->widget = widget; - grab->ownerEvents = ownerEvents; - grab->pointerMode = pointer_mode; - grab->keyboardMode = keyboard_mode; + XtSetBit(grab->ownerEvents, ownerEvents); + XtSetBit(grab->pointerMode, pointer_mode); + XtSetBit(grab->keyboardMode, keyboard_mode); grab->eventMask = event_mask; - grab->hasExt = need_ext; + XtSetBit(grab->hasExt, need_ext); grab->confineToIsWidgetWin = (XtWindow (widget) == confine_to); grab->modifiers = (unsigned short) modifiers; grab->keybut = keybut; @@ -928,9 +928,9 @@ static int GrabDevice ( device->grab.widget = widget; device->grab.modifiers = 0; device->grab.keybut = 0; - device->grab.ownerEvents = owner_events; - device->grab.pointerMode = pointer_mode; - device->grab.keyboardMode = keyboard_mode; + XtSetBit(device->grab.ownerEvents, owner_events); + XtSetBit(device->grab.pointerMode, pointer_mode); + XtSetBit(device->grab.keyboardMode, keyboard_mode); device->grab.hasExt = False; device->grabType = XtActiveServerGrab; pdi->activatingKey = (KeyCode)0; diff --git a/src/Selection.c b/src/Selection.c index 9af6b08..1051115 100644 --- a/src/Selection.c +++ b/src/Selection.c @@ -961,7 +961,7 @@ static Boolean OwnSelection( ctx->loses = lose; ctx->notify = notify; ctx->owner_cancel = cancel; - ctx->incremental = incremental; + XtSetBit(ctx->incremental, incremental); ctx->owner_closure = closure; ctx->was_disowned = FALSE; diff --git a/src/TMparse.c b/src/TMparse.c index d0c8ce7..2fc1e18 100644 --- a/src/TMparse.c +++ b/src/TMparse.c @@ -554,13 +554,13 @@ static void StoreLateBindings( temp = (LateBindingsPtr)XtRealloc((char *)temp, (unsigned)((count+number+1) * sizeof(LateBindings)) ); *lateBindings = temp; - temp[count].knot = notL; - temp[count].pair = pair; + XtSetBit(temp[count].knot, notL); + XtSetBit(temp[count].pair, pair); if (count == 0) temp[count].ref_count = 1; temp[count++].keysym = keysymL; if (keysymR){ - temp[count].knot = notR; + XtSetBit(temp[count].knot, notR); temp[count].pair = FALSE; temp[count].ref_count = 0; temp[count++].keysym = keysymR; @@ -1916,7 +1916,7 @@ static XtTranslations ParseTranslationTable( parseTree->isSimple = TRUE; parseTree->mappingNotifyInterest = FALSE; - parseTree->isAccelerator = isAccelerator; + XtSetBit(parseTree->isAccelerator, isAccelerator); parseTree->isStackBranchHeads = parseTree->isStackQuarks = parseTree->isStackComplexBranchHeads = TRUE; diff --git a/src/TMstate.c b/src/TMstate.c index f94544e..af74eff 100644 --- a/src/TMstate.c +++ b/src/TMstate.c @@ -1580,7 +1580,7 @@ void _XtAddEventSeqToStateTree( if (eventSeq->event.eventType == MappingNotify) stateTree->mappingNotifyInterest = True; branchHead->hasActions = True; - branchHead->more = eventSeq->actions->idx; + XtSetBits(branchHead->more, eventSeq->actions->idx, 13); FreeActions(eventSeq->actions); eventSeq->actions = NULL; return; @@ -1589,7 +1589,7 @@ void _XtAddEventSeqToStateTree( branchHead->isSimple = False; if (!eventSeq->next) branchHead->hasActions = True; - branchHead->more = GetComplexBranchIndex(stateTree, typeIndex, modIndex); + XtSetBits(branchHead->more, GetComplexBranchIndex(stateTree, typeIndex, modIndex), 13); state = &stateTree->complexBranchHeadTbl[TMBranchMore(branchHead)]; for (;;) { |