linux/string.h is not a valid include outside of the kernel, so when compil=
ing=20
sha1.c for the host (for use with the `mkimage` host binary), the include=20
needs to be changed to string.h.
Signed-Off-By: Mike Frysinger <vapier@...>
=2D--
diff --git a/lib_generic/sha1.c b/lib_generic/sha1.c
index 08ffa6b..d04cba7 100644
=2D-- a/lib_generic/sha1.c
+++ b/lib_generic/sha1.c
@@ -29,7 +29,11 @@
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
=20
+#ifndef USE_HOSTCC
#include <linux/string.h>
+#else
+#include <string.h>
+#endif
#include "sha1.h"
=20
/*
diff --git a/tools/easylogo/Makefile b/tools/easylogo/Makefile
index 292344a..566b125 100644
=2D-- a/tools/easylogo/Makefile
+++ b/tools/easylogo/Makefile
@@ -1,2 +1,8 @@
=2Dall: easylogo.c
=2D gcc easylogo.c -o easylogo
+CFLAGS +=3D -Wall
+
+all: easylogo
+
+clean:
+ rm -f easylogo *.o
+
+.PHONY: all clean
diff --git a/tools/easylogo/easylogo.c b/tools/easylogo/easylogo.c
index 9f1d1ff..c69f012 100644
=2D-- a/tools/easylogo/easylogo.c
+++ b/tools/easylogo/easylogo.c
@@ -8,6 +8,8 @@
*/
=20
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
=20
#pragma pack(1)
=20
@@ -41,7 +43,7 @@ typedef struct {
} yuyv_t ;
=20
typedef struct {
=2D unsigned char *data,
+ void *data,
*palette ;
int width,
height,
@@ -125,6 +127,16 @@ void printlogo_yuyv (unsigned short *data, int w, int =
h)
}
}
=20
+static inline unsigned short le16_to_cpu (unsigned short val)
+{
+ union {
+ unsigned char pval[2];
+ unsigned short val;
+ } swapped;
+ swapped.val =3D val;
+ return (swapped.pval[1] << 8) + swapped.pval[0];
+}
+
int image_load_tga (image_t *image, char *filename)
{
FILE *file ;
@@ -138,6 +150,14 @@ int image_load_tga (image_t *image, char *filename)
=20
fread(&header, sizeof(header), 1, file);
=20
+ /* byte swap: tga is little endian, host is ??? */
+ header.ColorMapOrigin =3D le16_to_cpu (header.ColorMapOrigin);
+ header.ColorMapLenght =3D le16_to_cpu (header.ColorMapLenght);
+ header.ImageXOrigin =3D le16_to_cpu (header.ImageXOrigin);
+ header.ImageYOrigin =3D le16_to_cpu (header.ImageYOrigin);
+ header.ImageWidth =3D le16_to_cpu (header.ImageWidth);
+ header.ImageHeight =3D le16_to_cpu (header.ImageHeight);
+
image->width =3D header.ImageWidth ;
image->height =3D header.ImageHeight ;
=20
@@ -352,9 +372,10 @@ int main (int argc, char *argv[])
strcpy (varname, argv[2]);
else
{
=2D int pos =3D strchr(inputfile, '.');
+ char *dot =3D strchr(inputfile, '.');
+ int pos =3D dot - inputfile;
=20
=2D if (pos >=3D 0)
+ if (dot)
{
strncpy (varname, inputfile, pos);
varname[pos] =3D 0 ;
@@ -365,13 +386,15 @@ int main (int argc, char *argv[])
strcpy (outputfile, argv[3]);
else
{
=2D int pos =3D strchr (varname, '.');
+ char *dot =3D strchr (varname, '.');
+ int pos =3D dot - varname;
=20
=2D if (pos > 0)
+ if (dot)
{
char app[DEF_FILELEN] ;
=20
strncpy(app, varname, pos);
+ app[pos] =3D 0;
sprintf(outputfile, "%s.h", app);
}
}
@@ -389,6 +412,8 @@ int main (int argc, char *argv[])
return -1 ;
}
=20
+ setbuf(stdout, NULL);
+
printf("Doing '%s' (%s) from '%s'...",
outputfile, varname, inputfile);
=20
|