mirror of
				https://github.com/simon987/sist2.git
				synced 2025-10-31 16:06:53 +00:00 
			
		
		
		
	Cleanup warnings
This commit is contained in:
		
							parent
							
								
									1abddabeec
								
							
						
					
					
						commit
						04dbfb23ab
					
				| @ -123,7 +123,7 @@ binaries. | |||||||
|         libssl-dev uuid-dev python3 libmagic-dev libfreetype6-dev \ |         libssl-dev uuid-dev python3 libmagic-dev libfreetype6-dev \ | ||||||
|         libcurl4-openssl-dev libbz2-dev yasm libharfbuzz-dev ragel \ |         libcurl4-openssl-dev libbz2-dev yasm libharfbuzz-dev ragel \ | ||||||
|         libarchive-dev libtiff5 libpng16-16 libpango1.0-dev \ |         libarchive-dev libtiff5 libpng16-16 libpango1.0-dev \ | ||||||
|         libxml2-dev libopenjp2-7-dev |         libxml2-dev libopenjp2-7-dev libleptonica-dev | ||||||
|    ``` |    ``` | ||||||
| 
 | 
 | ||||||
| 2. Build | 2. Build | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								src/main.c
									
									
									
									
									
								
							| @ -274,7 +274,7 @@ int main(int argc, const char *argv[]) { | |||||||
| 
 | 
 | ||||||
|     if (arg_version) { |     if (arg_version) { | ||||||
|         printf(Version); |         printf(Version); | ||||||
|         exit(0); |         goto end; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (LogCtx.very_verbose != 0) { |     if (LogCtx.very_verbose != 0) { | ||||||
| @ -286,12 +286,12 @@ int main(int argc, const char *argv[]) { | |||||||
| 
 | 
 | ||||||
|     if (argc == 0) { |     if (argc == 0) { | ||||||
|         argparse_usage(&argparse); |         argparse_usage(&argparse); | ||||||
|         return 1; |         goto end; | ||||||
|     } else if (strcmp(argv[0], "scan") == 0) { |     } else if (strcmp(argv[0], "scan") == 0) { | ||||||
| 
 | 
 | ||||||
|         int err = scan_args_validate(scan_args, argc, argv); |         int err = scan_args_validate(scan_args, argc, argv); | ||||||
|         if (err != 0) { |         if (err != 0) { | ||||||
|             return err; |             goto end; | ||||||
|         } |         } | ||||||
|         sist2_scan(scan_args); |         sist2_scan(scan_args); | ||||||
| 
 | 
 | ||||||
| @ -299,7 +299,7 @@ int main(int argc, const char *argv[]) { | |||||||
| 
 | 
 | ||||||
|         int err = index_args_validate(index_args, argc, argv); |         int err = index_args_validate(index_args, argc, argv); | ||||||
|         if (err != 0) { |         if (err != 0) { | ||||||
|             return err; |             goto end; | ||||||
|         } |         } | ||||||
|         sist2_index(index_args); |         sist2_index(index_args); | ||||||
| 
 | 
 | ||||||
| @ -307,19 +307,19 @@ int main(int argc, const char *argv[]) { | |||||||
| 
 | 
 | ||||||
|         int err = web_args_validate(web_args, argc, argv); |         int err = web_args_validate(web_args, argc, argv); | ||||||
|         if (err != 0) { |         if (err != 0) { | ||||||
|             return err; |             goto end; | ||||||
|         } |         } | ||||||
|         sist2_web(web_args); |         sist2_web(web_args); | ||||||
| 
 | 
 | ||||||
|     } else { |     } else { | ||||||
|         fprintf(stderr, "Invalid command: '%s'\n", argv[0]); |         fprintf(stderr, "Invalid command: '%s'\n", argv[0]); | ||||||
|         argparse_usage(&argparse); |         argparse_usage(&argparse); | ||||||
|         return 1; |         goto end; | ||||||
|     } |     } | ||||||
|     printf("\n"); |     printf("\n"); | ||||||
| 
 | 
 | ||||||
|  |     end: | ||||||
|     scan_args_destroy(scan_args); |     scan_args_destroy(scan_args); | ||||||
| 
 |  | ||||||
|     index_args_destroy(index_args); |     index_args_destroy(index_args); | ||||||
|     web_args_destroy(web_args); |     web_args_destroy(web_args); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #define AVIO_BUF_SIZE 8192 | #define AVIO_BUF_SIZE 8192 | ||||||
| 
 | 
 | ||||||
| __always_inline | __always_inline | ||||||
| AVCodecContext *alloc_jpeg_encoder(int dstW, int dstH, float qscale) { | static AVCodecContext *alloc_jpeg_encoder(int dstW, int dstH, float qscale) { | ||||||
| 
 | 
 | ||||||
|     AVCodec *jpeg_codec = avcodec_find_encoder(AV_CODEC_ID_MJPEG); |     AVCodec *jpeg_codec = avcodec_find_encoder(AV_CODEC_ID_MJPEG); | ||||||
|     AVCodecContext *jpeg = avcodec_alloc_context3(jpeg_codec); |     AVCodecContext *jpeg = avcodec_alloc_context3(jpeg_codec); | ||||||
| @ -78,7 +78,7 @@ AVFrame *scale_frame(const AVCodecContext *decoder, const AVFrame *frame, int si | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __always_inline | __always_inline | ||||||
| AVFrame *read_frame(AVFormatContext *pFormatCtx, AVCodecContext *decoder, int stream_idx, document_t *doc) { | static AVFrame *read_frame(AVFormatContext *pFormatCtx, AVCodecContext *decoder, int stream_idx, document_t *doc) { | ||||||
|     AVFrame *frame = av_frame_alloc(); |     AVFrame *frame = av_frame_alloc(); | ||||||
| 
 | 
 | ||||||
|     AVPacket avPacket; |     AVPacket avPacket; | ||||||
| @ -135,7 +135,7 @@ AVFrame *read_frame(AVFormatContext *pFormatCtx, AVCodecContext *decoder, int st | |||||||
|     text_buffer_destroy(&tex); |     text_buffer_destroy(&tex); | ||||||
| 
 | 
 | ||||||
| __always_inline | __always_inline | ||||||
| void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) { | static void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) { | ||||||
| 
 | 
 | ||||||
|     AVDictionaryEntry *tag = NULL; |     AVDictionaryEntry *tag = NULL; | ||||||
|     while ((tag = av_dict_get(pFormatCtx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { |     while ((tag = av_dict_get(pFormatCtx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { | ||||||
| @ -160,8 +160,7 @@ void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __always_inline | __always_inline | ||||||
| void | static void append_video_meta(AVFormatContext *pFormatCtx, AVFrame *frame, document_t *doc, int include_audio_tags, int is_video) { | ||||||
| append_video_meta(AVFormatContext *pFormatCtx, AVFrame *frame, document_t *doc, int include_audio_tags, int is_video) { |  | ||||||
| 
 | 
 | ||||||
|     if (is_video) { |     if (is_video) { | ||||||
|         meta_line_t *meta_duration = malloc(sizeof(meta_line_t)); |         meta_line_t *meta_duration = malloc(sizeof(meta_line_t)); | ||||||
|  | |||||||
| @ -82,15 +82,14 @@ int render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) { | |||||||
| 
 | 
 | ||||||
|     fz_drop_buffer(ctx, fzbuf); |     fz_drop_buffer(ctx, fzbuf); | ||||||
|     fz_drop_pixmap(ctx, pixmap); |     fz_drop_pixmap(ctx, pixmap); | ||||||
|  |     fz_drop_page(ctx, cover); | ||||||
| 
 | 
 | ||||||
|     if (err != 0) { |     if (err != 0) { | ||||||
|         LOG_WARNINGF(doc->filepath, "fz_new_buffer_from_pixmap_as_png() returned error code [%d] %s", err, |         LOG_WARNINGF(doc->filepath, "fz_new_buffer_from_pixmap_as_png() returned error code [%d] %s", err, | ||||||
|                      ctx->error.message) |                      ctx->error.message) | ||||||
|         fz_drop_page(ctx, cover); |  | ||||||
|         return FALSE; |         return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fz_drop_page(ctx, cover); |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -102,7 +101,7 @@ void fz_err_callback(void *user, UNUSED(const char *message)) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __always_inline | __always_inline | ||||||
| void init_ctx(fz_context *ctx, document_t *doc) { | static void init_ctx(fz_context *ctx, document_t *doc) { | ||||||
|     fz_disable_icc(ctx); |     fz_disable_icc(ctx); | ||||||
|     fz_register_document_handlers(ctx); |     fz_register_document_handlers(ctx); | ||||||
| 
 | 
 | ||||||
| @ -112,7 +111,8 @@ void init_ctx(fz_context *ctx, document_t *doc) { | |||||||
|     ctx->error.print = fz_err_callback; |     ctx->error.print = fz_err_callback; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int read_stext_block(fz_stext_block *block, text_buffer_t *tex) { | __always_inline | ||||||
|  | static int read_stext_block(fz_stext_block *block, text_buffer_t *tex) { | ||||||
|     if (block->type != FZ_STEXT_BLOCK_TEXT) { |     if (block->type != FZ_STEXT_BLOCK_TEXT) { | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
| @ -199,7 +199,7 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) { | |||||||
|     fz_catch(ctx) |     fz_catch(ctx) | ||||||
|         err = ctx->error.errcode; |         err = ctx->error.errcode; | ||||||
| 
 | 
 | ||||||
|     if (err) { |     if (err != 0) { | ||||||
|         fz_drop_stream(ctx, stream); |         fz_drop_stream(ctx, stream); | ||||||
|         fz_drop_document(ctx, fzdoc); |         fz_drop_document(ctx, fzdoc); | ||||||
|         fz_drop_context(ctx); |         fz_drop_context(ctx); | ||||||
| @ -280,12 +280,12 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) { | |||||||
| 
 | 
 | ||||||
|             fz_var(err); |             fz_var(err); | ||||||
|             fz_try(ctx) |             fz_try(ctx) | ||||||
|                         fz_run_page(ctx, page, dev, fz_identity, NULL); |                 fz_run_page(ctx, page, dev, fz_identity, NULL); | ||||||
|             fz_always(ctx) |             fz_always(ctx) | ||||||
|                 { |             { | ||||||
|                     fz_close_device(ctx, dev); |                 fz_close_device(ctx, dev); | ||||||
|                     fz_drop_device(ctx, dev); |                 fz_drop_device(ctx, dev); | ||||||
|                 } |             } | ||||||
|             fz_catch(ctx) |             fz_catch(ctx) | ||||||
|                 err = ctx->error.errcode; |                 err = ctx->error.errcode; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user