[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809

srowen at gmail.com srowen at gmail.com
Wed Aug 4 01:31:42 UTC 2010


The following commit has been merged in the upstream branch:
commit 4acd8d1dce06ffe849e477159cd780e714b7c07e
Author: srowen at gmail.com <srowen at gmail.com@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date:   Thu May 20 13:17:39 2010 +0000

    Fixes from Konstantin
    
    git-svn-id: http://zxing.googlecode.com/svn/trunk@1377 59b500cc-1b3d-0410-9834-0bbf25fbcc57

diff --git a/iphone/Classes/Decoder.mm b/iphone/Classes/Decoder.mm
index ea7748b..d5ca9cf 100644
--- a/iphone/Classes/Decoder.mm
+++ b/iphone/Classes/Decoder.mm
@@ -59,6 +59,8 @@ using namespace zxing;
   if ([self.delegate respondsToSelector:@selector(decoder:didDecodeImage:usingSubset:withResult:)]) {
     [self.delegate decoder:self didDecodeImage:self.image usingSubset:self.subsetImage withResult:result];
   }
+	
+  [result release];
 }
 
 - (void)failedToDecodeImage:(NSString *)reason {
@@ -185,8 +187,8 @@ using namespace zxing;
           NSString *resultString = [NSString stringWithCString:cString
                                 encoding:NSUTF8StringEncoding];
           
-          decoderResult = [TwoDDecoderResult resultWithText:resultString
-                                                     points:points];
+          decoderResult = [[TwoDDecoderResult resultWithText:resultString
+                                                     points:points] retain];
         } catch (ReaderException &rex) {
           NSLog(@"failed to decode, caught ReaderException '%s'",
               rex.what());
@@ -210,7 +212,10 @@ using namespace zxing;
       }
     }
 #endif
-    
+	  
+	free(subsetData);
+	self.subsetData = NULL;
+	  
     if (decoderResult) {
       [self performSelectorOnMainThread:@selector(didDecodeImage:)
                    withObject:decoderResult
@@ -220,9 +225,6 @@ using namespace zxing;
                    withObject:NSLocalizedString(@"Decoder BarcodeDetectionFailure", @"No barcode detected.")
                 waitUntilDone:NO];
     }
-    
-    free(subsetData);
-    self.subsetData = NULL;
   }
   [pool drain];
 #ifdef DEBUG
@@ -236,7 +238,7 @@ using namespace zxing;
 }
 
 - (void) decodeImage:(UIImage *)i {
-  [self decodeImage:i cropRect:CGRectMake(0.0f, 0.0f, image.size.width, image.size.height)];
+  [self decodeImage:i cropRect:CGRectMake(0.0f, 0.0f, i.size.width, i.size.height)];
 }
 
 - (void) decodeImage:(UIImage *)i cropRect:(CGRect)cr {
diff --git a/iphone/ZXingWidget/Decoder.mm b/iphone/ZXingWidget/Decoder.mm
index 55d927a..d5ca9cf 100644
--- a/iphone/ZXingWidget/Decoder.mm
+++ b/iphone/ZXingWidget/Decoder.mm
@@ -59,6 +59,8 @@ using namespace zxing;
   if ([self.delegate respondsToSelector:@selector(decoder:didDecodeImage:usingSubset:withResult:)]) {
     [self.delegate decoder:self didDecodeImage:self.image usingSubset:self.subsetImage withResult:result];
   }
+	
+  [result release];
 }
 
 - (void)failedToDecodeImage:(NSString *)reason {
@@ -132,9 +134,6 @@ using namespace zxing;
 #endif
   
   self.subsetImage = [UIImage imageWithCGImage:subsetImageRef];
-  // for debug purposes.
-//  UIImageWriteToSavedPhotosAlbum(self.subsetImage, nil, nil, nil);
-
   CGImageRelease(subsetImageRef);
   
   CGContextRelease(ctx);
@@ -188,8 +187,8 @@ using namespace zxing;
           NSString *resultString = [NSString stringWithCString:cString
                                 encoding:NSUTF8StringEncoding];
           
-          decoderResult = [TwoDDecoderResult resultWithText:resultString
-                                                     points:points];
+          decoderResult = [[TwoDDecoderResult resultWithText:resultString
+                                                     points:points] retain];
         } catch (ReaderException &rex) {
           NSLog(@"failed to decode, caught ReaderException '%s'",
               rex.what());
@@ -213,7 +212,10 @@ using namespace zxing;
       }
     }
 #endif
-    
+	  
+	free(subsetData);
+	self.subsetData = NULL;
+	  
     if (decoderResult) {
       [self performSelectorOnMainThread:@selector(didDecodeImage:)
                    withObject:decoderResult
@@ -223,9 +225,6 @@ using namespace zxing;
                    withObject:NSLocalizedString(@"Decoder BarcodeDetectionFailure", @"No barcode detected.")
                 waitUntilDone:NO];
     }
-    
-    free(subsetData);
-    self.subsetData = NULL;
   }
   [pool drain];
 #ifdef DEBUG
@@ -239,7 +238,7 @@ using namespace zxing;
 }
 
 - (void) decodeImage:(UIImage *)i {
-  [self decodeImage:i cropRect:CGRectMake(0.0f, 0.0f, image.size.width, image.size.height)];
+  [self decodeImage:i cropRect:CGRectMake(0.0f, 0.0f, i.size.width, i.size.height)];
 }
 
 - (void) decodeImage:(UIImage *)i cropRect:(CGRect)cr {

-- 
Multi-format 1D/2D barcode image processing library



More information about the Pkg-google-commits mailing list