mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-31 15:28:21 -04:00
Merge recent updates but without broken builder and with minor refactoring and bugfixes
This commit is contained in:
parent
b064495db8
commit
0a634ebcbd
37 changed files with 712 additions and 8665 deletions
|
@ -16,7 +16,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
#include "basetypes.h"
|
||||
#include "ustring.h"
|
||||
#include "ubytearray.h"
|
||||
#include <sys/stat.h>
|
||||
#include <fstream>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
|
@ -48,4 +50,20 @@ static inline bool changeDirectory(const UString & dir) {
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline USTATUS readFileIntoBuffer(const UString & inPath, UByteArray &buf) {
|
||||
if (!isExistOnFs(inPath))
|
||||
return U_FILE_OPEN;
|
||||
|
||||
std::ifstream inputFile(inPath.toLocal8Bit(), std::ios::in | std::ios::binary);
|
||||
if (!inputFile)
|
||||
return U_FILE_OPEN;
|
||||
std::vector<char> buffer(std::istreambuf_iterator<char>(inputFile),
|
||||
(std::istreambuf_iterator<char>()));
|
||||
inputFile.close();
|
||||
|
||||
buf = buffer;
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue