[haiku-commits] Re: haiku: hrev46654 - src/kits/network/libnetapi

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 10 Jan 2014 15:49:15 +0100

Hi,

remarking code style and functional errors:

On 10.01.2014 15:31, pulkomandy@xxxxxxxxxxxxx wrote:
hrev46654 adds 1 changeset to branch 'master'
old head: 5143323fb69e0c6e6adae3a2e67ce0720e01af56
new head: 090ba6d06bfc7232720da1acf07c7f82f6b1b501
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=090ba6d+%5E5143323

+               while(directory.GetNextEntry(&entry) != B_ENTRY_NOT_FOUND)
+               {

Space between while and (
{ goes on previous line

+                       // We read directories using the EPFL (Easily Parsed 
List Format)
+                       // This happens to be one of the formats that WebKit 
can understand,
+                       // and it is not too hard to parse or generate.
+                       // http://tools.ietf.org/html/draft-bernstein-eplf-02
+                       BString epfl("+");
+                       if(entry.IsFile() || entry.IsSymLink()) {

Space between if and (

+                               epfl += "r,";
+                               off_t fileSize;
+                               if (entry.GetSize(&fileSize) == B_OK)
+                                       epfl << "s" << fileSize << ",";
+
+                       } else if(entry.IsDirectory())

Space after if

+                               epfl += "/,";
+
+                       time_t modification;
+                       if (entry.GetModificationTime(&modification) == B_OK)
+                               epfl << "m" << modification << ",";
+
+                       entry.GetName(name);
+                       epfl << "\t" << name << "\r\n";
+                       fListener->DataReceived(this, epfl.String(), 
epfl.Length());

Accessing fListener when it could be NULL according to checks in the same method.

+                       size += epfl.Length();
+               }
+
                fListener->DownloadProgress(this, size, size);
                fResult.SetLength(size);

Not a new mistake, but again, accessing fListener when it is assumed to be possibly NULL elsewhere.

Best regards,
-Stephan


Other related posts: