X-Git-Url: http://git.jankratochvil.net/?p=reactos.git;a=blobdiff_plain;f=lib%2Fmsvcrt%2Ftime%2Fstrftime.c;fp=lib%2Fmsvcrt%2Ftime%2Fstrftime.c;h=7a39f63134ba4ccc5af70b697f3c9a46f7908a68;hp=96831ed6e6303bc9304670613e027fcee000e8c1;hb=e3ed2d773259cc445c7ff8181ebd934931365328;hpb=d378c68f5a9bb25c9e671dacd482d2e25d211df3 diff --git a/lib/msvcrt/time/strftime.c b/lib/msvcrt/time/strftime.c index 96831ed..7a39f63 100644 --- a/lib/msvcrt/time/strftime.c +++ b/lib/msvcrt/time/strftime.c @@ -4,6 +4,7 @@ #include #include + #define TM_YEAR_BASE 1900 static const char *afmt[] = { @@ -25,8 +26,8 @@ static const char *Bfmt[] = { static size_t gsize; static char *pt; -static int -_add(const char *str) + +static int _add(const char* str) { for (;; ++pt, --gsize) { @@ -37,8 +38,7 @@ _add(const char *str) } } -static int -_conv(int n, int digits, char pad) +static int _conv(int n, int digits, char pad) { static char buf[10]; char *p; @@ -50,16 +50,14 @@ _conv(int n, int digits, char pad) return _add(++p); } -static size_t -_fmt(const char *format, const struct tm *t) +static size_t _fmt(const char* format, const struct tm* t) { for (; *format; ++format) { if (*format == '%') { if (*(format+1) == '#' ) {format++;} - switch(*++format) - { + switch(*++format) { case '\0': --format; break; @@ -113,8 +111,7 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'I': - if (!_conv(t->tm_hour % 12 ? - t->tm_hour % 12 : 12, 2, '0')) + if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, '0')) return 0; continue; case 'j': @@ -126,8 +123,7 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'l': - if (!_conv(t->tm_hour % 12 ? - t->tm_hour % 12 : 12, 2, ' ')) + if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, ' ')) return 0; continue; case 'M': @@ -168,14 +164,11 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'U': - if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, - 2, '0')) + if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, 2, '0')) return 0; continue; case 'W': - if (!_conv((t->tm_yday + 7 - - (t->tm_wday ? (t->tm_wday - 1) : 6)) - / 7, 2, '0')) + if (!_conv((t->tm_yday + 7 - (t->tm_wday ? (t->tm_wday - 1) : 6)) / 7, 2, '0')) return 0; continue; case 'w': @@ -187,8 +180,7 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'y': - if (!_conv((t->tm_year + TM_YEAR_BASE) - % 100, 2, '0')) + if (!_conv((t->tm_year + TM_YEAR_BASE) % 100, 2, '0')) return 0; continue; case 'Y': @@ -230,8 +222,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *t) return 0; } -size_t -wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *t) +size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct tm* t) { char *x; char *f; @@ -245,8 +236,7 @@ wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *t) pt = x; if ((gsize = maxsize) < 1) return 0; - if (_fmt(f, t)) - { + if (_fmt(f, t)) { *pt = '\0'; free(f); for(i=0;i