Commit 6007f3251c0967adc13f2ed8be1b924ddc30124d

Authored by Wolfgang Denk
1 parent fc6414eca5

Coding Style cleanup, update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

Showing 2 changed files with 427 additions and 326 deletions Side-by-side Diff

  1 +commit fc6414eca55f1fc108fb12fc8cdc43bd8b4463f9
  2 +Author: Mike Frysinger <vapier@gentoo.org>
  3 +Date: Tue Dec 18 04:29:55 2007 -0500
  4 +
  5 + fix easylogo on big endian dev systems
  6 +
  7 + didnt realize how out of shape easylogo actually was until i tried using it.
  8 + this patch does byte swapping as need be on the input tga header since the tga
  9 + is in little endian but the host could just as well be big endian. i didnt
  10 + bother using bswap macros or such stuff from system headers as nothing in
  11 + POSIX dictates byte swapping functionality.
  12 +
  13 + Signed-Off-By: Mike Frysinger <vapier@gentoo.org>
  14 +
  15 +commit 38d299c2db81bd889c601b5dfc12c4e83ef83333
  16 +Author: Mike Frysinger <vapier@gentoo.org>
  17 +Date: Tue Dec 18 03:23:25 2007 -0500
  18 +
  19 + cleanup easylogo
  20 +
  21 + - make the Makefile not suck
  22 + - include proper headers for prototypes
  23 + - fix obvious broken handling of strchr() when handling '.' in filenames
  24 +
  25 + Signed-Off-By: Mike Frysinger <vapier@gentoo.org>
  26 +
  27 +commit 883e3925d99a8dd69c5b0201cba5b1887f88f95c
  28 +Author: raptorbrino@aim.com <raptorbrino@aim.com>
  29 +Date: Thu Dec 13 21:23:28 2007 -0500
  30 +
  31 + Fix build problems under Cygwin
  32 +
  33 + This patch allows u-boot to build without error in a cygwin
  34 + environment. Cygwin does not define __u64 in it's
  35 + include/asm/types.h file. The -idirafter flag in the u-boot
  36 + build causes the inclusion of the cygwin types.h file as opposed
  37 + to u-bot/include/asm/types.h file which does define __u64.
  38 + Subsequently, sha1.c compile fails due to unknown symbol.
  39 +
  40 + Signed-off-by: Brian Miller <raptorbrino@netscape.net>
  41 +
  42 +commit 43ef1c381f9195504a2488f5cb909227eb97d475
  43 +Author: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
  44 +Date: Fri Nov 30 17:29:59 2007 +0100
  45 +
  46 + cmd_bmp: Add support for displaying gzip compressed bmps
  47 +
  48 + The existing code can show information about a gzip compressed BMP
  49 + image, but can't actually display it.
  50 +
  51 + Therefore, move the decompression code out of bmp_info() and use it in
  52 + bmp_display() as well in order to display a compressed BMP image.
  53 +
  54 + Also, clean things up a bit and fix a memory leak while we're at it.
  55 +
  56 + [hskinnemoen@atmel.com: a bit of refactoring]
  57 + Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
  58 +
  59 +commit d197ffd8172c6fdef38733424640a9a47295d6e9
  60 +Author: Guennadi Liakhovetski <lg@denx.de>
  61 +Date: Thu Nov 29 21:15:56 2007 +0100
  62 +
  63 + Fix and optimize MII operations on FEC (MPC8xx) controllers
  64 +
  65 + This patch fixes several issues at least on a MPC885 based system with two
  66 + FEC interfaces used in MII mode.
  67 +
  68 + 1. PHY discovery should first read PHY_PHYIDR2 register and only then
  69 + PHY_PHYIDR1 like cpu/mpc8xx/fec.c::mii_discover_phy() does it,
  70 + otherwise the values read are wrong. Also notice, that PHY discovery
  71 + cannot work on MPC88x / MPC87x in setups with both FECs active at all
  72 + in its present form, because for both interfaces the registers from FEC
  73 + 1 are used to communicate over MII.
  74 +
  75 + 2. Remove code duplication for resetting the FEC by isolating it into a
  76 + separate function.
  77 +
  78 + 3. Initialize MII on FEC 1 when communicating over FEC 2 in fec_init().
  79 +
  80 + 4. Optimize mii_init() to only reset the FEC 1 controller once.
  81 +
  82 + 5. Fix a typo in mii_init() using index i instead of j thus potentially
  83 + leading to unpredictable results.
  84 +
  85 + Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
  86 +
  87 +commit 6a5e1d75bf106fa157e9ce68bcaf4b13e8a1d214
  88 +Author: Guennadi Liakhovetski <lg@denx.de>
  89 +Date: Tue Nov 20 13:14:20 2007 +0100
  90 +
  91 + Fix endianness conversions in rtl8169 driver
  92 +
  93 + It is unclear on what platforms this driver has been tested, since
  94 + noone up to now defines CONFIG_RTL8169 in the board configuration
  95 + header. Now it has been fixed for a big-endian mpc8241 based
  96 + linkstation platform. This patch presents the necessary endianness
  97 + conversion fixes.
  98 +
  99 + Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
  100 +
  101 +commit 07eb02687f008721974a2fb54cd7fdc28033ab3c
  102 +Author: Wolfgang Denk <wd@denx.de>
  103 +Date: Wed Jan 9 13:43:38 2008 +0100
  104 +
  105 + Coding Style clenaup; update CHANGELOG
  106 +
  107 + Signed-off-by: Wolfgang Denk <wd@denx.de>
  108 +
1 109 commit c26acc1a43b31ddca5add42fd0360ff0eee90c80
2 110 Author: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
3 111 Date: Thu Dec 27 17:13:11 2007 +0100
tools/easylogo/easylogo.c
... ... @@ -16,431 +16,424 @@
16 16 /*#define ENABLE_ASCII_BANNERS */
17 17  
18 18 typedef struct {
19   - unsigned char id;
20   - unsigned char ColorMapType;
21   - unsigned char ImageTypeCode;
22   - unsigned short ColorMapOrigin;
23   - unsigned short ColorMapLenght;
24   - unsigned char ColorMapEntrySize;
25   - unsigned short ImageXOrigin;
26   - unsigned short ImageYOrigin;
27   - unsigned short ImageWidth;
28   - unsigned short ImageHeight;
29   - unsigned char ImagePixelSize;
30   - unsigned char ImageDescriptorByte;
  19 + unsigned char id;
  20 + unsigned char ColorMapType;
  21 + unsigned char ImageTypeCode;
  22 + unsigned short ColorMapOrigin;
  23 + unsigned short ColorMapLenght;
  24 + unsigned char ColorMapEntrySize;
  25 + unsigned short ImageXOrigin;
  26 + unsigned short ImageYOrigin;
  27 + unsigned short ImageWidth;
  28 + unsigned short ImageHeight;
  29 + unsigned char ImagePixelSize;
  30 + unsigned char ImageDescriptorByte;
31 31 } tga_header_t;
32 32  
33 33 typedef struct {
34   - unsigned char r,g,b ;
35   -} rgb_t ;
  34 + unsigned char r, g, b;
  35 +} rgb_t;
36 36  
37 37 typedef struct {
38   - unsigned char b,g,r ;
39   -} bgr_t ;
  38 + unsigned char b, g, r;
  39 +} bgr_t;
40 40  
41 41 typedef struct {
42   - unsigned char Cb,y1,Cr,y2;
43   -} yuyv_t ;
  42 + unsigned char Cb, y1, Cr, y2;
  43 +} yuyv_t;
44 44  
45 45 typedef struct {
46   - void *data,
47   - *palette ;
48   - int width,
49   - height,
50   - pixels,
51   - bpp,
52   - pixel_size,
53   - size,
54   - palette_size,
55   - yuyv;
56   -} image_t ;
  46 + void *data, *palette;
  47 + int width, height, pixels, bpp, pixel_size, size, palette_size, yuyv;
  48 +} image_t;
57 49  
58 50 void StringUpperCase (char *str)
59 51 {
60   - int count = strlen(str);
61   - char c ;
  52 + int count = strlen (str);
  53 + char c;
62 54  
63   - while(count--)
64   - {
65   - c=*str;
66   - if ((c >= 'a')&&(c<='z'))
67   - *str = 'A' + (c-'a');
68   - str++ ;
69   - }
  55 + while (count--) {
  56 + c = *str;
  57 + if ((c >= 'a') && (c <= 'z'))
  58 + *str = 'A' + (c - 'a');
  59 + str++;
  60 + }
70 61 }
71 62  
72 63 void StringLowerCase (char *str)
73 64 {
74   - int count = strlen(str);
75   - char c ;
  65 + int count = strlen (str);
  66 + char c;
76 67  
77   - while(count--)
78   - {
79   - c=*str;
80   - if ((c >= 'A')&&(c<='Z'))
81   - *str = 'a' + (c-'A');
82   - str++ ;
83   - }
  68 + while (count--) {
  69 + c = *str;
  70 + if ((c >= 'A') && (c <= 'Z'))
  71 + *str = 'a' + (c - 'A');
  72 + str++;
  73 + }
84 74 }
85   -void pixel_rgb_to_yuyv (rgb_t *rgb_pixel, yuyv_t *yuyv_pixel)
  75 +void pixel_rgb_to_yuyv (rgb_t * rgb_pixel, yuyv_t * yuyv_pixel)
86 76 {
87   - unsigned int pR, pG, pB ;
  77 + unsigned int pR, pG, pB;
88 78  
89   - /* Transform (0-255) components to (0-100) */
90   - pR = rgb_pixel->r * 100 / 255 ;
91   - pG = rgb_pixel->g * 100 / 255 ;
92   - pB = rgb_pixel->b * 100 / 255 ;
  79 + /* Transform (0-255) components to (0-100) */
  80 + pR = rgb_pixel->r * 100 / 255;
  81 + pG = rgb_pixel->g * 100 / 255;
  82 + pB = rgb_pixel->b * 100 / 255;
93 83  
94   - /* Calculate YUV values (0-255) from RGB beetween 0-100 */
95   - yuyv_pixel->y1 = yuyv_pixel->y2 = 209 * (pR + pG + pB) / 300 + 16 ;
96   - yuyv_pixel->Cb = pB - (pR/4) - (pG*3/4) + 128 ;
97   - yuyv_pixel->Cr = pR - (pG*3/4) - (pB/4) + 128 ;
  84 + /* Calculate YUV values (0-255) from RGB beetween 0-100 */
  85 + yuyv_pixel->y1 = yuyv_pixel->y2 = 209 * (pR + pG + pB) / 300 + 16;
  86 + yuyv_pixel->Cb = pB - (pR / 4) - (pG * 3 / 4) + 128;
  87 + yuyv_pixel->Cr = pR - (pG * 3 / 4) - (pB / 4) + 128;
98 88  
99   - return ;
  89 + return;
100 90 }
101 91  
102   -void printlogo_rgb (rgb_t *data, int w, int h)
  92 +void printlogo_rgb (rgb_t * data, int w, int h)
103 93 {
104   - int x,y;
105   - for (y=0; y<h; y++)
106   - {
107   - for (x=0; x<w; x++, data++)
108   - if ((data->r < 30)/*&&(data->g == 0)&&(data->b == 0)*/)
109   - printf(" ");
110   - else
111   - printf("X");
112   - printf("\n");
113   - }
  94 + int x, y;
  95 +
  96 + for (y = 0; y < h; y++) {
  97 + for (x = 0; x < w; x++, data++)
  98 + if ((data->r <
  99 + 30) /*&&(data->g == 0)&&(data->b == 0) */ )
  100 + printf (" ");
  101 + else
  102 + printf ("X");
  103 + printf ("\n");
  104 + }
114 105 }
115 106  
116 107 void printlogo_yuyv (unsigned short *data, int w, int h)
117 108 {
118   - int x,y;
119   - for (y=0; y<h; y++)
120   - {
121   - for (x=0; x<w; x++, data++)
122   - if (*data == 0x1080) /* Because of inverted on i386! */
123   - printf(" ");
124   - else
125   - printf("X");
126   - printf("\n");
127   - }
  109 + int x, y;
  110 +
  111 + for (y = 0; y < h; y++) {
  112 + for (x = 0; x < w; x++, data++)
  113 + if (*data == 0x1080) /* Because of inverted on i386! */
  114 + printf (" ");
  115 + else
  116 + printf ("X");
  117 + printf ("\n");
  118 + }
128 119 }
129 120  
130 121 static inline unsigned short le16_to_cpu (unsigned short val)
131 122 {
132   - union {
133   - unsigned char pval[2];
134   - unsigned short val;
135   - } swapped;
136   - swapped.val = val;
137   - return (swapped.pval[1] << 8) + swapped.pval[0];
  123 + union {
  124 + unsigned char pval[2];
  125 + unsigned short val;
  126 + } swapped;
  127 +
  128 + swapped.val = val;
  129 + return (swapped.pval[1] << 8) + swapped.pval[0];
138 130 }
139 131  
140   -int image_load_tga (image_t *image, char *filename)
  132 +int image_load_tga (image_t * image, char *filename)
141 133 {
142   - FILE *file ;
143   - tga_header_t header ;
144   - int i;
145   - unsigned char app ;
146   - rgb_t *p ;
  134 + FILE *file;
  135 + tga_header_t header;
  136 + int i;
  137 + unsigned char app;
  138 + rgb_t *p;
147 139  
148   - if( ( file = fopen( filename, "rb" ) ) == NULL )
149   - return -1;
  140 + if ((file = fopen (filename, "rb")) == NULL)
  141 + return -1;
150 142  
151   - fread(&header, sizeof(header), 1, file);
  143 + fread (&header, sizeof (header), 1, file);
152 144  
153   - /* byte swap: tga is little endian, host is ??? */
154   - header.ColorMapOrigin = le16_to_cpu (header.ColorMapOrigin);
155   - header.ColorMapLenght = le16_to_cpu (header.ColorMapLenght);
156   - header.ImageXOrigin = le16_to_cpu (header.ImageXOrigin);
157   - header.ImageYOrigin = le16_to_cpu (header.ImageYOrigin);
158   - header.ImageWidth = le16_to_cpu (header.ImageWidth);
159   - header.ImageHeight = le16_to_cpu (header.ImageHeight);
  145 + /* byte swap: tga is little endian, host is ??? */
  146 + header.ColorMapOrigin = le16_to_cpu (header.ColorMapOrigin);
  147 + header.ColorMapLenght = le16_to_cpu (header.ColorMapLenght);
  148 + header.ImageXOrigin = le16_to_cpu (header.ImageXOrigin);
  149 + header.ImageYOrigin = le16_to_cpu (header.ImageYOrigin);
  150 + header.ImageWidth = le16_to_cpu (header.ImageWidth);
  151 + header.ImageHeight = le16_to_cpu (header.ImageHeight);
160 152  
161   - image->width = header.ImageWidth ;
162   - image->height = header.ImageHeight ;
  153 + image->width = header.ImageWidth;
  154 + image->height = header.ImageHeight;
163 155  
164   - switch (header.ImageTypeCode){
165   - case 2: /* Uncompressed RGB */
166   - image->yuyv = 0 ;
167   - image->palette_size = 0 ;
168   - image->palette = NULL ;
169   - break;
  156 + switch (header.ImageTypeCode) {
  157 + case 2: /* Uncompressed RGB */
  158 + image->yuyv = 0;
  159 + image->palette_size = 0;
  160 + image->palette = NULL;
  161 + break;
170 162  
171 163 default:
172   - printf("Format not supported!\n");
173   - return -1 ;
174   - }
  164 + printf ("Format not supported!\n");
  165 + return -1;
  166 + }
175 167  
176   - image->bpp = header.ImagePixelSize ;
177   - image->pixel_size = ((image->bpp-1) / 8) + 1 ;
178   - image->pixels = image->width * image->height;
179   - image->size = image->pixels * image->pixel_size ;
180   - image->data = malloc(image->size) ;
  168 + image->bpp = header.ImagePixelSize;
  169 + image->pixel_size = ((image->bpp - 1) / 8) + 1;
  170 + image->pixels = image->width * image->height;
  171 + image->size = image->pixels * image->pixel_size;
  172 + image->data = malloc (image->size);
181 173  
182   - if (image->bpp != 24)
183   - {
184   - printf("Bpp not supported: %d!\n", image->bpp);
185   - return -1 ;
186   - }
  174 + if (image->bpp != 24) {
  175 + printf ("Bpp not supported: %d!\n", image->bpp);
  176 + return -1;
  177 + }
187 178  
188   - fread(image->data, image->size, 1, file);
  179 + fread (image->data, image->size, 1, file);
189 180  
190 181 /* Swapping R and B values */
191 182  
192   - p = image->data ;
193   - for(i=0; i < image->pixels; i++, p++)
194   - {
195   - app = p->r ;
196   - p->r = p->b ;
197   - p->b = app ;
198   - }
  183 + p = image->data;
  184 + for (i = 0; i < image->pixels; i++, p++) {
  185 + app = p->r;
  186 + p->r = p->b;
  187 + p->b = app;
  188 + }
199 189  
200 190 /* Swapping image */
201 191  
202   - if(!(header.ImageDescriptorByte & 0x20))
203   - {
204   - unsigned char *temp = malloc(image->size);
205   - int linesize = image->pixel_size * image->width ;
206   - void *dest = image->data,
207   - *source = temp + image->size - linesize ;
  192 + if (!(header.ImageDescriptorByte & 0x20)) {
  193 + unsigned char *temp = malloc (image->size);
  194 + int linesize = image->pixel_size * image->width;
  195 + void *dest = image->data,
  196 + *source = temp + image->size - linesize;
208 197  
209   - printf("S");
210   - if (temp == NULL)
211   - {
212   - printf("Cannot alloc temp buffer!\n");
213   - return -1;
214   - }
  198 + printf ("S");
  199 + if (temp == NULL) {
  200 + printf ("Cannot alloc temp buffer!\n");
  201 + return -1;
  202 + }
215 203  
216   - memcpy(temp, image->data, image->size);
217   - for(i = 0; i<image->height; i++, dest+=linesize, source-=linesize)
218   - memcpy(dest, source, linesize);
  204 + memcpy (temp, image->data, image->size);
  205 + for (i = 0; i < image->height;
  206 + i++, dest += linesize, source -= linesize)
  207 + memcpy (dest, source, linesize);
219 208  
220   - free( temp );
221   - }
222   -
  209 + free (temp);
  210 + }
223 211 #ifdef ENABLE_ASCII_BANNERS
224   - printlogo_rgb (image->data,image->width, image->height);
  212 + printlogo_rgb (image->data, image->width, image->height);
225 213 #endif
226 214  
227   - fclose (file);
228   - return 0;
  215 + fclose (file);
  216 + return 0;
229 217 }
230 218  
231   -int image_free (image_t *image)
  219 +int image_free (image_t * image)
232 220 {
233   - if(image->data != NULL)
234   - free(image->data);
  221 + if (image->data != NULL)
  222 + free (image->data);
235 223  
236   - if(image->palette != NULL)
237   - free(image->palette);
  224 + if (image->palette != NULL)
  225 + free (image->palette);
238 226  
239 227 return 0;
240 228 }
241 229  
242   -int image_rgb_to_yuyv (image_t *rgb_image, image_t *yuyv_image)
  230 +int image_rgb_to_yuyv (image_t * rgb_image, image_t * yuyv_image)
243 231 {
244   - rgb_t *rgb_ptr = (rgb_t *) rgb_image->data ;
245   - yuyv_t yuyv ;
246   - unsigned short *dest ;
247   - int count = 0 ;
  232 + rgb_t *rgb_ptr = (rgb_t *) rgb_image->data;
  233 + yuyv_t yuyv;
  234 + unsigned short *dest;
  235 + int count = 0;
248 236  
249   - yuyv_image->pixel_size = 2 ;
250   - yuyv_image->bpp = 16 ;
251   - yuyv_image->yuyv = 1 ;
252   - yuyv_image->width = rgb_image->width ;
253   - yuyv_image->height = rgb_image->height ;
254   - yuyv_image->pixels = yuyv_image->width * yuyv_image->height ;
255   - yuyv_image->size = yuyv_image->pixels * yuyv_image->pixel_size ;
256   - dest = (unsigned short *) (yuyv_image->data = malloc(yuyv_image->size)) ;
257   - yuyv_image->palette = 0 ;
258   - yuyv_image->palette_size= 0 ;
  237 + yuyv_image->pixel_size = 2;
  238 + yuyv_image->bpp = 16;
  239 + yuyv_image->yuyv = 1;
  240 + yuyv_image->width = rgb_image->width;
  241 + yuyv_image->height = rgb_image->height;
  242 + yuyv_image->pixels = yuyv_image->width * yuyv_image->height;
  243 + yuyv_image->size = yuyv_image->pixels * yuyv_image->pixel_size;
  244 + dest = (unsigned short *) (yuyv_image->data =
  245 + malloc (yuyv_image->size));
  246 + yuyv_image->palette = 0;
  247 + yuyv_image->palette_size = 0;
259 248  
260   - while((count++) < rgb_image->pixels)
261   - {
  249 + while ((count++) < rgb_image->pixels) {
262 250 pixel_rgb_to_yuyv (rgb_ptr++, &yuyv);
263 251  
264   - if ((count & 1)==0) /* Was == 0 */
265   - memcpy (dest, ((void *)&yuyv) + 2, sizeof(short));
  252 + if ((count & 1) == 0) /* Was == 0 */
  253 + memcpy (dest, ((void *) &yuyv) + 2, sizeof (short));
266 254 else
267   - memcpy (dest, (void *)&yuyv, sizeof(short));
  255 + memcpy (dest, (void *) &yuyv, sizeof (short));
268 256  
269   - dest ++ ;
  257 + dest++;
270 258 }
271 259  
272 260 #ifdef ENABLE_ASCII_BANNERS
273   - printlogo_yuyv (yuyv_image->data, yuyv_image->width, yuyv_image->height);
  261 + printlogo_yuyv (yuyv_image->data, yuyv_image->width,
  262 + yuyv_image->height);
274 263 #endif
275   - return 0 ;
  264 + return 0;
276 265 }
277 266  
278   -int image_save_header (image_t *image, char *filename, char *varname)
  267 +int image_save_header (image_t * image, char *filename, char *varname)
279 268 {
280   - FILE *file = fopen (filename, "w");
281   - char app[256], str[256]="", def_name[64] ;
282   - int count = image->size, col=0;
283   - unsigned char *dataptr = image->data ;
284   - if (file==NULL)
285   - return -1 ;
  269 + FILE *file = fopen (filename, "w");
  270 + char app[256], str[256] = "", def_name[64];
  271 + int count = image->size, col = 0;
  272 + unsigned char *dataptr = image->data;
286 273  
287   -/* Author information */
288   - fprintf(file, "/*\n * Generated by EasyLogo, (C) 2000 by Paolo Scaffardi\n *\n");
289   - fprintf(file, " * To use this, include it and call: easylogo_plot(screen,&%s, width,x,y)\n *\n", varname);
290   - fprintf(file, " * Where:\t'screen'\tis the pointer to the frame buffer\n");
291   - fprintf(file, " *\t\t'width'\tis the screen width\n");
292   - fprintf(file, " *\t\t'x'\t\tis the horizontal position\n");
293   - fprintf(file, " *\t\t'y'\t\tis the vertical position\n */\n\n");
  274 + if (file == NULL)
  275 + return -1;
294 276  
295   -/* Headers */
296   - fprintf(file, "#include <video_easylogo.h>\n\n");
297   -/* Macros */
298   - strcpy(def_name, varname);
  277 + /* Author information */
  278 + fprintf (file,
  279 + "/*\n * Generated by EasyLogo, (C) 2000 by Paolo Scaffardi\n *\n");
  280 + fprintf (file,
  281 + " * To use this, include it and call: easylogo_plot(screen,&%s, width,x,y)\n *\n",
  282 + varname);
  283 + fprintf (file,
  284 + " * Where:\t'screen'\tis the pointer to the frame buffer\n");
  285 + fprintf (file, " *\t\t'width'\tis the screen width\n");
  286 + fprintf (file, " *\t\t'x'\t\tis the horizontal position\n");
  287 + fprintf (file, " *\t\t'y'\t\tis the vertical position\n */\n\n");
  288 +
  289 + /* Headers */
  290 + fprintf (file, "#include <video_easylogo.h>\n\n");
  291 + /* Macros */
  292 + strcpy (def_name, varname);
299 293 StringUpperCase (def_name);
300   - fprintf(file, "#define DEF_%s_WIDTH\t\t%d\n", def_name, image->width);
301   - fprintf(file, "#define DEF_%s_HEIGHT\t\t%d\n", def_name, image->height);
302   - fprintf(file, "#define DEF_%s_PIXELS\t\t%d\n", def_name, image->pixels);
303   - fprintf(file, "#define DEF_%s_BPP\t\t%d\n", def_name, image->bpp);
304   - fprintf(file, "#define DEF_%s_PIXEL_SIZE\t%d\n", def_name, image->pixel_size);
305   - fprintf(file, "#define DEF_%s_SIZE\t\t%d\n\n", def_name, image->size);
306   -/* Declaration */
307   - fprintf(file, "unsigned char DEF_%s_DATA[DEF_%s_SIZE] = {\n", def_name, def_name);
  294 + fprintf (file, "#define DEF_%s_WIDTH\t\t%d\n", def_name,
  295 + image->width);
  296 + fprintf (file, "#define DEF_%s_HEIGHT\t\t%d\n", def_name,
  297 + image->height);
  298 + fprintf (file, "#define DEF_%s_PIXELS\t\t%d\n", def_name,
  299 + image->pixels);
  300 + fprintf (file, "#define DEF_%s_BPP\t\t%d\n", def_name, image->bpp);
  301 + fprintf (file, "#define DEF_%s_PIXEL_SIZE\t%d\n", def_name,
  302 + image->pixel_size);
  303 + fprintf (file, "#define DEF_%s_SIZE\t\t%d\n\n", def_name,
  304 + image->size);
  305 + /* Declaration */
  306 + fprintf (file, "unsigned char DEF_%s_DATA[DEF_%s_SIZE] = {\n",
  307 + def_name, def_name);
308 308  
309   -/* Data */
310   - while(count)
311   - switch (col){
312   - case 0:
313   - sprintf(str, " 0x%02x", *dataptr++);
314   - col++;
315   - count-- ;
316   - break;
  309 + /* Data */
  310 + while (count)
  311 + switch (col) {
  312 + case 0:
  313 + sprintf (str, " 0x%02x", *dataptr++);
  314 + col++;
  315 + count--;
  316 + break;
317 317  
318   - case 16:
319   - fprintf(file, "%s", str);
320   - if (count > 0)
321   - fprintf(file,",");
322   - fprintf(file, "\n");
  318 + case 16:
  319 + fprintf (file, "%s", str);
  320 + if (count > 0)
  321 + fprintf (file, ",");
  322 + fprintf (file, "\n");
323 323  
324   - col = 0 ;
325   - break;
  324 + col = 0;
  325 + break;
326 326  
327   - default:
328   - strcpy(app, str);
329   - sprintf(str, "%s, 0x%02x", app, *dataptr++);
330   - col++ ;
331   - count-- ;
332   - break;
  327 + default:
  328 + strcpy (app, str);
  329 + sprintf (str, "%s, 0x%02x", app, *dataptr++);
  330 + col++;
  331 + count--;
  332 + break;
333 333 }
334 334  
335 335 if (col)
336   - fprintf(file, "%s\n", str);
  336 + fprintf (file, "%s\n", str);
337 337  
338   -/* End of declaration */
339   - fprintf(file, "};\n\n");
340   -/* Variable */
341   - fprintf(file, "fastimage_t %s = {\n", varname);
342   - fprintf(file, " DEF_%s_DATA,\n", def_name);
343   - fprintf(file, " DEF_%s_WIDTH,\n", def_name);
344   - fprintf(file, " DEF_%s_HEIGHT,\n", def_name);
345   - fprintf(file, " DEF_%s_BPP,\n", def_name);
346   - fprintf(file, " DEF_%s_PIXEL_SIZE,\n", def_name);
347   - fprintf(file, " DEF_%s_SIZE\n};\n", def_name);
  338 + /* End of declaration */
  339 + fprintf (file, "};\n\n");
  340 + /* Variable */
  341 + fprintf (file, "fastimage_t %s = {\n", varname);
  342 + fprintf (file, " DEF_%s_DATA,\n", def_name);
  343 + fprintf (file, " DEF_%s_WIDTH,\n", def_name);
  344 + fprintf (file, " DEF_%s_HEIGHT,\n", def_name);
  345 + fprintf (file, " DEF_%s_BPP,\n", def_name);
  346 + fprintf (file, " DEF_%s_PIXEL_SIZE,\n", def_name);
  347 + fprintf (file, " DEF_%s_SIZE\n};\n", def_name);
348 348  
349 349 fclose (file);
350 350  
351   - return 0 ;
  351 + return 0;
352 352 }
353 353  
354 354 #define DEF_FILELEN 256
355 355  
356 356 int main (int argc, char *argv[])
357 357 {
358   - char
359   - inputfile[DEF_FILELEN],
360   - outputfile[DEF_FILELEN],
361   - varname[DEF_FILELEN];
  358 + char inputfile[DEF_FILELEN],
  359 + outputfile[DEF_FILELEN], varname[DEF_FILELEN];
362 360  
363   - image_t rgb_logo, yuyv_logo ;
  361 + image_t rgb_logo, yuyv_logo;
364 362  
365   - switch (argc){
366   - case 2:
367   - case 3:
368   - case 4:
369   - strcpy (inputfile, argv[1]);
  363 + switch (argc) {
  364 + case 2:
  365 + case 3:
  366 + case 4:
  367 + strcpy (inputfile, argv[1]);
370 368  
371   - if (argc > 2)
372   - strcpy (varname, argv[2]);
373   - else
374   - {
375   - char *dot = strchr(inputfile, '.');
376   - int pos = dot - inputfile;
  369 + if (argc > 2)
  370 + strcpy (varname, argv[2]);
  371 + else {
  372 + char *dot = strchr (inputfile, '.');
  373 + int pos = dot - inputfile;
377 374  
378   - if (dot)
379   - {
380   - strncpy (varname, inputfile, pos);
381   - varname[pos] = 0 ;
382   - }
383   - }
  375 + if (dot) {
  376 + strncpy (varname, inputfile, pos);
  377 + varname[pos] = 0;
  378 + }
  379 + }
384 380  
385   - if (argc > 3)
386   - strcpy (outputfile, argv[3]);
387   - else
388   - {
389   - char *dot = strchr (varname, '.');
390   - int pos = dot - varname;
  381 + if (argc > 3)
  382 + strcpy (outputfile, argv[3]);
  383 + else {
  384 + char *dot = strchr (varname, '.');
  385 + int pos = dot - varname;
391 386  
392   - if (dot)
393   - {
394   - char app[DEF_FILELEN] ;
  387 + if (dot) {
  388 + char app[DEF_FILELEN];
395 389  
396   - strncpy(app, varname, pos);
397   - app[pos] = 0;
398   - sprintf(outputfile, "%s.h", app);
399   - }
400   - }
401   - break;
  390 + strncpy (app, varname, pos);
  391 + app[pos] = 0;
  392 + sprintf (outputfile, "%s.h", app);
  393 + }
  394 + }
  395 + break;
402 396  
403   - default:
404   - printf("EasyLogo 1.0 (C) 2000 by Paolo Scaffardi\n\n");
  397 + default:
  398 + printf ("EasyLogo 1.0 (C) 2000 by Paolo Scaffardi\n\n");
405 399  
406   - printf("Syntax: easylogo inputfile [outputvar {outputfile}] \n");
407   - printf("\n");
408   - printf("Where: 'inputfile' is the TGA image to load\n");
409   - printf(" 'outputvar' is the variable name to create\n");
410   - printf(" 'outputfile' is the output header file (default is 'inputfile.h')\n");
  400 + printf("Syntax: easylogo inputfile [outputvar {outputfile}] \n");
  401 + printf("\n");
  402 + printf("Where: 'inputfile' is the TGA image to load\n");
  403 + printf(" 'outputvar' is the variable name to create\n");
  404 + printf(" 'outputfile' is the output header file (default is 'inputfile.h')\n");
411 405  
412   - return -1 ;
413   - }
  406 + return -1;
  407 + }
414 408  
415   - printf("Doing '%s' (%s) from '%s'...",
416   - outputfile, varname, inputfile);
  409 + printf ("Doing '%s' (%s) from '%s'...",
  410 + outputfile, varname, inputfile);
417 411  
418   -/* Import TGA logo */
  412 + /* Import TGA logo */
419 413  
420   - printf("L");
421   - if (image_load_tga (&rgb_logo, inputfile)<0)
422   - {
423   - printf("input file not found!\n");
424   - exit(1);
425   - }
  414 + printf ("L");
  415 + if (image_load_tga (&rgb_logo, inputfile) < 0) {
  416 + printf ("input file not found!\n");
  417 + exit (1);
  418 + }
426 419  
427   -/* Convert it to YUYV format */
  420 + /* Convert it to YUYV format */
428 421  
429   - printf("C");
430   - image_rgb_to_yuyv (&rgb_logo, &yuyv_logo) ;
  422 + printf ("C");
  423 + image_rgb_to_yuyv (&rgb_logo, &yuyv_logo);
431 424  
432   -/* Save it into a header format */
  425 + /* Save it into a header format */
433 426  
434   - printf("S");
435   - image_save_header (&yuyv_logo, outputfile, varname) ;
  427 + printf ("S");
  428 + image_save_header (&yuyv_logo, outputfile, varname);
436 429  
437   -/* Free original image and copy */
  430 + /* Free original image and copy */
438 431  
439   - image_free (&rgb_logo);
440   - image_free (&yuyv_logo);
  432 + image_free (&rgb_logo);
  433 + image_free (&yuyv_logo);
441 434  
442   - printf("\n");
  435 + printf ("\n");
443 436  
444   - return 0 ;
  437 + return 0;
445 438 }