libsoup r1222 - in trunk: . libsoup tests
- From: danw svn gnome org
- To: svn-commits-list gnome org
- Subject: libsoup r1222 - in trunk: . libsoup tests
- Date: Tue, 23 Dec 2008 19:05:12 +0000 (UTC)
Author: danw
Date: Tue Dec 23 19:05:12 2008
New Revision: 1222
URL: http://svn.gnome.org/viewvc/libsoup?rev=1222&view=rev
Log:
* configure.in: add some more warning CFLAGS, inspired by Benjamin
Otte's blog post, although none of them picked out any actual
bugs. Annoyingly, the most interesting warnings came from
-Wwrite-strings and -Wshadow, both of which I decided against
keeping, because they had too many false positives.
* libsoup/soup-cookie-jar.c (soup_cookie_jar_get_cookies): rename
a variable to avoid shadowing.
* libsoup/soup-message-headers.c
(soup_message_headers_get_ranges): move a variable declaration to
avoid a possibly-confusing shadowing.
* tests/forms-test.c:
* tests/header-parsing.c:
* tests/range-test.c:
* tests/test-utils.c: constify some "char *"s that should have
already been const.
* tests/get.c (find_hrefs): rename an arg whose name shadowed a
global, to avoid possible future confusion
(get_url): Likewise with a functional-internal shadowing.
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/libsoup/soup-cookie-jar.c
trunk/libsoup/soup-message-headers.c
trunk/tests/forms-test.c
trunk/tests/get.c
trunk/tests/header-parsing.c
trunk/tests/range-test.c
trunk/tests/test-utils.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Dec 23 19:05:12 2008
@@ -235,7 +235,10 @@
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
CFLAGS="$CFLAGS \
-Wall -Wstrict-prototypes -Wmissing-declarations \
- -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
+ -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+ -Wdeclaration-after-statement -Wformat=2 -Winit-self \
+ -Wmissing-include-dirs -Wundef -Waggregate-return \
+ -Wmissing-format-attribute"
fi
if test "$os_win32" != yes; then
Modified: trunk/libsoup/soup-cookie-jar.c
==============================================================================
--- trunk/libsoup/soup-cookie-jar.c (original)
+++ trunk/libsoup/soup-cookie-jar.c Tue Dec 23 19:05:12 2008
@@ -252,7 +252,7 @@
{
SoupCookieJarPrivate *priv;
GSList *cookies, *domain_cookies;
- char *domain, *cur, *next, *result;
+ char *domain, *cur, *next_domain, *result;
GSList *new_head, *cookies_to_remove = NULL, *p;
g_return_val_if_fail (SOUP_IS_COOKIE_JAR (jar), NULL);
@@ -265,7 +265,7 @@
*/
cookies = NULL;
domain = cur = g_strdup_printf (".%s", uri->host);
- next = domain + 1;
+ next_domain = domain + 1;
do {
new_head = domain_cookies = g_hash_table_lookup (priv->domains, cur);
while (domain_cookies) {
@@ -285,9 +285,9 @@
domain_cookies = next;
}
- cur = next;
+ cur = next_domain;
if (cur)
- next = strchr (cur + 1, '.');
+ next_domain = strchr (cur + 1, '.');
} while (cur);
g_free (domain);
Modified: trunk/libsoup/soup-message-headers.c
==============================================================================
--- trunk/libsoup/soup-message-headers.c (original)
+++ trunk/libsoup/soup-message-headers.c Tue Dec 23 19:05:12 2008
@@ -723,7 +723,6 @@
const char *range = soup_message_headers_get (hdrs, "Range");
GSList *range_list, *r;
GArray *array;
- SoupRange cur;
char *spec, *end;
int i;
@@ -744,6 +743,8 @@
array = g_array_new (FALSE, FALSE, sizeof (SoupRange));
for (r = range_list; r; r = r->next) {
+ SoupRange cur;
+
spec = r->data;
if (*spec == '-') {
cur.start = g_ascii_strtoll (spec, &end, 10) + total_length;
Modified: trunk/tests/forms-test.c
==============================================================================
--- trunk/tests/forms-test.c (original)
+++ trunk/tests/forms-test.c Tue Dec 23 19:05:12 2008
@@ -22,8 +22,8 @@
#include "test-utils.h"
static struct {
- char *title, *name;
- char *result;
+ const char *title, *name;
+ const char *result;
} tests[] = {
/* Both fields must be filled in */
{ NULL, "Name", "" },
Modified: trunk/tests/get.c
==============================================================================
--- trunk/tests/get.c (original)
+++ trunk/tests/get.c Tue Dec 23 19:05:12 2008
@@ -36,7 +36,7 @@
static GHashTable *fetched_urls;
static GPtrArray *
-find_hrefs (SoupURI *base, const char *body, int length)
+find_hrefs (SoupURI *doc_base, const char *body, int length)
{
GPtrArray *hrefs = g_ptr_array_new ();
char *buf = g_strndup (body, length);
@@ -65,19 +65,19 @@
if (frag)
*frag = '\0';
- uri = soup_uri_new_with_base (base, href);
+ uri = soup_uri_new_with_base (doc_base, href);
g_free (href);
if (!uri)
continue;
- if (base->scheme != uri->scheme ||
- base->port != uri->port ||
- g_ascii_strcasecmp (base->host, uri->host) != 0) {
+ if (doc_base->scheme != uri->scheme ||
+ doc_base->port != uri->port ||
+ g_ascii_strcasecmp (doc_base->host, uri->host) != 0) {
soup_uri_free (uri);
continue;
}
- if (strncmp (base->path, uri->path, strlen (base->path)) != 0) {
+ if (strncmp (doc_base->path, uri->path, strlen (doc_base->path)) != 0) {
soup_uri_free (uri);
continue;
}
@@ -160,7 +160,7 @@
if (debug) {
SoupMessageHeadersIter iter;
- const char *name, *value;
+ const char *hname, *value;
char *path = soup_uri_to_string (soup_message_get_uri (msg), TRUE);
printf ("%s %s HTTP/1.%d\n\n", method, path,
@@ -170,8 +170,8 @@
msg->status_code, msg->reason_phrase);
soup_message_headers_iter_init (&iter, msg->response_headers);
- while (soup_message_headers_iter_next (&iter, &name, &value))
- printf ("%s: %s\r\n", name, value);
+ while (soup_message_headers_iter_next (&iter, &hname, &value))
+ printf ("%s: %s\r\n", hname, value);
printf ("\n");
} else
printf ("%s: %d %s\n", name, msg->status_code, msg->reason_phrase);
Modified: trunk/tests/header-parsing.c
==============================================================================
--- trunk/tests/header-parsing.c (original)
+++ trunk/tests/header-parsing.c Tue Dec 23 19:05:12 2008
@@ -10,7 +10,7 @@
#include "test-utils.h"
typedef struct {
- char *name, *value;
+ const char *name, *value;
} Header;
static struct RequestTest {
@@ -549,9 +549,9 @@
static const int num_resptests = G_N_ELEMENTS (resptests);
static struct QValueTest {
- char *header_value;
- char *acceptable[7];
- char *unacceptable[2];
+ const char *header_value;
+ const char *acceptable[7];
+ const char *unacceptable[2];
} qvaluetests[] = {
{ "text/plain; q=0.5, text/html,\t text/x-dvi; q=0.8, text/x-c",
{ "text/html", "text/x-c", "text/x-dvi", "text/plain", NULL },
Modified: trunk/tests/range-test.c
==============================================================================
--- trunk/tests/range-test.c (original)
+++ trunk/tests/range-test.c Tue Dec 23 19:05:12 2008
@@ -118,7 +118,7 @@
}
static void
-request_single_range (SoupSession *session, char *uri,
+request_single_range (SoupSession *session, const char *uri,
int start, int end)
{
SoupMessage *msg;
@@ -188,7 +188,7 @@
}
static void
-request_double_range (SoupSession *session, char *uri,
+request_double_range (SoupSession *session, const char *uri,
int first_start, int first_end,
int second_start, int second_end,
int expected_return_ranges)
@@ -212,7 +212,7 @@
}
static void
-request_triple_range (SoupSession *session, char *uri,
+request_triple_range (SoupSession *session, const char *uri,
int first_start, int first_end,
int second_start, int second_end,
int third_start, int third_end,
@@ -239,7 +239,7 @@
}
static void
-do_range_test (SoupSession *session, char *uri, gboolean expect_coalesce)
+do_range_test (SoupSession *session, const char *uri, gboolean expect_coalesce)
{
int twelfths = full_response->length / 12;
Modified: trunk/tests/test-utils.c
==============================================================================
--- trunk/tests/test-utils.c (original)
+++ trunk/tests/test-utils.c Tue Dec 23 19:05:12 2008
@@ -148,9 +148,9 @@
#ifdef HAVE_APACHE
static gboolean
-apache_cmd (char *cmd)
+apache_cmd (const char *cmd)
{
- char *argv[8];
+ const char *argv[8];
char *cwd, *conf;
int status;
gboolean ok;
@@ -167,7 +167,7 @@
argv[6] = cmd;
argv[7] = NULL;
- ok = g_spawn_sync (cwd, argv, NULL, 0, NULL, NULL,
+ ok = g_spawn_sync (cwd, (char **)argv, NULL, 0, NULL, NULL,
NULL, NULL, &status, NULL);
if (ok)
ok = (status == 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]