rename FileReader::load() -> FileReader::read()
This commit is contained in:
parent
1e140f9229
commit
b58c344604
@ -27,7 +27,7 @@ bool FileLoader::load(const char * fname)
|
|||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
if (!FileReader::load(fname, &m_buf, &size))
|
if (!FileReader::read(fname, &m_buf, &size))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
* @param[out] size Set to length of the file. If the return value is true
|
* @param[out] size Set to length of the file. If the return value is true
|
||||||
* and *size is 0, then no buffer was allocated and *buf should not be used.
|
* and *size is 0, then no buffer was allocated and *buf should not be used.
|
||||||
*
|
*
|
||||||
* @retval false The file failed to load. In this case the output parameter
|
* @retval false The file failed to read. In this case the output parameter
|
||||||
* values *buf and *size should not be used.
|
* values *buf and *size should not be used.
|
||||||
* @retval true The file was loaded successfully.
|
* @retval true The file was read successfully.
|
||||||
*/
|
*/
|
||||||
bool FileReader::load(const char * fname, uint8_t ** buf, size_t * size)
|
bool FileReader::read(const char * fname, uint8_t ** buf, size_t * size)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(fname, &st) != 0)
|
if (stat(fname, &st) != 0)
|
||||||
@ -53,7 +53,7 @@ bool FileReader::load(const char * fname, uint8_t ** buf, size_t * size)
|
|||||||
off_t n_bytes_read = 0u;
|
off_t n_bytes_read = 0u;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
off_t rd_size = read(fd, &(*buf)[n_bytes_read], st.st_size - n_bytes_read);
|
off_t rd_size = ::read(fd, &(*buf)[n_bytes_read], st.st_size - n_bytes_read);
|
||||||
if (rd_size <= 0)
|
if (rd_size <= 0)
|
||||||
break;
|
break;
|
||||||
n_bytes_read += rd_size;
|
n_bytes_read += rd_size;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
class FileReader
|
class FileReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool load(const char * fname, uint8_t ** buf, size_t * size);
|
static bool read(const char * fname, uint8_t ** buf, size_t * size);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user