From 47cc58ea4049e21f58be69c52e1a28501eda32ef Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 10 Jan 2023 10:33:54 +0100 Subject: [PATCH] api/libsphinxclient/test.c: Compiler compatibility fixes Include to avoid implicit function declarations. Avoid const char **/char ** type incompatibility by introducing the docs0 variable. --- api/libsphinxclient/test.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/api/libsphinxclient/test.c b/api/libsphinxclient/test.c index 495715f1c..237928ac4 100644 --- a/api/libsphinxclient/test.c +++ b/api/libsphinxclient/test.c @@ -16,6 +16,7 @@ #include #include #include +#include #if _WIN32 #include @@ -218,7 +219,8 @@ void test_excerpt_spz ( sphinx_client * client ) void test_persist_work ( sphinx_client * client ) { - char * docs[] = { NULL }; + const char * docs[] = { NULL }; + char *docs0; const char words[] = "that is"; const char * index = "test1"; const char filler[] = " no need to worry about "; @@ -229,13 +231,14 @@ void test_persist_work ( sphinx_client * client ) // should be in sync with sphinxclient.c MAX_PACKET_LEN i = 8*1024*1024 + 50; - docs[0] = malloc ( i ); - if ( !docs[0] ) + docs0 = malloc ( i ); + if ( !docs0 ) die ( "malloc failed at test_persist_work" ); + docs[0] = docs0; - memcpy ( docs[0], words, sizeof(words)-1 ); - doc = docs[0] + sizeof(words)-1; - while ( ( doc + sizeof(filler) )