From 78e74249014b152b93dae07bf194b16769016ad0 Mon Sep 17 00:00:00 2001 From: David Fries Date: Mon, 14 Jun 2010 13:57:46 +0200 Subject: fix detection of header files Disable the include generation iff a dot which is not followed by [hH] is found after the last path separator. This implies that dots in directory names are now ignored, and that files without an extension are always considered headers (e.g., STL headers and Qt forwarding headers). Task-number: QTBUG-11369 Merge-request: 686 Reviewed-by: Oswald Buddenhagen --- src/tools/moc/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/tools') diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index ebe1834a5a..499769041f 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -359,11 +359,10 @@ int runMoc(int _argc, char **_argv) if (autoInclude) { + int spos = filename.lastIndexOf(QDir::separator().toLatin1()); int ppos = filename.lastIndexOf('.'); - moc.noInclude = (ppos >= 0 - && tolower(filename[ppos + 1]) != 'h' - && tolower(filename[ppos + 1]) != QDir::separator().toLatin1() - ); + // spos >= -1 && ppos > spos => ppos >= 0 + moc.noInclude = (ppos > spos && tolower(filename[ppos + 1]) != 'h'); } if (moc.includeFiles.isEmpty()) { if (moc.includePath.isEmpty()) { -- cgit v1.2.3