diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/patches/18_bins-memory-leak	Wed Oct 15 23:35:35 2008 +0200
@@ -0,0 +1,214 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 18_bins-1.1.29-memory-leak.dpatch by  <rousseau@localhost.localdomain>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+--- bins-1.1.29.orig/bins
++++ bins-1.1.29/bins
+@@ -449,13 +449,13 @@
+ $defaultConfig{fileActiveSizeNames} = \@fileActiveSizeNames;
+ 
+ # Fields to display (in the list order) under the picture. These
+-# fields are defined in the getFields function below.
++# fields are defined in the %fields hash below.
+ my @mainFields = ("description", "people", "location", "date",
+                                   "event", "comment");
+ 
+ 
+ # Fields to display (in the list order) in the details page. These
+-# fields are in the getFields function below.
++# fields are in the %fields hash below.
+ my @secondaryFields = (
+                        # DigiCam
+                        _("BINS-SECTION DigiCam Info"),
+@@ -519,7 +519,6 @@
+                        "BINS-SECTION end", # close the last section
+                        );
+ 
+-sub getFields {
+     # The key is the string used as the name in the picture
+     #   description file.
+     # Name corresponds to the string displayed under the picture.
+@@ -527,9 +526,8 @@
+     #   found in some JPEG images.
+     # The value of the EXIF structure is only used if no value
+     #   is present in the picture description file.
+-    # Transform is a Perl operator used to convert an exif value
+-    #   to the desired format to display.  It is evaluated as
+-    #   normal Perl code and the result has to be in $_.
++    # Note: See also postProcessHashArrays() for dateString related
++    # items
+     my %fields =
+           (
+          "title" =>
+@@ -547,12 +545,6 @@
+          "date" =>
+          { Name => _("Date"),
+            EXIF => "DateTimeOriginal",
+-           Transform => '$_ = local2html(strftime $configHash->{dateString}, localtime str2time "$_") if str2time "$_"',
+-           # Alternatively, you could use regex substitution:
+-           # English version is yyyy:mm:dd hh:mm:ss to yyyy/mm/dd hh:mm:ss :
+-           # Transform => 's%^(\\d+):(\\d+):(\\d+) (.*)$%\$1/\$2/\$3 \$4%',
+-           # French version is yyyy:mm:dd hh:mm:ss to dd/mm/yyyy hh:mm:ss :
+-           # Transform => 's%^(\d+):(\d+):(\d+) (.*)$%$3/$2/$1 $4%',
+                  },
+ 
+              "event" =>
+@@ -822,8 +814,6 @@
+            Tip => _("Indicates the image sensor type on the camera or input device."),
+        },
+          );
+-    return \%fields;
+-}
+ 
+ my @priorityExifTags = ();  # the field in this list are taken from
+ # the desc file, even if they are present
+@@ -847,10 +837,10 @@
+                 });
+ $defaultConfig{colorsSubs} = \%colorsSubs;
+ 
+-sub getIntlSubs{
+-    my $configHash = shift;
+-    # Strings to translate in the HTML template pages (if I18N is used)
+-    my %intlSubs = (  STRING_THUMBNAILS   => _("thumbnails"),
++# Strings to translate in the HTML template pages (if I18N is used)
++# Note: See also postProcessHashArrays() for dateString related
++# items
++my %intlSubs = (  STRING_THUMBNAILS   => _("thumbnails"),
+                       STRING_IMAGELIST    => _("Image List"),
+                       STRING_HOME => _("Home"),
+                       STRING_ALBUM => _("Album"),
+@@ -882,13 +872,11 @@
+                       BINS_VERSION             => "1.1.29",
+                       ENCODING                 => $defaultConfig{htmlEncoding},
+                       GENERATED_DATE       => _("on ").
+-                      local2html(strftime($configHash->{dateString},
++                      local2html(strftime($defaultConfig{dateString},
+                                           localtime)),
+                       BINS_ID =>
+                       '<!--$Id: bins,v 1.182 2005/08/22 23:52:33 jerome Exp $-->',
+                       );
+-    return \%intlSubs;
+-}
+ 
+ # @knownImageExtentions defines file extensions that BINS can handle as
+ # input image. BINS _should_ handle all input format of ImageMagick
+@@ -925,6 +913,7 @@
+ sub beVerboseN;
+ sub min;
+ sub readConfigFile;
++sub postProcessHashArrays;
+ sub fileSize;
+ sub generateAlbumPages;
+ sub filenameToPreviewName;
+@@ -942,8 +931,6 @@
+ sub trimWhiteSpace;
+ sub stringToBool;
+ sub ignoreSet;
+-sub getFields;
+-sub getIntlSubs;
+ 
+ sub generateThumbnailPages;
+ sub generateThumbEntry;
+@@ -1015,6 +1002,27 @@
+     return \%option;
+ }
+ 
++# process hash arrays after reading config file
++# a non-default value of dateString might have been read from the
++# configuration file, so the proper values must be inserted into the
++# %fields and %intlSubs hash arrays
++sub postProcessHashArrays {
++    my $configHash = shift;
++
++    # Transform is a Perl operator used to convert an exif value
++    #   to the desired format to display.  It is evaluated as
++    #   normal Perl code and the result has to be in $_.
++    $fields{date}{Transform} =
++        '$_ = local2html(strftime $configHash->{dateString}, localtime str2time "$_")';
++           # Alternatively, you could use regex substitution:
++           # English version is yyyy:mm:dd hh:mm:ss to yyyy/mm/dd hh:mm:ss :
++           # Transform => 's%^(\\d+):(\\d+):(\\d+) (.*)$%\$1/\$2/\$3 \$4%',
++           # French version is yyyy:mm:dd hh:mm:ss to dd/mm/yyyy hh:mm:ss :
++           # Transform => 's%^(\d+):(\d+):(\d+) (.*)$%$3/$2/$1 $4%',
++    $intlSubs{GENERATED_DATE} = _("on ").
++            local2html(strftime($configHash->{dateString}, localtime)),
++}
++
+ # process command line arguments after reading config file
+ sub postProcessArgs {
+     my $option = shift;
+@@ -1272,6 +1280,9 @@
+     # read configurations files
+     my $defaultConfig = readConfigFile(\%defaultConfig);
+ 
++    # post process %fields and %intlSubs hash arrays
++    postProcessHashArrays($defaultConfig);
++
+     # post process command line args after reading config files
+     postProcessArgs($options, $defaultConfig);
+ 
+@@ -2962,7 +2973,7 @@
+             $sectionTitle = $tagName;
+             $sectionTitle =~ s/^BINS-SECTION //;
+         }else{
+-            $tagValue = getFields($configHash)->{$tagName};
++            $tagValue = $fields{$tagName};
+             if ($imageInfo->{$tagName}) {
+                 my %row = (FIELD_NAME => $tagValue->{'Name'},
+                            FIELD_VALUE => local2html($imageInfo->{$tagName})
+@@ -3017,7 +3028,7 @@
+     $subs_hash{CUSTOM_CSS} = $configHash->{customStyleSheet};
+ 
+     my @array;
+-    push @array, {NAV_NAME => getIntlSubs($configHash)->{STRING_BACKTOTHEIMAGE},
++    push @array, {NAV_NAME => $intlSubs{STRING_BACKTOTHEIMAGE},
+                   NAV_LINK => "javascript:history.back();",
+                   NAV_ICON => "back.png",
+                   NAV_ID => "back"};
+@@ -3674,7 +3685,7 @@
+         if (${%$hashref}{$tagName}) {
+             my $value=${%$hashref}{$tagName};
+             $value =~ s/'/&#39;/g  ; # in case it's used in javascript code
+-            push @descTable, {DESC_FIELD_NAME => getFields($configHash)->{$tagName}->{'Name'},
++            push @descTable, {DESC_FIELD_NAME => $fields{$tagName}->{'Name'},
+                               DESC_FIELD_VALUE => $value,
+                           };
+         }
+@@ -3819,7 +3830,7 @@
+     %{$templateParameters} =
+         (%{$templateParameters},
+          %{$configHash->{colorsSubs}{$configHash->{colorStyle}}},
+-         %{getIntlSubs($configHash)},
++         %intlSubs,
+          );
+ 
+     # open the html template
+@@ -3951,7 +3962,7 @@
+                 && $element->{Name} eq "field") {
+                 $fieldName = $element->{Attributes}{'name'};
+                 $fieldValue = "";
+-                if (grep (/^$fieldName$/, keys(%{getFields($configHash)}))) {
++                if (grep (/^$fieldName$/, keys(%fields))) {
+                     beVerbose("    Reading field '$fieldName':", 3);
+                     foreach my $characters (@{$element->{Contents}}) {
+                         #if (UNIVERSAL::isa($characters, 'XML::Grove::Characters')) {
+@@ -4377,13 +4388,13 @@
+     }
+ 
+     # add value to desc Hash if field is void
+-    foreach my $field (keys(%{getFields($configHash)})) {
+-        my $fieldExif = getFields($configHash)->{$field}->{'EXIF'};
++    foreach my $field (keys(%fields)) {
++        my $fieldExif = $fields{$field}->{'EXIF'};
+         if ((! $descHash->{$field}) && $fieldExif && $exifHash->{$fieldExif}) {
+             beVerboseN("  Using '$field' from EXIF data: ".
+                        $exifHash->{$fieldExif}, 3);
+ 
+-            my $func = getFields($configHash)->{$field}->{'Transform'};
++            my $func = $fields{$field}->{'Transform'};
+             if ($func) {
+                 $_ = $exifHash->{$fieldExif};
+                 beVerbose("  Evaluating '$func' from '$_'", 4);