Author: brane
Date: Fri May 30 17:38:38 2025
New Revision: 1925993
URL: http://svn.apache.org/viewvc?rev=1925993&view=rev
Log:
Compiler warning cleanup. In this chapter: unused variables and
one implicit converstion to a narrower type.
* auth/auth.h
(SERF_AUTH_assert): New assertion macro, similar to others in the code base.
* auth/auth.c
(serf__encode_auth_header): Fix apr_size_t -> int conversion warning,
caused by apr_base64 functions using int instead of size_t for the
data size.
* auth/auth_spnego.c
(do_auth): The auth_info local's value is never actually used, but does
have a potential side effect. For now, just add a FIXME comment.
* protocols/fcgi_protocol.c
(fcgi_cleanup): Do not define the unused baton.
* protocols/http2_protocol.c
(http2_handle_ping_ack): Likwise, do not define the unused baton.
* test/serf_httpd.c
(main): root_dir never seems to be used; add a FIXME for now.
Modified:
serf/trunk/auth/auth.c
serf/trunk/auth/auth.h
serf/trunk/auth/auth_spnego.c
serf/trunk/protocols/fcgi_protocol.c
serf/trunk/protocols/http2_protocol.c
serf/trunk/test/serf_httpd.c
Modified: serf/trunk/auth/auth.c
URL:
http://svn.apache.org/viewvc/serf/trunk/auth/auth.c?rev=1925993&r1=1925992&r2=1925993&view=diff
==============================================================================
--- serf/trunk/auth/auth.c (original)
+++ serf/trunk/auth/auth.c Fri May 30 17:38:38 2025
@@ -384,13 +384,21 @@ apr_status_t serf__handle_auth_response(
*/
void serf__encode_auth_header(const char **header,
const char *scheme,
- const char *data, apr_size_t data_len,
+ const char *data,
+ apr_size_t data_len,
apr_pool_t *pool)
{
apr_size_t encoded_len, scheme_len;
char *ptr;
- encoded_len = apr_base64_encode_len(data_len);
+ /* The apr_base64 functions take an integer length, not a size_t.
+ NOTE: There's no ""loss of integer precision"" when converting
+ (foo & INT_MAX) to an int, this should silence the compiler
+ without the need for an explicit cast. */
+ const int int_data_len = data_len & INT_MAX;
+ SERF_AUTH_assert(int_data_len == data_len);
+
+ encoded_len = apr_base64_encode_len(int_data_len);
scheme_len = strlen(scheme);
ptr = apr_palloc(pool, encoded_len + scheme_len + 1);
@@ -400,7 +408,7 @@ void serf__encode_auth_header(const char
ptr += scheme_len;
*ptr++ = ' ';
- apr_base64_encode(ptr, data, data_len);
+ apr_base64_encode(ptr, data, int_data_len);
}
const char *serf__construct_realm(peer_t peer,
Modified: serf/trunk/auth/auth.h
URL:
http://svn.apache.org/viewvc/serf/trunk/auth/auth.h?rev=1925993&r1=1925992&r2=1925993&view=diff
==============================================================================
--- serf/trunk/auth/auth.h (original)
+++ serf/trunk/auth/auth.h Fri May 30 17:38:38 2025
@@ -23,6 +23,13 @@
#include "auth_spnego.h"
+#ifdef _DEBUG
+#include <assert.h>
+#define SERF_AUTH_assert(x) assert(x)
+#else
+#define SERF_AUTH_assert(x) ((void)0)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
Modified: serf/trunk/auth/auth_spnego.c
URL:
http://svn.apache.org/viewvc/serf/trunk/auth/auth_spnego.c?rev=1925993&r1=1925992&r2=1925993&view=diff
==============================================================================
--- serf/trunk/auth/auth_spnego.c (original)
+++ serf/trunk/auth/auth_spnego.c Fri May 30 17:38:38 2025
@@ -273,6 +273,7 @@ do_auth(const serf__authn_scheme_t *sche
} else {
authn_info = &ctx->proxy_authn_info;
}
+ /* FIXME: authn_info's value is never used. */
/* Is this a response from a host/proxy? auth_hdr should always be set. */
if (code && auth_hdr) {
Modified: serf/trunk/protocols/fcgi_protocol.c
URL:
http://svn.apache.org/viewvc/serf/trunk/protocols/fcgi_protocol.c?rev=1925993&r1=1925992&r2=1925993&view=diff
==============================================================================
--- serf/trunk/protocols/fcgi_protocol.c (original)
+++ serf/trunk/protocols/fcgi_protocol.c Fri May 30 17:38:38 2025
@@ -60,10 +60,7 @@ struct serf_fcgi_protocol_t
static apr_status_t fcgi_cleanup(void *baton)
{
- serf_fcgi_protocol_t *fcgi = baton;
-
- fcgi = fcgi;
-
+ /* serf_fcgi_protocol_t *fcgi = baton; */
return APR_SUCCESS;
}
@@ -563,4 +560,3 @@ void serf__fcgi_protocol_init_server(ser
client->perform_teardown = fcgi_server_teardown;
client->protocol_baton = fcgi;
}
-
Modified: serf/trunk/protocols/http2_protocol.c
URL:
http://svn.apache.org/viewvc/serf/trunk/protocols/http2_protocol.c?rev=1925993&r1=1925992&r2=1925993&view=diff
==============================================================================
--- serf/trunk/protocols/http2_protocol.c (original)
+++ serf/trunk/protocols/http2_protocol.c Fri May 30 17:38:38 2025
@@ -761,11 +761,11 @@ http2_handle_ping_ack(void *baton,
const char *data,
apr_size_t len)
{
- serf_http2_protocol_t *h2 = baton;
+ /* serf_http2_protocol_t *h2 = baton; */
if (len != HTTP2_PING_DATA_SIZE)
return SERF_ERROR_HTTP2_FRAME_SIZE_ERROR;
- SERF_H2_assert(h2 != NULL);
+ SERF_H2_assert(baton != NULL);
/* Did we send a ping? */
Modified: serf/trunk/test/serf_httpd.c
URL:
http://svn.apache.org/viewvc/serf/trunk/test/serf_httpd.c?rev=1925993&r1=1925992&r2=1925993&view=diff
==============================================================================
--- serf/trunk/test/serf_httpd.c (original)
+++ serf/trunk/test/serf_httpd.c Fri May 30 17:38:38 2025
@@ -449,6 +449,7 @@ int main(int argc, const char **argv)
}
root_dir = argv[opt->ind];
+ /* FIXME: root_dir's value is never used. */
/* Setup debug logging */
if (verbose) {