Pārlūkot izejas kodu

Pacify Visual Studio 2013

Problem reported by Kees Dekker in:
http://mm.icann.org/pipermail/tz/2015-July/022514.html
* NEWS: Document this.
* difftime.c (difftime):
* localtime.c (localtime, localtime_r, gmtime, gmtime_r, offtime)
(ctime, ctime_r, mktime, timelocal, timegm, timeoff):
* strftime.c (strftime, _fmt, _conv, _add):
Omit 'const' attribute of arguments to match the corresponding
declaration.  Although the C standard says the 'const' is OK,
Visual Studio complains and as it's only a style thing here we
might as well omit it.
Paul Eggert 10 gadi atpakaļ
vecāks
revīzija
fe36e5f9ef
4 mainītis faili ar 20 papildinājumiem un 19 dzēšanām
  1. 3 0
      NEWS
  2. 1 1
      difftime.c
  3. 11 11
      localtime.c
  4. 5 7
      strftime.c

+ 3 - 0
NEWS

@@ -45,6 +45,9 @@ Unreleased, experimental changes
     zdump and zic no longer warn about valid time zone abbreviations
     like '-05'.
 
+    Some Visual Studio 2013 warnings have been suppressed.
+    (Thanks to Kees Dekker.)
+
   Changes affecting documentation
 
     tz-link.htm mentions Time Zone Database Parser (thanks to Howard Hinnant).

+ 1 - 1
difftime.c

@@ -8,7 +8,7 @@
 #include "private.h"	/* for time_t and TYPE_SIGNED */
 
 double ATTRIBUTE_CONST
-difftime(const time_t time1, const time_t time0)
+difftime(time_t time1, time_t time0)
 {
 	/*
 	** If (sizeof (double) > sizeof (time_t)) simply convert and subtract

+ 11 - 11
localtime.c

@@ -1464,13 +1464,13 @@ localtime_tzset(time_t const *timep, struct tm *tmp, bool setname)
 }
 
 struct tm *
-localtime(const time_t *const timep)
+localtime(const time_t *timep)
 {
   return localtime_tzset(timep, &tm, true);
 }
 
 struct tm *
-localtime_r(const time_t *const timep, struct tm *tmp)
+localtime_r(const time_t *timep, struct tm *tmp)
 {
   return localtime_tzset(timep, tmp, false);
 }
@@ -1499,7 +1499,7 @@ gmtsub(struct state const *sp, time_t const *timep, int_fast32_t offset,
 }
 
 struct tm *
-gmtime(const time_t *const timep)
+gmtime(const time_t *timep)
 {
   return gmtime_r(timep, &tm);
 }
@@ -1509,7 +1509,7 @@ gmtime(const time_t *const timep)
 */
 
 struct tm *
-gmtime_r(const time_t *const timep, struct tm *tmp)
+gmtime_r(const time_t *timep, struct tm *tmp)
 {
   gmtcheck();
   return gmtsub(gmtptr, timep, 0, tmp);
@@ -1518,7 +1518,7 @@ gmtime_r(const time_t *const timep, struct tm *tmp)
 #ifdef STD_INSPIRED
 
 struct tm *
-offtime(const time_t *const timep, const long offset)
+offtime(const time_t *timep, long offset)
 {
   gmtcheck();
   return gmtsub(gmtptr, timep, offset, &tm);
@@ -1671,7 +1671,7 @@ timesub(const time_t *const timep, const int_fast32_t offset,
 }
 
 char *
-ctime(const time_t *const timep)
+ctime(const time_t *timep)
 {
 /*
 ** Section 4.12.3.2 of X3.159-1989 requires that
@@ -1684,7 +1684,7 @@ ctime(const time_t *const timep)
 }
 
 char *
-ctime_r(const time_t *const timep, char *buf)
+ctime_r(const time_t *timep, char *buf)
 {
   struct tm mytm;
   struct tm *tmp = localtime_r(timep, &mytm);
@@ -2103,7 +2103,7 @@ mktime_z(struct state *sp, struct tm *tmp)
 #endif
 
 time_t
-mktime(struct tm *const tmp)
+mktime(struct tm *tmp)
 {
   time_t t;
   int err = lock();
@@ -2120,7 +2120,7 @@ mktime(struct tm *const tmp)
 #ifdef STD_INSPIRED
 
 time_t
-timelocal(struct tm *const tmp)
+timelocal(struct tm *tmp)
 {
 	if (tmp != NULL)
 		tmp->tm_isdst = -1;	/* in case it wasn't initialized */
@@ -2128,13 +2128,13 @@ timelocal(struct tm *const tmp)
 }
 
 time_t
-timegm(struct tm *const tmp)
+timegm(struct tm *tmp)
 {
   return timeoff(tmp, 0);
 }
 
 time_t
-timeoff(struct tm *const tmp, const long offset)
+timeoff(struct tm *tmp, long offset)
 {
   if (tmp)
     tmp->tm_isdst = 0;

+ 5 - 7
strftime.c

@@ -117,8 +117,7 @@ strftime_l(char *s, size_t maxsize, char const *format, struct tm const *t,
 #endif
 
 size_t
-strftime(char * const s, const size_t maxsize, const char *const format,
-	 const struct tm *const t)
+strftime(char *s, size_t maxsize, const char *format, const struct tm *t)
 {
 	char *	p;
 	int	warn;
@@ -149,8 +148,8 @@ strftime(char * const s, const size_t maxsize, const char *const format,
 }
 
 static char *
-_fmt(const char *format, const struct tm *const t, char * pt,
-     const char *const ptlim, int *warnp)
+_fmt(const char *format, const struct tm *t, char *pt,
+     const char *ptlim, int *warnp)
 {
 	for ( ; *format; ++format) {
 		if (*format == '%') {
@@ -562,8 +561,7 @@ label:
 }
 
 static char *
-_conv(const int n, const char *const format, char *const pt,
-      const char *const ptlim)
+_conv(int n, const char *format, char *pt, const char *ptlim)
 {
 	char	buf[INT_STRLEN_MAXIMUM(int) + 1];
 
@@ -572,7 +570,7 @@ _conv(const int n, const char *const format, char *const pt,
 }
 
 static char *
-_add(const char *str, char *pt, const char *const ptlim)
+_add(const char *str, char *pt, const char *ptlim)
 {
 	while (pt < ptlim && (*pt = *str++) != '\0')
 		++pt;