use plist_get_data_ptr not plist_get_data_val (libplist>=2.1.0)

This commit is contained in:
F. Duncanh
2026-01-23 00:34:02 -05:00
parent b17dac85b8
commit 3898cba605
2 changed files with 13 additions and 3 deletions

View File

@@ -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 )

View File

@@ -621,10 +621,14 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
}
uint_val = 0;
#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;
plist_get_data_val(req_params_fcup_response_data_node, &fcup_response_data, &uint_val);
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);