summaryrefslogtreecommitdiff
path: root/src/util.cc
Commit message (Collapse)AuthorAgeFilesLines
* Don't inherit file descriptor to child processTatsuhiro Tsujikawa2016-02-081-2/+20
| | | | | | For non-Mingw32 build, set FD_CLOEXEC to file descriptors which live beyond function scope. For Mingw32 build, just pass false to bInheritHandles parameter of CreateProcessW.
* mingw: Add formatLastError as wrapper function for FormatMessageTatsuhiro Tsujikawa2016-01-281-0/+18
|
* Refactor HttpRequestTatsuhiro Tsujikawa2016-01-101-0/+5
| | | | | This also makes comparison performed when replacing builtin header field with user-defined one case-insensitive.
* Refactor SocketCore::getPeerInfo, getAddrInfo to return Endpoint objectTatsuhiro Tsujikawa2016-01-091-3/+3
|
* make clang-format using clang-format-3.6Tatsuhiro Tsujikawa2015-12-271-590/+627
|
* Make clang (OSX) happy againNils Maier2015-06-241-0/+1
|
* Fix compile warning with Mingw64 x86 buildTatsuhiro Tsujikawa2015-06-211-1/+2
|
* Use user-defined literal for k, m, and g (powers of 1024)Tatsuhiro Tsujikawa2015-06-211-10/+10
|
* Make config and cache files conform to XDGVasilij Schneidermann2015-06-021-0/+31
| | | | | | | See http://standards.freedesktop.org/basedir-spec/latest/ for further details. This implementation decides the default based on whether a file exists at the legacy location, if it doesn't, it picks the XDG-conforming location instead.
* Mingw: Use _wgetenv to get user's home directoryTatsuhiro Tsujikawa2015-02-211-13/+32
| | | | Fixes GH-342
* Fix compile error without SSL/TLS enabledTatsuhiro Tsujikawa2015-02-011-0/+2
|
* Revise getRandom facilitiesNils Maier2015-01-201-37/+2
| | | | | | | | | | | | | | Use one of the following to provide random bytes: - Windows CryptGenRandom - Linux getrandom (syscall interface to urandom, without nasty corner cases such as file descriptor exhaustion or re-linked /dev/urandom) - std::device_random (C++ random device, which usually will be urandom) This also equalizes util::getRandom and SimpleRandomizer (the former will now use the latter) instead of having essentially two different PRNG interfaces with potentially different quality. Closes GH-320
* Add --min-tls-version optionTatsuhiro Tsujikawa2014-12-061-0/+17
| | | | | The --min-tls-version option specifies minimum SSL/TLS version to enable. Possible Values: SSLv3, TLSv1, TLSv1.1, TLSv1.2 Default: TLSv1
* util::parseIntSegments: Return SegList<int>Tatsuhiro Tsujikawa2014-06-041-1/+3
|
* Support PREF_DIR change for Metalink filesTatsuhiro Tsujikawa2014-06-041-0/+7
| | | | | Reworked previous commit adeead6f0396e2f8551d1182972e277728fd6c8b, and now support changing PREF_DIR for Metalink downloads.
* Fix unused function warning about generateRandomDataUrandom in mingw-w64Nils Maier2014-05-081-0/+2
|
* Remove ENABLE_MESSAGE_DIGEST, since we got the internal md, alwaysNils Maier2014-04-171-8/+2
|
* Fix bad fork() return value handlingTatsuhiro Tsujikawa2013-12-061-1/+1
|
* Code cleanupTatsuhiro Tsujikawa2013-11-011-2/+2
|
* Remove nativeToUtf8 and utf8ToNativeTatsuhiro Tsujikawa2013-11-011-47/+4
| | | | | They are now not needed since we use Windows specific command-line argument converter.
* util.cc: Remove uselss inline staticTatsuhiro Tsujikawa2013-09-301-2/+0
|
* util::percentEncodeMini: Fix regression bug removed unsignednessTatsuhiro Tsujikawa2013-09-301-4/+6
| | | | | srange-based for around std::string is convenient but several functions depend unsigned char for correctness and readability.
* Include prefs.h instead of typedef PrefPtr everywhereTatsuhiro Tsujikawa2013-09-261-1/+0
|
* Make generateRandomBytes less biased.Nils Maier2013-09-241-3/+1
|
* More auto-converts by cpp11-migrateNils Maier2013-09-201-3/+2
|
* Introduce PrefPtr typedefNils Maier2013-09-191-2/+2
|
* More code cleanupsNils Maier2013-09-191-95/+102
|
* util::htmlEscape: Optimize a bitTatsuhiro Tsujikawa2013-08-291-24/+23
| | | | | | | | | The cause of slowness of the first implementation is the memory allocation overhead and appending character by character. In this implementation, the output buffer is reserved the same size of input. This is reasonable because most likely no replacement happens in practice. And the unmodified region is copied using iterator range to speed up a bit.
* Fast-path for percentEncodeMini(string&)Nils Maier2013-08-241-8/+17
|
* Optimize htmlEscape implementation a bitNils Maier2013-08-241-17/+24
|
* Add fast-path to percentEncode(string&)Nils Maier2013-08-241-0/+4
|
* Convert to autos and ranged loopsNils Maier2013-08-211-4/+2
|
* Convert most 0/NULL pointers to nullptrNils Maier2013-08-201-8/+8
| | | | Courtesy of llvm cpp11-migrate 3.3
* Define a type for signal handlersNils Maier2013-08-181-3/+3
|
* Win: Use SetConsoleCtrlHandler for SIGINT/SIGTERMNils Maier2013-08-181-0/+76
|
* Use std::unique_ptr instead of array_ptrTatsuhiro Tsujikawa2013-07-031-26/+23
|
* Use std::unique_ptr for MessageDigestTatsuhiro Tsujikawa2013-07-031-1/+2
|
* Return std::unique_ptr member as const refTatsuhiro Tsujikawa2013-06-261-1/+1
| | | | | Returning raw pointer has a risk that it may be stolen by std::shared_ptr in accident.
* Rewrite util::divideTatsuhiro Tsujikawa2013-06-251-2/+1
|
* toUpper, toLower: Let compiler copy srcTatsuhiro Tsujikawa2013-06-241-8/+7
|
* Remove vbegin and vend in favor of std::begin and std::endTatsuhiro Tsujikawa2013-06-241-7/+9
|
* Use std::unique_ptr instead of std::shared_ptrTatsuhiro Tsujikawa2013-06-221-1/+1
|
* Require -std=c++11 and use std::shared_ptr instead of SharedHandleTatsuhiro Tsujikawa2013-06-221-10/+10
|
* OSX (now) needs signal.h for sigactionNils Maier2013-05-171-4/+3
|
* util.cc: Include only signal.h for opensolaris buildTatsuhiro Tsujikawa2013-03-171-0/+7
|
* Check for sys/signal.h and/or signal.hNils Maier2013-03-021-1/+8
| | | | | | | mingw-w64 does not actually have sys/signal.h, while OSX currently has a broken signal.h Better check the presence of both and use sys/signal.h if present, else signal.h
* Fix bustage on OSX with ./configure CC=cc CXX=c++ (clang)Nils Maier2013-03-011-1/+1
|
* Set sa_mask when setting signal handlerTatsuhiro Tsujikawa2013-02-141-2/+3
|
* Use _exit() instead of exit() where appropriateTatsuhiro Tsujikawa2013-02-141-1/+1
|
* Accept k and m as well as K and M in util::getRealSize()Tatsuhiro Tsujikawa2013-01-151-3/+8
|