BPackageInfo::ReadFromConfigFile() BFile& version

This commit is contained in:
Ingo Weinhold 2011-07-01 01:37:48 +02:00
parent 5b486787aa
commit bfbb410d1a
2 changed files with 15 additions and 2 deletions

View File

@ -18,6 +18,7 @@
class BEntry;
class BFile;
namespace BPackageKit {
@ -44,6 +45,9 @@ public:
status_t ReadFromConfigFile(
const BEntry& packageInfoEntry,
ParseErrorListener* listener = NULL);
status_t ReadFromConfigFile(
BFile& packageInfoFile,
ParseErrorListener* listener = NULL);
status_t ReadFromConfigString(
const BString& packageInfoString,
ParseErrorListener* listener = NULL);

View File

@ -849,8 +849,17 @@ BPackageInfo::ReadFromConfigFile(const BEntry& packageInfoEntry,
if ((result = file.InitCheck()) != B_OK)
return result;
return ReadFromConfigFile(file, listener);
}
status_t
BPackageInfo::ReadFromConfigFile(BFile& packageInfoFile,
ParseErrorListener* listener)
{
off_t size;
if ((result = file.GetSize(&size)) != B_OK)
status_t result = packageInfoFile.GetSize(&size);
if (result != B_OK)
return result;
BString packageInfoString;
@ -858,7 +867,7 @@ BPackageInfo::ReadFromConfigFile(const BEntry& packageInfoEntry,
if (buffer == NULL)
return B_NO_MEMORY;
if ((result = file.Read(buffer, size)) < size) {
if ((result = packageInfoFile.Read(buffer, size)) < size) {
packageInfoString.UnlockBuffer(0);
return result >= 0 ? B_IO_ERROR : result;
}