Skip to content

Commit 77ebbd4

Browse files
committed
Use correct type for BB offset
1 parent 49783ae commit 77ebbd4

File tree

8 files changed

+38
-6
lines changed

8 files changed

+38
-6
lines changed

qt/chip_db.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ int ChipDb::setSpareSize(int chipIndex, uint32_t spareSize)
100100
return 0;
101101
}
102102

103-
uint32_t ChipDb::getBBMarkOffset(int chipIndex)
103+
uint8_t ChipDb::getBBMarkOffset(int chipIndex)
104104
{
105105
ChipInfo *ci = getChipInfo(chipIndex);
106106

107107
return ci ? ci->bbMarkOffset : 0;
108108
}
109109

110-
int ChipDb::setBBMarkOffset(int chipIndex, uint32_t bbMarkOffset)
110+
int ChipDb::setBBMarkOffset(int chipIndex, uint8_t bbMarkOffset)
111111
{
112112
ChipInfo *ci = getChipInfo(chipIndex);
113113

qt/chip_db.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class ChipDb
3131
int setTotalSize(int chipIndex, uint32_t totalSize);
3232
uint32_t getSpareSize(int chipIndex);
3333
int setSpareSize(int chipIndex, uint32_t spareSize);
34-
uint32_t getBBMarkOffset(int chipIndex);
35-
int setBBMarkOffset(int chipIndex, uint32_t bbMarkOffset);
34+
uint8_t getBBMarkOffset(int chipIndex);
35+
int setBBMarkOffset(int chipIndex, uint8_t bbMarkOffset);
3636
};
3737

3838
#endif // CHIP_DB_H

qt/chip_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ChipInfo
6868
uint32_t blockSize;
6969
uint32_t totalSize;
7070
uint32_t spareSize;
71-
uint32_t bbMarkOffset;
71+
uint8_t bbMarkOffset;
7272
uint32_t params[CHIP_PARAM_NUM];
7373
uint32_t hal;
7474

qt/parallel_chip_db.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ int ParallelChipDb::getParamFromString(const QString &value, uint32_t &param)
4545
return 0;
4646
}
4747

48+
int ParallelChipDb::getParamFromString(const QString &value, uint8_t &param)
49+
{
50+
uint32_t temp;
51+
52+
if (getParamFromString(value, temp))
53+
return -1;
54+
55+
if (temp > UINT8_MAX)
56+
return -1;
57+
58+
param = temp;
59+
60+
return 0;
61+
}
62+
4863
int ParallelChipDb::getParamFromHexString(const QString &value, uint32_t &param)
4964
{
5065
bool ok;

qt/parallel_chip_db.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class ParallelChipDb : public ChipDb
5050
void commit();
5151
void reset();
5252
int getParamFromString(const QString &value, uint32_t &param);
53+
int getParamFromString(const QString &value, uint8_t &param);
5354
int getParamFromHexString(const QString &value, uint32_t &param);
5455
int getStringFromParam(const uint32_t &param, QString &value);
5556
int getHexStringFromParam(const uint32_t &param, QString &value);

qt/programmer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void Programmer::confChip(ChipInfo *chipInfo)
305305
confCmd.blockSize = chipInfo->blockSize;
306306
confCmd.totalSize = chipInfo->totalSize;
307307
confCmd.spareSize = chipInfo->spareSize;
308-
confCmd.bbMarkOff = static_cast<uint8_t>(chipInfo->bbMarkOffset);
308+
confCmd.bbMarkOff = chipInfo->bbMarkOffset;
309309

310310
QObject::connect(&reader, SIGNAL(result(int)), this,
311311
SLOT(confChipCb(int)));

qt/spi_chip_db.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ int SpiChipDb::getParamFromString(const QString &value, uint32_t &param)
4545
return 0;
4646
}
4747

48+
int SpiChipDb::getParamFromString(const QString &value, uint8_t &param)
49+
{
50+
uint32_t temp;
51+
52+
if (getParamFromString(value, temp))
53+
return -1;
54+
55+
if (temp > UINT8_MAX)
56+
return -1;
57+
58+
param = temp;
59+
60+
return 0;
61+
}
62+
4863
int SpiChipDb::getParamFromHexString(const QString &value, uint32_t &param)
4964
{
5065
bool ok;

qt/spi_chip_db.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class SpiChipDb : public ChipDb
5050
void commit();
5151
void reset();
5252
int getParamFromString(const QString &value, uint32_t &param);
53+
int getParamFromString(const QString &value, uint8_t &param);
5354
int getParamFromHexString(const QString &value, uint32_t &param);
5455
int getStringFromParam(const uint32_t &param, QString &value);
5556
int getHexStringFromParam(const uint32_t &param, QString &value);

0 commit comments

Comments
 (0)