aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | util: Add function FormatParagraph to format paragraph to fixed-widthWladimir J. van der Laan2014-06-111-0/+35
| | | | | | | | This is to be used for the `-version` and `-help` messages.
* | small formatting, indentation and comment fixesPhilip Kaufmann2014-06-101-10/+12
| | | | | | | | - contains zero code changes
* | 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-6/+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-6/+0
| | |
* | | Replace non-threadsafe gmtime and setlocaleWladimir J. van der Laan2014-05-231-0/+12
|/ / | | | | | | | | | | | | 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/+16
|\ \ | |/ |/| | | 5248ff4 SetupEnvironment() - clean commit (Stuart Cardall)
| * SetupEnvironment() - clean commitStuart Cardall2014-05-131-0/+16
| |
* | remove ParseString(...) which is never usedKamil Domanski2014-05-131-20/+0
|/
* Remove unused function WildcardMatchWladimir J. van der Laan2014-05-091-37/+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/+14
| | | | | | 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-1/+18
| | | | | | 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-18/+1
|
* Merge pull request #3749Wladimir J. van der Laan2014-02-261-9/+0
|\ | | | | | | 4423571 Replace PrintException with PrintExceptionContinue + throw (Wladimir J. van der Laan)
| * Replace PrintException with PrintExceptionContinue + throwWladimir J. van der Laan2014-02-261-9/+0
| | | | | | | | | | | | | | | | | | 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)
* | Get rid of C99 PRI?64 usage in source filesWladimir J. van der Laan2014-02-241-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | 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.
* 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.
* Merge pull request #3450Wladimir J. van der Laan2014-01-291-2/+3
|\ | | | | | | 4c0b2cd Win32: use a more modern API call in FileCommit() (Philip Kaufmann)
| * Win32: use a more modern API call in FileCommit()Philip Kaufmann2013-12-201-2/+3
| | | | | | | | | | | | - this seems to be a more recent API call and also supports e.g. SMB3, ReFS, which is not guaranteed for commit_() - link to MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439%28v=vs.85%29.aspx
* | Remove redundant .c_str()sWladimir J. van der Laan2014-01-231-5/+5
| | | | | | | | | | | | | | After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
* | Typesafe strprintf/error/LogPrint functionsWladimir J. van der Laan2014-01-231-68/+10
|/ | | | | | | Switch to tinyformat-based formatting. Tinyformat is a typesafe drop-in replacement for C99 printf functions: https://github.com/c42f/tinyformat
* Remove -logtodebuggerWladimir J. van der Laan2013-12-151-25/+2
| | | | | | | | | `-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 thread-local storage for LogPrint(category...)Gavin Andresen2013-12-101-9/+15
| | | | | | This prevents crashes at shutdown where a global destructor calls LogPrint(category...) after mapMultiArgs has been deleted.
* Fix infinite loop with LogPrint on WindowsGavin Andresen2013-12-101-17/+14
| | | | | | | | | Running -printtodebugger -debug (or -debug=lock), compiled with -DDEBUG_LOCKORDER would infinite loop on Windows because every critical section lock/unlock triggers a LogPrint. Solution is to use the raw boost mutex instead of a CCriticalSection.
* bitcoin-cli: remove unneeded dependencies (only code movement)Wladimir J. van der Laan2013-12-031-0/+2
| | | | | | | | | | | | | | Remove unnecessary dependencies for bitcoin-cli (leveldb, berkelydb, wallet, RPC server) Build system changes: - split libbitcoin.a into libbitcoin_common.a, libbitcoin_server.a and libbitcoin_cli.a Code changes (movement only): - split up HelpMessage into HelpMessage in init.cpp and HelpMessageCli in rpcclient.cpp - move uiInterface from init.cpp to util.cpp
* core: remove includes in .cpp, if header is already in .hPhilip Kaufmann2013-11-151-2/+0
| | | | | - example: if util.h includes stdint.h, remove it from util.cpp, as util.h is the first header included in util.cpp
* Use C99 printf statements in mingwWladimir J. van der Laan2013-11-131-4/+0
| | | | | | | 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
* Refactor: pull alert string sanitization into utilGavin Andresen2013-11-111-0/+13
|
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-69/+85
| | | | | | | | | 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.
* Merge pull request #3076 from lano1106/uint256_utilWladimir J. van der Laan2013-11-041-5/+5
|\ | | | | Make util phexdigit array reusable
| * Make util phexdigit array reusableOlivier Langlois2013-10-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | class template base_uint had its own private lookup table. This is saving 256 bytes per instantiation. The result is not spectacular as bitcoin-qt has only shrinked of about 1Kb but it is still valid improvement. Also, I have replaced a for loop with a memset() call. Made CBigNum::SetHex() use the new HexDigit() function. Signed-off-by: Olivier Langlois <[email protected]>
* | Merge pull request #3114Pieter Wuille2013-11-011-1/+4
|\ \ | | | | | | | | | a616206 Give peer time-adjustment data an own lock (Pieter Wuille)
| * | Give peer time-adjustment data an own lockPieter Wuille2013-10-261-1/+4
| | | | | | | | | | | | | | | Instead of relying on cs_main (defined in a different module) to prevent concurrent access to it.
* | | re-work -debug switch handlingPhilip Kaufmann2013-10-301-4/+13
|/ / | | | | | | | | | | | | | | | | | | | | | | - 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
* | Merge pull request #3046 from sarchar/lockedpage-changeGavin Andresen2013-10-201-2/+0
|\ \ | | | | | | Changing LockedPageManager to use a managed instance
| * | Changing LockedPageManager to use a managed instanceChuck2013-10-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures the allocator is ready no matter when it's needed (as some STL implementations allocate in constructors -- i.e., MSVC's STL in debug builds). Using boost::call_once to guarantee thread-safe static initialization. Adding some comments describing why the change was made. Addressing deinitialization of the LockedPageManager object by initializing it in a local static initializer and adding an assert in the base's destructor.
* | | Bump Year Number to 2013super32013-10-201-1/+1
|/ /
* / make fCommandLine a local variable in AppInit()Philip Kaufmann2013-10-081-1/+0
|/
* fix some printf -> LogPrintf leftoversPhilip Kaufmann2013-09-201-10/+2
|
* Replace printf with LogPrintf / LogPrintGavin Andresen2013-09-181-13/+13
|
* Refactor: OutputDebugStringF -> LogPrint(category, ...)Gavin Andresen2013-09-181-1/+9
|
* More fixes for blockchain corruption on OSX.Gregory Maxwell2013-09-151-0/+2
| | | | | | | | | As we'd previously learned, OSX's fsync is a data eating lie. Since 0.8.4 we're still getting some reports of disk corruption on OSX but now all of it looks like the block files have gotten out of sync with the database. It turns out that we were still using fsync() on the block files, so this isn't surprising.
* GetDataDir(): cache paths for each network separatelyGavin Andresen2013-08-221-11/+18
|
* Merge pull request #2855 from Diapolo/guard_CreatePidFileGavin Andresen2013-08-051-0/+2
|\ | | | | exclude CreatePidFile() function on WIN32 as it is unused
| * exclude CreatePidFile() function on WIN32 as it is unusedPhilip Kaufmann2013-07-241-0/+2
| |
* | Remove #define loop from util.hGavin Andresen2013-07-311-4/+4
|/ | | | | Replace the loop macro with while (true). The #define caused problems for Qt.
* Introduce a CChainParameters singleton class and regtest mode.Mike Hearn2013-06-191-3/+3
| | | | | | | | | | | | | The new class is accessed via the Params() method and holds most things that vary between main, test and regtest networks. The regtest mode has two purposes, one is to run the bitcoind/bitcoinj comparison tool which compares two separate implementations of the Bitcoin protocol looking for divergence. The other is that when run, you get a local node which can mine a single block instantly, which is highly convenient for testing apps during development as there's no need to wait 10 minutes for a block on the testnet.
* changes to thread code (directly use boost::thread)Philip Kaufmann2013-06-101-12/+0
| | | | | | | - removes our NewThread() function an replaces remaining calls with boost::thread with our TraceThread template - remove ExitThread() function - fix THREAD_PRIORITY_ABOVE_NORMAL for non Windows OSes
* Create parent directories if needed in GetDataDirWladimir J. van der Laan2013-06-081-1/+1
| | | | One-line change. Fixes #2752.
* remove GetBoolArg() fDefault parameter defaulting to falsePhilip Kaufmann2013-06-011-4/+3
| | | | | | | | - explicitly set the default of all GetBoolArg() calls - rework getarg_test.cpp and util_tests.cpp to cover this change - some indentation fixes - move macdockiconhandler.h include in bitcoin.cpp to the "our headers" section