~ubuntu-branches/ubuntu/trusty/gparted/trusty

« back to all changes in this revision

Viewing changes to src/Utils.cc

  • Committer: Package Import Robot
  • Author(s): Phillip Susi
  • Date: 2012-01-23 18:39:56 UTC
  • mfrom: (6.3.19)
  • Revision ID: package-import@ubuntu.com-20120123183956-hgocehdv6vs3g0gi
Tags: 0.11.0-1
* Merge from 0.8.1-1ubuntu5: Run dh_translations during build,
  if available.
* New upstream release 

  GParted 0.11.0  (2011-12-13)

  Key changes include:
  - Display ext2/3/4, ntfs, and btrfs unicode volume labels properly
  - Add labelling of btrfs file systems
  - Enable XFS copy to new smaller partition

  Bug Fixes
  - Display ext2/3/4 unicode volume labels properly (#662537)
  - Display ntfs unicode volume labels properly
    LP: #614994
  - Fix FAT16/32 label displayed as uppercase (#625337)
  - Add labelling of btrfs file systems (#663207)
    Thanks to Mike Fleetwood for small patch
    Requires btrfs-tools package yet-to-be-released (> Oct 25, 2011)
  - Fix btrfs volume label reading (#663590)
    Thanks to Mike Fleetwood for small patch
  - Enable XFS copy to new smaller partition (#663806)
    Thanks to Stephen Kirkby for small reverse umount order patch
  - Use newer btrfs multi-tool control command first (#663884)
    Thanks to Mike Fleetwood for this patch
  - Avoid redundant file system maximize actions (#663980)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include <sstream>
22
22
#include <iomanip>
23
 
#include <regex.h>
 
23
#include <glibmm/regex.h>
24
24
#include <locale.h>
25
25
 
26
26
 
181
181
                case FS_REISER4     : return "reiser4progs" ;
182
182
                case FS_REISERFS    : return "reiserfsprogs" ;
183
183
                case FS_UFS         : return "" ;
184
 
                case FS_XFS         : return "xfsprogs" ;
 
184
                case FS_XFS         : return "xfsprogs, xfsdump" ;
185
185
 
186
186
                default             : return "" ;
187
187
        }
327
327
        return exit_status ;
328
328
}
329
329
 
330
 
Glib::ustring Utils::regexp_label( const Glib::ustring & text,
331
 
                                const Glib::ustring & regular_sub_expression )
 
330
Glib::ustring Utils::regexp_label( const Glib::ustring & text
 
331
                                 , const Glib::ustring & pattern
 
332
                                 )
332
333
{
333
 
        //Extract text from a regular sub-expression.  E.g., "text we don't want (text we want)"
334
 
        Glib::ustring label = "";
335
 
        regex_t    preg ;
336
 
        int        nmatch = 2 ;
337
 
        regmatch_t pmatch[  2 ] ;
338
 
        int rc = regcomp( &preg, regular_sub_expression .c_str(), REG_EXTENDED | REG_ICASE | REG_NEWLINE ) ;
339
 
    if(rc == 0)
340
 
        {
341
 
                if (regexec(&preg, text.c_str(), nmatch, pmatch, 0) == 0)
342
 
                        label = text .substr( pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so ) ;
343
 
 
344
 
                regfree(&preg);
345
 
        }
346
 
        return label ;
 
334
        //Extract text from a regular sub-expression or pattern.
 
335
        //  E.g., "text we don't want (text we want)"
 
336
        std::vector<Glib::ustring> results;
 
337
        Glib::RefPtr<Glib::Regex> myregexp =
 
338
                Glib::Regex::create( pattern
 
339
                                   , Glib::REGEX_CASELESS | Glib::REGEX_MULTILINE
 
340
                                   );
 
341
 
 
342
        results = myregexp ->split( text );
 
343
 
 
344
        if ( results .size() >= 2 )
 
345
                return results[ 1 ] ;
 
346
        else
 
347
                return "" ;
347
348
}
348
349
 
349
350
Glib::ustring Utils::fat_compliant_label( const Glib::ustring & label )