Skip to content

Commit

Permalink
Let scaninc ignore empty C files
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Oct 11, 2024
1 parent 2c7964d commit b6892f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/scaninc/c_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ CFile::CFile(std::string path)

m_size = std::ftell(fp);

if (m_size < 0)
FATAL_ERROR("File size of \"%s\" is less than zero.\n", path.c_str());
else if (m_size == 0)
return; // Empty file

m_buffer = new char[m_size + 1];
m_buffer[m_size] = 0;

Expand All @@ -49,7 +54,7 @@ CFile::CFile(std::string path)

CFile::~CFile()
{
delete[] m_buffer;
if (m_size > 0) delete[] m_buffer;
}

void CFile::FindIncbins()
Expand Down

0 comments on commit b6892f5

Please sign in to comment.