/* 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 */
/* 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 */
FILE* inFile;
FILE* outCFile;
FILE* outHFile;
+ size_t bufLen;
unsigned char ch;
- unsigned char cnt;
/* Validate the arguments */
if (argc < 5)
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)
/* 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);