Merge pull request #87 from fsb4000/MSVC
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Wed, 31 Dec 2014 01:41:39 +0000 (04:41 +0300)
committerCryptoManiac <CryptoManiac@users.noreply.github.com>
Wed, 31 Dec 2014 01:41:39 +0000 (04:41 +0300)
Msvc

18 files changed:
MSVC/mynovacoin/mynovacoin.vcxproj
MSVC/mynovacoinqt/mynovacoinqt.vcxproj
contrib/gentoo/novacoin-0.5.0.ebuild [new file with mode: 0644]
src/addrman.h
src/bignum.h
src/db.h
src/main.h
src/net.cpp
src/net.h
src/qt/bitcoinunits.cpp
src/qt/bitcoinunits.h
src/qt/forms/optionsdialog.ui
src/qt/locale/bitcoin_ru.ts
src/qt/transactiontablemodel.cpp
src/qt/transactiontablemodel.h
src/qt/transactionview.cpp
src/script.cpp
src/script.h

index 7e28196..32192a1 100644 (file)
@@ -85,7 +85,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
-      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\deps\openssl-1.0.1j\inc32;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_55_0;..\..\..\deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <Optimization>Disabled</Optimization>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
-      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\Deps\openssl-1.0.1j\inc32;..\..\..\Deps\db-6.0.20\build_windows;..\..\..\Deps\boost_1_55_0;..\..\..\Deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <Optimization>Disabled</Optimization>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
-      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\deps\openssl-1.0.1j\inc32;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_55_0;..\..\..\deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
-      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\Deps\openssl-1.0.1j\inc32;..\..\..\Deps\db-6.0.20\build_windows;..\..\..\Deps\boost_1_55_0;..\..\..\Deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
index b2f640a..1c5fca7 100644 (file)
@@ -230,7 +230,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2-64\qtbase\bin\lrelease C:\
       <WarningLevel>0</WarningLevel>
     </Midl>
     <ResourceCompile>
-      <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ResourceCompile>
     <PreBuildEvent>
       <Command>C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2\qtbase\bin\lrelease C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.ts -qm C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.qm
@@ -248,7 +248,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2\qtbase\bin\lrelease C:\MyP
       <ExceptionHandling>Sync</ExceptionHandling>
       <ObjectFileName>$(IntDir)</ObjectFileName>
       <Optimization>MaxSpeed</Optimization>
-      <PreprocessorDefinitions>USE_UPNP;USE_QRCODE;UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_UPNP;USE_QRCODE;UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessToFile>false</PreprocessToFile>
       <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -277,7 +277,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2\qtbase\bin\lrelease C:\MyP
       <WarningLevel>0</WarningLevel>
     </Midl>
     <ResourceCompile>
-      <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ResourceCompile>
     <PreBuildEvent>
       <Command>C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2-64\qtbase\bin\lrelease C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.ts -qm C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.qm
diff --git a/contrib/gentoo/novacoin-0.5.0.ebuild b/contrib/gentoo/novacoin-0.5.0.ebuild
new file mode 100644 (file)
index 0000000..fe315b9
--- /dev/null
@@ -0,0 +1,118 @@
+\feff# Distributed under the terms of the GNU General Public License v2
+EAPI=5
+LANGS="en ru"
+
+inherit db-use eutils fdo-mime gnome2-utils kde4-functions qt4-r2
+
+DB_VER="4.8"
+
+DESCRIPTION="NovaCoin - a hybrid PoW+PoS energy efficient p2p-cryptocurrency and electronic payment system."
+HOMEPAGE="https://novaco.in/"
+SRC_URI="https://github.com/${PN}-project/${PN}/archive/nvc-v${PV}.tar.gz -> ${PN}-${PV}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+dbus -ipv6 kde +qrcode +upnp"
+
+RDEPEND="
+       dev-libs/boost[threads(+)]
+       dev-libs/openssl:0[-bindist]
+       qrcode? (
+               media-gfx/qrencode
+       )
+       upnp? (
+               net-libs/miniupnpc
+       )
+       sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
+       dev-qt/qtgui:4
+       dbus? (
+               dev-qt/qtdbus:4
+       )
+"
+DEPEND="${RDEPEND}
+       >=app-shells/bash-4.1
+       >sys-devel/gcc-4.3.3
+       >=dev-libs/openssl-0.9.8g
+       >=sys-libs/db-4.8.30
+       >=dev-libs/boost-1.37
+       >=net-libs/miniupnpc-1.6
+"
+
+DOCS="doc/translation_process.md"
+
+S="${WORKDIR}/${PN}-nvc-v${PV}"
+
+src_prepare() {
+       cd src || die
+
+       local filt= yeslang= nolang=
+
+       for ts in $(ls qt/locale/*.ts)
+       do
+               x="${ts/*bitcoin_/}"
+               x="${x/.ts/}"
+               if ! use "linguas_$x"; then
+                       nolang="$nolang $x"
+                       rm "$ts"
+                       filt="$filt\\|$x"
+               else
+                       yeslang="$yeslang $x"
+               fi
+       done
+
+       filt="bitcoin_\\(${filt:2}\\)\\.\(qm\|ts\)"
+       sed "/${filt}/d" -i 'qt/bitcoin.qrc'
+       einfo "Languages -- Enabled:$yeslang -- Disabled:$nolang"
+}
+
+src_configure() {
+       OPTS=()
+
+       use dbus && OPTS+=("USE_DBUS=1")
+       if use upnp; then
+               OPTS+=("USE_UPNP=1")
+       else
+               OPTS+=("USE_UPNP=-")
+       fi
+
+       use qrcode && OPTS+=("USE_QRCODE=1")
+       use ipv6 || OPTS+=("USE_IPV6=-")
+
+       OPTS+=("BDB_INCLUDE_PATH=$(db_includedir "${DB_VER}")")
+       OPTS+=("BDB_LIB_SUFFIX=-${DB_VER}")
+
+       if has_version '>=dev-libs/boost-1.52'; then
+               OPTS+=("LIBS+=-lboost_chrono\$\$BOOST_LIB_SUFFIX")
+       fi
+
+       eqmake4 ${PN}-qt.pro "${OPTS[@]}"
+}
+
+src_install() {
+       dobin ${PN}-qt
+
+       insinto /usr/share/pixmaps
+       newins "src/qt/res/icons/novacoin-128.png" "${PN}.png"
+
+       make_desktop_entry "${PN}-qt" "Novacoin" "/usr/share/pixmaps/${PN}.png" "Network;P2P;Finance;"
+
+       if use kde; then
+               insinto /usr/share/kde4/services
+               newins contrib/debian/novacoin-qt.protocol ${PN}.protocol
+       fi
+}
+
+update_caches() {
+       gnome2_icon_cache_update
+       fdo-mime_desktop_database_update
+       buildsycoca
+}
+
+pkg_postinst() {
+       update_caches
+}
+
+pkg_postrm() {
+       update_caches
+}
\ No newline at end of file
index 5f5bf79..beb543a 100644 (file)
@@ -569,7 +569,7 @@ public:
     // Return the number of (unique) addresses in all tables.
     int size()
     {
-        return vRandom.size();
+        return (int) vRandom.size();
     }
 
     // Consistency check
index e3e60f5..3570840 100644 (file)
@@ -88,7 +88,7 @@ public:
     CBigNum(uint64_t n) { BN_init(this); setuint64(n); }
 
     explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); }
-    explicit CBigNum(const std::vector<unsigned char>& vch)
+    explicit CBigNum(const std::vector<uint8_t>& vch)
     {
         BN_init(this);
         setvch(vch);
@@ -143,15 +143,15 @@ public:
     {
         uint64_t n = BN_get_word(this);
         if (!BN_is_negative(this))
-            return (n > (uint64_t)std::numeric_limits<int32_t>::max() ? std::numeric_limits<int32_t>::max() : n);
+            return (n > (uint64_t)std::numeric_limits<int32_t>::max() ? std::numeric_limits<int32_t>::max() : (int32_t)n);
         else
             return (n > (uint64_t)std::numeric_limits<int32_t>::max() ? std::numeric_limits<int32_t>::min() : -(int32_t)n);
     }
 
     void setint64(int64_t sn)
     {
-        unsigned char pch[sizeof(sn) + 6];
-        unsigned char* p = pch + 4;
+        uint8_t pch[sizeof(sn) + 6];
+        uint8_t* p = pch + 4;
         bool fNegative;
         uint64_t n;
 
@@ -169,7 +169,7 @@ public:
         bool fLeadingZeroes = true;
         for (int i = 0; i < 8; i++)
         {
-            unsigned char c = (n >> 56) & 0xff;
+            uint8_t c = (n >> 56) & 0xff;
             n <<= 8;
             if (fLeadingZeroes)
             {
@@ -183,7 +183,7 @@ public:
             }
             *p++ = c;
         }
-        uint32_t nSize = p - (pch + 4);
+        uint32_t nSize = (uint32_t) (p - (pch + 4));
         pch[0] = (nSize >> 24) & 0xff;
         pch[1] = (nSize >> 16) & 0xff;
         pch[2] = (nSize >> 8) & 0xff;
@@ -193,27 +193,35 @@ public:
 
     uint64_t getuint64()
     {
-        unsigned int nSize = BN_bn2mpi(this, NULL);
+        size_t nSize = BN_bn2mpi(this, NULL);
         if (nSize < 4)
             return 0;
-        std::vector<unsigned char> vch(nSize);
+        std::vector<uint8_t> vch(nSize);
         BN_bn2mpi(this, &vch[0]);
         if (vch.size() > 4)
             vch[4] &= 0x7f;
         uint64_t n = 0;
-        for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
-            ((unsigned char*)&n)[i] = vch[j];
+        for (size_t i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
+            ((uint8_t*)&n)[i] = vch[j];
         return n;
     }
 
     void setuint64(uint64_t n)
     {
-        unsigned char pch[sizeof(n) + 6];
-        unsigned char* p = pch + 4;
+        // Use BN_set_word if word size is sufficient for uint64_t
+        if (sizeof(n) <= sizeof(BN_ULONG))
+        {
+            if (!BN_set_word(this, (BN_ULONG)n))
+                throw bignum_error("CBigNum conversion from uint64_t : BN_set_word failed");
+            return;
+        }
+
+        uint8_t pch[sizeof(n) + 6];
+        uint8_t* p = pch + 4;
         bool fLeadingZeroes = true;
         for (int i = 0; i < 8; i++)
         {
-            unsigned char c = (n >> 56) & 0xff;
+            uint8_t c = (n >> 56) & 0xff;
             n <<= 8;
             if (fLeadingZeroes)
             {
@@ -225,24 +233,24 @@ public:
             }
             *p++ = c;
         }
-        uint32_t nSize = p - (pch + 4);
+        uint32_t nSize = (uint32_t) (p - (pch + 4));
         pch[0] = (nSize >> 24) & 0xff;
         pch[1] = (nSize >> 16) & 0xff;
         pch[2] = (nSize >> 8) & 0xff;
         pch[3] = (nSize) & 0xff;
-        BN_mpi2bn(pch, p - pch, this);
+        BN_mpi2bn(pch, (int)(p - pch), this);
     }
 
     void setuint160(uint160 n)
     {
-        unsigned char pch[sizeof(n) + 6];
-        unsigned char* p = pch + 4;
+        uint8_t pch[sizeof(n) + 6];
+        uint8_t* p = pch + 4;
         bool fLeadingZeroes = true;
-        unsigned char* pbegin = (unsigned char*)&n;
-        unsigned char* psrc = pbegin + sizeof(n);
+        uint8_t* pbegin = (uint8_t*)&n;
+        uint8_t* psrc = pbegin + sizeof(n);
         while (psrc != pbegin)
         {
-            unsigned char c = *(--psrc);
+            uint8_t c = *(--psrc);
             if (fLeadingZeroes)
             {
                 if (c == 0)
@@ -253,12 +261,12 @@ public:
             }
             *p++ = c;
         }
-        uint32_t nSize = p - (pch + 4);
+        uint32_t nSize = (uint32_t) (p - (pch + 4));
         pch[0] = (nSize >> 24) & 0xff;
         pch[1] = (nSize >> 16) & 0xff;
         pch[2] = (nSize >> 8) & 0xff;
         pch[3] = (nSize >> 0) & 0xff;
-        BN_mpi2bn(pch, p - pch, this);
+        BN_mpi2bn(pch, (int) (p - pch), this);
     }
 
     uint160 getuint160() const
@@ -266,26 +274,26 @@ public:
         unsigned int nSize = BN_bn2mpi(this, NULL);
         if (nSize < 4)
             return 0;
-        std::vector<unsigned char> vch(nSize);
+        std::vector<uint8_t> vch(nSize);
         BN_bn2mpi(this, &vch[0]);
         if (vch.size() > 4)
             vch[4] &= 0x7f;
         uint160 n = 0;
-        for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
-            ((unsigned char*)&n)[i] = vch[j];
+        for (size_t i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
+            ((uint8_t*)&n)[i] = vch[j];
         return n;
     }
 
     void setuint256(uint256 n)
     {
-        unsigned char pch[sizeof(n) + 6];
-        unsigned char* p = pch + 4;
+        uint8_t pch[sizeof(n) + 6];
+        uint8_t* p = pch + 4;
         bool fLeadingZeroes = true;
-        unsigned char* pbegin = (unsigned char*)&n;
-        unsigned char* psrc = pbegin + sizeof(n);
+        uint8_t* pbegin = (uint8_t*)&n;
+        uint8_t* psrc = pbegin + sizeof(n);
         while (psrc != pbegin)
         {
-            unsigned char c = *(--psrc);
+            uint8_t c = *(--psrc);
             if (fLeadingZeroes)
             {
                 if (c == 0)
@@ -296,12 +304,12 @@ public:
             }
             *p++ = c;
         }
-        uint32_t nSize = p - (pch + 4);
+        uint32_t nSize = (uint32_t) (p - (pch + 4));
         pch[0] = (nSize >> 24) & 0xff;
         pch[1] = (nSize >> 16) & 0xff;
         pch[2] = (nSize >> 8) & 0xff;
         pch[3] = (nSize >> 0) & 0xff;
-        BN_mpi2bn(pch, p - pch, this);
+        BN_mpi2bn(pch, (int) (p - pch), this);
     }
 
     uint256 getuint256() const
@@ -309,26 +317,26 @@ public:
         unsigned int nSize = BN_bn2mpi(this, NULL);
         if (nSize < 4)
             return 0;
-        std::vector<unsigned char> vch(nSize);
+        std::vector<uint8_t> vch(nSize);
         BN_bn2mpi(this, &vch[0]);
         if (vch.size() > 4)
             vch[4] &= 0x7f;
         uint256 n = 0;
-        for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
-            ((unsigned char*)&n)[i] = vch[j];
+        for (size_t i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
+            ((uint8_t*)&n)[i] = vch[j];
         return n;
     }
 
-    void setBytes(const std::vector<unsigned char>& vchBytes)
+    void setBytes(const std::vector<uint8_t>& vchBytes)
     {
-        BN_bin2bn(&vchBytes[0], vchBytes.size(), this);
+        BN_bin2bn(&vchBytes[0], (int) vchBytes.size(), this);
     }
 
-    std::vector<unsigned char> getBytes() const
+    std::vector<uint8_t> getBytes() const
     {
         int nBytes = BN_num_bytes(this);
 
-        std::vector<unsigned char> vchBytes(nBytes);
+        std::vector<uint8_t> vchBytes(nBytes);
 
         int n = BN_bn2bin(this, &vchBytes[0]);
         if (n != nBytes) {
@@ -338,10 +346,10 @@ public:
         return vchBytes;
     }
 
-    void setvch(const std::vector<unsigned char>& vch)
+    void setvch(const std::vector<uint8_t>& vch)
     {
-        std::vector<unsigned char> vch2(vch.size() + 4);
-        uint32_t nSize = vch.size();
+        std::vector<uint8_t> vch2(vch.size() + 4);
+        uint32_t nSize = (uint32_t) vch.size();
         // BIGNUM's byte stream format expects 4 bytes of
         // big endian size data info at the front
         vch2[0] = (nSize >> 24) & 0xff;
@@ -350,15 +358,15 @@ public:
         vch2[3] = (nSize >> 0) & 0xff;
         // swap data to big endian
         reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
-        BN_mpi2bn(&vch2[0], vch2.size(), this);
+        BN_mpi2bn(&vch2[0], (int) vch2.size(), this);
     }
 
-    std::vector<unsigned char> getvch() const
+    std::vector<uint8_t> getvch() const
     {
         unsigned int nSize = BN_bn2mpi(this, NULL);
         if (nSize <= 4)
-            return std::vector<unsigned char>();
-        std::vector<unsigned char> vch(nSize);
+            return std::vector<uint8_t>();
+        std::vector<uint8_t> vch(nSize);
         BN_bn2mpi(this, &vch[0]);
         vch.erase(vch.begin(), vch.begin() + 4);
         reverse(vch.begin(), vch.end());
@@ -368,19 +376,19 @@ public:
     CBigNum& SetCompact(uint32_t nCompact)
     {
         uint32_t nSize = nCompact >> 24;
-        std::vector<unsigned char> vch(4 + nSize);
+        std::vector<uint8_t> vch(4 + nSize);
         vch[3] = nSize;
         if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
         if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
         if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
-        BN_mpi2bn(&vch[0], vch.size(), this);
+        BN_mpi2bn(&vch[0], (int) vch.size(), this);
         return *this;
     }
 
     uint32_t GetCompact() const
     {
         uint32_t nSize = BN_bn2mpi(this, NULL);
-        std::vector<unsigned char> vch(nSize);
+        std::vector<uint8_t> vch(nSize);
         nSize -= 4;
         BN_bn2mpi(this, &vch[0]);
         uint32_t nCompact = nSize << 24;
@@ -413,7 +421,7 @@ public:
         while (isxdigit(*psz))
         {
             *this <<= 4;
-            int n = phexdigit[(unsigned char)*psz++];
+            int n = phexdigit[(uint8_t)*psz++];
             *this += n;
         }
         if (fNegative)
@@ -437,7 +445,7 @@ public:
             if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
                 throw bignum_error("CBigNum::ToString() : BN_div failed");
             bn = dv;
-            unsigned int c = rem.getuint32();
+            uint32_t c = rem.getuint32();
             str += "0123456789abcdef"[c];
         }
         if (BN_is_negative(this))
@@ -465,7 +473,7 @@ public:
     template<typename Stream>
     void Unserialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION)
     {
-        std::vector<unsigned char> vch;
+        std::vector<uint8_t> vch;
         ::Unserialize(s, vch, nType, nVersion);
         setvch(vch);
     }
@@ -502,7 +510,7 @@ public:
         CBigNum ret;
         if (!BN_mod_mul(&ret, this, &b, &m, pctx))
             throw bignum_error("CBigNum::mul_mod : BN_mod_mul failed");
-        
+
         return ret;
     }
 
@@ -579,7 +587,7 @@ public:
         if(ret < 0){
             throw bignum_error("CBigNum::isPrime :BN_is_prime");
         }
-        return ret;
+        return ret != 0;
     }
 
     bool isOne() const {
index 750d6b0..993b7a7 100644 (file)
--- a/src/db.h
+++ b/src/db.h
@@ -122,7 +122,7 @@ protected:
         CDataStream ssKey(SER_DISK, CLIENT_VERSION);
         ssKey.reserve(1000);
         ssKey << key;
-        Dbt datKey(&ssKey[0], ssKey.size());
+        Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
 
         // Read
         Dbt datValue;
@@ -138,6 +138,7 @@ protected:
             ssValue >> value;
         }
         catch (std::exception &e) {
+            (void)e;
             return false;
         }
 
@@ -159,13 +160,13 @@ protected:
         CDataStream ssKey(SER_DISK, CLIENT_VERSION);
         ssKey.reserve(1000);
         ssKey << key;
-        Dbt datKey(&ssKey[0], ssKey.size());
+        Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
 
         // Value
         CDataStream ssValue(SER_DISK, CLIENT_VERSION);
         ssValue.reserve(10000);
         ssValue << value;
-        Dbt datValue(&ssValue[0], ssValue.size());
+        Dbt datValue(&ssValue[0], (uint32_t)ssValue.size());
 
         // Write
         int ret = pdb->put(activeTxn, &datKey, &datValue, (fOverwrite ? 0 : DB_NOOVERWRITE));
@@ -188,7 +189,7 @@ protected:
         CDataStream ssKey(SER_DISK, CLIENT_VERSION);
         ssKey.reserve(1000);
         ssKey << key;
-        Dbt datKey(&ssKey[0], ssKey.size());
+        Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
 
         // Erase
         int ret = pdb->del(activeTxn, &datKey, 0);
@@ -208,7 +209,7 @@ protected:
         CDataStream ssKey(SER_DISK, CLIENT_VERSION);
         ssKey.reserve(1000);
         ssKey << key;
-        Dbt datKey(&ssKey[0], ssKey.size());
+        Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
 
         // Exists
         int ret = pdb->exists(activeTxn, &datKey, 0);
@@ -236,13 +237,13 @@ protected:
         if (fFlags == DB_SET || fFlags == DB_SET_RANGE || fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE)
         {
             datKey.set_data(&ssKey[0]);
-            datKey.set_size(ssKey.size());
+            datKey.set_size((uint32_t)ssKey.size());
         }
         Dbt datValue;
         if (fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE)
         {
             datValue.set_data(&ssValue[0]);
-            datValue.set_size(ssValue.size());
+            datValue.set_size((uint32_t)ssValue.size());
         }
         datKey.set_flags(DB_DBT_MALLOC);
         datValue.set_flags(DB_DBT_MALLOC);
index 0c54e7e..2cb3ea7 100644 (file)
@@ -471,7 +471,7 @@ public:
     void SetNull()
     {
         nVersion = CTransaction::CURRENT_VERSION;
-        nTime = GetAdjustedTime();
+        nTime = (uint32_t) GetAdjustedTime();
         vin.clear();
         vout.clear();
         nLockTime = 0;
@@ -619,6 +619,7 @@ public:
             filein >> *this;
         }
         catch (std::exception &e) {
+            (void)e;
             return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
         }
 
@@ -975,7 +976,7 @@ public:
         hashSig >>= 159; // take the first bit of the hash
         if (fDebug && GetBoolArg("-printstakemodifier"))
             printf(" entropybit=%" PRId64 "\n", hashSig.Get64());
-        return hashSig.Get64();
+        return (unsigned int)hashSig.Get64();
     }
 
     // ppcoin: two types of block: proof-of-work or proof-of-stake
@@ -1009,7 +1010,7 @@ public:
         BOOST_FOREACH(const CTransaction& tx, vtx)
             vMerkleTree.push_back(tx.GetHash());
         int j = 0;
-        for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+        for (int nSize = (int)vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
         {
             for (int i = 0; i < nSize; i += 2)
             {
@@ -1028,7 +1029,7 @@ public:
             BuildMerkleTree();
         std::vector<uint256> vMerkleBranch;
         int j = 0;
-        for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+        for (int nSize = (int)vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
         {
             int i = std::min(nIndex^1, nSize-1);
             vMerkleBranch.push_back(vMerkleTree[j+i]);
@@ -1096,6 +1097,7 @@ public:
             filein >> *this;
         }
         catch (std::exception &e) {
+            (void)e;
             return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
         }
 
@@ -1354,7 +1356,7 @@ public:
 
     bool GeneratedStakeModifier() const
     {
-        return (nFlags & BLOCK_STAKE_MODIFIER);
+        return (nFlags & BLOCK_STAKE_MODIFIER) != 0;
     }
 
     void SetStakeModifier(uint64_t nModifier, bool fGeneratedStakeModifier)
@@ -1634,7 +1636,7 @@ public:
     void clear();
     void queryHashes(std::vector<uint256>& vtxid);
 
-    unsigned long size()
+    size_t size()
     {
         LOCK(cs);
         return mapTx.size();
index 941bcd8..55d761e 100644 (file)
@@ -804,7 +804,7 @@ void ThreadSocketHandler2(void* parg)
                 if (lockRecv)
                 {
                     CDataStream& vRecv = pnode->vRecv;
-                    unsigned int nPos = vRecv.size();
+                    uint64_t nPos = vRecv.size();
 
                     if (nPos > ReceiveBufferSize()) {
                         if (!pnode->fDisconnect)
index 60c5274..2d635fa 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -29,8 +29,8 @@ extern int nBestHeight;
 
 
 
-inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
-inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
+inline uint64_t ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
+inline uint64_t SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
 
 void AddOneShot(std::string strDest);
 bool RecvLine(SOCKET hSocket, std::string& strLine);
@@ -251,7 +251,7 @@ public:
         fGetAddr = false;
         nMisbehavior = 0;
         hashCheckpointKnown = 0;
-        setInventoryKnown.max_size(SendBufferSize() / 1000);
+        setInventoryKnown.max_size((size_t)SendBufferSize() / 1000);
 
         // Be shy and don't send version until we hear
         if (hSocket != INVALID_SOCKET && !fInbound)
@@ -359,9 +359,9 @@ public:
         ENTER_CRITICAL_SECTION(cs_vSend);
         if (nHeaderStart != -1)
             AbortMessage();
-        nHeaderStart = vSend.size();
+        nHeaderStart = (int32_t)vSend.size();
         vSend << CMessageHeader(pszCommand, 0);
-        nMessageStart = vSend.size();
+        nMessageStart = (uint32_t)vSend.size();
         if (fDebug)
             printf("sending: %s ", pszCommand);
     }
@@ -392,7 +392,7 @@ public:
             return;
 
         // Set the size
-        uint32_t nSize = vSend.size() - nMessageStart;
+        uint32_t nSize = (uint32_t) vSend.size() - nMessageStart;
         memcpy((char*)&vSend[nHeaderStart] + CMessageHeader::MESSAGE_SIZE_OFFSET, &nSize, sizeof(nSize));
 
         // Set the checksum
@@ -415,7 +415,7 @@ public:
     {
         if (nHeaderStart < 0)
             return;
-        int nSize = vSend.size() - nMessageStart;
+        int nSize = (int) vSend.size() - nMessageStart;
         if (nSize > 0)
             EndMessage();
         else
index 863f291..496c9f7 100644 (file)
@@ -45,9 +45,9 @@ QString BitcoinUnits::description(int unit)
 {
     switch(unit)
     {
-    case BTC: return QString("NovaCoins");
-    case mBTC: return QString("Milli-NovaCoins (1 / 1,000)");
-    case uBTC: return QString("Micro-NovaCoins (1 / 1,000,000)");
+    case BTC: return QString(QObject::tr("NovaCoins"));
+    case mBTC: return QString(QObject::tr("Milli-NovaCoins (1 / 1,000)"));
+    case uBTC: return QString(QObject::tr("Micro-NovaCoins (1 / 1,000,000)"));
     default: return QString("???");
     }
 }
@@ -179,3 +179,13 @@ QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
     }
     return QVariant();
 }
+
+QString BitcoinUnits::getAmountColumnTitle(int unit)
+{
+    QString amountTitle = QObject::tr("Amount");
+    if (BitcoinUnits::valid(unit))
+    {
+        amountTitle += " ("+BitcoinUnits::name(unit) + ")";
+    }
+    return amountTitle;
+}
\ No newline at end of file
index 9b7c9e1..5ac3d47 100644 (file)
@@ -46,6 +46,8 @@ public:
     static QString formatWithUnit(int unit, qint64 amount, bool plussign=false);
     //! Parse string to coin amount
     static bool parse(int unit, const QString &value, qint64 *val_out);
+    //! Gets title for amount column including current display unit if optionsModel reference available */
+    static QString getAmountColumnTitle(int unit);
     ///@}
 
     //! @name AbstractListModel implementation
index 25ee24b..73e4801 100644 (file)
@@ -33,7 +33,7 @@
        <item>
         <widget class="QLabel" name="transactionFeeInfoLabel">
          <property name="text">
-          <string>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</string>
+          <string>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.001 recommended.</string>
          </property>
          <property name="textFormat">
           <enum>Qt::PlainText</enum>
           <widget class="BitcoinAmountField" name="transactionFee"/>
          </item>
          <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>per kilobyte</string>
+           </property>
+          </widget>
+         </item>
+         <item>
           <spacer name="horizontalSpacer_Main">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>20</width>
-           <height>40</height>
+           <width>17</width>
+           <height>153</height>
           </size>
          </property>
         </spacer>
index 68c5401..a9509bc 100644 (file)
 <context>
   <name>QObject</name>
   <message>
+    <source>Amount</source>
+    <translation>Количество</translation>
+  </message>
+  <message>
+    <source>NovaCoins</source>
+    <translation>NovaCoins</translation>
+  </message>
+  <message>
+    <source>Milli-NovaCoins (1 / 1,000)</source>
+    <translation>Милли-NovaCoins (1 / 1000)</translation>
+  </message>
+  <message>
+    <source>Micro-NovaCoins (1 / 1,000,000)</source>
+    <translation>Микро-NovaCoins (1 / 1000000)</translation>
+  </message>
+  <message>
     <source>from  %1 to %2</source>
     <translation>от %1 до %2</translation>
   </message>
@@ -1712,8 +1728,8 @@ This label turns red, if the priority is smaller than &quot;medium&quot;.
     </message>
     <message>
         <location line="+6"/>
-        <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
-        <translation>Опциональная комиссия за каждый КБ транзакции, которая позволяет быть уверенным, что Ваша транзакция будет обработана быстро.  Большинство транзакций занимают 1КБ.  Рекомендуется комиссия 0.01.</translation>
+        <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.001 recommended.</source>
+        <translation>Опциональная комиссия за каждый КБ транзакции, которая позволяет быть уверенным, что Ваша транзакция будет обработана быстро.  Большинство транзакций занимают 1КБ.  Рекомендуется комиссия 0.001.</translation>
     </message>
     <message>
         <location line="+15"/>
@@ -1721,6 +1737,11 @@ This label turns red, if the priority is smaller than &quot;medium&quot;.
         <translation>Заплатить ко&amp;миссию</translation>
     </message>
     <message>
+        <location line="67"/>
+        <source>per kilobyte</source>
+        <translation>за килобайт</translation>
+    </message>
+    <message>
         <location line="+31"/>
         <source>Automatically start NovaCoin after logging in to the system.</source>
         <translation>Автоматически запускать NovaCoin после входа в систему</translation>
@@ -2971,11 +2992,6 @@ This label turns red, if the priority is smaller than &quot;medium&quot;.
         <source>Address</source>
         <translation>Адрес</translation>
     </message>
-    <message>
-        <location line="+0"/>
-        <source>Amount</source>
-        <translation>Количество</translation>
-    </message>
     <message numerus="yes">
         <location line="+57"/>
         <source>Open for %n block(s)</source>
index 8133f57..3248c1d 100644 (file)
@@ -223,7 +223,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
         priv(new TransactionTablePriv(wallet, this)),
         cachedNumBlocks(0)
 {
-    columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
+    columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
 
     priv->refreshWallet();
 
@@ -239,6 +239,13 @@ TransactionTableModel::~TransactionTableModel()
     delete priv;
 }
 
+/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+void TransactionTableModel::updateAmountColumnTitle()
+{
+    columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+    emit headerDataChanged(Qt::Horizontal,Amount,Amount);
+}
+
 void TransactionTableModel::updateTransaction(const QString &hash, int status)
 {
     uint256 updated;
@@ -639,6 +646,7 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex
 
 void TransactionTableModel::updateDisplayUnit()
 {
+    updateAmountColumnTitle();
     // emit dataChanged to update Amount column with the current unit
     emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
 }
index d74f7fd..9608948 100644 (file)
@@ -80,6 +80,8 @@ public slots:
     void updateTransaction(const QString &hash, int status);
     void updateConfirmations();
     void updateDisplayUnit();
+    /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+    void updateAmountColumnTitle();
 
     friend class TransactionTablePriv;
 };
index 61ddb26..7dae349 100644 (file)
@@ -202,7 +202,7 @@ void TransactionView::setModel(WalletModel *model, bool fShoudAddThirdPartyURL)
         transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
 #endif
         transactionView->horizontalHeader()->resizeSection(
-                TransactionTableModel::Amount, 100);
+                TransactionTableModel::Amount, 120);
 
         if (model->getOptionsModel() && fShoudAddThirdPartyURL)
         {
index 7b25637..f30f3a2 100644 (file)
@@ -575,7 +575,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
                 case OP_DEPTH:
                 {
                     // -- stacksize
-                    CBigNum bn(stack.size());
+                    CBigNum bn((uint16_t) stack.size());
                     stack.push_back(bn.getvch());
                 }
                 break;
@@ -673,7 +673,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
                     // (in -- in size)
                     if (stack.size() < 1)
                         return false;
-                    CBigNum bn(stacktop(-1).size());
+                    CBigNum bn((uint16_t) stacktop(-1).size());
                     stack.push_back(bn.getvch());
                 }
                 break;
index f129848..157f41f 100644 (file)
@@ -13,7 +13,7 @@
 #include "keystore.h"
 #include "bignum.h"
 
-typedef std::vector<unsigned char> valtype;
+typedef std::vector<uint8_t> valtype;
 
 class CTransaction;
 
@@ -236,8 +236,6 @@ enum opcodetype
 
 const char* GetOpName(opcodetype opcode);
 
-
-
 inline std::string ValueString(const std::vector<unsigned char>& vch)
 {
     if (vch.size() <= 4)
@@ -258,22 +256,15 @@ inline std::string StackString(const std::vector<std::vector<unsigned char> >& v
     return str;
 }
 
-
-
-
-
-
-
-
 /** Serialized script, used inside transaction inputs and outputs */
-class CScript : public std::vector<unsigned char>
+class CScript : public std::vector<uint8_t>
 {
 protected:
     CScript& push_int64(int64_t n)
     {
         if (n == -1 || (n >= 1 && n <= 16))
         {
-            push_back(n + (OP_1 - 1));
+            push_back((uint8_t)n + (OP_1 - 1));
         }
         else
         {
@@ -287,7 +278,7 @@ protected:
     {
         if (n >= 1 && n <= 16)
         {
-            push_back(n + (OP_1 - 1));
+            push_back((uint8_t)n + (OP_1 - 1));
         }
         else
         {
@@ -299,10 +290,10 @@ protected:
 
 public:
     CScript() { }
-    CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }
-    CScript(const_iterator pbegin, const_iterator pend) : std::vector<unsigned char>(pbegin, pend) { }
+    CScript(const CScript& b) : std::vector<uint8_t>(b.begin(), b.end()) { }
+    CScript(const_iterator pbegin, const_iterator pend) : std::vector<uint8_t>(pbegin, pend) { }
 #ifndef _MSC_VER
-    CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector<unsigned char>(pbegin, pend) { }
+    CScript(const uint8_t* pbegin, const uint8_t* pend) : std::vector<uint8_t>(pbegin, pend) { }
 #endif
 
     CScript& operator+=(const CScript& b)
@@ -331,8 +322,7 @@ public:
     explicit CScript(opcodetype b)     { operator<<(b); }
     explicit CScript(const uint256& b) { operator<<(b); }
     explicit CScript(const CBigNum& b) { operator<<(b); }
-    explicit CScript(const std::vector<unsigned char>& b) { operator<<(b); }
-
+    explicit CScript(const std::vector<uint8_t>& b) { operator<<(b); }
 
     CScript& operator<<(int8_t  b) { return push_int64(b); }
     CScript& operator<<(int16_t b) { return push_int64(b); }
@@ -348,27 +338,27 @@ public:
     {
         if (opcode < 0 || opcode > 0xff)
             throw std::runtime_error("CScript::operator<<() : invalid opcode");
-        insert(end(), (unsigned char)opcode);
+        insert(end(), (uint8_t)opcode);
         return *this;
     }
 
     CScript& operator<<(const uint160& b)
     {
         insert(end(), sizeof(b));
-        insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
+        insert(end(), (uint8_t*)&b, (uint8_t*)&b + sizeof(b));
         return *this;
     }
 
     CScript& operator<<(const uint256& b)
     {
         insert(end(), sizeof(b));
-        insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
+        insert(end(), (uint8_t*)&b, (uint8_t*)&b + sizeof(b));
         return *this;
     }
 
     CScript& operator<<(const CPubKey& key)
     {
-        std::vector<unsigned char> vchKey = key.Raw();
+        std::vector<uint8_t> vchKey = key.Raw();
         return (*this) << vchKey;
     }
 
@@ -392,14 +382,14 @@ public:
         else if (b.size() <= 0xffff)
         {
             insert(end(), OP_PUSHDATA2);
-            uint16_t nSize = b.size();
-            insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
+            uint16_t nSize = (uint16_t) b.size();
+            insert(end(), (uint8_t*)&nSize, (uint8_t*)&nSize + sizeof(nSize));
         }
         else
         {
             insert(end(), OP_PUSHDATA4);
-            uint32_t nSize = b.size();
-            insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
+            uint32_t nSize = (uint32_t) b.size();
+            insert(end(), (uint8_t*)&nSize, (uint8_t*)&nSize + sizeof(nSize));
         }
         insert(end(), b.begin(), b.end());
         return *this;
@@ -414,7 +404,7 @@ public:
     }
 
 
-    bool GetOp(iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet)
+    bool GetOp(iterator& pc, opcodetype& opcodeRet, std::vector<uint8_t>& vchRet)
     {
          // Wrapper so it can be called with either iterator or const_iterator
          const_iterator pc2 = pc;
@@ -431,7 +421,7 @@ public:
          return fRet;
     }
 
-    bool GetOp(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet) const
+    bool GetOp(const_iterator& pc, opcodetype& opcodeRet, std::vector<uint8_t>& vchRet) const
     {
         return GetOp2(pc, opcodeRet, &vchRet);
     }
@@ -441,7 +431,7 @@ public:
         return GetOp2(pc, opcodeRet, NULL);
     }
 
-    bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>* pvchRet) const
+    bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, std::vector<uint8_t>* pvchRet) const
     {
         opcodeRet = OP_INVALIDOPCODE;
         if (pvchRet)
@@ -452,12 +442,12 @@ public:
         // Read instruction
         if (end() - pc < 1)
             return false;
-        unsigned int opcode = *pc++;
+        uint32_t opcode = *pc++;
 
         // Immediate operand
         if (opcode <= OP_PUSHDATA4)
         {
-            unsigned int nSize;
+            uint32_t nSize;
             if (opcode < OP_PUSHDATA1)
             {
                 nSize = opcode;
@@ -483,7 +473,7 @@ public:
                 memcpy(&nSize, &pc[0], 4);
                 pc += 4;
             }
-            if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize)
+            if (end() - pc < 0 || (uint32_t)(end() - pc) < nSize)
                 return false;
             if (pvchRet)
                 pvchRet->assign(pc, pc + nSize);
@@ -582,7 +572,7 @@ public:
     {
         std::string str;
         opcodetype opcode;
-        std::vector<unsigned char> vch;
+        std::vector<uint8_t> vch;
         const_iterator pc = begin();
         while (pc < end())
         {