You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
3.9 KiB
149 lines
3.9 KiB
1 year ago
|
diff -u a/bitfile.cpp b/bitfile.cpp
|
||
|
--- a/bitfile.cpp 2017-08-16 23:18:43.000000000 +1000
|
||
|
+++ b/bitfile.cpp 2021-09-05 13:54:41.982983499 +1000
|
||
|
@@ -96,7 +96,7 @@
|
||
|
length = ftell(fp); /* Fix at end */
|
||
|
fseek(fp, 0, SEEK_SET);
|
||
|
if(buffer) delete [] buffer;
|
||
|
- buffer= new byte[length];
|
||
|
+ buffer= new ::byte[length];
|
||
|
if (buffer == 0)
|
||
|
return 1;
|
||
|
fread(buffer,1, length, fp);
|
||
|
@@ -128,7 +128,7 @@
|
||
|
length >>= 1; /* We read two Hex nibbles for each byte*/
|
||
|
fseek(fp, 0, SEEK_SET);
|
||
|
if(buffer) delete [] buffer;
|
||
|
- buffer= new byte[length];
|
||
|
+ buffer= new ::byte[length];
|
||
|
|
||
|
/* FIXME: generate a dummy header*/
|
||
|
if (buffer == 0)
|
||
|
@@ -176,7 +176,7 @@
|
||
|
/* FIXME: Fill in dtime and date from the input file */
|
||
|
|
||
|
if(buffer) delete [] buffer;
|
||
|
- buffer=new byte[length];
|
||
|
+ buffer=new ::byte[length];
|
||
|
while ((fgets(buf, 1024, fp)) != 0)
|
||
|
{
|
||
|
uint32_t count;
|
||
|
@@ -333,13 +333,13 @@
|
||
|
|
||
|
void BitFile::processData(FILE *fp)
|
||
|
{
|
||
|
- byte t[4];
|
||
|
+ ::byte t[4];
|
||
|
fread(t,1,4,fp);
|
||
|
length=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3];
|
||
|
if(buffer) delete [] buffer;
|
||
|
- buffer=new byte[length];
|
||
|
+ buffer=new ::byte[length];
|
||
|
for(unsigned int i=0; i<length&&!feof(fp); i++){
|
||
|
- byte b;
|
||
|
+ ::byte b;
|
||
|
fread(&b,1,1,fp);
|
||
|
buffer[i]=bitRevTable[b]; // Reverse the bit order.
|
||
|
}
|
||
|
@@ -351,7 +351,7 @@
|
||
|
|
||
|
void BitFile::append(uint32_t val, unsigned cnt) {
|
||
|
size_t const nlen = length + 4*cnt;
|
||
|
- byte *const nbuf = new byte[nlen];
|
||
|
+ ::byte *const nbuf = new ::byte[nlen];
|
||
|
|
||
|
// copy old part
|
||
|
for(size_t i = 0; i < length; i++) nbuf[i] = buffer[i];
|
||
|
@@ -378,7 +378,7 @@
|
||
|
stat(fname, &stats);
|
||
|
|
||
|
size_t const nlen = length + stats.st_size;
|
||
|
- byte *const nbuf = new byte[nlen];
|
||
|
+ ::byte *const nbuf = new ::byte[nlen];
|
||
|
|
||
|
// copy old part
|
||
|
for(size_t i = 0; i < length; i++) nbuf[i] = buffer[i];
|
||
|
@@ -389,7 +389,7 @@
|
||
|
for(size_t i = length; i < nlen; i++) {
|
||
|
if(feof(fp)) throw io_exception("Unexpected end of file");
|
||
|
|
||
|
- byte b;
|
||
|
+ ::byte b;
|
||
|
fread(&b, 1, 1, fp);
|
||
|
buffer[i] = bitRevTable[b]; // Reverse the bit order.
|
||
|
}
|
||
|
@@ -407,7 +407,7 @@
|
||
|
{
|
||
|
length = size/8 + ((size%8)?1:0);
|
||
|
if(buffer) delete [] buffer;
|
||
|
- buffer=new byte[length];
|
||
|
+ buffer=new ::byte[length];
|
||
|
memset(buffer, 0xff, length);
|
||
|
}
|
||
|
|
||
|
@@ -529,7 +529,7 @@
|
||
|
}
|
||
|
for(i=0; i<clip; i++)
|
||
|
{
|
||
|
- byte b;
|
||
|
+ ::byte b;
|
||
|
if (style != STYLE_BPI)
|
||
|
b = bitRevTable[buffer[i]]; // Reverse bit order
|
||
|
else
|
||
|
@@ -540,7 +540,7 @@
|
||
|
case STYLE_HEX:
|
||
|
for(i=0; i<clip; i++)
|
||
|
{
|
||
|
- byte b=bitRevTable[buffer[i]]; // Reverse bit order
|
||
|
+ ::byte b=bitRevTable[buffer[i]]; // Reverse bit order
|
||
|
if ( i%16 == 0)
|
||
|
fprintf(fp,"%7d: ", i);
|
||
|
fprintf(fp,"%02x ", b);
|
||
|
@@ -553,7 +553,7 @@
|
||
|
case STYLE_HEX_RAW:
|
||
|
for(i=0; i<clip; i++)
|
||
|
{
|
||
|
- byte b=bitRevTable[buffer[i]]; // Reverse bit order
|
||
|
+ ::byte b=bitRevTable[buffer[i]]; // Reverse bit order
|
||
|
fprintf(fp,"%02x", b);
|
||
|
if ( i%4 == 3)
|
||
|
fprintf(fp,"\n");
|
||
|
@@ -569,7 +569,7 @@
|
||
|
int len = 0;
|
||
|
for(i=0; i<clip; i++)
|
||
|
{
|
||
|
- byte b = buffer[i];
|
||
|
+ ::byte b = buffer[i];
|
||
|
if (style == STYLE_MCS)
|
||
|
b = bitRevTable[b];
|
||
|
if (base != i>>16)
|
||
|
@@ -616,11 +616,11 @@
|
||
|
|
||
|
void BitFile::readField(string &field, FILE *fp)
|
||
|
{
|
||
|
- byte t[2];
|
||
|
+ ::byte t[2];
|
||
|
fread(t,1,2,fp);
|
||
|
unsigned short len=(t[0]<<8)+t[1];
|
||
|
for(int i=0; i<len; i++){
|
||
|
- byte b;
|
||
|
+ ::byte b;
|
||
|
fread(&b,1,1,fp);
|
||
|
field+=(char)b;
|
||
|
}
|
||
|
|
||
|
diff -u a/srecfile.cpp b/srecfile.cpp
|
||
|
--- a/srecfile.cpp 2017-08-16 23:18:43.000000000 +1000
|
||
|
+++ b/srecfile.cpp 2021-09-05 13:56:28.075150711 +1000
|
||
|
@@ -255,7 +255,7 @@
|
||
|
if (bufsize == 0)
|
||
|
bufsize = 1024*1024; /* Defaule size if no size given*/
|
||
|
|
||
|
- buffer = (byte*)malloc(bufsize);
|
||
|
+ buffer = (::byte*)malloc(bufsize);
|
||
|
if(!buffer)
|
||
|
{
|
||
|
fprintf(stderr, "Cannot allocate buffer\n");
|
||
|
|
||
|
Diff finished. Sun Sep 5 13:54:48 2021
|