diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-07-23 13:04:48 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-07-23 13:04:48 +0000 |
| commit | 380e3f018712d3a65ddc834dbf83e036b436be09 (patch) | |
| tree | be34c3320914cb6cd1927e49ee6f463a6562398e /src/Platform.cc | |
| parent | 6574e44f886740273676b6d73ef754385a36197f (diff) | |
2007-07-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Merged Ross's win32 patch(manually)
In the course of merging, following files are added.
* src/strptime.{h,c}
* src/libgen.{h,c}
* src/inet_aton.{h,c}
* src/Platform.{h,cc}
* src/localtime_r.{h,c}
* src/getaddrinfo.{h,c}
I've gethered network related things, and put them to following
file:
* src/a2netcompat.h
Also io related things are put to following file:
* src/a2io.h
Changed %lld to %s because mingw32 doesn't recognize %lld.
* src/message.h
(MSG_ALLOCATION_COMPLETED)
(EX_TOO_LARGE_FILE)
(EX_SIZE_MISMATCH)
(EX_FILE_OFFSET_OUT_OF_RANGE)
(EX_INVALID_CHUNK_CHECKSUM)
(EX_INVALID_RANGE_HEADER)
* src/FileAllocationCommand.cc
* src/HttpResponse.cc
* src/RequestGroup.cc
* src/MultiDiskAdaptor.cc
* src/OptionHandlerImpl.h
* src/HttpResponseCommand.cc
* src/FtpNegotiateCommand.cc
* src/IteratableChecksumValidator.cc
* src/SegmentMan.cc
* src/ChunkChecksumValidator.cc
Added Randomizer::getRandomNumber(long int)
* src/Randomizer.h (getRandomNumber)
* src/SimpleRandomizer.h (getRandomNumber)
* src/BitfieldMan.cc (getMissingIndexRandomly): Use this new
function.
* src/Util.cc (randomAlpha): Use this new function.
Diffstat (limited to 'src/Platform.cc')
| -rw-r--r-- | src/Platform.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/Platform.cc b/src/Platform.cc new file mode 100644 index 00000000..4db776f2 --- /dev/null +++ b/src/Platform.cc @@ -0,0 +1,63 @@ +/* <!-- copyright */ +/* + * aria2 - The high speed download utility + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. If you + * do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source + * files in the program, then also delete it here. + */ +/* copyright --> */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif // HAVE_CONFIG_H + +#ifdef HAVE_WINSOCK2_H +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x501 +# endif // _WIN32_WINNT +# include <winsock2.h> +#endif // HAVE_WINSOCK2_H + +#include "Platform.h" +#include "DlAbortEx.h" + +Platform::Platform() { +#ifdef HAVE_WINSOCK2_H + WSADATA wsaData; + memset((char*)&wsaData, 0, sizeof(wsaData)); + if (WSAStartup(MAKEWORD(1, 1), &wsaData)) { + throw new DlAbortEx(_("Windows socket library initialization failed")); + } +#endif // HAVE_WINSOCK2_H +} + +Platform::~Platform() { +#ifdef HAVE_WINSOCK2_H + WSACleanup(); +#endif // HAVE_WINSOCK2_H +} |
