Merge recent updates but without broken builder and with minor refactoring and bugfixes

This commit is contained in:
vit9696 2018-10-08 12:58:12 +03:00
parent b064495db8
commit 0a634ebcbd
37 changed files with 712 additions and 8665 deletions

View file

@ -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