Author: hbelusca
Date: Mon Jul 4 20:40:45 2016
New Revision: 71812
URL:
http://svn.reactos.org/svn/reactos?rev=71812&view=rev
Log:
[RTL]: Code styling modifications only:
- Use RtlCopyMemory,
- Don't hardcode types for sizeof(parameters),
- Braces for 'for'-loops,
- while (TRUE) instead of while (1),
- Use ULONG for integer iterator that cannot be negative,
- Start sentences with capitals.
Modified:
trunk/reactos/sdk/lib/rtl/time.c
Modified: trunk/reactos/sdk/lib/rtl/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/time.c?rev=718…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/time.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/time.c [iso-8859-1] Mon Jul 4 20:40:45 2016
@@ -170,12 +170,12 @@
RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields,
OUT PLARGE_INTEGER Time)
{
- int CurMonth;
+ ULONG CurMonth;
TIME_FIELDS IntTimeFields;
- memcpy(&IntTimeFields,
- TimeFields,
- sizeof(TIME_FIELDS));
+ RtlCopyMemory(&IntTimeFields,
+ TimeFields,
+ sizeof(TIME_FIELDS));
if (TimeFields->Milliseconds < 0 || TimeFields->Milliseconds > 999 ||
TimeFields->Second < 0 || TimeFields->Second > 59 ||
@@ -260,27 +260,27 @@
ULONGLONG IntTime = Time->QuadPart;
/* Extract millisecond from time and convert time into seconds */
- TimeFields->Milliseconds = (CSHORT) ((IntTime % TICKSPERSEC) / TICKSPERMSEC);
+ TimeFields->Milliseconds = (CSHORT)((IntTime % TICKSPERSEC) / TICKSPERMSEC);
IntTime = IntTime / TICKSPERSEC;
/* Split the time into days and seconds within the day */
Days = (ULONG)(IntTime / SECSPERDAY);
SecondsInDay = IntTime % SECSPERDAY;
- /* compute time of day */
- TimeFields->Hour = (CSHORT) (SecondsInDay / SECSPERHOUR);
+ /* Compute time of day */
+ TimeFields->Hour = (CSHORT)(SecondsInDay / SECSPERHOUR);
SecondsInDay = SecondsInDay % SECSPERHOUR;
- TimeFields->Minute = (CSHORT) (SecondsInDay / SECSPERMIN);
- TimeFields->Second = (CSHORT) (SecondsInDay % SECSPERMIN);
-
- /* compute day of week */
- TimeFields->Weekday = (CSHORT) ((EPOCHWEEKDAY + Days) % DAYSPERWEEK);
-
- /* compute year */
+ TimeFields->Minute = (CSHORT)(SecondsInDay / SECSPERMIN);
+ TimeFields->Second = (CSHORT)(SecondsInDay % SECSPERMIN);
+
+ /* Compute day of week */
+ TimeFields->Weekday = (CSHORT)((EPOCHWEEKDAY + Days) % DAYSPERWEEK);
+
+ /* Compute year */
CurYear = EPOCHYEAR;
CurYear += Days / DAYSPERLEAPYEAR;
Days -= DaysSinceEpoch(CurYear);
- while (1)
+ while (TRUE)
{
LeapYear = IsLeapYear(CurYear);
if (Days < YearLengths[LeapYear])
@@ -290,15 +290,17 @@
CurYear++;
Days = Days - YearLengths[LeapYear];
}
- TimeFields->Year = (CSHORT) CurYear;
+ TimeFields->Year = (CSHORT)CurYear;
/* Compute month of year */
LeapYear = IsLeapYear(CurYear);
Months = MonthLengths[LeapYear];
for (CurMonth = 0; Days >= Months[CurMonth]; CurMonth++)
+ {
Days = Days - Months[CurMonth];
- TimeFields->Month = (CSHORT) (CurMonth + 1);
- TimeFields->Day = (CSHORT) (Days + 1);
+ }
+ TimeFields->Month = (CSHORT)(CurMonth + 1);
+ TimeFields->Day = (CSHORT)(Days + 1);
}
@@ -359,7 +361,7 @@
Status = ZwQuerySystemInformation(SystemTimeOfDayInformation,
&TimeInformation,
- sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
+ sizeof(TimeInformation),
NULL);
if (!NT_SUCCESS(Status))
return Status;
@@ -384,7 +386,7 @@
Status = ZwQuerySystemInformation(SystemTimeOfDayInformation,
&TimeInformation,
- sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
+ sizeof(TimeInformation),
NULL);
if (!NT_SUCCESS(Status))
return Status;