summaryrefslogtreecommitdiffstats
path: root/src/proto
diff options
context:
space:
mode:
authorMichael Brown2005-05-24 01:47:54 +0200
committerMichael Brown2005-05-24 01:47:54 +0200
commit7b423c098838fb4b972ac888ac6f94efda951765 (patch)
treec55dbb81000afe6e556caf9004ff830116117c36 /src/proto
parentSplit PXE code into preboot, udp, tftp, undi and loader units. (diff)
downloadipxe-7b423c098838fb4b972ac888ac6f94efda951765.tar.gz
ipxe-7b423c098838fb4b972ac888ac6f94efda951765.tar.xz
ipxe-7b423c098838fb4b972ac888ac6f94efda951765.zip
Fixes for gcc >= 3.2 from Georg Baum
Diffstat (limited to 'src/proto')
-rw-r--r--src/proto/http.c15
-rw-r--r--src/proto/nmb.c7
2 files changed, 13 insertions, 9 deletions
diff --git a/src/proto/http.c b/src/proto/http.c
index 6f47fc14d..4fa594f66 100644
--- a/src/proto/http.c
+++ b/src/proto/http.c
@@ -40,18 +40,19 @@ static int send_tcp_request(int length, void *buffer, void *ptr) {
/**************************************************************************
RECV_TCP_CALLBACK - Receive data using TCP
**************************************************************************/
-static int recv_tcp_request(int length, const void *buffer, void *ptr) {
+static int recv_tcp_request(int length, const void *data, void *ptr) {
struct send_recv_state *state = (struct send_recv_state *)ptr;
+ const char *buffer = data;
/* Assume that the lines in an HTTP header do not straddle a packet */
/* boundary. This is probably a reasonable assumption */
if (state->recv_state == RESULT_CODE) {
while (length > 0) {
/* Find HTTP result code */
- if (*(const char *)buffer == ' ') {
- const char *ptr = ((const char *)buffer) + 1;
+ if (*buffer == ' ') {
+ const char *ptr = buffer + 1;
int rc = strtoul(ptr, &ptr, 10);
- if (ptr >= (const char *)buffer + length) {
+ if (ptr >= buffer + length) {
state->recv_state = ERROR;
DBG ( "HTTP got bad result code\n" );
return 0;
@@ -61,7 +62,7 @@ static int recv_tcp_request(int length, const void *buffer, void *ptr) {
DBG ( "HTTP got result code %d\n", rc );
goto header;
}
- ++(const char *)buffer;
+ ++buffer;
length--;
}
state->recv_state = ERROR;
@@ -88,7 +89,7 @@ static int recv_tcp_request(int length, const void *buffer, void *ptr) {
/* Find beginning of line */
while (length > 0) {
length--;
- if (*((const char *)buffer)++ == '\n')
+ if (*buffer++ == '\n')
break;
}
/* Check for end of header */
@@ -140,7 +141,7 @@ static int http ( char *url, struct sockaddr_in *server __unused,
tcp_transaction ( server->sin_addr.s_addr,
server->sin_port, &state,
- send_tcp_request, recv_tcp_request );
+ send_tcp_request, (int (*)(int, const void *, void *))recv_tcp_request );
}
if ( state.recv_state == MOVED ) {
diff --git a/src/proto/nmb.c b/src/proto/nmb.c
index b395dabeb..d44c06850 100644
--- a/src/proto/nmb.c
+++ b/src/proto/nmb.c
@@ -15,6 +15,7 @@ static inline char * nbns_make_name ( char *dest, const char *name ) {
char nb_name[16];
char c;
int i;
+ uint16_t *d;
*(dest++) = 32; /* Length is always 32 */
@@ -26,11 +27,13 @@ static inline char * nbns_make_name ( char *dest, const char *name ) {
memset ( nb_name, ' ', 15 );
nb_name[15] = '\0';
memcpy ( nb_name, name, strlen ( name ) ); /* Do not copy NUL */
+
+ d = ( uint16_t * ) dest;
for ( i = 0 ; i < 16 ; i++ ) {
c = nb_name[i];
- *( ( ( uint16_t * ) dest ) ++ ) =
- htons ( ( ( c | ( c << 4 ) ) & 0x0f0f ) + 0x4141 );
+ *( d++ ) = htons ( ( ( c | ( c << 4 ) ) & 0x0f0f ) + 0x4141 );
}
+ dest = ( char * ) d;
*(dest++) = 0; /* Terminating 0-length name component */
return dest;