Remove uneeded file pointer in gerbview code
This commit is contained in:
parent
b363e0f300
commit
6b218ff764
|
@ -22,6 +22,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ki_exception.h"
|
||||||
#include <string_utils.h>
|
#include <string_utils.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
|
@ -137,7 +138,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
|
||||||
*/
|
*/
|
||||||
bool GERBER_FILE_IMAGE::TestFileIsRS274( const wxString& aFullFileName )
|
bool GERBER_FILE_IMAGE::TestFileIsRS274( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
char* letter;
|
char* letter = nullptr;
|
||||||
bool foundADD = false;
|
bool foundADD = false;
|
||||||
bool foundD0 = false;
|
bool foundD0 = false;
|
||||||
bool foundD2 = false;
|
bool foundD2 = false;
|
||||||
|
@ -147,21 +148,12 @@ bool GERBER_FILE_IMAGE::TestFileIsRS274( const wxString& aFullFileName )
|
||||||
bool foundX = false;
|
bool foundX = false;
|
||||||
bool foundY = false;
|
bool foundY = false;
|
||||||
|
|
||||||
|
|
||||||
FILE* file = wxFopen( aFullFileName, "rb" );
|
|
||||||
|
|
||||||
if( file == nullptr )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
FILE_LINE_READER gerberReader( aFullFileName );
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while( true )
|
FILE_LINE_READER gerberReader( aFullFileName );
|
||||||
{
|
|
||||||
if( gerberReader.ReadLine() == nullptr )
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
while( gerberReader.ReadLine() )
|
||||||
|
{
|
||||||
// Remove all whitespace from the beginning and end
|
// Remove all whitespace from the beginning and end
|
||||||
char* line = StrPurge( gerberReader.Line() );
|
char* line = StrPurge( gerberReader.Line() );
|
||||||
|
|
||||||
|
@ -216,12 +208,16 @@ bool GERBER_FILE_IMAGE::TestFileIsRS274( const wxString& aFullFileName )
|
||||||
// RS-274X
|
// RS-274X
|
||||||
if( ( foundD0 || foundD2 || foundM0 || foundM2 ) && foundADD && foundStar
|
if( ( foundD0 || foundD2 || foundM0 || foundM2 ) && foundADD && foundStar
|
||||||
&& ( foundX || foundY ) )
|
&& ( foundX || foundY ) )
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
// RS-274D. Could be folded into the expression above, but someday
|
// RS-274D. Could be folded into the expression above, but someday
|
||||||
// we might want to test for them separately.
|
// we might want to test for them separately.
|
||||||
else if( ( foundD0 || foundD2 || foundM0 || foundM2 ) && !foundADD && foundStar
|
else if( ( foundD0 || foundD2 || foundM0 || foundM2 ) && !foundADD && foundStar
|
||||||
&& ( foundX || foundY ) )
|
&& ( foundX || foundY ) )
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue