Here's a patch that enables
configure --enable-werror

It also fixes all compile warnings on 64-bit Fedora 11 Linux, compiles
clean on 32-bit FC8 as well.

I couldn't fix all of the configure logic to deal properly with -Werror,
so I used an ugly hack to write out -Werror to a file and then append it
to CFLAGS in the Makefile.am script.  There has to be a better way to do this, 
but
I find automake logic to be totally baffling.

The ssh changes are the most risky and in need of review, and may
have issues on other platforms and/or version of libssh.

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

diff --git a/acinclude.m4 b/acinclude.m4
index 86f7c7b..dc7d2a9 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -182,6 +182,7 @@ AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
         HAVE_WINDOWS_H shall not be defined.
 #else
         int dummy=2*WINVER;
+        ((void)dummy);
 #endif
       ]])
     ],[
diff --git a/configure.ac b/configure.ac
index dbaa224..731543a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,7 @@ AM_MAINTAINER_MODE
 CURL_CHECK_OPTION_DEBUG
 CURL_CHECK_OPTION_OPTIMIZE
 CURL_CHECK_OPTION_WARNINGS
+CURL_CHECK_OPTION_WERROR
 CURL_CHECK_OPTION_CURLDEBUG
 CURL_CHECK_OPTION_ARES
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8a1f1a9..f0a3f22 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -44,6 +44,10 @@ CLEANFILES = $(DSP) $(VCPROJ)
 lib_LTLIBRARIES = libcurl.la
 LIBCURL_LIBS = @LIBCURL_LIBS@
 
+
+CFLAGS += `cat ../extra_build_args.txt`
+
+
 # Specify our include paths here, and do it relative to $(top_srcdir) and
 # $(top_builddir), to ensure that these paths which belong to the library
 # being currently built and tested are searched before the library which
diff --git a/lib/pop3.c b/lib/pop3.c
index 320f756..8f0cf59 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -925,7 +925,7 @@ CURLcode Curl_pop3_write(struct connectdata *conn,
      0d 0a 2e 0d 0a. This marker can of course be spread out
      over up to 5 different data chunks. Deal with it! */
   struct pop3_conn *pop3c = &conn->proto.pop3c;
-  int checkmax = (nread >= POP3_EOB_LEN?POP3_EOB_LEN:nread);
+  int checkmax = (int)(nread >= POP3_EOB_LEN?POP3_EOB_LEN:nread);
   int checkleft = POP3_EOB_LEN-pop3c->eob;
   int check = (checkmax >= checkleft?checkleft:checkmax);
 
diff --git a/lib/ssh.c b/lib/ssh.c
index c81a19c..0f8476c 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -223,7 +223,7 @@ kbd_callback(const char *name, int name_len, const char 
*instruction,
 #endif  /* CURL_LIBSSH2_DEBUG */
   if(num_prompts == 1) {
     responses[0].text = strdup(conn->passwd);
-    responses[0].length = strlen(conn->passwd);
+    responses[0].length = (unsigned int)(strlen(conn->passwd));
   }
   (void)prompts;
   (void)abstract;
@@ -704,7 +704,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, 
bool *block)
        */
       sshc->authlist = libssh2_userauth_list(sshc->ssh_session,
                                              conn->user,
-                                             strlen(conn->user));
+                                             (unsigned 
int)(strlen(conn->user)));
 
       if(!sshc->authlist) {
         if((err = libssh2_session_last_errno(sshc->ssh_session)) ==
@@ -795,9 +795,11 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
     case SSH_AUTH_PKEY:
       /* The function below checks if the files exists, no need to stat() here.
        */
-      rc = libssh2_userauth_publickey_fromfile(sshc->ssh_session,
-                                               conn->user, sshc->rsa_pub,
-                                               sshc->rsa, sshc->passphrase);
+      rc = libssh2_userauth_publickey_fromfile_ex(sshc->ssh_session,
+                                                  conn->user,
+                                                  (unsigned 
int)(strlen(conn->user)),
+                                                  sshc->rsa_pub,
+                                                  sshc->rsa, sshc->passphrase);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
@@ -832,8 +834,11 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_AUTH_PASS:
-      rc = libssh2_userauth_password(sshc->ssh_session, conn->user,
-                                     conn->passwd);
+      rc = libssh2_userauth_password_ex(sshc->ssh_session, conn->user,
+                                        (unsigned int)(strlen(conn->user)),
+                                        conn->passwd,
+                                        (unsigned int)(strlen(conn->passwd)),
+                                        NULL);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
@@ -875,7 +880,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, 
bool *block)
       /* Authentication failed. Continue with keyboard-interactive now. */
       rc = libssh2_userauth_keyboard_interactive_ex(sshc->ssh_session,
                                                     conn->user,
-                                                    strlen(conn->user),
+                                                    (unsigned 
int)(strlen(conn->user)),
                                                     &kbd_callback);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
@@ -962,7 +967,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, 
bool *block)
       }
       else {
         /* Return the error type */
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         result = sftp_libssh2_error_to_CURLE(err);
         sshc->actualcode = result?result:CURLE_SSH;
         DEBUGF(infof(data, "error = %d makes libcurl = %d\n",
@@ -1190,13 +1195,15 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
          * set them both at once, we need to obtain the current ownership
          * first.  This takes an extra protocol round trip.
          */
-        rc = libssh2_sftp_stat(sshc->sftp_session, sshc->quote_path2,
-                               &sshc->quote_attrs);
+        rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2,
+                                  (unsigned int)(strlen(sshc->quote_path2)),
+                                  LIBSSH2_SFTP_STAT,
+                                  &sshc->quote_attrs);
         if(rc == LIBSSH2_ERROR_EAGAIN) {
           break;
         }
         else if(rc != 0) { /* get those attributes */
-          err = libssh2_sftp_last_error(sshc->sftp_session);
+          err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
           Curl_safefree(sshc->quote_path1);
           sshc->quote_path1 = NULL;
           Curl_safefree(sshc->quote_path2);
@@ -1260,13 +1267,15 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_QUOTE_SETSTAT:
-      rc = libssh2_sftp_setstat(sshc->sftp_session, sshc->quote_path2,
+      rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2,
+                                (unsigned int)(strlen(sshc->quote_path2)),
+                                LIBSSH2_SFTP_SETSTAT,
                                 &sshc->quote_attrs);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
       else if(rc != 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         Curl_safefree(sshc->quote_path1);
         sshc->quote_path1 = NULL;
         Curl_safefree(sshc->quote_path2);
@@ -1281,13 +1290,16 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_QUOTE_SYMLINK:
-      rc = libssh2_sftp_symlink(sshc->sftp_session, sshc->quote_path1,
-                                sshc->quote_path2);
+      rc = libssh2_sftp_symlink_ex(sshc->sftp_session, sshc->quote_path1,
+                                   (unsigned int)(strlen(sshc->quote_path1)),
+                                   sshc->quote_path2,
+                                   (unsigned int)(strlen(sshc->quote_path2)),
+                                   LIBSSH2_SFTP_SYMLINK);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
       else if(rc != 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         Curl_safefree(sshc->quote_path1);
         sshc->quote_path1 = NULL;
         Curl_safefree(sshc->quote_path2);
@@ -1302,12 +1314,13 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_QUOTE_MKDIR:
-      rc = libssh2_sftp_mkdir(sshc->sftp_session, sshc->quote_path1, 0755);
+      rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sshc->quote_path1,
+                                 (unsigned int)(strlen(sshc->quote_path1)), 
0755);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
       else if(rc != 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         Curl_safefree(sshc->quote_path1);
         sshc->quote_path1 = NULL;
         failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err));
@@ -1319,13 +1332,18 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_QUOTE_RENAME:
-      rc = libssh2_sftp_rename(sshc->sftp_session, sshc->quote_path1,
-                               sshc->quote_path2);
+      rc = libssh2_sftp_rename_ex(sshc->sftp_session, sshc->quote_path1,
+                                  (unsigned int)(strlen(sshc->quote_path1)),
+                                  sshc->quote_path2,
+                                  (unsigned int)(strlen(sshc->quote_path2)),
+                                  LIBSSH2_SFTP_RENAME_OVERWRITE |
+                                  LIBSSH2_SFTP_RENAME_ATOMIC |
+                                  LIBSSH2_SFTP_RENAME_NATIVE);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
       else if(rc != 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         Curl_safefree(sshc->quote_path1);
         sshc->quote_path1 = NULL;
         Curl_safefree(sshc->quote_path2);
@@ -1339,12 +1357,13 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_QUOTE_RMDIR:
-      rc = libssh2_sftp_rmdir(sshc->sftp_session, sshc->quote_path1);
+      rc = libssh2_sftp_rmdir_ex(sshc->sftp_session, sshc->quote_path1,
+                                 (unsigned int)(strlen(sshc->quote_path1)));
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
       else if(rc != 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         Curl_safefree(sshc->quote_path1);
         sshc->quote_path1 = NULL;
         failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err));
@@ -1356,12 +1375,13 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_QUOTE_UNLINK:
-      rc = libssh2_sftp_unlink(sshc->sftp_session, sshc->quote_path1);
+      rc = libssh2_sftp_unlink_ex(sshc->sftp_session, sshc->quote_path1,
+                                  (unsigned int)(strlen(sshc->quote_path1)));
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
       else if(rc != 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         Curl_safefree(sshc->quote_path1);
         sshc->quote_path1 = NULL;
         failf(data, "rm command failed: %s", sftp_libssh2_strerror(err));
@@ -1398,7 +1418,9 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       if(data->state.resume_from != 0) {
         LIBSSH2_SFTP_ATTRIBUTES attrs;
         if(data->state.resume_from< 0) {
-          rc = libssh2_sftp_stat(sshc->sftp_session, sftp_scp->path, &attrs);
+          rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,
+                                    (unsigned int)(strlen(sftp_scp->path)),
+                                    LIBSSH2_SFTP_STAT, &attrs);
           if(rc == LIBSSH2_ERROR_EAGAIN) {
             break;
           }
@@ -1422,8 +1444,10 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
         flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC;
 
       sshc->sftp_handle =
-        libssh2_sftp_open(sshc->sftp_session, sftp_scp->path,
-                          flags, data->set.new_file_perms);
+        libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,
+                             (unsigned int)(strlen(sftp_scp->path)),
+                             flags, data->set.new_file_perms,
+                             LIBSSH2_SFTP_OPENFILE);
 
       if(!sshc->sftp_handle) {
         rc = libssh2_session_last_errno(sshc->ssh_session);
@@ -1434,7 +1458,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
           if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)
             /* only when there was an SFTP protocol error can we extract
                the sftp error! */
-            err = libssh2_sftp_last_error(sshc->sftp_session);
+            err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
           else
             err = -1; /* not an sftp error at all */
 
@@ -1574,8 +1598,9 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
 
     case SSH_SFTP_CREATE_DIRS_MKDIR:
       /* 'mode' - parameter is preliminary - default to 0644 */
-      rc = libssh2_sftp_mkdir(sshc->sftp_session, sftp_scp->path,
-                              data->set.new_directory_perms);
+      rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sftp_scp->path,
+                                 (unsigned int)(strlen(sftp_scp->path)),
+                                 data->set.new_directory_perms);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
@@ -1588,7 +1613,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
          * permission was denied (creation might succeed further down the
          * path) - retry on unspecific FAILURE also
          */
-        sftp_err = libssh2_sftp_last_error(sshc->sftp_session);
+        sftp_err = (unsigned int)(libssh2_sftp_last_error(sshc->sftp_session));
         if((sftp_err != LIBSSH2_FX_FILE_ALREADY_EXISTS) &&
            (sftp_err != LIBSSH2_FX_FAILURE) &&
            (sftp_err != LIBSSH2_FX_PERMISSION_DENIED)) {
@@ -1606,8 +1631,10 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
        * This is a directory that we are trying to get, so produce a directory
        * listing
        */
-      sshc->sftp_handle = libssh2_sftp_opendir(sshc->sftp_session,
-                                               sftp_scp->path);
+      sshc->sftp_handle = libssh2_sftp_open_ex(sshc->sftp_session,
+                                               sftp_scp->path,
+                                               (unsigned 
int)(strlen(sftp_scp->path)),
+                                               0, 0, LIBSSH2_SFTP_OPENDIR);
       if(!sshc->sftp_handle) {
         if(libssh2_session_last_errno(sshc->ssh_session) ==
            LIBSSH2_ERROR_EAGAIN) {
@@ -1615,7 +1642,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
           break;
         }
         else {
-          err = libssh2_sftp_last_error(sshc->sftp_session);
+          err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
           failf(data, "Could not open directory for reading: %s",
                 sftp_libssh2_strerror(err));
           state(conn, SSH_SFTP_CLOSE);
@@ -1681,7 +1708,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
           }
         }
         else {
-          sshc->readdir_currLen = strlen(sshc->readdir_longentry);
+          sshc->readdir_currLen = (int)(strlen(sshc->readdir_longentry));
           sshc->readdir_totalLen = 80 + sshc->readdir_currLen;
           sshc->readdir_line = calloc(sshc->readdir_totalLen, 1);
           if(!sshc->readdir_line) {
@@ -1728,7 +1755,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
         break;
       }
       else if(sshc->readdir_len <= 0) {
-        err = libssh2_sftp_last_error(sshc->sftp_session);
+        err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
         result = sftp_libssh2_error_to_CURLE(err);
         sshc->actualcode = result?result:CURLE_SSH;
         failf(data, "Could not open remote file for reading: %s :: %d",
@@ -1744,10 +1771,11 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       break;
 
     case SSH_SFTP_READDIR_LINK:
-      sshc->readdir_len = libssh2_sftp_readlink(sshc->sftp_session,
-                                                sshc->readdir_linkPath,
-                                                sshc->readdir_filename,
-                                                PATH_MAX);
+      sshc->readdir_len = libssh2_sftp_symlink_ex(sshc->sftp_session,
+                                                  sshc->readdir_linkPath,
+                                                  (unsigned 
int)(strlen(sshc->readdir_linkPath)),
+                                                  sshc->readdir_filename,
+                                                  PATH_MAX, 
LIBSSH2_SFTP_READLINK);
       if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) {
         rc = LIBSSH2_ERROR_EAGAIN;
         break;
@@ -1826,8 +1854,10 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
        * Work on getting the specified file
        */
       sshc->sftp_handle =
-        libssh2_sftp_open(sshc->sftp_session, sftp_scp->path,
-                          LIBSSH2_FXF_READ, data->set.new_file_perms);
+        libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,
+                             (unsigned int)(strlen(sftp_scp->path)),
+                             LIBSSH2_FXF_READ, data->set.new_file_perms,
+                             LIBSSH2_SFTP_OPENFILE);
       if(!sshc->sftp_handle) {
         if(libssh2_session_last_errno(sshc->ssh_session) ==
            LIBSSH2_ERROR_EAGAIN) {
@@ -1835,7 +1865,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
           break;
         }
         else {
-          err = libssh2_sftp_last_error(sshc->sftp_session);
+          err = (int)(libssh2_sftp_last_error(sshc->sftp_session));
           failf(data, "Could not open remote file for reading: %s",
                 sftp_libssh2_strerror(err));
           state(conn, SSH_SFTP_CLOSE);
@@ -1851,7 +1881,9 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
     {
       LIBSSH2_SFTP_ATTRIBUTES attrs;
 
-      rc = libssh2_sftp_stat(sshc->sftp_session, sftp_scp->path, &attrs);
+      rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,
+                                (unsigned int)(strlen(sftp_scp->path)),
+                                LIBSSH2_SFTP_STAT, &attrs);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
@@ -2048,7 +2080,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
        */
       sshc->ssh_channel =
         libssh2_scp_send_ex(sshc->ssh_session, sftp_scp->path,
-                            data->set.new_file_perms,
+                            (int)(data->set.new_file_perms),
                             (size_t)data->set.infilesize, 0, 0);
       if(!sshc->ssh_channel) {
         if(libssh2_session_last_errno(sshc->ssh_session) ==
@@ -2060,8 +2092,8 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
           int ssh_err;
           char *err_msg;
 
-          ssh_err = libssh2_session_last_error(sshc->ssh_session,
-                                               &err_msg, NULL, 0);
+          ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
+                                                     &err_msg, NULL, 0));
           failf(conn->data, "%s", err_msg);
           state(conn, SSH_SCP_CHANNEL_FREE);
           sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
@@ -2110,8 +2142,8 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
           int ssh_err;
           char *err_msg;
 
-          ssh_err = libssh2_session_last_error(sshc->ssh_session,
-                                               &err_msg, NULL, 0);
+          ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
+                                                     &err_msg, NULL, 0));
           failf(conn->data, "%s", err_msg);
           state(conn, SSH_SCP_CHANNEL_FREE);
           sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
diff --git a/lib/transfer.c b/lib/transfer.c
index 2d50405..73c23d5 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -857,7 +857,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
 
 #ifndef CURL_DISABLE_SMTP
       if(conn->protocol & PROT_SMTP) {
-        result = Curl_smtp_escape_eob(conn, nread);
+        result = Curl_smtp_escape_eob(conn, (int)(nread));
         if(result)
           return result;
       }
diff --git a/lib/url.c b/lib/url.c
index 15304fd..f006443 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1839,7 +1839,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, 
CURLoption option,
       data->set.fread_func = (curl_read_callback)fread;
     break;
   case CURLOPT_FORCE_USE_READFUNC:
-    data->set.force_use_fread_func = va_arg(param, long);
+    data->set.force_use_fread_func = (int)(va_arg(param, long));
     break;
   case CURLOPT_SEEKFUNCTION:
     /*
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index 1ea4d17..d552490 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -875,6 +875,14 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
         #
       GNU_C)
         #
+        if test "$want_werror" = "yes"; then
+         echo "-Werror" > extra_build_args.txt
+         # This breaks auto-config stage
+         # tmp_CFLAGS="$tmp_CFLAGS -Werror"
+        else
+         echo "" > extra_build_args.txt
+        fi
+
         if test "$want_warnings" = "yes"; then
           #
           dnl Do not enable -pedantic when cross-compiling with a gcc older
@@ -1285,6 +1293,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
       typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
     ]],[[
       bad_t dummy;
+      ((void)dummy);
     ]])
   ],[
     AC_MSG_RESULT([no])
diff --git a/m4/curl-confopts.m4 b/m4/curl-confopts.m4
index fb11ee3..3680961 100644
--- a/m4/curl-confopts.m4
+++ b/m4/curl-confopts.m4
@@ -314,6 +314,38 @@ AC_HELP_STRING([--disable-warnings],[Disable strict 
compiler warnings]),
   AC_MSG_RESULT([$want_warnings])
 ])
 
+dnl CURL_CHECK_OPTION_WERROR
+dnl -------------------------------------------------
+dnl Verify if configure has been invoked with option
+dnl --enable-werror or --disable-werror, and set
+dnl shell variable want_werror as appropriate.
+
+AC_DEFUN([CURL_CHECK_OPTION_WERROR], [
+  AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
+  AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
+  AC_MSG_CHECKING([whether to enable compiler warnings as errors])
+  OPT_COMPILER_WERROR="default"
+  AC_ARG_ENABLE(werror,
+AC_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
+AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
+  OPT_COMPILER_WERROR=$enableval)
+  case "$OPT_COMPILER_WERROR" in
+    no)
+      dnl --disable-werror option used
+      want_werror="no"
+      ;;
+    default)
+      dnl --disable-werror option not specified, default to off
+      want_werror="no"
+      ;;
+    *)
+      dnl --enable-werror option used
+      want_werror="yes"
+      ;;
+  esac
+  AC_MSG_RESULT([$want_werror])
+])
+
 
 dnl CURL_CHECK_NONBLOCKING_SOCKET
 dnl -------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 3672458..29bfdd4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,6 +46,8 @@ bin_PROGRAMS = curl
 
 include Makefile.inc
 
+CFLAGS += `cat ../extra_build_args.txt`
+
 curl_LDADD = $(top_builddir)/lib/libcurl.la @CURL_LIBS@
 curl_DEPENDENCIES = $(top_builddir)/lib/libcurl.la
 BUILT_SOURCES = hugehelp.c
diff --git a/src/main.c b/src/main.c
index 80edfe0..61b663e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4238,7 +4238,7 @@ header_callback(void *ptr, size_t size, size_t nmemb, 
void *stream)
         continue;
       }
       p+=9;
-      filename = parse_filename(p, cb - (p - str));
+      filename = parse_filename(p, (int)(cb - (p - str)));
       if (filename) {
         outs->filename = filename;
         break;
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to