aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
Commit message (Collapse)AuthorAgeFilesLines
* add missing header end commentsPhilip Kaufmann2014-08-281-1/+1
| | | | | | - ensures a consistent usage in header files - also add a blank line after the copyright header where missing - also remove orphan new-lines at the end of some files
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-170/+6
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* Move `COIN` and `CENT` to core.hWladimir J. van der Laan2014-08-261-3/+0
| | | | | Eventually these should end up in `money.h` after monetary amounts are typedef'ed, but at least they don't belong in `util.h`.
* Move `*Version()` functions to version.h/cppWladimir J. van der Laan2014-08-261-2/+0
|
* Move `S_I*` constants and `MSG_NOSIGNAL` to compat.hWladimir J. van der Laan2014-08-261-14/+0
|
* Move SetThreadPriority implementation to util.cpp instead of the headerWladimir J. van der Laan2014-08-261-28/+1
| | | | Put the THREAD_* and PRIO_ constants in compat.h.
* Remove unused function `ByteReverse` from util.hWladimir J. van der Laan2014-08-261-6/+0
|
* Remove unused `alignup` function from util.hWladimir J. van der Laan2014-08-261-14/+0
|
* Move CMedianFilter to timedata.cppWladimir J. van der Laan2014-08-261-56/+0
| | | | | Now that we no longer use the median filter to keep track of the number of blocks of peers, that's the only place it is used.
* Move strprintf define to tinyformat.hWladimir J. van der Laan2014-08-201-1/+0
| | | | This avoids a dependency on util.h if just tinyformat is needed.
* move rand functions from util to new random.h/.cppPhilip Kaufmann2014-07-091-51/+0
|
* add GetRandBytes() as wrapper for RAND_bytes()Philip Kaufmann2014-07-091-0/+1
| | | | | | - add a small wrapper in util around RAND_bytes() and replace with GetRandBytes() in the code to log errors from calling RAND_bytes() - remove OpenSSL header rand.h where no longer needed
* Show nodeid instead of addresses (for anonymity) unless otherwise requested.R E Broadley2014-07-041-0/+1
|
* Move non-trivial uint256.h methods to uint256.cppPieter Wuille2014-06-281-0/+1
|
* Move network-time related functions to timedata.cpp/hWladimir J. van der Laan2014-06-251-4/+0
| | | | | The network time-offset-mangement functions from util.cpp are moved to timedata.(cpp|h). This breaks the dependency of util on netbase.
* build: fix build weirdness after 54372482.Cory Fields2014-06-231-1/+1
| | | | | | | | | | | | | bitcoin-config.h moved, but the old file is likely to still exist when reconfiguring or switching branches. This would've caused files to not rebuild correctly, and other strange problems. Make the path explicit so that the old one cannot be found. Core libs use config/bitcoin-config.h. Libs (like crypto) which don't want access to bitcoin's headers continue to use -Iconfig and #include bitcoin-config.h.
* util: Add function FormatParagraph to format paragraph to fixed-widthWladimir J. van der Laan2014-06-111-0/+5
| | | | This is to be used for the `-version` and `-help` messages.
* Remove unused Print/PrintHex functionsWladimir J. van der Laan2014-06-101-11/+0
| | | | | You can just use HexStr(script) or script.ToString() for debugging, no need for these extra functions.
* rename fNoListen to fListen and move to netPhilip Kaufmann2014-05-291-1/+0
| | | | | - better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI
* Merge pull request #4183Wladimir J. van der Laan2014-05-251-2/+0
|\ | | | | | | | | | | | | | | | | f40dbee remove CPubKey::VerifyCompact( ) which is never used (Kamil Domanski) 28b6c1d remove GetMedianTime( ) which is never used (Kamil Domanski) 5bd4adc remove LookupHostNumeric( ) which is never used (Kamil Domanski) 595f691 remove LogException( ) which is never used (Kamil Domanski) f4057cb remove CTransaction::IsNewerThan which is never used (Kamil Domanski) 0e31e56 remove CWallet::AddReserveKey which is never used (Kamil Domanski)
| * remove LogException( ) which is never usedKamil Domanski2014-05-201-2/+0
| |
* | Replace non-threadsafe gmtime and setlocaleWladimir J. van der Laan2014-05-231-8/+1
|/ | | | | | | Make DateTimeStrFormat use boost::posix_time. Also re-enable the util_DateTimeStrFormat tests, as they are no longer platform specific.
* Merge pull request #4174Wladimir J. van der Laan2014-05-191-0/+1
|\ | | | | | | 5248ff4 SetupEnvironment() - clean commit (Stuart Cardall)
| * SetupEnvironment() - clean commitStuart Cardall2014-05-131-0/+1
| |
* | remove ParseString(...) which is never usedKamil Domanski2014-05-131-1/+0
|/
* Merge pull request #4138Wladimir J. van der Laan2014-05-121-12/+0
|\ | | | | | | 783b182 Remove dummy PRIszX macros for formatting (Wladimir J. van der Laan)
| * Remove dummy PRIszX macros for formattingWladimir J. van der Laan2014-05-061-12/+0
| | | | | | | | | | | | | | | | | | Size specifiers are no longer needed now that we use typesafe tinyformat for string formatting, instead of the system's sprintf. No functional changes. This continues the work in #3735.
* | Remove unused function WildcardMatchWladimir J. van der Laan2014-05-091-9/+0
| | | | | | | | | | No longer necessary after implementing netmask-based matching. Also remove a longer-unused function `skipspaces`.
* | util: add parseint32 function with strict error reportingWladimir J. van der Laan2014-05-091-0/+7
|/ | | | | | None of the current integer parsing functions in util check whether the result is valid and fits in the range of the type. This is required for less sloppy error reporting.
* Wrap create_directory calls in try...catch blocks.Brandon Dahler2014-03-311-0/+1
| | | | | | Ignores any exceptions thrown if directory exists, otherwise re-throws exception. Rebased-By: Wladimir J. van der Laan <[email protected]>
* replace custom GetFilesize() with boost::filesystem::file_size()Philip Kaufmann2014-03-031-1/+0
|
* Merge pull request #3749Wladimir J. van der Laan2014-02-261-5/+8
|\ | | | | | | 4423571 Replace PrintException with PrintExceptionContinue + throw (Wladimir J. van der Laan)
| * Replace PrintException with PrintExceptionContinue + throwWladimir J. van der Laan2014-02-261-5/+8
| | | | | | | | | | | | | | | | | | Just a pet peeve. (PrintException has exactly the same body as PrintExceptionContinue but does a re-throw at the end. Move these re-throws to the call site, this aids understanding what is going on as well as eliminates a bit of code duplication in util.cpp)
* | Remove definition of PRI?64 in util.hWladimir J. van der Laan2014-02-241-11/+3
| | | | | | | | | | | | | | | | This was a bad idea. This can't be solved with macros as any other library that includes inttypes.h will get in the way. The parent commit has removed all usages from the source, this commit removes the definition.
* | Get rid of C99 PRI?64 usage in source filesWladimir J. van der Laan2014-02-241-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h indirectly, so we cannot fix this with just macros. Trivial commit: apply the following script to all .cpp and .h files: # Middle sed -i 's/"PRIx64"/x/g' "$1" sed -i 's/"PRIu64"/u/g' "$1" sed -i 's/"PRId64"/d/g' "$1" # Initial sed -i 's/PRIx64"/"x/g' "$1" sed -i 's/PRIu64"/"u/g' "$1" sed -i 's/PRId64"/"d/g' "$1" # Trailing sed -i 's/"PRIx64/x"/g' "$1" sed -i 's/"PRIu64/u"/g' "$1" sed -i 's/"PRId64/d"/g' "$1" After this commit, `git grep` for PRI.64 should turn up nothing except the defines in util.h.
* Don't use PRIx64 formatting derives from inttypes.hWladimir J. van der Laan2014-02-221-8/+19
| | | | | | | | | | | | As the tinyformat-based formatting system (introduced in b77dfdc) is type-safe, no special format characters are needed to specify sizes. Tinyformat can support (ignore) the C99 prefixes such as "ll" but chokes on MSVC's inttypes.h defines prefixes such as "I64X". So don't include inttypes.h and define our own for compatibility. (an alternative would be to sweep the entire codebase using sed -i to get rid of the size specifiers but this has less diff impact)
* Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron2014-02-091-1/+1
| | | | | | in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
* Re-add newline to error() messagesWladimir J. van der Laan2014-01-291-2/+2
| | | | | As reported by @Subo1978, error messages don't have a trailing newline anymore after commit b77dfdc9. Add back this newline.
* Typesafe strprintf/error/LogPrint functionsWladimir J. van der Laan2014-01-231-32/+40
| | | | | | | Switch to tinyformat-based formatting. Tinyformat is a typesafe drop-in replacement for C99 printf functions: https://github.com/c42f/tinyformat
* Allow `-noserver` with bitcoindWladimir J. van der Laan2013-12-201-1/+0
| | | | | | | | Allow running bitcoind without server. - Default to -server mode (of course) for bitcoind with SoftSetBoolArg - Remove fForceServer argument from AppInit2 - Move fDaemon to a static variable in bitcoind
* Remove -logtodebuggerWladimir J. van der Laan2013-12-151-1/+1
| | | | | | | | | `-logtodebugger` is a strange, obscure, WIN32-only (mostly MSVC) thing. Let's clean up the options a bit get rid of it. test_bitcoin was using fLogToDebugger as a way to prevent logging to debug.log. For this, add a boolean (not exposed as option) fLogToDebugLog that defaults to true and is disabled in the tests.
* Use C99 printf statements in mingwWladimir J. van der Laan2013-11-131-21/+8
| | | | | | | Otherwise, format specifiers such as %llu will not work on XP or earlier. This bug was introduced with 51ed9ec9. http://sourceforge.net/apps/trac/mingw-w64/wiki/gnu%20printf
* misc small changes to polish after include cleanupPhilip Kaufmann2013-11-111-3/+1
|
* Refactor: pull alert string sanitization into utilGavin Andresen2013-11-111-0/+1
|
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-57/+51
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* re-work -debug switch handlingPhilip Kaufmann2013-10-301-1/+0
| | | | | | | | | | | | - re-work -debug help message text - make -debug log every debugging information again (even all categories) - remove unneeded fDebug checks in front of LogPrint()/qDebug(), as that check is done in LogPrintf() when category is != NULL (true for all LogPrint() calls - remove fDebug ONLY in code which is NOT performance-critical - harmonize addrman category name - deprecate -debugnet usage, should be used via -debug=net and remove the corresponding global
* Bump Year Number to 2013super32013-10-201-1/+1
|
* make fCommandLine a local variable in AppInit()Philip Kaufmann2013-10-081-1/+0
|
* Replace printf with LogPrintf / LogPrintGavin Andresen2013-09-181-15/+8
|
* Refactor: OutputDebugStringF -> LogPrint(category, ...)Gavin Andresen2013-09-181-2/+4
|