work around some gcc 4.3.3 compiler warnings

This commit is contained in:
dickelbeck 2009-10-05 04:22:27 +00:00
parent b34df533d9
commit ce4d22f024
15 changed files with 413 additions and 394 deletions

View File

@ -658,7 +658,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default:
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
printf( CONV_TO_UTF8( s ) );
D(printf( "%s", CONV_TO_UTF8( s ) );)
break;
}
}

View File

@ -417,7 +417,7 @@ bool WinEDA_App::SetBinDir()
if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL )
{
fgets( Line, 1000, ftmp );
(void) fgets( Line, 1000, ftmp );
fclose( ftmp );
remove( TMP_FILE );
}

View File

@ -412,12 +412,12 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
wxString keyname, infokey;
msg = wxT( "$hotkey list\n" );
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "%s", CONV_TO_UTF8( msg ) );
/* print the allowed keys, for info
*/
msg = wxT( "# " ); msg += _( "Allowed keys:\n" );
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "%s", CONV_TO_UTF8( msg ) );
msg.Empty();
for( int ii = 0; ; ii++ )
{
@ -431,7 +431,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
if( msg.Len() > 60 )
{
msg += wxT( "\n" );
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "%s", CONV_TO_UTF8( msg ) );
msg.Empty();
}
}
@ -440,7 +440,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
if( !msg.IsEmpty() )
msg += wxT( "\n" );
msg += wxT( "#\n#\n" );
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "%s", CONV_TO_UTF8( msg ) );
/* Print the current hotkey list */
Ki_HotkeyInfo** List;
@ -449,12 +449,10 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
if( DescList->m_Comment )
{
fprintf( cfgfile, "# " );
fprintf( cfgfile, DescList->m_Comment );
fprintf( cfgfile, "\n" );
fprintf( cfgfile, "%s\n", DescList->m_Comment );
}
msg = *DescList->m_SectionTag;
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "\n" );
fprintf( cfgfile, "%s\n", CONV_TO_UTF8( msg ) );
List = DescList->m_HK_InfoList;
for( ; *List != NULL; List++ )
{
@ -465,12 +463,12 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
infokey = hk_decr->m_InfoMsg;
AddDelimiterString( infokey );
msg += keyname + wxT( ": " ) + infokey + wxT( "\n" );
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "%s", CONV_TO_UTF8( msg ) );
}
}
msg = wxT( "$Endlist\n" );
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "%s\n", CONV_TO_UTF8( msg ) );
fclose( cfgfile );
return 1;
}

View File

@ -90,7 +90,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
}
/* Check if library type is valid */
fgets( buffer, 32, file );
(void) fgets( buffer, 32, file );
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{
s_files_invalid << tmp << _(" (Not a Kicad file)") << wxT("\n");

View File

@ -118,7 +118,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" )
* or "# EESchema Netliste"
*/
fgets( Line, BUFFER_CHAR_SIZE, source );
(void) fgets( Line, BUFFER_CHAR_SIZE, source );
/* test for netlist type PCB2 */
i = strnicmp( Line, "( {", 3 );
if( i != 0 )

View File

@ -93,7 +93,7 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
fprintf( file, " ( %s ", CONV_TO_UTF8( component.m_TimeStamp ) );
if( !component.m_Module.IsEmpty() )
fprintf( file, CONV_TO_UTF8( component.m_Module ) );
fprintf( file, "%s", CONV_TO_UTF8( component.m_Module ) );
else
fprintf( file, "$noname$" );

View File

@ -94,7 +94,7 @@ static int WriteSetup( FILE* File, BOARD* Pcb )
fprintf( File, "$SETUP\n" );
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( File, text );
fprintf( File, "%s", text );
Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount;
fprintf( File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount );

View File

@ -188,16 +188,16 @@ public:
{
ret.Printf( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
m_ErrorCode,
GetErrorText().GetData(),
ShowCoord( m_MainPosition ).GetData(), m_MainText.GetData(),
ShowCoord( m_AuxiliaryPosition ).GetData(), m_AuxiliaryText.GetData() );
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ),
GetChars( ShowCoord( m_AuxiliaryPosition ) ), GetChars( m_AuxiliaryText ) );
}
else
{
ret.Printf( wxT( "ErrType(%d): %s\n %s: %s\n" ),
m_ErrorCode,
GetErrorText().GetData(),
ShowCoord( m_MainPosition ).GetData(), m_MainText.GetData() );
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ) );
}
return ret;

View File

