Merge pull request #33 from fesiqueira/fix/fix_fpos_t

Fix compilation error caused by fpos_t struct
pull/51/head
steenerson 2019-12-10 19:00:00 -08:00 committed by GitHub
commit f9aefe0b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View File

@ -294,7 +294,7 @@ bool SdBaseFile::getFilename(char* name) {
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SdBaseFile::getpos(fpos_t* pos) { void SdBaseFile::getpos(filepos_t* pos) {
pos->position = curPosition_; pos->position = curPosition_;
pos->cluster = curCluster_; pos->cluster = curCluster_;
} }
@ -925,7 +925,7 @@ bool SdBaseFile::openRoot(SdVolume* vol) {
* \return The byte if no error and not at eof else -1; * \return The byte if no error and not at eof else -1;
*/ */
int SdBaseFile::peek() { int SdBaseFile::peek() {
fpos_t pos; filepos_t pos;
getpos(&pos); getpos(&pos);
int c = read(); int c = read();
if (c >= 0) setpos(&pos); if (c >= 0) setpos(&pos);
@ -1492,7 +1492,7 @@ bool SdBaseFile::seekSet(uint32_t pos) {
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SdBaseFile::setpos(fpos_t* pos) { void SdBaseFile::setpos(filepos_t* pos) {
curPosition_ = pos->position; curPosition_ = pos->position;
curCluster_ = pos->cluster; curCluster_ = pos->cluster;
} }

View File

@ -31,16 +31,16 @@
#include "SdVolume.h" #include "SdVolume.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* \struct fpos_t * \struct filepos_t
* \brief internal type for istream * \brief internal type for istream
* do not use in user apps * do not use in user apps
*/ */
struct fpos_t { struct filepos_t {
/** stream position */ /** stream position */
uint32_t position; uint32_t position;
/** cluster for position */ /** cluster for position */
uint32_t cluster; uint32_t cluster;
fpos_t() : position(0), cluster(0) {} filepos_t() : position(0), cluster(0) {}
}; };
// use the gnu style oflag in open() // use the gnu style oflag in open()
@ -196,11 +196,11 @@ class SdBaseFile {
/** get position for streams /** get position for streams
* \param[out] pos struct to receive position * \param[out] pos struct to receive position
*/ */
void getpos(fpos_t* pos); void getpos(filepos_t* pos);
/** set position for streams /** set position for streams
* \param[out] pos struct with value for new position * \param[out] pos struct with value for new position
*/ */
void setpos(fpos_t* pos); void setpos(filepos_t* pos);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool close(); bool close();
bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock); bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock);

View File

@ -294,7 +294,7 @@ bool SdBaseFile::getFilename(char* name) {
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SdBaseFile::getpos(fpos_t* pos) { void SdBaseFile::getpos(filepos_t* pos) {
pos->position = curPosition_; pos->position = curPosition_;
pos->cluster = curCluster_; pos->cluster = curCluster_;
} }
@ -925,7 +925,7 @@ bool SdBaseFile::openRoot(SdVolume* vol) {
* \return The byte if no error and not at eof else -1; * \return The byte if no error and not at eof else -1;
*/ */
int SdBaseFile::peek() { int SdBaseFile::peek() {
fpos_t pos; filepos_t pos;
getpos(&pos); getpos(&pos);
int c = read(); int c = read();
if (c >= 0) setpos(&pos); if (c >= 0) setpos(&pos);
@ -1492,7 +1492,7 @@ bool SdBaseFile::seekSet(uint32_t pos) {
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SdBaseFile::setpos(fpos_t* pos) { void SdBaseFile::setpos(filepos_t* pos) {
curPosition_ = pos->position; curPosition_ = pos->position;
curCluster_ = pos->cluster; curCluster_ = pos->cluster;
} }

View File

@ -31,16 +31,16 @@
#include "SdVolume.h" #include "SdVolume.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* \struct fpos_t * \struct filepos_t
* \brief internal type for istream * \brief internal type for istream
* do not use in user apps * do not use in user apps
*/ */
struct fpos_t { struct filepos_t {
/** stream position */ /** stream position */
uint32_t position; uint32_t position;
/** cluster for position */ /** cluster for position */
uint32_t cluster; uint32_t cluster;
fpos_t() : position(0), cluster(0) {} filepos_t() : position(0), cluster(0) {}
}; };
// use the gnu style oflag in open() // use the gnu style oflag in open()
@ -196,11 +196,11 @@ class SdBaseFile {
/** get position for streams /** get position for streams
* \param[out] pos struct to receive position * \param[out] pos struct to receive position
*/ */
void getpos(fpos_t* pos); void getpos(filepos_t* pos);
/** set position for streams /** set position for streams
* \param[out] pos struct with value for new position * \param[out] pos struct with value for new position
*/ */
void setpos(fpos_t* pos); void setpos(filepos_t* pos);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool close(); bool close();
bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock); bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock);