~ubuntu-branches/ubuntu/oneiric/notecase/oneiric

« back to all changes in this revision

Viewing changes to src/lib/File64.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Soyez
  • Date: 2008-11-10 11:29:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20081110112957-9uu6p24w7i0c7ib2
Tags: 1.9.7-0ubuntu1
* New Upstream Release
* Updated Standards-Version to 3.8.0, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
  #include <io.h>
17
17
  #include <glib.h>
18
18
  #include <glib/gstdio.h>
19
 
 #else 
 
19
 #else
20
20
  #include <sys/types.h>
21
21
  #include <sys/stat.h>
22
22
  #include <unistd.h>
40
40
        Close();
41
41
}
42
42
 
 
43
INT64 File64::FileSize(const char *szPath)
 
44
{
 
45
        //TOFIX 64bit support
 
46
    struct stat statbuf;
 
47
        int r = stat(szPath, &statbuf);
 
48
    if (r == -1)
 
49
    {
 
50
        //dTRACE("Failed finding status of: %s\n[errno = %d]\n", full_path, errno);
 
51
        return -1;
 
52
    }
 
53
        return statbuf.st_size;
 
54
}
 
55
 
43
56
bool File64::Open(const char *szPath, unsigned long nFlags)
44
57
{
45
58
        int nOpenFlags = 0;
83
96
      errno = save_errno;
84
97
    }
85
98
  else
86
 
    {    
 
99
    {
87
100
      gchar *cp_filename = g_locale_from_utf8 (szPath, -1, NULL, NULL, NULL);
88
101
      m_nFile   = open (cp_filename, nOpenFlags, pmode);
89
102
      int save_errno = errno;
93
106
      errno = save_errno;
94
107
    }
95
108
#else
96
 
        m_nFile = open(szPath, nOpenFlags, pmode);      
 
109
        m_nFile = open(szPath, nOpenFlags, pmode);
97
110
#endif
98
111
 
99
112
        return (m_nFile != -1);
115
128
{
116
129
        ASSERT(IsOpen());
117
130
 
118
 
#ifdef _WIN32   
 
131
#ifdef _WIN32
119
132
        //::FlushFileBuffers(m_hFile);
120
133
#else
121
134
        fsync(m_nFile);