diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Alloc.c | 14 | ||||
-rw-r--r-- | src/Callback.c | 56 | ||||
-rw-r--r-- | src/Composite.c | 2 | ||||
-rw-r--r-- | src/Convert.c | 16 | ||||
-rw-r--r-- | src/Converters.c | 40 | ||||
-rw-r--r-- | src/Core.c | 4 | ||||
-rw-r--r-- | src/Create.c | 4 | ||||
-rw-r--r-- | src/Destroy.c | 2 | ||||
-rw-r--r-- | src/Display.c | 26 | ||||
-rw-r--r-- | src/Error.c | 6 | ||||
-rw-r--r-- | src/Event.c | 62 | ||||
-rw-r--r-- | src/EventUtil.c | 4 | ||||
-rw-r--r-- | src/GCManager.c | 8 | ||||
-rw-r--r-- | src/Geometry.c | 12 | ||||
-rw-r--r-- | src/GetResList.c | 8 | ||||
-rw-r--r-- | src/Hooks.c | 2 | ||||
-rw-r--r-- | src/Initialize.c | 32 | ||||
-rw-r--r-- | src/Intrinsic.c | 38 | ||||
-rw-r--r-- | src/Keyboard.c | 16 | ||||
-rw-r--r-- | src/Manage.c | 14 | ||||
-rw-r--r-- | src/NextEvent.c | 36 | ||||
-rw-r--r-- | src/Object.c | 18 | ||||
-rw-r--r-- | src/PassivGrab.c | 14 | ||||
-rw-r--r-- | src/Pointer.c | 4 | ||||
-rw-r--r-- | src/ResConfig.c | 10 | ||||
-rw-r--r-- | src/Resources.c | 46 | ||||
-rw-r--r-- | src/Selection.c | 100 | ||||
-rw-r--r-- | src/SetValues.c | 4 | ||||
-rw-r--r-- | src/Shell.c | 104 | ||||
-rw-r--r-- | src/TMaction.c | 28 | ||||
-rw-r--r-- | src/TMgrab.c | 18 | ||||
-rw-r--r-- | src/TMkey.c | 42 | ||||
-rw-r--r-- | src/TMparse.c | 102 | ||||
-rw-r--r-- | src/TMprint.c | 28 | ||||
-rw-r--r-- | src/TMstate.c | 106 | ||||
-rw-r--r-- | src/Threads.c | 4 | ||||
-rw-r--r-- | src/VarCreate.c | 2 | ||||
-rw-r--r-- | src/Varargs.c | 14 |
38 files changed, 523 insertions, 523 deletions
diff --git a/src/Alloc.c b/src/Alloc.c index 754881b..868af3b 100644 --- a/src/Alloc.c +++ b/src/Alloc.c @@ -143,20 +143,20 @@ Cardinal XtAsprintf( if (len < 0) _XtAllocError("vsnprintf"); - *new_string = XtMalloc(len + 1); /* snprintf doesn't count trailing '\0' */ + *new_string = XtMalloc((Cardinal) len + 1); /* snprintf doesn't count trailing '\0' */ if (len < sizeof(buf)) { - strncpy(*new_string, buf, len); + strncpy(*new_string, buf, (size_t) len); (*new_string)[len] = '\0'; } else { va_start(ap, format); - if (vsnprintf(*new_string, len + 1, format, ap) < 0) + if (vsnprintf(*new_string, (size_t) (len + 1), format, ap) < 0) _XtAllocError("vsnprintf"); va_end(ap); } - return len; + return (Cardinal) len; } @@ -252,7 +252,7 @@ char* _XtHeapAlloc( printf( "allocating large segment (%d bytes) on heap %#x\n", bytes, heap ); #endif - heap_loc = XtMalloc(bytes + sizeof(char*)); + heap_loc = XtMalloc(bytes + (Cardinal) sizeof(char*)); if (heap->start) { *(char**)heap_loc = *(char**)heap->start; *(char**)heap->start = heap_loc; @@ -273,10 +273,10 @@ char* _XtHeapAlloc( heap->current = heap_loc + sizeof(char*); heap->bytes_remaining = HEAP_SEGMENT_SIZE - sizeof(char*); } - bytes = (bytes + (sizeof(long) - 1)) & (~(sizeof(long) - 1)); + bytes = (Cardinal) ((bytes + (sizeof(long) - 1)) & (~(sizeof(long) - 1))); heap_loc = heap->current; heap->current += bytes; - heap->bytes_remaining -= bytes; /* can be negative, if rounded */ + heap->bytes_remaining = (heap->bytes_remaining - (int) bytes); /* can be negative, if rounded */ return heap_loc; } diff --git a/src/Callback.c b/src/Callback.c index 7413da0..5064a6e 100644 --- a/src/Callback.c +++ b/src/Callback.c @@ -122,17 +122,17 @@ void _XtAddCallback( if (icl && icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; icl = (InternalCallbackList) - __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (count + 1)); + __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (count + 1))); (void) memmove((char *)ToList(icl), (char *)ToList(*callbacks), sizeof(XtCallbackRec) * count); } else { icl = (InternalCallbackList) - XtRealloc((char *) icl, sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (count + 1)); + XtRealloc((char *) icl, (Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (count + 1))); } *callbacks = icl; - icl->count = count + 1; + icl->count = (unsigned short) (count + 1); icl->is_padded = 0; icl->call_state = 0; cl = ToList(icl) + count; @@ -208,17 +208,17 @@ static void AddCallbacks( for (j=0, cl = newcallbacks; cl->callback; cl++, j++); if (icl && icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; - icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+j)); + icl = (InternalCallbackList) __XtMalloc((Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i+j))); (void) memmove((char *)ToList(*callbacks), (char *)ToList(icl), - sizeof(XtCallbackRec) * i); + sizeof(XtCallbackRec) * (size_t) i); } else { icl = (InternalCallbackList) XtRealloc((char *) icl, - sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+j)); + (Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i+j))); } *callbacks = icl; - icl->count = i+j; + icl->count = (unsigned short) (i+j); icl->is_padded = 0; icl->call_state = 0; for (cl = ToList(icl) + i; --j >= 0; ) @@ -283,9 +283,9 @@ void _XtRemoveCallback ( j = icl->count - i - 1; ocl = ToList(icl); icl = (InternalCallbackList) - __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i + j)); - icl->count = i + j; + __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i + j))); + icl->count = (unsigned short) (i + j); icl->is_padded = 0; icl->call_state = 0; ncl = ToList(icl); @@ -301,8 +301,8 @@ void _XtRemoveCallback ( while (--i >= 0) *cl++ = *ncl++; icl = (InternalCallbackList) - XtRealloc((char *) icl, sizeof(InternalCallbackRec) - + sizeof(XtCallbackRec) * icl->count); + XtRealloc((char *) icl, (Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * icl->count)); icl->is_padded = 0; *callbacks = icl; } else { @@ -385,9 +385,9 @@ void XtRemoveCallbacks ( cl = ToList(icl); if (icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; - icl = (InternalCallbackList)__XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * i); - icl->count = i; + icl = (InternalCallbackList)__XtMalloc((Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) i)); + icl->count = (unsigned short) i; icl->call_state = 0; } ccl = ToList(icl); @@ -404,7 +404,7 @@ void XtRemoveCallbacks ( } if (icl->count) { icl = (InternalCallbackList) - XtRealloc((char *)icl, (sizeof(InternalCallbackRec) + + XtRealloc((char *)icl, (Cardinal) (sizeof(InternalCallbackRec) + sizeof(XtCallbackRec) * icl->count)); icl->is_padded = 0; *callbacks = icl; @@ -484,9 +484,9 @@ InternalCallbackList _XtCompileCallbackList( for (n=0, xtcl=xtcallbacks; xtcl->callback; n++, xtcl++) {}; if (n == 0) return (InternalCallbackList) NULL; - callbacks = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * n); - callbacks->count = n; + callbacks = (InternalCallbackList) __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) n)); + callbacks->count = (unsigned short) n; callbacks->is_padded = 0; callbacks->call_state = 0; cl = ToList(callbacks); @@ -514,17 +514,17 @@ XtCallbackList _XtGetCallbackList( if (icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; ocl = ToList(icl); - icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+1)); - icl->count = i; + icl = (InternalCallbackList) __XtMalloc((Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i+1))); + icl->count = (unsigned short) i; icl->call_state = 0; cl = ToList(icl); while (--i >= 0) *cl++ = *ocl++; } else { icl = (InternalCallbackList) XtRealloc((char *)icl, - sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+1)); + (Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t)(i+1))); cl = ToList(icl) + i; } icl->is_padded = 1; diff --git a/src/Composite.c b/src/Composite.c index 29893d8..7b6982c 100644 --- a/src/Composite.c +++ b/src/Composite.c @@ -242,7 +242,7 @@ static void CompositeInsertChild( cw->composite.num_slots += (cw->composite.num_slots / 2) + 2; cw->composite.children = children = (WidgetList) XtRealloc((XtPointer) children, - (unsigned) (cw->composite.num_slots) * sizeof(Widget)); + (Cardinal)((unsigned) (cw->composite.num_slots) * sizeof(Widget))); } /* Ripple children up one space from "position" */ for (i = cw->composite.num_children; i > position; i--) { diff --git a/src/Convert.c b/src/Convert.c index 70004da..f9cafe3 100644 --- a/src/Convert.c +++ b/src/Convert.c @@ -207,15 +207,15 @@ void _XtTableAddConverter( XtFree((char *)p); } - p = (ConverterPtr) __XtMalloc(sizeof(ConverterRec) + - sizeof(XtConvertArgRec) * num_args); + p = (ConverterPtr) __XtMalloc((Cardinal)(sizeof(ConverterRec) + + sizeof(XtConvertArgRec) * num_args)); p->next = *pp; *pp = p; p->from = from_type; p->to = to_type; p->converter = converter; p->destructor = destructor; - p->num_args = num_args; + p->num_args = (unsigned short) num_args; p->global = global; args = ConvertArgs(p); while (num_args--) @@ -223,7 +223,7 @@ void _XtTableAddConverter( p->new_style = new_style; p->do_ref_count = False; if (destructor || (cache_type & 0xff)) { - p->cache_type = cache_type & 0xff; + p->cache_type = (char) (cache_type & 0xff); if (cache_type & XtCacheRefCount) p->do_ref_count = True; } else { @@ -367,7 +367,7 @@ CacheEnter( pHashEntry = &cacheHashTable[hash & CACHEHASHMASK]; if ((succeeded && destructor) || do_ref) { - p = (CachePtr) _XtHeapAlloc(heap, (sizeof(CacheRec) + + p = (CachePtr) _XtHeapAlloc(heap, (Cardinal) (sizeof(CacheRec) + sizeof(CacheRecExt) + num_args * sizeof(XrmValue))); CEXT(p)->prev = pHashEntry; @@ -377,7 +377,7 @@ CacheEnter( p->has_ext = True; } else { - p = (CachePtr)_XtHeapAlloc(heap, (sizeof(CacheRec) + + p = (CachePtr)_XtHeapAlloc(heap, (Cardinal) (sizeof(CacheRec) + num_args * sizeof(XrmValue))); p->has_ext = False; } @@ -403,7 +403,7 @@ CacheEnter( p->from.addr = (XPointer)_XtHeapAlloc(heap, from->size); (void) memmove((char *)p->from.addr, (char *)from->addr, from->size); } - p->num_args = num_args; + p->num_args = (unsigned short) num_args; if (num_args) { XrmValue *pargs = CARGS(p); for (i = 0; i < num_args; i++) { @@ -540,7 +540,7 @@ static Boolean ResourceQuarkToOffset( for (i = 0; i < wc->core_class.num_resources; i++, resources++) { res = *resources; if (res->xrm_name == name) { - *offset = -res->xrm_offset - 1; + *offset = (Cardinal) (-res->xrm_offset - 1); return True; } } /* for i in resources */ diff --git a/src/Converters.c b/src/Converters.c index 7020ca8..6798194 100644 --- a/src/Converters.c +++ b/src/Converters.c @@ -144,11 +144,11 @@ void _XtConvertInitialize(void) (char*) fromVal->addr, tstr); \ return False; \ } \ - *(type*)(toVal->addr) = (value); \ + *(type*)(toVal->addr) = (type) (value); \ } \ else { \ static type static_val; \ - static_val = (value); \ + static_val = (type) (value); \ toVal->addr = (XPointer)&static_val; \ } \ toVal->size = sizeof(type); \ @@ -162,11 +162,11 @@ void _XtConvertInitialize(void) toVal->size = sizeof(type); \ return False; \ } \ - *(type*)(toVal->addr) = (value); \ + *(type*)(toVal->addr) = (type) (value); \ } \ else { \ static type static_val; \ - static_val = (value); \ + static_val = (type) (value); \ toVal->addr = (XPointer)&static_val; \ } \ toVal->size = sizeof(type); \ @@ -445,7 +445,7 @@ Boolean XtCvtIntToColor( } screen = *((Screen **) args[0].addr); colormap = *((Colormap *) args[1].addr); - c.pixel = *(int *)fromVal->addr; + c.pixel = (unsigned long) (*(int *)fromVal->addr); XQueryColor(DisplayOfScreen(screen), colormap, &c); done(XColor, c); @@ -1381,18 +1381,18 @@ static int CompareISOLatin1 (const char *first, const char *second) /* try lowercasing and try again */ if ((a >= XK_A) && (a <= XK_Z)) - a += (XK_a - XK_A); + a = (unsigned char) (a + (XK_a - XK_A)); else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis)) - a += (XK_agrave - XK_Agrave); + a = (unsigned char) (a + (XK_agrave - XK_Agrave)); else if ((a >= XK_Ooblique) && (a <= XK_Thorn)) - a += (XK_oslash - XK_Ooblique); + a = (unsigned char) (a + (XK_oslash - XK_Ooblique)); if ((b >= XK_A) && (b <= XK_Z)) - b += (XK_a - XK_A); + b = (unsigned char) (b + (XK_a - XK_A)); else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis)) - b += (XK_agrave - XK_Agrave); + b = (unsigned char) (b + (XK_agrave - XK_Agrave)); else if ((b >= XK_Ooblique) && (b <= XK_Thorn)) - b += (XK_oslash - XK_Ooblique); + b = (unsigned char) (b + (XK_oslash - XK_Ooblique)); if (a != b) break; } @@ -1407,11 +1407,11 @@ static void CopyISOLatin1Lowered(char *dst, const char *src) for ( ; *source; source++, dest++) { if (*source >= XK_A && *source <= XK_Z) - *dest = *source + (XK_a - XK_A); + *dest = (unsigned char) (*source + (XK_a - XK_A)); else if (*source >= XK_Agrave && *source <= XK_Odiaeresis) - *dest = *source + (XK_agrave - XK_Agrave); + *dest = (unsigned char) (*source + (XK_agrave - XK_Agrave)); else if (*source >= XK_Ooblique && *source <= XK_Thorn) - *dest = *source + (XK_oslash - XK_Ooblique); + *dest = (unsigned char) (*source + (XK_oslash - XK_Ooblique)); else *dest = *source; } @@ -1656,10 +1656,10 @@ Boolean XtCvtStringToCommandArgArray( while (*src != '\0' && !IsWhitespace(*src) && !IsNewline(*src)) { if (*src == '\\' && (IsWhitespace(*(src+1)) || IsNewline(*(src+1)))) { - len = src - start; + len = (int) (src - start); if (len) { /* copy preceeding part of token */ - memcpy(dst, start, len); + memcpy(dst, start, (size_t) len); dst += len; } /* skip backslash */ @@ -1669,10 +1669,10 @@ Boolean XtCvtStringToCommandArgArray( } src++; } - len = src - start; + len = (int) (src - start); if (len) { /* copy last part of token */ - memcpy(dst, start, len); + memcpy(dst, start, (size_t) len); dst += len; } *dst = '\0'; @@ -1680,13 +1680,13 @@ Boolean XtCvtStringToCommandArgArray( dst++; } - ptr = strarray = (String*) __XtMalloc((Cardinal)(tokens+1) * sizeof(String)); + ptr = strarray = (String*) __XtMalloc((Cardinal)((size_t)(tokens+1) * sizeof(String))); src = dst_str; while (--tokens >= 0) { *ptr = src; ptr++; if (tokens) { - len = strlen(src); + len = (int) strlen(src); src = src + len + 1; } } @@ -349,7 +349,7 @@ static Boolean CoreSetValues( } else { attributes.background_pixmap = new->core.background_pixmap; - window_mask &= ~CWBackPixel; + window_mask &= (unsigned long) (~CWBackPixel); window_mask |= CWBackPixmap; } redisplay = TRUE; @@ -366,7 +366,7 @@ static Boolean CoreSetValues( } else { attributes.border_pixmap = new->core.border_pixmap; - window_mask &= ~CWBorderPixel; + window_mask &= (unsigned long) (~CWBorderPixel); window_mask |= CWBorderPixmap; } } diff --git a/src/Create.c b/src/Create.c index 67537a1..81bf733 100644 --- a/src/Create.c +++ b/src/Create.c @@ -297,7 +297,7 @@ xtWidgetAlloc( (sizeof(struct {char a; unsigned long b;}) - sizeof(unsigned long) + sizeof(double))) { if (csize && !(csize & (sizeof(double) - 1))) - wsize = (wsize + sizeof(double) - 1) & ~(sizeof(double)-1); + wsize = (Cardinal) ((wsize + sizeof(double) - 1) & ~(sizeof(double)-1)); } } widget = (Widget) __XtCalloc(1,(unsigned)(wsize + csize)); @@ -620,7 +620,7 @@ popupPostProc(Widget w) parent->core.popup_list = (WidgetList) XtRealloc((char*) parent->core.popup_list, - (unsigned) (parent->core.num_popups+1) * sizeof(Widget)); + (Cardinal)((unsigned) (parent->core.num_popups+1) * sizeof(Widget))); parent->core.popup_list[parent->core.num_popups++] = w; } diff --git a/src/Destroy.c b/src/Destroy.c index e952bcc..b72f4c6 100644 --- a/src/Destroy.c +++ b/src/Destroy.c @@ -351,7 +351,7 @@ void XtDestroyWidget (Widget widget) app->destroy_list_size += 10; app->destroy_list = (DestroyRec*) XtRealloc( (char*)app->destroy_list, - (unsigned)sizeof(DestroyRec)*app->destroy_list_size + (Cardinal)(sizeof(DestroyRec) * (size_t)app->destroy_list_size) ); } dr = app->destroy_list + app->destroy_count++; diff --git a/src/Display.c b/src/Display.c index ec01d29..3916bc3 100644 --- a/src/Display.c +++ b/src/Display.c @@ -120,9 +120,9 @@ static void AddToAppContext( #define DISPLAYS_TO_ADD 4 if (app->count >= app->max) { - app->max += DISPLAYS_TO_ADD; + app->max = (short) (app->max + DISPLAYS_TO_ADD); app->list = (Display **) XtRealloc((char *)app->list, - (unsigned) app->max * sizeof(Display *)); + (Cardinal) ((unsigned) app->max * sizeof(Display *))); } app->list[app->count++] = d; @@ -218,8 +218,8 @@ static XtPerDisplay InitPerDisplay( pd->pdi.keyboard.grabType = XtNoServerGrab; pd->pdi.pointer.grabType = XtNoServerGrab; _XtAllocWWTable(pd); - pd->per_screen_db = (XrmDatabase *)__XtCalloc(ScreenCount(dpy), - sizeof(XrmDatabase)); + pd->per_screen_db = (XrmDatabase *)__XtCalloc((Cardinal)ScreenCount(dpy), + (Cardinal)sizeof(XrmDatabase)); pd->cmd_db = (XrmDatabase)NULL; pd->server_db = (XrmDatabase)NULL; pd->dispatcher_list = NULL; @@ -288,9 +288,9 @@ Display *XtOpenDisplay( } else { int len; displayName = XDisplayName(displayName); - len = strlen (displayName); - app->display_name_tried = (String) __XtMalloc (len + 1); - strncpy ((char*) app->display_name_tried, displayName, len + 1); + len = (int) strlen (displayName); + app->display_name_tried = (String) __XtMalloc ((Cardinal)(len + 1)); + strncpy ((char*) app->display_name_tried, displayName, (size_t) (len + 1)); app->display_name_tried[len] = '\0'; } if (db) XrmDestroyDatabase(db); @@ -317,7 +317,7 @@ _XtAppInit( */ saved_argv = (String *) - __XtMalloc( (Cardinal)((*argc_in_out + 1) * sizeof(String)) ); + __XtMalloc( (Cardinal)((size_t)(*argc_in_out + 1) * sizeof(String)) ); for (i = 0 ; i < *argc_in_out ; i++) saved_argv[i] = (*argv_in_out)[i]; saved_argv[i] = NULL; /* NULL terminate that sucker. */ @@ -507,7 +507,7 @@ void XtDestroyApplicationContext(XtAppContext app) _XtAppDestroyCount++; appDestroyList = (XtAppContext *) XtRealloc((char *) appDestroyList, - (unsigned) (_XtAppDestroyCount * sizeof(XtAppContext))); + (unsigned) ((size_t)_XtAppDestroyCount * sizeof(XtAppContext))); appDestroyList[_XtAppDestroyCount-1] = app; UNLOCK_PROCESS; UNLOCK_APP(app); @@ -520,7 +520,7 @@ void _XtDestroyAppContexts(void) XtAppContext apps[8]; XtAppContext* pApps; - pApps = XtStackAlloc (sizeof (XtAppContext) * _XtAppDestroyCount, apps); + pApps = XtStackAlloc (sizeof (XtAppContext) * (size_t)_XtAppDestroyCount, apps); for (i = ii = 0; i < _XtAppDestroyCount; i++) { if (_XtSafeToDestroy(appDestroyList[i])) @@ -683,7 +683,7 @@ void XtCloseDisplay(Display *dpy) app->dpy_destroy_count++; app->dpy_destroy_list = (Display **) XtRealloc((char *) app->dpy_destroy_list, - (unsigned) (app->dpy_destroy_count * sizeof(Display *))); + (Cardinal) ((size_t)app->dpy_destroy_count * sizeof(Display *))); app->dpy_destroy_list[app->dpy_destroy_count-1] = dpy; } UNLOCK_APP(app); @@ -756,8 +756,8 @@ void XtGetDisplays( { int ii; LOCK_APP(app_context); - *num_dpy_return = app_context->count; - *dpy_return = (Display**)__XtMalloc(app_context->count * sizeof(Display*)); + *num_dpy_return = (Cardinal)app_context->count; + *dpy_return = (Display**)__XtMalloc((Cardinal)((size_t)app_context->count * sizeof(Display*))); for (ii = 0; ii < app_context->count; ii++) (*dpy_return)[ii] = app_context->list[ii]; UNLOCK_APP(app_context); diff --git a/src/Error.c b/src/Error.c index 18a80b5..44e8a2a 100644 --- a/src/Error.c +++ b/src/Error.c @@ -194,12 +194,12 @@ void XtAppGetErrorDatabaseText( #endif /* GLOBALERRORS */ } else (void) XrmGetResource(db, str_name, str_class, &type_str, &result); if (result.addr) { - (void) strncpy (buffer, result.addr, nbytes); + (void) strncpy (buffer, result.addr, (size_t) nbytes); if (result.size > (unsigned) nbytes) buffer[nbytes-1] = 0; } else { - int len = strlen(defaultp); + int len = (int) strlen(defaultp); if (len >= nbytes) len = nbytes-1; - (void) memmove(buffer, defaultp, len); + (void) memmove(buffer, defaultp, (size_t) len); buffer[len] = '\0'; } if (str_name) diff --git a/src/Event.c b/src/Event.c index 11823d6..7fa20da 100644 --- a/src/Event.c +++ b/src/Event.c @@ -150,7 +150,7 @@ static void CallExtensionSelector( for (p = widget->core.event_table; p != NULL; p = p->next) if (p->has_type_specifier && EXT_TYPE(p) >= rec->min && EXT_TYPE(p) <= rec->max) - count += p->mask; + count = (Cardinal) (count + p->mask); if (count == 0 && !forceCall) return; @@ -230,7 +230,7 @@ RemoveEventHandler( Display* dpy = XtDisplay (widget); if (oldMask != mask) - XSelectInput(dpy, XtWindow(widget), mask); + XSelectInput(dpy, XtWindow(widget), (long) mask); if (has_type_specifier) { XtPerDisplay pd = _XtGetPerDisplay(dpy); @@ -348,9 +348,9 @@ AddEventHandler( i++; if (i == p->mask) { p = (XtEventRec*) XtRealloc((char*)p, - sizeof(XtEventRec) + + (Cardinal)(sizeof(XtEventRec) + sizeof(XtEventRecExt) + - p->mask * sizeof(XtPointer)); + p->mask * sizeof(XtPointer))); EXT_SELECT_DATA(p,i) = select_data; p->mask++; *pp = p; @@ -363,7 +363,7 @@ AddEventHandler( Display* dpy = XtDisplay (widget); if (oldMask != mask) - XSelectInput(dpy, XtWindow(widget), mask); + XSelectInput(dpy, XtWindow(widget), (long) mask); if (has_type_specifier) { XtPerDisplay pd = _XtGetPerDisplay (dpy); @@ -514,7 +514,7 @@ static const WidgetRec WWfake; /* placeholder for deletions */ #define WWHASH(tab,win) ((win) & tab->mask) #define WWREHASHVAL(tab,win) ((((win) % tab->rehash) + 2) | 1) -#define WWREHASH(tab,idx,rehash) ((idx + rehash) & tab->mask) +#define WWREHASH(tab,idx,rehash) ((unsigned)(idx + rehash) & (tab->mask)) #define WWTABLE(display) (_XtGetPerDisplay(display)->WWtable) static void ExpandWWTable(WWTable); @@ -547,11 +547,11 @@ void XtRegisterDrawable( if ((tab->occupied + (tab->occupied >> 2)) > tab->mask) ExpandWWTable(tab); - idx = WWHASH(tab, window); + idx = (int) WWHASH(tab, window); if ((entry = tab->entries[idx]) && entry != &WWfake) { - rehash = WWREHASHVAL(tab, window); + rehash = (int) WWREHASHVAL(tab, window); do { - idx = WWREHASH(tab, idx, rehash); + idx = (int) WWREHASH(tab, idx, rehash); } while ((entry = tab->entries[idx]) && entry != &WWfake); } if (!entry) @@ -593,12 +593,12 @@ void XtUnregisterDrawable( UNLOCK_APP(app); return; } - idx = WWHASH(tab, window); + idx = (int) WWHASH(tab, window); if ((entry = tab->entries[idx])) { if (entry != widget) { - rehash = WWREHASHVAL(tab, window); + rehash = (int) WWREHASHVAL(tab, window); do { - idx = WWREHASH(tab, idx, rehash); + idx = (int) WWREHASH(tab, idx, rehash); if (!(entry = tab->entries[idx])) { UNLOCK_PROCESS; UNLOCK_APP(app); @@ -633,11 +633,11 @@ static void ExpandWWTable( entries = tab->entries = (Widget *) __XtCalloc(tab->mask+1, sizeof(Widget)); for (oldidx = 0; oldidx <= oldmask; oldidx++) { if ((entry = oldentries[oldidx]) && entry != &WWfake) { - newidx = WWHASH(tab, XtWindow(entry)); + newidx = (Cardinal) WWHASH(tab, XtWindow(entry)); if (entries[newidx]) { - rehash = WWREHASHVAL(tab, XtWindow(entry)); + rehash = (Cardinal) WWREHASHVAL(tab, XtWindow(entry)); do { - newidx = WWREHASH(tab, newidx, rehash); + newidx = (Cardinal) WWREHASH(tab, newidx, rehash); } while (entries[newidx]); } entries[newidx] = entry; @@ -662,11 +662,11 @@ Widget XtWindowToWidget( LOCK_APP(app); LOCK_PROCESS; tab = WWTABLE(display); - idx = WWHASH(tab, window); + idx = (int) WWHASH(tab, window); if ((entry = tab->entries[idx]) && XtWindow(entry) != window) { - rehash = WWREHASHVAL(tab, window); + rehash = (int) WWREHASHVAL(tab, window); do { - idx = WWREHASH(tab, idx, rehash); + idx = (int) WWREHASH(tab, idx, rehash); } while ((entry = tab->entries[idx]) && XtWindow(entry) != window); } if (entry) { @@ -740,8 +740,8 @@ static Boolean CallEventHandlers( numprocs++; } if (numprocs > EHMAXSIZE) { - proc = (XtEventHandler *)__XtMalloc(numprocs * (sizeof(XtEventHandler) + - sizeof(XtPointer))); + proc = (XtEventHandler *)__XtMalloc((Cardinal)((size_t)numprocs * (sizeof(XtEventHandler) + + sizeof(XtPointer)))); closure = (XtPointer *)(proc + numprocs); } else { proc = procs; @@ -1037,10 +1037,10 @@ void XtAddExposureToRegion( /* These Expose and GraphicsExpose fields are at identical offsets */ if (event->type == Expose || event->type == GraphicsExpose) { - rect.x = ev->x; - rect.y = ev->y; - rect.width = ev->width; - rect.height = ev->height; + rect.x = (Position) ev->x; + rect.y = (Position) ev->y; + rect.width = (Dimension) ev->width; + rect.height = (Dimension) ev->height; XUnionRectWithRegion(&rect, region, region); } } @@ -1061,10 +1061,10 @@ static void AddExposureToRectangularRegion( XExposeEvent *ev = (XExposeEvent *) event; /* These Expose and GraphicsExpose fields are at identical offsets */ - rect.x = ev->x; - rect.y = ev->y; - rect.width = ev->width; - rect.height = ev->height; + rect.x = (Position) ev->x; + rect.y = (Position) ev->y; + rect.width = (Dimension) ev->width; + rect.height = (Dimension) ev->height; if (XEmptyRegion(region)) { XUnionRectWithRegion(&rect, region, region); @@ -1331,7 +1331,7 @@ Boolean _XtDefaultDispatcher( was_dispatched = (XFilterEvent(event, XtWindow(widget)) || XtDispatchEventToWidget(widget, event)); } - else was_dispatched = XFilterEvent(event, None); + else was_dispatched = (Boolean) XFilterEvent(event, None); } else if (grabType == pass) { if (event->type == LeaveNotify || @@ -1359,7 +1359,7 @@ Boolean _XtDefaultDispatcher( if ((grabList == NULL ||_XtOnGrabList(dspWidget, grabList)) && XtIsSensitive(dspWidget)) { - if ((was_filtered = XFilterEvent(event, XtWindow(dspWidget)))) { + if ((was_filtered = (Boolean) XFilterEvent(event, XtWindow(dspWidget)))) { /* If this event activated a device grab, release it. */ _XtUngrabBadGrabs(event, widget, mask, pdi); was_dispatched = True; @@ -1699,7 +1699,7 @@ void XtRegisterExtensionSelector( pd->ext_select_count++; pd->ext_select_list = (ExtSelectRec *) XtRealloc((char *) pd->ext_select_list, - pd->ext_select_count * sizeof(ExtSelectRec)); + (Cardinal) ((size_t)pd->ext_select_count * sizeof(ExtSelectRec))); for (i = pd->ext_select_count - 1; i > 0; i--) { if (pd->ext_select_list[i-1].min > min_event_type) { pd->ext_select_list[i] = pd->ext_select_list[i-1]; diff --git a/src/EventUtil.c b/src/EventUtil.c index 91ad31f..4dcbbc6 100644 --- a/src/EventUtil.c +++ b/src/EventUtil.c @@ -173,12 +173,12 @@ void _XtFillAncestorList( happen again, so grow the ancestor list */ *maxElemsPtr += CACHESIZE; trace = (Widget *) XtRealloc((char*)trace, - sizeof(Widget) * (*maxElemsPtr)); + (Cardinal)(sizeof(Widget) * (size_t)(*maxElemsPtr))); } trace[i] = w; } *listPtr = trace; - *numElemsPtr = i; + *numElemsPtr = (int) i; #undef CACHESIZE } diff --git a/src/GCManager.c b/src/GCManager.c index ba3d9c4..5769d11 100644 --- a/src/GCManager.c +++ b/src/GCManager.c @@ -235,8 +235,8 @@ GC XtAllocateGC( /* No matches, have to create a new one */ cur = XtNew(GCrec); - cur->screen = XScreenNumberOfScreen(screen); - cur->depth = depth; + cur->screen = (unsigned char) XScreenNumberOfScreen(screen); + cur->depth = (unsigned char) depth; cur->ref_count = 1; cur->dynamic_mask = dynamicMask; cur->unused_mask = (unusedMask & ~dynamicMask); @@ -250,8 +250,8 @@ GC XtAllocateGC( if (!drawable) { if (!pd->pixmap_tab) { int n; - pd->pixmap_tab = (Drawable **)__XtMalloc((unsigned)ScreenCount(dpy) * - sizeof(Drawable *)); + pd->pixmap_tab = (Drawable **)__XtMalloc((Cardinal)((unsigned)ScreenCount(dpy) * + sizeof(Drawable *))); for (n = 0; n < ScreenCount(dpy); n++) pd->pixmap_tab[n] = NULL; } diff --git a/src/Geometry.c b/src/Geometry.c index 8d16c63..771094b 100644 --- a/src/Geometry.c +++ b/src/Geometry.c @@ -85,7 +85,7 @@ static void ClearRectObjAreas( bw2 = old->border_width << 1; XClearArea( XtDisplay(pw), XtWindow(pw), old->x, old->y, - old->width + bw2, old->height + bw2, + (unsigned)(old->width + bw2), (unsigned)(old->height + bw2), TRUE ); bw2 = r->rectangle.border_width << 1; @@ -430,7 +430,7 @@ _XtMakeGeometryRequest ( if (XtIsWidget(request->sibling)) req.changes.sibling = XtWindow(request->sibling); else - req.changeMask &= ~(CWStackMode | CWSibling); + req.changeMask = (XtGeometryMask) (req.changeMask & (unsigned long) (~(CWStackMode | CWSibling))); } } @@ -716,8 +716,8 @@ void XtTranslateCoords( *rooty = y; for (; w != NULL && ! XtIsShell(w); w = w->core.parent) { - *rootx += w->core.x + w->core.border_width; - *rooty += w->core.y + w->core.border_width; + *rootx = (Position) (*rootx + w->core.x + w->core.border_width); + *rooty = (Position) (*rooty + w->core.y + w->core.border_width); } if (w == NULL) @@ -728,8 +728,8 @@ void XtTranslateCoords( else { Position x2, y2; _XtShellGetCoordinates( w, &x2, &y2 ); - *rootx += x2 + w->core.border_width; - *rooty += y2 + w->core.border_width; + *rootx = (Position) (*rootx + x2 + w->core.border_width); + *rooty = (Position) (*rooty + y2 + w->core.border_width); } UNLOCK_APP(app); } diff --git a/src/GetResList.c b/src/GetResList.c index c22725c..4c8fe0d 100644 --- a/src/GetResList.c +++ b/src/GetResList.c @@ -90,14 +90,14 @@ void XtGetResourceList( register XtResourceList *list, dlist; LOCK_PROCESS; - size = widget_class->core_class.num_resources * sizeof(XtResource); + size = (int) (widget_class->core_class.num_resources * sizeof(XtResource)); *resources = (XtResourceList) __XtMalloc((unsigned) size); if (!widget_class->core_class.class_inited) { /* Easy case */ (void) memmove((char *) *resources, - (char *)widget_class->core_class.resources, size); + (char *)widget_class->core_class.resources, (size_t) size); *num_resources = widget_class->core_class.num_resources; UNLOCK_PROCESS; return; @@ -161,14 +161,14 @@ void XtGetConstraintResourceList( return; } - size = class->constraint_class.num_resources * sizeof(XtResource); + size = (int) (class->constraint_class.num_resources * sizeof(XtResource)); *resources = (XtResourceList) __XtMalloc((unsigned) size); if (!class->core_class.class_inited) { /* Easy case */ (void) memmove((char *) *resources, - (char *)class->constraint_class.resources, size); + (char *)class->constraint_class.resources, (size_t) size); *num_resources = class->constraint_class.num_resources; UNLOCK_PROCESS; return; diff --git a/src/Hooks.c b/src/Hooks.c index bf26a13..9c05a05 100644 --- a/src/Hooks.c +++ b/src/Hooks.c @@ -123,7 +123,7 @@ void _XtAddShellToHookObj( ho->hooks.max_shells += SHELL_INCR; ho->hooks.shells = (WidgetList)XtRealloc((char*)ho->hooks.shells, - ho->hooks.max_shells * sizeof (Widget)); + (Cardinal) (ho->hooks.max_shells * sizeof (Widget))); } ho->hooks.shells[ho->hooks.num_shells++] = shell; diff --git a/src/Initialize.c b/src/Initialize.c index a9b8844..0218849 100644 --- a/src/Initialize.c +++ b/src/Initialize.c @@ -180,7 +180,7 @@ static void GetHostname ( return; buf[0] = '\0'; - (void) gethostname (buf, maxlen); + (void) gethostname (buf, (size_t) maxlen); buf [maxlen - 1] = '\0'; #endif } @@ -320,11 +320,11 @@ String _XtGetUserName( char* ptr; if ((ptr = getenv("USER"))) { - (void) strncpy (dest, ptr, len-1); + (void) strncpy (dest, ptr, (size_t) (len-1)); dest[len-1] = '\0'; } else { if ((pw = _XGetpwuid(getuid(),pwparams)) != NULL) { - (void) strncpy (dest, pw->pw_name, len-1); + (void) strncpy (dest, pw->pw_name, (size_t)(len-1)); dest[len-1] = '\0'; } else *dest = '\0'; @@ -367,7 +367,7 @@ static String GetRootDirName( return NULL; if ((ptr = getenv("HOME"))) { - (void) strncpy (dest, ptr, len-1); + (void) strncpy (dest, ptr, (size_t)(len-1)); dest[len-1] = '\0'; } else { if ((ptr = getenv("USER"))) @@ -375,7 +375,7 @@ static String GetRootDirName( else pw = _XGetpwuid(getuid(),pwparams); if (pw != NULL) { - (void) strncpy (dest, pw->pw_dir, len-1); + (void) strncpy (dest, pw->pw_dir, (size_t)(len-1)); dest[len-1] = '\0'; } else *dest = '\0'; @@ -437,7 +437,7 @@ static void CombineUserDefaults( } else { char filename[PATH_MAX]; (void) GetRootDirName(filename, - PATH_MAX - strlen (slashDotXdefaults) - 1); + PATH_MAX - (int)strlen (slashDotXdefaults) - 1); (void) strcat(filename, slashDotXdefaults); (void)XrmCombineFileDatabase(filename, pdb, False); } @@ -574,9 +574,9 @@ XrmDatabase XtScreenDatabase( #endif (void) GetRootDirName(filename = filenamebuf, - PATH_MAX - strlen (slashDotXdefaultsDash) - 1); + PATH_MAX - (int)strlen (slashDotXdefaultsDash) - 1); (void) strcat(filename, slashDotXdefaultsDash); - len = strlen(filename); + len = (int)strlen(filename); GetHostname (filename+len, PATH_MAX-len); } (void)XrmCombineFileDatabase(filename, &db, False); @@ -657,14 +657,14 @@ static void _MergeOptionTables( enum {Check, NotSorted, IsSorted} sort_order = Check; *dst = table = (XrmOptionDescRec*) - __XtMalloc( sizeof(XrmOptionDescRec) * (num_src1 + num_src2) ); + __XtMalloc( (Cardinal)(sizeof(XrmOptionDescRec) * (num_src1 + num_src2) )); (void) memmove(table, src1, sizeof(XrmOptionDescRec) * num_src1 ); if (num_src2 == 0) { *num_dst = num_src1; return; } - endP = &table[dst_len = num_src1]; + endP = &table[dst_len = (int)num_src1]; for (opt2 = src2, i2= 0; i2 < num_src2; opt2++, i2++) { found = False; whereP = endP-1; /* assume new option goes at the end */ @@ -709,7 +709,7 @@ static void _MergeOptionTables( dst_len++; } } - *num_dst = dst_len; + *num_dst = (Cardinal)dst_len; } @@ -770,13 +770,13 @@ XrmDatabase _XtPreparseCommandLine( String *targv; int targc = argc; - targv = (String *) __XtMalloc(sizeof(char *) * argc); - (void) memmove(targv, argv, sizeof(char *) * argc); + targv = (String *) __XtMalloc((Cardinal)(sizeof(char *) * (size_t)argc)); + (void) memmove(targv, argv, sizeof(char *) * (size_t) argc); _MergeOptionTables(opTable, XtNumber(opTable), urlist, num_urs, &options, &num_options); name_list[0] = class_list[0] = XrmPermStringToQuark("."); name_list[2] = class_list[2] = NULLQUARK; - XrmParseCommand(&db, options, num_options, ".", &targc, targv); + XrmParseCommand(&db, options, (int) num_options, ".", &targc, targv); if (applName) { name_list[1] = XrmPermStringToQuark("name"); if (XrmQGetResource(db, name_list, name_list, &type, &val) && @@ -893,7 +893,7 @@ void _XtDisplayInitialize( /* Parse the command line and remove Xt arguments from argv */ _MergeOptionTables( opTable, XtNumber(opTable), urlist, num_urs, &options, &num_options ); - XrmParseCommand(&pd->cmd_db, options, num_options, name, argc, argv); + XrmParseCommand(&pd->cmd_db, options, (int) num_options, name, argc, argv); db = XtScreenDatabase(DefaultScreenOfDisplay(dpy)); @@ -908,7 +908,7 @@ void _XtDisplayInitialize( while (!XrmQGetSearchList(db, name_list, class_list, search_list, search_list_size)) { XrmHashTable* old = search_list; - Cardinal size = (search_list_size*=2)*sizeof(XrmHashTable); + Cardinal size = (Cardinal) ((size_t)(search_list_size *= 2)*sizeof(XrmHashTable)); if (!(search_list = (XrmHashTable*)ALLOCATE_LOCAL(size))) _XtAllocError(NULL); (void) memmove((char*)search_list, (char*)old, (size>>1) ); diff --git a/src/Intrinsic.c b/src/Intrinsic.c index 450dce7..35d1c2f 100644 --- a/src/Intrinsic.c +++ b/src/Intrinsic.c @@ -181,7 +181,7 @@ static void ComputeWindowAttributes( XtExposeProc expose; *value_mask = CWEventMask | CWColormap; - (*values).event_mask = XtBuildEventMask(widget); + (*values).event_mask = (long) XtBuildEventMask(widget); (*values).colormap = widget->core.colormap; if (widget->core.background_pixmap != XtUnspecifiedPixmap) { *value_mask |= CWBackPixmap; @@ -333,8 +333,8 @@ static void RealizeWidget( int len_nm, len_cl; char *s; - len_nm = widget->core.name ? strlen(widget->core.name) : 0; - len_cl = strlen(class_name); + len_nm = widget->core.name ? (int) strlen(widget->core.name) : 0; + len_cl = (int) strlen(class_name); s = __XtMalloc((unsigned) (len_nm + len_cl + 2)); s[0] = '\0'; if (len_nm) @@ -634,7 +634,7 @@ Widget XtNameToWidget( Widget result; WIDGET_TO_APPCON(root); - len = strlen(name); + len = (int) strlen(name); if (len == 0) return NULL; LOCK_APP(app); @@ -963,7 +963,7 @@ static Boolean TestFile( #else (status.st_mode & S_IFMT) != S_IFDIR); /* not a directory */ #endif /* X_NOT_POSIX else */ - return ret; + return (Boolean) ret; #else /* VMS */ return TRUE; /* Who knows what to do here? */ #endif /* VMS */ @@ -1092,7 +1092,7 @@ String XtFindFile( if (*colon == ':') break; } - len = colon - path; + len = (int) (colon - path); if (Resolve(path, len, substitutions, num_substitutions, buf, '/')) { if (firstTime || strcmp(buf1,buf2) != 0) { @@ -1214,11 +1214,11 @@ static char *ExtractLocaleName( # endif if ((end = strchr (start, ENDCHAR))) { - len = end - start; + len = (int) (end - start); if (buf != NULL) XtFree (buf); - buf = XtMalloc (len + 1); + buf = XtMalloc ((Cardinal)(len + 1)); if (buf == NULL) return NULL; - strncpy(buf, start, len); + strncpy(buf, start, (size_t) len); *(buf + len) = '\0'; # ifdef WHITEFILL for (start = buf; start = strchr(start, ' '); ) @@ -1272,9 +1272,9 @@ static void FillInLangSubs( return; } - len = strlen(string) + 1; + len = (int) strlen(string) + 1; subs[0].substitution = string; - p1 = subs[1].substitution = __XtMalloc((Cardinal) 3*len); + p1 = subs[1].substitution = __XtMalloc((Cardinal) (3*len)); p2 = subs[2].substitution = subs[1].substitution + len; p3 = subs[3].substitution = subs[2].substitution + len; @@ -1286,8 +1286,8 @@ static void FillInLangSubs( ch = strchr(string, '_'); if (ch != NULL) { - len = ch - string; - (void) strncpy(p1, string, len); + len = (int) (ch - string); + (void) strncpy(p1, string, (size_t) len); p1[len] = '\0'; string = ch + 1; rest = &p2; @@ -1297,8 +1297,8 @@ static void FillInLangSubs( ch = strchr(string, '.'); if (ch != NULL) { - len = ch - string; - strncpy(*rest, string, len); + len = (int) (ch - string); + strncpy(*rest, string, (size_t) len); (*rest)[len] = '\0'; (void) strcpy(p3, ch+1); } else (void) strcpy(*rest, string); @@ -1347,7 +1347,7 @@ String XtResolvePathname( XtPerDisplay pd; static const char *defaultPath = NULL; const char *impl_default = implementation_default_path(); - int idef_len = strlen(impl_default); + int idef_len = (int) strlen(impl_default); char *massagedPath; int bytesAllocd, bytesLeft; char *ch, *result; @@ -1399,7 +1399,7 @@ String XtResolvePathname( char *new; bytesAllocd +=1000; new = __XtMalloc((Cardinal) bytesAllocd); - strncpy( new, massagedPath, bytesUsed ); + strncpy( new, massagedPath, (size_t) bytesUsed ); ch = new + bytesUsed; if (pathMallocd) XtFree(massagedPath); @@ -1444,10 +1444,10 @@ String XtResolvePathname( int i = XtNumber(defaultSubs); Substitution sub, def; merged_substitutions = sub = (Substitution) - ALLOCATE_LOCAL((unsigned)(num_substitutions+i)*sizeof(SubstitutionRec)); + ALLOCATE_LOCAL((unsigned)(num_substitutions+(Cardinal)i)*sizeof(SubstitutionRec)); if (sub == NULL) _XtAllocError(NULL); for (def = defaultSubs; i--; sub++, def++) sub->match = def->match; - for (i = num_substitutions; i--; ) *sub++ = *substitutions++; + for (i = (int) num_substitutions; i--; ) *sub++ = *substitutions++; } merged_substitutions[0].substitution = (String)filename; merged_substitutions[1].substitution = (String)type; diff --git a/src/Keyboard.c b/src/Keyboard.c index c8ba863..4c43b95 100644 --- a/src/Keyboard.c +++ b/src/Keyboard.c @@ -241,10 +241,10 @@ static Boolean IsOutside( */ XtTranslateCoords(w, 0, 0, &left, &top); /* We need to take borders into consideration */ - left = left - w->core.border_width; - top = top - w->core.border_width; - right = left + w->core.width + w->core.border_width; - bottom = top + w->core.height + w->core.border_width; + left = (Position) (left - w->core.border_width); + top = (Position) (top - w->core.border_width); + right = (Position) (left + w->core.width + w->core.border_width); + bottom = (Position) (top + w->core.height + w->core.border_width); if ( (e->x_root < left) || (e->y_root < top) || @@ -367,12 +367,12 @@ static Widget FindKeyDestination( } if ((grab = CheckServerGrabs((XEvent*)event, pseudoTrace, - pseudoTraceDepth))) + (Cardinal)pseudoTraceDepth))) { XtDevice device = &pdi->keyboard; device->grabType = XtPseudoPassiveServerGrab; - pdi->activatingKey = event->keycode; + pdi->activatingKey = (KeyCode) event->keycode; device->grab = *grab; if (grab @@ -411,7 +411,7 @@ Widget _XtProcessKeyboardEvent( !IsServerGrab(device->grabType) && (newGrab = CheckServerGrabs((XEvent*)event, pdi->trace, - pdi->traceDepth))) + (Cardinal) pdi->traceDepth))) { /* * honor pseudo-grab from prior event by X @@ -424,7 +424,7 @@ Widget _XtProcessKeyboardEvent( { /* Activate the grab */ device->grab = *newGrab; - pdi->activatingKey = event->keycode; + pdi->activatingKey = (KeyCode) event->keycode; device->grabType = XtPassiveServerGrab; } } diff --git a/src/Manage.c b/src/Manage.c index 4ff7219..f97ec2a 100644 --- a/src/Manage.c +++ b/src/Manage.c @@ -138,8 +138,8 @@ static void UnmanageChildren( if ((pw!=NULL) && XtIsRealized (pw)) XClearArea (XtDisplay (pw), XtWindow (pw), r->rectangle.x, r->rectangle.y, - r->rectangle.width + (r->rectangle.border_width << 1), - r->rectangle.height + (r->rectangle.border_width << 1), + (unsigned) (r->rectangle.width + (r->rectangle.border_width << 1)), + (unsigned) (r->rectangle.height + (r->rectangle.border_width << 1)), TRUE); } @@ -237,7 +237,7 @@ static void ManageChildren( if (num_children <= MAXCHILDREN) { unique_children = cache; } else { - unique_children = (WidgetList) __XtMalloc(num_children * sizeof(Widget)); + unique_children = (WidgetList) __XtMalloc((Cardinal) ((size_t)num_children * sizeof(Widget))); } num_unique_children = 0; for (i = 0; i < num_children; i++) { @@ -302,8 +302,8 @@ static void ManageChildren( if (pw != NULL) XClearArea (XtDisplay (pw), XtWindow (pw), r->rectangle.x, r->rectangle.y, - r->rectangle.width + (r->rectangle.border_width << 1), - r->rectangle.height + (r->rectangle.border_width << 1), + (unsigned) (r->rectangle.width + (r->rectangle.border_width << 1)), + (unsigned) (r->rectangle.height + (r->rectangle.border_width << 1)), TRUE); } } @@ -432,10 +432,10 @@ void XtChangeManagedSet( parent = XtParent(*childp); childp = unmanage_children; - for (i = num_unmanage; --i >= 0 && XtParent(*childp) == parent; childp++); + for (i = (int) num_unmanage; --i >= 0 && XtParent(*childp) == parent; childp++); call_out = (i >= 0); childp = manage_children; - for (i = num_manage; --i >= 0 && XtParent(*childp) == parent; childp++); + for (i = (int) num_manage; --i >= 0 && XtParent(*childp) == parent; childp++); if (call_out || i >= 0) { XtAppWarningMsg(app, "ambiguousParent", XtNxtChangeManagedSet, XtCXtToolkitError, "Not all children have same parent", diff --git a/src/NextEvent.c b/src/NextEvent.c index c6fbcf1..68c2e88 100644 --- a/src/NextEvent.c +++ b/src/NextEvent.c @@ -154,7 +154,7 @@ static void AdjustHowLong ( if(*howlong <= (unsigned long)(time_spent.tv_sec*1000+time_spent.tv_usec/1000)) *howlong = (unsigned long)0; /* Timed out */ else - *howlong -= (time_spent.tv_sec*1000+time_spent.tv_usec/1000); + *howlong = (*howlong - (unsigned long)(time_spent.tv_sec*1000+time_spent.tv_usec/1000)); } typedef struct { @@ -195,12 +195,12 @@ static void InitTimes ( wt->poll_wait = X_BLOCK; #endif } else { /* block until at most */ - wt->max_wait_time.tv_sec = *howlong/1000; - wt->max_wait_time.tv_usec = (*howlong %1000)*1000; + wt->max_wait_time.tv_sec = (time_t) (*howlong/1000); + wt->max_wait_time.tv_usec = (suseconds_t) ((*howlong %1000)*1000); #ifndef USE_POLL wt->wait_time_ptr = &wt->max_wait_time; #else - wt->poll_wait = *howlong; + wt->poll_wait = (int) *howlong; #endif } } else { /* don't block */ @@ -279,11 +279,11 @@ static void InitFds ( if (!wf->fdlist || wf->fdlist == wf->stack) { wf->fdlist = (struct pollfd*) - XtStackAlloc (sizeof (struct pollfd) * wf->fdlistlen, wf->stack); + XtStackAlloc (sizeof (struct pollfd) * (size_t)wf->fdlistlen, wf->stack); } else { wf->fdlist = (struct pollfd*) XtRealloc ((char*) wf->fdlist, - sizeof (struct pollfd) * wf->fdlistlen); + (Cardinal) (sizeof (struct pollfd) * (size_t)wf->fdlistlen)); } if (wf->fdlistlen) { @@ -334,9 +334,9 @@ static void AdjustTimes ( wt->wait_time_ptr = &zero_time; } #else - wt->poll_wait = wt->wait_time.tv_sec * 1000 + wt->wait_time.tv_usec / 1000; + wt->poll_wait = (int) (wt->wait_time.tv_sec * 1000 + wt->wait_time.tv_usec / 1000); else - wt->poll_wait = wt->max_wait_time.tv_sec * 1000 + wt->max_wait_time.tv_usec / 1000; + wt->poll_wait = (int) (wt->max_wait_time.tv_sec * 1000 + wt->max_wait_time.tv_usec / 1000); } else wt->poll_wait = X_DONT_BLOCK; } @@ -352,7 +352,7 @@ static int IoWait ( return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask, wt->wait_time_ptr); #else - return poll (wf->fdlist, wf->fdlistlen, wt->poll_wait); + return poll (wf->fdlist, (nfds_t) wf->fdlistlen, wt->poll_wait); #endif } @@ -797,8 +797,8 @@ XtIntervalId XtAppAddTimeOut( tptr->te_closure = closure; tptr->te_proc = proc; tptr->app = app; - tptr->te_timer_value.tv_sec = interval/1000; - tptr->te_timer_value.tv_usec = (interval%1000)*1000; + tptr->te_timer_value.tv_sec = (time_t) (interval/1000); + tptr->te_timer_value.tv_usec = (suseconds_t) ((interval%1000)*1000); X_GETTIMEOFDAY (¤t_time); FIXUP_TIMEVAL(current_time); ADD_TIME(tptr->te_timer_value,tptr->te_timer_value,current_time); @@ -992,19 +992,19 @@ XtInputId XtAppAddInput( LOCK_APP(app); if (!condition || - condition & ~(XtInputReadMask|XtInputWriteMask|XtInputExceptMask)) + condition & (unsigned long)(~(XtInputReadMask|XtInputWriteMask|XtInputExceptMask))) XtAppErrorMsg(app,"invalidParameter","xtAddInput",XtCXtToolkitError, "invalid condition passed to XtAppAddInput", (String *)NULL, (Cardinal *)NULL); if (app->input_max <= source) { - Cardinal n = source + 1; + Cardinal n = (Cardinal) (source + 1); int ii; app->input_list = (InputEvent**)XtRealloc((char*) app->input_list, - n * sizeof(InputEvent*)); + (Cardinal)((size_t)n * sizeof(InputEvent*))); for (ii = app->input_max; ii < (int) n; ii++) app->input_list[ii] = (InputEvent*) NULL; - app->input_max = n; + app->input_max = (short) n; } sptr = XtNew(InputEvent); sptr->ie_proc = proc; @@ -1271,7 +1271,7 @@ void XtAppNextEvent( #ifdef XTHREADS /* assert(app->list[d] == event->xany.display); */ #endif - app->last = d; + app->last = (short) d; if (event->xany.type == MappingNotify) _XtRefreshMapping(event, False); UNLOCK_APP(app); @@ -1389,7 +1389,7 @@ void XtAppProcessEvent( #ifdef XTHREADS /* assert(app->list[d] == event.xany.display); */ #endif - app->last = d; + app->last = (short) d; if (event.xany.type == MappingNotify) { _XtRefreshMapping(&event, False); } @@ -1561,7 +1561,7 @@ Boolean XtAppPeekEvent( if (d != -1) { /* event */ GotEvent: XPeekEvent(app->list[d], event); - app->last = (d == 0 ? app->count : d) - 1; + app->last = (short) ((d == 0 ? app->count : d) - 1); UNLOCK_APP(app); return TRUE; } diff --git a/src/Object.c b/src/Object.c index ae1ac75..d5ed095 100644 --- a/src/Object.c +++ b/src/Object.c @@ -130,7 +130,7 @@ externaldef(objectClass) WidgetClass objectClass static void ConstructCallbackOffsets( - WidgetClass widgetClass) + WidgetClass myWidgetClass) { static XrmQuark QCallback = NULLQUARK; register int i; @@ -138,7 +138,7 @@ static void ConstructCallbackOffsets( register CallbackTable newTable; register CallbackTable superTable; register XrmResourceList resourceList; - ObjectClass objectClass = (ObjectClass)widgetClass; + ObjectClass myObjectClass = (ObjectClass)myWidgetClass; /* This function builds an array of pointers to the resource @@ -150,9 +150,9 @@ static void ConstructCallbackOffsets( if (QCallback == NULLQUARK) QCallback = XrmPermStringToQuark(XtRCallback); - if (objectClass->object_class.superclass != NULL) { + if (myObjectClass->object_class.superclass != NULL) { superTable = (CallbackTable) - ((ObjectClass) objectClass->object_class.superclass)-> + ((ObjectClass) myObjectClass->object_class.superclass)-> object_class.callback_private; tableSize = (int)(long) superTable[0]; } else { @@ -161,8 +161,8 @@ static void ConstructCallbackOffsets( } /* Count the number of callbacks */ - resourceList = (XrmResourceList) objectClass->object_class.resources; - for (i = objectClass->object_class.num_resources; --i >= 0; resourceList++) + resourceList = (XrmResourceList) myObjectClass->object_class.resources; + for (i = (int) myObjectClass->object_class.num_resources; --i >= 0; resourceList++) if (resourceList->xrm_type == QCallback) tableSize++; @@ -172,13 +172,13 @@ static void ConstructCallbackOffsets( * offsets so that resource overrides work. */ newTable = (CallbackTable) - __XtMalloc(sizeof(XrmResource *) * (tableSize + 1)); + __XtMalloc((Cardinal) (sizeof(XrmResource *) * (size_t) (tableSize + 1))); newTable[0] = (XrmResource *)(long) tableSize; if (superTable) tableSize -= (int)(long) superTable[0]; - resourceList = (XrmResourceList) objectClass->object_class.resources; + resourceList = (XrmResourceList) myObjectClass->object_class.resources; for (i=1; tableSize > 0; resourceList++) if (resourceList->xrm_type == QCallback) { newTable[i++] = resourceList; @@ -190,7 +190,7 @@ static void ConstructCallbackOffsets( --tableSize >= 0; superTable++) newTable[i++] = *superTable; - objectClass->object_class.callback_private = (XtPointer) newTable; + myObjectClass->object_class.callback_private = (XtPointer) newTable; } static void InheritObjectExtensionMethods( diff --git a/src/PassivGrab.c b/src/PassivGrab.c index 8d3a1d1..f8a10ad 100644 --- a/src/PassivGrab.c +++ b/src/PassivGrab.c @@ -111,7 +111,7 @@ static void DeleteDetailFromMask( int i; pDetailMask = (Mask *)__XtMalloc(sizeof(Mask) * MasksPerDetailMask); for (i = MasksPerDetailMask; --i >= 0; ) - pDetailMask[i] = ~0; + pDetailMask[i] = (unsigned long) (~0); *ppDetailMask = pDetailMask; } BITCLEAR((pDetailMask), detail); @@ -172,7 +172,7 @@ static XtServerGrabPtr CreateGrab( grab->eventMask = event_mask; grab->hasExt = need_ext; grab->confineToIsWidgetWin = (XtWindow (widget) == confine_to); - grab->modifiers = modifiers; + grab->modifiers = (unsigned short) modifiers; grab->keybut = keybut; if (need_ext) { XtServerGrabExtPtr ext = GRABEXT(grab); @@ -578,7 +578,7 @@ XtServerGrabPtr _XtCheckServerGrabsOnWidget ( * Extension may be representing keyboard group state in two upper bits. */ tempGrab.widget = widget; - tempGrab.keybut = event->xkey.keycode; /* also xbutton.button */ + tempGrab.keybut = (KeyCode) event->xkey.keycode; /* also xbutton.button */ tempGrab.modifiers = event->xkey.state & 0x1FFF; /*also xbutton.state*/ tempGrab.hasExt = False; @@ -782,8 +782,8 @@ void UngrabKeyOrButton ( /* Build a temporary grab list entry */ tempGrab.widget = widget; - tempGrab.modifiers = modifiers; - tempGrab.keybut = keyOrButton; + tempGrab.modifiers = (unsigned short) modifiers; + tempGrab.keybut = (KeyCode) keyOrButton; tempGrab.hasExt = False; LOCK_PROCESS; @@ -809,7 +809,7 @@ void UngrabKeyOrButton ( widget->core.window); else XUngrabButton(widget->core.screen->display, - keyOrButton, (unsigned int)modifiers, + (unsigned) keyOrButton, (unsigned int)modifiers, widget->core.window); } @@ -912,7 +912,7 @@ static int GrabDevice ( UNLOCK_PROCESS; if (!isKeyboard) returnVal = XGrabPointer(XtDisplay(widget), XtWindow(widget), - owner_events, event_mask, + owner_events, (unsigned) event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time); else diff --git a/src/Pointer.c b/src/Pointer.c index 4e53717..70b0ea8 100644 --- a/src/Pointer.c +++ b/src/Pointer.c @@ -75,7 +75,7 @@ Widget _XtProcessPointerEvent( { Cardinal i; - for (i = pdi->traceDepth; + for (i = (Cardinal) pdi->traceDepth; i > 0 && !newGrab; i--) newGrab = _XtCheckServerGrabsOnWidget((XEvent*)event, @@ -94,7 +94,7 @@ Widget _XtProcessPointerEvent( case ButtonRelease: { if ((device->grabType == XtPassiveServerGrab) && - !(event->state & ~(Button1Mask << (event->button - 1)) & + !(event->state & (unsigned)(~(Button1Mask << (event->button - 1))) & AllButtonsMask)) deactivateGrab = TRUE; } diff --git a/src/ResConfig.c b/src/ResConfig.c index eb21fd5..444cf70 100644 --- a/src/ResConfig.c +++ b/src/ResConfig.c @@ -702,8 +702,8 @@ _search_widget_tree ( if ((loose == NULL) && (tight == NULL)) return; - loose_len = (loose) ? strlen (loose) : 0; - tight_len = (tight) ? strlen (tight) : 0; + loose_len = (loose) ? (int) strlen (loose) : 0; + tight_len = (tight) ? (int) strlen (tight) : 0; if ((loose == NULL) || (tight_len > loose_len)) remainder = XtNewString (tight); @@ -774,16 +774,16 @@ _locate_children ( * count the number of children */ if (XtIsWidget (parent)) - num_children += parent->core.num_popups; + num_children = (int) ((Cardinal) num_children + parent->core.num_popups); if (XtIsComposite (parent)) - num_children += comp->composite.num_children; + num_children = (int) ((Cardinal) num_children + comp->composite.num_children); if (num_children == 0) { *children = NULL; return (0); } *children = (Widget *) - XtMalloc ((Cardinal) sizeof(Widget) * num_children); + XtMalloc ((Cardinal) (sizeof(Widget) * (size_t) num_children)); if (XtIsComposite (parent)) { for (i=0; i<comp->composite.num_children; i++) { diff --git a/src/Resources.c b/src/Resources.c index 562aac9..4eef3fd 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -290,7 +290,7 @@ void _XtCompileResourceList( xrmres->xrm_name = PSToQ(resources->resource_name); xrmres->xrm_class = PSToQ(resources->resource_class); xrmres->xrm_type = PSToQ(resources->resource_type); - xrmres->xrm_offset = (Cardinal) + xrmres->xrm_offset = (int) (-(int)resources->resource_offset - 1); xrmres->xrm_default_type = PSToQ(resources->default_type); } @@ -311,7 +311,7 @@ static void XrmCompileResourceListEphem( xrmres->xrm_name = StringToName(resources->resource_name); xrmres->xrm_class = StringToClass(resources->resource_class); xrmres->xrm_type = StringToQuark(resources->resource_type); - xrmres->xrm_offset = (Cardinal) + xrmres->xrm_offset = (int) (-(int)resources->resource_offset - 1); xrmres->xrm_default_type = StringToQuark(resources->default_type); } @@ -363,7 +363,7 @@ void _XtDependencies( /* Allocate and initialize new_res with superclass resource pointers */ new_num_res = super_num_res + class_num_res; - new_res = (XrmResourceList *) __XtMalloc(new_num_res*sizeof(XrmResourceList)); + new_res = (XrmResourceList *) __XtMalloc((Cardinal)(new_num_res*sizeof(XrmResourceList))); if (super_num_res > 0) XtMemmove(new_res, super_res, super_num_res * sizeof(XrmResourceList)); @@ -452,7 +452,7 @@ XrmResourceList* _XtCreateIndirectionTable ( register Cardinal idx; XrmResourceList* table; - table = (XrmResourceList*)__XtMalloc(num_resources * sizeof(XrmResourceList)); + table = (XrmResourceList*)__XtMalloc((Cardinal)(num_resources * sizeof(XrmResourceList))); for (idx = 0; idx < num_resources; idx++) table[idx] = (XrmResourceList)(&(resources[idx])); return table; @@ -491,7 +491,7 @@ static XtCacheRef *GetResources( XtCacheRef *cache_ptr, *cache_base; Boolean persistent_resources = True; Boolean found_persistence = False; - int num_typed_args = *pNumTypedArgs; + int num_typed_args = (int) *pNumTypedArgs; XrmDatabase db; Boolean do_tm_hack = False; @@ -584,12 +584,12 @@ static XtCacheRef *GetResources( db = XtScreenDatabase(XtScreenOfObject(widget)); while (!XrmQGetSearchList(db, names, classes, - searchList, searchListSize)) { + searchList, (int) searchListSize)) { if (searchList == stackSearchList) searchList = NULL; searchList = (XrmHashTable*)XtRealloc((char*)searchList, - sizeof(XrmHashTable) * - (searchListSize *= 2)); + (Cardinal) (sizeof(XrmHashTable) * + (searchListSize *= 2))); } if (persistent_resources) @@ -612,7 +612,7 @@ static XtCacheRef *GetResources( XrmValue from_val, to_val; from_type = StringToQuark(arg->type); - from_val.size = arg->size; + from_val.size = (Cardinal) arg->size; if ((from_type == QString) || ((unsigned) arg->size > sizeof(XtArgVal))) from_val.addr = (XPointer)arg->value; else @@ -645,12 +645,12 @@ static XtCacheRef *GetResources( if (widget->core.screen != oldscreen) { db = XtScreenDatabase(widget->core.screen); while (!XrmQGetSearchList(db, names, classes, - searchList, searchListSize)) { + searchList, (int) searchListSize)) { if (searchList == stackSearchList) searchList = NULL; searchList = (XrmHashTable*)XtRealloc((char*)searchList, - sizeof(XrmHashTable) * - (searchListSize *= 2)); + (Cardinal)(sizeof(XrmHashTable) * + (searchListSize *= 2))); } } } @@ -692,7 +692,7 @@ static XtCacheRef *GetResources( for (res = table, j = 0; j < num_resources; j++, res++) { rx = *res; - xrm_type = rx->xrm_type; + xrm_type = (XrmRepresentation) rx->xrm_type; if (typed[j]) { register XtTypedArg* arg = typed_args + typed[j] - 1; @@ -706,7 +706,7 @@ static XtCacheRef *GetResources( Boolean converted; from_type = StringToQuark(arg->type); - from_val.size = arg->size; + from_val.size = (Cardinal) arg->size; if ((from_type == QString) || ((unsigned) arg->size > sizeof(XtArgVal))) from_val.addr = (XPointer)arg->value; else @@ -733,7 +733,7 @@ static XtCacheRef *GetResources( */ if(rx->xrm_size > sizeof(XtArgVal)) { - arg->value = (XtArgVal) __XtMalloc(rx->xrm_size); + arg->value = (XtArgVal) (void *) __XtMalloc(rx->xrm_size); arg->size = -(arg->size); } else { /* will fit - copy directly into value field */ arg->value = (XtArgVal) NULL; @@ -755,7 +755,7 @@ static XtCacheRef *GetResources( Boolean have_value = False; if (XrmQGetSearchResource(searchList, - rx->xrm_name, rx->xrm_class, &rawType, &value)) { + (XrmName) rx->xrm_name, (XrmClass) rx->xrm_class, &rawType, &value)) { if (rawType != xrm_type) { convValue.size = rx->xrm_size; convValue.addr = (XPointer)(base - rx->xrm_offset - 1); @@ -774,7 +774,7 @@ static XtCacheRef *GetResources( || (rx->xrm_default_type == xrm_type) || (rx->xrm_default_addr != NULL))) { /* Convert default value to proper type */ - xrm_default_type = rx->xrm_default_type; + xrm_default_type = (XrmRepresentation) rx->xrm_default_type; if (xrm_default_type == QCallProc) { (*(XtResourceDefaultProc)(rx->xrm_default_addr))( widget,-(rx->xrm_offset+1), &value); @@ -806,7 +806,7 @@ static XtCacheRef *GetResources( } else { value.addr = rx->xrm_default_addr; if (xrm_default_type == QString) { - value.size = strlen((char *)value.addr) + 1; + value.size = (unsigned) strlen((char *)value.addr) + 1; } else { value.size = sizeof(XtPointer); } @@ -876,15 +876,15 @@ static XtCacheRef *GetResources( } } } - if ((Cardinal)num_typed_args != *pNumTypedArgs) *pNumTypedArgs = num_typed_args; + if ((Cardinal)num_typed_args != *pNumTypedArgs) *pNumTypedArgs = (Cardinal) num_typed_args; if (searchList != stackSearchList) XtFree((char*)searchList); if (!cache_ptr) cache_ptr = cache_base; if (cache_ptr && cache_ptr != cache_ref) { - int cache_ref_size = cache_ptr - cache_ref; + int cache_ref_size = (int) (cache_ptr - cache_ref); XtCacheRef *refs = (XtCacheRef*) - __XtMalloc((unsigned)sizeof(XtCacheRef)*(cache_ref_size + 1)); - (void) memmove(refs, cache_ref, sizeof(XtCacheRef)*cache_ref_size ); + __XtMalloc((Cardinal)(sizeof(XtCacheRef) * (size_t)(cache_ref_size + 1))); + (void) memmove(refs, cache_ref, sizeof(XtCacheRef)*(size_t)cache_ref_size ); refs[cache_ref_size] = NULL; return refs; } @@ -909,7 +909,7 @@ static void CacheArgs( count = (args != NULL) ? num_args : num_typed_args; if (num_quarks < count) { - quarks = (XrmQuarkList) __XtMalloc(count * sizeof(XrmQuark)); + quarks = (XrmQuarkList) __XtMalloc((Cardinal)(count * sizeof(XrmQuark))); } else { quarks = quark_cache; } diff --git a/src/Selection.c b/src/Selection.c index ead96fc..97f8232 100644 --- a/src/Selection.c +++ b/src/Selection.c @@ -139,7 +139,7 @@ static void RemoveParamInfo(Widget, Atom); static Atom GetParamInfo(Widget, Atom); static int StorageSize[3] = {1, sizeof(short), sizeof(long)}; -#define BYTELENGTH(length, format) ((length) * StorageSize[(format)>>4]) +#define BYTELENGTH(length, format) ((length) * (size_t)StorageSize[(format)>>4]) #define NUMELEM(bytelength, format) ((bytelength) / StorageSize[(format)>>4]) /* Xlib and Xt are permitted to have different memory allocators, and in the @@ -225,7 +225,7 @@ static Atom GetSelectionProperty( } propCount = sarray->propCount++; sarray->list = (SelectionProp) XtRealloc((XtPointer)sarray->list, - (unsigned)(sarray->propCount*sizeof(SelectionPropRec))); + (Cardinal)((size_t)sarray->propCount * sizeof(SelectionPropRec))); (void) snprintf(propname, sizeof(propname), "_XT_SELECTION_%d", propCount); sarray->list[propCount].prop = XInternAtom(dpy, propname, FALSE); sarray->list[propCount].avail = FALSE; @@ -281,13 +281,13 @@ static CallBackInfo MakeInfo( info->ctx = ctx; info->callbacks = (XtSelectionCallbackProc *) - __XtMalloc((unsigned) (count * sizeof(XtSelectionCallbackProc))); + __XtMalloc((unsigned) ((size_t)count * sizeof(XtSelectionCallbackProc))); (void) memmove((char*)info->callbacks, (char*)callbacks, - count * sizeof(XtSelectionCallbackProc)); + (size_t)count * sizeof(XtSelectionCallbackProc)); info->req_closure = - (XtPointer*)__XtMalloc((unsigned) (count * sizeof(XtPointer))); + (XtPointer*)__XtMalloc((unsigned) ((size_t)count * sizeof(XtPointer))); (void) memmove((char*)info->req_closure, (char*)closures, - count * sizeof(XtPointer)); + (size_t)count * sizeof(XtPointer)); if (count == 1 && properties != NULL && properties[0] != None) info->property = properties[0]; else { @@ -298,9 +298,9 @@ static CallBackInfo MakeInfo( info->proc = HandleSelectionReplies; info->widget = widget; info->time = time; - info->incremental = (Boolean*) __XtMalloc(count * sizeof(Boolean)); + info->incremental = (Boolean*) __XtMalloc((Cardinal)((size_t)count * sizeof(Boolean))); (void) memmove((char*)info->incremental, (char*) incremental, - count * sizeof(Boolean)); + (size_t)count * sizeof(Boolean)); info->current = 0; info->value = NULL; return (info); @@ -499,7 +499,7 @@ static void AddHandler( UNLOCK_PROCESS; if (requestWindowRec->active_transfer_count++ == 0) { XtRegisterDrawable(dpy, window, widget); - XSelectInput(dpy, window, mask); + XSelectInput(dpy, window, (long)mask); } XtAddRawEventHandler(widget, mask, FALSE, proc, closure); } @@ -579,7 +579,7 @@ static void SendIncrement( { Display *dpy = incr->ctx->dpy; - unsigned long incrSize = MAX_SELECTION_INCR(dpy); + unsigned long incrSize = (unsigned long) MAX_SELECTION_INCR(dpy); if (incrSize > incr->bytelength - incr->offset) incrSize = incr->bytelength - incr->offset; StartProtectedSection(dpy, incr->requestor); @@ -643,7 +643,7 @@ static void HandlePropertyGone( if (req->bytelength == 0) AllSent(req); else { - unsigned long size = MAX_SELECTION_INCR(ctx->dpy); + unsigned long size = (unsigned long) MAX_SELECTION_INCR(ctx->dpy); SendIncrement(req); (*(XtConvertSelectionIncrProc)ctx->convert) (ctx->widget, &ctx->selection, &req->target, @@ -725,7 +725,7 @@ static Boolean GetConversion( if (timestamp_target) { value = __XtMalloc(sizeof(long)); - *(long*)value = ctx->time; + *(long*)value = (long) ctx->time; targetType = XA_INTEGER; length = 1; format = 32; @@ -733,7 +733,7 @@ static Boolean GetConversion( else { ctx->ref_count++; if (ctx->incremental == TRUE) { - unsigned long size = MAX_SELECTION_INCR(ctx->dpy); + unsigned long size = (unsigned long) MAX_SELECTION_INCR(ctx->dpy); if ((*(XtConvertSelectionIncrProc)ctx->convert) (ctx->widget, &event->selection, &target, &targetType, &value, &length, &format, @@ -846,7 +846,7 @@ static void HandleSelectionEvents( event->xselectionrequest.property, 0L, 1000000, False,(Atom)AnyPropertyType, &target, &format, &length, &bytesafter, &value) == Success) - count = BYTELENGTH(length, format) / sizeof(IndirectPair); + count = (int) (BYTELENGTH(length, format) / sizeof(IndirectPair)); else count = 0; for (p = (IndirectPair *)value; count; p++, count--) { @@ -1206,7 +1206,7 @@ static void HandleGetIncrement( } else { /* add increment to collection */ if (info->incremental[n]) { #ifdef XT_COPY_SELECTION - int size = BYTELENGTH(length, info->format) + 1; + int size = (int) BYTELENGTH(length, info->format) + 1; char *tmp = __XtMalloc((Cardinal) size); (void) memmove(tmp, value, size); XFree(value); @@ -1215,14 +1215,14 @@ static void HandleGetIncrement( (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection, &info->type, value, &length, &info->format); } else { - int size = BYTELENGTH(length, info->format); + int size = (int) BYTELENGTH(length, info->format); if (info->offset + size > info->bytelength) { /* allocate enough for this and the next increment */ info->bytelength = info->offset + size * 2; info->value = XtRealloc(info->value, (Cardinal) info->bytelength); } - (void) memmove(&info->value[info->offset], value, size); + (void) memmove(&info->value[info->offset], value, (size_t)size); info->offset += size; XFree(value); } @@ -1253,7 +1253,7 @@ static void HandleNone( } -static long IncrPropSize( +static unsigned long IncrPropSize( Widget widget, unsigned char* value, int format, @@ -1261,7 +1261,7 @@ static long IncrPropSize( { unsigned long size; if (format == 32) { - size = ((long*)value)[length-1]; /* %%% what order for longs? */ + size = ((unsigned long*)value)[length-1]; /* %%% what order for longs? */ return size; } else { @@ -1315,7 +1315,7 @@ Boolean HandleNormal( XDeleteProperty(dpy, XtWindow(widget), property); #ifdef XT_COPY_SELECTION if (value) { /* it could have been deleted after the SelectionNotify */ - int size = BYTELENGTH(length, info->format) + 1; + int size = (int) BYTELENGTH(length, info->format) + 1; char *tmp = __XtMalloc((Cardinal) size); (void) memmove(tmp, value, size); XFree(value); @@ -1349,7 +1349,7 @@ static void HandleIncremental( XDeleteProperty(dpy, XtWindow(widget), property); XFlush(dpy); - info->bytelength = size; + info->bytelength = (int) size; if (info->incremental[info->current]) /* requestor wants incremental too */ info->value = NULL; /* so no need for buffer to assemble value */ else @@ -1453,7 +1453,7 @@ static void DoLocalTransfer( req->event.requestor = req->requestor = XtWindow(widget); if (ctx->incremental) { - unsigned long size = MAX_SELECTION_INCR(ctx->dpy); + unsigned long size = (unsigned long) MAX_SELECTION_INCR(ctx->dpy); if (!(*(XtConvertSelectionIncrProc)ctx->convert) (ctx->widget, &selection, &target, &resulttype, &value, &length, &format, @@ -1465,10 +1465,10 @@ static void DoLocalTransfer( Boolean allSent = FALSE; while (!allSent) { if (ctx->notify && (value != NULL)) { - int bytelength = BYTELENGTH(length,format); + int bytelength = (int) BYTELENGTH(length,format); /* both sides think they own this storage */ temp = __XtMalloc((unsigned)bytelength); - (void) memmove(temp, value, bytelength); + (void) memmove(temp, value, (size_t) bytelength); value = temp; } /* use care; older clients were never warned that @@ -1491,12 +1491,12 @@ static void DoLocalTransfer( } } else { while (length) { - int bytelength = BYTELENGTH(length, format); + int bytelength = (int) BYTELENGTH(length, format); total = XtRealloc(total, - (unsigned) (totallength += bytelength)); + (Cardinal) (totallength = totallength + (unsigned long)bytelength)); (void) memmove((char*)total + totallength - bytelength, value, - bytelength); + (size_t) bytelength); (*(XtConvertSelectionIncrProc)ctx->convert) (ctx->widget, &selection, &target, &resulttype, &value, &length, &format, @@ -1519,10 +1519,10 @@ static void DoLocalTransfer( HandleNone(widget, callback, closure, selection); } else { if (ctx->notify && (value != NULL)) { - int bytelength = BYTELENGTH(length,format); + int bytelength = (int) BYTELENGTH(length,format); /* both sides think they own this storage; better copy */ temp = __XtMalloc((unsigned)bytelength); - (void) memmove(temp, value, bytelength); + (void) memmove(temp, value, (size_t) bytelength); value = temp; } if (value == NULL) value = __XtMalloc((unsigned)1); @@ -1673,7 +1673,7 @@ static void GetSelectionValues( int i = 0, j = 0; passed_callbacks = (XtSelectionCallbackProc *) - XtStackAlloc(sizeof(XtSelectionCallbackProc) * count, stack_cbs); + XtStackAlloc(sizeof(XtSelectionCallbackProc) * (size_t)count, stack_cbs); /* To deal with the old calls from XtGetSelectionValues* we will repeat however many callbacks have been passed into @@ -1687,11 +1687,11 @@ static void GetSelectionValues( time, incremental, properties); XtStackFree((XtPointer) passed_callbacks, stack_cbs); - info->target = (Atom *)__XtMalloc((unsigned) ((count+1) * sizeof(Atom))); + info->target = (Atom *)__XtMalloc((unsigned) ((size_t)(count+1) * sizeof(Atom))); (*info->target) = ctx->prop_list->indirect_atom; (void) memmove((char *) info->target+sizeof(Atom), (char *) targets, - count * sizeof(Atom)); - pairs = (IndirectPair*)__XtMalloc((unsigned)(count*sizeof(IndirectPair))); + (size_t) count * sizeof(Atom)); + pairs = (IndirectPair*)__XtMalloc((unsigned)((size_t)count*sizeof(IndirectPair))); for (p = &pairs[count-1], t = &targets[count-1], i = count - 1; p >= pairs; p--, t--, i--) { p->target = *t; @@ -1728,7 +1728,7 @@ void XtGetSelectionValues( WIDGET_TO_APPCON(widget); LOCK_APP(app); - incremental = XtStackAlloc(count * sizeof(Boolean), incremental_values); + incremental = XtStackAlloc((size_t)count * sizeof(Boolean), incremental_values); for(i = 0; i < count; i++) incremental[i] = FALSE; if (IsGatheringRequest(widget, selection)) { AddSelectionRequests(widget, selection, count, targets, &callback, @@ -1757,7 +1757,7 @@ void XtGetSelectionValuesIncremental( WIDGET_TO_APPCON(widget); LOCK_APP(app); - incremental = XtStackAlloc(count * sizeof(Boolean), incremental_values); + incremental = XtStackAlloc((size_t)count * sizeof(Boolean), incremental_values); for(i = 0; i < count; i++) incremental[i] = TRUE; if (IsGatheringRequest(widget, selection)) { AddSelectionRequests(widget, selection, count, targets, &callback, @@ -1890,8 +1890,8 @@ static void AddSelectionRequests( qi->count += count; req = (QueuedRequest*) XtRealloc((char*) req, - (start + count) * - sizeof(QueuedRequest)); + (Cardinal)((size_t)(start + count) * + sizeof(QueuedRequest))); while(i < count) { QueuedRequest newreq = (QueuedRequest) __XtMalloc(sizeof(QueuedRequestRec)); @@ -2027,7 +2027,7 @@ void XtCreateSelectionRequest( while(queueInfo->selections[n] != None) n++; queueInfo->selections = (Atom*) XtRealloc((char*) queueInfo->selections, - (n + 2) * sizeof(Atom)); + (Cardinal)((size_t)(n + 2) * sizeof(Atom))); queueInfo->selections[n] = selection; queueInfo->selections[n + 1] = None; @@ -2082,12 +2082,12 @@ void XtSendSelectionRequest( int j = 0; /* Allocate */ - targets = (Atom *) XtStackAlloc(count * sizeof(Atom), t); + targets = (Atom *) XtStackAlloc((size_t)count * sizeof(Atom), t); cbs = (XtSelectionCallbackProc *) - XtStackAlloc(count * sizeof(XtSelectionCallbackProc), c); - closures = (XtPointer *) XtStackAlloc(count * sizeof(XtPointer), cs); - incrs = (Boolean *) XtStackAlloc(count * sizeof(Boolean), ins); - props = (Atom *) XtStackAlloc(count * sizeof(Atom), p); + XtStackAlloc((size_t)count * sizeof(XtSelectionCallbackProc), c); + closures = (XtPointer *) XtStackAlloc((size_t)count * sizeof(XtPointer), cs); + incrs = (Boolean *) XtStackAlloc((size_t)count * sizeof(Boolean), ins); + props = (Atom *) XtStackAlloc((size_t)count * sizeof(Atom), p); /* Copy */ for(i = 0; i < queueInfo->count; i++) { @@ -2163,7 +2163,7 @@ void XtSetSelectionParameters( XChangeProperty(dpy, window, property, type, format, PropModeReplace, - (unsigned char *) value, length); + (unsigned char *) value, (int) length); } /* Retrieves data passed in a parameter. Data for this is stored @@ -2182,7 +2182,7 @@ void XtGetSelectionParameters( WIDGET_TO_APPCON(owner); *value_return = NULL; - *length_return = *format_return = 0; + *length_return = (unsigned long) (*format_return = 0); *type_return = None; LOCK_APP(app); @@ -2199,7 +2199,7 @@ void XtGetSelectionParameters( EndProtectedSection(dpy); #ifdef XT_COPY_SELECTION if (*value_return) { - int size = BYTELENGTH(*length_return, *format_return) + 1; + int size = (int) BYTELENGTH(*length_return, *format_return) + 1; char *tmp = __XtMalloc((Cardinal) size); (void) memmove(tmp, *value_return, size); XFree(*value_return); @@ -2239,7 +2239,7 @@ static void AddParamInfo( (char *)pinfo); } else { - for (n = pinfo->count, p = pinfo->paramlist; n; n--, p++) { + for (n = (int) pinfo->count, p = pinfo->paramlist; n; n--, p++) { if (p->selection == None || p->selection == selection) break; } @@ -2247,7 +2247,7 @@ static void AddParamInfo( pinfo->count++; pinfo->paramlist = (Param) XtRealloc((char*) pinfo->paramlist, - pinfo->count * sizeof(ParamRec)); + (Cardinal)(pinfo->count * sizeof(ParamRec))); p = &pinfo->paramlist[pinfo->count - 1]; (void) XSaveContext(XtDisplay(w), XtWindow(w), paramPropertyContext, (char *)pinfo); @@ -2273,7 +2273,7 @@ static void RemoveParamInfo( (XPointer *) &pinfo) == 0)) { /* Find and invalidate the parameter data. */ - for (n = pinfo->count, p = pinfo->paramlist; n; n--, p++) { + for (n = (int) pinfo->count, p = pinfo->paramlist; n; n--, p++) { if (p->selection != None) { if (p->selection == selection) p->selection = None; @@ -2305,7 +2305,7 @@ static Atom GetParamInfo( && (XFindContext(XtDisplay(w), XtWindow(w), paramPropertyContext, (XPointer *) &pinfo) == 0)) { - for (n = pinfo->count, p = pinfo->paramlist; n; n--, p++) + for (n = (int) pinfo->count, p = pinfo->paramlist; n; n--, p++) if (p->selection == selection) { atom = p->param; break; diff --git a/src/SetValues.c b/src/SetValues.c index f274000..d057e94 100644 --- a/src/SetValues.c +++ b/src/SetValues.c @@ -432,8 +432,8 @@ void XtSetValues( XtName(w),XtName(pw))); XClearArea (XtDisplay (pw), XtWindow (pw), r->rectangle.x, r->rectangle.y, - r->rectangle.width + bw2, - r->rectangle.height + bw2,TRUE); + (unsigned) (r->rectangle.width + bw2), + (unsigned) (r->rectangle.height + bw2), TRUE); } } } diff --git a/src/Shell.c b/src/Shell.c index f160527..5112f02 100644 --- a/src/Shell.c +++ b/src/Shell.c @@ -1193,11 +1193,11 @@ static void Realize( */ register Widget *childP = w->composite.children; int i; - for (i = w->composite.num_children; i; i--, childP++) { + for (i = (int) w->composite.num_children; i; i--, childP++) { if (XtIsWidget(*childP) && XtIsManaged(*childP)) { if ((*childP)->core.background_pixmap != XtUnspecifiedPixmap) { - mask &= ~(CWBackPixel); + mask &= (unsigned long) (~(CWBackPixel)); mask |= CWBackPixmap; attr->background_pixmap = w->core.background_pixmap = @@ -1502,7 +1502,7 @@ static void _popup_set_prop( XInternAtom(XtDisplay((Widget)w), "WM_LOCALE_NAME", False), XA_STRING, 8, PropModeReplace, - (unsigned char *)locale, strlen(locale)); + (unsigned char *)locale, (int) strlen(locale)); } UNLOCK_PROCESS; @@ -1525,7 +1525,7 @@ static void _popup_set_prop( "SM_CLIENT_ID", False), XA_STRING, 8, PropModeReplace, (unsigned char *) sm_client_id, - strlen(sm_client_id)); + (int) strlen(sm_client_id)); } } } @@ -1537,7 +1537,7 @@ static void _popup_set_prop( "WM_WINDOW_ROLE", False), XA_STRING, 8, PropModeReplace, (unsigned char *)wmshell->wm.window_role, - strlen(wmshell->wm.window_role)); + (int) strlen(wmshell->wm.window_role)); } /* ARGSUSED */ @@ -1567,16 +1567,16 @@ static void EventHandler( if( NEQ(width) || NEQ(height) || NEQ(border_width) ) { sizechanged = TRUE; #undef NEQ - w->core.width = event->xconfigure.width; - w->core.height = event->xconfigure.height; - w->core.border_width = event->xconfigure.border_width; + w->core.width = (Dimension) event->xconfigure.width; + w->core.height = (Dimension) event->xconfigure.height; + w->core.border_width = (Dimension) event->xconfigure.border_width; } if (event->xany.send_event /* ICCCM compliant synthetic ev */ /* || w->shell.override_redirect */ || w->shell.client_specified & _XtShellNotReparented) { - w->core.x = event->xconfigure.x; - w->core.y = event->xconfigure.y; + w->core.x = (Position) event->xconfigure.x; + w->core.y = (Position) event->xconfigure.y; w->shell.client_specified |= _XtShellPositionValid; } else w->shell.client_specified &= ~_XtShellPositionValid; @@ -1599,8 +1599,8 @@ static void EventHandler( w->shell.client_specified &= ~(_XtShellNotReparented | _XtShellPositionValid); else { - w->core.x = event->xreparent.x; - w->core.y = event->xreparent.y; + w->core.x = (Position) event->xreparent.x; + w->core.y = (Position) event->xreparent.y; w->shell.client_specified |= (_XtShellNotReparented | _XtShellPositionValid); } @@ -1885,7 +1885,7 @@ static XtGeometryResult GeometryManager( wid->core.width = shell->core.width; wid->core.height = shell->core.height; if (request->request_mode & CWBorderWidth) { - wid->core.x = wid->core.y = -request->border_width; + wid->core.x = wid->core.y = (Position) (-request->border_width); } } return XtGeometryYes; @@ -1941,7 +1941,7 @@ static Boolean _wait_for_response( unsigned long timeout; if (XtIsWMShell((Widget)w)) - timeout = ((WMShellWidget)w)->wm.wm_timeout; + timeout = (unsigned long) ((WMShellWidget)w)->wm.wm_timeout; else timeout = DEFAULT_WM_TIMEOUT; @@ -2008,16 +2008,16 @@ static XtGeometryResult RootGeometryManager( oldborder_width = w->core.border_width; #define PutBackGeometry() \ - { w->core.x = oldx; \ - w->core.y = oldy; \ - w->core.width = oldwidth; \ - w->core.height = oldheight; \ - w->core.border_width = oldborder_width; } + { w->core.x = (Position) (oldx); \ + w->core.y = (Position) (oldy); \ + w->core.width = (Dimension) (oldwidth); \ + w->core.height = (Dimension) (oldheight); \ + w->core.border_width = (Dimension) (oldborder_width); } if (mask & CWX) { - if (w->core.x == request->x) mask &= ~CWX; + if (w->core.x == request->x) mask &= (unsigned int) (~CWX); else { - w->core.x = values.x = request->x; + w->core.x = (Position) (values.x = request->x); if (wm) { hintp->flags &= ~USPosition; hintp->flags |= PPosition; @@ -2026,9 +2026,9 @@ static XtGeometryResult RootGeometryManager( } } if (mask & CWY) { - if (w->core.y == request->y) mask &= ~CWY; + if (w->core.y == request->y) mask &= (unsigned int) (~CWY); else { - w->core.y = values.y = request->y; + w->core.y = (Position) (values.y = request->y); if (wm) { hintp->flags &= ~USPosition; hintp->flags |= PPosition; @@ -2038,16 +2038,16 @@ static XtGeometryResult RootGeometryManager( } if (mask & CWBorderWidth) { if (w->core.border_width == request->border_width) { - mask &= ~CWBorderWidth; + mask &= (unsigned int) (~CWBorderWidth); } else w->core.border_width = - values.border_width = - request->border_width; + (Dimension) (values.border_width = + request->border_width); } if (mask & CWWidth) { - if (w->core.width == request->width) mask &= ~CWWidth; + if (w->core.width == request->width) mask &= (unsigned int) (~CWWidth); else { - w->core.width = values.width = request->width; + w->core.width = (Dimension)(values.width = request->width); if (wm) { hintp->flags &= ~USSize; hintp->flags |= PSize; @@ -2056,9 +2056,9 @@ static XtGeometryResult RootGeometryManager( } } if (mask & CWHeight) { - if (w->core.height == request->height) mask &= ~CWHeight; + if (w->core.height == request->height) mask &= (unsigned int) (~CWHeight); else { - w->core.height = values.height = request->height; + w->core.height = (Dimension)(values.height = request->height); if (wm) { hintp->flags &= ~USSize; hintp->flags |= PSize; @@ -2113,7 +2113,7 @@ static XtGeometryResult RootGeometryManager( /* If no non-stacking bits are set, there's no way to tell whether or not this worked, so assume it did */ - if (!(mask & ~(CWStackMode | CWSibling))) return XtGeometryYes; + if (!(mask & (unsigned)(~(CWStackMode | CWSibling)))) return XtGeometryYes; if (wm && ((WMShellWidget)w)->wm.wait_for_wm == FALSE) { /* the window manager is sick @@ -2184,14 +2184,14 @@ static XtGeometryResult RootGeometryManager( return XtGeometryNo; } else { - w->core.width = event.xconfigure.width; - w->core.height = event.xconfigure.height; - w->core.border_width = event.xconfigure.border_width; + w->core.width = (Dimension) event.xconfigure.width; + w->core.height = (Dimension) event.xconfigure.height; + w->core.border_width = (Dimension) event.xconfigure.border_width; if (event.xany.send_event || /* ICCCM compliant synth */ w->shell.client_specified & _XtShellNotReparented) { - w->core.x = event.xconfigure.x; - w->core.y = event.xconfigure.y; + w->core.x = (Position) event.xconfigure.x; + w->core.y = (Position) event.xconfigure.y; w->shell.client_specified |= _XtShellPositionValid; } else w->shell.client_specified &= ~_XtShellPositionValid; @@ -2377,7 +2377,7 @@ static Boolean WMSetValues( False), XA_STRING, 8, PropModeReplace, (unsigned char *)nwmshell->wm.window_role, - strlen(nwmshell->wm.window_role)); + (int) strlen(nwmshell->wm.window_role)); } else if (XtIsRealized(new) && ! nwmshell->wm.window_role) { XDeleteProperty(XtDisplay(new), XtWindow(new), XInternAtom(XtDisplay(new), "WM_WINDOW_ROLE", @@ -2487,11 +2487,11 @@ static String * NewArgv( if (count <= 0 || !str) return NULL; - for (num = count; num--; str++) { - nbytes += strlen(*str); + for (num = (Cardinal) count; num--; str++) { + nbytes = (nbytes + (Cardinal) strlen(*str)); nbytes++; } - num = (count+1) * sizeof(String); + num = (Cardinal) ((size_t)(count+1) * sizeof(String)); new = newarray = (String *) __XtMalloc(num + nbytes); sptr = ((char *) new) + num; @@ -2661,7 +2661,7 @@ static Boolean SessionSetValues( False), XA_STRING, 8, PropModeReplace, (unsigned char *) nw->session.session_id, - strlen(nw->session.session_id)); + (int) strlen(nw->session.session_id)); } } return False; @@ -2682,8 +2682,8 @@ void _XtShellGetCoordinates( (int) -w->core.border_width, (int) -w->core.border_width, &tmpx, &tmpy, &tmpchild); - w->core.x = tmpx; - w->core.y = tmpy; + w->core.x = (Position) tmpx; + w->core.y = (Position) tmpy; w->shell.client_specified |= _XtShellPositionValid; } *x = w->core.x; @@ -2853,10 +2853,10 @@ static String * NewStringArray(String *str) if (!str) return NULL; for (num = 0; *str; num++, str++) { - nbytes += strlen(*str); + nbytes = nbytes + (Cardinal)strlen(*str); nbytes++; } - num = (num + 1) * sizeof(String); + num = (Cardinal)((size_t)(num + 1) * sizeof(String)); new = newarray = (String *) __XtMalloc(num + nbytes); sptr = ((char *) new) + num; @@ -2906,7 +2906,7 @@ static SmProp * ArrayPack(char *name, XtPointer closure) p->num_vals = 1; p->type = SmARRAY8; p->name = name; - p->vals->length = strlen(prop) + 1; + p->vals->length = (int) strlen(prop) + 1; p->vals->value = prop; return p; } @@ -2923,13 +2923,13 @@ static SmProp * ListPack( for (ptr = prop; *ptr; ptr++) n++; - p = (SmProp*) __XtMalloc(sizeof(SmProp) + (Cardinal)(n*sizeof(SmPropValue))); + p = (SmProp*) __XtMalloc((Cardinal)(sizeof(SmProp) + (size_t)n * sizeof(SmPropValue))); p->vals = (SmPropValue *) (((char *) p) + sizeof(SmProp)); p->num_vals = n; p->type = SmLISTofARRAY8; p->name = name; for (ptr = prop, vals = p->vals; *ptr; ptr++, vals++) { - vals->length = strlen(*ptr) + 1; + vals->length = (int) strlen(*ptr) + 1; vals->value = *ptr; } return p; @@ -3099,8 +3099,8 @@ static void XtCallSaveCallbacks( save->next = NULL; save->save_type = save_type; save->interact_style = interact; - save->shutdown = shutdown; - save->fast = fast; + save->shutdown = (Boolean) shutdown; + save->fast = (Boolean) fast; save->cancel_shutdown = False; save->phase = 1; save->interact_dialog_type = SmDialogNormal; @@ -3380,7 +3380,7 @@ static String* EditCommand( count++; if (want) { - s = new = (String *) __XtMalloc((Cardinal)(count+3) * sizeof(String*)); + s = new = (String *) __XtMalloc((Cardinal)((size_t) (count+3) * sizeof(String*))); *s = *sarray; s++; sarray++; *s = "-xtsessionID"; s++; *s = str; s++; @@ -3390,7 +3390,7 @@ static String* EditCommand( } else { if (count < 3) return NewStringArray(sarray); - s = new = (String *) __XtMalloc((Cardinal)(count-1) * sizeof(String*)); + s = new = (String *) __XtMalloc((Cardinal)((size_t)(count-1) * sizeof(String*))); for (; --count >= 0; sarray++) { if (strcmp(*sarray, "-xtsessionID") == 0) { sarray++; diff --git a/src/TMaction.c b/src/TMaction.c index 2e49ffc..37e3ef1 100644 --- a/src/TMaction.c +++ b/src/TMaction.c @@ -117,16 +117,16 @@ static CompiledActionTable CompileActionTable( if (! stat) { cTableHold = cActions = (CompiledActionTable) - __XtMalloc(count * sizeof(CompiledAction)); + __XtMalloc((Cardinal)((size_t)count * sizeof(CompiledAction))); - for (i=count; --i >= 0; cActions++, actions++) { + for (i= (int)count; --i >= 0; cActions++, actions++) { cActions->proc = actions->proc; cActions->signature = (*func)(actions->string); } } else { cTableHold = (CompiledActionTable) actions; - for (i=count; --i >= 0; actions++) + for (i= (int)count; --i >= 0; actions++) ((CompiledActionTable) actions)->signature = (*func)(actions->string); } @@ -136,7 +136,7 @@ static CompiledActionTable CompileActionTable( for (i=1; (Cardinal) i <= count - 1; i++) { register Cardinal j; hold = cActions[i]; - j = i; + j = (Cardinal)i; while (j && cActions[j-1].signature > hold.signature) { cActions[j] = cActions[j-1]; j--; @@ -181,7 +181,7 @@ static void ReportUnboundActions( String s = XrmQuarkToString(stateTree->quarkTbl[j]); if (num_unbound != 0) num_chars += 2; - num_chars += strlen(s); + num_chars += (Cardinal)strlen(s); num_unbound++; } } @@ -228,7 +228,7 @@ static CompiledAction *SearchActionTable( register int i, left, right; left = 0; - right = numActions - 1; + right = (int)numActions - 1; while (left <= right) { i = (left + right) >> 1; if (signature < actionTable[i].signature) @@ -251,7 +251,7 @@ static int BindActions( TMShortCard numActions, Cardinal *ndxP) { - register int unbound = stateTree->numQuarks - *ndxP; + register int unbound = (int)(stateTree->numQuarks - *ndxP); CompiledAction* action; register Cardinal ndx; register Boolean savedNdx = False; @@ -331,7 +331,7 @@ static int BindProcs( BindActions(stateTree, procs, GetClassActions(class), - class->core_class.num_actions, + (TMShortCard) class->core_class.num_actions, &ndx); class = class->core_class.superclass; } while (unbound != 0 && class != NULL); @@ -444,7 +444,7 @@ static XtActionProc *EnterBindCache( LOCK_PROCESS; classCache = GetClassCache(w); bindCachePtr = &classCache->bindCache; - procsSize = stateTree->numQuarks * sizeof(XtActionProc); + procsSize = (TMShortCard)(stateTree->numQuarks * sizeof(XtActionProc)); for (bindCache = *bindCachePtr; (*bindCachePtr); @@ -466,8 +466,8 @@ static XtActionProc *EnterBindCache( { *bindCachePtr = bindCache = (TMBindCache) - __XtMalloc(sizeof(TMBindCacheRec) + - (procsSize - sizeof(XtActionProc))); + __XtMalloc((Cardinal)(sizeof(TMBindCacheRec) + + (size_t)(procsSize - sizeof(XtActionProc)))); bindCache->next = NULL; bindCache->status = *bindStatus; bindCache->status.refCount = 1; @@ -776,7 +776,7 @@ void XtAppAddActions( rec->next = app->action_table; app->action_table = rec; rec->table = CompileActionTable(actions, num_actions, False, False); - rec->count = num_actions; + rec->count = (TMShortCard) num_actions; UNLOCK_APP(app); } @@ -804,10 +804,10 @@ void XtGetActionList( *num_actions_return = widget_class->core_class.num_actions; if (*num_actions_return) { list = *actions_return = (XtActionList) - __XtMalloc(*num_actions_return * sizeof(XtActionsRec)); + __XtMalloc((Cardinal)((size_t)*num_actions_return * sizeof(XtActionsRec))); table = GetClassActions(widget_class); if (table != NULL) { - for (i= (*num_actions_return); --i >= 0; list++, table++) { + for (i= (int)(*num_actions_return); --i >= 0; list++, table++) { list->string = XrmQuarkToString(table->signature); list->proc = table->proc; } diff --git a/src/TMgrab.c b/src/TMgrab.c index 08cb486..25c5540 100644 --- a/src/TMgrab.c +++ b/src/TMgrab.c @@ -102,8 +102,8 @@ static void GrabAllCorrectKeys( &careOn, &careMask); if (!resolved) return; } - careOn |= modMatch->modifiers; - careMask |= modMatch->modifierMask; + careOn = (careOn | (Modifiers)modMatch->modifiers); + careMask = (careMask | (Modifiers)modMatch->modifierMask); XtKeysymToKeycodeList( dpy, @@ -130,13 +130,13 @@ static void GrabAllCorrectKeys( ); /* continue; */ /* grab all modifier combinations */ } - least_mod = modifiers_return & (~modifiers_return + 1); - for (std_mods = modifiers_return; + least_mod = (int) (modifiers_return & (~modifiers_return + 1)); + for (std_mods = (int) modifiers_return; std_mods >= least_mod; std_mods--) { Modifiers dummy; /* check all useful combinations of modifier bits */ - if (modifiers_return & std_mods && - !(~modifiers_return & std_mods)) { + if ((modifiers_return & (Modifiers)std_mods) && + !(~modifiers_return & (Modifiers)std_mods)) { XtTranslateKeycode( dpy, *keycodeP, (Modifiers)std_mods, &dummy, &keysym ); @@ -205,10 +205,10 @@ static Boolean DoGrab( &careOn, &careMask); if (!resolved) break; } - careOn |= modMatch->modifiers; + careOn = (careOn | (Modifiers) modMatch->modifiers); XtGrabButton( widget, - (unsigned) typeMatch->eventCode, + (int) typeMatch->eventCode, careOn, grabP->owner_events, grabP->event_mask, @@ -277,7 +277,7 @@ void _XtRegisterGrabs( */ doGrab.widget = widget; doGrab.grabP = grabP; - doGrab.count = count; + doGrab.count = (TMShortCard) count; _XtTraverseStateTree((TMStateTree)*stateTreePtr, DoGrab, (XtPointer)&doGrab); diff --git a/src/TMkey.c b/src/TMkey.c index 864b6ec..353bf98 100644 --- a/src/TMkey.c +++ b/src/TMkey.c @@ -136,7 +136,7 @@ FM(0x1e), FM(0x9e), FM(0x5e), FM(0xde), FM(0x3e), FM(0xbe), FM(0x7e), FM(0xfe) #define TRANSLATE(ctx,pd,dpy,key,mod,mod_ret,sym_ret) \ { \ - int _i_ = (((key) - (pd)->min_keycode + modmix[(mod) & 0xff]) & \ + int _i_ = (((key) - (TMLongCard) (pd)->min_keycode + modmix[(mod) & 0xff]) & \ (TMKEYCACHESIZE-1)); \ if ((key) == 0) { /* Xlib XIM composed input */ \ mod_ret = 0; \ @@ -147,8 +147,8 @@ FM(0x1e), FM(0x9e), FM(0x5e), FM(0xde), FM(0x3e), FM(0xbe), FM(0x7e), FM(0xfe) mod_ret = MOD_RETURN(ctx, key); \ sym_ret = (ctx)->keycache.keysym[_i_]; \ } else { \ - XtTranslateKeycode(dpy, key, mod, &mod_ret, &sym_ret); \ - (ctx)->keycache.keycode[_i_] = key; \ + XtTranslateKeycode(dpy, (KeyCode) key, mod, &mod_ret, &sym_ret); \ + (ctx)->keycache.keycode[_i_] = (KeyCode) (key); \ (ctx)->keycache.modifiers[_i_] = (unsigned char)(mod); \ (ctx)->keycache.keysym[_i_] = sym_ret; \ MOD_RETURN(ctx, key) = (unsigned char)mod_ret; \ @@ -157,12 +157,12 @@ FM(0x1e), FM(0x9e), FM(0x5e), FM(0xde), FM(0x3e), FM(0xbe), FM(0x7e), FM(0xfe) #define UPDATE_CACHE(ctx, pd, key, mod, mod_ret, sym_ret) \ { \ - int _i_ = (((key) - (pd)->min_keycode + modmix[(mod) & 0xff]) & \ + int _i_ = (((key) - (TMLongCard) (pd)->min_keycode + modmix[(mod) & 0xff]) & \ (TMKEYCACHESIZE-1)); \ - (ctx)->keycache.keycode[_i_] = key; \ + (ctx)->keycache.keycode[_i_] = (KeyCode) (key); \ (ctx)->keycache.modifiers[_i_] = (unsigned char)(mod); \ (ctx)->keycache.keysym[_i_] = sym_ret; \ - MOD_RETURN(ctx, key) = (unsigned char)mod_ret; \ + MOD_RETURN(ctx, key) = (unsigned char)(mod_ret); \ } /* usual number of expected keycodes in XtKeysymToKeycodeList */ @@ -262,8 +262,8 @@ Boolean _XtMatchUsingDontCareMods( resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers, &computed, &computedMask); if (!resolved) return FALSE; - computed |= modMatch->modifiers; - computedMask |= modMatch->modifierMask; /* gives do-care mask */ + computed = (Modifiers) (computed | modMatch->modifiers); + computedMask = (Modifiers) (computedMask | modMatch->modifierMask); /* gives do-care mask */ if ( (computed & computedMask) == (eventSeq->event.modifiers & computedMask) ) { @@ -283,7 +283,7 @@ Boolean _XtMatchUsingDontCareMods( useful_mods = ~computedMask & modifiers_return; if (useful_mods == 0) return FALSE; - switch (num_modbits = num_bits(useful_mods)) { + switch (num_modbits = (int) num_bits(useful_mods)) { case 1: case 8: /* @@ -296,7 +296,7 @@ Boolean _XtMatchUsingDontCareMods( * applications. We can only hope that Motif's virtual * modifiers won't result in all eight modbits being set. */ - for (i = useful_mods; i > 0; i--) { + for (i = (int) useful_mods; i > 0; i--) { TRANSLATE(tm_context, pd, dpy, eventSeq->event.eventCode, (Modifiers)i, modifiers_return, keysym_return); if (keysym_return == @@ -389,13 +389,13 @@ Boolean _XtMatchUsingStandardMods ( modifiers_return = MOD_RETURN(tm_context, eventSeq->event.eventCode); if (!modifiers_return) { XtTranslateKeycode(dpy, (KeyCode)eventSeq->event.eventCode, - eventSeq->event.modifiers, &modifiers_return, + (Modifiers)eventSeq->event.modifiers, &modifiers_return, &keysym_return); - translateModifiers = eventSeq->event.modifiers & modifiers_return; + translateModifiers = (Modifiers) (eventSeq->event.modifiers & modifiers_return); UPDATE_CACHE(tm_context, pd, eventSeq->event.eventCode, translateModifiers, modifiers_return, keysym_return); } else { - translateModifiers = eventSeq->event.modifiers & modifiers_return; + translateModifiers = (Modifiers) (eventSeq->event.modifiers & modifiers_return); TRANSLATE(tm_context, pd, dpy, (KeyCode)eventSeq->event.eventCode, translateModifiers, modifiers_return, keysym_return); } @@ -406,8 +406,8 @@ Boolean _XtMatchUsingStandardMods ( resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers, &computed, &computedMask); if (!resolved) return FALSE; - computed |= modMatch->modifiers; - computedMask |= modMatch->modifierMask; + computed = (Modifiers) (computed | modMatch->modifiers); + computedMask = (Modifiers) (computedMask | modMatch->modifierMask); if ((computed & computedMask) == (eventSeq->event.modifiers & ~modifiers_return & computedMask)) { @@ -437,7 +437,7 @@ void _XtBuildKeysymTables( if (pd->keysyms) XFree( (char *)pd->keysyms ); pd->keysyms_serial = NextRequest(dpy); - pd->keysyms = XGetKeyboardMapping(dpy, pd->min_keycode, + pd->keysyms = XGetKeyboardMapping(dpy, (KeyCode) pd->min_keycode, pd->max_keycode-pd->min_keycode+1, &pd->keysyms_per_keycode); if (pd->modKeysyms) @@ -472,21 +472,21 @@ void _XtBuildKeysymTables( for (j=0;j<modKeymap->max_keypermod;j++) { keycode = modKeymap->modifiermap[i*modKeymap->max_keypermod+j]; if (keycode != 0) { - pd->isModifier[keycode>>3] |= 1 << (keycode & 7); + pd->isModifier[keycode>>3] |= (unsigned char) (1 << (keycode & 7)); for (k=0; k<pd->keysyms_per_keycode;k++) { idx = ((keycode-pd->min_keycode)* pd->keysyms_per_keycode)+k; keysym = pd->keysyms[idx]; if ((keysym == XK_Mode_switch) && (i > 2)) - pd->mode_switch |= 1 << i; + pd->mode_switch = (pd->mode_switch | (Modifiers) (1 << i)); if ((keysym == XK_Num_Lock) && (i > 2)) - pd->num_lock |= 1 << i; + pd->num_lock = (pd->num_lock | (Modifiers) (1 << i)); if (keysym != 0 && keysym != tempKeysym ){ if (tempCount==maxCount) { maxCount += KeysymTableSize; pd->modKeysyms = (KeySym*)XtRealloc( (char*)pd->modKeysyms, - (unsigned) (maxCount*sizeof(KeySym)) ); + (unsigned) ((size_t)maxCount * sizeof(KeySym)) ); } pd->modKeysyms[tempCount++] = keysym; table[i].count++; @@ -656,7 +656,7 @@ KeySym *XtGetKeysymTable( LOCK_APP(app); pd = _XtGetPerDisplay(dpy); _InitializeKeysymTables(dpy, pd); - *min_keycode_return = pd->min_keycode; /* %%% */ + *min_keycode_return = (KeyCode) pd->min_keycode; /* %%% */ *keysyms_per_keycode_return = pd->keysyms_per_keycode; retval = pd->keysyms; UNLOCK_APP(app); diff --git a/src/TMparse.c b/src/TMparse.c index cdfacd1..9d46db4 100644 --- a/src/TMparse.c +++ b/src/TMparse.c @@ -445,7 +445,7 @@ static void Compile_XtEventTable( register int i; register EventKeys entry = table; - for (i=count; --i >= 0; entry++) + for (i= (int)count; --i >= 0; entry++) entry->signature = XrmPermStringToQuark(entry->event); qsort(table, count, sizeof(EventKey), OrderEvents); } @@ -463,7 +463,7 @@ static void Compile_XtModifierTable( register int i; register ModifierKeys entry = table; - for (i=count; --i >= 0; entry++) + for (i= (int)count; --i >= 0; entry++) entry->signature = XrmPermStringToQuark(entry->name); qsort(table, count, sizeof(ModifierRec), OrderModifiers); } @@ -666,7 +666,7 @@ static String FetchModifierToken( modStr = XtStackAlloc ((size_t)(str - start + 1), modStrbuf); if (modStr == NULL) _XtAllocError (NULL); - (void) memmove(modStr, start, str-start); + (void) memmove(modStr, start, (size_t) (str - start)); modStr[str-start] = '\0'; *token_return = XrmStringToQuark(modStr); XtStackFree (modStr, modStrbuf); @@ -691,7 +691,7 @@ static String ParseModifiers( exclusive = FALSE; if (start != str) { if (Qmod == QNone) { - event->event.modifierMask = ~0; + event->event.modifierMask = (unsigned long) (~0); event->event.modifiers = 0; ScanWhitespace(str); return str; @@ -749,11 +749,11 @@ static String ParseModifiers( return PanicModeRecovery(str); } event->event.modifierMask |= maskBit; - if (notFlag) event->event.modifiers &= ~maskBit; + if (notFlag) event->event.modifiers = (event->event.modifiers & (TMLongCard) (~maskBit)); else event->event.modifiers |= maskBit; ScanWhitespace(str); } - if (exclusive) event->event.modifierMask = ~0; + if (exclusive) event->event.modifierMask = (unsigned long) (~0); return str; } @@ -770,13 +770,13 @@ static String ParseXtEventType( ScanAlphanumeric(str); eventTypeStr = XtStackAlloc ((size_t)(str - start + 1), eventTypeStrbuf); if (eventTypeStr == NULL) _XtAllocError (NULL); - (void) memmove(eventTypeStr, start, str-start); + (void) memmove(eventTypeStr, start, (size_t)(str-start)); eventTypeStr[str-start] = '\0'; *tmEventP = LookupTMEventType(eventTypeStr,error); XtStackFree (eventTypeStr, eventTypeStrbuf); if (*error) return PanicModeRecovery(str); - event->event.eventType = events[*tmEventP].eventType; + event->event.eventType = (TMLongCard) events[*tmEventP].eventType; return str; } @@ -787,9 +787,9 @@ static unsigned long StrToHex( register unsigned long val = 0; while ((c = *str)) { - if ('0' <= c && c <= '9') val = val*16+c-'0'; - else if ('a' <= c && c <= 'z') val = val*16+c-'a'+10; - else if ('A' <= c && c <= 'Z') val = val*16+c-'A'+10; + if ('0' <= c && c <= '9') val = (unsigned long) (val * 16 + (unsigned long)c - '0'); + else if ('a' <= c && c <= 'z') val = (unsigned long) (val*16+(unsigned long)c-'a'+10); + else if ('A' <= c && c <= 'Z') val = (unsigned long) (val*16+(unsigned long)c-'A'+10); else return 0; str++; } @@ -804,7 +804,7 @@ static unsigned long StrToOct( register unsigned long val = 0; while ((c = *str)) { - if ('0' <= c && c <= '7') val = val*8+c-'0'; else return 0; + if ('0' <= c && c <= '7') val = val*8+(unsigned long)c-'0'; else return 0; str++; } @@ -824,7 +824,7 @@ static unsigned long StrToNum( } while ((c = *str)) { - if ('0' <= c && c <= '9') val = val*10+c-'0'; + if ('0' <= c && c <= '9') val = val*10+(unsigned long)c-'0'; else return 0; str++; } @@ -843,7 +843,7 @@ static KeySym StringToKeySym( #ifndef NOTASCII /* special case single character ASCII, for speed */ if (*(str+1) == '\0') { - if (' ' <= *str && *str <= '~') return XK_space + (*str - ' '); + if (' ' <= *str && *str <= '~') return (KeySym) (XK_space + (*str - ' ')); } #endif @@ -907,7 +907,7 @@ static String ParseImmed( Boolean* error) { event->event.eventCode = (unsigned long)closure; - event->event.eventCodeMask = ~0UL; + event->event.eventCodeMask = (unsigned long) (~0UL); return BROKEN_OPTIMIZER_HACK(str); } @@ -966,7 +966,7 @@ static String ParseKeySym( if (*str != '\0' && !IsNewline(*str)) str++; keySymName[1] = '\0'; event->event.eventCode = StringToKeySym(keySymName, error); - event->event.eventCodeMask = ~0L; + event->event.eventCodeMask = (unsigned long) (~0L); } else if (*str == ',' || *str == ':' || /* allow leftparen to be single char symbol, * for backwards compatibility @@ -987,10 +987,10 @@ static String ParseKeySym( && (*str != '(' || *(str+1) <= '0' || *(str+1) >= '9') && *str != '\0') str++; keySymName = XtStackAlloc ((size_t)(str - start + 1), keySymNamebuf); - (void) memmove(keySymName, start, str-start); + (void) memmove(keySymName, start, (size_t) (str-start)); keySymName[str-start] = '\0'; event->event.eventCode = StringToKeySym(keySymName, error); - event->event.eventCodeMask = ~0L; + event->event.eventCodeMask = (unsigned long) (~0L); } if (*error) { /* We never get here when keySymName hasn't been allocated */ @@ -1033,13 +1033,13 @@ static String ParseTable( *error = TRUE; return str; } - (void) memmove(tableSymName, start, str-start); + (void) memmove(tableSymName, start, (size_t) (str-start)); tableSymName[str-start] = '\0'; signature = StringToQuark(tableSymName); for (; table->signature != NULLQUARK; table++) if (table->signature == signature) { event->event.eventCode = table->value; - event->event.eventCodeMask = ~0L; + event->event.eventCodeMask = (unsigned long) (~0L); return str; } @@ -1089,9 +1089,9 @@ static String ParseAtom( *error = TRUE; return str; } - (void) memmove(atomName, start, str-start); + (void) memmove(atomName, start, (size_t) (str-start)); atomName[str-start] = '\0'; - event->event.eventCode = XrmStringToQuark(atomName); + event->event.eventCode = (TMLongCard) XrmStringToQuark(atomName); event->event.matchEvent = _XtMatchAtom; } return str; @@ -1142,8 +1142,8 @@ static String ParseEvent( && (event->event.modifiers | event->event.modifierMask) /* any */ && (event->event.modifiers != AnyModifier)) { - event->event.modifiers - |= buttonModifierMasks[event->event.eventCode]; + event->event.modifiers = (event->event.modifiers + | (TMLongCard) buttonModifierMasks[event->event.eventCode]); /* the button that is going up will always be in the modifiers... */ } @@ -1174,7 +1174,7 @@ static String ParseQuotedStringEvent( event->event.eventType = KeyPress; event->event.eventCode = StringToKeySym(s, error); if (*error) return PanicModeRecovery(str); - event->event.eventCodeMask = ~0L; + event->event.eventCodeMask = (unsigned long) (~0L); event->event.matchEvent = _XtMatchUsingStandardMods; event->event.standard = TRUE; @@ -1206,11 +1206,11 @@ static void RepeatDown( if ((upEvent->event.eventType == ButtonRelease) && (upEvent->event.modifiers != AnyModifier) && (upEvent->event.modifiers | upEvent->event.modifierMask)) - upEvent->event.modifiers - |= buttonModifierMasks[event->event.eventCode]; + upEvent->event.modifiers = (upEvent->event.modifiers + | (TMLongCard) buttonModifierMasks[event->event.eventCode]); if (event->event.lateModifiers) - event->event.lateModifiers->ref_count += (reps - 1) * 2; + event->event.lateModifiers->ref_count = (unsigned short) (event->event.lateModifiers->ref_count + (reps - 1) * 2); for (i=1; i<reps; i++) { @@ -1253,11 +1253,11 @@ static void RepeatDownPlus( if ((upEvent->event.eventType == ButtonRelease) && (upEvent->event.modifiers != AnyModifier) && (upEvent->event.modifiers | upEvent->event.modifierMask)) - upEvent->event.modifiers - |= buttonModifierMasks[event->event.eventCode]; + upEvent->event.modifiers = (upEvent->event.modifiers + | (TMLongCard) buttonModifierMasks[event->event.eventCode]); if (event->event.lateModifiers) - event->event.lateModifiers->ref_count += reps * 2 - 1; + event->event.lateModifiers->ref_count = (unsigned short) (event->event.lateModifiers->ref_count + reps * 2 - 1); for (i=0; i<reps; i++) { @@ -1307,11 +1307,11 @@ static void RepeatUp( if ((downEvent->event.eventType == ButtonPress) && (downEvent->event.modifiers != AnyModifier) && (downEvent->event.modifiers | downEvent->event.modifierMask)) - downEvent->event.modifiers - &= ~buttonModifierMasks[event->event.eventCode]; + downEvent->event.modifiers = (downEvent->event.modifiers + & (TMLongCard) (~buttonModifierMasks[event->event.eventCode])); if (event->event.lateModifiers) - event->event.lateModifiers->ref_count += reps * 2 - 1; + event->event.lateModifiers->ref_count = (unsigned short) (event->event.lateModifiers->ref_count + reps * 2 - 1); /* up */ event->next = XtNew(EventSeqRec); @@ -1363,11 +1363,11 @@ static void RepeatUpPlus( if ((downEvent->event.eventType == ButtonPress) && (downEvent->event.modifiers != AnyModifier) && (downEvent->event.modifiers | downEvent->event.modifierMask)) - downEvent->event.modifiers - &= ~buttonModifierMasks[event->event.eventCode]; + downEvent->event.modifiers = (downEvent->event.modifiers + & (TMLongCard) (~buttonModifierMasks[event->event.eventCode])); if (event->event.lateModifiers) - event->event.lateModifiers->ref_count += reps * 2; + event->event.lateModifiers->ref_count = (unsigned short) (event->event.lateModifiers->ref_count + reps * 2); for (i=0; i<reps; i++) { @@ -1404,7 +1404,7 @@ static void RepeatOther( tempEvent = event = *eventP; if (event->event.lateModifiers) - event->event.lateModifiers->ref_count += reps - 1; + event->event.lateModifiers->ref_count = (unsigned short) (event->event.lateModifiers->ref_count + reps - 1); for (i=1; i<reps; i++) { event->next = XtNew(EventSeqRec); @@ -1427,7 +1427,7 @@ static void RepeatOtherPlus( tempEvent = event = *eventP; if (event->event.lateModifiers) - event->event.lateModifiers->ref_count += reps - 1; + event->event.lateModifiers->ref_count = (unsigned short) (event->event.lateModifiers->ref_count + reps - 1); for (i=1; i<reps; i++) { event->next = XtNew(EventSeqRec); @@ -1482,11 +1482,11 @@ static String ParseRepeat( size_t len; ScanNumeric(str); - len = (str - start); + len = (size_t) (str - start); if (len < sizeof repStr) { (void) memmove(repStr, start, len); repStr[len] = '\0'; - *reps = StrToNum(repStr); + *reps = (int) StrToNum(repStr); } else { Syntax("Repeat count too large.", ""); *error = TRUE; @@ -1617,7 +1617,7 @@ static String ParseActionProc( *error = TRUE; return str; } - (void) memmove(procName, start, str-start); + (void) memmove(procName, start, (size_t) (str-start)); procName[str-start] = '\0'; *actionProcNameP = XrmStringToQuark( procName ); return str; @@ -1643,9 +1643,9 @@ static String ParseString( */ if (*str == '\\' && (*(str+1) == '"' || (*(str+1) == '\\' && *(str+2) == '"'))) { - len = prev_len + (str-start+2); + len = (unsigned) (prev_len + (str-start+2)); *strP = XtRealloc(*strP, len); - (void) memmove(*strP + prev_len, start, str-start); + (void) memmove(*strP + prev_len, start, (size_t) (str-start)); prev_len = len-1; str++; (*strP)[prev_len-1] = *str; @@ -1654,9 +1654,9 @@ static String ParseString( } str++; } - len = prev_len + (str-start+1); + len = (unsigned) (prev_len + (str-start+1)); *strP = XtRealloc(*strP, len); - (void) memmove( *strP + prev_len, start, str-start); + (void) memmove( *strP + prev_len, start, (size_t) (str-start)); (*strP)[len-1] = '\0'; if (*str == '"') str++; else XtWarningMsg(XtNtranslationParseError,"parseString", @@ -1672,7 +1672,7 @@ static String ParseString( && !IsNewline(*str) && *str != '\0') str++; *strP = __XtMalloc((unsigned)(str-start+1)); - (void) memmove(*strP, start, str-start); + (void) memmove(*strP, start, (size_t) (str-start)); (*strP)[str-start] = '\0'; } return str; @@ -1717,7 +1717,7 @@ static String ParseParamSeq( if (num_params != 0) { String *paramP = (String *) - __XtMalloc( (unsigned)(num_params+1) * sizeof(String) ); + __XtMalloc( (Cardinal)((num_params+1) * sizeof(String)) ); *paramSeqP = paramP; *paramNumP = num_params; paramP += num_params; /* list is LIFO right now */ @@ -1804,7 +1804,7 @@ static void ShowProduction( char *eol, *production, productionbuf[500]; eol = strchr(currentProduction, '\n'); - if (eol) len = eol - currentProduction; + if (eol) len = (size_t) (eol - currentProduction); else len = strlen (currentProduction); production = XtStackAlloc (len + 1, productionbuf); if (production == NULL) _XtAllocError (NULL); @@ -1869,7 +1869,7 @@ static String CheckForPoundSign( start = str; str = ScanIdent(str); len = MIN(19, str-start); - (void) memmove(operation, start, len); + (void) memmove(operation, start, (size_t) len); operation[len] = '\0'; if (!strcmp(operation,"replace")) opType = XtTableReplace; @@ -1941,7 +1941,7 @@ static XtTranslations ParseTranslationTable( XtFree((char *)parseTree->complexBranchHeadTbl); xlations = _XtCreateXlations(stateTrees, 1, NULL, NULL); - xlations->operation = actualOp; + xlations->operation = (unsigned char) actualOp; #ifdef notdef XtFree(stateTrees); diff --git a/src/TMprint.c b/src/TMprint.c index 6c469f1..95cda25 100644 --- a/src/TMprint.c +++ b/src/TMprint.c @@ -92,10 +92,10 @@ if (sb->current - sb->start > (int)sb->max - STR_THRESHOLD) \ } #define ExpandForChars(sb, nchars ) \ - if ((unsigned)(sb->current - sb->start) > sb->max - STR_THRESHOLD - nchars) { \ + if ((unsigned)(sb->current - sb->start) > (sb->max - STR_THRESHOLD - nchars)) { \ String old = sb->start; \ sb->start = XtRealloc(old, \ - (Cardinal)(sb->max += STR_INCAMOUNT + nchars)); \ + (Cardinal)(sb->max = (Cardinal)(sb->max + STR_INCAMOUNT + (Cardinal) nchars))); \ sb->current = sb->current - old + sb->start; \ } @@ -338,7 +338,7 @@ static void PrintActions( if (accelWidget) { /* accelerator */ String name = XtName(accelWidget); - int nameLen = strlen(name); + int nameLen = (int) strlen(name); ExpandForChars(sb, nameLen ); XtMemmove(sb->current, name, nameLen ); sb->current += nameLen; @@ -396,8 +396,8 @@ static Boolean LookAheadForCycleOrMulticlick( else if (typeMatch->eventType == _XtEventTimerEventType) continue; else /* not same event as starting event and not timer */ { - unsigned int type = sTypeMatch->eventType; - unsigned int t = typeMatch->eventType; + unsigned int type = (unsigned) sTypeMatch->eventType; + unsigned int t = (unsigned) typeMatch->eventType; if ( (type == ButtonPress && t != ButtonRelease) || (type == ButtonRelease && t != ButtonPress) || (type == KeyPress && t != KeyRelease) @@ -569,8 +569,8 @@ static void ProcessLaterMatches( branchHead, (state ? state->nextLevel : NULL), 0) == TM_NO_MATCH)) { - printData[*numPrintsRtn].tIndex = i; - printData[*numPrintsRtn].bIndex = j; + printData[*numPrintsRtn].tIndex = (TMShortCard) i; + printData[*numPrintsRtn].bIndex = (TMShortCard) j; (*numPrintsRtn)++; } } @@ -603,7 +603,7 @@ static void ProcessStateTree( == TM_NO_MATCH) { if (!branchHead->isSimple || branchHead->hasActions) { printData[*numPrintsRtn].tIndex = tIndex; - printData[*numPrintsRtn].bIndex = i; + printData[*numPrintsRtn].bIndex = (TMShortCard) i; (*numPrintsRtn)++; } LOCK_PROCESS; @@ -690,14 +690,14 @@ String _XtPrintXlations( sb->max = 1000; maxPrints = 0; for (i = 0; i < xlations->numStateTrees; i++) - maxPrints += - ((TMSimpleStateTree)(xlations->stateTreeTbl[i]))->numBranchHeads; + maxPrints = (TMShortCard) (maxPrints + + ((TMSimpleStateTree)(xlations->stateTreeTbl[i]))->numBranchHeads); prints = (PrintRec *) XtStackAlloc(maxPrints * sizeof(PrintRec), stackPrints); numPrints = 0; for (i = 0; i < xlations->numStateTrees; i++) - ProcessStateTree(prints, xlations, i, &numPrints); + ProcessStateTree(prints, xlations, (TMShortCard) i, &numPrints); for (i = 0; i < numPrints; i++) { TMSimpleStateTree stateTree = (TMSimpleStateTree) @@ -796,8 +796,8 @@ void _XtDisplayInstalledAccelerators( sb->max = 1000; maxPrints = 0; for (i = 0; i < xlations->numStateTrees; i++) - maxPrints += - ((TMSimpleStateTree)xlations->stateTreeTbl[i])->numBranchHeads; + maxPrints = (TMShortCard) (maxPrints + + ((TMSimpleStateTree)xlations->stateTreeTbl[i])->numBranchHeads); prints = (PrintRec *) XtStackAlloc(maxPrints * sizeof(PrintRec), stackPrints); @@ -809,7 +809,7 @@ void _XtDisplayInstalledAccelerators( i++, complexBindProcs++) { if (complexBindProcs->widget) { - ProcessStateTree(prints, xlations, i, &numPrints); + ProcessStateTree(prints, xlations, (TMShortCard) i, &numPrints); } } for (i = 0; i < numPrints; i++) { diff --git a/src/TMstate.c b/src/TMstate.c index fda9a23..443eb09 100644 --- a/src/TMstate.c +++ b/src/TMstate.c @@ -130,11 +130,11 @@ static TMShortCard GetBranchHead( if (parseTree->numBranchHeads == parseTree->branchHeadTblSize) { if (parseTree->branchHeadTblSize == 0) - parseTree->branchHeadTblSize += TM_BRANCH_HEAD_TBL_ALLOC; + parseTree->branchHeadTblSize = (TMShortCard) (parseTree->branchHeadTblSize + TM_BRANCH_HEAD_TBL_ALLOC); else - parseTree->branchHeadTblSize += - TM_BRANCH_HEAD_TBL_REALLOC; - newSize = (parseTree->branchHeadTblSize * sizeof(TMBranchHeadRec)); + parseTree->branchHeadTblSize = (TMShortCard) (parseTree->branchHeadTblSize + + TM_BRANCH_HEAD_TBL_REALLOC); + newSize = (TMShortCard) (parseTree->branchHeadTblSize * sizeof(TMBranchHeadRec)); if (parseTree->isStackBranchHeads) { TMBranchHead oldBranchHeadTbl = parseTree->branchHeadTbl; parseTree->branchHeadTbl = (TMBranchHead) __XtMalloc(newSize); @@ -144,7 +144,7 @@ static TMShortCard GetBranchHead( else { parseTree->branchHeadTbl = (TMBranchHead) XtRealloc((char *)parseTree->branchHeadTbl, - (parseTree->branchHeadTblSize * + (Cardinal)(parseTree->branchHeadTblSize * sizeof(TMBranchHeadRec))); } } @@ -161,7 +161,7 @@ static TMShortCard GetBranchHead( branchHead->isSimple = True; branchHead->hasActions = False; branchHead->hasCycles = False; - return parseTree->numBranchHeads-1; + return (TMShortCard) (parseTree->numBranchHeads - 1); } TMShortCard _XtGetQuarkIndex( @@ -183,10 +183,10 @@ TMShortCard _XtGetQuarkIndex( TMShortCard newSize; if (parseTree->quarkTblSize == 0) - parseTree->quarkTblSize += TM_QUARK_TBL_ALLOC; + parseTree->quarkTblSize = (TMShortCard) (parseTree->quarkTblSize + TM_QUARK_TBL_ALLOC); else - parseTree->quarkTblSize += TM_QUARK_TBL_REALLOC; - newSize = (parseTree->quarkTblSize * sizeof(XrmQuark)); + parseTree->quarkTblSize = (TMShortCard) (parseTree->quarkTblSize + TM_QUARK_TBL_REALLOC); + newSize = (TMShortCard) (parseTree->quarkTblSize * sizeof(XrmQuark)); if (parseTree->isStackQuarks) { XrmQuark *oldquarkTbl = parseTree->quarkTbl; @@ -197,7 +197,7 @@ TMShortCard _XtGetQuarkIndex( else { parseTree->quarkTbl = (XrmQuark *) XtRealloc((char *)parseTree->quarkTbl, - (parseTree->quarkTblSize * + (Cardinal)(parseTree->quarkTblSize * sizeof(XrmQuark))); } } @@ -223,11 +223,11 @@ static TMShortCard GetComplexBranchIndex( TMShortCard newSize; if (parseTree->complexBranchHeadTblSize == 0) - parseTree->complexBranchHeadTblSize += TM_COMPLEXBRANCH_HEAD_TBL_ALLOC; + parseTree->complexBranchHeadTblSize = (TMShortCard) (parseTree->complexBranchHeadTblSize + TM_COMPLEXBRANCH_HEAD_TBL_ALLOC); else - parseTree->complexBranchHeadTblSize += TM_COMPLEXBRANCH_HEAD_TBL_REALLOC; + parseTree->complexBranchHeadTblSize = (TMShortCard) (parseTree->complexBranchHeadTblSize + TM_COMPLEXBRANCH_HEAD_TBL_REALLOC); - newSize = (parseTree->complexBranchHeadTblSize * sizeof(StatePtr)); + newSize = (TMShortCard) (parseTree->complexBranchHeadTblSize * sizeof(StatePtr)); if (parseTree->isStackComplexBranchHeads) { StatePtr *oldcomplexBranchHeadTbl @@ -240,12 +240,12 @@ static TMShortCard GetComplexBranchIndex( else { parseTree->complexBranchHeadTbl = (StatePtr *) XtRealloc((char *)parseTree->complexBranchHeadTbl, - (parseTree->complexBranchHeadTblSize * + (Cardinal)(parseTree->complexBranchHeadTblSize * sizeof(StatePtr))); } } parseTree->complexBranchHeadTbl[parseTree->numComplexBranchHeads++] = NULL; - return parseTree->numComplexBranchHeads-1; + return (TMShortCard) (parseTree->numComplexBranchHeads - 1); } TMShortCard _XtGetTypeIndex( @@ -276,10 +276,10 @@ TMShortCard _XtGetTypeIndex( if (j == TM_TYPE_SEGMENT_SIZE) { if (_XtGlobalTM.numTypeMatchSegments == _XtGlobalTM.typeMatchSegmentTblSize) { - _XtGlobalTM.typeMatchSegmentTblSize += 4; + _XtGlobalTM.typeMatchSegmentTblSize = (TMShortCard) (_XtGlobalTM.typeMatchSegmentTblSize + 4); _XtGlobalTM.typeMatchSegmentTbl = (TMTypeMatch *) XtRealloc((char *)_XtGlobalTM.typeMatchSegmentTbl, - (_XtGlobalTM.typeMatchSegmentTblSize * sizeof(TMTypeMatch))); + (Cardinal)(_XtGlobalTM.typeMatchSegmentTblSize * sizeof(TMTypeMatch))); } _XtGlobalTM.typeMatchSegmentTbl[_XtGlobalTM.numTypeMatchSegments++] = segment = (TMTypeMatch) @@ -371,10 +371,10 @@ TMShortCard _XtGetModifierIndex( if (j == TM_MOD_SEGMENT_SIZE) { if (_XtGlobalTM.numModMatchSegments == _XtGlobalTM.modMatchSegmentTblSize) { - _XtGlobalTM.modMatchSegmentTblSize += 4; + _XtGlobalTM.modMatchSegmentTblSize = (TMShortCard) (_XtGlobalTM.modMatchSegmentTblSize + 4); _XtGlobalTM.modMatchSegmentTbl = (TMModifierMatch *) XtRealloc((char *)_XtGlobalTM.modMatchSegmentTbl, - (_XtGlobalTM.modMatchSegmentTblSize * sizeof(TMModifierMatch))); + (Cardinal)(_XtGlobalTM.modMatchSegmentTblSize * sizeof(TMModifierMatch))); } _XtGlobalTM.modMatchSegmentTbl[_XtGlobalTM.numModMatchSegments++] = segment = (TMModifierMatch) @@ -446,8 +446,8 @@ Boolean _XtRegularMatch( modMatch->lateModifiers, &computed, &computedMask); if (!resolved) return FALSE; - computed |= modMatch->modifiers; - computedMask |= modMatch->modifierMask; + computed = (Modifiers) (computed | modMatch->modifiers); + computedMask = (Modifiers) (computedMask | modMatch->modifierMask); return ( (computed & computedMask) == (eventSeq->event.modifiers & computedMask)); @@ -462,7 +462,7 @@ Boolean _XtMatchAtom( Atom atom; atom = XInternAtom(eventSeq->xev->xany.display, - XrmQuarkToString(typeMatch->eventCode), + XrmQuarkToString((XrmQuark)(typeMatch->eventCode)), False); return (atom == eventSeq->event.eventCode); } @@ -498,7 +498,7 @@ static void XEventToTMEvent( tmEvent->xev = event; tmEvent->event.eventCodeMask = 0; tmEvent->event.modifierMask = 0; - tmEvent->event.eventType = event->type; + tmEvent->event.eventType = (TMLongCard) event->type; tmEvent->event.lateModifiers = NULL; tmEvent->event.matchEvent = NULL; tmEvent->event.standard = FALSE; @@ -518,13 +518,13 @@ static void XEventToTMEvent( break; case MotionNotify: - tmEvent->event.eventCode = event->xmotion.is_hint; + tmEvent->event.eventCode = (TMLongCard) event->xmotion.is_hint; tmEvent->event.modifiers = event->xmotion.state; break; case EnterNotify: case LeaveNotify: - tmEvent->event.eventCode = event->xcrossing.mode; + tmEvent->event.eventCode = (TMLongCard) event->xcrossing.mode; tmEvent->event.modifiers = event->xcrossing.state; break; @@ -554,13 +554,13 @@ static void XEventToTMEvent( break; case MappingNotify: - tmEvent->event.eventCode = event->xmapping.request; + tmEvent->event.eventCode = (TMLongCard) event->xmapping.request; tmEvent->event.modifiers = 0; break; case FocusIn: case FocusOut: - tmEvent->event.eventCode = event->xfocus.mode; + tmEvent->event.eventCode = (TMLongCard) event->xfocus.mode; tmEvent->event.modifiers = 0; break; @@ -699,7 +699,7 @@ static void PushContext( !(context->matches[i].isCycleStart); i++){}; if (i < context->numMatches) - context->numMatches = i+1; + context->numMatches = (TMShortCard) (i + 1); #ifdef DEBUG else XtWarning("pushing cycle end with no cycle start"); @@ -710,12 +710,12 @@ static void PushContext( if (context->numMatches == context->maxMatches) { if (context->maxMatches == 0) - context->maxMatches += TM_CONTEXT_MATCHES_ALLOC; + context->maxMatches = (TMShortCard) (context->maxMatches + TM_CONTEXT_MATCHES_ALLOC); else - context->maxMatches += TM_CONTEXT_MATCHES_REALLOC; + context->maxMatches = (TMShortCard) (context->maxMatches + TM_CONTEXT_MATCHES_REALLOC); context->matches = (MatchPairRec *) XtRealloc((char *)context->matches, - context->maxMatches * sizeof(MatchPairRec)); + (Cardinal)(context->maxMatches * sizeof(MatchPairRec))); } context->matches[context->numMatches].isCycleStart = newState->isCycleStart; context->matches[context->numMatches].isCycleEnd = newState->isCycleEnd; @@ -901,7 +901,7 @@ static int MatchComplexBranch( TMShortCard i; LOCK_PROCESS; - for (i = startIndex; i < stateTree->numComplexBranchHeads; i++) + for (i = (TMShortCard) startIndex; i < stateTree->numComplexBranchHeads; i++) { StatePtr candState; TMShortCard numMatches = context->numMatches; @@ -981,7 +981,7 @@ static StatePtr TryCurrentTree( XEvent *xev = curEventPtr->xev; unsigned long time = GetTime(tmRecPtr, xev); XtPerDisplay pd = _XtGetPerDisplay(xev->xany.display); - unsigned long delta = pd->multi_click_time; + unsigned long delta = (unsigned long) pd->multi_click_time; if ((tmRecPtr->lastEventTime + delta) >= time) { if (nextState->actions) { @@ -1184,7 +1184,7 @@ static EventMask EventToMask( unsigned long eventType = typeMatch->eventType; if (eventType == MotionNotify) { - Modifiers modifierMask = modMatch->modifierMask; + Modifiers modifierMask = (Modifiers) modMatch->modifierMask; Modifiers tempMask; returnMask = 0; @@ -1211,7 +1211,7 @@ static EventMask EventToMask( returnMask |= Button5MotionMask; return returnMask; } - returnMask = _XtConvertTypeToMask(eventType); + returnMask = _XtConvertTypeToMask((int)eventType); if (returnMask == (StructureNotifyMask|SubstructureNotifyMask)) returnMask = StructureNotifyMask; return returnMask; @@ -1285,7 +1285,7 @@ void _XtInstallTranslations( _XtTraverseStateTree(stateTree, AggregateEventMask, (XtPointer)&xlations->eventMask); - mappingNotifyInterest |= stateTree->simple.mappingNotifyInterest; + mappingNotifyInterest = (Boolean) (mappingNotifyInterest | stateTree->simple.mappingNotifyInterest); } /* double click needs to make sure that you have selected on both button down and up. */ @@ -1339,7 +1339,7 @@ void _XtRemoveTranslations( i++) { stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i]; - mappingNotifyInterest |= stateTree->mappingNotifyInterest; + mappingNotifyInterest = (Boolean) (mappingNotifyInterest | stateTree->mappingNotifyInterest); } if (mappingNotifyInterest) RemoveFromMappingCallbacks(widget, (XtPointer)widget, NULL); @@ -1399,7 +1399,7 @@ void XtUninstallTranslations( _XtUninstallTranslations(widget); if (XtIsRealized(widget) && oldMask) XSelectInput(XtDisplay(widget), XtWindow(widget), - XtBuildEventMask(widget)); + (long) XtBuildEventMask(widget)); hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget)); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { XtChangeHookDataRec call_data; @@ -1423,8 +1423,8 @@ XtTranslations _XtCreateXlations( TMShortCard i; xlations = (XtTranslations) - __XtMalloc(sizeof(TranslationData) + - (numStateTrees-1) * sizeof(TMStateTree)); + __XtMalloc((Cardinal)(sizeof(TranslationData) + + (numStateTrees - 1) * sizeof(TMStateTree))); #ifdef TRACE_TM LOCK_PROCESS; if (_XtGlobalTM.numTms == _XtGlobalTM.tmTblSize) { @@ -1463,7 +1463,7 @@ TMStateTree _XtParseTreeToStateTree( complexTree = XtNew(TMComplexStateTreeRec); complexTree->isSimple = False; - tableSize = parseTree->numComplexBranchHeads * sizeof(StatePtr); + tableSize = (unsigned) (parseTree->numComplexBranchHeads * sizeof(StatePtr)); complexTree->complexBranchHeadTbl = (StatePtr *) __XtMalloc(tableSize); XtMemmove(complexTree->complexBranchHeadTbl, @@ -1480,13 +1480,13 @@ TMStateTree _XtParseTreeToStateTree( simpleTree->refCount = 0; simpleTree->mappingNotifyInterest = parseTree->mappingNotifyInterest; - tableSize = parseTree->numBranchHeads * sizeof(TMBranchHeadRec); + tableSize = (unsigned) (parseTree->numBranchHeads * sizeof(TMBranchHeadRec)); simpleTree->branchHeadTbl = (TMBranchHead) __XtMalloc(tableSize); XtMemmove(simpleTree->branchHeadTbl, parseTree->branchHeadTbl, tableSize); simpleTree->numBranchHeads = parseTree->numBranchHeads; - tableSize = parseTree->numQuarks * sizeof(XrmQuark); + tableSize = (unsigned) (parseTree->numQuarks * sizeof(XrmQuark)); simpleTree->quarkTbl = (XrmQuark *) __XtMalloc(tableSize); XtMemmove(simpleTree->quarkTbl, parseTree->quarkTbl, tableSize); simpleTree->numQuarks = parseTree->numQuarks; @@ -1501,7 +1501,7 @@ static void FreeActions( TMShortCard i; for (action = actions; action;) { ActionPtr nextAction = action->next; - for (i = action->num_params; i;) { + for (i = (TMShortCard) action->num_params; i;) { XtFree( action->params[--i] ); } XtFree( (char*)action->params ); @@ -1669,7 +1669,7 @@ Boolean _XtCvtMergeTranslations( first = ((TMConvertRec*)from->addr)->old; second = ((TMConvertRec*)from->addr)->new; - numStateTrees = first->numStateTrees + second->numStateTrees; + numStateTrees = (TMShortCard) (first->numStateTrees + second->numStateTrees); stateTrees = (TMStateTree *) XtStackAlloc(numStateTrees * sizeof(TMStateTree), stackStateTrees); @@ -1773,7 +1773,7 @@ static XtTranslations UnmergeTranslations( if (xlations->composers[1]) { second = UnmergeTranslations(widget, xlations->composers[1], unmergeXlations, - currIndex + + (TMShortCard)currIndex + xlations->composers[0]->numStateTrees, oldBindings, numOldBindings, newBindings, numNewBindingsRtn); @@ -1908,14 +1908,14 @@ static TMBindData MakeBindData( isComplex = (i < numBindings); if (isComplex) bytes = (sizeof(TMComplexBindDataRec) + - ((numBindings - 1) * + ((TMLongCard)(numBindings - 1) * sizeof(TMComplexBindProcsRec))); else bytes = (sizeof(TMSimpleBindDataRec) + - ((numBindings - 1) * + ((TMLongCard)(numBindings - 1) * sizeof(TMSimpleBindProcsRec))); - bindData = (TMBindData) __XtCalloc(sizeof(char), bytes); + bindData = (TMBindData) __XtCalloc((Cardinal) sizeof(char), (Cardinal) bytes); bindData->simple.isComplex = isComplex; if (isComplex) { TMComplexBindData cBindData = (TMComplexBindData)bindData; @@ -2020,7 +2020,7 @@ static Boolean ComposeTranslations( (&((TMSimpleBindData)bindData)->bindTbl[0]); } - numBytes =(((oldXlations ? oldXlations->numStateTrees : 0) + numBytes =(TMShortCard) (((oldXlations ? oldXlations->numStateTrees : 0) + newXlations->numStateTrees) * sizeof(TMComplexBindProcsRec)); newBindings = (TMComplexBindProcs) XtStackAlloc(numBytes, stackBindings); XtBZero((char *)newBindings, numBytes); @@ -2072,7 +2072,7 @@ static Boolean ComposeTranslations( mask = newTable->eventMask; if (mask != oldMask) XSelectInput(XtDisplay(dest), XtWindow(dest), - XtBuildEventMask(dest)); + (long) XtBuildEventMask(dest)); } XtStackFree((XtPointer)newBindings, (XtPointer)stackBindings); return(newTable != NULL); @@ -2113,8 +2113,8 @@ XtTranslations _XtGetTranslationValue( Cardinal numBindings = xlations->numStateTrees; (*aXlationsPtr) = aXlations = (ATranslations) - __XtMalloc(sizeof(ATranslationData) + - (numBindings - 1) * sizeof(TMComplexBindProcsRec)); + __XtMalloc((Cardinal) (sizeof(ATranslationData) + + (numBindings - 1) * sizeof(TMComplexBindProcsRec))); aXlations->hasBindings = True; aXlations->xlations = xlations; diff --git a/src/Threads.c b/src/Threads.c index 7ae9e18..ee19c2e 100644 --- a/src/Threads.c +++ b/src/Threads.c @@ -199,7 +199,7 @@ AppUnlock(XtAppContext app) xmutex_unlock(app_lock->mutex); #else xthread_t self; - + (void)self; self = xthread_self(); xmutex_lock(app_lock->mutex); assert(xthread_equal(app_lock->holder, self)); @@ -236,7 +236,7 @@ YieldAppLock( unsigned ii; app_lock->stack.st = (struct _Tstack *) XtRealloc ((char *)app_lock->stack.st, - (app_lock->stack.size + STACK_INCR) * sizeof (struct _Tstack)); + (Cardinal)((app_lock->stack.size + STACK_INCR) * sizeof (struct _Tstack))); ii = app_lock->stack.size; app_lock->stack.size += STACK_INCR; for ( ; ii < app_lock->stack.size; ii++) { diff --git a/src/VarCreate.c b/src/VarCreate.c index 4f5058c..ad07253 100644 --- a/src/VarCreate.c +++ b/src/VarCreate.c @@ -298,7 +298,7 @@ _XtVaOpenApplication( count++; typed_args = (XtTypedArgList) XtRealloc((char *) typed_args, - (unsigned) (count + 1) * sizeof(XtTypedArg)); + (Cardinal) ((size_t)(count + 1) * sizeof(XtTypedArg))); } typed_args[count].name = NULL; diff --git a/src/Varargs.c b/src/Varargs.c index b33e287..10c1361 100644 --- a/src/Varargs.c +++ b/src/Varargs.c @@ -138,7 +138,7 @@ XtTypedArgList _XtVaCreateTypedArgList(va_list var, register int count) XtTypedArgList avlist; avlist = (XtTypedArgList) - __XtCalloc((int)count + 1, (unsigned)sizeof(XtTypedArg)); + __XtCalloc((Cardinal)count + 1, (unsigned)sizeof(XtTypedArg)); for(attr = va_arg(var, String), count = 0; attr != NULL; attr = va_arg(var, String)) { @@ -206,7 +206,7 @@ TypedArgToArg( } to_val.addr = NULL; - from_val.size = typed_arg->size; + from_val.size = (Cardinal) typed_arg->size; if ((strcmp(typed_arg->type, XtRString) == 0) || ((unsigned) typed_arg->size > sizeof(XtArgVal))) { from_val.addr = (XPointer)typed_arg->value; @@ -243,7 +243,7 @@ TypedArgToArg( else if (to_val.size == sizeof(XtArgVal)) arg_return->value = *(XtArgVal *)to_val.addr; else if (to_val.size > sizeof(XtArgVal)) { - arg_return->value = (XtArgVal) __XtMalloc(to_val.size); + arg_return->value = (XtArgVal) (void *) __XtMalloc(to_val.size); memory_return->value = (XtArgVal) memcpy((void *)arg_return->value, to_val.addr, to_val.size); } @@ -359,7 +359,7 @@ _XtVaToArgList( return; } - args = (ArgList)__XtMalloc((unsigned)(max_count * 2 * sizeof(Arg))); + args = (ArgList)__XtMalloc((Cardinal)((size_t)(max_count * 2) * sizeof(Arg))); for (count = max_count * 2; --count >= 0; ) args[count].value = (XtArgVal) NULL; count = 0; @@ -435,7 +435,7 @@ GetResources( cons_top = constraint; *res_list = (XtResourceList) XtRealloc((char*)*res_list, - ((*number + num_constraint) * + (Cardinal)((*number + num_constraint) * sizeof(XtResource))); for (temp= num_constraint, res= *res_list + *number; temp != 0; temp--) @@ -491,7 +491,7 @@ _XtVaToTypedArgList( int count; args = (XtTypedArgList) - __XtMalloc((unsigned)(max_count * sizeof(XtTypedArg))); + __XtMalloc((Cardinal)((size_t) max_count * sizeof(XtTypedArg))); for(attr = va_arg(var, String), count = 0 ; attr != NULL; attr = va_arg(var, String)) { @@ -513,5 +513,5 @@ _XtVaToTypedArgList( } *args_return = args; - *num_args_return = count; + *num_args_return = (Cardinal) count; } |