diff --git a/reactos/hal/halx86/legacy/bussupp.c b/reactos/hal/halx86/legacy/bussupp.c index 374603ca627..ec70b40f794 100644 --- a/reactos/hal/halx86/legacy/bussupp.c +++ b/reactos/hal/halx86/legacy/bussupp.c @@ -715,7 +715,7 @@ HalpDebugPciDumpBus(IN ULONG i, /* Isolate the class name */ sprintf(LookupString, "C %02x ", PciData->BaseClass); - ClassName = strstr(ClassTable, LookupString); + ClassName = strstr((PCHAR)ClassTable, LookupString); if (ClassName) { /* Isolate the subclass name */ @@ -736,7 +736,7 @@ HalpDebugPciDumpBus(IN ULONG i, /* Isolate the vendor name */ sprintf(LookupString, "\r\n%04x ", PciData->VendorID); - VendorName = strstr(VendorTable, LookupString); + VendorName = strstr((PCHAR)VendorTable, LookupString); if (VendorName) { /* Copy the vendor name into our buffer */ diff --git a/reactos/tools/bin2c.c b/reactos/tools/bin2c.c index 87682c1a67a..83b38e9e241 100644 --- a/reactos/tools/bin2c.c +++ b/reactos/tools/bin2c.c @@ -13,8 +13,8 @@ int main(int argc, char *argv[]) FILE* inFile; FILE* outCFile; FILE* outHFile; + size_t bufLen; unsigned char ch; - unsigned char cnt; /* Validate the arguments */ if (argc < 5) @@ -46,14 +46,6 @@ int main(int argc, char *argv[]) return -1; } - /* Generate the header file and close it */ - fprintf(outHFile, "/* This file is autogenerated, do not edit. */\n\n"); - fprintf(outHFile, "#ifndef CHAR\n" - "#define CHAR char\n" - "#endif\n\n"); - fprintf(outHFile, "extern CHAR %s[];\n", argv[4]); - fclose(outHFile); - /* Generate the source file and close it */ fprintf(outCFile, "/* This file is autogenerated, do not edit. */\n\n"); if (argc >= 7) @@ -69,26 +61,30 @@ int main(int argc, char *argv[]) /* Add the array attribute */ fprintf(outCFile, "%s ", argv[5]); } - fprintf(outCFile, "CHAR %s[] =\n{", argv[4]); + fprintf(outCFile, "unsigned char %s[] =\n{", argv[4]); - cnt = 0; - ch = fgetc(inFile); + bufLen = 0; + ch = fgetc(inFile); while (!feof(inFile)) { - if ((cnt % 16) == 0) - { + if ((bufLen % 16) == 0) fprintf(outCFile, "\n "); - cnt = 0; - } + fprintf(outCFile, " 0x%02x,", (unsigned int)ch); - ++cnt; + ++bufLen; ch = fgetc(inFile); } /* Put a final NULL terminator */ - fprintf(outCFile, "\n 0x00"); + fprintf(outCFile, "\n 0x00"); ++bufLen; fprintf(outCFile, "\n};\n"); fclose(outCFile); + /* Generate the header file and close it */ + fprintf(outHFile, "/* This file is autogenerated, do not edit. */\n\n"); + fprintf(outHFile, "#define %s_SIZE %Iu\n" , argv[4], bufLen); + fprintf(outHFile, "extern unsigned char %s[%Iu];\n", argv[4], bufLen); + fclose(outHFile); + /* Close the input file */ fclose(inFile);