Fix hexadecimal number formatting
This commit is contained in:
@@ -57,7 +57,7 @@ bool SdBaseFile::addCluster() {
|
||||
bool SdBaseFile::addDirCluster() {
|
||||
uint32_t block;
|
||||
// max folder size
|
||||
if (fileSize_ / sizeof(dir_t) >= 0XFFFF) goto fail;
|
||||
if (fileSize_ / sizeof(dir_t) >= 0xFFFF) goto fail;
|
||||
|
||||
if (!addCluster()) goto fail;
|
||||
if (!vol_->cacheFlush()) goto fail;
|
||||
@@ -510,7 +510,7 @@ bool SdBaseFile::mkdir(SdBaseFile* parent, const uint8_t dname[11]) {
|
||||
d.firstClusterHigh = 0;
|
||||
}
|
||||
else {
|
||||
d.firstClusterLow = parent->firstCluster_ & 0XFFFF;
|
||||
d.firstClusterLow = parent->firstCluster_ & 0xFFFF;
|
||||
d.firstClusterHigh = parent->firstCluster_ >> 16;
|
||||
}
|
||||
// copy '..' to block
|
||||
@@ -1063,7 +1063,7 @@ int16_t SdBaseFile::read(void* buf, uint16_t nbyte) {
|
||||
// amount left to read
|
||||
toRead = nbyte;
|
||||
while (toRead > 0) {
|
||||
offset = curPosition_ & 0X1FF; // offset in block
|
||||
offset = curPosition_ & 0x1FF; // offset in block
|
||||
if (type_ == FAT_FILE_TYPE_ROOT_FIXED) {
|
||||
block = vol_->rootDirStart() + (curPosition_ >> 9);
|
||||
}
|
||||
@@ -1120,7 +1120,7 @@ fail:
|
||||
int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
|
||||
int16_t n;
|
||||
// if not a directory file or miss-positioned return an error
|
||||
if (!isDir() || (0X1F & curPosition_)) return -1;
|
||||
if (!isDir() || (0x1F & curPosition_)) return -1;
|
||||
|
||||
//If we have a longFilename buffer, mark it as invalid. If we find a long filename it will be filled automaticly.
|
||||
if (longFilename != NULL) longFilename[0] = '\0';
|
||||
@@ -1513,7 +1513,7 @@ bool SdBaseFile::sync() {
|
||||
if (!isDir()) d->fileSize = fileSize_;
|
||||
|
||||
// update first cluster fields
|
||||
d->firstClusterLow = firstCluster_ & 0XFFFF;
|
||||
d->firstClusterLow = firstCluster_ & 0xFFFF;
|
||||
d->firstClusterHigh = firstCluster_ >> 16;
|
||||
|
||||
// set modify time if user supplied a callback date/time function
|
||||
@@ -1738,7 +1738,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
|
||||
|
||||
while (nToWrite > 0) {
|
||||
uint8_t blockOfCluster = vol_->blockOfCluster(curPosition_);
|
||||
uint16_t blockOffset = curPosition_ & 0X1FF;
|
||||
uint16_t blockOffset = curPosition_ & 0x1FF;
|
||||
if (blockOfCluster == 0 && blockOffset == 0) {
|
||||
// start of new cluster
|
||||
if (curCluster_ == 0) {
|
||||
@@ -1774,7 +1774,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
|
||||
// full block - don't need to use cache
|
||||
if (vol_->cacheBlockNumber() == block) {
|
||||
// invalidate cache if block is in cache
|
||||
vol_->cacheSetBlockNumber(0XFFFFFFFF, false);
|
||||
vol_->cacheSetBlockNumber(0xFFFFFFFF, false);
|
||||
}
|
||||
if (!vol_->writeBlock(block, src)) goto fail;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user