From 77735fc932340b3321d3f0dc53cf8b9f0958e44f Mon Sep 17 00:00:00 2001 From: tihmstar Date: Wed, 4 Jan 2017 15:38:34 +0100 Subject: [PATCH] changed fopen to "rb" instead of "r". should fix load sep failed bug --- futurerestore/futurerestore.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index 7949a8b8..00c8a019 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -681,7 +681,7 @@ void futurerestore::setBasebandManifestPath(const char *basebandManifestPath){ }; void futurerestore::loadSep(const char *sepPath){ - FILE *fsep = fopen(sepPath, "r"); + FILE *fsep = fopen(sepPath, "rb"); if (!fsep) reterror(-15, "failed to read SEP\n"); @@ -693,21 +693,15 @@ void futurerestore::loadSep(const char *sepPath){ reterror(-15, "failed to malloc memory for SEP\n"); size_t freadRet=0; - //workaroung for windows bug!?!? - do { - size_t cread = fread(_client->sepfwdata, 1, _client->sepfwdatasize, fsep); - if (!cread) - reterror(-15, "failed to load SEP. _client->sepfwdatasize=%zu but fread returned=%zu\n",_client->sepfwdatasize,freadRet); - freadRet += cread; - printf("reading sep %zu of %zu bytes",freadRet,_client->sepfwdatasize); - } while (freadRet < _client->sepfwdatasize); + if ((freadRet = fread(_client->sepfwdata, 1, _client->sepfwdatasize, fsep)) != _client->sepfwdatasize) + reterror(-15, "failed to load SEP. size=%zu but fread returned %zu\n",_client->sepfwdatasize,freadRet); fclose(fsep); } void futurerestore::setBasebandPath(const char *basebandPath){ - FILE *fbb = fopen(basebandPath, "r"); + FILE *fbb = fopen(basebandPath, "rb"); if (!fbb) reterror(-15, "failed to read Baseband"); _basebandPath = basebandPath;