okular/core/synctex/patches/07-synctex_scanner_new_with_output_file-reset-mode.diff
Albert Astals Cid d95efa7698 Move synctex up to the core from poppler generator
This way dvi and any other potential user gets it for free

The diff is huge, but the synctex files are just moves.

And the code in core/ is also mostly just a move from the generator_pdf.cpp code

Acked by Luigi

REVIEW: 120311
2014-10-09 00:17:53 +02:00

22 lines
1.2 KiB
Diff

Description: synctex_scanner_new_with_output_file: reset the io_mode to read before trying to read again
synctex_scanner_new_with_output_file() tries first to open the file in an
"unquoted mode"; if it fails, it tries again quoting the file name.
During the first attempt, the synctex_io_mode_t is passed as pointer and it
can be incremented, making the second attempt start from "rb" instead of "r".
The easiest solution is to reset the io_mode before doing the second open
attempt.
Author: Albert Astals Cid <aacid@kde.org>
diff --git a/generators/poppler/synctex/synctex_parser.c b/generators/poppler/synctex/synctex_parser.c
index 588f350..c8f61bb 100644
--- a/generators/poppler/synctex/synctex_parser.c
+++ b/generators/poppler/synctex/synctex_parser.c
@@ -2584,6 +2584,8 @@ synctex_scanner_t synctex_scanner_new_with_output_file(const char * output, cons
}
/* now open the synctex file */
if (_synctex_open(output,build_directory,&synctex,&file,synctex_ADD_QUOTES,&io_mode) || !file) {
+ /* reset the io_mode to the default, ie read */
+ io_mode = 0;
if (_synctex_open(output,build_directory,&synctex,&file,synctex_DONT_ADD_QUOTES,&io_mode) || !file) {
return NULL;
}