Browse Source

Set JSON real precision to double (17 digits).

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
094382778f
4 changed files with 6 additions and 7 deletions
  1. +2
    -2
      src/app/ModuleWidget.cpp
  2. +2
    -2
      src/app/RackWidget.cpp
  3. +1
    -1
      src/patch.cpp
  4. +1
    -2
      src/settings.cpp

+ 2
- 2
src/app/ModuleWidget.cpp View File

@@ -512,7 +512,7 @@ void ModuleWidget::copyClipboard() {
cleanupModuleJson(moduleJ); cleanupModuleJson(moduleJ);


DEFER({json_decref(moduleJ);}); DEFER({json_decref(moduleJ);});
char* json = json_dumps(moduleJ, JSON_INDENT(2) | JSON_REAL_PRECISION(9));
char* json = json_dumps(moduleJ, JSON_INDENT(2));
DEFER({std::free(json);}); DEFER({std::free(json);});
glfwSetClipboardString(APP->window->win, json); glfwSetClipboardString(APP->window->win, json);
} }
@@ -633,7 +633,7 @@ void ModuleWidget::save(std::string filename) {
} }
DEFER({std::fclose(file);}); DEFER({std::fclose(file);});


json_dumpf(moduleJ, file, JSON_INDENT(2) | JSON_REAL_PRECISION(9));
json_dumpf(moduleJ, file, JSON_INDENT(2));
} }


void ModuleWidget::saveTemplate() { void ModuleWidget::saveTemplate() {


+ 2
- 2
src/app/RackWidget.cpp View File

@@ -936,7 +936,7 @@ void RackWidget::saveSelection(std::string path) {
} }
DEFER({std::fclose(file);}); DEFER({std::fclose(file);});


json_dumpf(rootJ, file, JSON_INDENT(2) | JSON_REAL_PRECISION(9));
json_dumpf(rootJ, file, JSON_INDENT(2));
} }


void RackWidget::saveSelectionDialog() { void RackWidget::saveSelectionDialog() {
@@ -964,7 +964,7 @@ void RackWidget::saveSelectionDialog() {
void RackWidget::copyClipboardSelection() { void RackWidget::copyClipboardSelection() {
json_t* rootJ = selectionToJson(); json_t* rootJ = selectionToJson();
DEFER({json_decref(rootJ);}); DEFER({json_decref(rootJ);});
char* moduleJson = json_dumps(rootJ, JSON_INDENT(2) | JSON_REAL_PRECISION(9));
char* moduleJson = json_dumps(rootJ, JSON_INDENT(2));
DEFER({std::free(moduleJson);}); DEFER({std::free(moduleJson);});
glfwSetClipboardString(APP->window->win, moduleJson); glfwSetClipboardString(APP->window->win, moduleJson);
} }


+ 1
- 1
src/patch.cpp View File

@@ -203,7 +203,7 @@ void PatchManager::saveAutosave() {
return; return;
} }


json_dumpf(rootJ, file, JSON_INDENT(2) | JSON_REAL_PRECISION(9));
json_dumpf(rootJ, file, JSON_INDENT(2));
std::fclose(file); std::fclose(file);
system::remove(patchPath); system::remove(patchPath);
system::rename(tmpPath, patchPath); system::rename(tmpPath, patchPath);


+ 1
- 2
src/settings.cpp View File

@@ -393,8 +393,7 @@ void save(std::string path) {
return; return;
DEFER({std::fclose(file);}); DEFER({std::fclose(file);});


// 11 is enough precision to handle double UNIX time values to 0.1 seconds.
json_dumpf(rootJ, file, JSON_INDENT(2) | JSON_REAL_PRECISION(11));
json_dumpf(rootJ, file, JSON_INDENT(2));
json_decref(rootJ); json_decref(rootJ);
} }




Loading…
Cancel
Save