Alexandre Julliard : winefile: Build with msvcrt.

Alexandre Julliard julliard at winehq.org
Thu May 2 16:45:08 CDT 2019


Module: wine
Branch: master
Commit: 9c6f2e2d88af4290ceb37f32920b14c0a389fa43
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9c6f2e2d88af4290ceb37f32920b14c0a389fa43

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May  2 11:01:24 2019 +0200

winefile: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/winefile/Makefile.in |  4 +-
 programs/winefile/splitpath.c | 92 -------------------------------------------
 programs/winefile/winefile.c  | 25 +++++-------
 programs/winefile/winefile.h  | 34 ----------------
 4 files changed, 11 insertions(+), 144 deletions(-)

diff --git a/programs/winefile/Makefile.in b/programs/winefile/Makefile.in
index ae8a144..469074a 100644
--- a/programs/winefile/Makefile.in
+++ b/programs/winefile/Makefile.in
@@ -1,9 +1,9 @@
 MODULE    = winefile.exe
-APPMODE   = -mwindows -municode
 IMPORTS   = uuid shell32 comdlg32 comctl32 ole32 mpr version user32 gdi32 advapi32 shlwapi
 
+EXTRADLLFLAGS = -mwindows -municode -mno-cygwin
+
 C_SRCS = \
-	splitpath.c \
 	winefile.c
 
 RC_SRCS = winefile.rc
diff --git a/programs/winefile/splitpath.c b/programs/winefile/splitpath.c
deleted file mode 100644
index 20d7ded..0000000
--- a/programs/winefile/splitpath.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2000, 2004 Martin Fuchs
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "winefile.h"
-
-
-void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext)
-{
-        const WCHAR* end; /* end of processed string */
-	const WCHAR* p;	  /* search pointer */
-	const WCHAR* s;	  /* copy pointer */
-
-	/* extract drive name */
-	if (path[0] && path[1]==':') {
-		if (drv) {
-			*drv++ = *path++;
-			*drv++ = *path++;
-			*drv = '\0';
-		}
-	} else if (drv)
-		*drv = '\0';
-
-        end = path + lstrlenW(path);
-
-	/* search for begin of file extension */
-	for(p=end; p>path && *--p!='\\' && *p!='/'; )
-		if (*p == '.') {
-			end = p;
-			break;
-		}
-
-	if (ext)
-		for(s=end; (*ext=*s++); )
-			ext++;
-
-	/* search for end of directory name */
-	for(p=end; p>path; )
-		if (*--p=='\\' || *p=='/') {
-			p++;
-			break;
-		}
-
-	if (name) {
-		for(s=p; s<end; )
-			*name++ = *s++;
-
-		*name = '\0';
-	}
-
-	if (dir) {
-		for(s=path; s<p; )
-			*dir++ = *s++;
-
-		*dir = '\0';
-	}
-}
-
-
-/*
-void main()	// test splipath()
-{
-	WCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
-
-	_wsplitpath(L"x\\y", drv, dir, name, ext);
-	_wsplitpath(L"x\\", drv, dir, name, ext);
-	_wsplitpath(L"\\x", drv, dir, name, ext);
-	_wsplitpath(L"x", drv, dir, name, ext);
-	_wsplitpath(L"", drv, dir, name, ext);
-	_wsplitpath(L".x", drv, dir, name, ext);
-	_wsplitpath(L":x", drv, dir, name, ext);
-	_wsplitpath(L"a:x", drv, dir, name, ext);
-	_wsplitpath(L"a.b:x", drv, dir, name, ext);
-	_wsplitpath(L"W:\\/\\abc/Z:~", drv, dir, name, ext);
-	_wsplitpath(L"abc.EFGH:12345", drv, dir, name, ext);
-	_wsplitpath(L"C:/dos/command.com", drv, dir, name, ext);
-}
-*/
diff --git a/programs/winefile/winefile.c b/programs/winefile/winefile.c
index eb03ea3..d69cbcb 100644
--- a/programs/winefile/winefile.c
+++ b/programs/winefile/winefile.c
@@ -21,17 +21,10 @@
 
 #define COBJMACROS
 
+#include <assert.h>
+#include <stdio.h>
 #include "winefile.h"
 #include "resource.h"
-#include "wine/unicode.h"
-
-#ifndef _MAX_PATH
-#define _MAX_DRIVE          3
-#define _MAX_FNAME          256
-#define _MAX_DIR            _MAX_FNAME
-#define _MAX_EXT            _MAX_FNAME
-#define _MAX_PATH           260
-#endif
 
 #ifdef NONAMELESSUNION
 #define	UNION_MEMBER(x) DUMMYUNIONNAME.x
@@ -887,8 +880,8 @@ static int compareExt(const void* arg1, const void* arg2)
 	name1 = fd1->cFileName;
 	name2 = fd2->cFileName;
 
-	ext1 = strrchrW(name1, '.');
-	ext2 = strrchrW(name2, '.');
+	ext1 = wcsrchr(name1, '.');
+	ext2 = wcsrchr(name2, '.');
 
 	if (ext1)
 		ext1++;
@@ -1108,7 +1101,7 @@ static ChildWnd* alloc_child_window(LPCWSTR path, LPITEMIDLIST pidl, HWND hwnd)
 
 	if (path)
 	{
-		int pathlen = strlenW(path);
+		int pathlen = lstrlenW(path);
 		const WCHAR *npath = path;
 
 		if (path[0] == '"' && path[pathlen - 1] == '"')
@@ -1560,7 +1553,7 @@ static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCWSTR st
 					VS_FIXEDFILEINFO* pFixedFileInfo = (VS_FIXEDFILEINFO*)pVal;
                                         WCHAR buffer[BUFFER_LEN];
 
-                                        sprintfW(buffer, sFmt,
+                                        swprintf(buffer, ARRAY_SIZE(buffer), sFmt,
                                                  HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS),
                                                  HIWORD(pFixedFileInfo->dwFileVersionLS), LOWORD(pFixedFileInfo->dwFileVersionLS));
 
@@ -2614,7 +2607,7 @@ static BOOL is_registered_type(LPCWSTR ext)
 
 static enum FILE_TYPE get_file_type(LPCWSTR filename)
 {
-	LPCWSTR ext = strrchrW(filename, '.');
+	LPCWSTR ext = wcsrchr(filename, '.');
 	if (!ext)
 		ext = sEmpty;
 
@@ -3519,7 +3512,7 @@ static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParen
 static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
 	ChildWnd* child = (ChildWnd*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
-	ASSERT(child);
+	assert(child);
 
 	switch(nmsg) {
 		case WM_DRAWITEM: {
@@ -3849,7 +3842,7 @@ static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
 {
 	ChildWnd* child = (ChildWnd*)GetWindowLongPtrW(GetParent(hwnd), GWLP_USERDATA);
 	Pane* pane = (Pane*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
-	ASSERT(child);
+	assert(child);
 
 	switch(nmsg) {
 		case WM_HSCROLL:
diff --git a/programs/winefile/winefile.h b/programs/winefile/winefile.h
index 1ce3d4c..eac2ff0 100644
--- a/programs/winefile/winefile.h
+++ b/programs/winefile/winefile.h
@@ -16,25 +16,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#define WIN32_LEAN_AND_MEAN
-#define WIN32_EXTRA_LEAN
-#define NOSERVICE
-#define NOMCX
-#define NOIME
-#define NOCOMM
-#define NOKANJI
-#define NORPC
-#define NOPROXYSTUB
-#define NOIMAGE
-#define NOTAPE
-
 #include <windows.h>
 #include <commdlg.h>
-
-#ifdef UNICODE
-#define _UNICODE
-#endif
-
 #include <locale.h>
 #include <time.h>
 
@@ -42,23 +25,8 @@
 #include <shellapi.h>   /* for ShellExecuteW() */
 #include <shlobj.h>
 
-#ifndef FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
-#define FILE_ATTRIBUTE_ENCRYPTED            0x00000040
-#define FILE_ATTRIBUTE_SPARSE_FILE          0x00000200
-#define FILE_ATTRIBUTE_REPARSE_POINT        0x00000400
-#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED  0x00002000
-#endif
-
-
-#ifdef  _DEBUG
-#define ASSERT(x)   {if (!(x)) DebugBreak();}
-#else
-#define ASSERT(x)   /* nothing */
-#endif
-
 #define BUFFER_LEN  1024
 
-
 enum IMAGE {
     IMG_NONE=-1,    IMG_FILE=0,         IMG_DOCUMENT,   IMG_EXECUTABLE,
     IMG_FOLDER,     IMG_OPEN_FOLDER,    IMG_FOLDER_PLUS,IMG_OPEN_PLUS,  IMG_OPEN_MINUS,
@@ -129,5 +97,3 @@ typedef struct
 } WINEFILE_GLOBALS;
 
 extern WINEFILE_GLOBALS Globals;
-
-extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);




More information about the wine-cvs mailing list