github fix and comment improvements:

* Fix a StrPrintf() %s count mismatch bug
* Better comments
* Use std::string::data() instead of a ref to the first char to get the str::string buffer  (should not change anything with GNU lib)
This commit is contained in:
Dick Hollenbeck 2016-02-04 17:49:20 +01:00 committed by jean-pierre charras
parent a9bf46a5de
commit 7c637ea7be
2 changed files with 13 additions and 14 deletions

View File

@ -194,7 +194,7 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
if( it != m_gh_cache->end() ) // fp_name is present
{
wxMemoryInputStream mis( &m_zip_image[0], m_zip_image.size() );
wxMemoryInputStream mis( m_zip_image.data(), m_zip_image.size() );
// This decoder should always be UTF8, since it was saved that way by git.
// That is, since pretty footprints are UTF8, and they were pushed to the
@ -205,21 +205,17 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
if( zis.OpenEntry( *entry ) )
{
INPUTSTREAM_LINE_READER reader( &zis, aLibraryPath );
#if 1
// I am a PCB_IO derivative with my own PCB_PARSER
m_parser->SetLineReader( &reader ); // ownership not passed
MODULE* ret = (MODULE*) m_parser->Parse();
#else
PCB_PARSER parser( &reader );
MODULE* ret = (MODULE*) parser.Parse();
#endif
// Dude, the footprint name comes from the file name in
// a github library. Zero out the library name, we don't know it here.
// Some caller may set the library nickname, one such instance is
// FP_LIB_TABLE::FootprintLoad().
// In a github library, (as well as in a "KiCad" library) the name of
// the pretty file defines the footprint name. That filename trumps
// any name found in the pretty file; any name in the pretty file
// must be ignored here. Also, the library nickname is unknown in
// this context so clear it just in case.
ret->SetFPID( fp_name );
return ret;
@ -541,11 +537,14 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) throw( IO_ERROR )
}
catch( const IO_ERROR& ioe )
{
// https "GET" has faild, report this to API caller.
// https "GET" has failed, report this to API caller.
// Note: kcurl.Perform() does not return an error if the file to download is not found
static const char errorcmd[] = "http GET command failed"; // Do not translate this message
UTF8 fmt( _( "%s\nCannot get/download Zip archive: '%s'\nfor library path: '%s'.\nReason: '%s'" ) );
std::string msg = StrPrintf( fmt.c_str(),
errorcmd,
zip_url.c_str(),
TO_UTF8( aRepoURL ),
TO_UTF8( ioe.errorText )

View File

@ -2695,12 +2695,12 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
case T_chamfer:
if( !zone->GetIsKeepout() ) // smoothing has meaning only for filled zones
zone->SetCornerSmoothingType( ZONE_SETTINGS::SMOOTHING_CHAMFER );
zone->SetCornerSmoothingType( ZONE_SETTINGS::SMOOTHING_CHAMFER );
break;
case T_fillet:
if( !zone->GetIsKeepout() ) // smoothing has meaning only for filled zones
zone->SetCornerSmoothingType( ZONE_SETTINGS::SMOOTHING_FILLET );
zone->SetCornerSmoothingType( ZONE_SETTINGS::SMOOTHING_FILLET );
break;
default: