Author: dreimer
Date: Thu Jan 8 08:07:10 2009
New Revision: 38642
URL:
http://svn.reactos.org/svn/reactos?rev=38642&view=rev
Log:
Sync to Wine HEAD. Done with my first try of a autosync script for the normal apps.
Modified:
trunk/rosapps/applications/winfile/winefile.c
trunk/rosapps/applications/winfile/winefile.h
Modified: trunk/rosapps/applications/winfile/winefile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/winfile/winef…
==============================================================================
--- trunk/rosapps/applications/winfile/winefile.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/winfile/winefile.c [iso-8859-1] Thu Jan 8 08:07:10 2009
@@ -33,6 +33,7 @@
#include "winefile.h"
#include "resource.h"
+#include "wine/unicode.h"
#ifdef _NO_EXTENSIONS
#undef _LEFT_FILES
@@ -196,8 +197,17 @@
static const TCHAR sWINEFILEFRAME[] =
{'W','F','S','_','F','r','a','m','e','\0'};
static const TCHAR sWINEFILETREE[] =
{'W','F','S','_','T','r','e','e','\0'};
-static const TCHAR sLongHexFmt[] =
{'%','I','6','4','X','\0'};
-static const TCHAR sLongNumFmt[] =
{'%','I','6','4','u','\0'};
+static void format_longlong(LPWSTR ret, ULONGLONG val)
+{
+ WCHAR buffer[65], *p = &buffer[64];
+
+ *p = 0;
+ do {
+ *(--p) = '0' + val % 10;
+ val /= 10;
+ } while (val);
+ lstrcpyW( ret, p );
+}
/* load resource string */
@@ -299,52 +309,6 @@
ReleaseDC(hwnd, hdc);
}
-#ifdef __WINE__
-
-#ifdef UNICODE
-
-/* call vswprintf() in msvcrt.dll */
-/*TODO: fix swprintf() in non-msvcrt mode, so that this dynamic linking function can be
removed */
-static int msvcrt_swprintf(WCHAR* buffer, const WCHAR* fmt, ...)
-{
- static int (__cdecl *pvswprintf)(WCHAR*, const WCHAR*, va_list) = NULL;
- va_list ap;
- int ret;
-
- if (!pvswprintf) {
- HMODULE hModMsvcrt = LoadLibraryA("msvcrt");
- pvswprintf = (int(__cdecl*)(WCHAR*,const WCHAR*,va_list)) GetProcAddress(hModMsvcrt,
"vswprintf");
- }
-
- va_start(ap, fmt);
- ret = (*pvswprintf)(buffer, fmt, ap);
- va_end(ap);
-
- return ret;
-}
-
-static LPCWSTR my_wcsrchr(LPCWSTR str, WCHAR c)
-{
- LPCWSTR p = str;
-
- while(*p)
- ++p;
-
- do {
- if (--p < str)
- return NULL;
- } while(*p != c);
-
- return p;
-}
-
-#define _tcsrchr my_wcsrchr
-#else /* UNICODE */
-#define _tcsrchr strrchr
-#endif /* UNICODE */
-
-#endif /* __WINE__ */
-
/* allocate and initialise a directory entry */
static Entry* alloc_entry(void)
@@ -1219,8 +1183,8 @@
name1 = fd1->cFileName;
name2 = fd2->cFileName;
- ext1 = _tcsrchr(name1, '.');
- ext2 = _tcsrchr(name2, '.');
+ ext1 = strrchrW(name1, '.');
+ ext2 = strrchrW(name2, '.');
if (ext1)
ext1++;
@@ -2032,7 +1996,6 @@
static const TCHAR sByteFmt[] = {'%','s','
','B','y','t','e','s','\0'};
TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
LPWIN32_FIND_DATA pWFD;
- ULONGLONG size;
dlg = (struct PropertiesDialog*) lparam;
pWFD = (LPWIN32_FIND_DATA) &dlg->entry.data;
@@ -2044,8 +2007,7 @@
format_date(&pWFD->ftLastWriteTime, b1, COL_DATE|COL_TIME);
SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_LASTCHANGE), b1);
- size = ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow;
- _stprintf(b1, sLongNumFmt, size);
+ format_longlong( b1, ((ULONGLONG)pWFD->nFileSizeHigh <<
32) | pWFD->nFileSizeLow );
wsprintf(b2, sByteFmt, b1);
SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2);
@@ -2907,17 +2869,18 @@
static const TCHAR sFmtGB[] = {'%', '.', '1', 'f', '
', 'G', 'B', '\0'};
static const TCHAR sFmtMB[] = {'%', '.', '1', 'f', '
', 'M', 'B', '\0'};
static const TCHAR sFmtkB[] = {'%', '.', '1', 'f', '
', 'k', 'B', '\0'};
+ static const TCHAR sFmtB[] = {'%', 'u', 0};
float fBytes = (float)bytes;
if (bytes >= 1073741824) /* 1 GB */
- _stprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f);
+ sprintfW(buffer, sFmtGB, fBytes/1073741824.f+.5f);
else if (bytes >= 1048576) /* 1 MB */
- _stprintf(buffer, sFmtMB, fBytes/1048576.f+.5f);
+ sprintfW(buffer, sFmtMB, fBytes/1048576.f+.5f);
else if (bytes >= 1024) /* 1 kB */
- _stprintf(buffer, sFmtkB, fBytes/1024.f+.5f);
+ sprintfW(buffer, sFmtkB, fBytes/1024.f+.5f);
else
- _stprintf(buffer, sLongNumFmt, bytes);
+ sprintfW(buffer, sFmtB, (DWORD)bytes);
}
static void set_space_status(void)
@@ -3141,7 +3104,7 @@
static enum FILE_TYPE get_file_type(LPCTSTR filename)
{
- LPCTSTR ext = _tcsrchr(filename, '.');
+ LPCTSTR ext = strrchrW(filename, '.');
if (!ext)
ext = sEmpty;
@@ -3354,11 +3317,7 @@
if (!(attrs&FILE_ATTRIBUTE_DIRECTORY))
#endif
{
- ULONGLONG size;
-
- size = ((ULONGLONG)entry->data.nFileSizeHigh << 32) |
entry->data.nFileSizeLow;
-
- _stprintf(buffer, sLongNumFmt, size);
+ format_longlong( buffer, ((ULONGLONG)entry->data.nFileSizeHigh << 32) |
entry->data.nFileSizeLow );
if (calcWidthCol == -1)
output_number(pane, dis, col, buffer);
@@ -3397,10 +3356,15 @@
#ifndef _NO_EXTENSIONS
if (entry->bhfi_valid) {
- ULONGLONG index = ((ULONGLONG)entry->bhfi.nFileIndexHigh << 32) |
entry->bhfi.nFileIndexLow;
-
if (visible_cols & COL_INDEX) {
- _stprintf(buffer, sLongHexFmt, index);
+ static const TCHAR fmtlow[] = {'%','X',0};
+ static const TCHAR fmthigh[] =
{'%','X','%','0','8','X',0};
+
+ if (entry->bhfi.nFileIndexHigh)
+ wsprintf(buffer, fmthigh,
+ entry->bhfi.nFileIndexHigh,
entry->bhfi.nFileIndexLow );
+ else
+ wsprintf(buffer, fmtlow, entry->bhfi.nFileIndexLow );
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, DT_RIGHT);
Modified: trunk/rosapps/applications/winfile/winefile.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/winfile/winef…
==============================================================================
--- trunk/rosapps/applications/winfile/winefile.h [iso-8859-1] (original)
+++ trunk/rosapps/applications/winfile/winefile.h [iso-8859-1] Thu Jan 8 08:07:10 2009
@@ -150,11 +150,9 @@
#ifdef UNICODE
extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR*
ext);
#define _tsplitpath _wsplitpath
-#define _stprintf msvcrt_swprintf
#else
extern void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
#define _tsplitpath _splitpath
-#define _stprintf sprintf
#endif
#else