]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/http.c
Cosmetics
[ffmpeg] / libavformat / http.c
index 6a509dc6aa2187561f63b8095fe221f6e97630e9..5bfd7368852d51b71f7e136b23bdd43ccfafb29e 100644 (file)
@@ -23,6 +23,7 @@
 #include "network.h"
 
 #include "base64.h"
+#include "avstring.h"
 
 /* XXX: POST protocol is not completely implemented because ffmpeg uses
    only a subset of it. */
@@ -62,7 +63,7 @@ static int http_open_cnx(URLContext *h)
 
     proxy_path = getenv("http_proxy");
     use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
-        strstart(proxy_path, "http://", NULL);
+        av_strstart(proxy_path, "http://", NULL);
 
     /* fill the dest addr */
  redo:
@@ -72,7 +73,7 @@ static int http_open_cnx(URLContext *h)
     if (port > 0) {
         snprintf(hoststr, sizeof(hoststr), "%s:%d", hostname, port);
     } else {
-        pstrcpy(hoststr, sizeof(hoststr), hostname);
+        av_strlcpy(hoststr, hostname, sizeof(hoststr));
     }
 
     if (use_proxy) {
@@ -100,7 +101,7 @@ static int http_open_cnx(URLContext *h)
         /* url moved, get next */
         url_close(hd);
         if (redirects++ >= MAX_REDIRECTS)
-            return AVERROR_IO;
+            return AVERROR(EIO);
         location_changed = 0;
         goto redo;
     }
@@ -108,7 +109,7 @@ static int http_open_cnx(URLContext *h)
  fail:
     if (hd)
         url_close(hd);
-    return AVERROR_IO;
+    return AVERROR(EIO);
 }
 
 static int http_open(URLContext *h, const char *uri, int flags)
@@ -125,7 +126,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
     h->priv_data = s;
     s->filesize = -1;
     s->off = 0;
-    pstrcpy (s->location, URL_SIZE, uri);
+    av_strlcpy(s->location, uri, URL_SIZE);
 
     ret = http_open_cnx(h);
     if (ret != 0)
@@ -138,7 +139,7 @@ static int http_getc(HTTPContext *s)
     if (s->buf_ptr >= s->buf_end) {
         len = url_read(s->hd, s->buffer, BUFFER_SIZE);
         if (len < 0) {
-            return AVERROR_IO;
+            return AVERROR(EIO);
         } else if (len == 0) {
             return -1;
         } else {
@@ -236,7 +237,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
 
     av_freep(&auth_b64);
     if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
-        return AVERROR_IO;
+        return AVERROR(EIO);
 
     /* init input buffer */
     s->buf_ptr = s->buffer;
@@ -254,7 +255,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
     for(;;) {
         ch = http_getc(s);
         if (ch < 0)
-            return AVERROR_IO;
+            return AVERROR(EIO);
         if (ch == '\n') {
             /* process line */
             if (q > line && q[-1] == '\r')