weather.c
/* callback function used by curl in get_zip and 
in weather_initialize */
callback function used by curl in get_zip and
in weather_initialize
callback function used by curl in get_zip and in weather_initialize
size_t curl_callback(char *ptr, size_t size, size_t nmemb, void *userdata)
{
	size_t realsize = size * nmemb;
	get_request *req = (get_request *)userdata;
	while (req->buflen < req->len + realsize + 1)
	{
		req->buffer = realloc(req->buffer, req->buflen + CHUNK_SIZE);
		req->buflen += CHUNK_SIZE;
	}
	memcpy(&req->buffer[req->len], ptr, realsize);
	req->len += realsize;
	req->buffer[req->len] = 0;
	return realsize;
}
size_t curl_callback ( char * ptr , size_t size , size_t nmemb , void * userdata ) { size_t realsize = size * nmemb ; get_request * req = ( get_request * ) userdata ; while ( req -> buflen < req -> len + realsize + 1 ) { req -> buffer = realloc ( req -> buffer , req -> buflen + CHUNK_SIZE ) ; req -> buflen += CHUNK_SIZE ; } memcpy ( & req -> buffer [ req -> len ] , ptr , realsize ) ; req -> len += realsize ; req -> buffer [ req -> len ] = 0 ; return realsize ; }
callback function used by curl in get_zip and
in weather_initialize
callback function used by curl in get_zip and in weather_initialize
// printf("receive chunk of %zu bytes\n", realsize);