Mercurial > bins
comparison debian/patches/18_bins-memory-leak @ 4:c5749e43b1d7
Adding debian files (to original 1.1.29)
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Wed, 15 Oct 2008 23:35:35 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:a84c32f131df | 4:c5749e43b1d7 |
---|---|
1 #! /bin/sh /usr/share/dpatch/dpatch-run | |
2 ## 18_bins-1.1.29-memory-leak.dpatch by <rousseau@localhost.localdomain> | |
3 ## | |
4 ## All lines beginning with `## DP:' are a description of the patch. | |
5 ## DP: No description. | |
6 | |
7 @DPATCH@ | |
8 --- bins-1.1.29.orig/bins | |
9 +++ bins-1.1.29/bins | |
10 @@ -449,13 +449,13 @@ | |
11 $defaultConfig{fileActiveSizeNames} = \@fileActiveSizeNames; | |
12 | |
13 # Fields to display (in the list order) under the picture. These | |
14 -# fields are defined in the getFields function below. | |
15 +# fields are defined in the %fields hash below. | |
16 my @mainFields = ("description", "people", "location", "date", | |
17 "event", "comment"); | |
18 | |
19 | |
20 # Fields to display (in the list order) in the details page. These | |
21 -# fields are in the getFields function below. | |
22 +# fields are in the %fields hash below. | |
23 my @secondaryFields = ( | |
24 # DigiCam | |
25 _("BINS-SECTION DigiCam Info"), | |
26 @@ -519,7 +519,6 @@ | |
27 "BINS-SECTION end", # close the last section | |
28 ); | |
29 | |
30 -sub getFields { | |
31 # The key is the string used as the name in the picture | |
32 # description file. | |
33 # Name corresponds to the string displayed under the picture. | |
34 @@ -527,9 +526,8 @@ | |
35 # found in some JPEG images. | |
36 # The value of the EXIF structure is only used if no value | |
37 # is present in the picture description file. | |
38 - # Transform is a Perl operator used to convert an exif value | |
39 - # to the desired format to display. It is evaluated as | |
40 - # normal Perl code and the result has to be in $_. | |
41 + # Note: See also postProcessHashArrays() for dateString related | |
42 + # items | |
43 my %fields = | |
44 ( | |
45 "title" => | |
46 @@ -547,12 +545,6 @@ | |
47 "date" => | |
48 { Name => _("Date"), | |
49 EXIF => "DateTimeOriginal", | |
50 - Transform => '$_ = local2html(strftime $configHash->{dateString}, localtime str2time "$_") if str2time "$_"', | |
51 - # Alternatively, you could use regex substitution: | |
52 - # English version is yyyy:mm:dd hh:mm:ss to yyyy/mm/dd hh:mm:ss : | |
53 - # Transform => 's%^(\\d+):(\\d+):(\\d+) (.*)$%\$1/\$2/\$3 \$4%', | |
54 - # French version is yyyy:mm:dd hh:mm:ss to dd/mm/yyyy hh:mm:ss : | |
55 - # Transform => 's%^(\d+):(\d+):(\d+) (.*)$%$3/$2/$1 $4%', | |
56 }, | |
57 | |
58 "event" => | |
59 @@ -822,8 +814,6 @@ | |
60 Tip => _("Indicates the image sensor type on the camera or input device."), | |
61 }, | |
62 ); | |
63 - return \%fields; | |
64 -} | |
65 | |
66 my @priorityExifTags = (); # the field in this list are taken from | |
67 # the desc file, even if they are present | |
68 @@ -847,10 +837,10 @@ | |
69 }); | |
70 $defaultConfig{colorsSubs} = \%colorsSubs; | |
71 | |
72 -sub getIntlSubs{ | |
73 - my $configHash = shift; | |
74 - # Strings to translate in the HTML template pages (if I18N is used) | |
75 - my %intlSubs = ( STRING_THUMBNAILS => _("thumbnails"), | |
76 +# Strings to translate in the HTML template pages (if I18N is used) | |
77 +# Note: See also postProcessHashArrays() for dateString related | |
78 +# items | |
79 +my %intlSubs = ( STRING_THUMBNAILS => _("thumbnails"), | |
80 STRING_IMAGELIST => _("Image List"), | |
81 STRING_HOME => _("Home"), | |
82 STRING_ALBUM => _("Album"), | |
83 @@ -882,13 +872,11 @@ | |
84 BINS_VERSION => "1.1.29", | |
85 ENCODING => $defaultConfig{htmlEncoding}, | |
86 GENERATED_DATE => _("on "). | |
87 - local2html(strftime($configHash->{dateString}, | |
88 + local2html(strftime($defaultConfig{dateString}, | |
89 localtime)), | |
90 BINS_ID => | |
91 '<!--$Id: bins,v 1.182 2005/08/22 23:52:33 jerome Exp $-->', | |
92 ); | |
93 - return \%intlSubs; | |
94 -} | |
95 | |
96 # @knownImageExtentions defines file extensions that BINS can handle as | |
97 # input image. BINS _should_ handle all input format of ImageMagick | |
98 @@ -925,6 +913,7 @@ | |
99 sub beVerboseN; | |
100 sub min; | |
101 sub readConfigFile; | |
102 +sub postProcessHashArrays; | |
103 sub fileSize; | |
104 sub generateAlbumPages; | |
105 sub filenameToPreviewName; | |
106 @@ -942,8 +931,6 @@ | |
107 sub trimWhiteSpace; | |
108 sub stringToBool; | |
109 sub ignoreSet; | |
110 -sub getFields; | |
111 -sub getIntlSubs; | |
112 | |
113 sub generateThumbnailPages; | |
114 sub generateThumbEntry; | |
115 @@ -1015,6 +1002,27 @@ | |
116 return \%option; | |
117 } | |
118 | |
119 +# process hash arrays after reading config file | |
120 +# a non-default value of dateString might have been read from the | |
121 +# configuration file, so the proper values must be inserted into the | |
122 +# %fields and %intlSubs hash arrays | |
123 +sub postProcessHashArrays { | |
124 + my $configHash = shift; | |
125 + | |
126 + # Transform is a Perl operator used to convert an exif value | |
127 + # to the desired format to display. It is evaluated as | |
128 + # normal Perl code and the result has to be in $_. | |
129 + $fields{date}{Transform} = | |
130 + '$_ = local2html(strftime $configHash->{dateString}, localtime str2time "$_")'; | |
131 + # Alternatively, you could use regex substitution: | |
132 + # English version is yyyy:mm:dd hh:mm:ss to yyyy/mm/dd hh:mm:ss : | |
133 + # Transform => 's%^(\\d+):(\\d+):(\\d+) (.*)$%\$1/\$2/\$3 \$4%', | |
134 + # French version is yyyy:mm:dd hh:mm:ss to dd/mm/yyyy hh:mm:ss : | |
135 + # Transform => 's%^(\d+):(\d+):(\d+) (.*)$%$3/$2/$1 $4%', | |
136 + $intlSubs{GENERATED_DATE} = _("on "). | |
137 + local2html(strftime($configHash->{dateString}, localtime)), | |
138 +} | |
139 + | |
140 # process command line arguments after reading config file | |
141 sub postProcessArgs { | |
142 my $option = shift; | |
143 @@ -1272,6 +1280,9 @@ | |
144 # read configurations files | |
145 my $defaultConfig = readConfigFile(\%defaultConfig); | |
146 | |
147 + # post process %fields and %intlSubs hash arrays | |
148 + postProcessHashArrays($defaultConfig); | |
149 + | |
150 # post process command line args after reading config files | |
151 postProcessArgs($options, $defaultConfig); | |
152 | |
153 @@ -2962,7 +2973,7 @@ | |
154 $sectionTitle = $tagName; | |
155 $sectionTitle =~ s/^BINS-SECTION //; | |
156 }else{ | |
157 - $tagValue = getFields($configHash)->{$tagName}; | |
158 + $tagValue = $fields{$tagName}; | |
159 if ($imageInfo->{$tagName}) { | |
160 my %row = (FIELD_NAME => $tagValue->{'Name'}, | |
161 FIELD_VALUE => local2html($imageInfo->{$tagName}) | |
162 @@ -3017,7 +3028,7 @@ | |
163 $subs_hash{CUSTOM_CSS} = $configHash->{customStyleSheet}; | |
164 | |
165 my @array; | |
166 - push @array, {NAV_NAME => getIntlSubs($configHash)->{STRING_BACKTOTHEIMAGE}, | |
167 + push @array, {NAV_NAME => $intlSubs{STRING_BACKTOTHEIMAGE}, | |
168 NAV_LINK => "javascript:history.back();", | |
169 NAV_ICON => "back.png", | |
170 NAV_ID => "back"}; | |
171 @@ -3674,7 +3685,7 @@ | |
172 if (${%$hashref}{$tagName}) { | |
173 my $value=${%$hashref}{$tagName}; | |
174 $value =~ s/'/'/g ; # in case it's used in javascript code | |
175 - push @descTable, {DESC_FIELD_NAME => getFields($configHash)->{$tagName}->{'Name'}, | |
176 + push @descTable, {DESC_FIELD_NAME => $fields{$tagName}->{'Name'}, | |
177 DESC_FIELD_VALUE => $value, | |
178 }; | |
179 } | |
180 @@ -3819,7 +3830,7 @@ | |
181 %{$templateParameters} = | |
182 (%{$templateParameters}, | |
183 %{$configHash->{colorsSubs}{$configHash->{colorStyle}}}, | |
184 - %{getIntlSubs($configHash)}, | |
185 + %intlSubs, | |
186 ); | |
187 | |
188 # open the html template | |
189 @@ -3951,7 +3962,7 @@ | |
190 && $element->{Name} eq "field") { | |
191 $fieldName = $element->{Attributes}{'name'}; | |
192 $fieldValue = ""; | |
193 - if (grep (/^$fieldName$/, keys(%{getFields($configHash)}))) { | |
194 + if (grep (/^$fieldName$/, keys(%fields))) { | |
195 beVerbose(" Reading field '$fieldName':", 3); | |
196 foreach my $characters (@{$element->{Contents}}) { | |
197 #if (UNIVERSAL::isa($characters, 'XML::Grove::Characters')) { | |
198 @@ -4377,13 +4388,13 @@ | |
199 } | |
200 | |
201 # add value to desc Hash if field is void | |
202 - foreach my $field (keys(%{getFields($configHash)})) { | |
203 - my $fieldExif = getFields($configHash)->{$field}->{'EXIF'}; | |
204 + foreach my $field (keys(%fields)) { | |
205 + my $fieldExif = $fields{$field}->{'EXIF'}; | |
206 if ((! $descHash->{$field}) && $fieldExif && $exifHash->{$fieldExif}) { | |
207 beVerboseN(" Using '$field' from EXIF data: ". | |
208 $exifHash->{$fieldExif}, 3); | |
209 | |
210 - my $func = getFields($configHash)->{$field}->{'Transform'}; | |
211 + my $func = $fields{$field}->{'Transform'}; | |
212 if ($func) { | |
213 $_ = $exifHash->{$fieldExif}; | |
214 beVerbose(" Evaluating '$func' from '$_'", 4); |