Alexandre Julliard : shell32: Store the raw AUTHORS file in resources instead of trying to convert to a C array .

Alexandre Julliard julliard at winehq.org
Thu Nov 11 12:05:49 CST 2010


Module: wine
Branch: master
Commit: 40977bf1d2f0f11a24fd9330dffac264fced2306
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=40977bf1d2f0f11a24fd9330dffac264fced2306

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Nov 11 12:24:46 2010 +0100

shell32: Store the raw AUTHORS file in resources instead of trying to convert to a C array.

---

 .gitignore                  |    1 +
 Makefile.in                 |    2 ++
 configure                   |    3 +++
 configure.ac                |    1 +
 dlls/shell32/.gitignore     |    1 -
 dlls/shell32/Makefile.in    |   10 ----------
 dlls/shell32/shell32_main.c |   39 +++++++++++++++++++++++++++++----------
 dlls/shell32/shres.rc       |    3 +++
 tools/make_makefiles        |    1 +
 9 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/.gitignore b/.gitignore
index c15e617..b57ea54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,6 +135,7 @@ dlls/rpcrt4/tests/server.h
 dlls/rpcrt4/tests/server_c.c
 dlls/rpcrt4/tests/server_s.c
 dlls/shdocvw/shdocvw_v1.tlb
+dlls/shell32/AUTHORS
 dlls/stdole2.tlb/std_ole_v2.tlb
 dlls/stdole32.tlb/std_ole_v1.tlb
 dlls/sti/sti_wia.h
diff --git a/Makefile.in b/Makefile.in
index f8d760d..eec29bc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -73,6 +73,8 @@ tools/wmc tools/wrc: tools
 tools tools/wmc tools/wrc: libs/wine
 tools/widl tools/wmc tools/wrc: libs/wpp
 
+dlls/shell32/Makefile dlls/shell32/__depend__: dlls/shell32/AUTHORS
+
 $(MAKEDEP): include/config.h tools/Makefile
 	@cd $(TOOLSDIR)/tools && $(MAKE) makedep$(TOOLSEXT)
 
diff --git a/configure b/configure
index 4d89bd8..9b1cb22 100755
--- a/configure
+++ b/configure
@@ -14569,6 +14569,8 @@ then
 "crosstest:
 	@echo \"crosstest is not supported (mingw not installed?)\" && false"
 fi
+ac_config_links="$ac_config_links dlls/shell32/AUTHORS:AUTHORS"
+wine_fn_config_symlink dlls/shell32/AUTHORS
 ac_config_links="$ac_config_links dlls/wineps.drv/generic.ppd:dlls/wineps.drv/generic.ppd"
 test "$srcdir" = "." || wine_fn_config_symlink dlls/wineps.drv/generic.ppd
 if test "x$enable_fonts" != xno; then
@@ -15962,6 +15964,7 @@ do
   case $ac_config_target in
     "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
     "include/stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/stamp-h" ;;
+    "dlls/shell32/AUTHORS") CONFIG_LINKS="$CONFIG_LINKS dlls/shell32/AUTHORS:AUTHORS" ;;
     "dlls/wineps.drv/generic.ppd") CONFIG_LINKS="$CONFIG_LINKS dlls/wineps.drv/generic.ppd:dlls/wineps.drv/generic.ppd" ;;
     "fonts/marlett.ttf") CONFIG_LINKS="$CONFIG_LINKS fonts/marlett.ttf:fonts/marlett.ttf" ;;
     "fonts/symbol.ttf") CONFIG_LINKS="$CONFIG_LINKS fonts/symbol.ttf:fonts/symbol.ttf" ;;
diff --git a/configure.ac b/configure.ac
index f0ebc03..04ed14f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2263,6 +2263,7 @@ AH_BOTTOM([#endif /* WINE_CROSSTEST */])
 
 AC_CONFIG_COMMANDS([include/stamp-h], [echo timestamp > include/stamp-h])
 
+WINE_CONFIG_SYMLINK(dlls/shell32/AUTHORS,AUTHORS)
 WINE_CONFIG_SYMLINK(dlls/wineps.drv/generic.ppd)
 WINE_CONFIG_SYMLINK(fonts/marlett.ttf,,enable_fonts)
 WINE_CONFIG_SYMLINK(fonts/symbol.ttf,,enable_fonts)
diff --git a/dlls/shell32/.gitignore b/dlls/shell32/.gitignore
deleted file mode 100644
index a6683e2..0000000
--- a/dlls/shell32/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/authors.c
diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in
index a101c75..1997c01 100644
--- a/dlls/shell32/Makefile.in
+++ b/dlls/shell32/Makefile.in
@@ -106,14 +106,4 @@ SVG_SRCS = \
 	shortcut.svg \
 	trash_file.svg
 
-EXTRA_OBJS = authors.o
-
 @MAKE_DLL_RULES@
-
-authors.c: $(top_srcdir)/AUTHORS
-	(LC_ALL=C; export LC_ALL; echo 'const char * const SHELL_Authors[] = {' && \
-	 sed -e '1,2d' -e 's/\(.*\)/  \"\1\",/' $(top_srcdir)/AUTHORS && \
-	 echo '  0 };') >$@ || ($(RM) $@ && false)
-
-clean::
-	$(RM) authors.c
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 7d78ab5..227b63e 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -51,8 +51,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
-extern const char * const SHELL_Authors[];
-
 /*************************************************************************
  * CommandLineToArgvW            [SHELL32.@]
  *
@@ -932,6 +930,34 @@ HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
     return DISP_E_MEMBERNOTFOUND;
 }
 
+static void add_authors( HWND list )
+{
+    static const WCHAR eol[] = {'\r','\n',0};
+    static const WCHAR authors[] = {'A','U','T','H','O','R','S',0};
+    WCHAR *strW, *start, *end;
+    HRSRC rsrc = FindResourceW( shell32_hInstance, authors, (LPCWSTR)RT_RCDATA );
+    char *strA = LockResource( LoadResource( shell32_hInstance, rsrc ));
+    DWORD sizeW, sizeA = SizeofResource( shell32_hInstance, rsrc );
+
+    if (!strA) return;
+    sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1;
+    if (!(strW = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) ))) return;
+    MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW );
+    strW[sizeW - 1] = 0;
+
+    start = strpbrkW( strW, eol );  /* skip the header line */
+    while (start)
+    {
+        while (*start && strchrW( eol, *start )) start++;
+        if (!*start) break;
+        end = strpbrkW( start, eol );
+        if (end) *end++ = 0;
+        SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
+        start = end;
+    }
+    HeapFree( GetProcessHeap(), 0, strW );
+}
+
 /*************************************************************************
  * AboutDlgProc            (internal)
  */
@@ -952,7 +978,6 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
 
             if (info)
             {
-                const char* const *pstr = SHELL_Authors;
                 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
                 GetWindowTextW( hWnd, template, sizeof(template)/sizeof(WCHAR) );
                 sprintfW( buffer, template, info->szApp );
@@ -968,13 +993,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
                 hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX);
                 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
                 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
-                while (*pstr)
-                {
-                    /* authors list is in utf-8 format */
-                    MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, buffer, sizeof(buffer)/sizeof(WCHAR) );
-                    SendMessageW( hWndCtl, LB_ADDSTRING, -1, (LPARAM)buffer );
-                    pstr++;
-                }
+                add_authors( hWndCtl );
                 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
             }
         }
diff --git a/dlls/shell32/shres.rc b/dlls/shell32/shres.rc
index 11cc344..6ff4d98 100644
--- a/dlls/shell32/shres.rc
+++ b/dlls/shell32/shres.rc
@@ -125,3 +125,6 @@ IDR_AVI_FILENUKE AVI searching.avi
 
 /* @makedep: searching.avi */
 IDR_AVI_FILEDELETE AVI searching.avi
+
+/* @makedep: AUTHORS */
+AUTHORS RCDATA AUTHORS
diff --git a/tools/make_makefiles b/tools/make_makefiles
index 4673fea..7084258 100755
--- a/tools/make_makefiles
+++ b/tools/make_makefiles
@@ -90,6 +90,7 @@ my @ignores = (
     "Makefile",
     "dlldata.c",
     "dlls/*/*.def",
+    "dlls/shell32/AUTHORS",
     "*/*/tests/*crosstest.exe",
     "*/*/tests/testlist.c",
     "include/config.h",




More information about the wine-cvs mailing list