@@ -225,7 +225,7 @@ ZEND_FUNCTION(zstd_uncompress)
225225
226226 if (ZSTD_IS_ERROR (result )) {
227227 zend_string_efree (output );
228- ZSTD_WARNING ("can not decompress stream" );
228+ ZSTD_WARNING ("%s" , ZSTD_getErrorName ( result ) );
229229 RETURN_FALSE ;
230230 }
231231
@@ -237,15 +237,15 @@ ZEND_FUNCTION(zstd_uncompress)
237237 stream = ZSTD_createDStream ();
238238 if (stream == NULL ) {
239239 zend_string_efree (output );
240- ZSTD_WARNING ("can not create stream " );
240+ ZSTD_WARNING ("failed to create decompress context " );
241241 RETURN_FALSE ;
242242 }
243243
244244 result = ZSTD_initDStream (stream );
245245 if (ZSTD_IS_ERROR (result )) {
246246 zend_string_efree (output );
247247 ZSTD_freeDStream (stream );
248- ZSTD_WARNING ("can not init stream" );
248+ ZSTD_WARNING ("%s" , ZSTD_getErrorName ( result ) );
249249 RETURN_FALSE ;
250250 }
251251
@@ -268,7 +268,7 @@ ZEND_FUNCTION(zstd_uncompress)
268268 if (ZSTD_IS_ERROR (result )) {
269269 zend_string_efree (output );
270270 ZSTD_freeDStream (stream );
271- ZSTD_WARNING ("can not decompress stream" );
271+ ZSTD_WARNING ("%s" , ZSTD_getErrorName ( result ) );
272272 RETURN_FALSE ;
273273 }
274274
@@ -308,14 +308,14 @@ ZEND_FUNCTION(zstd_compress_dict)
308308
309309 cctx = ZSTD_createCCtx ();
310310 if (cctx == NULL ) {
311- ZSTD_WARNING ("ZSTD_createCCtx() error " );
311+ ZSTD_WARNING ("failed to create compress context " );
312312 RETURN_FALSE ;
313313 }
314314
315315 cdict = ZSTD_createCDict (dict , dict_len , (int ) level );
316316 if (!cdict ) {
317317 ZSTD_freeCCtx (cctx );
318- ZSTD_WARNING ("ZSTD_createCDict() error " );
318+ ZSTD_WARNING ("failed to load dictionary " );
319319 RETURN_FALSE ;
320320 }
321321
@@ -368,7 +368,7 @@ ZEND_FUNCTION(zstd_uncompress_dict)
368368
369369 ddict = ZSTD_createDDict (dict , dict_len );
370370 if (!ddict ) {
371- ZSTD_WARNING ("ZSTD_createDDict() error " );
371+ ZSTD_WARNING ("failed to load dictionary " );
372372 RETURN_FALSE ;
373373 }
374374
@@ -378,7 +378,7 @@ ZEND_FUNCTION(zstd_uncompress_dict)
378378 if (dctx == NULL ) {
379379 zend_string_efree (output );
380380 ZSTD_freeDDict (ddict );
381- ZSTD_WARNING ("ZSTD_createDCtx() error " );
381+ ZSTD_WARNING ("failed to create decompress context " );
382382 RETURN_FALSE ;
383383 }
384384
@@ -499,8 +499,7 @@ static int php_zstd_comp_flush_or_end(php_zstd_stream_data *self, int end)
499499 res = ZSTD_compressStream2 (self -> cctx , & self -> output , & in ,
500500 end ? ZSTD_e_end : ZSTD_e_flush );
501501 if (ZSTD_isError (res )) {
502- php_error_docref (NULL , E_WARNING ,
503- "libzstd error %s\n" , ZSTD_getErrorName (res ));
502+ ZSTD_WARNING ("zstd: %s\n" , ZSTD_getErrorName (res ));
504503 ret = EOF ;
505504 }
506505 php_stream_write (self -> stream , self -> output .dst , self -> output .pos );
@@ -581,8 +580,7 @@ static ssize_t php_zstd_decomp_read(php_stream *stream, char *buf, size_t count)
581580 res = ZSTD_decompressStream (self -> dctx ,
582581 & self -> output , & self -> input );
583582 if (ZSTD_IS_ERROR (res )) {
584- php_error_docref (NULL , E_WARNING ,
585- "libzstd error %s\n" , ZSTD_getErrorName (res ));
583+ ZSTD_WARNING ("zstd: %s\n" , ZSTD_getErrorName (res ));
586584#if PHP_VERSION_ID >= 70400
587585 return -1 ;
588586#endif
@@ -622,8 +620,7 @@ php_zstd_comp_write(php_stream *stream, const char *buf, size_t count)
622620 res = ZSTD_compressStream2 (self -> cctx , & self -> output ,
623621 & in , ZSTD_e_continue );
624622 if (ZSTD_isError (res )) {
625- php_error_docref (NULL , E_WARNING ,
626- "libzstd error %s\n" , ZSTD_getErrorName (res ));
623+ ZSTD_WARNING ("zstd: %s\n" , ZSTD_getErrorName (res ));
627624#if PHP_VERSION_ID >= 70400
628625 return -1 ;
629626#endif
@@ -720,9 +717,8 @@ php_stream_zstd_opener(
720717 }
721718
722719 if (level > ZSTD_maxCLevel ()) {
723- php_error_docref (NULL , E_WARNING ,
724- "zstd: compression level (%d) must be less than %d" ,
725- level , ZSTD_maxCLevel ());
720+ ZSTD_WARNING ("zstd: compression level (%d) must be less than %d" ,
721+ level , ZSTD_maxCLevel ());
726722 level = ZSTD_maxCLevel ();
727723 }
728724
@@ -739,8 +735,7 @@ php_stream_zstd_opener(
739735 self -> dctx = NULL ;
740736 self -> cctx = ZSTD_createCCtx ();
741737 if (!self -> cctx ) {
742- php_error_docref (NULL , E_WARNING ,
743- "zstd: compression context failed" );
738+ ZSTD_WARNING ("zstd: compression context failed" );
744739 php_stream_close (self -> stream );
745740 efree (self );
746741 return NULL ;
@@ -758,8 +753,7 @@ php_stream_zstd_opener(
758753 } else {
759754 self -> dctx = ZSTD_createDCtx ();
760755 if (!self -> dctx ) {
761- php_error_docref (NULL , E_WARNING ,
762- "zstd: compression context failed" );
756+ ZSTD_WARNING ("zstd: compression context failed" );
763757 php_stream_close (self -> stream );
764758 efree (self );
765759 return NULL ;
@@ -944,7 +938,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx, int level)
944938 REPORT_ERRORS , // | USE_PATH
945939 NULL , context );
946940 if (!stream ) {
947- ZSTD_WARNING ("could not open dictionary stream: %s" , dict );
941+ ZSTD_WARNING ("failed to open dictionary stream: %s" , dict );
948942 return ;
949943 }
950944
0 commit comments