Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: Source/WebCore/loader/FTPDirectoryParser.cpp

Issue 13529026: Removing a bunch of unused platform code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix whitespace and compiler error on Mac. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2002 Cyrus Patel <cyp@fb14.uni-mainz.de> 2 * Copyright (C) 2002 Cyrus Patel <cyp@fb14.uni-mainz.de>
3 * (C) 2007 Apple Inc. All rights reserved. 3 * (C) 2007 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public 6 * modify it under the terms of the GNU Lesser General Public
7 * License 2.1 as published by the Free Software Foundation. 7 * License 2.1 as published by the Free Software Foundation.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 // This was originally Mozilla code, titled ParseFTPList.cpp 20 // This was originally Mozilla code, titled ParseFTPList.cpp
21 // Original version of this file can currently be found at: http://mxr.mozilla.o rg/mozilla1.8/source/netwerk/streamconv/converters/ParseFTPList.cpp 21 // Original version of this file can currently be found at: http://mxr.mozilla.o rg/mozilla1.8/source/netwerk/streamconv/converters/ParseFTPList.cpp
22 22
23 #include "config.h" 23 #include "config.h"
24 #if ENABLE(FTPDIR) 24 #if ENABLE(FTPDIR)
25 #include "FTPDirectoryParser.h" 25 #include "FTPDirectoryParser.h"
26 26
27 #if PLATFORM(QT) 27 #if OS(WINDOWS) && (USE(PTHREADS) || HAVE(PTHREAD_H))
28 #include <QDateTime>
29 // On Windows, use the threadsafe *_r functions provided by pthread.
30 #elif OS(WINDOWS) && (USE(PTHREADS) || HAVE(PTHREAD_H))
31 #include <pthread.h> 28 #include <pthread.h>
32 #endif 29 #endif
33 30
34 #include <wtf/ASCIICType.h> 31 #include <wtf/ASCIICType.h>
35 #include <stdio.h> 32 #include <stdio.h>
36 33
37 using namespace WTF; 34 using namespace WTF;
38 35
39 namespace WebCore { 36 namespace WebCore {
40 #if PLATFORM(QT) && defined(Q_WS_WIN32) 37 #if OS(WINDOWS) && !defined(gmtime_r)
41
42 // Replacement for gmtime_r() which is not available on MinGW.
43 // We use this on Win32 Qt platform for portability.
44 struct tm gmtimeQt(const QDateTime& input)
45 {
46 tm result;
47
48 QDate date(input.date());
49 result.tm_year = date.year() - 1900;
50 result.tm_mon = date.month();
51 result.tm_mday = date.day();
52 result.tm_wday = date.dayOfWeek();
53 result.tm_yday = date.dayOfYear();
54
55 QTime time(input.time());
56 result.tm_sec = time.second();
57 result.tm_min = time.minute();
58 result.tm_hour = time.hour();
59
60 return result;
61 }
62
63 static struct tm *gmtimeQt(const time_t *const timep, struct tm *result)
64 {
65 const QDateTime dt(QDateTime::fromTime_t(*timep));
66 *result = WebCore::gmtimeQt(dt);
67 return result;
68 }
69
70 #define gmtime_r(x, y) gmtimeQt(x, y)
71 #elif OS(WINDOWS) && !defined(gmtime_r)
72 #if defined(_MSC_VER) && (_MSC_VER >= 1400) 38 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
73 #define gmtime_r(x, y) gmtime_s((y), (x)) 39 #define gmtime_r(x, y) gmtime_s((y), (x))
74 #else /* !_MSC_VER */ 40 #else /* !_MSC_VER */
75 #define gmtime_r(x,y) (gmtime(x)?(*(y)=*gmtime(x),(y)):0) 41 #define gmtime_r(x,y) (gmtime(x)?(*(y)=*gmtime(x),(y)):0)
76 #endif 42 #endif
77 #endif 43 #endif
78 44
79 static inline FTPEntryType ParsingFailed(ListState& state) 45 static inline FTPEntryType ParsingFailed(ListState& state)
80 { 46 {
81 if (state.parsedOne || state.listStyle) /* junk if we fail to parse */ 47 if (state.parsedOne || state.listStyle) /* junk if we fail to parse */
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ 1672 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
1707 1673
1708 } /* if (linelen > 0) */ 1674 } /* if (linelen > 0) */
1709 1675
1710 return ParsingFailed(state); 1676 return ParsingFailed(state);
1711 } 1677 }
1712 1678
1713 } // namespace WebCore 1679 } // namespace WebCore
1714 1680
1715 #endif // ENABLE(FTPDIR) 1681 #endif // ENABLE(FTPDIR)
OLDNEW
« no previous file with comments | « Source/WebCore/html/canvas/WebGLRenderingContext.cpp ('k') | Source/WebCore/loader/icon/IconDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698