Commit 5f0679bf authored by Dick Hollenbeck's avatar Dick Hollenbeck

comment/doc cleanups

parent 4f7c7eb1
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
int vprint( std::string* result, const char* format, va_list ap ) static int vprint( std::string* result, const char* format, va_list ap )
{ {
char msg[512]; char msg[512];
size_t len = vsnprintf( msg, sizeof(msg), format, ap ); size_t len = vsnprintf( msg, sizeof(msg), format, ap );
...@@ -67,7 +67,7 @@ int vprint( std::string* result, const char* format, va_list ap ) ...@@ -67,7 +67,7 @@ int vprint( std::string* result, const char* format, va_list ap )
} }
int strprintf( std::string* result, const char* format, ... ) int StrPrintf( std::string* result, const char* format, ... )
{ {
va_list args; va_list args;
...@@ -79,7 +79,7 @@ int strprintf( std::string* result, const char* format, ... ) ...@@ -79,7 +79,7 @@ int strprintf( std::string* result, const char* format, ... )
} }
std::string strprintf( const char* format, ... ) std::string StrPrintf( const char* format, ... )
{ {
std::string ret; std::string ret;
va_list args; va_list args;
......
...@@ -39,41 +39,34 @@ ...@@ -39,41 +39,34 @@
/** /**
* Function vprint * Function StrPrintf
* is like vsprintf() but the output is appended to a std::string instead of to a
* character array.
* @param result is the string to append to, previous text is not clear()ed.
* @param format is a printf() style format string.
* @param ap is a va_list argument stack pointer which gives the
* modifying data for the format string.
*/
int vprint( std::string* result, const char* format, va_list ap );
/**
* Function strprintf
* is like sprintf() but the output is appended to a std::string instead of to a * is like sprintf() but the output is appended to a std::string instead of to a
* character array. * character array.
* @param result is the string to append to, previous text is not clear()ed. * @param aResult is the string to append to, previous text is not clear()ed.
* @param format is a printf() style format string. * @param aFormat is a printf() style format string.
* @param ap is a va_list argument stack pointer which gives the * @return int - the count of bytes appended to the result string, no terminating
* modifying data for the format string. * nul is included.
*
* @return int - the count of bytes appended to the result string, no terminating nul is included.
*/ */
int strprintf( std::string* result, const char* format, ... ); int
#if defined(__GNUG__)
__attribute__ ((format (printf, 2, 3)))
#endif
StrPrintf( std::string* aResult, const char* aFormat, ... );
/** /**
* Function strprintf * Function StrPrintf
* is like sprintf() but the output is returned in a std::string instead of to a * is like sprintf() but the output is returned in a std::string instead of to a
* character array. * character array.
* @param result is the string to append to, previous text is not clear()ed. * @param aResult is the string to append to, previous text is not clear()ed.
* @param format is a printf() style format string. * @param aFormat is a printf() style format string.
* @param ap is a va_list argument stack pointer which gives the * @return std::string - the result of the sprintf().
* modifying data for the format string.
*/ */
std::string strprintf( const char* format, ... ); std::string
#if defined(__GNUG__)
__attribute__ ((format (printf, 1, 2)))
#endif
StrPrintf( const char* format, ... );
/** /**
......
...@@ -1215,37 +1215,37 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const ...@@ -1215,37 +1215,37 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
// Unconnected pad is default net so don't save it. // Unconnected pad is default net so don't save it.
if( !(m_ctl & CTL_OMIT_NETS) && aPad->GetNet() != 0 ) if( !(m_ctl & CTL_OMIT_NETS) && aPad->GetNet() != 0 )
strprintf( &output, " (net %d %s)", aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() ); StrPrintf( &output, " (net %d %s)", aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() );
if( aPad->GetPadToDieLength() != 0 ) if( aPad->GetPadToDieLength() != 0 )
strprintf( &output, " (die_length %s)", FMT_IU( aPad->GetPadToDieLength() ).c_str() ); StrPrintf( &output, " (die_length %s)", FMT_IU( aPad->GetPadToDieLength() ).c_str() );
if( aPad->GetLocalSolderMaskMargin() != 0 ) if( aPad->GetLocalSolderMaskMargin() != 0 )
strprintf( &output, " (solder_mask_margin %s)", FMT_IU( aPad->GetLocalSolderMaskMargin() ).c_str() ); StrPrintf( &output, " (solder_mask_margin %s)", FMT_IU( aPad->GetLocalSolderMaskMargin() ).c_str() );
if( aPad->GetLocalSolderPasteMargin() != 0 ) if( aPad->GetLocalSolderPasteMargin() != 0 )
strprintf( &output, " (solder_paste_margin %s)", FMT_IU( aPad->GetLocalSolderPasteMargin() ).c_str() ); StrPrintf( &output, " (solder_paste_margin %s)", FMT_IU( aPad->GetLocalSolderPasteMargin() ).c_str() );
if( aPad->GetLocalSolderPasteMarginRatio() != 0 ) if( aPad->GetLocalSolderPasteMarginRatio() != 0 )
strprintf( &output, " (solder_paste_margin_ratio %s)", StrPrintf( &output, " (solder_paste_margin_ratio %s)",
Double2Str( aPad->GetLocalSolderPasteMarginRatio() ).c_str() ); Double2Str( aPad->GetLocalSolderPasteMarginRatio() ).c_str() );
if( aPad->GetLocalClearance() != 0 ) if( aPad->GetLocalClearance() != 0 )
strprintf( &output, " (clearance %s)", FMT_IU( aPad->GetLocalClearance() ).c_str() ); StrPrintf( &output, " (clearance %s)", FMT_IU( aPad->GetLocalClearance() ).c_str() );
if( aPad->GetZoneConnection() != UNDEFINED_CONNECTION ) if( aPad->GetZoneConnection() != UNDEFINED_CONNECTION )
strprintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() ); StrPrintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() );
if( aPad->GetThermalWidth() != 0 ) if( aPad->GetThermalWidth() != 0 )
strprintf( &output, " (thermal_width %s)", FMT_IU( aPad->GetThermalWidth() ).c_str() ); StrPrintf( &output, " (thermal_width %s)", FMT_IU( aPad->GetThermalWidth() ).c_str() );
if( aPad->GetThermalGap() != 0 ) if( aPad->GetThermalGap() != 0 )
strprintf( &output, " (thermal_gap %s)", FMT_IU( aPad->GetThermalGap() ).c_str() ); StrPrintf( &output, " (thermal_gap %s)", FMT_IU( aPad->GetThermalGap() ).c_str() );
if( output.size() ) if( output.size() )
{ {
m_out->Print( 0, "\n" ); m_out->Print( 0, "\n" );
m_out->Print( aNestLevel+1, "%s", output.c_str() + 1 ); // +1 skips initial space on first element m_out->Print( aNestLevel+1, "%s", output.c_str()+1 ); // +1 skips 1st space on 1st element
} }
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment