cleanup easylogo
[oweals/u-boot.git] / tools / easylogo / easylogo.c
index 9f1d1fff0821cfb2f158c7cd40f69a426bc08d08..59f9ae7d99a544c68df52306eb8086b1944f8881 100644 (file)
@@ -8,6 +8,8 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #pragma pack(1)
 
@@ -41,7 +43,7 @@ typedef struct {
 } yuyv_t ;
 
 typedef struct {
-       unsigned char   *data,
+       void                            *data,
                                        *palette ;
        int                             width,
                                        height,
@@ -352,9 +354,10 @@ int main (int argc, char *argv[])
            strcpy (varname,    argv[2]);
        else
        {
-           int pos = strchr(inputfile, '.');
+           char *dot = strchr(inputfile, '.');
+           int pos = dot - inputfile;
 
-           if (pos >= 0)
+           if (dot)
            {
                strncpy (varname, inputfile, pos);
                varname[pos] = 0 ;
@@ -365,13 +368,15 @@ int main (int argc, char *argv[])
            strcpy (outputfile, argv[3]);
        else
        {
-           int pos = strchr (varname, '.');
+           char *dot = strchr (varname, '.');
+           int pos = dot - varname;
 
-           if (pos > 0)
+           if (dot)
            {
                char app[DEF_FILELEN] ;
 
                strncpy(app, varname, pos);
+               app[pos] = 0;
                sprintf(outputfile, "%s.h", app);
            }
        }