From ceaf52bfa1f730153eb2d0c043ffe49dbd852c34 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 23 Feb 2023 21:10:57 +0100 Subject: [PATCH] fixes some divide by zero exception while drawing --- .../com/minres/scviewer/database/ftr/FtrDbLoader.java | 10 ++-------- .../database/ui/swt/internal/RulerPainter.java | 5 +++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java index d5f8990..37bfb58 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -328,7 +328,6 @@ public class FtrDbLoader implements IWaveformDbLoader { long array_len = readArrayLength(); assert(array_len==-1); CborType next = peekType(); - int chunk_idx=0; while(next != null && !break_type.isEqualType(next)) { long tag = readTag(); switch((int)tag) { @@ -400,7 +399,6 @@ public class FtrDbLoader implements IWaveformDbLoader { } } next = peekType(); - chunk_idx++; } } catch(IOException e) { long pos = 0; @@ -468,7 +466,6 @@ public class FtrDbLoader implements IWaveformDbLoader { long tx_size = cborDecoder.readArrayLength(); long txId = 0; long genId = 0; - long attr_idx=0; for(long i = 0; imaxTextLength; boolean drawText=true; for (long tickTime = startTickTime; tickTime < endTime; tickTime+= rulerTickMinor) { - int x0Pos = (int) (tickTime/scaleFactor) + proj.getTranslation().x; + int x0Pos = (int) (tickTime/safe_scale_factor) + proj.getTranslation().x; if ((tickTime % rulerTickMajor) == 0) { if(drawEvery || drawText) gc.drawText(waveCanvas.timeToString(tickTime), x0Pos, area.y+textY);