Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Cleaning and editing error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
NewEraCracker committed Dec 25, 2018
1 parent 2f6109e commit 720891e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 5 additions & 12 deletions bin2dat.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef _MSC_VER
#include <stdint.h>
#else
#define int32_t __int32
#endif

int main(int argc, char * argv[])
{
Expand All @@ -33,7 +26,7 @@ int main(int argc, char * argv[])
// Open in for reading
in = fopen(argv[1], "rb");
if (in == NULL) {
printf("Unable to open file for read: %s\n", argv[1]);
printf("ERROR: Unable to open file for read: %s\n", argv[1]);
return 1;
}

Expand All @@ -42,7 +35,7 @@ int main(int argc, char * argv[])
if (out == NULL) {
fclose(in); // Don't leak descriptors

printf("Unable to open file for write: %s\n", argv[2]);
printf("ERROR: Unable to open file for write: %s\n", argv[2]);
return 1;
}

Expand All @@ -52,10 +45,10 @@ int main(int argc, char * argv[])

do {
// Read in four byte chunks
int32_t buffer = 0;
unsigned int buffer = 0;
read = fread(&buffer, 1, sizeof(buffer), in);

// Check for EOF and incomplete chunks
// Check for EOF and invalid reads
if (!read) {
break;
} else if(read != 4) {
Expand All @@ -73,7 +66,7 @@ int main(int argc, char * argv[])
}
} while (read);

// Check for incomplete chunks
// Check for unaligned reads
if(count % 4) {
printf("WARN: Unaligned read from: %s\n", argv[1]);
fwrite("\n", 1, 1, out);
Expand Down
1 change: 0 additions & 1 deletion cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

unsigned int cpuid(unsigned int type)
{
Expand Down

0 comments on commit 720891e

Please sign in to comment.