clang-format

This commit is contained in:
Shaun Reed 2024-01-24 23:25:14 -05:00
parent d6b17cdf87
commit 1c6a3ffcc7
1 changed files with 10 additions and 11 deletions

View File

@ -18,20 +18,21 @@ QtkIOStream::QtkIOStream(const char * pFile, const char * pMode) :
mFile(pFile) { mFile(pFile) {
QString mode(pMode); QString mode(pMode);
bool open = false; bool open = false;
if (mode == "w" || mode == "wb") { if(mode == "w" || mode == "wb") {
open = mFile.open(QIODeviceBase::WriteOnly); open = mFile.open(QIODeviceBase::WriteOnly);
} else if (mode == "r" || mode == "rb") { } else if(mode == "r" || mode == "rb") {
open = mFile.open(QIODeviceBase::ReadOnly); open = mFile.open(QIODeviceBase::ReadOnly);
} else if (mode == "wt") { } else if(mode == "wt") {
open = mFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Text); open = mFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Text);
} else if (mode == "rt") { } else if(mode == "rt") {
open = mFile.open(QIODeviceBase::ReadOnly | QIODeviceBase::Text); open = mFile.open(QIODeviceBase::ReadOnly | QIODeviceBase::Text);
} else { } else {
open = false; open = false;
qDebug() << "[Qtk::QtkIOStream] Invalid file open mode: " << mode << "\n"; qDebug() << "[Qtk::QtkIOStream] Invalid file open mode: " << mode << "\n";
} }
if(!open) { if(!open) {
qDebug() << "[Qtk::QtkIOStream] Could not open file: " << QString(pFile) << "\n"; qDebug() << "[Qtk::QtkIOStream] Could not open file: " << QString(pFile)
<< "\n";
} }
} }
@ -40,7 +41,7 @@ QtkIOStream::QtkIOStream(const char * pFile, const char * pMode) :
******************************************************************************/ ******************************************************************************/
size_t QtkIOStream::Read(void * pvBuffer, size_t pSize, size_t pCount) { size_t QtkIOStream::Read(void * pvBuffer, size_t pSize, size_t pCount) {
qint64 readSize = mFile.read((char*)pvBuffer, pSize * pCount); qint64 readSize = mFile.read((char *)pvBuffer, pSize * pCount);
if(readSize < 0) { if(readSize < 0) {
qDebug() << "[Qtk::QtkIOStream] Failed to read (" << pSize qDebug() << "[Qtk::QtkIOStream] Failed to read (" << pSize
<< ") bytes from file at: " << mFile.filesystemFileName().c_str() << ") bytes from file at: " << mFile.filesystemFileName().c_str()
@ -51,12 +52,10 @@ size_t QtkIOStream::Read(void * pvBuffer, size_t pSize, size_t pCount) {
} }
size_t QtkIOStream::Write(const void * pvBuffer, size_t pSize, size_t pCount) { size_t QtkIOStream::Write(const void * pvBuffer, size_t pSize, size_t pCount) {
qint64 writeSize = mFile.write((char*)pvBuffer, pSize * pCount); qint64 writeSize = mFile.write((char *)pvBuffer, pSize * pCount);
if(writeSize < 0) { if(writeSize < 0) {
qDebug() << "[Qtk::QtkIOStream] Failed to write buffer with size (" qDebug() << "[Qtk::QtkIOStream] Failed to write buffer with size (" << pSize
<< pSize << ") to file at: " << mFile.filesystemFileName().c_str() << "\n";
<< ") to file at: " << mFile.filesystemFileName().c_str()
<< "\n";
return -1; return -1;
} }
return writeSize; return writeSize;