mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-25 23:25:40 +00:00
Whitespace, cstdint types
This commit is contained in:
parent
9c2aff72c8
commit
c7ad13fb31
|
@ -49,14 +49,14 @@ unsigned CBlockFile::ReadBytes(void *data, unsigned numBytes)
|
|||
{
|
||||
if (NULL == fp)
|
||||
return 0;
|
||||
return fread(data, sizeof(UINT8), numBytes, fp);
|
||||
return fread(data, sizeof(uint8_t), numBytes, fp);
|
||||
}
|
||||
|
||||
unsigned CBlockFile::ReadDWord(UINT32 *data)
|
||||
unsigned CBlockFile::ReadDWord(uint32_t *data)
|
||||
{
|
||||
if (NULL == fp)
|
||||
return 0;
|
||||
fread(data, sizeof(UINT32), 1, fp);
|
||||
fread(data, sizeof(uint32_t), 1, fp);
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
@ -70,23 +70,23 @@ void CBlockFile::UpdateBlockSize(void)
|
|||
curPos = ftell(fp); // save current file position
|
||||
fseek(fp, blockStartPos, SEEK_SET);
|
||||
newBlockSize = curPos - blockStartPos;
|
||||
fwrite(&newBlockSize, sizeof(UINT32), 1, fp);
|
||||
fwrite(&newBlockSize, sizeof(uint32_t), 1, fp);
|
||||
fseek(fp, curPos, SEEK_SET); // go back
|
||||
}
|
||||
|
||||
void CBlockFile::WriteByte(UINT8 data)
|
||||
void CBlockFile::WriteByte(uint8_t data)
|
||||
{
|
||||
if (NULL == fp)
|
||||
return;
|
||||
fwrite(&data, sizeof(UINT8), 1, fp);
|
||||
fwrite(&data, sizeof(uint8_t), 1, fp);
|
||||
UpdateBlockSize();
|
||||
}
|
||||
|
||||
void CBlockFile::WriteDWord(UINT32 data)
|
||||
void CBlockFile::WriteDWord(uint32_t data)
|
||||
{
|
||||
if (NULL == fp)
|
||||
return;
|
||||
fwrite(&data, sizeof(UINT32), 1, fp);
|
||||
fwrite(&data, sizeof(uint32_t), 1, fp);
|
||||
UpdateBlockSize();
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void CBlockFile::WriteBytes(const void *data, unsigned numBytes)
|
|||
{
|
||||
if (NULL == fp)
|
||||
return;
|
||||
fwrite(data, sizeof(UINT8), numBytes, fp);
|
||||
fwrite(data, sizeof(uint8_t), numBytes, fp);
|
||||
UpdateBlockSize();
|
||||
}
|
||||
|
||||
|
@ -142,10 +142,10 @@ void CBlockFile::WriteBlockHeader(const char *name, const char *comment)
|
|||
|
||||
Block Format
|
||||
------------
|
||||
blockLength (UINT32) Total length of block in bytes.
|
||||
nameLength (UINT32) Length of name field including terminating 0 (up to
|
||||
blockLength (uint32_t) Total length of block in bytes.
|
||||
nameLength (uint32_t) Length of name field including terminating 0 (up to
|
||||
1025).
|
||||
commentLength (UINT32) Same as above, but for comment string.
|
||||
commentLength (uint32_t) Same as above, but for comment string.
|
||||
name ... Name string (null-terminated, up to 1025 bytes).
|
||||
comment ... Comment string (same as above).
|
||||
data ... Raw data (blockLength - total header size).
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#ifndef INCLUDED_BLOCKFILE_H
|
||||
#define INCLUDED_BLOCKFILE_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/*
|
||||
* CBlockFile:
|
||||
|
@ -150,10 +151,10 @@ private:
|
|||
// Helper functions
|
||||
void ReadString(char *str, unsigned strLen, unsigned maxLen);
|
||||
unsigned ReadBytes(void *data, unsigned numBytes);
|
||||
unsigned ReadDWord(UINT32 *data);
|
||||
unsigned ReadDWord(uint32_t *data);
|
||||
void UpdateBlockSize(void);
|
||||
void WriteByte(UINT8 data);
|
||||
void WriteDWord(UINT32 data);
|
||||
void WriteByte(uint8_t data);
|
||||
void WriteDWord(uint32_t data);
|
||||
void WriteBytes(const void *data, unsigned numBytes);
|
||||
void WriteBlockHeader(const char *name, const char *comment);
|
||||
|
||||
|
|
Loading…
Reference in a new issue