@ -1,5 +1,5 @@
/* MiniZip 1.00, demo of zLib + Zip package written by Gilles Vollant
Modifie le 2 juin 2004 JPC
* Modifie le 2 juin 2004 JPC
*/
#include <stdio.h>
#include <stdlib.h>
@ -21,12 +21,12 @@
#include "zip.h"
#ifdef WIN32
//#define USEWIN32IOAPI
#include "iowin32.h"
#endif
#define WRITEBUFFERSIZE (16384)
#define MAXFILENAME (1024)
@ -42,6 +42,7 @@ uLong filetime(
#ifdef WIN32
{
int ret = 0;
{
FILETIME ftLocal;
HANDLE hFind;
@ -58,6 +59,8 @@ uLong filetime(
}
return ret;
}
#else
#ifdef unix
{
@ -103,22 +106,28 @@ time_t tm_t=0;
#endif
/*******************************************/
int check_exist_file( const char* filename )
/*******************************************/
{
/*******************************************/
FILE* ftestexist;
int ret = 1;
ftestexist = fopen( filename, "rb" );
if (ftestexist == NULL) ret = 0;
else fclose(ftestexist);
if( ftestexist == NULL )
ret = 0;
else
fclose( ftestexist );
return ret;
}
/* calculate the CRC32 of a file,
because to encrypt a file, we need known the CRC32 of the file before */
int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
* because to encrypt a file, we need known the CRC32 of the file before */
int getFileCrc( const char* filenameinzip,
void* buf,
unsigned long size_buf,
unsigned long* result_crc )
{
unsigned long calculate_crc = 0;
int err = ZIP_OK;
@ -146,21 +155,22 @@ unsigned long total_read = 0;
if( size_read>0 )
calculate_crc = crc32( calculate_crc, buf, size_read );
total_read += size_read;
} while( (err == ZIP_OK) && (size_read>0) );
if( fin )
fclose( fin );
*result_crc = calculate_crc;
if ( g_Verbose ) printf("file %s crc %lx\n",filenameinzip,calculate_crc);
if( g_Verbose )
printf( "file %s crc %lx\n", filenameinzip, calculate_crc );
return err;
}
/********************************/
int main( int argc, char* argv[] )
/********************************/
{
/********************************/
int i;
int opt_overwrite = 0;
int opt_compress_level = Z_DEFAULT_COMPRESSION;
@ -209,10 +219,12 @@ const char* password=NULL;
}
}
}
else if (zipfilenamearg == 0) zipfilenamearg = i ;
else if( zipfilenamearg == 0 )
zipfilenamearg = i;
}
if ( err ) return 0;
if( err )
return 0;
size_buf = WRITEBUFFERSIZE;
buf = (void*) malloc( size_buf );
@ -222,7 +234,8 @@ const char* password=NULL;
return ZIP_INTERNALERROR;
}
if (zipfilenamearg==0) zipok=0;
if( zipfilenamearg==0 )
zipok = 0;
else
{
int len;
@ -255,15 +268,18 @@ const char* password=NULL;
do
{
char answer[128];
printf("The file %s exist. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
scanf("%1s",answer);
printf( "The file %s exist. Overwrite ? [y]es, [n]o, [a]ppend : ",
filename_try );
(void) scanf( "%1s", answer );
rep = answer[0];
if( (rep>='a') && (rep<='z') )
rep -= 0x20;
}
while ((rep!='Y') && (rep!='N') && (rep!='A'));
if (rep=='N') zipok = 0;
if (rep=='A') opt_overwrite = 2;
} while( (rep!='Y') && (rep!='N') && (rep!='A') );
if( rep=='N' )
zipok = 0;
if( rep=='A' )
opt_overwrite = 2;
}
}
@ -285,7 +301,8 @@ const char* password=NULL;
err = ZIP_ERRNO;
}
else
if ( g_Verbose ) printf("creating %s\n",filename_try);
if( g_Verbose )
printf( "creating %s\n", filename_try );
for( i = zipfilenamearg + 1; (i<argc) && (err==ZIP_OK); i++ )
{
@ -298,17 +315,19 @@ const char* password=NULL;
unsigned long crcFile = 0;
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
zi.tmz_date.tm_mday =
zi.tmz_date.tm_mon =
zi.tmz_date.tm_year = 0;
zi.dosDate = 0;
zi.internal_fa = 0;
zi.external_fa = 0;
filetime( filenameinzip, &zi.tmz_date, &zi.dosDate );
/*
err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
NULL,0,NULL,0,NULL / * comment * /,
(opt_compress_level != 0) ? Z_DEFLATED : 0,
opt_compress_level);
* err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
* NULL,0,NULL,0,NULL / * comment * /,
* (opt_compress_level != 0) ? Z_DEFLATED : 0,
* opt_compress_level);
*/
if( (password != NULL) && (err==ZIP_OK) )
err = getFileCrc( filenameinzip, buf, size_buf, &crcFile );
@ -352,13 +371,14 @@ const char* password=NULL;
printf( "error in writing %s in the zipfile\n",
filenameinzip );
}
}
} while( (err == ZIP_OK) && (size_read>0) );
if (fin) fclose(fin);
if( fin )
fclose( fin );
if (err<0) err=ZIP_ERRNO;
if( err<0 )
err = ZIP_ERRNO;
else
{
err = zipCloseFileInZip( zf );
@ -368,6 +388,7 @@ const char* password=NULL;
}
}
}
errclose = zipClose( zf, NULL );
if( errclose != ZIP_OK )
printf( "error in closing %s\n", filename_try );

