QT_WA/QT_WA_INLINE and ANSI/Unicode functions

Chris January chris at atomice.net
Fri Nov 12 17:57:58 CET 2004


I knocked together a simple Perl script to detect where we are using Windows
functions that have ...A and ...W endings without using the QT_WA and
QT_WA_INLINE macros.

The results are below. Note in particular the use of CreateWindowW which
fails on Windows 98 and so prevents even simply applications like
examples/hello from working.

./dialogs/qfiledialog_win.cpp: GetOpenFileNameW
./dialogs/qfiledialog_win.cpp: GetOpenFileNameW
./dialogs/qfiledialog_win.cpp: GetSaveFileNameW
./dialogs/qfiledialog_win.cpp: SHBrowseForFolderW
./kernel/qapplication_win.cpp: SystemParametersInfoW
./kernel/qapplication_win.cpp: GetObjectW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: DefWindowProcW
./kernel/qapplication_win.cpp: LoadImageW
./kernel/qapplication_win.cpp: LoadImageW
./kernel/qapplication_win.cpp: LoadCursorW
./kernel/qapplication_win.cpp: LoadIconW
./kernel/qapplication_win.cpp: LoadIconW
./kernel/qapplication_win.cpp: RegisterClassExW
./kernel/qapplication_win.cpp: LoadCursorW
./kernel/qapplication_win.cpp: RegisterClassExW
./kernel/qapplication_win.cpp: GetCommandLineW
./kernel/qeventloop_win.cpp: DefWindowProcW
./kernel/qpainter_win.cpp: ExtTextOutW
./kernel/qpainter_win.cpp: ExtTextOutW
./kernel/qpixmap_win.cpp: GetObjectW
./kernel/qpixmap_win.cpp: ExtTextOutW
./kernel/qpixmap_win.cpp: GetObjectW
./kernel/qpixmap_win.cpp: GetObjectW
./kernel/qpixmap_win.cpp: GetObjectW
./kernel/qpixmap_win.cpp: GetObjectW
./kernel/qprinter_win.cpp: PrintDlgW
./kernel/qwidget_win.cpp: GetObjectW
./kernel/qwidget_win.cpp: SystemParametersInfoW
./kernel/qwidget_win.cpp: CreateWindowExW
./kernel/qwidget_win.cpp: SetWindowLongW
./kernel/qwidget_win.cpp: SetWindowLongW
./kernel/qwidget_win.cpp: SetWindowTextW
./kernel/qwidget_win.cpp: ExtTextOutW
./tools/qdir_win.cpp: GetEnvironmentVariableW
./tools/qdir_win.cpp: GetEnvironmentVariableW
./tools/qfileinfo_win.cpp: GetFileAttributesW

---

#!/usr/bin/env perl

$QTDIR=$ENV{'QTDIR'};

foreach $filename (@ARGV) {
	$text = `cpp $filename -I "$QTDIR/include" -D __GNUC__ -D_UNICODE
-DUNICODE 2>/dev/null`;
	$text =~
s/QT_WA\s*\(\s*[a-zA-Z0-9]{4,}W\s*\(.*?,\s*[a-zA-Z0-9]{4,}A\s*\(.*?\)//sg;
	$text =~
s/QT_WA_INLINE\s*\(\s*[a-zA-Z0-9]{4,}W\s*\(.*?,\s*[a-zA-Z0-9]{4,}A\s*\(.*?\)
//sg;
	$text =~ s/# [0-9]+ "[^"]+\.h" [0-9]+.*?# [0-9]+ "[^"]+\.cpp"
[0-9]+//sg;
	while ($text =~ /([a-zA-Z0-9]{4,}A)\s*\(.*?\)/gs) {
		print "$filename: $1\n";
	}
}



More information about the kde-cygwin mailing list