mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-13 05:01:30 +00:00
Comparing paths with strcmp is not really smart
This is "the same" commit as b932ef7e0f
but with a different patch number 08->09
This commit is contained in:
parent
e0a0091d0c
commit
086c0dbce4
|
@ -0,0 +1,22 @@
|
|||
diff --git a/generators/poppler/synctex/synctex_parser_utils.c b/generators/poppler/synctex/synctex_parser_utils.c
|
||||
index 3be45b7..3dd764f 100644
|
||||
--- a/generators/poppler/synctex/synctex_parser_utils.c
|
||||
+++ b/generators/poppler/synctex/synctex_parser_utils.c
|
||||
@@ -199,7 +199,16 @@ next_character:
|
||||
++rhs;
|
||||
goto next_character;
|
||||
# else
|
||||
- return 0 == strcmp(lhs,rhs)?synctex_YES:synctex_NO;
|
||||
+ if (lhs[0] == '/' && rhs[0] == '/') { /* for absolute paths compare the real paths */
|
||||
+ char *lhsreal = realpath(lhs, 0);
|
||||
+ char *rhsreal = realpath(rhs, 0);
|
||||
+ synctex_bool_t result = lhsreal && rhsreal && 0 == strcmp(lhsreal,rhsreal)?synctex_YES:synctex_NO;
|
||||
+ free (lhsreal);
|
||||
+ free (rhsreal);
|
||||
+ return result;
|
||||
+ } else {
|
||||
+ return 0 == strcmp(lhs,rhs)?synctex_YES:synctex_NO;
|
||||
+ }
|
||||
# endif
|
||||
}
|
||||
|
|
@ -5,3 +5,4 @@
|
|||
06-mingw-_synctex_error.diff
|
||||
07-synctex_scanner_new_with_output_file-reset-mode.diff
|
||||
08-fix_cpp_comments.diff
|
||||
09-fix_path_comparison.diff
|
||||
|
|
|
@ -199,7 +199,16 @@ next_character:
|
|||
++rhs;
|
||||
goto next_character;
|
||||
# else
|
||||
return 0 == strcmp(lhs,rhs)?synctex_YES:synctex_NO;
|
||||
if (lhs[0] == '/' && rhs[0] == '/') { /* for absolute paths compare the real paths */
|
||||
char *lhsreal = realpath(lhs, 0);
|
||||
char *rhsreal = realpath(rhs, 0);
|
||||
synctex_bool_t result = lhsreal && rhsreal && 0 == strcmp(lhsreal,rhsreal)?synctex_YES:synctex_NO;
|
||||
free (lhsreal);
|
||||
free (rhsreal);
|
||||
return result;
|
||||
} else {
|
||||
return 0 == strcmp(lhs,rhs)?synctex_YES:synctex_NO;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue