updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / vdr-burn / 91_trim-fix.dpatch
blobad9c5627e03fb0cce0e2825eb9418348d5c4149f
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 91_trim-fix.dpatch by Tobias Grimm <tg@e-tobi.net>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Solution from CVS for bug #178
6 ## DP: ( http://vdr-developer.org/mantisbt/view.php?id=178 )
8 @DPATCH@
9 diff -urNad vdr-plugin-burn-0.1.0~pre21~/common.c vdr-plugin-burn-0.1.0~pre21/common.c
10 --- vdr-plugin-burn-0.1.0~pre21~/common.c 2006-09-16 20:33:36.000000000 +0200
11 +++ vdr-plugin-burn-0.1.0~pre21/common.c 2006-10-31 16:57:55.000000000 +0100
12 @@ -2,7 +2,7 @@
13 * See the files COPYING and README for copyright information and how to reach
14 * the author.
16 - * $Id: common.c,v 1.28 2006/09/16 18:33:36 lordjaxom Exp $
17 + * $Id: common.c,v 1.29 2006/10/01 21:22:27 lordjaxom Exp $
20 #include "burn.h"
21 @@ -116,15 +116,11 @@
22 return builder.str();
25 - void trim_left( std::string& text_, const char* characters_ )
26 + void trim_left( std::string& text_, const char* characters_, std::string::size_type offset_ )
28 - std::string::size_type pos = 0;
29 - do {
30 - while ( strchr( characters_, text_[ pos ] ) != NULL )
31 - text_.erase( 0, 1 );
32 - if ( ( pos = text_.find( '~' ) ) != std::string::npos )
33 - ++pos;
34 - } while ( pos != std::string::npos );
35 + std::string::size_type pos;
36 + if ( ( pos = text_.find_first_not_of( characters_, offset_ ) ) > 0 )
37 + text_.erase( offset_, pos - offset_ );
40 string get_recording_datetime(const cRecording* recording_, char delimiter)
41 diff -urNad vdr-plugin-burn-0.1.0~pre21~/common.h vdr-plugin-burn-0.1.0~pre21/common.h
42 --- vdr-plugin-burn-0.1.0~pre21~/common.h 2006-09-16 20:33:36.000000000 +0200
43 +++ vdr-plugin-burn-0.1.0~pre21/common.h 2006-10-31 16:57:55.000000000 +0100
44 @@ -2,7 +2,7 @@
45 * See the files COPYING and README for copyright information and how to reach
46 * the author.
48 - * $Id: common.h,v 1.28 2006/09/16 18:33:36 lordjaxom Exp $
49 + * $Id: common.h,v 1.29 2006/10/01 21:22:27 lordjaxom Exp $
52 #ifndef VDR_BURN_COMMON_H
53 @@ -194,7 +194,7 @@
55 int ScanPageCount(const std::string& Path);
56 std::string progress_bar(double current, double total, int length = 20);
57 - void trim_left( std::string& text_, const char* characters_ );
58 + void trim_left( std::string& text_, const char* characters_, std::string::size_type offset_ = 0 );
60 //!--- recording helper functions -----------------------------------------
62 diff -urNad vdr-plugin-burn-0.1.0~pre21~/jobs.c vdr-plugin-burn-0.1.0~pre21/jobs.c
63 --- vdr-plugin-burn-0.1.0~pre21~/jobs.c 2006-09-16 20:33:36.000000000 +0200
64 +++ vdr-plugin-burn-0.1.0~pre21/jobs.c 2006-10-31 16:57:55.000000000 +0100
65 @@ -2,7 +2,7 @@
66 * See the files COPYING and README for copyright information and how to reach
67 * the author.
69 - * $Id: jobs.c,v 1.34 2006/09/16 18:33:36 lordjaxom Exp $
70 + * $Id: jobs.c,v 1.35 2006/10/01 21:22:27 lordjaxom Exp $
73 #include "burn.h"
74 @@ -47,15 +47,19 @@
75 m_fileName( recording_->FileName() ),
76 m_summary( get_recording_description(recording_) ),
77 m_datetime( get_recording_datetime(recording_, ' ') ),
78 + m_title( recording_->Name() ),
79 m_totalSize( 0, 0 ),
80 m_totalLength( 0, 0 )
82 - string title = recording_->Name();
83 - string::size_type pos;
84 - if (global_setup().RemovePath && (pos = title.rfind('~')) != string::npos)
85 - title.erase(0, pos + 1);
86 - trim_left(title, "%@");
87 - m_title = title;
88 + std::string::size_type pos;
89 + if ( global_setup().RemovePath && ( pos = m_title.rfind( '~' ) ) != std::string::npos )
90 + m_title.erase( 0, pos + 1 );
92 + for ( pos = 0;; ++pos ) {
93 + trim_left( m_title, "%@", pos );
94 + if ( ( pos = m_title.find( '~', pos ) ) == std::string::npos )
95 + break;
96 + }
99 // size_pair::size_type recording::get_total_size() const