~ubuntu-branches/ubuntu/vivid/mediatomb/vivid

« back to all changes in this revision

Viewing changes to src/file_io_handler.cc

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2008-03-02 13:09:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080302130916-zlljdze3kt7vuq4b
Tags: 0.11.0-1
* New upstream release.
* Include message about which inotify headers will be used when enabling
  inotify runtime support.
* Fixed error with use of INTERFACE in init script. Also removed use of -m
  option.
* Including new config.xml options.
* Added more build dependencies for new upstream release.
* Removed build dependency of libid3-dev, taglib is now preferred.
* mediatomb.xpm and manpage.xml is now included in orig tarball.
* inotify patch is not needed anymore.
* md5 patch has been committed upstream and is no longer needed. Also removed
  README.Debian.
* TwinHelix PNG fix is now used. Removed from TODO.
* Adding dependency of iceweasel for mediatomb package.
* Updated copyright file.
* Updated watch file.
* Updated rules file for proper configure options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
    Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
                       Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
9
9
    
10
 
    Copyright (C) 2006-2007 Gena Batyan <bgeradz@mediatomb.cc>,
 
10
    Copyright (C) 2006-2008 Gena Batyan <bgeradz@mediatomb.cc>,
11
11
                            Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
12
                            Leonhard Wimmer <leo@mediatomb.cc>
13
13
    
24
24
    version 2 along with MediaTomb; if not, write to the Free Software
25
25
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
26
26
    
27
 
    $Id: file_io_handler.cc 1294 2007-05-13 16:28:24Z lww $
 
27
    $Id: file_io_handler.cc 1698 2008-02-23 20:48:30Z lww $
28
28
*/
29
29
 
30
30
/// \file file_io_handler.cc
58
58
 
59
59
void FileIOHandler::open(IN enum UpnpOpenFileMode mode)
60
60
{
61
 
    f = fopen(filename.c_str(), "rb");
 
61
    if (mode == UPNP_READ)
 
62
    {
 
63
        f = fopen(filename.c_str(), "rb");
 
64
    }
 
65
    else if (mode == UPNP_WRITE)
 
66
    {
 
67
        f = fopen(filename.c_str(), "wb");
 
68
    }
 
69
    else
 
70
    {
 
71
        throw _Exception(_("FileIOHandler::open: invdalid read/write mode"));
 
72
    }
 
73
 
62
74
    if (f == NULL)
63
75
    {
64
76
        throw _Exception(_("FileIOHandler::open: failed to open: ") + filename.c_str());
65
77
    }
 
78
 
66
79
}
67
80
 
68
81
int FileIOHandler::read(OUT char *buf, IN size_t length)
78
91
    }
79
92
 
80
93
    return ret;
81
 
 }
82
 
                                                                                                                                                                         
 
94
}
 
95
 
 
96
int FileIOHandler::write(IN char *buf, IN size_t length)
 
97
{
 
98
    int ret = 0;
 
99
 
 
100
    ret = fwrite(buf, sizeof(char), length, f);
 
101
 
 
102
    return ret;
 
103
}
 
104
 
83
105
void FileIOHandler::seek(IN off_t offset, IN int whence)
84
106
{
85
107
    if (fseeko(f, offset, whence) != 0)
94
116
    {
95
117
        throw _Exception(_("fclose failed"));
96
118
    }
 
119
    f = NULL;
97
120
}