Fix string handling in wniapicheck

Francois Gouget fgouget at free.fr
Thu Oct 21 04:11:30 CDT 2004


winapi_check did not correctly handle escaped quotes inside strings 
which caused this spurious warning:

dlls/shlwapi/tests/path.c:96: C++ comments not allowed: 
///f%20o%5E%26%60%7B%7D%7C%5D%5B%22%3C%3E/%o/b%23a%20r/baz"},


Changelog:

  * tools/winapi_check/winapi_parser.pm

    Fix escaped quote handling in strings.


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont \xE9t\xE9 remplac\xE9s par de nouveaux.
-------------- next part --------------
Index: tools/winapi_check/winapi_parser.pm
===================================================================
RCS file: /var/cvs/wine/tools/winapi_check/winapi_parser.pm,v
retrieving revision 1.39
diff -u -r1.39 winapi_parser.pm
--- tools/winapi_check/winapi_parser.pm	7 Oct 2004 18:53:56 -0000	1.39
+++ tools/winapi_check/winapi_parser.pm	19 Oct 2004 18:03:44 -0000
@@ -192,7 +192,7 @@
 	}
 
 	# remove C comments
-	if(s/^([^\"\/]*?(?:\"[^\"]*?\"[^\"]*?)*?)(?=\/\*)//s) {
+	if(s/^([^\"\/]*?(?:\"(?:[^\\\"]*|\\.)*\"[^\"]*?)*?)(?=\/\*)//s) {
 	    my $prefix = $1;
 	    if(s/^(\/\*.*?\*\/)//s) {
 		my @lines = split(/\n/, $1);
@@ -213,7 +213,7 @@
 	}
 
 	# remove C++ comments
-	while(s/^([^\"\/]*?(?:\"[^\"]*?\"[^\"]*?)*?)(\/\/.*?)$/$1/s) {
+	while(s/^([^\"\/]*?(?:\"(?:[^\\\"]*|\\.)*\"[^\"]*?)*?)(\/\/.*?)$/$1/s) {
 	    &$cplusplus_comment_found_callback($., $2);
 	    $again = 1;
 	}
@@ -652,7 +652,7 @@
 	    $output->write("$file: $.: can't parse: '$&'\n");
 	} elsif(/\'[^\']*\'/s) {
 	    $_ = $'; $again = 1;
-	} elsif(/\"[^\"]*\"/s) {
+	} elsif(/\"(?:[^\\\"]*|\\.)*\"/s) {
 	    $_ = $'; $again = 1;
 	} elsif(/;/s) {
 	    $_ = $'; $again = 1;


More information about the wine-patches mailing list