Skip to content

Commit 098e9b7

Browse files
committed
changes
1 parent a90ed18 commit 098e9b7

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/xinterpreter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ __get_cxx_version ()
149149
}
150150

151151
// Split code from includes
152-
auto blocks = split_from_includes(code.c_str());
152+
auto blocks = split_from_includes(code);
153153

154154
auto errorlevel = 0;
155155

src/xmime_internal.hpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ namespace xcpp
2525
inline nl::json mime_repr(intptr_t V)
2626
{
2727
// Return a JSON mime bundle representing the specified value.
28+
void* value = (void*)V;
29+
2830
// Include "xcpp/xmime.hpp" only on the first time a variable is displayed.
2931
static bool xmime_included = false;
3032

@@ -37,17 +39,16 @@ namespace xcpp
3739
intptr_t mimeReprV;
3840
bool hadError = false;
3941
{
40-
std::ostringstream oss;
41-
oss << reinterpret_cast<void*>(V);
42-
std::string pointerStr = oss.str();
42+
std::ostringstream code;
43+
code << "using xcpp::mime_bundle_repr;";
44+
code << "mime_bundle_repr(";
45+
// code << "*(" << getTypeAsString(V);
46+
code << &value;
47+
code << "));";
4348

44-
std::string code;
45-
code = "using xcpp::mime_bundle_repr; ";
46-
code += "mime_bundle_repr(*((const void**)";
47-
code += pointerStr;
48-
code += "));";
49+
std::string codeString = code.str();
4950

50-
mimeReprV = Cpp::Evaluate(code.c_str(), &hadError);
51+
mimeReprV = Cpp::Evaluate(codeString.c_str(), &hadError);
5152
}
5253

5354
if (!hadError && mimeReprV != 0) {

0 commit comments

Comments
 (0)