Changeset 63308 in webkit


Ignore:
Timestamp:
Jul 14, 2010 4:15:05 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-14 Joone Hur <joone@kldp.org>

Reviewed by Jian Li.

[GTK] Enabling File Reader/Writer APIs
https://bugs.webkit.org/show_bug.cgi?id=40209

The layout test fast/files will be enabled after eventSender.beginDragWithFiles is implemented for GTK.

  • platform/gtk/FileSystemGtk.cpp: (WebCore::openFile): Added. (WebCore::readFromFile): Added.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63307 r63308  
     12010-07-14  Joone Hur  <joone@kldp.org>
     2
     3        Reviewed by Jian Li.
     4
     5        [GTK] Enabling File Reader/Writer APIs
     6        https://bugs.webkit.org/show_bug.cgi?id=40209
     7
     8        The layout test fast/files will be enabled after eventSender.beginDragWithFiles is implemented for GTK.
     9
     10        * platform/gtk/FileSystemGtk.cpp:
     11        (WebCore::openFile): Added.
     12        (WebCore::readFromFile): Added.
     13
    1142010-07-14  Nikolas Zimmermann  <nzimmermann@rim.com>
    215
  • trunk/WebCore/platform/gtk/FileSystemGtk.cpp

    r61077 r63308  
    2525#include "GOwnPtr.h"
    2626#include "PlatformString.h"
    27 #include <wtf/text/CString.h>
    28 
     27
     28#include <errno.h>
     29#include <fcntl.h>
    2930#include <glib.h>
    3031#include <glib/gstdio.h>
    31 
    3232#include <unistd.h>
     33#include <wtf/text/CString.h>
    3334
    3435namespace WebCore {
     
    234235}
    235236
     237PlatformFileHandle openFile(const String& path, FileOpenMode mode)
     238{
     239    CString fsRep = fileSystemRepresentation(path);
     240
     241    if (fsRep.isNull())
     242        return invalidPlatformFileHandle;
     243
     244    int platformFlag = 0;
     245    if (mode == OpenForRead)
     246        platformFlag |= O_RDONLY;
     247    else if (mode == OpenForWrite)
     248        platformFlag |= (O_WRONLY | O_CREAT | O_TRUNC);
     249
     250    return g_open(fsRep.data(), platformFlag, 0666);
     251}
     252
    236253void closeFile(PlatformFileHandle& handle)
    237254{
     
    256273}
    257274
     275int readFromFile(PlatformFileHandle handle, char* data, int length)
     276{
     277    do {
     278        int bytesRead = read(handle, data, static_cast<size_t>(length));
     279        if (bytesRead >= 0)
     280            return bytesRead;
     281    } while (errno == EINTR);
     282
     283    return -1;
     284}
     285
    258286bool unloadModule(PlatformModule module)
    259287{
Note: See TracChangeset for help on using the changeset viewer.