View File

@ -90,7 +90,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
msg << _("Number") << wxT("\";\"");
msg << _("Designation") << wxT("\";\"");
msg << _("Supplier and ref") << wxT("\";\n" );
fprintf( FichBom, CONV_TO_UTF8( msg ) );
fprintf( FichBom, "%s", CONV_TO_UTF8( msg ) );
// Build list
CmpList list;
@ -142,7 +142,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
msg << current->m_Pkg << wxT( "\";" );
msg << current->m_CmpCount << wxT( ";\"" );
msg << current->m_Val << wxT( "\";;;\n" );
fprintf( FichBom, CONV_TO_UTF8( msg ) );
fprintf( FichBom, "%s", CONV_TO_UTF8( msg ) );
list.DeleteObject( current );
delete (current);

View File

@ -365,19 +365,19 @@ int MODULE::Write_3D_Descr( FILE* File ) const
t3D->m_MatScale.x,
t3D->m_MatScale.y,
t3D->m_MatScale.z );
fprintf( File, to_point( buf ) );
fprintf( File, "%s", to_point( buf ) );
sprintf( buf, "Of %lf %lf %lf\n",
t3D->m_MatPosition.x,
t3D->m_MatPosition.y,
t3D->m_MatPosition.z );
fprintf( File, to_point( buf ) );
fprintf( File, "%s", to_point( buf ) );
sprintf( buf, "Ro %lf %lf %lf\n",
t3D->m_MatRotation.x,
t3D->m_MatRotation.y,
t3D->m_MatRotation.z );
fprintf( File, to_point( buf ) );
fprintf( File, "%s", to_point( buf ) );
fprintf( File, "$EndSHAPE3D\n" );
}

View File

@ -523,14 +523,14 @@ void DIALOG_DRC_CONTROL::writeReport( FILE* fp )
fprintf( fp, "\n** Found %d DRC errors **\n", count );
for( int i = 0; i<count; ++i )
fprintf( fp, m_ClearanceListBox->GetItem( i )->ShowReport().mb_str() );
fprintf( fp, "%s", CONV_TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
count = m_UnconnectedListBox->GetItemCount();
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
for( int i = 0; i<count; ++i )
fprintf( fp, m_UnconnectedListBox->GetItem( i )->ShowReport().mb_str() );
fprintf( fp, "%s", CONV_TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
fprintf( fp, "\n** End of Report **\n" );
}

View File

@ -524,7 +524,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "$SETUP\n" );
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( aFile, text );
fprintf( aFile, "%s", text );
fprintf( aFile, "ZoneGridSize %d\n", g_GridRoutingSize );

View File

@ -881,7 +881,7 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
else
{
if( aBoard->m_TrackWidthSelector < (int)aBoard->m_TrackWidthHistory.size() )
if( aBoard->m_TrackWidthSelector < aBoard->m_TrackWidthHistory.size() )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + aBoard->m_TrackWidthSelector, true );
}
@ -899,7 +899,7 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
msg << _(" (from NetClass)" );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true );
}
if( aBoard->m_ViaSizeSelector < (int)aBoard->m_ViaSizeHistory.size() )
if( aBoard->m_ViaSizeSelector < aBoard->m_ViaSizeHistory.size() )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + aBoard->m_ViaSizeSelector, true );
return trackwidth_menu;

View File

@ -192,7 +192,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1;
}
fgets( Line, sizeof(Line), FichCmp );
(void) fgets( Line, sizeof(Line), FichCmp );
fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n",
DateAndTime( Line ) );
@ -601,7 +601,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return;
}
fgets( Line, sizeof(Line), FichCmp );
(void) fgets( Line, sizeof(Line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n",
DateAndTime( Line ) );