[vlc-devel] [PATCH] compat: revmoe 'const' from the prototype of timegm().

KO Myung-Hun komh78 at gmail.com
Sat Dec 12 04:09:13 CET 2015


The prototype of timegm() does not have 'const'.

This fixes compilation on OS/2 which have only a declaration of
timegm().

-----
make.exe[3]: Entering directory `F:/lang/work/vlc/vlc.git/compat'
  CC       freeaddrinfo.lo
In file included from ../config.h:869:0,
                 from freeaddrinfo.c:27:
../include/vlc_fixups.h:203:8: error: conflicting types for 'timegm'
 time_t timegm(const struct tm *);
        ^
In file included from ../include/vlc_fixups.h:45:0,
                 from ../config.h:869,
                 from freeaddrinfo.c:27:
f:/lang/gcc/usr/include/time.h:188:8: note: previous declaration of 'timegm' was here
 time_t timegm(struct tm * const);
        ^
make.exe[3]: *** [freeaddrinfo.lo] Error 1
-----
---
 compat/timegm.c      | 2 +-
 include/vlc_fixups.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compat/timegm.c b/compat/timegm.c
index 68a3030..27a3df3 100644
--- a/compat/timegm.c
+++ b/compat/timegm.c
@@ -37,7 +37,7 @@ static bool is_leap_year(unsigned y)
     return true;
 }
 
-time_t timegm(const struct tm *tm)
+time_t timegm(struct tm *tm)
 {
     static const unsigned ydays[12 + 1] = {
         0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index a028df7..213d3f3 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -200,7 +200,7 @@ struct tm *localtime_r (const time_t *, struct tm *);
 #endif
 
 #ifndef HAVE_TIMEGM
-time_t timegm(const struct tm *);
+time_t timegm(struct tm *);
 #endif
 
 #ifndef HAVE_TIMESPEC_GET
-- 
2.6.0



More information about the vlc-devel mailing list