diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 4f5545b..e550fee 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -102,6 +102,10 @@ else () endif() if ( PLIST_FOUND ) message( STATUS "found libplist-${PLIST_VERSION}") + pkg_check_modules ( PLIST_21 libplist-2.0>=2.1.0 ) + if ( PLIST_21_FOUND ) + add_definitions( -DPLIST_210 ) + endif() pkg_check_modules ( PLIST_23 libplist-2.0>=2.3.0 ) if ( PLIST_23_FOUND ) add_definitions( -DPLIST_230 ) diff --git a/lib/http_handlers.h b/lib/http_handlers.h index 516ed30..a2b1198 100644 --- a/lib/http_handlers.h +++ b/lib/http_handlers.h @@ -621,10 +621,14 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t } uint_val = 0; - char *fcup_response_data = NULL; - plist_get_data_val(req_params_fcup_response_data_node, &fcup_response_data, &uint_val); +#ifdef PLIST_210 + const char *fcup_response_data = NULL; + fcup_response_data = plist_get_data_ptr(req_params_fcup_response_data_node, &uint_val); +#else + char *fcup_response_data = NULL; + fcup_response_data = plist_get_data_val(req_params_fcup_response_data_node, &fcup_response_data, &uint_val); +#endif fcup_response_datalen = (int) uint_val; - char *playlist = NULL; if (!fcup_response_data) { plist_mem_free(fcup_response_url); @@ -637,7 +641,9 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t } playlist[fcup_response_datalen] = '\0'; memcpy(playlist, fcup_response_data, fcup_response_datalen); +#ifndef PLIST_210 plist_mem_free(fcup_response_data); +#endif } assert(playlist); int playlist_len = strlen(playlist);