Ignore:
Timestamp:
2011-09-15T18:28:42+12:00 (13 years ago)
Author:
ak19
Message:

Dr Bainbridge suggested corrections to commits of revision 24600: 1. gs-magick.pl: close call on Pipe only if successfully opened. 2. Command_status always needs to be shifted and turned into its signed value for display in convertutil.pm. 3. giget calls to imagemagick more eficient: doesn't call identify twice, but just once since the exit code and output to STDOUT can both be inspected after just one call. Moreover, exit code needed to be tested for equality against 0, not whether it is greater than 0, so no shifting and converting to signed value required.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/giget.pm

    r24600 r24601  
    152152        }
    153153        else {
     154        my $command = "\"".&util::get_perl_exec()."\" -S gs-magick.pl identify \"$output_fname\" 2>&1";
     155        my $result = `$command`;
     156       
     157        my $status = $?;
    154158        # need to shift the $? exit code returned by system() by 8 bits and
    155159        # then convert it to a signed value to work out whether it is indeed > 0
    156         my $status = system("\"".&util::get_perl_exec()."\" -S gs-magick.pl identify \"$output_fname\"");
    157         $status >>= 8;
    158         $status = (($status & 0x80) ? -(0x100 - ($status & 0xFF)) : $status);
    159 
    160         if($status > 0 ) {
     160        #$status >>= 8;
     161        #$status = (($status & 0x80) ? -(0x100 - ($status & 0xFF)) : $status);
     162        #if($status > 0 ) {
     163        if($status != 0 ) {
    161164            print STDERR "**** NOT JPEG: output_fname \n";
    162165            unlink $output_fname;
    163166        }
    164167        else {
    165             my $command = "\"".&util::get_perl_exec()."\" -S gs-magick.pl identify \"$output_fname\" 2>&1";
    166             my $result = `$command`;
    167168           
    168169            my $type =   'unknown';
Note: See TracChangeset for help on using the changeset viewer.