Alexandre Julliard : kernel32: Remove time.c.

Alexandre Julliard julliard at winehq.org
Tue May 26 17:17:07 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue May 26 14:51:16 2020 +0200

kernel32: Remove time.c.

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

---

 dlls/kernel32/Makefile.in      |   1 -
 dlls/kernel32/kernel_private.h |   2 -
 dlls/kernel32/lcformat.c       |  36 ++++++++++-
 dlls/kernel32/locale.c         |  11 ++++
 dlls/kernel32/sync.c           |  29 +++++++++
 dlls/kernel32/time.c           | 135 -----------------------------------------
 6 files changed, 75 insertions(+), 139 deletions(-)

diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in
index 801d8dd7fc..28a15f8bbe 100644
--- a/dlls/kernel32/Makefile.in
+++ b/dlls/kernel32/Makefile.in
@@ -29,7 +29,6 @@ C_SRCS = \
 	tape.c \
 	term.c \
 	thread.c \
-	time.c \
 	toolhelp.c \
 	version.c \
 	virtual.c \
diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h
index 7c1d548ff1..bcf2ee9a52 100644
--- a/dlls/kernel32/kernel_private.h
+++ b/dlls/kernel32/kernel_private.h
@@ -64,8 +64,6 @@ extern void FILE_SetDosError(void) DECLSPEC_HIDDEN;
 extern WCHAR *FILE_name_AtoW( LPCSTR name, BOOL alloc ) DECLSPEC_HIDDEN;
 extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ) DECLSPEC_HIDDEN;
 
-extern BOOL NLS_IsUnicodeOnlyLcid(LCID) DECLSPEC_HIDDEN;
-
 /* computername.c */
 extern void COMPUTERNAME_Init(void) DECLSPEC_HIDDEN;
 
diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c
index 165cb07dd4..91fab3dc45 100644
--- a/dlls/kernel32/lcformat.c
+++ b/dlls/kernel32/lcformat.c
@@ -320,7 +320,7 @@ static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
  *
  * Determine if a locale is Unicode only, and thus invalid in ASCII calls.
  */
-BOOL NLS_IsUnicodeOnlyLcid(LCID lcid)
+static BOOL NLS_IsUnicodeOnlyLcid(LCID lcid)
 {
   lcid = ConvertDefaultLocale(lcid);
 
@@ -1767,3 +1767,37 @@ int WINAPI GetCurrencyFormatEx(LPCWSTR localename, DWORD flags, LPCWSTR value,
 
     return GetCurrencyFormatW( LocaleNameToLCID(localename, 0), flags, value, format, str, len);
 }
+
+/*********************************************************************
+ *            GetCalendarInfoA (KERNEL32.@)
+ */
+int WINAPI GetCalendarInfoA( LCID lcid, CALID id, CALTYPE type, LPSTR data, int size, DWORD *val )
+{
+    int ret, sizeW = size;
+    LPWSTR dataW = NULL;
+
+    if (NLS_IsUnicodeOnlyLcid(lcid))
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+    if (!size && !(type & CAL_RETURN_NUMBER)) sizeW = GetCalendarInfoW( lcid, id, type, NULL, 0, NULL );
+    if (!(dataW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR)))) return 0;
+
+    ret = GetCalendarInfoW( lcid, id, type, dataW, sizeW, val );
+    if(ret && dataW && data)
+        ret = WideCharToMultiByte( CP_ACP, 0, dataW, -1, data, size, NULL, NULL );
+    else if (type & CAL_RETURN_NUMBER)
+        ret *= sizeof(WCHAR);
+    HeapFree( GetProcessHeap(), 0, dataW );
+    return ret;
+}
+
+/*********************************************************************
+ *            SetCalendarInfoA (KERNEL32.@)
+ */
+int WINAPI SetCalendarInfoA( LCID lcid, CALID id, CALTYPE type, LPCSTR data)
+{
+    FIXME("(%08x,%08x,%08x,%s): stub\n", lcid, id, type, debugstr_a(data));
+    return 0;
+}
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 58389f6697..0ca4f39d26 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -172,6 +172,17 @@ BOOL WINAPI GetCPInfoExA( UINT codepage, DWORD dwFlags, LPCPINFOEXA cpinfo )
     return TRUE;
 }
 
+
+/*********************************************************************
+ *              GetDaylightFlag   (KERNEL32.@)
+ */
+BOOL WINAPI GetDaylightFlag(void)
+{
+    TIME_ZONE_INFORMATION tzinfo;
+    return GetTimeZoneInformation( &tzinfo) == TIME_ZONE_ID_DAYLIGHT;
+}
+
+
 /***********************************************************************
  *              EnumSystemCodePagesA   (KERNEL32.@)
  */
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index d0301e484d..4032315750 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -49,6 +49,9 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(sync);
 
+static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000;
+
+
 static void get_create_object_attributes( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nameW,
                                           SECURITY_ATTRIBUTES *sa, const WCHAR *name )
 {
@@ -100,6 +103,32 @@ static HANDLE normalize_handle_if_console(HANDLE handle)
     return handle;
 }
 
+/******************************************************************************
+ *           GetTickCount64       (KERNEL32.@)
+ */
+ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
+{
+    ULONG high, low;
+
+    do
+    {
+        high = user_shared_data->u.TickCount.High1Time;
+        low = user_shared_data->u.TickCount.LowPart;
+    }
+    while (high != user_shared_data->u.TickCount.High2Time);
+    /* note: we ignore TickCountMultiplier */
+    return (ULONGLONG)high << 32 | low;
+}
+
+/***********************************************************************
+ *           GetTickCount       (KERNEL32.@)
+ */
+DWORD WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
+{
+    /* note: we ignore TickCountMultiplier */
+    return user_shared_data->u.TickCount.LowPart;
+}
+
 /***********************************************************************
  *           RegisterWaitForSingleObject   (KERNEL32.@)
  */
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
deleted file mode 100644
index 94ccbfb2b9..0000000000
--- a/dlls/kernel32/time.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Win32 kernel time functions
- *
- * Copyright 1995 Martin von Loewis and Cameron Heide
- *
- * 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 "config.h"
-
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#include <stdarg.h>
-#include <stdlib.h>
-#include <time.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-
-#include "ntstatus.h"
-#define WIN32_NO_STATUS
-#define NONAMELESSUNION
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "ddk/wdm.h"
-#include "kernel_private.h"
-#include "wine/unicode.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(time);
-
-static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000;
-
-
-/*********************************************************************
- *	GetCalendarInfoA				(KERNEL32.@)
- *
- */
-int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType,
-			    LPSTR lpCalData, int cchData, LPDWORD lpValue)
-{
-    int ret, cchDataW = cchData;
-    LPWSTR lpCalDataW = NULL;
-
-    if (NLS_IsUnicodeOnlyLcid(lcid))
-    {
-      SetLastError(ERROR_INVALID_PARAMETER);
-      return 0;
-    }
-
-    if (!cchData && !(CalType & CAL_RETURN_NUMBER))
-        cchDataW = GetCalendarInfoW(lcid, Calendar, CalType, NULL, 0, NULL);
-    if (!(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchDataW*sizeof(WCHAR))))
-        return 0;
-
-    ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchDataW, lpValue);
-    if(ret && lpCalDataW && lpCalData)
-        ret = WideCharToMultiByte(CP_ACP, 0, lpCalDataW, -1, lpCalData, cchData, NULL, NULL);
-    else if (CalType & CAL_RETURN_NUMBER)
-        ret *= sizeof(WCHAR);
-    HeapFree(GetProcessHeap(), 0, lpCalDataW);
-
-    return ret;
-}
-
-/*********************************************************************
- *	SetCalendarInfoA				(KERNEL32.@)
- *
- */
-int WINAPI	SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData)
-{
-    FIXME("(%08x,%08x,%08x,%s): stub\n",
-	  Locale, Calendar, CalType, debugstr_a(lpCalData));
-    return 0;
-}
-
-/*********************************************************************
- *      GetDaylightFlag                                   (KERNEL32.@)
- *
- *  Specifies if daylight savings time is in operation.
- *
- * NOTES
- *  This function is called from the Win98's control applet timedate.cpl.
- *
- * RETURNS
- *  TRUE if daylight savings time is in operation.
- *  FALSE otherwise.
- */
-BOOL WINAPI GetDaylightFlag(void)
-{
-    TIME_ZONE_INFORMATION tzinfo;
-    return GetTimeZoneInformation( &tzinfo) == TIME_ZONE_ID_DAYLIGHT;
-}
-
-/******************************************************************************
- *           GetTickCount64       (KERNEL32.@)
- */
-ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
-{
-    ULONG high, low;
-
-    do
-    {
-        high = user_shared_data->u.TickCount.High1Time;
-        low = user_shared_data->u.TickCount.LowPart;
-    }
-    while (high != user_shared_data->u.TickCount.High2Time);
-    /* note: we ignore TickCountMultiplier */
-    return (ULONGLONG)high << 32 | low;
-}
-
-/***********************************************************************
- *           GetTickCount       (KERNEL32.@)
- */
-DWORD WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
-{
-    /* note: we ignore TickCountMultiplier */
-    return user_shared_data->u.TickCount.LowPart;
-}




More information about the wine-cvs mailing list