FileRequest: style fixes

Pointed out by axeld, stippi and waddlesplash. Thanks for watching.
This commit is contained in:
Adrien Destugues
2014-01-13 08:05:30 +01:00
parent a6c0fea79c
commit 5e9a96156d
+7 -7
View File
@@ -7,7 +7,6 @@
*/ */
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <Directory.h> #include <Directory.h>
@@ -84,20 +83,19 @@ BFileRequest::_ProtocolLoop()
int size = 0; int size = 0;
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
BEntry entry; BEntry entry;
while(directory.GetNextEntry(&entry) != B_ENTRY_NOT_FOUND) while (directory.GetNextEntry(&entry) != B_ENTRY_NOT_FOUND) {
{
// We read directories using the EPFL (Easily Parsed List Format) // We read directories using the EPFL (Easily Parsed List Format)
// This happens to be one of the formats that WebKit can understand, // This happens to be one of the formats that WebKit can understand,
// and it is not too hard to parse or generate. // and it is not too hard to parse or generate.
// http://tools.ietf.org/html/draft-bernstein-eplf-02 // http://tools.ietf.org/html/draft-bernstein-eplf-02
BString epfl("+"); BString epfl("+");
if(entry.IsFile() || entry.IsSymLink()) { if (entry.IsFile() || entry.IsSymLink()) {
epfl += "r,"; epfl += "r,";
off_t fileSize; off_t fileSize;
if (entry.GetSize(&fileSize) == B_OK) if (entry.GetSize(&fileSize) == B_OK)
epfl << "s" << fileSize << ","; epfl << "s" << fileSize << ",";
} else if(entry.IsDirectory()) } else if (entry.IsDirectory())
epfl += "/,"; epfl += "/,";
time_t modification; time_t modification;
@@ -106,11 +104,13 @@ BFileRequest::_ProtocolLoop()
entry.GetName(name); entry.GetName(name);
epfl << "\t" << name << "\r\n"; epfl << "\t" << name << "\r\n";
fListener->DataReceived(this, epfl.String(), epfl.Length()); if (fListener != NULL)
fListener->DataReceived(this, epfl.String(), epfl.Length());
size += epfl.Length(); size += epfl.Length();
} }
fListener->DownloadProgress(this, size, size); if (fListener != NULL)
fListener->DownloadProgress(this, size, size);
fResult.SetLength(size); fResult.SetLength(size);
return B_PROT_SUCCESS; return B_PROT_SUCCESS;