aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
AgeCommit message (Collapse)Author
2012-05-20Merge pull request #1354 from fanquake/masterPieter Wuille
Update Header Licenses
2012-05-20Merge pull request #1302 from laanwj/2012_05_utilstringsWladimir J. van der Laan
Get rid of snprintf (except one) with fixed buffers, shorten code
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-16Add new utility functions FileCommit(), RenameOver()Jeff Garzik
2012-05-14Get rid of snprintf (except one) with fixed buffers, shorten codeWladimir J. van der Laan
- Use strprintf or vstrprintf instead of snprintf
2012-05-13Move GetStartOnSystemStartup and SetStartOnSystemStartup to GUI codeWladimir J. van der Laan
2012-05-11Split synchronization mechanisms from util.{h,cpp}Pieter Wuille
2012-05-11Use polling instead of boost's broken semaphore on OSXPieter Wuille
2012-05-11Use semaphores instead of condition variablesPieter Wuille
2012-05-09Merge pull request #1134 from Diapolo/util-updatesJeff Garzik
small util.cpp/h changes
2012-05-09util.h/.ccp: modifiy some comments / rename MyGetSpecialFolderPath() -> ↵Philip Kaufmann
GetSpecialFolderPath(), set fCreate default to true and remove the fallback (not Win >= Vista compatible anyway) / remove namespace fs stuff where only used once / misc small changes'
2012-05-09Fix DEBUG_LOCKCONTENTIONMatt Corallo
2012-05-01remove duplicate definition of SecureString in util.hWladimir J. van der Laan
SecureString was moved to allocators.h in commit 6cb6d623479c5dd42d91de7a4d391078d0800e54
2012-04-23Merge pull request #1140 from jgarzik/sign-compareJeff Garzik
Address many more sign comparison warnings
2012-04-23Change signed->unsigned at 3 code sitesJeff Garzik
This resolves signed/unsigned comparison warnings.
2012-04-22Make GetDataDir return absolute pathsPieter Wuille
2012-04-21Integrate @JoelKatz's optimized ToHex (#562) into current HexStr functionWladimir J. van der Laan
2012-04-17Further reduce header dependenciesPieter Wuille
This commit removes the dependency of serialize.h on PROTOCOL_VERSION, and makes this parameter required instead of implicit. This is much saner, as it makes the places where changing a version number can have an influence obvious.
2012-04-17Remove headers.hPieter Wuille
2012-04-12Remove obsolete Win32 AffinityBugWorkaround()Jeff Garzik
Reference miner exists for testnet-in-a-box type situations, and as a reference. We don't care enough about highly optimized internal mining to keep workarounds like this.
2012-04-11Use filesystem::path instead of manual string tinkeringPieter Wuille
Where possible, use boost::filesystem::path instead of std::string or char* for filenames. This avoids a lot of manual string tinkering, in favor of path::operator/. GetDataDir is also reworked significantly, it now only keeps two cached directory names (the network-specific data dir, and the root data dir), which are decided through a parameter instead of pre-initialized global variables. Finally, remove the "upgrade from 0.1.5" case where a debug.log in the current directory has to be removed.
2012-04-09Do not report spurious deadlocks caused by TRY_LOCKPieter Wuille
2012-04-09Use scoped locks instead of CRITICAL_BLOCKPieter Wuille
2012-04-04Locking system overhaul, add condition variablesPieter Wuille
This commit simplifies the locking system: CCriticalSection becomes a simple typedef for boost::interprocess::interprocess_recursive_mutex, and CCriticalBlock and CTryCriticalBlock are replaced by a templated CMutexLock, which wraps boost::interprocess::scoped_lock. By making the lock type a template parameter, some critical sections can now be changed to non-recursive locks, which support waiting via condition variables. These are implemented in CWaitableCriticalSection and WAITABLE_CRITICAL_BLOCK. CWaitableCriticalSection is a wrapper for a different Boost mutex, which supports waiting/notification via condition variables. This should enable us to remove much of the used polling code. Important is that this mutex is not recursive, so functions that perform the locking must not call eachother. Because boost::interprocess::scoped_lock does not support assigning and copying, I had to revert to the older CRITICAL_BLOCK macros that use a nested for loop instead of a simple if.
2012-04-04move translation function _ to qtui.h/noui.h instead of util.hWladimir J. van der Laan
2012-04-04remove dependency on serialize.h and util.h for SecureStringWladimir J. van der Laan
2012-04-03VC2010 compile fixesWladimir J. van der Laan
2012-03-26Begin doxygen-compatible commentsPieter Wuille
2012-03-25remove unused functions from util.h/util.cppWladimir J. van der Laan
2012-03-10Resolves issue #922 - "wallet passphrase timeout of several years doesn't work"Gregory Maxwell
2^31 milliseconds is only about 25 days. Also clamps Sleep() to 10 years, because it currently sleeps for 0 seconds when the sleep time would cross 2^31 seconds since the epoch. Hopefully boost will be fixed by 2028.
2012-02-26Reworked QT settingsGavin Andresen
2012-02-11Macros for manual critical sectionsPieter Wuille
2012-02-07Update all copyrights to 2012Gavin Andresen
2012-02-07Unit tests for the GetArg() methodsGavin Andresen
2012-02-06-bip16 option (default: 1) to support / not support BIP 16. And bumped ↵Gavin Andresen
default BIP16 switchover date from Feb 15 to Mar 1
2012-01-14Replace tabs with four spaces to comply with coding standard in doc/coding.txtLars Rasmusson
2012-01-13Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen
2012-01-06Network stack refactorPieter Wuille
This introduces CNetAddr and CService, respectively wrapping an (IPv6) IP address and an IP+port combination. This functionality used to be part of CAddress, which also contains network flags and connection attempt information. These extra fields are however not always necessary. These classes, along with logic for creating connections and doing name lookups, are moved to netbase.{h,cpp}, which does not depend on headers.h. Furthermore, CNetAddr is mostly IPv6-ready, though IPv6 functionality is not yet enabled for the application itself.
2012-01-03Fix issue #659, and cleanup wallet/command-line argument handling a bitGavin Andresen
2011-12-21Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan
This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
2011-12-20Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr
2011-12-20Merge pull request #673 from mndrix/less-time-dataGavin Andresen
Store fewer time samples
2011-12-19Use std::numeric_limits<> for typesafe INT_MAX/etcGavin Andresen
2011-12-19Cleanup: removed dead code, and use C99 typedefs for int64 (supported by all ↵Gavin Andresen
modern c++ compilers)
2011-12-19Merge pull request #707 from gavinandresen/BIP14Gavin Andresen
Implement BIP 14 : separate protocol version from client version
2011-12-19Implement BIP 14 : separate protocol version from client versionGavin Andresen
2011-12-16Move more newlines out of strings, and fix translations.Gavin Andresen
2011-12-01Retain only the most recent time samplesMichael Hendricks
Remembering all time samples makes nTimeOffset slow to respond to system clock corrections. For instance, I start my node with a system clock that's 30 minutes slow and run it for a few days. During that time, I accumulate 10,000 offset samples with a median of 1800 seconds. Now I correct my system clock. Without this change, my node must collect another 10,000 samples before nTimeOffset is correct again. With this change, I must only accumulate 100 samples to correct the offset. Storing unlimited time samples also allows an attacker with many IP addresses (ex, a large botnet) to perform a memory exhaustion attack against Bitcoin nodes. The attacker sends a version message from each IP to his target, consuming more of the target's memory each time. Time samples are small, so this attack might be impractical under the old code, but it's impossible with the new code.
2011-11-26Implement an mlock()'d string class for storing passphrasesDylan Noblesmith
SecureString is identical to std::string except with secure_allocator substituting for std::allocator. This makes casting between them impossible, so converting between the two at API boundaries requires calling ::c_str() for now.
2011-11-02Cleaned up the critical section macros.Clark Gaebel