From 31b3cceaa950713ede6a69b1ccb52a298ed54a08 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 31 Jan 2012 08:25:37 +0000 Subject: fixing const api and add check to address --- src/ats/ats_api_scheduling.c | 4 ++-- src/hello/address.c | 2 ++ src/include/gnunet_ats_service.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index b3d644023..dd70b634f 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c @@ -759,7 +759,7 @@ get_addresses (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @return location as GNUNET_ATS_Information */ -struct GNUNET_ATS_Information +const struct GNUNET_ATS_Information GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const struct sockaddr * addr, socklen_t addrlen) { GNUNET_assert (sh != NULL); @@ -868,7 +868,7 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); ats.value = htonl (type); - return ats; + return (const struct GNUNET_ATS_Information) ats; } /** diff --git a/src/hello/address.c b/src/hello/address.c index 618aa6e6a..893a6dc91 100644 --- a/src/hello/address.c +++ b/src/hello/address.c @@ -46,6 +46,8 @@ GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer, size_t slen; char *end; + GNUNET_assert (transport_name != NULL); + slen = strlen (transport_name) + 1; addr = GNUNET_malloc (sizeof (struct GNUNET_HELLO_Address) + address_length + diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 0db277597..9f5fed29d 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h @@ -542,7 +542,7 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, * @param addrlen address length * @return location as GNUNET_ATS_Information */ -struct GNUNET_ATS_Information +const struct GNUNET_ATS_Information GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, const struct sockaddr * addr, socklen_t addrlen); -- cgit v1.2.3