Menu

#314 Saving of large files (>20000 lines) is not possible

v1.1.x
fixed
None
v1.1.0
Bug Fix
2018-04-26
2018-04-12
Erik Hänel
No

Saving of large files (>20000 lines) is not possible.

Analysis:
The issue is related to the size_t wxFile::Write(const void*, size_t) member function, which doesn't force to write the complete passed buffer. However, the current implementation casts the returned size_t to bool and doesn't check, if the complete buffer was written.

A more straightforward solution would be to use the std::ofstream with the ios_base::binary open mode flag and write the the editor contents converted to a std::string as a stream (this will also ensure that the encoding is ANSI).

Implementation:
The fix was implemented as proposed by the analysis. Implementation tests were passed successfully.

Documentation:
The fix was documented in the changes log. Further documentation not needed.

Tests:
The fix was tested with a file of 31501 lines. No deviation detected. Bug fix implemented successfully.

Discussion

  • Erik Hänel

    Erik Hänel - 2018-04-13
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2018-04-13
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,9 @@
    -Saving of large files (>20000 lines) is not possible
    +Saving of large files (>20000 lines) is not possible.
    +
    +**Analysis:**
    +
    +**Implementation:**
    +
    +**Documentation:**
    +
    +**Tests:**
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2018-04-13
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,9 @@
     Saving of large files (>20000 lines) is not possible.
    
     **Analysis:**
    +The issue is related to the `size_t wxFile::Write(const void*, size_t)` member function, which doesn't force to write the complete passed buffer. However, the current implementation casts the returned `size_t` to `bool` and doesn't check, if the complete buffer was written.
    +
    +A more straightforward solution would be to use the `std::ofstream` with the `ios_base::binary` open mode flag and write the the editor contents converted to a `std::string` as a stream (this will also ensure that the encoding is ANSI).
    
     **Implementation:**
    
    • status: analyzing --> implementing
     
  • Erik Hänel

    Erik Hänel - 2018-04-13
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -6,7 +6,9 @@
     A more straightforward solution would be to use the `std::ofstream` with the `ios_base::binary` open mode flag and write the the editor contents converted to a `std::string` as a stream (this will also ensure that the encoding is ANSI).
    
     **Implementation:**
    +The fix was implemented as proposed by the analysis. Implementation tests were passed successfully.
    
     **Documentation:**
    +The fix was documented in the changes log. Further documentation not needed.
    
     **Tests:**
    
    • status: implementing --> testing
     
  • Erik Hänel

    Erik Hänel - 2018-04-26
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -12,3 +12,4 @@
     The fix was documented in the changes log. Further documentation not needed.
    
     **Tests:**
    +The fix was tested with a file of 31501 lines. No deviation detected. Bug fix implemented successfully.
    
    • status: testing --> fixed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB