comdlg32: move GetFileTitle(A/W/16) to filedlg.c, filedlg16.c
(16Bit-Seperation)
Detlef Riekenberg
wine.dev at web.de
Thu Jan 11 17:05:58 CST 2007
dlls/comdlg32/filetitle.c implements only GetFileTitle
as ANSI, UNICODE and 16-Bit version.
Creating filetitle16.c for 3 lines of code is a bad Idea, so
move the Code to filedlg.c / filedlg16.c and delete the File.
Changelog:
comdlg32: move GetFileTitle(A/W/16) to filedlg.c, filedlg16.c
--
By by ... Detlef
-------------- next part --------------
>From 29d90ee0c160e13d12f28d1a92c5a4e3eed54b0f Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Thu, 11 Jan 2007 23:56:49 +0100
Subject: [PATCH] comdlg32: move GetFileTitle(A/W/16) to filedlg.c, filedlg16.c
---
dlls/comdlg32/Makefile.in | 1
dlls/comdlg32/filedlg.c | 80 +++++++++++++++++++++++++++++
dlls/comdlg32/filedlg16.c | 9 +++
dlls/comdlg32/filetitle.c | 126 ---------------------------------------------
4 files changed, 89 insertions(+), 127 deletions(-)
diff --git a/dlls/comdlg32/Makefile.in b/dlls/comdlg32/Makefile.in
index 35e180e..dded9a3 100644
--- a/dlls/comdlg32/Makefile.in
+++ b/dlls/comdlg32/Makefile.in
@@ -14,7 +14,6 @@ C_SRCS = \
filedlg.c \
filedlg31.c \
filedlgbrowser.c \
- filetitle.c \
finddlg32.c \
fontdlg.c \
printdlg.c
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 5fcdfd0..9030641 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -3914,3 +3914,83 @@ BOOL WINAPI GetSaveFileNameW(
else
return GetFileDialog95W(ofn, SAVE_DIALOG);
}
+
+/***********************************************************************
+ * GetFileTitleA (COMDLG32.@)
+ *
+ * See GetFileTitleW.
+ */
+short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, WORD cbBuf)
+{
+ int ret;
+ UNICODE_STRING strWFile;
+ LPWSTR lpWTitle;
+
+ RtlCreateUnicodeStringFromAsciiz(&strWFile, lpFile);
+ lpWTitle = RtlAllocateHeap( GetProcessHeap(), 0, cbBuf*sizeof(WCHAR));
+ ret = GetFileTitleW(strWFile.Buffer, lpWTitle, cbBuf);
+ if (!ret) WideCharToMultiByte( CP_ACP, 0, lpWTitle, -1, lpTitle, cbBuf, NULL, NULL );
+ RtlFreeUnicodeString( &strWFile );
+ RtlFreeHeap( GetProcessHeap(), 0, lpWTitle );
+ return ret;
+}
+
+
+/***********************************************************************
+ * GetFileTitleW (COMDLG32.@)
+ *
+ * Get the name of a file.
+ *
+ * PARAMS
+ * lpFile [I] name and location of file
+ * lpTitle [O] returned file name
+ * cbBuf [I] buffer size of lpTitle
+ *
+ * RETURNS
+ * Success: zero
+ * Failure: negative number.
+ */
+short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
+{
+ int i, len;
+ static const WCHAR brkpoint[] = {'*','[',']',0};
+ TRACE("(%p %p %d);\n", lpFile, lpTitle, cbBuf);
+
+ if(lpFile == NULL || lpTitle == NULL)
+ return -1;
+
+ len = strlenW(lpFile);
+
+ if (len == 0)
+ return -1;
+
+ if(strpbrkW(lpFile, brkpoint))
+ return -1;
+
+ len--;
+
+ if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
+ return -1;
+
+ for(i = len; i >= 0; i--)
+ {
+ if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')
+ {
+ i++;
+ break;
+ }
+ }
+
+ if(i == -1)
+ i++;
+
+ TRACE("---> '%s'\n", debugstr_w(&lpFile[i]));
+
+ len = strlenW(lpFile+i)+1;
+ if(cbBuf < len)
+ return len;
+
+ strcpyW(lpTitle, &lpFile[i]);
+ return 0;
+}
+
diff --git a/dlls/comdlg32/filedlg16.c b/dlls/comdlg32/filedlg16.c
index 8014609..4159f1d 100644
--- a/dlls/comdlg32/filedlg16.c
+++ b/dlls/comdlg32/filedlg16.c
@@ -513,3 +513,12 @@ BOOL16 WINAPI GetSaveFileName16(
TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile));
return bRet;
}
+
+
+/***********************************************************************
+ * GetFileTitle (COMMDLG.27)
+ */
+short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf)
+{
+ return GetFileTitleA(lpFile, lpTitle, cbBuf);
+}
diff --git a/dlls/comdlg32/filetitle.c b/dlls/comdlg32/filetitle.c
deleted file mode 100644
index 753285b..0000000
--- a/dlls/comdlg32/filetitle.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * COMMDLG - File Dialogs
- *
- * Copyright 1994 Martin Ayotte
- * Copyright 1996 Albrecht Kleine
- *
- * 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 <stdarg.h>
-#include <string.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "winnls.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "commdlg.h"
-#include "cdlg.h"
-#include "cdlg16.h"
-#include "wine/unicode.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
-
-/***********************************************************************
- * GetFileTitleA (COMDLG32.@)
- *
- * See GetFileTitleW.
- */
-short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, WORD cbBuf)
-{
- int ret;
- UNICODE_STRING strWFile;
- LPWSTR lpWTitle;
-
- RtlCreateUnicodeStringFromAsciiz(&strWFile, lpFile);
- lpWTitle = RtlAllocateHeap( GetProcessHeap(), 0, cbBuf*sizeof(WCHAR));
- ret = GetFileTitleW(strWFile.Buffer, lpWTitle, cbBuf);
- if (!ret) WideCharToMultiByte( CP_ACP, 0, lpWTitle, -1, lpTitle, cbBuf, NULL, NULL );
- RtlFreeUnicodeString( &strWFile );
- RtlFreeHeap( GetProcessHeap(), 0, lpWTitle );
- return ret;
-}
-
-
-/***********************************************************************
- * GetFileTitleW (COMDLG32.@)
- *
- * Get the name of a file.
- *
- * PARAMS
- * lpFile [I] name and location of file
- * lpTitle [O] returned file name
- * cbBuf [I] buffer size of lpTitle
- *
- * RETURNS
- * Success: zero
- * Failure: negative number.
- */
-short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
-{
- int i, len;
- static const WCHAR brkpoint[] = {'*','[',']',0};
- TRACE("(%p %p %d);\n", lpFile, lpTitle, cbBuf);
-
- if(lpFile == NULL || lpTitle == NULL)
- return -1;
-
- len = strlenW(lpFile);
-
- if (len == 0)
- return -1;
-
- if(strpbrkW(lpFile, brkpoint))
- return -1;
-
- len--;
-
- if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
- return -1;
-
- for(i = len; i >= 0; i--)
- {
- if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')
- {
- i++;
- break;
- }
- }
-
- if(i == -1)
- i++;
-
- TRACE("---> '%s'\n", debugstr_w(&lpFile[i]));
-
- len = strlenW(lpFile+i)+1;
- if(cbBuf < len)
- return len;
-
- strcpyW(lpTitle, &lpFile[i]);
- return 0;
-}
-
-
-/***********************************************************************
- * GetFileTitle (COMMDLG.27)
- */
-short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf)
-{
- return GetFileTitleA(lpFile, lpTitle, cbBuf);
-}
--
1.4.1
More information about the wine-patches
mailing list