-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 319e0ff..eda5859 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp @@ -272,49 +272,49 @@ int LibMadPlugin::tcp_open(char *address, int port) { if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *)&l, sizeof(l)) < 0) { return (0); } if (connect(sock, (struct sockaddr *)&stAddr, sizeof(stAddr)) < 0) { return (0); } return (sock); } /** * Read a http line header. * This function read character by character. * @param tcp_sock the socket use to read the stream * @param buf a buffer to receive the data * @param size size of the buffer * @return the size of the stream read or -1 if an error occured */ int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) { int offset = 0; do { - if (std::read(tcp_sock, buf + offset, 1) < 0) + if (::read(tcp_sock, buf + offset, 1) < 0) return -1; if (buf[offset] != '\r') /* Strip \r from answer */ offset++; } while (offset < size - 1 && buf[offset - 1] != '\n'); buf[offset] = 0; return offset; } int LibMadPlugin::http_open(const QString& path ) { char *host; int port; char *request; int tcp_sock; char http_request[PATH_MAX]; char filename[PATH_MAX]; //char c; char *arg =strdup(path.latin1()); /* Check for URL syntax */ if (strncmp(arg, "http://", strlen("http://"))) { return (0); } @@ -364,49 +364,49 @@ int LibMadPlugin::http_open(const QString& path ) { } while (c != '\r'); fprintf(stderr, "\n"); return (0); } #endif QString name; QString genre; QString bitrate; QString url; QString message = tr("Info: "); do { int len; len = http_read_line(tcp_sock, http_request, sizeof(http_request)); if (len == -1) { qDebug( "http_open: "+ QString(strerror(errno)) +"\n"); return 0; } if (QString(http_request).left(9) == "Location:") { /* redirect */ - std::close(tcp_sock); + ::close(tcp_sock); http_request[strlen(http_request) - 1] = '\0'; return http_open(&http_request[10]); } if (QString(http_request).left(4) == "ICY ") { /* This is shoutcast/icecast streaming */ if (strncmp(http_request + 4, "200 ", 4)) { qDebug("http_open: " + QString(http_request) + "\n"); return 0; } } else if (QString(http_request).left(4) == "icy-") { /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */ if ( QString( http_request ).left( 8 ) == "icy-name" ) { name = tr("Name: ") + QString(http_request).mid(9, (QString(http_request).length())- 9 ); } else if ( QString( http_request ).left( 9 ) == "icy-genre" ) { genre = tr("Genre: ") + QString(http_request).mid(10, (QString(http_request).length())-10 ); } else if ( QString( http_request ).left( 6 ) == "icy-br" ) { bitrate = tr("Bitrate: ") + QString(http_request).mid(7, (QString(http_request).length())- 7 ); } else if ( QString( http_request ).left( 7 ) == "icy-url" ) { url = tr("URL: ") + QString(http_request).mid(8, (QString(http_request).length())- 8 ); } else if ( QString( http_request ).left( 10 ) == "icy-notice" ) { message += QString(http_request).mid(11, QString(http_request).length()-11 ) ; } } |