From: Darren S. <ds...@us...> - 2006-04-08 14:44:54
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3786/src Modified Files: http.c Log Message: Minor cleanups. Index: http.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/http.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- http.c 4 Apr 2006 22:08:52 -0000 1.27 +++ http.c 8 Apr 2006 14:44:44 -0000 1.28 @@ -76,14 +76,13 @@ }; -static int http_host_connect_attempt (struct in_addr ia, int port) { - - int s; +static int http_host_connect_attempt (struct in_addr ia, int port) +{ struct sockaddr_in sin; - s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - - if (s==-1) { + int s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + if (s == -1) + { display_error (FROM_GXINE, _("HTTP error"), _("Failed to open socket: %s"), strerror (errno)); return -1; @@ -93,30 +92,29 @@ sin.sin_addr = ia; sin.sin_port = htons(port); - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 - && errno != EINPROGRESS) { + if (connect (s, (struct sockaddr *)&sin, sizeof (sin))==-1 + && errno != EINPROGRESS) + { display_error (FROM_GXINE, _("HTTP error"), _("Cannot connect to host: %s"), strerror (errno)); - close(s); + close (s); return -1; } return s; } -static int http_host_connect (const char *host, int port) { - - struct hostent *h; - int i; - int s = -1; - - h=gethostbyname(host); - if (h==NULL) { +static int http_host_connect (const char *host, int port) +{ + struct hostent *h = gethostbyname(host); + if (h==NULL) + { display_error (FROM_GXINE, _("HTTP error"), _("Unable to resolve â%sâ"), host); return -1; } + int i, s; for (i = 0, s = -1; s == -1 && h->h_addr_list[i]; ++i) { struct in_addr ia; @@ -128,12 +126,10 @@ } static int http_parse_url (char *urlbuf, char **user, char **password, - char** host, int *port, char **filename) { - char *start = NULL; - char *authcolon = NULL; - char *at = NULL; - char *portcolon = NULL; - char *slash = NULL; + char** host, int *port, char **filename) +{ + char *start, *at, *portcolon, *slash; + char *authcolon = NULL; if (user != NULL) *user = NULL; @@ -169,7 +165,8 @@ authcolon = NULL; portcolon = strchr(at, ':'); - } else + } + else portcolon = strchr(start, ':'); if (portcolon != NULL && slash != NULL && portcolon > slash) @@ -196,7 +193,7 @@ if (host != NULL) *host = start; - if (slash != 0) + if (slash != NULL) { *slash = '\0'; @@ -265,10 +262,8 @@ return 0; } -static void report_error (const char *url, const char *fmt, ...) - __attribute__ ((format (printf, 2, 3))); - -static void report_error (const char *url, const char *fmt, ...) +static void __attribute__ ((format (printf, 2, 3))) +report_error (const char *url, const char *fmt, ...) { va_list ap; char *msg; @@ -284,7 +279,7 @@ static http_t *http_open (const char *mrl) { http_t *this; - char *proxy, *request = NULL; + char *proxy, *request; int done,len,linenum; char mime_type[BUFSIZE]; |