Skip to content

Commit

Permalink
Fixes a coverity scan warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Zlika committed Jul 30, 2018
1 parent 53b8d11 commit df94be5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ void LoadSap(const char *filename)
sap = sap_open(filename);
}

void UnloadK7(void)
{
if(fk7) {fclose(fk7); fk7 = NULL;}
}

void LoadK7(const char *filename)
{
UnloadK7();
if(filename[0] == '\0') return;
fk7 = fopen(filename, "rb+");
if(fk7 == NULL) return;
}

// Tape drive: read a byte
static void Readbytek7(void)
{
Expand All @@ -214,7 +227,7 @@ static void Readbytek7(void)
if(byte == EOF)
{
Initprog();
fseek(fk7, 0, SEEK_SET);
if (fseek(fk7, 0, SEEK_SET)) UnloadK7();
return;
}
A = byte; Mputc(0x2045, byte);
Expand All @@ -229,19 +242,6 @@ static void Writebytek7(void)
Mputc(0x2045, 0);
}

void UnloadK7(void)
{
if(fk7) {fclose(fk7); fk7 = NULL;}
}

void LoadK7(const char *filename)
{
UnloadK7();
if(filename[0] == '\0') return;
fk7 = fopen(filename, "rb+");
if(fk7 == NULL) return;
}

void UnloadMemo(void)
{
carflags = 0;
Expand Down

0 comments on commit df94be5

Please sign in to comment.