Menu

A couple of suggestions.

2007-01-12
2013-04-26
  • V.Strelnikov

    V.Strelnikov - 2007-01-12

    A disk partition, which mean to be destination for restored files and folders,
    may have maximum filename length less than maximum filename length on damaged partition.
    Added new "max_name_len" parameter.
    Filesystem encoding on damaged partition may be different from operation system encoding,
    so it would be good idea to add some params, such as "codepage" and "iocharset", but that is TODO things.

    patch will be sent later.

     
    • V.Strelnikov

      V.Strelnikov - 2007-01-12

      Index: src/options.h

      --- src/options.h    (revision 4)
      +++ src/options.h    (working copy)
      @@ -30,6 +30,7 @@
           class Options{
               private:
                   uint16_t blocksize_;
      +            uint16_t max_name_len_;

                   boost::filesystem::path device_;
                   boost::filesystem::path output_dir_;
      @@ -52,6 +53,7 @@

                   inline uint16_t get_blocksize() const {return blocksize_;}
      +            inline uint16_t get_max_name_len() const {return max_name_len_;}

                   boost::filesystem::path get_device() const {return device_;}
                   boost::filesystem::path get_output_dir() const{return output_dir_;}
      Index: src/options.cpp
      ===================================================================
      --- src/options.cpp    (revision 4)
      +++ src/options.cpp    (working copy)
      @@ -41,7 +41,8 @@
                                       ("first",value<string>(),"A perl compliant regex that specifies which files are to be recovered first")
                                       ("last",value<string>(),"A perl compliant regex that specifies which files are to be recovered last")
                                       ("exclude",value<string>(),"Exclude files that matches this perl compliant regex")
      -                                ("skip-unsane-extents","Skip files that does not have a sane extent-set.")
      +                                ("skip-unsane-extents","Skip files that does not have a sane extent-set")
      +                                ("max-name-len",value<uint16_t>(&max_name_len_)->default_value(254),"Setting maximum length of filename or directory")
                                       ;
           variables_map vm;
           store(parse_command_line(argc, argv, optdes), vm);
      Index: src/recoverer.cpp
      ===================================================================
      --- src/recoverer.cpp    (revision 4)
      +++ src/recoverer.cpp    (working copy)
      @@ -245,6 +245,7 @@
           }
           for (uint32_t i=0;i<inovec_.size();++i){
               if ( (inovec_[i].get_name().empty()) ||
      +              (inovec_[i].get_name().length()>options.get_max_name_len()) ||
                     (inovec_[i].get_name().find("\n")!=string::npos) ||
                     (inovec_[i].get_name().find("\r")!=string::npos)) { //or otherwise is an illegal name
      //             cout << "using di_number for name "<<inovec_[i].get_di_number()<<endl;

       

Log in to post a comment.