Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2007-11-24 11:39:31


Author: bemandawes
Date: 2007-11-24 11:39:30 EST (Sat, 24 Nov 2007)
New Revision: 41333
URL: http://svn.boost.org/trac/boost/changeset/41333

Log:
Change long name inspection to follow ISO 9660:1997, thus replacing all length requirements with a single 207 maximum path length requirement.
Text files modified:
   trunk/tools/inspect/inspect.cpp | 2 +
   trunk/tools/inspect/long_name_check.cpp | 72 +++++-----------------------------------
   trunk/tools/inspect/long_name_check.hpp | 4 --
   3 files changed, 11 insertions(+), 67 deletions(-)

Modified: trunk/tools/inspect/inspect.cpp
==============================================================================
--- trunk/tools/inspect/inspect.cpp (original)
+++ trunk/tools/inspect/inspect.cpp 2007-11-24 11:39:30 EST (Sat, 24 Nov 2007)
@@ -628,6 +628,8 @@
       link_ck = true;
     else if ( std::strcmp( argv[1], "-long_name" ) == 0 )
       long_name_ck = true;
+ else if ( std::strcmp( argv[1], "-long-name" ) == 0 )
+ long_name_ck = true;
     else if ( std::strcmp( argv[1], "-tab" ) == 0 )
       tab_ck = true;
     else if ( std::strcmp( argv[1], "-minmax" ) == 0 )

Modified: trunk/tools/inspect/long_name_check.cpp
==============================================================================
--- trunk/tools/inspect/long_name_check.cpp (original)
+++ trunk/tools/inspect/long_name_check.cpp 2007-11-24 11:39:30 EST (Sat, 24 Nov 2007)
@@ -17,30 +17,20 @@
 
 namespace { namespace aux {
 
-bool starts_with_nonalpha( path const & p )
+bool starts_with_nonalnum( path const & p )
 {
   const string & x = p.string();
   assert(!x.empty());
 
   const string::value_type first = x[0];
 
- return !std::isalpha( first, std::locale::classic() )
+ return !std::isalnum( first, std::locale::classic() )
       && first != '_'
       && x != ".cvsignore"
+ && x != ".svn"
       ;
 }
 
-bool contains_dot( path const & p)
-{
- return p.string().find( '.' ) != std::string::npos;
-}
-
-// ISO 9660
-path::iterator::difference_type depth( path const & p)
-{
- return std::distance( p.begin(), p.end() );
-}
-
 }}
 
 
@@ -48,7 +38,7 @@
 {
   namespace inspect
   {
- const char file_name_check::limits::name[] = "ISO 9660 Level 3";
+ const char file_name_check::limits::name[] = "ISO 9660:1999 Level 3";
 
     file_name_check::file_name_check() : m_name_errors(0) {}
 
@@ -58,29 +48,6 @@
     {
       std::string const leaf( full_path.leaf() );
 
- // checks on the leaf name ----------------------------------//
- {
- const unsigned m = filesystem::is_directory(full_path)
- ? limits::max_dirname_length
- : limits::max_filename_length;
-
- if ( leaf.size() > m )
- {
- ++m_name_errors;
- error( library_name, full_path, string(name())
- + " name exceeds "
- + boost::lexical_cast<string>(m)
- + " characters" );
- }
- }
-
- if ( std::count( leaf.begin(), leaf.end(), '.' ) > 1 )
- {
- ++m_name_errors;
- error( library_name, full_path, string(name())
- + " name contains more than one dot character ('.')" );
- }
-
       if ( *leaf.rbegin() == '.' )
       {
         ++m_name_errors;
@@ -95,37 +62,16 @@
 
       // checks on the directory name --------------------------- //
 
- if( aux::starts_with_nonalpha( path(leaf)) )
+ if( aux::starts_with_nonalnum( path(leaf)) )
       {
         ++m_name_errors;
         error( library_name, full_path, string(name())
             + " leading character of \""
             + leaf + "\""
- + " is not alphabetic" );
- }
-
- if ( filesystem::is_directory( full_path )
- && aux::contains_dot( relative_path ) )
- {
- ++m_name_errors;
- error( library_name, full_path, string(name())
- + " directory name contains the dot character ('.')" );
- }
-
- {
- const int m = limits::max_directory_depth;
- if ( filesystem::is_directory( full_path )
- && aux::depth( relative_path) > m )
- {
- ++m_name_errors;
- error( library_name, full_path, string(name())
- + " directory depth exceeds "
- + boost::lexical_cast<string>(m)
- + " (maximum for " + limits::name + " (CD-ROMs))" );
- }
+ + " is not alphanumeric" );
       }
 
- const unsigned max_relative_path = 100; // [gps] Explain this
+ const unsigned max_relative_path = 207; // ISO 9660:1999 sets this limit
       const string generic_root( "boost_X_XX_X/" );
       if ( relative_path.string().size() >
           ( max_relative_path - generic_root.size() ) )
@@ -136,11 +82,11 @@
             + " file path will exceed "
             + boost::lexical_cast<string>(max_relative_path)
             + " characters in a directory tree with a root of the form "
- + generic_root )
+ + generic_root + ", and this exceeds ISO 9660:1999 limit of 207" )
             ;
       }
 
- if (relative_path.leaf() != ".cvsignore")
+ if (relative_path.leaf() != ".cvsignore" && relative_path.leaf() != ".svn")
       {
         try
         {

Modified: trunk/tools/inspect/long_name_check.hpp
==============================================================================
--- trunk/tools/inspect/long_name_check.hpp (original)
+++ trunk/tools/inspect/long_name_check.hpp 2007-11-24 11:39:30 EST (Sat, 24 Nov 2007)
@@ -25,10 +25,6 @@
       //
       struct iso_9660_limits
       {
- enum { max_directory_depth = 8 };
- enum { max_dirname_length = 31 };
- enum { max_filename_length = 31 }; // > level 2!
-
           static const char name[];
       };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk