--- a/libpurple/protocols/mxit/chunk.c Tue Nov 24 11:50:55 2009 +0000 +++ b/libpurple/protocols/mxit/chunk.c Tue Nov 24 13:23:27 2009 +0000 @@ -576,18 +576,17 @@ /* parse the resource chunks */ while ( chunklen > 0 ) { - struct raw_chunk* chunkhdr = ( struct raw_chunk * ) &chunkdata[pos]; - chunkhdr->length = ntohl( chunkhdr->length ); /* host byte-order */ + gchar* chunk = &chunkdata[pos]; /* start of chunk data */ - pos += sizeof( struct raw_chunk ); + pos += MXIT_CHUNK_HEADER_SIZE; - switch ( chunkhdr->type ) { + switch ( chunk_type( chunk ) ) { case CP_CHUNK_SPLASH : /* splash image */ { struct splash_chunk* splash = g_new0( struct splash_chunk, 1 ); - mxit_chunk_parse_splash( &chunkdata[pos], chunkhdr->length, splash ); + mxit_chunk_parse_splash( &chunkdata[pos], chunk_length( chunk ), splash ); cr->resources = g_list_append( cr->resources, splash ); break; @@ -600,12 +599,12 @@ break; } default: - purple_debug_info( MXIT_PLUGIN_ID, "Unsupported custom resource chunk received (%i)\n", chunkhdr->type ); + purple_debug_info( MXIT_PLUGIN_ID, "Unsupported custom resource chunk received (%i)\n", chunk_type( chunk) ); } /* skip over data to next resource chunk */ - pos += chunkhdr->length; - chunklen -= ( sizeof( struct raw_chunk ) + chunkhdr->length ); + pos += chunk_length( chunk ); + chunklen -= ( MXIT_CHUNK_HEADER_SIZE + chunk_length( chunk ) ); } }