aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
Commit message (Collapse)AuthorAgeFilesLines
* 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. Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: 3e8ac6a
* remove ParseString(...) which is never usedKamil Domanski2014-05-211-1/+0
| | | | | Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: be54b87
* SetupEnvironment() - clean commitStuart Cardall2014-05-191-0/+1
| | | | | Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: 5248ff4
* Remove dummy PRIszX macros for formattingWladimir J. van der Laan2014-05-121-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. Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: 783b182
* 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
|
* fix some cosmetic glitches in the codebasePhilip Kaufmann2013-09-091-1/+1
| | | | | | | | | | | - rename URL into URI in paymentserver where correct - add some missing Qt-coding-stuff in paymentserver - change QSpinBox to QLineEdit as base for BitcoinAmountField in .ui files (as this is the result when converting the BAF back into base) - remove some c_str() and replace with QString::fromStdString() - remove several new-lines - remove unneeded spaces - indentation fixes
* autotools: switch to autotools buildsystemCory Fields2013-09-051-4/+5
|
* Merge pull request #2618 from fcicq/solaris-supportJeff Garzik2013-08-241-0/+8
|\ | | | | Partial solaris support
| * Add missing constant for solarisfcicq2013-07-171-0/+8
| |
* | Make RPC password resistant to timing attacksGavin Andresen2013-08-081-0/+15
| | | | | | | | | | | | | | Fixes issue#2838; this is a tweaked version of pull#2845 that should not leak the length of the password and is more generic, in case we run into other situations where we need timing-attack-resistant comparisons.
* | 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-1/+0
|/ | | | | Replace the loop macro with while (true). The #define caused problems for Qt.
* Dump addresses every 15 minutes instead of 10 secondsPieter Wuille2013-06-241-2/+2
|
* Introduce a CChainParameters singleton class and regtest mode.Mike Hearn2013-06-191-1/+0
| | | | | | | | | | | | | 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.
* fixed: don't use thread::sleep_for where it's known to be brokentheuni2013-06-141-1/+5
| | | | Fixes #2690.
* fixed: include boost header as necessarytheuni2013-06-131-0/+1
| | | | | | Without this include, sometimes BOOST_VERSION was defined and sometimes it was not, depending on which includes came before it. The result was a random mix of sleep or sleep_for for boost versions >= 1.50.
* changes to thread code (directly use boost::thread)Philip Kaufmann2013-06-101-8/+1
| | | | | | | - 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
* remove GetBoolArg() fDefault parameter defaulting to falsePhilip Kaufmann2013-06-011-1/+1
| | | | | | | | - 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
* Merge pull request #2552 from Diapolo/win-typedefJeff Garzik2013-05-301-2/+0
|\ | | | | remove obsolete and unused typedef for Windows
| * remove obsolete and unused typedef for WindowsPhilip Kaufmann2013-04-231-2/+0
| |
* | Make CPubKey statically allocatedPieter Wuille2013-05-301-1/+2
| |
* | Explicitly #include stdarg.h, for access to va_listRobert Backhaus2013-05-241-0/+2
| |
* | Try to increase file descriptor rlimit if necessaryPieter Wuille2013-04-291-0/+1
|/ | | | As the default can be too low, especially on OSX.
* small indentation, space, formatting fixes (no code changes)Philip Kaufmann2013-04-061-3/+3
|
* Clean up shutdown processGavin Andresen2013-04-031-2/+0
|
* LoopForever and ThreadTrace helpersGavin Andresen2013-04-031-0/+56
|
* Rename util.h Sleep --> MilliSleepGavin Andresen2013-04-031-5/+8
| | | | | | | | Two reasons for this change: 1. Need to always use boost::thread's sleep, even on Windows, so the sleeps can be interrupted (prior code used Windows' built-in Sleep). 2. I always forgot what units the old Sleep took.
* Shutdown cleanup prep-workGavin Andresen2013-04-031-1/+2
| | | | | | | | | | Create a boost::thread_group object at the qt/bitcoind main-loop level that will hold pointers to all the main-loop threads. This will replace the vnThreadsRunning[] array. For testing, ported the BitcoinMiner threads to use its own boost::thread_group.
* Merge pull request #2229 from sipa/preallocGavin Andresen2013-02-221-0/+1
|\ | | | | Native versions for AllocateFileRange()