diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-16 22:48:53 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-16 22:48:53 -0700 |
commit | 3ea70059805b3ebc795f797b5880b90b6b3a9235 (patch) | |
tree | 580e215d33f103506e983e4b67739c587d8f8c5a /src | |
parent | 0c9e200c3975917f5d78eac67b1f4cedefd73079 (diff) |
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/Attrib.c | 2 | ||||
-rw-r--r-- | src/CrBufFrI.c | 2 | ||||
-rw-r--r-- | src/RdFToBuf.c | 12 | ||||
-rw-r--r-- | src/WrFFrI.c | 4 | ||||
-rw-r--r-- | src/XpmI.h | 4 | ||||
-rw-r--r-- | src/amigax.c | 60 | ||||
-rw-r--r-- | src/create.c | 18 | ||||
-rw-r--r-- | src/hashtab.c | 2 | ||||
-rw-r--r-- | src/parse.c | 2 | ||||
-rw-r--r-- | src/rgb.c | 2 | ||||
-rw-r--r-- | src/scan.c | 26 | ||||
-rw-r--r-- | src/simx.c | 18 |
12 files changed, 76 insertions, 76 deletions
diff --git a/src/Attrib.c b/src/Attrib.c index cb304df..1b38047 100644 --- a/src/Attrib.c +++ b/src/Attrib.c @@ -57,7 +57,7 @@ CreateOldColorTable( XpmColor **colorTable, **color; unsigned int a; - if (ncolors >= UINT_MAX / sizeof(XpmColor *)) + if (ncolors >= UINT_MAX / sizeof(XpmColor *)) return XpmNoMemory; colorTable = (XpmColor **) XpmMalloc(ncolors * sizeof(XpmColor *)); diff --git a/src/CrBufFrI.c b/src/CrBufFrI.c index 113a45c..398c645 100644 --- a/src/CrBufFrI.c +++ b/src/CrBufFrI.c @@ -214,7 +214,7 @@ XpmCreateBufferFromXpmImage( } ErrorStatus = WriteColors(&ptr, &ptr_size, &used_size, image->colorTable, image->ncolors, image->cpp); - + if (ErrorStatus != XpmSuccess) RETURN(ErrorStatus); diff --git a/src/RdFToBuf.c b/src/RdFToBuf.c index b719960..8501d23 100644 --- a/src/RdFToBuf.c +++ b/src/RdFToBuf.c @@ -98,12 +98,12 @@ XpmReadFileToBuffer( fclose(fp); #ifdef VMS /* VMS often stores text files in a variable-length record format, - where there are two bytes of size followed by the record. fread - converts this so it looks like a record followed by a newline. - Unfortunately, the size reported by fstat() (and fseek/ftell) - counts the two bytes for the record terminator, while fread() - counts only one. So, fread() sees fewer bytes in the file (size - minus # of records) and thus when asked to read the amount + where there are two bytes of size followed by the record. fread + converts this so it looks like a record followed by a newline. + Unfortunately, the size reported by fstat() (and fseek/ftell) + counts the two bytes for the record terminator, while fread() + counts only one. So, fread() sees fewer bytes in the file (size + minus # of records) and thus when asked to read the amount returned by stat(), it fails. The best solution, suggested by DEC, seems to consider the length returned from fstat() as an upper bound and call fread() with diff --git a/src/WrFFrI.c b/src/WrFFrI.c index f2726f9..83c11fa 100644 --- a/src/WrFFrI.c +++ b/src/WrFFrI.c @@ -256,8 +256,8 @@ WritePixels( unsigned int x, y, h; h = height - 1; - if (cpp != 0 && width >= (UINT_MAX - 3)/cpp) - return XpmNoMemory; + if (cpp != 0 && width >= (UINT_MAX - 3)/cpp) + return XpmNoMemory; p = buf = (char *) XpmMalloc(width * cpp + 3); if (!buf) return (XpmNoMemory); @@ -98,7 +98,7 @@ extern FILE *popen(); #ifndef SIZE_MAX # ifdef ULONG_MAX # define SIZE_MAX ULONG_MAX -# else +# else # define SIZE_MAX UINT_MAX # endif #endif @@ -319,7 +319,7 @@ FUNC(xpmstrdup, char *, (char *s1)); #define xpmstrdup strdup #endif -#ifdef NEED_STRCASECMP +#ifdef NEED_STRCASECMP FUNC(xpmstrcasecmp, int, (char *s1, char *s2)); #else #undef xpmstrcasecmp diff --git a/src/amigax.c b/src/amigax.c index eb3bc3a..f163960 100644 --- a/src/amigax.c +++ b/src/amigax.c @@ -58,7 +58,7 @@ AllocRastPort ( unsigned int depth) { struct RastPort *rp; - + rp = XpmMalloc (sizeof (*rp)); if (rp != NULL) { @@ -75,14 +75,14 @@ AllocRastPort ( else { unsigned int i; - + rp->BitMap = XpmMalloc (sizeof (*rp->BitMap)); if (rp->BitMap == NULL) { FreeRastPort (rp, width, height); return NULL; } - + InitBitMap (rp->BitMap, depth, width, height); for (i = 0; i < depth; ++i) rp->BitMap->Planes[i] = NULL; @@ -97,7 +97,7 @@ AllocRastPort ( } } } - + return rp; } @@ -118,7 +118,7 @@ FreeRastPort ( else { unsigned int i; - + for (i = 0; i < rp->BitMap->Depth; ++i) { if (rp->BitMap->Planes[i] != NULL) @@ -139,7 +139,7 @@ AllocXImage ( unsigned int depth) { XImage *img; - + img = XpmMalloc (sizeof (*img)); if (img != NULL) { @@ -152,7 +152,7 @@ AllocXImage ( return NULL; } } - + return img; } @@ -166,7 +166,7 @@ FreeXImage ( FreeRastPort (ximage->rp, ximage->width, ximage->height); XpmFree (ximage); } - + return Success; } @@ -180,7 +180,7 @@ XPutPixel ( { SetAPen (ximage->rp, pixel); WritePixel (ximage->rp, x, y); - + return Success; } @@ -195,7 +195,7 @@ AllocBestPen ( if (GfxBase->LibNode.lib_Version >= 39) { unsigned long r, g, b; - + r = screen_in_out->red * 0x00010001; g = screen_in_out->green * 0x00010001; b = screen_in_out->blue * 0x00010001; @@ -205,7 +205,7 @@ AllocBestPen ( TAG_DONE); if (screen_in_out->pixel == -1) return False; - + QueryColor (colormap, screen_in_out); } else @@ -213,7 +213,7 @@ AllocBestPen ( XColor nearest, trial; long nearest_delta, trial_delta; int num_cells, i; - + num_cells = colormap->Count; nearest.pixel = 0; QueryColor (colormap, &nearest); @@ -249,7 +249,7 @@ AllocBestPen ( screen_in_out->green = nearest.green; screen_in_out->blue = nearest.blue; } - + return True; } @@ -263,11 +263,11 @@ FreePens ( if (GfxBase->LibNode.lib_Version >= 39) { int i; - + for (i = 0; i < npixels; i++) ReleasePen (colormap, pixels[i]); } - + return Success; } @@ -278,20 +278,20 @@ ParseColor ( XColor *exact_def_return) { int spec_length; - + if (spec == 0) return False; - + spec_length = strlen(spec); if (spec[0] == '#') { int hexlen; char hexstr[10]; - + hexlen = (spec_length - 1) / 3; if (hexlen < 1 || hexlen > 4 || hexlen * 3 != spec_length - 1) return False; - + hexstr[hexlen] = '\0'; strncpy (hexstr, spec + 1, hexlen); exact_def_return->red = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen); @@ -299,7 +299,7 @@ ParseColor ( exact_def_return->green = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen); strncpy (hexstr, spec + 1 + 2 * hexlen, hexlen); exact_def_return->blue = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen); - + return True; } else @@ -308,25 +308,25 @@ ParseColor ( int items, red, green, blue; char line[512], name[512]; Bool success = False; - + rgbf = fopen ("LIBS:rgb.txt", "r"); if (rgbf == NULL) return False; - + while (fgets(line, sizeof (line), rgbf) && !success) { items = sscanf (line, "%d %d %d %[^\n]\n", &red, &green, &blue, name); if (items != 4) continue; - + if (red < 0 || red > 0xFF || green < 0 || green > 0xFF || blue < 0 || blue > 0xFF) { continue; } - + if (0 == xpmstrcasecmp (spec, name)) { exact_def_return->red = red * 0x0101; @@ -336,7 +336,7 @@ ParseColor ( } } fclose (rgbf); - + return success; } } @@ -350,7 +350,7 @@ QueryColor ( if (GfxBase->LibNode.lib_Version >= 39) { unsigned long rgb[3]; - + GetRGB32 (colormap, def_in_out->pixel, 1, rgb); def_in_out->red = rgb[0] >> 16; def_in_out->green = rgb[1] >> 16; @@ -359,13 +359,13 @@ QueryColor ( else { unsigned short rgb; - + rgb = GetRGB4 (colormap, def_in_out->pixel); def_in_out->red = ((rgb >> 8) & 0xF) * 0x1111; def_in_out->green = ((rgb >> 4) & 0xF) * 0x1111; def_in_out->blue = (rgb & 0xF) * 0x1111; } - + return Success; } @@ -377,9 +377,9 @@ QueryColors ( int ncolors) { int i; - + for (i = 0; i < ncolors; i++) QueryColor (colormap, &defs_in_out[i]); - + return Success; } diff --git a/src/create.c b/src/create.c index 7c75a42..00084d4 100644 --- a/src/create.c +++ b/src/create.c @@ -309,17 +309,17 @@ SetCloseColor( * occurred, so we try the next closest color, and so on, until no more * colors are within closeness of the target. If we knew that the * colormap had changed, we could skip this sequence. - * + * * If _none_ of the colors within closeness of the target can be allocated, * then we can finally be pretty sure that the colormap has actually * changed. In this case we try to allocate the original color (again), * then try the closecolor stuff (again)... - * + * * In theory it would be possible for an infinite loop to occur if another * process kept changing the colormap every time we sorted it, so we set * a maximum on the number of iterations. After this many tries, we use * XGrabServer() to ensure that the colormap remains unchanged. - * + * * This approach gives particularly bad worst case performance - as many as * <MaximumIterations> colormap reads and sorts may be needed, and as * many as <MaximumIterations> * <ColormapSize> attempted allocations @@ -816,7 +816,7 @@ XpmCreateImageFromXpmImage( ErrorStatus = XpmSuccess; - if (image->ncolors >= UINT_MAX / sizeof(Pixel)) + if (image->ncolors >= UINT_MAX / sizeof(Pixel)) return (XpmNoMemory); /* malloc pixels index tables */ @@ -1692,7 +1692,7 @@ APutImagePixels ( unsigned char *array; XImage *tmp_img; BOOL success = FALSE; - + array = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*array)); if (array != NULL) { @@ -1711,7 +1711,7 @@ APutImagePixels ( } XpmFree (array); } - + if (!success) { for (y = 0; y < height; ++y) @@ -1890,7 +1890,7 @@ PutPixel16MSB( unsigned long pixel) { unsigned char *addr; - + if(x < 0 || y < 0) return 0; @@ -1908,7 +1908,7 @@ PutPixel16LSB( unsigned long pixel) { unsigned char *addr; - + if(x < 0 || y < 0) return 0; @@ -2092,7 +2092,7 @@ xpmParseDataAndCreate( xpmGetCmt(data, &colors_cmt); /* malloc pixels index tables */ - if (ncolors >= UINT_MAX / sizeof(Pixel)) + if (ncolors >= UINT_MAX / sizeof(Pixel)) RETURN(XpmNoMemory); image_pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * ncolors); diff --git a/src/hashtab.c b/src/hashtab.c index 49e6e48..1bd4109 100644 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -146,7 +146,7 @@ HashTableGrows(xpmHashTable *table) HASH_TABLE_GROWS table->size = size; table->limit = size / 3; - if (size >= UINT_MAX / sizeof(*atomTable)) + if (size >= UINT_MAX / sizeof(*atomTable)) return (XpmNoMemory); atomTable = (xpmHashAtom *) XpmMalloc(size * sizeof(*atomTable)); if (!atomTable) diff --git a/src/parse.c b/src/parse.c index 5c7915f..7dc2aa7 100644 --- a/src/parse.c +++ b/src/parse.c @@ -380,7 +380,7 @@ ParsePixels( unsigned int a, x, y; if ((height > 0 && width >= UINT_MAX / height) || - width * height >= UINT_MAX / sizeof(unsigned int)) + width * height >= UINT_MAX / sizeof(unsigned int)) return XpmNoMemory; #ifndef FOR_MSW iptr2 = (unsigned int *) XpmMalloc(sizeof(unsigned int) * width * height); @@ -71,7 +71,7 @@ xpmReadRgbNames( /* Loop reading each line in the file. */ n = 0; - rgb = rgbn; + rgb = rgbn; /* Quit if rgb text file has too many entries. */ while (fgets(line, sizeof(line), rgbf) && n < MAX_RGBNAMES) { @@ -111,8 +111,8 @@ LFUNC(MSWGetImagePixels, int, (Display *d, XImage *image, unsigned int width, LFUNC(ScanTransparentColor, int, (XpmColor *color, unsigned int cpp, XpmAttributes *attributes)); -LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors, - unsigned int ncolors, +LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors, + unsigned int ncolors, Pixel *pixels, unsigned int mask, unsigned int cpp, XpmAttributes *attributes)); @@ -244,7 +244,7 @@ XpmCreateXpmImageFromImage( if (!pmap.pixelindex) RETURN(XpmNoMemory); - if (pmap.size >= UINT_MAX / sizeof(Pixel)) + if (pmap.size >= UINT_MAX / sizeof(Pixel)) RETURN(XpmNoMemory); pmap.pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * pmap.size); @@ -273,10 +273,10 @@ XpmCreateXpmImageFromImage( /* * scan the image data - * + * * In case depth is 1 or bits_per_pixel is 4, 6, 8, 24 or 32 use optimized * functions, otherwise use slower but sure general one. - * + * */ if (image) { @@ -433,8 +433,8 @@ ScanOtherColors( #ifndef FOR_MSW xpmRgbName rgbn[MAX_RGBNAMES]; #else - xpmRgbName *rgbn = NULL; -#endif + xpmRgbName *rgbn = NULL; +#endif int rgbn_max = 0; unsigned int i, j, c, i2; XpmColor *color; @@ -559,10 +559,10 @@ ScanOtherColors( #ifndef FOR_MSW sprintf(buf, "#%04X%04X%04X", xcolor->red, xcolor->green, xcolor->blue); -#else +#else sprintf(buf, "#%02x%02x%02x", xcolor->red, xcolor->green, xcolor->blue); -#endif +#endif color->c_color = (char *) xpmstrdup(buf); } if (!color->c_color) { @@ -924,15 +924,15 @@ AGetImagePixels ( unsigned int x, y; unsigned char *pixels; XImage *tmp_img; - + pixels = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*pixels)); if (pixels == NULL) return XpmNoMemory; - + tmp_img = AllocXImage ((((width+15)>>4)<<4), 1, image->rp->BitMap->Depth); if (tmp_img == NULL) CLEAN_UP (XpmNoMemory); - + iptr = pmap->pixelindex; for (y = 0; y < height; ++y) { @@ -943,7 +943,7 @@ AGetImagePixels ( CLEAN_UP (XpmNoMemory); } } - + CLEAN_UP (XpmSuccess); } @@ -122,7 +122,7 @@ XDefaultScreen(Display *d) /* I get only 1 plane but 8 bits per pixel, so I think BITSPIXEL should be depth */ -int +int XDefaultDepth(Display *display, Screen *screen) { int d, b; @@ -140,7 +140,7 @@ XDefaultColormap(Display *display, Screen *screen) /* convert hex color names, wrong digits (not a-f,A-F,0-9) are treated as zero */ -static int +static int hexCharToInt(c) { int r; @@ -157,7 +157,7 @@ hexCharToInt(c) return (r); } -static int +static int rgbFromHex(char *hex, int *r, int *g, int *b) { int len; @@ -187,7 +187,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b) } /* Color related functions */ -int +int XParseColor(Display *d, Colormap *cmap, char *name, XColor *color) { int r, g, b; /* only 8 bit values used */ @@ -215,14 +215,14 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color) } -int +int XAllocColor(Display *d, Colormap cmap, XColor *color) { /* colormap not used yet so color->pixel is the real COLORREF (RBG) and not an index in some colormap as in X */ return (1); } -void +void XQueryColors(Display *display, Colormap *colormap, XColor *xcolors, int ncolors) { @@ -238,7 +238,7 @@ XQueryColors(Display *display, Colormap *colormap, } return; } -int +int XFreeColors(Display *d, Colormap cmap, unsigned long pixels[], int npixels, unsigned long planes) { @@ -274,14 +274,14 @@ XCreateImage(Display *d, Visual *v, } -void +void XImageFree(XImage *img) { if (img) { XpmFree(img); } } -void +void XDestroyImage(XImage *img) { if (img) { |