From 9670ca65d60cc8a9ec07e9783806264aac44219a Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Tue, 23 Dec 2014 14:33:00 +0000 Subject: [PATCH] [0.3.x] fixed : issue #13374 ( hex() does not work with the module class ) git-svn-id: https://pykd.svn.codeplex.com/svn@89533 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/variant.h | 6 ++++-- test/scripts/intbase.py | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pykd/variant.h b/pykd/variant.h index d1f66e1..92bb127 100644 --- a/pykd/variant.h +++ b/pykd/variant.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "kdlib/variant.h" #include "kdlib/exceptions.h" @@ -221,9 +223,9 @@ public: return v.asStr(); } - static std::wstring hex(kdlib::NumBehavior& var) { + static std::string hex(kdlib::NumBehavior& var) { kdlib::NumVariant v = var; - return v.asHex(); + return std::string("0x") + std::string(_bstr_t(v.asHex().c_str())); } static bool isInteger(kdlib::NumBehavior& var) { diff --git a/test/scripts/intbase.py b/test/scripts/intbase.py index 77386c8..7cb6e69 100644 --- a/test/scripts/intbase.py +++ b/test/scripts/intbase.py @@ -169,5 +169,9 @@ class IntBaseTest( unittest.TestCase ): def testConvert( self ): self.assertEqual( "100", "%d" % numVariant(100) ) self.assertEqual( "64", "%x" % numVariant(100) ) - - \ No newline at end of file + + def testStr(self): + self.assertEqual( "100", str(numVariant(100)) ) + + def testHex(self): + self.assertEqual( "0x64", hex(numVariant(100)) )