From 8ff1fa703499c5ae0602dc31b09114d2522fd852 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 13 Mar 2020 18:39:11 -0700 Subject: [PATCH] Fix edge-face validation check --- PluginCommon/AddressTranslate.cs | 8 ++++++++ PluginCommon/VisWireframe.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/PluginCommon/AddressTranslate.cs b/PluginCommon/AddressTranslate.cs index b3ae29d..fd6af4e 100644 --- a/PluginCommon/AddressTranslate.cs +++ b/PluginCommon/AddressTranslate.cs @@ -27,6 +27,14 @@ namespace PluginCommon { /// /// This is currently simple enough that it could just be an interface, but I don't want /// to rely on that remaining true. + /// + /// TODO(maybe): add a "IsAddressRangeValid(int srcOffset, int addr, int length)" method + /// that verifies an entire address range is in memory. This would allow subsequent access + /// to skip error checks. (You still have to do the address-to-offset translation on every + /// byte though, which is where most of the expense is.) + /// TODO(maybe): add a "CopyAddressRange(byte[] data, int srcOffset, int addr, int length)" + /// that returns a newly-allocated buffer with the data copied out. This would allow fast + /// access to data that is split into multiple regions. /// public class AddressTranslate { private AddressMap mAddrMap; diff --git a/PluginCommon/VisWireframe.cs b/PluginCommon/VisWireframe.cs index 0e94bc0..865cc35 100644 --- a/PluginCommon/VisWireframe.cs +++ b/PluginCommon/VisWireframe.cs @@ -192,7 +192,7 @@ namespace PluginCommon { } // check edge-faces - foreach (IntPair ip in mVertexFaces) { + foreach (IntPair ip in mEdgeFaces) { if (ip.Val0 < 0 || ip.Val0 >= edgeCount || ip.Val1 < 0 || ip.Val1 >= faceCount) { msg = "invalid edge-face (e=" + ip.Val0 + ", f=" + ip.Val1 + ")";