From 0f3a27b95f4efb0b541bacf2684a904787e4bab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 18 Dec 2007 22:32:15 +0100 Subject: Avoid a multiplication. --- src/input/input_http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/input/input_http.c') diff --git a/src/input/input_http.c b/src/input/input_http.c index 38658b161..c4ce7af83 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -249,7 +249,7 @@ static int http_plugin_basicauth (const char *user, const char *password, char* if (len < enclen) return -1; - tmp = malloc (sizeof(char) * (totlen + 1)); + tmp = malloc (totlen + 1); strcpy (tmp, user); strcat (tmp, ":"); if (password != NULL) -- cgit v1.2.3 From 923db0a3878ffe545084b13f23f7b2e23f66f097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 18 Dec 2007 22:32:46 +0100 Subject: Mark the enctable static. --- src/input/input_http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/input/input_http.c') diff --git a/src/input/input_http.c b/src/input/input_http.c index c4ce7af83..407e2045e 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -232,7 +232,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { } static int http_plugin_basicauth (const char *user, const char *password, char* dest, int len) { - static char *enctable="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + static const char enctable[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; char *tmp; char *sptr; char *dptr; -- cgit v1.2.3 From adae6f7ab3a15f031252fd77261f4d49fed88805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 00:57:25 +0100 Subject: Make proxyauth a variable local to http_plugin_open() function. --HG-- extra : transplant_source : %F2%15%E8%D0%BC%EE%04Xk%21U%D2%AB%968%0F%15%8A%91E --- src/input/input_http.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/input/input_http.c') diff --git a/src/input/input_http.c b/src/input/input_http.c index 407e2045e..42f64b4a8 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -80,7 +80,6 @@ typedef struct { char proxybuf[BUFSIZE]; char auth[BUFSIZE]; - char proxyauth[BUFSIZE]; char preview[MAX_PREVIEW_SIZE]; off_t preview_size; @@ -667,6 +666,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { int use_proxy; int proxyport; int mpegurl_redirect = 0; + char proxyauth[BUFSIZE]; use_proxy = this_class->proxyhost && strlen(this_class->proxyhost); @@ -674,7 +674,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (this_class->proxyuser && strlen(this_class->proxyuser)) { if (http_plugin_basicauth (this_class->proxyuser, this_class->proxypassword, - this->proxyauth, BUFSIZE)) { + proxyauth, BUFSIZE)) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "proxy error", NULL); return 0; } @@ -776,7 +776,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { buflen = strlen(this->buf); if (this_class->proxyuser && strlen(this_class->proxyuser)) { snprintf (this->buf + buflen, BUFSIZE - buflen, - "Proxy-Authorization: Basic %s\015\012", this->proxyauth); + "Proxy-Authorization: Basic %s\015\012", proxyauth); buflen = strlen(this->buf); } if (this->user && strlen(this->user)) { -- cgit v1.2.3 From 64596f317f7d03ed1f3e747cd2b0664b1d4f6535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 01:03:58 +0100 Subject: Make auth also a local variable in http_plugin_open. --- src/input/input_http.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/input/input_http.c') diff --git a/src/input/input_http.c b/src/input/input_http.c index 42f64b4a8..f2e91c226 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -79,8 +79,6 @@ typedef struct { char buf[BUFSIZE]; char proxybuf[BUFSIZE]; - char auth[BUFSIZE]; - char preview[MAX_PREVIEW_SIZE]; off_t preview_size; @@ -666,6 +664,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { int use_proxy; int proxyport; int mpegurl_redirect = 0; + char auth[BUFSIZE]; char proxyauth[BUFSIZE]; use_proxy = this_class->proxyhost && strlen(this_class->proxyhost); @@ -693,7 +692,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { this->port = DEFAULT_HTTP_PORT; if (this->user && strlen(this->user)) { - if (http_plugin_basicauth (this->user, this->password, this->auth, BUFSIZE)) { + if (http_plugin_basicauth (this->user, this->password, auth, BUFSIZE)) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "basic auth error", NULL); return -1; } @@ -781,7 +780,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { } if (this->user && strlen(this->user)) { snprintf (this->buf + buflen, BUFSIZE - buflen, - "Authorization: Basic %s\015\012", this->auth); + "Authorization: Basic %s\015\012", auth); buflen = strlen(this->buf); } -- cgit v1.2.3