Title: [121254] trunk/Source/WebCore
- Revision
- 121254
- Author
- commit-qu...@webkit.org
- Date
- 2012-06-26 05:10:58 -0700 (Tue, 26 Jun 2012)
Log Message
[EFL] Simplify SharedBuffer::createWithContentsOfFile() implementation
https://bugs.webkit.org/show_bug.cgi?id=89655
Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-06-26
Reviewed by Csaba Osztrogonác.
Simplify the implementation of SharedBuffer::createWithContentsOfFile()
in EFL port.
No new test, no behavior change.
* platform/efl/SharedBufferEfl.cpp:
(WebCore::SharedBuffer::createWithContentsOfFile):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (121253 => 121254)
--- trunk/Source/WebCore/ChangeLog 2012-06-26 11:27:55 UTC (rev 121253)
+++ trunk/Source/WebCore/ChangeLog 2012-06-26 12:10:58 UTC (rev 121254)
@@ -1,3 +1,18 @@
+2012-06-26 Christophe Dumez <christophe.du...@intel.com>
+
+ [EFL] Simplify SharedBuffer::createWithContentsOfFile() implementation
+ https://bugs.webkit.org/show_bug.cgi?id=89655
+
+ Reviewed by Csaba Osztrogonác.
+
+ Simplify the implementation of SharedBuffer::createWithContentsOfFile()
+ in EFL port.
+
+ No new test, no behavior change.
+
+ * platform/efl/SharedBufferEfl.cpp:
+ (WebCore::SharedBuffer::createWithContentsOfFile):
+
2012-06-26 Thiago Marcos P. Santos <thiago.san...@intel.com>
[EFL] REGRESSION (r121163): fast/frames/iframe-access-screen-of-deleted.html crashes
Modified: trunk/Source/WebCore/platform/efl/SharedBufferEfl.cpp (121253 => 121254)
--- trunk/Source/WebCore/platform/efl/SharedBufferEfl.cpp 2012-06-26 11:27:55 UTC (rev 121253)
+++ trunk/Source/WebCore/platform/efl/SharedBufferEfl.cpp 2012-06-26 12:10:58 UTC (rev 121254)
@@ -39,32 +39,24 @@
PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath)
{
- FILE* file;
- struct stat fileStat;
- RefPtr<SharedBuffer> result;
-
if (filePath.isEmpty())
return 0;
- if (!(file = fopen(filePath.utf8().data(), "rb")))
+ FILE* file = fopen(filePath.utf8().data(), "rb");
+ if (!file)
return 0;
+ struct stat fileStat;
if (fstat(fileno(file), &fileStat)) {
fclose(file);
return 0;
}
- result = SharedBuffer::create();
- result->m_buffer.resize(fileStat.st_size);
- if (result->m_buffer.size() != static_cast<unsigned>(fileStat.st_size)) {
- fclose(file);
- return 0;
- }
-
- const size_t bytesRead = fread(result->m_buffer.data(), 1, fileStat.st_size, file);
+ Vector<char> buffer(fileStat.st_size);
+ const size_t bytesRead = fread(buffer.data(), 1, buffer.size(), file);
fclose(file);
- return bytesRead == static_cast<unsigned>(fileStat.st_size) ? result.release() : 0;
+ return (bytesRead == buffer.size()) ? SharedBuffer::adoptVector(buffer) : 0;
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes