Skip to content

Commit

Permalink
Fix Sprintf of data handle. (#2509)
Browse files Browse the repository at this point in the history
* Print modern handle.
  • Loading branch information
1uc authored Sep 27, 2023
1 parent 79eb8ad commit 82867f0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/ivoc/xmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1986,15 +1986,16 @@ void HocValEditor::evalField() {
}

void HocValEditor::audit() {
char buf[200];
auto sout = std::stringstream{};
if (pyvar_) {
return;
} else if (variable_) {
Sprintf(buf, "%s = %s\n", variable_->string(), fe_->text()->string());
sout << variable_->string() << " = " << fe_->text()->string();
} else if (pval_) {
Sprintf(buf, "// %p pointer set to %s\n", pval_, fe_->text()->string());
sout << "// " << pval_ << " set to " << fe_->text()->string();
}
hoc_audit_command(buf);
auto buf = sout.str();
hoc_audit_command(buf.c_str());
}

void HocValEditor::updateField() {
Expand Down Expand Up @@ -2706,13 +2707,16 @@ void OcSlider::update(Observable*) {
}

void OcSlider::audit() {
auto sout = std::stringstream{};
char buf[200];
Sprintf(buf, "%g", *pval_);
if (variable_) {
Sprintf(buf, "%s = %g\n", variable_->string(), *pval_);
sout << variable_->string() << " = " << buf << "\n";
} else if (pval_) {
Sprintf(buf, "// %p pointer set to %g\n", pval_, *pval_);
sout << "// " << pval_ << " set to " << buf << "\n";
}
hoc_audit_command(buf);
auto str = sout.str();
hoc_audit_command(str.c_str());
if (send_) {
send_->audit();
}
Expand Down

0 comments on commit 82867f0

Please sign in to comment.