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

comment/doc cleanups

parent 4f7c7eb1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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];
    size_t  len = vsnprintf( msg, sizeof(msg), format, 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;

@@ -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;
    va_list     args;
+19 −26
Original line number Diff line number Diff line
@@ -39,41 +39,34 @@


/**
 * Function vprint
 * 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
 * Function StrPrintf
 * is like sprintf() 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.
 *
 * @return int - the count of bytes appended to the result string, no terminating nul is included.
 */
int strprintf( std::string* result, const char* format, ... );
 * @param aResult is the string to append to, previous text is not clear()ed.
 * @param aFormat is a printf() style format string.
 * @return int - the count of bytes appended to the result string, no terminating
 *           nul is included.
 */
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
 * 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.
 * @param aResult is the string to append to, previous text is not clear()ed.
 * @param aFormat is a printf() style format string.
 * @return std::string - the result of the sprintf().
 */
std::string strprintf( const char* format, ... );
std::string
#if defined(__GNUG__)
    __attribute__ ((format (printf, 1, 2)))
#endif
    StrPrintf( const char* format, ... );


/**
+10 −10
Original line number Diff line number Diff line
@@ -1215,37 +1215,37 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const

    // Unconnected pad is default net so don't save it.
    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 )
        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 )
        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 )
        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 )
        strprintf( &output, " (solder_paste_margin_ratio %s)",
        StrPrintf( &output, " (solder_paste_margin_ratio %s)",
                Double2Str( aPad->GetLocalSolderPasteMarginRatio() ).c_str() );

    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 )
        strprintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() );
        StrPrintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() );

    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 )
        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() )
    {
        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" );