Ticket #9268: io.diff

File io.diff, 2.4 KB (added by Lawrence Rust <lvr@…>, 9 years ago)
  • mythtv/libs/libmythtv/mythiowrapper.cpp

     
    9696        return -1;
    9797
    9898    if (S_ISDIR( fileinfo.st_mode )) // libmythdvdnav tries to open() a dir
    99         return -1;
     99        return errno = EISDIR, -1;
    100100
    101101    int fileID = -1;
    102102    if (strncmp(pathname, "myth://", 7))
     
    191191    return result;
    192192}
    193193
     194#ifdef USING_MINGW
     195#   undef  lseek
     196#   define lseek  _lseeki64
     197#   undef  off_t
     198#   define off_t off64_t
     199#endif
    194200off_t mythfile_seek(int fileID, off_t offset, int whence)
    195201{
    196202    off_t result = -1;
     
    204210    else if (m_remotefiles.contains(fileID))
    205211        result = m_remotefiles[fileID]->Seek(offset, whence);
    206212    else if (m_localfiles.contains(fileID))
    207 #ifdef USING_MINGW
    208         result = lseek64(m_localfiles[fileID], offset, whence);
    209 #else
    210213        result = lseek(m_localfiles[fileID], offset, whence);
    211 #endif
    212214    m_fileWrapperLock.unlock();
    213215
    214216    return result;
     
    226228    else if (m_remotefiles.contains(fileID))
    227229        result = m_remotefiles[fileID]->Seek(0, SEEK_CUR);
    228230    else if (m_localfiles.contains(fileID))
    229 #ifdef USING_MINGW
    230         result = lseek64(m_localfiles[fileID], 0, SEEK_CUR);
    231 #else
    232231        result = lseek(m_localfiles[fileID], 0, SEEK_CUR);
    233 #endif
    234232    m_fileWrapperLock.unlock();
    235233
    236234    return result;
    237235}
     236#ifdef USING_MINGW
     237#   undef  lseek
     238#   undef  off_t
     239#endif
    238240
    239241ssize_t mythfile_read(int fileID, void *buf, size_t count)
    240242{
  • mythtv/libs/libmythtv/mythiowrapper.h

     
    1111int     mythfile_check(int fileID);
    1212int     mythfile_open(const char *pathname, int flags);
    1313int     mythfile_close(int fileID);
     14#ifdef USING_MINGW
     15off64_t mythfile_seek(int fileID, off64_t offset, int whence);
     16off64_t mythfile_tell(int fileID);
     17#else
    1418off_t   mythfile_seek(int fileID, off_t offset, int whence);
    1519off_t   mythfile_tell(int fileID);
     20#endif
    1621ssize_t mythfile_read(int fileID, void *buf, size_t count);
    1722ssize_t mythfile_write(int fileID, void *buf, size_t count);
    1823int     mythfile_stat(const char *path, struct stat *buf);