style fixes

This commit is contained in:
Adam Lederer 2024-08-04 21:59:30 -07:00 committed by tildearrow
parent 5c9fd69ac1
commit 15d47d0aae
3 changed files with 42 additions and 42 deletions

View file

@ -365,7 +365,7 @@ void DivInstrument::writeFeatureFM(SafeWriter* w, bool fui) {
}
void MemPatch::clear() {
data = nullptr;
data = NULL;
offset=0;
size=0;
}
@ -374,8 +374,8 @@ bool MemPatch::calcDiff(const void* pre, const void* post, size_t inputSize) {
bool diffValid=false;
size_t firstDiff=0;
size_t lastDiff=0;
const uint8_t* preBytes = (const uint8_t*)pre;
const uint8_t* postBytes = (const uint8_t*)post;
const unsigned char* preBytes=(const unsigned char*)pre;
const unsigned char* postBytes=(const unsigned char*)post;
for (size_t ii=0; ii<inputSize; ++ii) {
if (preBytes[ii] != postBytes[ii]) {
@ -388,7 +388,7 @@ bool MemPatch::calcDiff(const void* pre, const void* post, size_t inputSize) {
if (diffValid) {
offset=firstDiff;
size=lastDiff - firstDiff + 1;
data = new uint8_t[size];
data=new unsigned char[size];
// the diff is to make pre into post (MemPatch is general, not specific to
// undo), so copy from postBytes
@ -399,13 +399,13 @@ bool MemPatch::calcDiff(const void* pre, const void* post, size_t inputSize) {
}
void MemPatch::applyAndReverse(void* target, size_t targetSize) {
if (size == 0) { return; }
if (size==0) return;
assert(offset+size<=targetSize);
uint8_t* targetBytes = (uint8_t*)target;
unsigned char* targetBytes=(unsigned char*)target;
// swap this->data and its segment on target
for (size_t ii=0; ii<size; ++ii) {
uint8_t tmp = targetBytes[offset + ii];
unsigned char tmp=targetBytes[offset+ii];
targetBytes[offset+ii] = data[ii];
data[ii] = tmp;
}
@ -428,7 +428,7 @@ bool DivInstrumentUndoStep::makeUndoPatch(size_t processTime_, const DivInstrume
// create the patch that will make post into pre
podPatch.calcDiff((const DivInstrumentPOD*)post, (const DivInstrumentPOD*)pre, sizeof(DivInstrumentPOD));
if (pre->name.compare(post->name) != 0) {
if (pre->name!=post->name != 0) {
nameValid=true;
name=pre->name;
}
@ -465,7 +465,7 @@ void DivInstrument::recordUndoStepIfChanged(size_t processTime, const DivInstrum
}
int DivInstrument::undo() {
if (undoHist.empty()) { return 0; }
if (undoHist.empty()) return 0;
DivInstrumentUndoStep* step=undoHist.back();
undoHist.pop_back();
@ -484,7 +484,7 @@ int DivInstrument::undo() {
}
int DivInstrument::redo() {
if (redoHist.empty()) { return 0; }
if (redoHist.empty()) return 0;
DivInstrumentUndoStep* step = redoHist.back();
redoHist.pop_back();

View file

@ -888,7 +888,7 @@ struct DivInstrumentPOD {
struct MemPatch {
MemPatch() :
data(nullptr)
data(NULL)
, offset(0)
, size(0) {
}
@ -904,7 +904,7 @@ struct MemPatch {
void applyAndReverse(void* target, size_t inputSize);
bool isValid() const { return size>0; }
uint8_t* data;
unsigned char* data;
size_t offset;
size_t size;
};

View file

@ -5250,7 +5250,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::SetNextWindowSizeConstraints(ImVec2(440.0f*dpiScale,400.0f*dpiScale),ImVec2(canvasW,canvasH));
}
if (ImGui::Begin("Instrument Editor",&insEditOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking),_("Instrument Editor"))) {
DivInstrument* ins=nullptr;
DivInstrument* ins=NULL;
if (curIns==-2) {
ImGui::SetCursorPosY(ImGui::GetCursorPosY()+(ImGui::GetContentRegionAvail().y-ImGui::GetFrameHeightWithSpacing()+ImGui::GetStyle().ItemSpacing.y)*0.5f);
CENTER_TEXT(_("waiting..."));
@ -7757,7 +7757,7 @@ void FurnaceGUI::drawInsEdit() {
cachedCurInsPtr=ins;
} else {
cachedCurInsPtr = nullptr;
cachedCurInsPtr=NULL;
}
}