summaryrefslogtreecommitdiff
path: root/cut-n-paste/synctex/synctex_parser_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'cut-n-paste/synctex/synctex_parser_utils.c')
-rw-r--r--cut-n-paste/synctex/synctex_parser_utils.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/cut-n-paste/synctex/synctex_parser_utils.c b/cut-n-paste/synctex/synctex_parser_utils.c
index 70132bda..0e9fd0e5 100644
--- a/cut-n-paste/synctex/synctex_parser_utils.c
+++ b/cut-n-paste/synctex/synctex_parser_utils.c
@@ -5,7 +5,7 @@ This file is part of the SyncTeX package.
Latest Revision: Tue Jun 14 08:23:30 UTC 2011
-Version: 1.17
+Version: 1.18
See synctex_parser_readme.txt for more details
@@ -67,6 +67,7 @@ authorization from the copyright holder.
#ifdef SYNCTEX_WINDOWS
#include <windows.h>
+#include <shlwapi.h> /* Use shlwapi.lib */
#endif
void *_synctex_malloc(size_t size) {
@@ -115,6 +116,15 @@ void _synctex_strip_last_path_extension(char * string) {
if(NULL != string){
char * last_component = NULL;
char * last_extension = NULL;
+# if defined(SYNCTEX_WINDOWS)
+ last_component = PathFindFileName(string);
+ last_extension = PathFindExtension(string);
+ if(last_extension == NULL)return;
+ if(last_component == NULL)last_component = string;
+ if(last_extension>last_component){/* filter out paths like "my/dir/.hidden" */
+ last_extension[0] = '\0';
+ }
+# else
char * next = NULL;
/* first we find the last path component */
if(NULL == (last_component = strstr(string,"/"))){
@@ -125,12 +135,12 @@ void _synctex_strip_last_path_extension(char * string) {
last_component = next+1;
}
}
-# if defined(SYNCTEX_WINDOWS) || defined(SYNCTEX_OS2)
- /* On Windows, the '\' is also a path separator. */
+# if defined(SYNCTEX_OS2)
+ /* On OS2, the '\' is also a path separator. */
while((next = strstr(last_component,"\\"))){
last_component = next+1;
}
-# endif
+# endif /* SYNCTEX_OS2 */
/* then we find the last path extension */
if((last_extension = strstr(last_component,"."))){
++last_extension;
@@ -142,6 +152,7 @@ void _synctex_strip_last_path_extension(char * string) {
last_extension[0] = '\0';
}
}
+# endif /* SYNCTEX_WINDOWS */
}
}
@@ -150,7 +161,7 @@ synctex_bool_t synctex_ignore_leading_dot_slash_in_path(const char ** name_ref)
if (SYNCTEX_IS_DOT((*name_ref)[0]) && SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[1])) {
do {
(*name_ref) += 2;
- while (SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[1])) {
+ while (SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[0])) {
++(*name_ref);
}
} while(SYNCTEX_IS_DOT((*name_ref)[0]) && SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[1]));
@@ -292,7 +303,6 @@ char * _synctex_merge_strings(const char * first,...) {
size_t len = strlen(temp);
if(UINT_MAX-len<size) {
_synctex_error("! _synctex_merge_strings: Capacity exceeded.");
- va_end(arg);
return NULL;
}
size+=len;
@@ -313,7 +323,6 @@ char * _synctex_merge_strings(const char * first,...) {
_synctex_error("! _synctex_merge_strings: Copy problem");
free(result);
result = NULL;
- va_end(arg);
return NULL;
}
dest += size;