summaryrefslogtreecommitdiff
path: root/graphics/xv/files/patch-suse-2003-01-27
blob: 60cee57cd57d5e21072528ab56ad70ceaf56d540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
--- xv.c
+++ xv.c	2003-01-27 00:03:36.000000000 +0100
@@ -146,9 +146,7 @@
      rmodeset, gamset, cgamset, perfect, owncmap, rwcolor, stdcmap;
 int  nodecor;
 double gamval, rgamval, ggamval, bgamval;
-
-
-
+winRepositionningInfoST winRepositionningInfo = { 0, 0};
 
 /*******************************************/
 int main(argc, argv)
@@ -2125,6 +2145,7 @@
     /* if the file is STDIN, write it out to a temp file */
 
     if (strcmp(filename,STDINSTR)==0) {
+      int tmpfd;
       FILE *fp;
 
 #ifndef VMS      
@@ -2135,11 +2156,15 @@
       mktemp(filename);
 
       clearerr(stdin);
-      fp = fopen(filename,"w");
+      tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
+      if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
+      fp = fdopen(tmpfd,"w");
       if (!fp) FatalError("openPic(): can't write temporary file");
     
       while ( (i=getchar()) != EOF) putc(i,fp);
+      fflush(fp);
       fclose(fp);
+      close(tmpfd);
 
       /* and remove it from list, since we can never reload from stdin */
       if (strcmp(namelist[0], STDINSTR)==0) deleteFromList(0);
@@ -2672,7 +2697,11 @@
      to generate the correct exposes (particularly with 'BitGravity' turned
      on */
 
-  if (mainW && !useroot) GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
+  /*Brian T. Schellenberger: fix for X 4.2 refresh problem*/
+  if (mainW && !useroot) {
+    XSync(theDisp, False);
+    GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
+  }
 
   return 1;
 
@@ -2812,7 +2846,8 @@
 
 #ifdef GS_PATH
   else if (strncmp((char *) magicno, "%!",     (size_t) 2)==0 ||
-	   strncmp((char *) magicno, "\004%!", (size_t) 3)==0)   rv = RFT_PS;
+	   strncmp((char *) magicno, "\004%!", (size_t) 3)==0 ||
+	   strncmp((char *) magicno, "%PDF",   (size_t) 4)==0)   rv = RFT_PS;
 #endif
 
 #ifdef HAVE_MAG
@@ -2959,6 +2998,7 @@
      returns '0' on failure */
 
   char namez[128], *fname, buf[512];
+  int tmpfd;
 
   fname = name;
   namez[0] = '\0';
@@ -3047,15 +3090,18 @@
      char *src, *dst;
 {
   char tmpname[128], buffer[8192]; /* XXX */
-  int n, eof;
+  int n, eof, tmpfd;
   FILE *sfp, *dfp;
 
   sprintf(dst, "%s/xvmXXXXXX", tmpdir);
   mktemp(dst);
+  tmpfd = open(dst,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
+  if (tmpfd < 0) FatalError("RemoveMacbinary(): can't create temporary file");
+
   SetISTR(ISTR_INFO, "Removing MacBinary...");
 
   sfp = xv_fopen(src, "r"); 
-  dfp = xv_fopen(dst, "w"); 
+  dfp = fdopen(tmpfd, "w"); 
   if (!sfp || !dfp) {
     SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
     Warning();
@@ -3067,7 +3113,9 @@
   if (eof = feof(sfp))
     fwrite(buffer, 1, n, dfp);
   fclose(sfp);
+  fflush(dfp);
   fclose(dfp);
+  close(tmpfd);
   if (!eof) {
     SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
     Warning();
@@ -3199,7 +3247,7 @@
    */
 
   char fullcmd[512], tmpname[64], str[512];
-  int i;
+  int i, tmpfd;
 
   if (!cmd || (strlen(cmd) < (size_t) 2)) return 1;
 
@@ -3210,6 +3258,9 @@
     ErrPopUp(str, "\nHow unlikely!");
     return 1;
   }
+  tmpfd = open(tmpname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
+  if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
+  close(tmpfd);
 
   /* build command */
   strcpy(fullcmd, cmd+1);  /* skip the leading '!' character in cmd */
--- xv.h
+++ xv.h	2003-01-27 00:03:36.000000000 +0100
@@ -310,7 +294,9 @@
 #  endif
 #endif
 
-
+#ifndef		S_IRWUSR
+#  define	S_IRWUSR	(S_IRUSR|S_IWRITE)
+#endif
 
 #ifndef MAXPATHLEN
 #  define MAXPATHLEN 256
@@ -813,6 +811,13 @@
 #define WHERE
 #endif
 
+/* Needed for repositionning with negative geometries */
+typedef struct {
+  int negativeX;
+  int negativeY;
+} winRepositionningInfoST;
+extern winRepositionningInfoST winRepositionningInfo;
+
 typedef unsigned char byte;
 
 typedef struct scrl { 
--- xvdir.c
+++ xvdir.c	2003-01-27 00:03:36.000000000 +0100
@@ -80,7 +83,7 @@
 			       "PIC",
 #endif /* HAVE_PIC */
 #ifdef HAVE_MAKI
-			       "MAKI",
+			       "MAKI (640x400 only)",
 #endif /* HAVE_MAKI */
 #ifdef HAVE_PI
 			       "PI",
--- xvevent.c
+++ xvevent.c	2003-01-27 00:03:36.000000000 +0100
@@ -64,6 +64,8 @@
 
 static void   annotatePic      PARM((void));
 
+static int    debkludge_offx;
+static int    debkludge_offy;
 
 /****************/
 int EventLoop()
@@ -676,6 +694,29 @@
 	p_offy = xwa.y;
       }
 
+      /* Gather info to keep right border inside */
+      {
+	Window current;
+	Window root_r;
+	Window parent_r;
+	Window *children_r;
+	int nchildren_r;
+	XWindowAttributes xwa;
+
+	parent_r=mainW;
+	current=mainW;
+	do {
+	  current=parent_r;
+	  XQueryTree(theDisp, current, &root_r, &parent_r,
+		     &children_r, &nchildren_r);
+	  if (children_r!=NULL) {
+	    XFree(children_r);
+	  }
+	} while(parent_r!=root_r);
+	XGetWindowAttributes(theDisp, current, &xwa);
+	debkludge_offx=eWIDE-xwa.width+p_offx;
+	debkludge_offy=eHIGH-xwa.height+p_offy;
+      }
       
       /* move window around a bit... */
       {
@@ -2078,6 +2127,26 @@
   if (xwa->width  < dispWIDE && xwc.x < p_offx) xwc.x = p_offx;
   if (xwa->height < dispHIGH && xwc.y < p_offy) xwc.y = p_offy;
 
+  /* Try to keep bottom right decorations inside */
+  if (xwc.x+eWIDE-debkludge_offx>dispWIDE) {
+    xwc.x=dispWIDE-eWIDE+debkludge_offx;
+    if (xwc.x<0) xwc.x=0;
+  }
+  if (xwc.y+eHIGH-debkludge_offy>dispHIGH) {
+    xwc.y=dispHIGH-eHIGH+debkludge_offy;
+    if (xwc.y<0) xwc.y=0;
+  }
+
+  /* In case of negative offset for first image */
+  if (winRepositionningInfo.negativeX) {
+    xwc.x+=winRepositionningInfo.negativeX;
+    winRepositionningInfo.negativeX=0;
+  }
+  if (winRepositionningInfo.negativeY) {
+    xwc.y+=winRepositionningInfo.negativeY;
+    winRepositionningInfo.negativeY=0;
+  }
+
   xwc.width  = xwa->width;
   xwc.height = xwa->height;
 
--- xvfits.c
+++ xvfits.c	2003-01-27 00:03:36.000000000 +0100
@@ -14,7 +14,7 @@
  * provided "as is" without express or implied warranty.
  */
 
-
+#define  NEEDSDIR /* for S_IRUSR|S_IWUSR */
 #include "xv.h"
 
 #define NCARDS    (36)
@@ -223,7 +223,7 @@
    * If there was a problem writing files, then a error message will be set.
    */
   
-  int   i, np=nx * ny, ioerror, nwrt;
+  int   i, np=nx * ny, ioerror, nwrt, tmpfd;
   FILE *fp;
   char *error;
   byte *work;
@@ -246,7 +246,12 @@
 
   for (i=0; i < nz && !error; i++) {
     sprintf(filename, "%s%d", basename, i+1);
-    fp = xv_fopen(filename, "w");
+    tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
+    if (tmpfd < 0) {
+      error = "Unable to open temporary file";
+      break;
+    }
+    fp = fdopen(tmpfd, "w");
     if (!fp) {
       error = "Unable to open temporary file";
       break;
@@ -254,13 +259,17 @@
     
     if (wrheader(fp, nx, ny, comment)) {
       error = "I/O error writing temporary file";
+      fflush(fp);
       fclose(fp);
+      close(tmpfd);
       unlink(filename);
       break;
     }
 
     nwrt = fwrite(image+i*np, sizeof(byte), (size_t) np, fp);
+    fflush(fp);
     fclose(fp);
+    close(tmpfd);
 
     if (nwrt == 0) {  /* failed to write any data */
       error = "I/O error writing temporary file";
--- xvimage.c
+++ xvimage.c	2003-01-27 00:03:36.000000000 +0100
@@ -21,6 +21,7 @@
  *            int  LoadPad(pinfo, fname);
  */
 
+#define  NEEDSDIR             /* for S_IRUSR|S_IWUSR */
 #include "copyright.h"
 
 #include "xv.h"
@@ -2927,7 +2930,7 @@
      char *str;
      int   wide, high, opaque,omode;
 {
-  int i;
+  int i, tmpfd;
   byte *bgpic24;
   char syscmd[512], fname[128], errstr[512];
   PICINFO pinfo;
@@ -2949,6 +2952,13 @@
   strcpy(fname, "Sys$Disk:[]xvuXXXXXX");
 #endif
   mktemp(fname);
+  tmpfd = open(fname, O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
+  if (tmpfd < 0) {
+    sprintf(errstr, "Error: can't create temporary file %s", fname);
+    ErrPopUp(errstr, "\nDoh!");
+    return 0;
+  }
+  close(tmpfd);
 
   /* run bggen to generate the background */
   sprintf(syscmd, "bggen -g %dx%d %s > %s", wide, high, str, fname);
--- xvmaki.c
+++ xvmaki.c	2003-01-27 00:03:36.000000000 +0100
@@ -355,8 +355,12 @@
 	return -1;
     }
     
-    if(w != 640 || h != 400)
+    if(w != 640 || h != 400) {
+        char  str[512];
+        sprintf(str,"MAKI: %s Should be 640x400", maki_msgs[MAKI_SIZE]);
+	ErrPopUp(str, "\nBummer!");
 	maki_error(mi, MAKI_SIZE);
+    }
     
     maki.fp = fp;
     maki.width = w;
@@ -669,6 +673,7 @@
 static void maki_init_info(mi)
     struct maki_info *mi;
 {
+    xvbzero((char *)mi, sizeof(struct maki_info));
     mi->fp = NULL;
     mi->fsize = 0;
     mi->x0 = mi->y0 = mi->x1 = mi->y1 = 0;
--- xvpds.c
+++ xvpds.c	2003-01-27 00:03:36.000000000 +0100
@@ -102,7 +102,7 @@
  * This software is provided "as is" without any express or implied warranty.
  */
 
-
+#define  NEEDSDIR       /* for S_IRUSR|S_IWUSR */
 #include "xv.h"
 
 #ifdef HAVE_PDS
@@ -250,7 +250,7 @@
 {
   /* returns '1' on success, '0' on failure */
 
-  int tempnum;
+  int tempnum, tmpfd;
   FILE	*zf;
   static int isfixed,teco,i,j,itype,vaxbyte,
              recsize,hrecsize,irecsize,isimage,labelrecs,labelsofar,
@@ -690,6 +690,12 @@
 #ifndef VMS
     sprintf(pdsuncompfname,"%s/xvhuffXXXXXX", tmpdir);
     mktemp(pdsuncompfname);
+    tmpfd = open(pdsuncompfname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
+    if (tmpfd < 0) {
+	SetISTR(ISTR_WARNING,"Unable to create temporarly file.");
+	return 0;
+    }
+    close(tmpfd);
     sprintf(scanbuff,"%s %s - 4 >%s",PDSUNCOMP,fname,pdsuncompfname);
 #else
     strcpy(pdsuncompfname,"sys$disk:[]xvhuffXXXXXX");
--- xvps.c
+++ xvps.c	2003-01-27 00:03:36.000000000 +0100
@@ -1564,7 +1564,7 @@
   /* build command string */
 
 #ifndef VMS  /* VMS needs quotes around mixed case command lines */
-  sprintf(tmp, "%s -sDEVICE=%s -r%d -q -dNOPAUSE -sOutputFile=%s%%d ",
+  sprintf(tmp, "%s -sDEVICE=%s -r%d -q -dSAFER -dNOPAUSE -sOutputFile=%s%%d ",
 	  GS_PATH, gsDev, gsRes, tmpname);
 #else
   sprintf(tmp, 
--- xvtiff.c
+++ xvtiff.c	2003-01-27 00:03:36.000000000 +0100
@@ -5,6 +5,7 @@
  * LoadTIFF(fname, numcols, quick)  -  load a TIFF file
  */
 
+#define  NEEDSDIR       /* for S_IRUSR|S_IWUSR */
 #ifndef va_start
 # define NEEDSARGS
 #endif
@@ -56,7 +89,7 @@
     return 0;
   }
 
-  fseek(fp, 0L, 2);
+  fseek(fp, 0L, SEEK_END);
   filesize = ftell(fp);
   fclose(fp);
 
@@ -1065,7 +1308,7 @@
      int fromskew, toskew;
 {
   while (h-- > 0) {
-    UNROLL8(w,0, *cp++ = PALmap[*pp++][0]);
+    UNROLL8(w,, *cp++ = PALmap[*pp++][0]);
     cp += toskew;
     pp += fromskew;
   }
@@ -1262,7 +1504,7 @@
     }
   } else {
     while (h-- > 0) {
-      UNROLL8(w,0,
+      UNROLL8(w,,
 	      *cp++ = pp[0];
 	      *cp++ = pp[1];
 	      *cp++ = pp[2];
@@ -1335,7 +1577,7 @@
     }
   } else {
     while (h-- > 0) {
-      UNROLL8(w,0,
+      UNROLL8(w,,
 	      *cp++ = *r++;
 	      *cp++ = *g++;
 	      *cp++ = *b++;
--- xvtiffwr.c
+++ xvtiffwr.c	2003-01-27 00:03:36.000000000 +0100
@@ -78,6 +78,9 @@
       TIFFSetField(tif, TIFFTAG_GROUP3OPTIONS,
 	  GROUP3OPT_2DENCODING+GROUP3OPT_FILLBITS);
 
+  if (comp == COMPRESSION_LZW)
+      TIFFSetField(tif, TIFFTAG_PREDICTOR, 2);
+
   TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
   TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
   TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
--- xvvd.c
+++ xvvd.c	2003-01-27 00:03:36.000000000 +0100
@@ -793,7 +794,7 @@
        returns '0' on failure */
 
     char namez[128], *fname, buf[512], tmp[HEADERSIZE];
-    int n;
+    int n, tmpfd;
     FILE *pfp, *tfp;
   
     fname = name;
@@ -834,10 +835,17 @@
 	Warning();
 	return 0;
     }
-    if ((tfp = fopen(uncompname, "w")) == NULL) {
+    if ((tmpfd = open(uncompname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR)) < 0) {
+	SetISTR(ISTR_INFO, "Unable to create temporarly file.",
+		BaseName(uncompname));
+	Warning();
+	pclose(pfp);
+    }
+    if ((tfp = fdopen(tmpfd, "w")) == NULL) {
 	SetISTR(ISTR_INFO, "Unable to create temporarly file.",
 		BaseName(uncompname));
 	Warning();
+	close(tmpfd);
 	pclose(pfp);
 	return 0;
     }
@@ -846,11 +854,15 @@
 		BaseName(fname));
 	Warning();
 	pclose(pfp);
+	fflush(tfp);
 	fclose(tfp);
+	close(tmpfd);
 	return 0;
     }
     fwrite(tmp, 1, n, tfp);
+    fflush(tfp);
     fclose(tfp);
+    close(tmpfd);
     pclose(pfp);
     
     /* if we renamed the file to end with a .Z for the sake of 'uncompress', 
--- xvxpm.c
+++ xvxpm.c	2003-01-27 00:03:36.000000000 +0100
@@ -77,96 +77,104 @@
   hentry  *clmp;		/* colormap hash-table */
   hentry  *c_sptr;		/* cmap hash-table search pointer*/
   XColor   col;
-  
+
   bname = BaseName(fname);
   fp = fopen(fname, "r");
   if (!fp)
     return (XpmLoadError(bname, "couldn't open file"));
-  
+
   if (DEBUG)
     printf("LoadXPM(): Loading xpm from %s\n", fname);
-  
+
   fseek(fp, 0L, 2);
   filesize = ftell(fp);
   fseek(fp, 0L, 0);
-  
+
   bufchar = -2;
   in_quote = FALSE;
-  
+
   /* Read in the values line.  It is the first string in the
    * xpm, and contains four numbers.  w, h, num_colors, and
    * chars_per_pixel. */
-  
+
   /* First, get to the first string */
   while (((c = XpmGetc(fp))!=EOF) && (c != '"')) ;
   line_pos = 0;
-  
+
   /* Now, read in the string */
   while (((c = XpmGetc(fp))!=EOF) && (line_pos < VALUES_LEN) && (c != '"')) {
     values[line_pos++] = c;
   }
   if (c != '"')
     return (XpmLoadError(bname, "error parsing values line"));
-  
+
   values[line_pos] = '\0';
   sscanf(values, "%d%d%d%d", &w, &h, &nc, &cpp);
   if (nc <= 0 || cpp <= 0)
     return (XpmLoadError(bname, "No colours in Xpm?"));
-  
+
   if (nc > 256)
     pinfo->type = PIC24;
   else
     pinfo->type = PIC8;
-  
+
   if (DEBUG)
     printf("LoadXPM(): reading a %dx%d image (%d colors)\n", w, h, nc);
-  
+
   /* We got this far... */
   WaitCursor();
-  
+
   if (!hash_init(nc))
     return (XpmLoadError(bname, "Not enough memory to hash colormap"));
-  
+
   clmp = (hentry *) malloc(nc * sizeof(hentry)); /* Holds the colormap */
   if (pinfo->type == PIC8) pic = (byte *) malloc((size_t) (w*h));
                       else pic = (byte *) malloc((size_t) (w*h*3));
-  
+
   if (!clmp || !pic)
     return (XpmLoadError(bname, "Not enough memory to load pixmap"));
-  
+
   c_sptr = clmp;
   i_sptr = pic;
-  
+
   /* initialize the 'hex' array for zippy ASCII-hex -> int conversion */
-  
+
   for (i = 0 ; i < 256 ; i++)   hex[i] = 0;
   for (i = '0'; i <= '9' ; i++) hex[i] = i - '0';
   for (i = 'a'; i <= 'f' ; i++) hex[i] = i - 'a' + 10;
   for (i = 'A'; i <= 'F' ; i++) hex[i] = i - 'A' + 10;
-  
+
   /* Again, we've made progress. */
   WaitCursor();
-  
+
   /* Now, we need to read the colormap. */
   pinfo->colType = F_BWDITHER;
   for (i = 0 ; i < nc ; i++) {
     while (((c = XpmGetc(fp))!=EOF) && (c != '"')) ;
     if (c != '"')
       return (XpmLoadError(bname, "Error reading colormap"));
-    
+
     for (j = 0 ; j < cpp ; j++)
       c_sptr->token[j] = XpmGetc(fp);
     c_sptr->token[j] = '\0';
-    
+
     while (((c = XpmGetc(fp))!=EOF) && ((c == ' ') || (c == '\t'))) ;
     if (c == EOF)		/* The failure condition of getc() */
       return (XpmLoadError(bname, "Error parsing colormap line"));
-    
+
     do {
       char  key[3];
-      char  color[40];	/* Need to figure a good size for this... */
+      char  color[80];	/* Need to figure a good size for this... */
       short hd;		/* Hex digits per R, G, or B */
-      
+
+/*
+ *  Problem with spaces in color names
+ *
+ *    X s Color Name m Other Name c Last Name
+ *
+ *  ... this parser doesn't find `Any Name'
+ */
+
       for (j=0; j<2 && (c != ' ') && (c != '\t') && (c != EOF); j++) {
 	key[j] = c;
 	c = XpmGetc(fp);
@@ -177,7 +185,7 @@
       if (c == EOF)	/* The failure condition of getc() */
 	return (XpmLoadError(bname, "Error parsing colormap line"));
 
-      for (j=0; j<39 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
+      for (j=0; j<79 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
 	color[j] = c;
 	c = XpmGetc(fp);
       }
@@ -236,13 +244,13 @@
       else {      /* 'None' or unrecognized color spec */
 	int rgb;
 
-	if (strcmp(color, "None") == 0) rgb = 0xb2c0dc;  /* infobg */
+	if (strcasecmp(color, "None") == 0) rgb = 0xb2c0dc;  /* infobg */
 	else {
 	  SetISTR(ISTR_INFO, "%s:  unknown color spec '%s'", bname, color);
 	  Timer(1000);
 	  rgb = 0x808080;
 	}
-	
+
 	if (pinfo->type == PIC8) {
 	  pinfo->r[i] = (rgb>>16) & 0xff;
 	  pinfo->g[i] = (rgb>> 8) & 0xff;
@@ -309,28 +317,29 @@
 	*i_sptr++ = mapentry->cv_rgb[2];
       }
     }  /* for ( j < w ) */
-    (void)XpmGetc(fp);		/* Throw away the close " */
-  
+    while (((c = XpmGetc(fp))!=EOF) &&	/* Throw away the close " and */
+	   (c != '"')) ;		/* erase all remaining pixels */
+
     if (!(i%7)) WaitCursor();
   }  /* for ( i < h ) */
-  
+
   pinfo->pic = pic;
   pinfo->normw = pinfo->w = w;
   pinfo->normh = pinfo->h = h;
   pinfo->frmType = F_XPM;
 
   if (DEBUG) printf("LoadXPM(): pinfo->colType is %d\n", pinfo->colType);
-  
+
   sprintf(pinfo->fullInfo, "Xpm v3 Pixmap (%ld bytes)", filesize);
   sprintf(pinfo->shrtInfo, "%dx%d Xpm.", w, h);
   pinfo->comment = (char *)NULL;
-  
+
   hash_destroy();
   free(clmp);
-  
+
   if (fp != stdin)
     fclose(fp);
-  
+
   return(1);
 }