aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
AgeCommit message (Collapse)Author
2014-09-20Also create pid file in non-daemon modeWladimir J. van der Laan
Always make a pid file, not only when `-daemon` specified. This is useful for troubleshooting, for attaching debuggers and loggers and such. - Write the pid file only after the datadir lock was acquired - Don't create or remove a pid file on WIN32, and also don't show the option
2014-09-14header include cleanupPhilip Kaufmann
- ensures alphabetical ordering for includes etc. in source file headers
2014-08-28add missing header end commentsPhilip Kaufmann
- 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
2014-08-26Split up util.cpp/hWladimir J. van der Laan
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.
2014-08-26Move `COIN` and `CENT` to core.hWladimir J. van der Laan
Eventually these should end up in `money.h` after monetary amounts are typedef'ed, but at least they don't belong in `util.h`.
2014-08-26Move `*Version()` functions to version.h/cppWladimir J. van der Laan
2014-08-26Move `S_I*` constants and `MSG_NOSIGNAL` to compat.hWladimir J. van der Laan
2014-08-26Move SetThreadPriority implementation to util.cpp instead of the headerWladimir J. van der Laan
Put the THREAD_* and PRIO_ constants in compat.h.
2014-08-26Remove unused function `ByteReverse` from util.hWladimir J. van der Laan
2014-08-26Remove unused `alignup` function from util.hWladimir J. van der Laan
2014-08-26Move CMedianFilter to timedata.cppWladimir J. van der Laan
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.
2014-08-20Move strprintf define to tinyformat.hWladimir J. van der Laan
This avoids a dependency on util.h if just tinyformat is needed.
2014-07-09move rand functions from util to new random.h/.cppPhilip Kaufmann
2014-07-09add GetRandBytes() as wrapper for RAND_bytes()Philip Kaufmann
- 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
2014-07-04Show nodeid instead of addresses (for anonymity) unless otherwise requested.R E Broadley
2014-06-28Move non-trivial uint256.h methods to uint256.cppPieter Wuille
2014-06-25Move network-time related functions to timedata.cpp/hWladimir J. van der Laan
The network time-offset-mangement functions from util.cpp are moved to timedata.(cpp|h). This breaks the dependency of util on netbase.
2014-06-23build: fix build weirdness after 54372482.Cory Fields
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.
2014-06-11util: Add function FormatParagraph to format paragraph to fixed-widthWladimir J. van der Laan
This is to be used for the `-version` and `-help` messages.
2014-06-10Remove unused Print/PrintHex functionsWladimir J. van der Laan
You can just use HexStr(script) or script.ToString() for debugging, no need for these extra functions.
2014-05-29rename fNoListen to fListen and move to netPhilip Kaufmann
- better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI
2014-05-25Merge pull request #4183Wladimir J. van der Laan
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)
2014-05-23Replace non-threadsafe gmtime and setlocaleWladimir J. van der Laan
Make DateTimeStrFormat use boost::posix_time. Also re-enable the util_DateTimeStrFormat tests, as they are no longer platform specific.
2014-05-20remove LogException( ) which is never usedKamil Domanski
2014-05-19Merge pull request #4174Wladimir J. van der Laan
5248ff4 SetupEnvironment() - clean commit (Stuart Cardall)
2014-05-13SetupEnvironment() - clean commitStuart Cardall
2014-05-13remove ParseString(...) which is never usedKamil Domanski
2014-05-12Merge pull request #4138Wladimir J. van der Laan
783b182 Remove dummy PRIszX macros for formatting (Wladimir J. van der Laan)
2014-05-09Remove unused function WildcardMatchWladimir J. van der Laan
No longer necessary after implementing netmask-based matching. Also remove a longer-unused function `skipspaces`.
2014-05-09util: add parseint32 function with strict error reportingWladimir J. van der Laan
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.
2014-05-06Remove dummy PRIszX macros for formattingWladimir J. van der Laan
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.
2014-03-31Wrap create_directory calls in try...catch blocks.Brandon Dahler
Ignores any exceptions thrown if directory exists, otherwise re-throws exception. Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
2014-03-03replace custom GetFilesize() with boost::filesystem::file_size()Philip Kaufmann
2014-02-26Merge pull request #3749Wladimir J. van der Laan
4423571 Replace PrintException with PrintExceptionContinue + throw (Wladimir J. van der Laan)
2014-02-26Replace PrintException with PrintExceptionContinue + throwWladimir J. van der Laan
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)
2014-02-24Remove definition of PRI?64 in util.hWladimir J. van der Laan
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.
2014-02-24Get rid of C99 PRI?64 usage in source filesWladimir J. van der Laan
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.
2014-02-22Don't use PRIx64 formatting derives from inttypes.hWladimir J. van der Laan
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)
2014-02-09Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron
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.
2014-01-29Re-add newline to error() messagesWladimir J. van der Laan
As reported by @Subo1978, error messages don't have a trailing newline anymore after commit b77dfdc9. Add back this newline.
2014-01-23Typesafe strprintf/error/LogPrint functionsWladimir J. van der Laan
Switch to tinyformat-based formatting. Tinyformat is a typesafe drop-in replacement for C99 printf functions: https://github.com/c42f/tinyformat
2013-12-20Allow `-noserver` with bitcoindWladimir J. van der Laan
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
2013-12-15Remove -logtodebuggerWladimir J. van der Laan
`-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.
2013-11-13Use C99 printf statements in mingwWladimir J. van der Laan
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
2013-11-11misc small changes to polish after include cleanupPhilip Kaufmann
2013-11-11Refactor: pull alert string sanitization into utilGavin Andresen
2013-11-10Cleanup code using forward declarations.Brandon Dahler
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.
2013-10-30re-work -debug switch handlingPhilip Kaufmann
- 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
2013-10-20Bump Year Number to 2013super3
2013-10-08make fCommandLine a local variable in AppInit()Philip Kaufmann