761N/A@@ -59,6 +59,7 @@ case $host_os in
761N/A # darwin has poll() but can't be used to poll character devices
761N/A # darwin10 (SnowLeopard) should be tested as well once released
761N/A darwin7*) ;; darwin8*) ;; darwin9*) ;;
761N/A AC_CHECK_FUNC(poll, AC_DEFINE(USE_POLL,1,
761N/A [Define to 1 if you have the "poll" function.]))
761N/A@@ -128,6 +128,7 @@ typedef int XtCacheType;
761N/A #define XtCacheAll 0x002
761N/A #define XtCacheByDisplay 0x003
761N/A #define XtCacheRefCount 0x100
761N/A+#define XtCacheXmRefCount 0x200
761N/A /****************************************************************
761N/A@@ -256,6 +257,8 @@ typedef void (*XtDestructor)(
761N/A Cardinal* /* num_args */
761N/A+typedef XtPointer (*XtReplicator)(XtPointer);
761N/A typedef Opaque XtCacheRef;
761N/A typedef Opaque XtActionHookId;
761N/A@@ -659,6 +662,17 @@ extern void XtSetTypeConverter(
761N/A XtDestructor /* destructor */
761N/A+extern void _XtSetTypeConverter(
761N/A+ _Xconst _XtString /* from_type */,
761N/A+ _Xconst _XtString /* to_type */,
761N/A+ XtTypeConverter /* converter */,
761N/A+ XtConvertArgList /* convert_args */,
761N/A+ Cardinal /* num_args */,
761N/A+ XtCacheType /* cache_type */,
761N/A+ XtDestructor /* destructor */,
761N/A+ XtReplicator /* replicator */
761N/A extern void XtAppSetTypeConverter(
761N/A XtAppContext /* app_context */,
761N/A _Xconst _XtString /* from_type */,
761N/A@@ -120,6 +120,8 @@ SOFTWARE.
761N/A if ((char *)(dst) != (char *)(src)) { \
761N/A if (size == sizeof(int)) \
761N/A *((int *) (dst)) = *((int *) (src)); \
761N/A+ else if (size == sizeof(long)) \
761N/A+ *((long *) (dst)) = *((long *) (src)); \
761N/A else if (size == sizeof(char)) \
761N/A *((char *) (dst)) = *((char *) (src)); \
761N/A else if (size == sizeof(short)) \
761N/A@@ -131,15 +133,22 @@ SOFTWARE.
761N/A #define XtBZero(dst, size) \
761N/A if (size == sizeof(int)) \
761N/A *((int *) (dst)) = 0; \
761N/A+ else if (size == sizeof(long)) \
761N/A+ *((long *)(dst)) = 0; \
761N/A bzero((char *) (dst), (int) (size))
761N/A #define XtMemcmp(b1, b2, size) \
761N/A- (size == sizeof(int) ? \
761N/A+ ((size == sizeof(int)) ? \
761N/A *((int *) (b1)) != *((int *) (b2)) \
761N/A- : memcmp((char *) (b1), (char *) (b2), (int) (size)) \
761N/A+ :((size == sizeof(short))? \
761N/A+ *((short *) (b1)) != *((short *) (b2)) \
761N/A+ :((size == sizeof(long))? \
761N/A+ *((long *) (b1)) != *((long *) (b2)) \
761N/A+ :((size == sizeof(BYTE))? \
761N/A+ *((BYTE *)(b1)) != *((BYTE *)(b2)) \
761N/A+ :memcmp((char *) (b1), (char *) (b2), (int) (size)) \
761N/A #define XtMemmove(dst, src, size) \
761N/A@@ -79,6 +79,7 @@ typedef struct _ConverterRec {
351N/A XrmRepresentation from, to;
351N/A XtTypeConverter converter;
351N/A XtDestructor destructor;
761N/A+ XtReplicator replicator;
351N/A unsigned short num_args;
351N/A unsigned int do_ref_count:1;
351N/A unsigned int new_style:1;
761N/A@@ -86,11 +87,25 @@ typedef struct _ConverterRec {
351N/A-#define ConvertArgs(p) ((XtConvertArgList)((p)+1))
761N/A+#define ConvertArgs(p) ((XtConvertArgList)((p)+(ptrdiff_t)1))
351N/A /* used for old-style type converter cache only */
351N/A static Heap globalHeap = {NULL, NULL, 0};
351N/A+void TableAddConverter(
351N/A+ XrmRepresentation from_type,
351N/A+ XrmRepresentation to_type,
351N/A+ XtTypeConverter converter,
351N/A+ XtConvertArgList convert_args,
351N/A+ XtCacheType cache_type,
351N/A+ XtDestructor destructor,
351N/A+ XtReplicator replicator,
351N/A void _XtSetDefaultConverterTable(
761N/A@@ -109,13 +124,11 @@ void _XtSetDefaultConverterTable(
351N/A XtCacheType cache_type;
351N/A for (i = CONVERTHASHSIZE; --i >= 0; ) {
351N/A for (rec = *globalConverterTable++; rec; rec = rec->next) {
351N/A- cache_type = rec->cache_type;
351N/A- if (rec->do_ref_count)
351N/A- cache_type |= XtCacheRefCount;
351N/A- _XtTableAddConverter(*table, rec->from, rec->to, rec->converter,
351N/A+ cache_type = rec->cache_type | (rec->do_ref_count & 0xff00);
351N/A+ TableAddConverter(*table, rec->from, rec->to, rec->converter,
351N/A ConvertArgs(rec), rec->num_args,
351N/A rec->new_style, cache_type,
351N/A- rec->destructor, True);
351N/A+ rec->destructor, rec->replicator, True);
761N/A@@ -147,10 +160,14 @@ typedef struct _CacheRec {
351N/A XtTypeConverter converter;
351N/A+ XtDestructor destructor;
351N/A+ XtReplicator replicator;
351N/A unsigned short num_args;
351N/A unsigned int conversion_succeeded:1;
351N/A unsigned int has_ext:1;
351N/A unsigned int is_refcounted:1;
351N/A+ unsigned int ref_count;
351N/A unsigned int must_be_freed:1;
351N/A unsigned int from_is_value:1;
351N/A unsigned int to_is_value:1;
761N/A@@ -158,15 +175,7 @@ typedef struct _CacheRec {
351N/A-typedef struct _CacheRecExt {
351N/A- XtDestructor destructor;
351N/A-#define CEXT(p) ((CacheRecExt *)((p)+1))
351N/A-#define CARGS(p) ((p)->has_ext ? (XrmValue *)(CEXT(p)+1) : (XrmValue *)((p)+1))
761N/A+#define CARGS(p) (XrmValue *)((p)+(ptrdiff_t)1)
351N/A #define CACHEHASHSIZE 256
351N/A #define CACHEHASHMASK 255
761N/A@@ -175,6 +184,28 @@ typedef CachePtr CacheHashTable[CACHEHAS
351N/A static CacheHashTable cacheHashTable;
351N/A void _XtTableAddConverter(
351N/A+ XrmRepresentation from_type,
351N/A+ XrmRepresentation to_type,
351N/A+ XtTypeConverter converter,
351N/A+ XtConvertArgList convert_args,
351N/A+ XtCacheType cache_type,
351N/A+ XtDestructor destructor,
351N/A+ unsigned short cache_flags;
351N/A+ cache_flags = cache_type & (XtCacheNone | XtCacheAll |
351N/A+ XtCacheByDisplay | XtCacheRefCount);
351N/A+ TableAddConverter(table, from_type, to_type, converter, convert_args, num_args,
351N/A+ new_style, cache_type, destructor, 0, global);
351N/A+void TableAddConverter(
351N/A XrmRepresentation from_type,
351N/A XrmRepresentation to_type,
761N/A@@ -184,6 +215,7 @@ void _XtTableAddConverter(
351N/A XtCacheType cache_type,
351N/A XtDestructor destructor,
351N/A+ XtReplicator replicator,
351N/A register ConverterPtr *pp;
761N/A@@ -207,6 +239,7 @@ void _XtTableAddConverter(
351N/A p->converter = converter;
351N/A p->destructor = destructor;
351N/A+ p->replicator = replicator;
351N/A p->num_args = num_args;
761N/A@@ -216,21 +249,21 @@ void _XtTableAddConverter(
351N/A p->do_ref_count = False;
351N/A if (destructor || (cache_type & 0xff)) {
351N/A p->cache_type = cache_type & 0xff;
351N/A- if (cache_type & XtCacheRefCount)
351N/A- p->do_ref_count = True;
351N/A+ p->do_ref_count = cache_type & 0xff00;
351N/A p->cache_type = XtCacheNone;
351N/A-void XtSetTypeConverter(
351N/A+void _XtSetTypeConverter(
351N/A register _Xconst char* from_type,
351N/A register _Xconst char* to_type,
351N/A- XtTypeConverter converter,
351N/A+ XtTypeConverter converter,
351N/A XtConvertArgList convert_args,
351N/A- XtCacheType cache_type,
351N/A- XtDestructor destructor
351N/A+ XtCacheType cache_type,
351N/A+ XtDestructor destructor,
351N/A+ XtReplicator replicator
351N/A ProcessContext process;
761N/A@@ -245,21 +278,41 @@ void XtSetTypeConverter(
351N/A to = XrmStringToRepresentation(to_type);
351N/A if (!process->globalConverterTable) {
351N/A- process->globalConverterTable = (ConverterTable)
351N/A- __XtCalloc(CONVERTHASHSIZE, (unsigned)sizeof(ConverterPtr));
351N/A+ process->globalConverterTable = (ConverterTable)
351N/A+ __XtCalloc(CONVERTHASHSIZE, (unsigned)sizeof(ConverterPtr));
351N/A- _XtTableAddConverter(process->globalConverterTable, from, to,
351N/A- converter, convert_args,
351N/A- num_args, True, cache_type, destructor, True);
351N/A+ TableAddConverter(process->globalConverterTable, from, to, converter,
351N/A+ convert_args, num_args, True, cache_type, destructor,
351N/A- _XtTableAddConverter(app->converterTable, from, to,
351N/A- converter, convert_args,
351N/A- num_args, True, cache_type, destructor, True);
351N/A+ TableAddConverter(app->converterTable, from, to, converter,
351N/A+ convert_args, num_args, True, cache_type,
351N/A+ destructor, replicator, True);
351N/A+void XtSetTypeConverter(
351N/A+ register _Xconst char* from_type,
351N/A+ register _Xconst char* to_type,
351N/A+ XtTypeConverter converter,
351N/A+ XtConvertArgList convert_args,
351N/A+ XtCacheType cache_type,
351N/A+ XtDestructor destructor
351N/A+ unsigned short cache_flags;
351N/A+ cache_flags = cache_type & (XtCacheNone | XtCacheAll |
351N/A+ XtCacheByDisplay | XtCacheRefCount);
351N/A+ _XtSetTypeConverter(from_type, to_type, converter, convert_args, num_args,
351N/A+ cache_flags, destructor, 0);
351N/A void XtAppSetTypeConverter(
351N/A register _Xconst char* from_type,
761N/A@@ -349,6 +402,7 @@ CacheEnter(
351N/A XtDestructor destructor,
351N/A+ XtReplicator replicator,
351N/A register CachePtr *pHashEntry;
761N/A@@ -358,34 +412,22 @@ CacheEnter(
351N/A pHashEntry = &cacheHashTable[hash & CACHEHASHMASK];
351N/A- if ((succeeded && destructor) || do_ref) {
351N/A- p = (CachePtr) _XtHeapAlloc(heap, (sizeof(CacheRec) +
351N/A- num_args * sizeof(XrmValue)));
351N/A- CEXT(p)->prev = pHashEntry;
351N/A- CEXT(p)->destructor = succeeded ? destructor : NULL;
351N/A- CEXT(p)->closure = closure;
351N/A- CEXT(p)->ref_count = 1;
351N/A- p = (CachePtr)_XtHeapAlloc(heap, (sizeof(CacheRec) +
351N/A- num_args * sizeof(XrmValue)));
351N/A+ p = (CachePtr)_XtHeapAlloc(heap,
351N/A+ (sizeof(CacheRec) + num_args * sizeof(XrmValue)));
351N/A p->conversion_succeeded = succeeded;
351N/A p->is_refcounted = do_ref;
351N/A p->must_be_freed = do_free;
351N/A- if (p->next && p->next->has_ext)
351N/A- CEXT(p->next)->prev = &p->next;
351N/A p->tag = (XtPointer)heap;
351N/A p->converter = converter;
351N/A+ p->destructor = destructor;
351N/A+ p->replicator = replicator;
351N/A p->from_is_value = True;
761N/A@@ -408,14 +450,31 @@ CacheEnter(
351N/A p->to_is_value = False;
351N/A- p->to_is_value = True;
351N/A- p->to_is_value = False;
351N/A- (void) memmove((char *)p->
to.addr, (char *)to->addr, to->size);
351N/A+ XPointer src_ptr, dest_ptr, gptr;
351N/A+ p->to_is_value = True;
351N/A+ p->to_is_value = False;
351N/A+ dest_ptr = p->
to.addr = (XPointer)_XtHeapAlloc(heap, to->size);
351N/A+ if (do_ref & XtCacheXmRefCount) {
351N/A+ gptr = (*(p->replicator))(*(XtPointer *)(to->addr));
351N/A+ src_ptr = (XtPointer)&gptr;
351N/A+ memmove(dest_ptr, src_ptr, to->size);
351N/A+ if ((succeeded && destructor) || do_ref) {
761N/A@@ -423,32 +482,39 @@ CacheEnter(
351N/A static void FreeCacheRec(
351N/A- if (CEXT(p)->destructor) {
351N/A- Cardinal num_args = p->num_args;
351N/A- XrmValue *args = NULL;
351N/A- (*CEXT(p)->destructor) (app, &toc, CEXT(p)->closure, args,
351N/A- *(CEXT(p)->prev) = p->next;
351N/A- if (p->next && p->next->has_ext)
351N/A- CEXT(p->next)->prev = CEXT(p)->prev;
351N/A- if (p->next && p->next->has_ext)
351N/A- CEXT(p->next)->prev = prev;
351N/A+ CachePtr cachep, *cachepp;
351N/A+ cachepp = &cacheHashTable[p->hash & CACHEHASHMASK];
351N/A+ while (cachep = *cachepp) {
351N/A+ *cachepp = cachep->next;
351N/A+ cachepp = &cachep->next;
351N/A+ Cardinal num_args=p->num_args;
351N/A+ (*p->destructor)(app, &toc, p->closure, args, &num_args);
351N/A if (p->must_be_freed) {
761N/A@@ -472,18 +538,18 @@ void _XtCacheFlushTag(
351N/A- register CachePtr *prev;
351N/A+ register CachePtr *next_link;
351N/A for (i = CACHEHASHSIZE; --i >= 0;) {
351N/A- prev = &cacheHashTable[i];
351N/A- while ((rec = *prev)) {
351N/A+ next_link = &cacheHashTable[i];
351N/A+ while ((rec = *next_link)) {
351N/A+ next_link = &rec->next;
351N/A- FreeCacheRec(app, rec, prev);
351N/A+ FreeCacheRec(app, rec, False);
351N/A+ cacheHashTable[i] = 0;
761N/A@@ -633,7 +699,12 @@ void XtDirectConvert(
351N/A /* Try to find cache entry for conversion */
351N/A hash = ((long) converter >> 2) + from->size + *((char *) from->addr);
351N/A- if (from->size > 1) hash += ((char *) from->addr)[1];
351N/A+ if (sizeof(long) == 4)
351N/A+ hash += ((char *) from->addr)[1];
351N/A+ hash += ((char *) from->addr)[6];
351N/A for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next) {
761N/A@@ -677,7 +748,7 @@ void XtDirectConvert(
351N/A CacheEnter(&globalHeap, (XtTypeConverter)converter, args, num_args,
351N/A from, to, (to->addr != NULL), hash, False, False,
351N/A- (XtDestructor)NULL, NULL);
351N/A+ (XtDestructor)NULL, NULL, 0);
761N/A@@ -718,6 +789,7 @@ CallConverter(
351N/A+ XPointer from_addr, gptr;
351N/A if (!cP || ((cP->cache_type == XtCacheNone) && !cP->destructor)) {
761N/A@@ -730,7 +802,12 @@ CallConverter(
351N/A /* Try to find cache entry for conversion */
351N/A hash = ((long)(converter) >> 2) + from->size + *((char *) from->addr);
351N/A- if (from->size > 1) hash += ((char *) from->addr)[1];
351N/A+ if (sizeof(long) == 4)
351N/A+ hash += ((char *) from->addr)[1];
351N/A+ hash += ((char *) from->addr)[6];
351N/A if (cP->cache_type != XtCacheNone) {
351N/A for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next){
761N/A@@ -762,14 +839,18 @@ CallConverter(
761N/A+ if (cP->do_ref_count & XtCacheXmRefCount) {
351N/A+ from_addr = (XPointer)&gptr;
351N/A+ } else if (p->to_is_value) {
351N/A- (void) memmove((char *)to->addr,
351N/A+ memmove((char *)to->addr, from_addr,
351N/A } else { /* old-style call */
761N/A@@ -779,7 +860,7 @@ CallConverter(
351N/A if (p->is_refcounted) {
351N/A *cache_ref_return = (XtCacheRef)p;
761N/A@@ -802,7 +883,7 @@ CallConverter(
351N/A XtPointer closure = NULL;
351N/A unsigned int supplied_size = to->size;
351N/A- Boolean do_ref = cP->do_ref_count && cache_ref_return;
351N/A+ unsigned short do_ref;
351N/A Boolean do_free = False;
351N/A (*(XtTypeConverter)converter)(dpy, args, &num_args, from, to, &closure);
761N/A@@ -815,6 +896,8 @@ CallConverter(
351N/A+ do_ref = cache_ref_return ? cP->do_ref_count : 0;
351N/A if ((cP->cache_type == XtCacheNone) || do_ref) {
761N/A@@ -826,8 +909,12 @@ CallConverter(
351N/A heap = &XtDisplayToApplicationContext(dpy)->heap;
351N/A- p = CacheEnter(heap, converter, args, num_args, from, to, retval,
351N/A- hash, do_ref, do_free, cP->destructor, closure);
351N/A+ if (do_ref || !(cP->do_ref_count & XtCacheXmRefCount)) {
351N/A+ p = CacheEnter(heap, converter, args, num_args, from, to, retval,
351N/A+ hash, do_ref, do_free, cP->destructor,
351N/A+ cP->replicator, closure);
351N/A *cache_ref_return = (XtCacheRef)p;
351N/A else if (cache_ref_return)
761N/A@@ -1053,8 +1140,8 @@ void XtAppReleaseCacheRefs(
351N/A for (r = (CachePtr*)refs; (p = *r); r++) {
351N/A- if (p->is_refcounted && --(CEXT(p)->ref_count) == 0) {
351N/A- FreeCacheRec(app, p, NULL);
351N/A+ if (p->is_refcounted && (--p->ref_count) == 0) {
351N/A+ FreeCacheRec(app, p, True);
761N/A@@ -1070,7 +1157,6 @@ void XtCallbackReleaseCacheRefList(
351N/A XtAppReleaseCacheRefs( XtWidgetToApplicationContext(widget),
351N/A (XtCacheRef*)closure );
761N/A@@ -1352,7 +1352,7 @@ Boolean XtCvtIntToPixmap(
351N/A XtNwrongParameters,"cvtIntToPixmap",XtCXtToolkitError,
351N/A "Integer to Pixmap conversion needs no extra arguments",
351N/A (String *) NULL, (Cardinal *)NULL);
351N/A- done(Pixmap, *(Pixmap*)fromVal->addr);
351N/A+ done(Pixmap, *(int*)fromVal->addr);
761N/A@@ -397,8 +397,7 @@ xtCreate(
761N/A CompileCallbacks(widget);
761N/A if (cache_refs != NULL) {
761N/A- XtAddCallback(widget, XtNdestroyCallback,
761N/A- XtCallbackReleaseCacheRefList, (XtPointer)cache_refs );
761N/A@@ -315,12 +315,15 @@ _XtAppInit(
351N/A * Save away argv and argc so we can set the properties later
351N/A- saved_argv = (String *)
351N/A- __XtMalloc( (Cardinal)((*argc_in_out + 1) * sizeof(String)) );
761N/A- for (i = 0 ; i < *argc_in_out ; i++) saved_argv[i] = (*argv_in_out)[i];
761N/A- saved_argv[i] = NULL; /* NULL terminate that sucker. */
351N/A+ if(*argv_in_out != NULL) {
351N/A+ saved_argv = (String *)
351N/A+ __XtMalloc( (Cardinal)((*argc_in_out + 1) * sizeof(String)) );
351N/A+ for (i = 0 ; i < *argc_in_out ; i++) saved_argv[i] = (*argv_in_out)[i];
351N/A+ saved_argv[i] = NULL; /* NULL terminate that sucker. */
351N/A *app_context_return = XtCreateApplicationContext();
761N/A@@ -555,6 +555,14 @@ void XtRegisterDrawable(
351N/A+/* need this for backward compatability */
351N/A+void _XtRegisterWindow(window, widget)
351N/A+ XtRegisterDrawable(XtDisplay(widget), (Drawable)window, widget);
351N/A void XtUnregisterDrawable(
761N/A@@ -605,6 +613,14 @@ void XtUnregisterDrawable(
351N/A+/* need this for backward compatability */
351N/A+void _XtUnregisterWindow(window, widget)
351N/A+ register Window window;
351N/A+ register Widget widget;
351N/A+ XtUnregisterDrawable(XtDisplay(widget), (Drawable)window);
351N/A static void ExpandWWTable(
761N/A@@ -322,6 +322,12 @@ _XtMakeGeometryRequest (
351N/A returnCode = (*manager)(widget, request, reply);
351N/A+ /* leob fix for bug 4153816 */
351N/A+ if (returnCode == XtGeometryDone && XtIsRealized(widget) &&
761N/A@@ -470,7 +470,7 @@ static String _XtDefaultLanguageProc(
351N/A if (! XSetLocaleModifiers(""))
351N/A XtWarning("X locale modifiers not supported, using default");
351N/A- return setlocale(LC_ALL, NULL); /* re-query in case overwritten */
351N/A+ return setlocale(LC_CTYPE, NULL); /* re-query in case overwritten */
351N/A XtLanguageProc XtSetLanguageProc(
761N/A@@ -991,8 +991,13 @@ Widget XtOpenApplication(XtAppContext *a
351N/A XtSetArg(args[num], XtNscreen, DefaultScreenOfDisplay(dpy)); num++;
351N/A- XtSetArg(args[num], XtNargc, saved_argc); num++;
351N/A- XtSetArg(args[num], XtNargv, argv_in_out); num++;
351N/A+ /* only set argc and argv if argv_in_out[0] is not NULL */
351N/A+ if (argv_in_out && argv_in_out[0]) {
351N/A+ XtSetArg(args[num], XtNargc, saved_argc);
351N/A+ XtSetArg(args[num], XtNargv, argv_in_out);
351N/A merged_args = XtMergeArgLists(args_in, num_args_in, args, num);
761N/A libXt_la_LIBADD = @XT_LIBS@
761N/A-libXt_la_LDFLAGS = -version-number 6:0:0 -no-undefined
761N/A+libXt_la_LDFLAGS = -version-number 4:0:0 -no-undefined \
761N/A+ -M $(top_srcdir)/../../mapfile-vers -lc
761N/A # The util directory contains a program that builds some of the sources.
761N/A@@ -339,6 +339,51 @@ static void AdjustTimes (
351N/A+static void CheckAndTrimTimes(XtAppContext app, wait_times_ptr_t wt)
351N/A+ XtAppErrorMsg(app, "communicationError", "select",
351N/A+ XtCXtToolkitError, "Resetting timer values: zero_time=%lu:%lu, "
351N/A+ "wait_time=%lu:%lu, max_wait_time=%lu:%lu, cur_time=%lu:%lu",
351N/A+ memset(&zero_time, 0, sizeof(zero_time)); /* Ensure the integrity of */
351N/A+ { /* acceptable range if nec. */
351N/A+ /* significant at this level.) */
351N/A+ if (app->timerQueue != NULL) /* Do the same for the head of */
351N/A+ { /* the timer queue if necessary. */
351N/A+ TIMEDELTA(tv, app->timerQueue->te_timer_value, wt->cur_time);
351N/A+ XtAppErrorMsg(app, "selectError", "timerQueue",
351N/A+ XtCXtToolkitError, "timerQueue value %lu:%lu is invalid",
351N/A+ ADD_TIME(app->timerQueue->te_timer_value, wt->cur_time, tv);
761N/A@@ -621,20 +666,56 @@ WaitLoop:
351N/A * interrupt occured recalculate time value and wait again.
351N/A- if (errno == EINTR || errno == EAGAIN) {
351N/A- if (errno == EAGAIN) {
351N/A- errno = 0; /* errno is not self reseting */
351N/A- errno = 0; /* errno is not self reseting */
761N/A- /* was it interrupted by a signal that we care about? */
761N/A- if (!ignoreSignals && app->signalQueue != NULL) {
761N/A- SignalEventRec *se_ptr = app->signalQueue;
761N/A- while (se_ptr != NULL) {
761N/A- if (se_ptr->se_notice) {
761N/A- if (block && howlong != NULL)
351N/A+ if (errno == EAGAIN) {
351N/A+ errno = 0; /* errno is not self reseting */
351N/A+ } else if (errno == EBADF) {
351N/A+ /* Bug 4482749 - If we have a bad FD stop monitoring it */
351N/A+ struct timeval tv={0};
351N/A+ String param = bad_fd;
351N/A+ Cardinal param_count = 1;
351N/A+ * Get rid of any input procedures on the bad FD
351N/A+ * and regenerate the list of FDs we listen to.
351N/A+ while (app->input_list[i] != NULL) {
351N/A+ XtRemoveInput((XtInputId)app->input_list[i]);
351N/A+ InitFds (app, ignoreEvents, ignoreInputs, &wf);
351N/A+ sprintf(bad_fd, "%d", errno);
351N/A+ XtAppWarningMsg(app, "communicationError", "select",
351N/A+ "Select failed; error code %s",
351N/A+ ¶m, ¶m_count);
351N/A+ sprintf(bad_fd, "EBADF error in select() call for file descriptor %d", i);
351N/A+ XtAppWarning(app, param);
351N/A+ } else if (errno == EINTR) {
351N/A+ /* was it interrupted by a signal that we care about? */
351N/A+ if (!ignoreSignals && app->signalQueue != NULL) {
351N/A+ SignalEventRec *se_ptr = app->signalQueue;
351N/A+ while (se_ptr != NULL) {
351N/A+ if (se_ptr->se_notice) {
351N/A+ if (block && howlong != NULL)
761N/A@@ -679,17 +760,33 @@ WaitLoop:
351N/A- Cardinal param_count = 1;
351N/A- sprintf( Errno, "%d", errno);
351N/A- XtAppWarningMsg(app, "communicationError","select",
351N/A- XtCXtToolkitError,"Select failed; error code %s",
351N/A- ¶m, ¶m_count);
761N/A+ } else if (errno == EINVAL) { /* (Can be recovered from if */
761N/A+ struct timeval tv={0};
351N/A+ /* Do a non-blocking select to */
351N/A+ /* eliminate any timeout errors.*/
351N/A+ if (nfds == -1) { /* Now try to sort out the good */
351N/A+ if (errno == EINVAL) { /* and the bad from the ugly. */
351N/A+ char Errno[12]; /* (This is ugly). */
351N/A+ Cardinal param_count = 1;
351N/A+ sprintf(Errno, "%d", errno);
351N/A+ XtAppErrorMsg(app, "communicationError", "select",
351N/A+ XtCXtToolkitError, "Select failed; error code %s",
351N/A+ ¶m, ¶m_count);
351N/A+ XtAppError(app, "EINVAL error in select() call");
351N/A+ } else { /* If the new error is not about */
351N/A+ /* an invalid select() parameter,*/
351N/A+ continue; /* then simply try again. */
351N/A+ } else { /* (Else the error appears to be */
351N/A+ /* in the timeout parameter.) */
351N/A+ CheckAndTrimTimes(app, &wt);
351N/A } /* timed out or input available */
761N/A@@ -735,6 +832,44 @@ WaitLoop:
351N/A #define SeCallProc(ptr) \
351N/A (*ptr->se_proc) (ptr->se_closure, (XtSignalId*)&ptr);
351N/A+#ifdef sun /*SUNSOFT */
351N/A+#if NeedFunctionPrototypes
351N/A+int _XtwaitForSomething(
351N/A+ _XtBoolean ignoreTimers,
351N/A+ _XtBoolean ignoreInputs,
351N/A+ _XtBoolean ignoreEvents,
351N/A+ unsigned long *howlong,
351N/A+int _XtwaitForSomething(ignoreTimers, ignoreInputs, ignoreEvents,
351N/A+ unsigned long *howlong;
351N/A+/* fix for bug 4185875 leob */
351N/A+return _XtWaitForSomething(app,
351N/A+ ignoreEvents, ignoreTimers, ignoreInputs, TRUE,
351N/A+/* fix for bug 4185875 leob */
351N/A+return _XtWaitForSomething(app,
351N/A+ ignoreEvents, ignoreTimers, ignoreInputs, TRUE,
761N/A@@ -937,7 +937,7 @@ static XtCacheRef *GetResources(
351N/A register XtTypedArg* arg = typed_args + typed[j] - 1;
351N/A- for (i = num_typed_args - typed[j]; i; i--, arg++) {
351N/A+ for (i = num_typed_args - typed[j]; i > 0; i--, arg++) {
761N/A@@ -2473,6 +2473,11 @@ static Boolean TopLevelSetValues(
351N/A+ /* fix for bug 1243761 - leob */