Commit a144b277 authored by Jesse Mapel's avatar Jesse Mapel Committed by Makayla Shepherd
Browse files

Fixed a bug that caused reading binary control networks to fail.

parent bc32f865
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ namespace Isis {
    // Now stream the rest of the input into the google protocol buffer.
    try {
      filePos += headerLength;
      int oldLimit = headerCodedInStream.PushLimit(headerLength);
      CodedInputStream::Limit oldLimit = headerCodedInStream.PushLimit(headerLength);
      if (!p_networkHeader->ParseFromCodedStream(&headerCodedInStream)) {
        IString msg = "Failed to read input control net file [" +
            file.name() + "]";
@@ -86,6 +86,9 @@ namespace Isis {
      // choose 64 MB as a safe amount
      int streamThreshold = 1024 * 1024 * 64;
      int currentStreamSize = 0;
      // For some reason, reading the header causes the input stream to fail so reopen the file
      input.close();
      input.open(file.expanded().toLatin1().data(), ios::in | ios::binary);
      input.seekg(filePos, ios::beg);
      IstreamInputStream *pointInStream = new IstreamInputStream(&input);
      CodedInputStream *pointCodedInStream = new CodedInputStream(pointInStream);
@@ -565,4 +568,3 @@ namespace Isis {
    return pvl;
  }
}