[Webkit-unassigned] [Bug 79194] [EFL] Build warning: Fix warn_unused_result warnings

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 5 21:00:26 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=79194





--- Comment #4 from Byungwoo Lee <bw80.lee at samsung.com>  2012-03-05 21:00:26 PST ---

Thanks for your comment.

> How about
> 
>   const size_t freadResult = fread(...);
>   fclose(file);
> 
>   const bool readSuccessful = (freadResult == static_cast<size_t>(fileStat.st_size));
> 
>   return readSucessful ? result.relase() : 0;
This looks better for me also, and I think 'readSuccessful' is redundant.
How about the below?

-    fread(result->m_buffer.data(), 1, fileStat.st_size, file);
+    const size_t bytesRead = fread(result->m_buffer.data(), 1, fileStat.st_size, file);
     fclose(file);

-    return result.release();
+    return bytesRead == static_cast<unsigned>(fileStat.st_size) ? result.release() : 0;




> > Tools/DumpRenderTree/efl/ImageDiff.cpp:218
> > +                } while ((bytesWritten += count) < bytesRead);
> 
> Personally, I find (bytesWritten += count) here weird to read (no pun intended :-). How about moving the increase operation inside the do-while loop?
Ok~ I'll fix as below
+                    bytesWritten += count;
+                } while (bytesWritten < bytesRead);

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list