[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Can't use read() in class derived from KIO::SlaveBase
From:       Philipp Schmidt <philschmidt () gmx ! net>
Date:       2012-01-16 9:33:28
Message-ID: 2329217.ikStgBkYnT () sam
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

while implementing the get() method of my MTP Kio-Slave I ran into the problem 
that SlaveBase implements a read() function itself, therefore the compiler 
tells me there is no candidate for read(int fd, void* buffer, int length)

[...]/kio_mtp.cpp:160:50: error: no matching function for call to 
‘MTPSlave::read(int&, char [2048], int)'
candidate is: virtual void KIO::SlaveBase::read(KIO::filesize_t)

Since the only way to sanely get the data of the file on the MTP-device for a 
KIO-Slave is to get a filedescriptor and read from it (the other ways would be 
to directly copy the file: not possible since we don't know the target OR to 
have a callback function that does something with the data that it receives) I 
need to be able to call the read()-function from unistd.h.

So how would I do that?

Philipp
[Attachment #5 (unknown)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" \
content="1" /><style type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:9pt; \
font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">Hi,</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; ">&nbsp;</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">while implementing the get() method of my MTP Kio-Slave I ran into \
the problem that SlaveBase implements a read() function itself, therefore the \
compiler tells me there is no candidate for read(int fd, void* buffer, int \
length)</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">[...]/kio_mtp.cpp:160:50: \
error: no matching function for call to ‘MTPSlave::read(int&amp;, char [2048], \
int)'</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">candidate \
is: virtual void KIO::SlaveBase::read(KIO::filesize_t)</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Since the only way to sanely \
get the data of the file on the MTP-device for a KIO-Slave is to get a filedescriptor \
and read from it (the other ways would be to directly copy the file: not possible \
since we don't know the target OR to have a callback function that does something \
with the data that it receives) I need to be able to call the read()-function from \
unistd.h.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">So how would I do that?</p> \
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Philipp</p></body></html>



>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic