summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/libmadplugin.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/libmadplugin.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp4
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
@@ -284,25 +284,25 @@ int LibMadPlugin::tcp_open(char *address, int port) {
284/** 284/**
285 * Read a http line header. 285 * Read a http line header.
286 * This function read character by character. 286 * This function read character by character.
287 * @param tcp_sock the socket use to read the stream 287 * @param tcp_sock the socket use to read the stream
288 * @param buf a buffer to receive the data 288 * @param buf a buffer to receive the data
289 * @param size size of the buffer 289 * @param size size of the buffer
290 * @return the size of the stream read or -1 if an error occured 290 * @return the size of the stream read or -1 if an error occured
291 */ 291 */
292int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) { 292int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) {
293 int offset = 0; 293 int offset = 0;
294 294
295 do { 295 do {
296 if (std::read(tcp_sock, buf + offset, 1) < 0) 296 if (::read(tcp_sock, buf + offset, 1) < 0)
297 return -1; 297 return -1;
298 if (buf[offset] != '\r') /* Strip \r from answer */ 298 if (buf[offset] != '\r') /* Strip \r from answer */
299 offset++; 299 offset++;
300 } while (offset < size - 1 && buf[offset - 1] != '\n'); 300 } while (offset < size - 1 && buf[offset - 1] != '\n');
301 301
302 buf[offset] = 0; 302 buf[offset] = 0;
303 return offset; 303 return offset;
304} 304}
305 305
306int LibMadPlugin::http_open(const QString& path ) { 306int LibMadPlugin::http_open(const QString& path ) {
307 char *host; 307 char *host;
308 int port; 308 int port;
@@ -376,25 +376,25 @@ int LibMadPlugin::http_open(const QString& path ) {
376 376
377 int len; 377 int len;
378 378
379 len = http_read_line(tcp_sock, http_request, sizeof(http_request)); 379 len = http_read_line(tcp_sock, http_request, sizeof(http_request));
380 380
381 if (len == -1) { 381 if (len == -1) {
382 qDebug( "http_open: "+ QString(strerror(errno)) +"\n"); 382 qDebug( "http_open: "+ QString(strerror(errno)) +"\n");
383 return 0; 383 return 0;
384 } 384 }
385 385
386 if (QString(http_request).left(9) == "Location:") { 386 if (QString(http_request).left(9) == "Location:") {
387 /* redirect */ 387 /* redirect */
388 std::close(tcp_sock); 388 ::close(tcp_sock);
389 http_request[strlen(http_request) - 1] = '\0'; 389 http_request[strlen(http_request) - 1] = '\0';
390 return http_open(&http_request[10]); 390 return http_open(&http_request[10]);
391 } 391 }
392 392
393 if (QString(http_request).left(4) == "ICY ") { 393 if (QString(http_request).left(4) == "ICY ") {
394 /* This is shoutcast/icecast streaming */ 394 /* This is shoutcast/icecast streaming */
395 if (strncmp(http_request + 4, "200 ", 4)) { 395 if (strncmp(http_request + 4, "200 ", 4)) {
396 qDebug("http_open: " + QString(http_request) + "\n"); 396 qDebug("http_open: " + QString(http_request) + "\n");
397 return 0; 397 return 0;
398 } 398 }
399 } else if (QString(http_request).left(4) == "icy-") { 399 } else if (QString(http_request).left(4) == "icy-") {
400 /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */ 400 /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */