Prechádzať zdrojové kódy

Contrast Mobile add order discount / fix crash

ERP Mobile compatible fix
Ray Zhang 2 rokov pred
rodič
commit
f76aa59820
100 zmenil súbory, kde vykonal 8788 pridanie a 7569 odobranie
  1. 5 16
      RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj
  2. 1 1
      RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist
  3. 192 107
      RedAnt ERP Mobile/HMLG Scan Order/CartViewController.m
  4. 17 17
      RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m
  5. 3 2
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/MessageBox.m
  6. 5 3
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/PopWaitAlert.m
  7. 4 2
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/RAPopviewContainer.m
  8. 5 4
      RedAnt ERP Mobile/HMLG Scan Order/RAQRCodeScannerViewController.m
  9. 1 1
      RedAnt ERP Mobile/HMLG Scan Order/ScanHomeViewController.m
  10. 2 2
      RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m
  11. 0 18
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/WorkspaceSettings.xcsettings
  12. 0 1911
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  13. 0 115
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Expressions.xcexplist
  14. BIN
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate
  15. 0 17
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  16. 0 14
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Expressions.xcexplist
  17. 5 0
      RedAnt ERP Mobile/ScanApiSDK-10.2.227-2/ScanApiHelper.mm
  18. 4 4
      RedAnt ERP Mobile/common/AES/NSData+CommonCrypto.h
  19. 21 21
      RedAnt ERP Mobile/common/AES/NSData+CommonCrypto.m
  20. 31 18
      RedAnt ERP Mobile/common/AppDelegateBase.m
  21. 1 1
      RedAnt ERP Mobile/common/AutoScrollImage/CycleScrollView.m
  22. 2 17
      RedAnt ERP Mobile/common/ERP_Mobile_Cart.storyboard
  23. 89 96
      RedAnt ERP Mobile/common/ERP_Mobile_Portfolio.storyboard
  24. 19 19
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  25. 27 13
      RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m
  26. 4 4
      RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m
  27. 384 364
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  28. 1 1
      RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m
  29. 10 10
      RedAnt ERP Mobile/common/Functions/category/CategorySearchFilterViewController.m
  30. 13 7
      RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m
  31. 13 13
      RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m
  32. 1 1
      RedAnt ERP Mobile/common/Functions/home/HomeViewController.m
  33. 12 11
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m
  34. 40 66
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m
  35. 4 4
      RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m
  36. 38 14
      RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.m
  37. 6 4
      RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m
  38. 1 1
      RedAnt ERP Mobile/common/Functions/order/OrderDetailModelCell.m
  39. 18 18
      RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m
  40. 24 12
      RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m
  41. 3 3
      RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m
  42. 1 1
      RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m
  43. 10 5
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m
  44. 23 13
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m
  45. 10 10
      RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchFilterViewController.m
  46. 8 8
      RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m
  47. 7 7
      RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m
  48. 31 3
      RedAnt ERP Mobile/common/Functions/sidemenu/FunctionTestViewController.m
  49. 1 1
      RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m
  50. 31 0
      RedAnt ERP Mobile/common/Functions/signature/AAPLShaderTypes.h
  51. 62 0
      RedAnt ERP Mobile/common/Functions/signature/AAPLShaders.metal
  52. 26 0
      RedAnt ERP Mobile/common/Functions/signature/SViewController.h
  53. 200 0
      RedAnt ERP Mobile/common/Functions/signature/SViewController.m
  54. 42 0
      RedAnt ERP Mobile/common/Functions/signature/SignatureRenderer.h
  55. 193 0
      RedAnt ERP Mobile/common/Functions/signature/SignatureRenderer.m
  56. 3 2
      RedAnt ERP Mobile/common/Functions/signature/SignatureView.m
  57. 1 1
      RedAnt ERP Mobile/common/Functions/signature/SignatureViewController.m
  58. 39 0
      RedAnt ERP Mobile/common/Functions/signature/SignatureViewM.h
  59. 716 0
      RedAnt ERP Mobile/common/Functions/signature/SignatureViewM.m
  60. 18 15
      RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m
  61. 3 3
      RedAnt ERP Mobile/common/PDFUtils.m
  62. 2 0
      RedAnt ERP Mobile/common/Reachability.m
  63. 2 2
      RedAnt ERP Mobile/common/TextUtils.m
  64. 2 1
      RedAnt ERP Mobile/common/customUI/ImageScrollerViewController.m
  65. 17 10
      RedAnt ERP Mobile/common/data_provider/RADataProvider.h
  66. 56 54
      RedAnt ERP Mobile/common/data_provider/RADataProvider.m
  67. 2 1
      RedAnt ERP Mobile/common/data_provider/RANetwork.h
  68. 4 3
      RedAnt ERP Mobile/common/data_provider/RANetwork.m
  69. 2 2
      RedAnt ERP Mobile/common/pdfCreator/RAPDFPage.m
  70. 25 24
      RedAnt ERP Mobile/common/pdfCreator/TextDrawable.m
  71. 8 2
      RedAnt ERP Mobile/common/zip/ZipArchive.mm
  72. 132 132
      RedAnt ERP Mobile/common/zip/minizip/crypt.h
  73. 257 177
      RedAnt ERP Mobile/common/zip/minizip/ioapi.c
  74. 210 75
      RedAnt ERP Mobile/common/zip/minizip/ioapi.h
  75. 291 283
      RedAnt ERP Mobile/common/zip/minizip/mztools.c
  76. 37 31
      RedAnt ERP Mobile/common/zip/minizip/mztools.h
  77. 2130 1599
      RedAnt ERP Mobile/common/zip/minizip/unzip.c
  78. 437 354
      RedAnt ERP Mobile/common/zip/minizip/unzip.h
  79. 2002 1219
      RedAnt ERP Mobile/common/zip/minizip/zip.c
  80. 367 235
      RedAnt ERP Mobile/common/zip/minizip/zip.h
  81. 24 12
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/project.pbxproj
  82. 1 1
      RedAnt ERP Mobile/iSales-CONTRAST/ContrastModelItemCell.m
  83. 85 85
      RedAnt ERP Mobile/iSales-CONTRAST/config.h
  84. 2 14
      RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj
  85. 12 3
      RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard
  86. 0 12
      RedAnt ERP Mobile/iSales-TRADESHOW.xcodeproj/project.pbxproj
  87. 0 12
      RedAnt ERP Mobile/iSales-UNITED WAVER.xcodeproj/project.pbxproj
  88. 0 12
      RedAnt ERP Mobile/iSales-USAI.xcodeproj/project.pbxproj
  89. BIN
      Redant Drivers/Redant Drivers.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
  90. 4 4
      common/NetworkUtils.m
  91. 3 1
      common/RAUtils.h
  92. 26 5
      common/RAUtils.m
  93. 1 1
      common/WK PDF+Web/RAPDFViewController.m
  94. 10 7
      common/Youtube/RAYTPlayer.m
  95. 75 72
      common/customUI/CustomIOSAlertView.m
  96. 1 1
      common/customUI/commoneditor/CommonEditorAutoCompleteView.m
  97. 1 1
      common/customUI/commoneditor/CommonEditorCellModel.m
  98. 121 95
      common/customUI/commoneditor/CommonEditorViewController.m
  99. 2 1
      common/customUI/commoneditor/EnumSelectAndSort/EnumSelectAndSortViewController.m
  100. 6 5
      common/upload/RANetworkTaskDelegate.m

+ 5 - 16
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj

@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 46;
+	objectVersion = 53;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -101,7 +101,6 @@
 		3CDDB262273A59DF00681F78 /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB260273A59DF00681F78 /* TouchImageView.m */; };
 		3CDDB265273A59EF00681F78 /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB264273A59EF00681F78 /* RTLabel.m */; };
 		3CDDB268273A5A0400681F78 /* StrikethroughLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB267273A5A0400681F78 /* StrikethroughLabel.m */; };
-		3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */; };
 		3CDDB26E273A5A7800681F78 /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB26C273A5A7800681F78 /* RAUtils.m */; };
 		3CF33C8B27BF4936001CBEEC /* ServerSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CF33C8A27BF4936001CBEEC /* ServerSettingViewController.m */; };
 		3CF33C8F27BF4A3D001CBEEC /* RAQRCodeScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CF33C8C27BF4A3D001CBEEC /* RAQRCodeScannerViewController.m */; };
@@ -321,7 +320,6 @@
 		71DF74851C57608F00F2789C /* ImageUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74701C57608F00F2789C /* ImageUploadViewController.m */; };
 		71DF74861C57608F00F2789C /* ImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74721C57608F00F2789C /* ImageViewController.m */; };
 		71DF74871C57608F00F2789C /* NIDropDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74741C57608F00F2789C /* NIDropDown.m */; };
-		71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74761C57608F00F2789C /* PulldownMenu.m */; };
 		71DF74891C57608F00F2789C /* RadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74781C57608F00F2789C /* RadioButton.m */; };
 		71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF747C1C57608F00F2789C /* SimpleGrid.m */; };
 		71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74801C57608F00F2789C /* TouchLabel.m */; };
@@ -500,8 +498,6 @@
 		3CDDB264273A59EF00681F78 /* RTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RTLabel.m; path = ../../common/customUI/RTLabel.m; sourceTree = "<group>"; };
 		3CDDB266273A5A0400681F78 /* StrikethroughLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrikethroughLabel.h; path = ../../common/customUI/StrikethroughLabel.h; sourceTree = "<group>"; };
 		3CDDB267273A5A0400681F78 /* StrikethroughLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StrikethroughLabel.m; path = ../../common/customUI/StrikethroughLabel.m; sourceTree = "<group>"; };
-		3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomIOSAlertView.m; path = ../../common/customUI/CustomIOSAlertView.m; sourceTree = "<group>"; };
-		3CDDB26A273A5A1500681F78 /* CustomIOSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomIOSAlertView.h; path = ../../common/customUI/CustomIOSAlertView.h; sourceTree = "<group>"; };
 		3CDDB26C273A5A7800681F78 /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = ../../common/RAUtils.m; sourceTree = "<group>"; };
 		3CDDB26D273A5A7800681F78 /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = ../../common/RAUtils.h; sourceTree = "<group>"; };
 		3CF33C8927BF4936001CBEEC /* ServerSettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerSettingViewController.h; sourceTree = "<group>"; };
@@ -891,8 +887,6 @@
 		71DF74721C57608F00F2789C /* ImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageViewController.m; path = common/customUI/ImageViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74731C57608F00F2789C /* NIDropDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIDropDown.h; path = common/customUI/NIDropDown.h; sourceTree = SOURCE_ROOT; };
 		71DF74741C57608F00F2789C /* NIDropDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIDropDown.m; path = common/customUI/NIDropDown.m; sourceTree = SOURCE_ROOT; };
-		71DF74751C57608F00F2789C /* PulldownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PulldownMenu.h; path = common/customUI/PulldownMenu.h; sourceTree = SOURCE_ROOT; };
-		71DF74761C57608F00F2789C /* PulldownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PulldownMenu.m; path = common/customUI/PulldownMenu.m; sourceTree = SOURCE_ROOT; };
 		71DF74771C57608F00F2789C /* RadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioButton.h; path = common/customUI/RadioButton.h; sourceTree = SOURCE_ROOT; };
 		71DF74781C57608F00F2789C /* RadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RadioButton.m; path = common/customUI/RadioButton.m; sourceTree = SOURCE_ROOT; };
 		71DF747B1C57608F00F2789C /* SimpleGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleGrid.h; path = common/customUI/SimpleGrid.h; sourceTree = SOURCE_ROOT; };
@@ -1689,8 +1683,6 @@
 		718600B31936C385004B6CDE /* customUI */ = {
 			isa = PBXGroup;
 			children = (
-				3CDDB26A273A5A1500681F78 /* CustomIOSAlertView.h */,
-				3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */,
 				71DF746B1C57608F00F2789C /* ImageScrollerView.h */,
 				71DF746C1C57608F00F2789C /* ImageScrollerView.m */,
 				71DF746D1C57608F00F2789C /* ImageScrollerViewController.h */,
@@ -1701,8 +1693,6 @@
 				71DF74721C57608F00F2789C /* ImageViewController.m */,
 				71DF74731C57608F00F2789C /* NIDropDown.h */,
 				71DF74741C57608F00F2789C /* NIDropDown.m */,
-				71DF74751C57608F00F2789C /* PulldownMenu.h */,
-				71DF74761C57608F00F2789C /* PulldownMenu.m */,
 				71DF74771C57608F00F2789C /* RadioButton.h */,
 				71DF74781C57608F00F2789C /* RadioButton.m */,
 				71DF747B1C57608F00F2789C /* SimpleGrid.h */,
@@ -2035,7 +2025,8 @@
 		713F769E1929F4A7006A7305 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 1330;
+				BuildIndependentTargetsInParallel = YES;
+				LastUpgradeCheck = 1430;
 				ORGANIZATIONNAME = "United Software Applications, Inc";
 				TargetAttributes = {
 					713F76A51929F4A7006A7305 = {
@@ -2223,7 +2214,6 @@
 				712AFED71DBA050200254965 /* BasicDrawable.m in Sources */,
 				3C51494E273D095900F78617 /* CommonEditorCellImg.m in Sources */,
 				71DF74891C57608F00F2789C /* RadioButton.m in Sources */,
-				3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */,
 				3CF513A827F437CF004B4818 /* ScanSearchViewController.m in Sources */,
 				7162A5DF1C5876E300AB630E /* ScannerSettingViewController.m in Sources */,
 				71DF74831C57608F00F2789C /* ImageScrollerView.m in Sources */,
@@ -2232,7 +2222,6 @@
 				3CDDB265273A59EF00681F78 /* RTLabel.m in Sources */,
 				3C51494D273D095900F78617 /* CommonEditorCellSignature.m in Sources */,
 				3C4DA62527B503B1001EB44E /* MainViewController.m in Sources */,
-				71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */,
 				7141DD551C57459B00F7DF59 /* split.c in Sources */,
 				716AF8E11D7AA0E0001188E0 /* SelectUploadOrderViewController.m in Sources */,
 				712AFEDF1DBA050200254965 /* TextDrawable.m in Sources */,
@@ -2546,7 +2535,7 @@
 				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 53394;
+				CURRENT_PROJECT_VERSION = 53397;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2595,7 +2584,7 @@
 				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 53394;
+				CURRENT_PROJECT_VERSION = 53397;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>HMLG Scan Order.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>3</integer>
 		</dict>
 	</dict>
 </dict>

+ 192 - 107
RedAnt ERP Mobile/HMLG Scan Order/CartViewController.m

@@ -425,7 +425,20 @@
     self.toolbar.hidden = false;
     
     //   DebugLog(@"begin edit %@",NSStringFromCGRect(self.cartItemView.frame));
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+//    NSArray *scenes=[[[UIApplication sharedApplication] connectedScenes] allObjects];
+//    NSArray *windows=[[scenes objectAtIndex:0] windows];
+//
+//    UIWindow* w=windows[0];
+
+    
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];
+    
+//    if (@available(iOS 13, *)) {
+//        orientation= [RAUtils query_orientation:self];
+//    }
+//    else
+//        orientation=[[UIApplication sharedApplication] statusBarOrientation];
+    
     if ( UIInterfaceOrientationIsPortrait(orientation))
         self.cartItemView.frame = CGRectMake(0,40,768,840);
     else
@@ -440,7 +453,7 @@
     //    DebugLog(@"end edit %@",NSStringFromCGRect(self.cartItemView.frame));
     
     
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation= [RAUtils query_orientation:self];// = [[UIApplication sharedApplication]statusBarOrientation];
     if ( UIInterfaceOrientationIsPortrait(orientation))
         self.cartItemView.frame = CGRectMake(0,40,768,760);
     else
@@ -505,34 +518,34 @@
     
     return;
 #endif
-    UITableViewCell* cell =(UITableViewCell*) sender.superview.superview;
-    
-    NSIndexPath *   indexPath = [self.itemListTable indexPathForCell:cell];
-    //            DebugLog(@"shouldchangeedit %d_%d",indexPath.section,indexPath.row);
-    NSDictionary * item_json = nil;
-    if (self.back_order_flag) {
-        item_json = [self itemJsonAtIndexPath:indexPath];
-    } else {
-        item_json = self.content_arr[indexPath.row];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
-    }
-    
-    NSString* product_id = [item_json valueForKey:@"product_id"];
-    NSString *name = [item_json valueForKey:@"model"];
-    
-    int is_rate = [item_json[@"is_rate"] intValue];
-    if(is_rate==1)
-        return;
-    
-    DetailViewController* dvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Model" bundle:nil] instantiateViewControllerWithIdentifier:@"DetailViewController" ];
-    //            dvc
-    
-    dvc.product_id=product_id;
-    dvc.category_id=nil;
-    dvc.ispush=true;
-    dvc.model_name = name;
-    
-    [dvc reload];
-    [self.navigationController pushViewController:dvc animated:true];
+//    UITableViewCell* cell =(UITableViewCell*) sender.superview.superview;
+//
+//    NSIndexPath *   indexPath = [self.itemListTable indexPathForCell:cell];
+//    //            DebugLog(@"shouldchangeedit %d_%d",indexPath.section,indexPath.row);
+//    NSDictionary * item_json = nil;
+//    if (self.back_order_flag) {
+//        item_json = [self itemJsonAtIndexPath:indexPath];
+//    } else {
+//        item_json = self.content_arr[indexPath.row];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
+//    }
+//
+//    NSString* product_id = [item_json valueForKey:@"product_id"];
+//    NSString *name = [item_json valueForKey:@"model"];
+//
+//    int is_rate = [item_json[@"is_rate"] intValue];
+//    if(is_rate==1)
+//        return;
+//
+//    DetailViewController* dvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Model" bundle:nil] instantiateViewControllerWithIdentifier:@"DetailViewController" ];
+//    //            dvc
+//
+//    dvc.product_id=product_id;
+//    dvc.category_id=nil;
+//    dvc.ispush=true;
+//    dvc.model_name = name;
+//
+//    [dvc reload];
+//    [self.navigationController pushViewController:dvc animated:true];
 }
 -(void)viewWillLayoutSubviews
 {
@@ -1362,7 +1375,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1907,7 +1920,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2110,55 +2123,55 @@
 //    }
 #endif
     
-#ifdef BACKORDER_PROCESS
-    if (self.back_order_flag) {
-
-        NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-        [params setObject:@(0) forKey:@"step"];
-        
-        
-        RAOrderEditorViewController *orderEditorVC =[[UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"RAOrderEditorViewController"];
-        
-        
-        //[[RAOrderEditorViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
-        
-        orderEditorVC.disable_dropdown_refresh=true;
-        orderEditorVC.url_type = URL_REMOTE;
-        orderEditorVC.request_url=URL_CARTDELIVERY;
-        orderEditorVC.params = params;
-        orderEditorVC.delegate=self;
-        orderEditorVC.title=@"";
-        [self.navigationController pushViewController:orderEditorVC animated:true];
-        
-    }
-    else
-#endif
-    {
-        NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-        //   NSString * string = [checked componentsJoinedByString:@","];
-        //  [params setValue:string forKey:@"cart2Checkbox"];
-        
-        
-        
-
-        
-         CreateOrderViewController * orderinfoVC = [[CreateOrderViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
-        
-        orderinfoVC.disable_dropdown_refresh=true;
-        orderinfoVC.url_type = URL_REMOTE;
-        orderinfoVC.request_url=URL_CARTDELIVERY;
-        
-        orderinfoVC.params = params;
-        orderinfoVC.title=@"";
-        orderinfoVC.delegate=self;
-        //
-        //    if(checked.count==count)
-        //    {
-        //    orderinfoVC.have_tail = true
-        //    }
-        
-        [self.navigationController pushViewController:orderinfoVC animated:true];
-    }
+//#ifdef BACKORDER_PROCESS
+//    if (self.back_order_flag) {
+//
+//        NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+//        [params setObject:@(0) forKey:@"step"];
+//
+//
+//        RAOrderEditorViewController *orderEditorVC =[[UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"RAOrderEditorViewController"];
+//
+//
+//        //[[RAOrderEditorViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
+//
+//        orderEditorVC.disable_dropdown_refresh=true;
+//        orderEditorVC.url_type = URL_REMOTE;
+//        orderEditorVC.request_url=URL_CARTDELIVERY;
+//        orderEditorVC.params = params;
+//        orderEditorVC.delegate=self;
+//        orderEditorVC.title=@"";
+//        [self.navigationController pushViewController:orderEditorVC animated:true];
+//
+//    }
+//    else
+//#endif
+//    {
+//        NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+//        //   NSString * string = [checked componentsJoinedByString:@","];
+//        //  [params setValue:string forKey:@"cart2Checkbox"];
+//        
+//        
+//        
+//
+//        
+//         CreateOrderViewController * orderinfoVC = [[CreateOrderViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
+//        
+//        orderinfoVC.disable_dropdown_refresh=true;
+//        orderinfoVC.url_type = URL_REMOTE;
+//        orderinfoVC.request_url=URL_CARTDELIVERY;
+//        
+//        orderinfoVC.params = params;
+//        orderinfoVC.title=@"";
+//        orderinfoVC.delegate=self;
+//        //
+//        //    if(checked.count==count)
+//        //    {
+//        //    orderinfoVC.have_tail = true
+//        //    }
+//        
+//        [self.navigationController pushViewController:orderinfoVC animated:true];
+//    }
     
 
 }
@@ -2259,7 +2272,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [parentvc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2478,7 +2491,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [parentvc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3350,8 +3363,8 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
-
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     // 添加一个删除按钮
@@ -3372,8 +3385,8 @@
     __weak typeof(self) weakself = self;
     
     
-    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" Delete " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
-        
+//    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" Delete " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+    UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@" Delete " handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         DebugLog(@"delete click");
         
          //[self.itemListTable setEditing:false animated:YES];
@@ -3504,7 +3517,7 @@
     
     deleteRowAction.backgroundColor = [UIColor redColor];
     
-    UITableViewRowAction *notifyMeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Notify Me" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+    UIContextualAction* notifyMeAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Notify Me" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         
         {
             
@@ -3559,10 +3572,67 @@
         
     }];
     
+//    UITableViewRowAction *notifyMeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Notify Me" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+//
+//        {
+//
+////            __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+//            PopWaitAlert* pop = [RAUtils waiting_pop:@"Sending Email" completion:nil];
+//                [RANetwork request_notifymodel:productID emailAddr:nil withScreen:ScreenCodeCart completionHandler:^(NSMutableDictionary *result) {
+//                                NSMutableDictionary *dic = result;
+//
+//
+//                //                [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+////                                [waitting_alert dismissViewControllerAnimated:YES completion:^{
+//                    [pop hide];
+//                                    int result_code = [[dic valueForKey:@"result"] intValue];
+//
+//                                    if (result_code != RESULT_TRUE && result_code != RESULT_NO_EMAIL_ADDRESS)
+//                                    {
+//
+//                                        NSString *msg = [NSString stringWithFormat:@"The email send failed"];
+//
+//                                        if ([dic valueForKey:@"err_msg"]) {
+//                                            msg = [dic valueForKey:@"err_msg"];
+//                                        }
+//
+//
+//                                        UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+//                                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//
+//                                        }];
+//
+//                                        [errorAlertVC addAction:action];
+//                                        [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+//
+//                                    } else if (result_code == RESULT_TRUE){
+//
+//                                        [RAUtils message_box:@"Message" message:@"Notification is sent to default email address." completion:nil];
+//
+//                                    } else if (result_code == RESULT_NO_EMAIL_ADDRESS) {
+//
+//                                        [weakself showAddressBoxToEmailProduct:productID];
+//
+//                                    }
+////                                }];
+//
+//
+//
+//                            }];
+//
+////            }];
+//
+//        };
+//
+//
+//    }];
+    
     notifyMeAction.backgroundColor = UIColorFromRGB(0x9BBF5A);
     
     
-    UITableViewRowAction *addWatchAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Move To Wish List" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *addWatchAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Move To Wish List" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
+    UIContextualAction* addWatchAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Move To Wish List" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
+                                            
         
         DebugLog(@"Wishlist click");
         
@@ -3644,7 +3714,11 @@
     
     
     // 添加一个编辑按钮
-    UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
+    
+    UIContextualAction* editRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Edit Price" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
+               
+                                           
         
         DebugLog(@"edit click");
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
@@ -3800,7 +3874,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [parentvc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3875,15 +3949,17 @@
     //
     //    freeRowAction.backgroundColor = [UIColor lightGrayColor];
     
-    UITableViewRowAction *noteRowAction = nil;
-    
-    
-   // NSDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
-    
-    
-    
+//    UITableViewRowAction *noteRowAction = nil;
+//
+//
+//   // NSDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
+//
+//
+//
+//
+//    noteRowAction=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Edit note" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
     
-    noteRowAction=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Edit note" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+    UIContextualAction* noteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Edit note" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         
         DebugLog(@"item note click");
         
@@ -3933,7 +4009,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [parentvc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3956,7 +4032,10 @@
     noteRowAction.backgroundColor = [UIColor lightGrayColor];
 
 
-    UITableViewRowAction *move2BackAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Move to Back Order" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+//    UITableViewRowAction *move2BackAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Move to Back Order" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+        
+        UIContextualAction* move2BackAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Move to Back Order" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
+            
         
         NSDictionary *item_json = [self itemJsonAtIndexPath:indexPath];
         NSString* cart_item_id = [item_json valueForKey:@"cart_item_id"];
@@ -4055,14 +4134,17 @@
         
         
         
-        return arr;
+//        return arr;
+        return  [UISwipeActionsConfiguration configurationWithActions:arr];
         //    return @[deleteRowAction,addWatchAction, editRowAction,freeRowAction];
     } else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
         if (appDelegate.customer_type == CustomerTypeStore) {
 #ifndef SCANNER_ORDER
-            return @[notifyMeAction,deleteRowAction,addWatchAction,editRowAction];
+//            return @[notifyMeAction,deleteRowAction,addWatchAction,editRowAction];
+            return  [UISwipeActionsConfiguration configurationWithActions:@[notifyMeAction,deleteRowAction,addWatchAction,editRowAction]];
 #else
-            return @[deleteRowAction];
+//            return @[deleteRowAction];
+            return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
 #endif
         } else {
             
@@ -4095,14 +4177,17 @@
                 [actionArray addObject:editRowAction];
             }
             
-            return actionArray;
+//            return actionArray;
+            return  [UISwipeActionsConfiguration configurationWithActions:actionArray];
         }
     }
     else
 #ifndef SCANNER_ORDER
-        return @[deleteRowAction,addWatchAction];
+//        return @[deleteRowAction,addWatchAction];
+        return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction,addWatchAction]];
 #else
-    return @[deleteRowAction];
+//    return @[deleteRowAction];
+    return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
 #endif
     
     

+ 17 - 17
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -678,7 +678,7 @@
         NSComparisonResult resuest = [obj1 compare:obj2];
         return resuest;
     }];
-    NSLog(@"afterSortKeyArray:%@",afterSortKeyArray);
+    DebugLog(@"afterSortKeyArray:%@",afterSortKeyArray);
     
     //通过排列的key值获取value
     NSMutableArray *valueArray = [NSMutableArray array];
@@ -686,7 +686,7 @@
         NSString *valueString = [dict objectForKey:sortsing];
         [valueArray addObject:valueString];
     }
-    NSLog(@"valueArray:%@",valueArray);
+    DebugLog(@"valueArray:%@",valueArray);
 }
 -(void)of_search:(NSMutableDictionary*) dict keyword:(NSString*)keyword
 {
@@ -719,7 +719,7 @@
     
 //    NSString * str5 = [AESCrypt AES128Decrypt:@"" key:@"usai2010"];
     
-//    NSLog(@"decrypt:%@",[AESCrypt fastdecrypt:@"vafHUwfRPIUbPNVnKhLc5aAVK7sOFRztlfJVRHW7QVa/qGgm11E5UwfYWZEBTQpH"]);
+//    DebugLog(@"decrypt:%@",[AESCrypt fastdecrypt:@"vafHUwfRPIUbPNVnKhLc5aAVK7sOFRztlfJVRHW7QVa/qGgm11E5UwfYWZEBTQpH"]);
  
     
 //    [self of_test];
@@ -979,7 +979,7 @@
                             
                             
                             
-                            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
                             [self presentViewController:navi animated:YES completion:^{
                                 
                                 DebugLog(@"login present.........");
@@ -1024,7 +1024,7 @@
         
         
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             DebugLog(@"login present.........");
@@ -1062,7 +1062,7 @@
             
             
             
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
             [self presentViewController:navi animated:YES completion:^{
                 
                 DebugLog(@"login present.........");
@@ -1079,7 +1079,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         DebugLog(@"login present.........");
@@ -1173,7 +1173,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [self presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1238,7 +1238,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1729,7 +1729,7 @@
     
     
     toController.view.autoresizingMask =     UIViewAutoresizingFlexibleHeight  |UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
-    NSLog(@"MAIN VIEWCONTROLLER CHILD COUNT %lu",(unsigned long)self.childViewControllers.count);
+    DebugLog(@"MAIN VIEWCONTROLLER CHILD COUNT %lu",(unsigned long)self.childViewControllers.count);
     [self addChildViewController:toController];                                     //
     [fromController willMoveToParentViewController:nil];                            //
     
@@ -2130,7 +2130,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [self presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3022,7 +3022,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3054,7 +3054,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3300,7 +3300,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3343,7 +3343,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3503,7 +3503,7 @@
                     UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
                     
                     navi.navigationBar.translucent = NO;
-                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
                     [strongself presentViewController:navi animated:YES completion:^{
                         
                     }];
@@ -3519,7 +3519,7 @@
             UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
             
             navi.navigationBar.translucent = NO;
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
             [self presentViewController:navi animated:YES completion:^{
                 
             }];

+ 3 - 2
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/MessageBox.m

@@ -7,6 +7,7 @@
 //
 
 #import "MessageBox.h"
+#import "RAUtils.h"
 
 @implementation MessageBox
 
@@ -44,13 +45,13 @@
     MessageBox *mb =[[MessageBox alloc] init:completion];
     
 //    [mb setCompletion:completion];
-    [mb setCenter : [UIApplication sharedApplication].keyWindow.center ];
+    [mb setCenter : [RAUtils keyWindow].center ];
     [mb setTitle:title];
     [mb setMessage:message];
     RAPopviewContainer *wrapper = [[RAPopviewContainer alloc] initWithView:mb];
     wrapper.modalView=true;
     wrapper.bgColor = [UIColor colorWithWhite:0 alpha:0.2];
-    [wrapper show:[UIApplication sharedApplication].keyWindow];
+    [wrapper show:[RAUtils keyWindow]];
     return mb;
 }
 

+ 5 - 3
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/PopWaitAlert.m

@@ -7,6 +7,7 @@
 //
 
 #import "PopWaitAlert.h"
+#import "RAUtils.h"
 
 @interface PopWaitAlert ()
 
@@ -48,13 +49,14 @@
     PopWaitAlert *pa =[[PopWaitAlert alloc] init:completion];
     
 //    [pa setCompletion:completion];
-    [pa setCenter : [UIApplication sharedApplication].keyWindow.center ];
+    
+    [pa setCenter : [RAUtils keyWindow].center ];
     [pa setTitle:title];
     [pa setMessage:message];
     RAPopviewContainer *wrapper = [[RAPopviewContainer alloc] initWithView:pa];
     wrapper.modalView=true;
     wrapper.bgColor = [UIColor colorWithWhite:0 alpha:0.2];
-    [wrapper show:[UIApplication sharedApplication].keyWindow];
+    [wrapper show:[RAUtils keyWindow]];
     return pa;
 }
 
@@ -249,7 +251,7 @@
         [self updateframe];
 //        [self sizeToFit];
 //        self resize
-        int a=0;
+        
     }
     return self;
 }

+ 4 - 2
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/RAPopviewContainer.m

@@ -6,6 +6,8 @@
 //
 
 #import "RAPopviewContainer.h"
+#import "const.h"
+#import "RAUtils.h"
 
 @protocol RAPopviewContainerProtocol <NSObject>
 
@@ -42,7 +44,7 @@
     
 //    CGRect r1 =[UIApplication sharedApplication].keyWindow.bounds;
 //    CGRect r2 =[UIApplication sharedApplication].keyWindow.rootViewController.view.bounds;
-    self.frame = [UIApplication sharedApplication].keyWindow.bounds;//parentView.bounds;
+    self.frame = [RAUtils keyWindow].bounds;//parentView.bounds;
     [self addTarget:self action:@selector(onBkgButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
     
     
@@ -58,7 +60,7 @@
     if (self.hideHandler)
         self.hideHandler();
     
-    NSLog(@"hide...");
+    DebugLog(@"hide...");
     [self removeFromSuperview];
 }
 

+ 5 - 4
RedAnt ERP Mobile/HMLG Scan Order/RAQRCodeScannerViewController.m

@@ -9,6 +9,7 @@
 #import "RAQRCodeScannerViewController.h"
 #import <AVKit/AVKit.h>
 #import "config.h"
+#import "const.h"
 
 @interface RAQRCodeScannerViewController () <AVCaptureMetadataOutputObjectsDelegate>
 
@@ -167,7 +168,7 @@
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
     
-//    NSLog(@"device orientation: %ld & statusbar orientaion: %ld",[UIDevice currentDevice].orientation,[UIApplication sharedApplication].statusBarOrientation);
+//    DebugLog(@"device orientation: %ld & statusbar orientaion: %ld",[UIDevice currentDevice].orientation,[UIApplication sharedApplication].statusBarOrientation);
 }
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -323,7 +324,7 @@
     self.input = [AVCaptureDeviceInput deviceInputWithDevice:self.device error:&inputError];
     
     if (inputError) {
-        NSLog(@"init scanner input error: %@",inputError);
+        DebugLog(@"init scanner input error: %@",inputError);
         return;
     }
     
@@ -332,7 +333,7 @@
     if ([self.session canAddInput:self.input]) {
         [self.session addInput:self.input];
     } else {
-        NSLog(@"init scanner can't add input");
+        DebugLog(@"init scanner can't add input");
         return;
     }
     
@@ -342,7 +343,7 @@
     if ([self.session canAddOutput:self.output]) {
         [self.session addOutput:self.output];
     } else {
-        NSLog(@"init scanner can't add output");
+        DebugLog(@"init scanner can't add output");
         return;
     }
     self.output.metadataObjectTypes = @[

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order/ScanHomeViewController.m

@@ -27,7 +27,7 @@
 }
 - (void) reload_data {
     
-    NSLog(@"ScanHomeViewController RELOAD");
+    DebugLog(@"ScanHomeViewController RELOAD");
     [self loadNewsList];
 }
 /*

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m

@@ -70,7 +70,7 @@
 //    
 //    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //    
-//    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //    [self presentViewController:navi animated:YES completion:^{
 //        
 //        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -836,7 +836,7 @@
 
             if([appDelegate.password isEqualToString:titleTextField.text])
             {
-                NSLog(@"%@", @"run process");
+                DebugLog(@"%@", @"run process");
 //                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{
                 PopWaitAlert* pop =[RAUtils waiting_pop:@"Delete Account" completion:nil];
                     [RANetwork request_delete_account:^(NSMutableDictionary *result) {

+ 0 - 18
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/WorkspaceSettings.xcsettings

@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>BuildLocationStyle</key>
-	<string>UseAppPreferences</string>
-	<key>CustomBuildLocationType</key>
-	<string>RelativeToDerivedData</string>
-	<key>DerivedDataLocationStyle</key>
-	<string>Default</string>
-	<key>EnabledFullIndexStoreVisibility</key>
-	<false/>
-	<key>IssueFilterStyle</key>
-	<string>ShowActiveSchemeOnly</string>
-	<key>LiveSourceIssuesEnabled</key>
-	<true/>
-</dict>
-</plist>

+ 0 - 1911
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1,1911 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Bucket
-   type = "0"
-   version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554805778.632166"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "126"
-            endingLineNumber = "126"
-            landmarkName = "-startAirPrintWithData1:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554805778.6332819"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "97"
-            endingLineNumber = "97"
-            landmarkName = "-startAirPrintWithData1:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554805778.634837"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "37"
-            endingLineNumber = "37"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554805778.635595"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "186"
-            endingLineNumber = "186"
-            landmarkName = "-startAirPrintWithData1:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554805778.636358"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "256"
-            endingLineNumber = "256"
-            landmarkName = "-startAirPrintWithData1:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554805821.695904"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "237"
-            endingLineNumber = "237"
-            landmarkName = "-startAirPrintWithData1:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/FunctionTestViewController.m"
-            timestampString = "554806785.342867"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "183"
-            endingLineNumber = "183"
-            landmarkName = "-startAirPrintWithData1:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.482568"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "230"
-            endingLineNumber = "230"
-            landmarkName = "-refresh_on_login"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/portfolio/PortfolioViewController.m"
-            timestampString = "570354574.18522"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "476"
-            endingLineNumber = "476"
-            landmarkName = "-createTearSheet"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/portfolio/PortfolioViewController.m"
-            timestampString = "570354574.185432"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "881"
-            endingLineNumber = "881"
-            landmarkName = "-onEditClick:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.482723"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "139"
-            endingLineNumber = "139"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.482788"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "53"
-            endingLineNumber = "53"
-            landmarkName = "-viewDidLoad"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.1855789"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1244"
-            endingLineNumber = "1244"
-            landmarkName = "-didRotateFromInterfaceOrientation:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.185712"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1231"
-            endingLineNumber = "1231"
-            landmarkName = "-SelectCategory:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.185791"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1230"
-            endingLineNumber = "1230"
-            landmarkName = "-SelectCategory:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/home/HomeViewController.m"
-            timestampString = "570354574.185883"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "257"
-            endingLineNumber = "257"
-            landmarkName = "-didRotateFromInterfaceOrientation:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.186016"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1487"
-            endingLineNumber = "1487"
-            landmarkName = "-checkToolBar"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.1860991"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1210"
-            endingLineNumber = "1210"
-            landmarkName = "-operation_reload"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.86408"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "258"
-            endingLineNumber = "258"
-            landmarkName = "-operation_loadpage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.864159"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "262"
-            endingLineNumber = "262"
-            landmarkName = "-operation_loadpage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.864217"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "294"
-            endingLineNumber = "294"
-            landmarkName = "-operation_loadpage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.86428"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "298"
-            endingLineNumber = "298"
-            landmarkName = "-operation_loadpage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.864331"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "336"
-            endingLineNumber = "336"
-            landmarkName = "-operation_loadpage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.864383"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "713"
-            endingLineNumber = "713"
-            landmarkName = "-numberOfSectionsInTableView:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.864434"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "719"
-            endingLineNumber = "719"
-            landmarkName = "-tableView:numberOfRowsInSection:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ImageUtils.m"
-            timestampString = "555232471.226006"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "44"
-            endingLineNumber = "44"
-            landmarkName = "+load_cached_img:loadFrom:size:allow_enlarge:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/home/HomeViewController.m"
-            timestampString = "570354574.186393"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "725"
-            endingLineNumber = "725"
-            landmarkName = "-tableView:cellForRowAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ImageUtils.m"
-            timestampString = "555232563.2149251"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "60"
-            endingLineNumber = "60"
-            landmarkName = "+load_cached_img:loadFrom:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.186591"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1934"
-            endingLineNumber = "1934"
-            landmarkName = "-collectionView:cellForItemAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.186752"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1963"
-            endingLineNumber = "1963"
-            landmarkName = "-collectionCell:setImageForIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/data_provider/iSalesDB.m"
-            timestampString = "555232764.8044471"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "568"
-            endingLineNumber = "568"
-            landmarkName = "+load_cached_img:loadFrom:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/data_provider/iSalesDB.m"
-            timestampString = "555233035.0430681"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "501"
-            endingLineNumber = "501"
-            landmarkName = "+cache_img:filename:saveTo:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.1869839"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1916"
-            endingLineNumber = "1916"
-            landmarkName = "-collectionView:cellForItemAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.453158"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "444"
-            endingLineNumber = "444"
-            landmarkName = "-viewDidLoad"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483219"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "416"
-            endingLineNumber = "416"
-            landmarkName = "-class_name"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.187216"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2550"
-            endingLineNumber = "2550"
-            landmarkName = "-alertView:clickedButtonAtIndex:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/ScannerSettingViewController.m"
-            timestampString = "555931358.794494"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "800"
-            endingLineNumber = "800"
-            landmarkName = "-onDecodedData:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483333"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "133"
-            endingLineNumber = "133"
-            landmarkName = "-viewDidDisappear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483384"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "132"
-            endingLineNumber = "132"
-            landmarkName = "-viewDidDisappear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483459"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "113"
-            endingLineNumber = "113"
-            landmarkName = "-viewDidAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483531"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "118"
-            endingLineNumber = "118"
-            landmarkName = "-viewDidAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483588"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "130"
-            endingLineNumber = "130"
-            landmarkName = "-viewDidDisappear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "iSales-UWAVER/AppDelegateBase.m"
-            timestampString = "556007611.882955"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2707"
-            endingLineNumber = "2707"
-            landmarkName = "AppDelegateBase"
-            landmarkType = "3">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "iSales-UWAVER/AppDelegateBase.m"
-            timestampString = "556007611.8829989"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2638"
-            endingLineNumber = "2638"
-            landmarkName = "-application:didFinishLaunchingWithOptions:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/home/HomeViewController.m"
-            timestampString = "570354574.187582"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "991"
-            endingLineNumber = "991"
-            landmarkName = "-refresh_ui"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.18768"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "190"
-            endingLineNumber = "190"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.187808"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2318"
-            endingLineNumber = "2318"
-            landmarkName = "SearchViewController"
-            landmarkType = "3">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.187876"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "49"
-            endingLineNumber = "49"
-            landmarkName = "-reload_container_getdata:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483789"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "173"
-            endingLineNumber = "173"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.483851"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "226"
-            endingLineNumber = "226"
-            landmarkName = "-refresh_on_login"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.187981"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "141"
-            endingLineNumber = "141"
-            landmarkName = "-end_select:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.188043"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2654"
-            endingLineNumber = "2654"
-            landmarkName = "-categoryString:node:level:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.188107"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1246"
-            endingLineNumber = "1246"
-            landmarkName = "CategoryViewController"
-            landmarkType = "3">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.1881779"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1232"
-            endingLineNumber = "1232"
-            landmarkName = "-SelectCategory:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.4543231"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "260"
-            endingLineNumber = "260"
-            landmarkName = "-checklogin:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.45446"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "279"
-            endingLineNumber = "279"
-            landmarkName = "-checklogin:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/LoginViewController.m"
-            timestampString = "558260217.438984"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "211"
-            endingLineNumber = "211"
-            landmarkName = "-onLoginClick:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/LoginViewController.m"
-            timestampString = "558260217.4394079"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "402"
-            endingLineNumber = "402"
-            landmarkName = "-onLoginClick:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/LoginViewController.m"
-            timestampString = "558260217.439682"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "262"
-            endingLineNumber = "262"
-            landmarkName = "-onLoginClick:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/LoginViewController.m"
-            timestampString = "558260217.439914"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "251"
-            endingLineNumber = "251"
-            landmarkName = "-onLoginClick:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/sidemenu/LoginViewController.m"
-            timestampString = "558260217.4401391"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "256"
-            endingLineNumber = "256"
-            landmarkName = "-onLoginClick:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.454766"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "261"
-            endingLineNumber = "261"
-            landmarkName = "-checklogin:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.188409"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1513"
-            endingLineNumber = "1513"
-            landmarkName = "-viewDidLoad"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.1884741"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1490"
-            endingLineNumber = "1490"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.188543"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1467"
-            endingLineNumber = "1467"
-            landmarkName = "-checkToolBar"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.484159"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "111"
-            endingLineNumber = "111"
-            landmarkName = "-viewDidAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.188627"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "207"
-            endingLineNumber = "207"
-            landmarkName = "-viewDidLoad"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.188688"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "365"
-            endingLineNumber = "365"
-            landmarkName = "-viewWillLayoutSubviews"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.188769"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1350"
-            endingLineNumber = "1350"
-            landmarkName = "-viewWillLayoutSubviews"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.188828"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1491"
-            endingLineNumber = "1491"
-            landmarkName = "-willRotateToInterfaceOrientation:duration:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/search+itemsearch/SearchViewController.m"
-            timestampString = "570354574.188875"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "196"
-            endingLineNumber = "196"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "570354574.188931"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1213"
-            endingLineNumber = "1213"
-            landmarkName = "-reload"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/iSalesNavigationController.m"
-            timestampString = "556104318.032016"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "49"
-            endingLineNumber = "49"
-            landmarkName = "-supportedInterfaceOrientations"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/iSalesNavigationController.m"
-            timestampString = "556104318.0320719"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "45"
-            endingLineNumber = "45"
-            landmarkName = "-preferredInterfaceOrientationForPresentation"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.4557689"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1484"
-            endingLineNumber = "1484"
-            landmarkName = "-showCategoryMenu:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/iSalesNavigationController.m"
-            timestampString = "556104318.032186"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "48"
-            endingLineNumber = "48"
-            landmarkName = "-supportedInterfaceOrientations"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/categoryMenu_RATree/RAViewController.m"
-            timestampString = "570354574.189109"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "56"
-            endingLineNumber = "56"
-            landmarkName = "-reload_container_getdata:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.455983"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1286"
-            endingLineNumber = "1286"
-            landmarkName = "-switchToCart"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderListViewController.m"
-            timestampString = "560235661.456152"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2221"
-            endingLineNumber = "2221"
-            landmarkName = "-reload_data"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.4563"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "531"
-            endingLineNumber = "531"
-            landmarkName = "-viewDidLoad"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/MainViewController.m"
-            timestampString = "560235661.456414"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1378"
-            endingLineNumber = "1378"
-            landmarkName = "-switchToCart"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailHeaderCell.m"
-            timestampString = "558257659.044757"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "197"
-            endingLineNumber = "197"
-            landmarkName = "-add_toPortfolio:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.484494"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "427"
-            endingLineNumber = "427"
-            landmarkName = "+Notify:Message:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/ActiveViewController.m"
-            timestampString = "559623633.4845459"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "353"
-            endingLineNumber = "353"
-            landmarkName = "-OnReloadData:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderDetailViewController.m"
-            timestampString = "570354574.189401"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3429"
-            endingLineNumber = "3429"
-            landmarkName = "-copyOrder"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderDetailViewController.m"
-            timestampString = "570354574.189917"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3463"
-            endingLineNumber = "3463"
-            landmarkName = "OrderDetailViewController"
-            landmarkType = "3">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderDetailViewController.m"
-            timestampString = "570354574.190277"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3505"
-            endingLineNumber = "3505"
-            landmarkName = "-webViewDidFinishLoad:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderDetailViewController.m"
-            timestampString = "570354574.190632"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3503"
-            endingLineNumber = "3503"
-            landmarkName = "-webViewDidFinishLoad:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.1909651"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2480"
-            endingLineNumber = "2480"
-            landmarkName = "-showEmailAddrBox"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.191103"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2476"
-            endingLineNumber = "2476"
-            landmarkName = "-showEmailAddrBox"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/camscan/ScannerViewController.m"
-            timestampString = "570354574.191179"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "351"
-            endingLineNumber = "351"
-            landmarkName = "-captureOutput:didOutputMetadataObjects:fromConnection:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/camscan/ScannerViewController.m"
-            timestampString = "570354574.191294"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "414"
-            endingLineNumber = "414"
-            landmarkName = "-captureOutput:didOutputMetadataObjects:fromConnection:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/DefaultAppearance.m"
-            timestampString = "559895681.488915"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "87"
-            endingLineNumber = "87"
-            landmarkName = "+load_appearance"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/DefaultAppearance.m"
-            timestampString = "559895681.488973"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "254"
-            endingLineNumber = "254"
-            landmarkName = "+set_appearance_item:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/DefaultAppearance.m"
-            timestampString = "559895681.489026"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "260"
-            endingLineNumber = "260"
-            landmarkName = "+appearance_function:function:value:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/DefaultAppearance.m"
-            timestampString = "559895681.489134"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "318"
-            endingLineNumber = "318"
-            landmarkName = "+appearance_function:function:value:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/cart/ModelItemCell.m"
-            timestampString = "559981356.24167"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "433"
-            endingLineNumber = "433"
-            landmarkName = "-textFieldDidEndEditing:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/CommonEditor/CommonEditorViewController.m"
-            timestampString = "573031368.6110981"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3844"
-            endingLineNumber = "3844"
-            landmarkName = "-tableView:cellForRowAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/contact/ContactListViewController.m"
-            timestampString = "567574407.865497"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "786"
-            endingLineNumber = "786"
-            landmarkName = "-tableView:didSelectRowAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/home/HomeViewController.m"
-            timestampString = "570354574.191509"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "422"
-            endingLineNumber = "422"
-            landmarkName = "-tableView:cellForRowAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/home/HomeViewController.m"
-            timestampString = "570354574.191577"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "511"
-            endingLineNumber = "511"
-            landmarkName = "-tableView:cellForRowAtIndexPath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/data_provider/RANetwork.m"
-            timestampString = "568713630.2565089"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3264"
-            endingLineNumber = "3264"
-            landmarkName = "+Category:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/data_provider/RANetwork.m"
-            timestampString = "568713630.264015"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3305"
-            endingLineNumber = "3305"
-            landmarkName = "+Category:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/data_provider/RANetwork.m"
-            timestampString = "568713630.264292"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3304"
-            endingLineNumber = "3304"
-            landmarkName = "+Category:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/data_provider/RANetwork.m"
-            timestampString = "568713630.264538"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3263"
-            endingLineNumber = "3263"
-            landmarkName = "+Category:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.191745"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "115"
-            endingLineNumber = "115"
-            landmarkName = "-reload"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.191816"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "133"
-            endingLineNumber = "133"
-            landmarkName = "-reload"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.191872"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "462"
-            endingLineNumber = "462"
-            landmarkName = "-setupNavigationBar"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.191938"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "105"
-            endingLineNumber = "105"
-            landmarkName = "-reload"
-            landmarkType = "7">
-            <Locations>
-               <Location
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "-[DetailViewController reload]"
-                  moduleName = "USAI Mobile"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/ray/Documents/CODE_ERPSuiteIOS/RedAnt%20ERP%20Mobile/common/Functions/modelDetail/DetailViewController.m"
-                  timestampString = "586144613.7612489"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "106"
-                  endingLineNumber = "106"
-                  offsetFromSymbolStart = "23">
-               </Location>
-               <Location
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "__30-[DetailViewController reload]_block_invoke"
-                  moduleName = "USAI Mobile"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/ray/Documents/CODE_ERPSuiteIOS/RedAnt%20ERP%20Mobile/common/Functions/modelDetail/DetailViewController.m"
-                  timestampString = "586144613.76423"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "106"
-                  endingLineNumber = "106"
-                  offsetFromSymbolStart = "15">
-               </Location>
-            </Locations>
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderDetailViewController.m"
-            timestampString = "570354574.1920069"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1378"
-            endingLineNumber = "1378"
-            landmarkName = "-imgbtnClicked:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/OrderDetailViewController.m"
-            timestampString = "570354574.192323"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1366"
-            endingLineNumber = "1366"
-            landmarkName = "-imgbtnClicked:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.1926219"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "290"
-            endingLineNumber = "290"
-            landmarkName = "-viewDidLoad"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.19269"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "351"
-            endingLineNumber = "351"
-            landmarkName = "-viewWillAppear:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.1927609"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "94"
-            endingLineNumber = "94"
-            landmarkName = "-ReloadData"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.192835"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "66"
-            endingLineNumber = "66"
-            landmarkName = "-reload_container_getdata:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/modelDetail/DetailViewController.m"
-            timestampString = "570354574.19289"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "78"
-            endingLineNumber = "78"
-            landmarkName = "-manually_refresh"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "common/Functions/order/CreateOrderViewController.m"
-            timestampString = "586144613.048191"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3042"
-            endingLineNumber = "3042"
-            landmarkName = "-empolyee_commit_order:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
-</Bucket>

+ 0 - 115
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Expressions.xcexplist

@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<VariablesViewState
-   version = "1.0">
-   <ContextStates>
-      <ContextState
-         contextName = "-[ImageDrawable Draw:dataSource:ParentRect:startX:startY:flipHeight:range:]:ImageDrawable.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.drawableTemplate[@&quot;source&quot;]">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[TextDrawable Query_Rect:dataSource:ParentRect:startX:startY:flipHeight:range:]:TextDrawable.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.text">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "__30-[DetailHeaderCell addtocart:]_block_invoke_3:DetailHeaderCell.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.cqty">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[CycleScrollView reset]:CycleScrollView.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.subviews">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[NSData(LowLevelCommonCryptor) dataEncryptedUsingAlgorithm:key:initializationVector:options:error:]:NSData+CommonCrypto.m">
-      </ContextState>
-      <ContextState
-         contextName = "-[AppDelegate connectionDidFinishLoading:]:AppDelegate.m">
-      </ContextState>
-      <ContextState
-         contextName = "+[RAUtils arr2string:separator:trim:]:RAUtils.m">
-      </ContextState>
-      <ContextState
-         contextName = "-[TextDrawable Draw:dataSource:ParentRect:startX:startY:flipHeight:range:]:TextDrawable.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "data[@&quot;gnotes&quot;]">
-            </PersistentString>
-            <PersistentString
-               value = "self.text">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[FunctionTestViewController printInteractionController:choosePaper:]:FunctionTestViewController.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "paper.paperSize">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[HomeViewController viewDidDisappear:]:HomeViewController.m">
-      </ContextState>
-      <ContextState
-         contextName = "__30-[DetailViewController reload]_block_invoke:DetailViewController.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.navigationItem">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[TableDrawable Draw:dataSource:ParentRect:startX:startY:flipHeight:range:]:TableDrawable.m">
-      </ContextState>
-      <ContextState
-         contextName = "-[NSData(LowLevelCommonCryptor) _runCryptor:result:]:NSData+CommonCrypto.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "[self bytes]">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[PDFDrawable DrawBound:dataSource:ParentRect:startX:startY:flipHeight:range:]:PDFDrawable.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.drawableTemplate[@&quot;draw_bound&quot;]">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "-[PDFDrawable to_parent_rect:pos:offsetX:offsetY:]:PDFDrawable.m">
-      </ContextState>
-      <ContextState
-         contextName = "__41+[OLDataProvider prepare_portfolio_data:]_block_invoke:OLDataProvider.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "s_is_percentage.length==0">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-      <ContextState
-         contextName = "+[RANetwork Category:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:]:RANetwork.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "[Singleton sharedInstance].homeClickedItemName">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-   </ContextStates>
-</VariablesViewState>

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 17
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Bucket
-   type = "0"
-   version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            scope = "0"
-            stopOnStyle = "0">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
-</Bucket>

+ 0 - 14
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Expressions.xcexplist

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<VariablesViewState
-   version = "1.0">
-   <ContextStates>
-      <ContextState
-         contextName = "__32-[AppDelegate update_count_mark]_block_invoke:AppDelegate.m">
-         <PersistentStrings>
-            <PersistentString
-               value = "self.cart_count">
-            </PersistentString>
-         </PersistentStrings>
-      </ContextState>
-   </ContextStates>
-</VariablesViewState>

+ 5 - 0
RedAnt ERP Mobile/ScanApiSDK-10.2.227-2/ScanApiHelper.mm

@@ -1634,7 +1634,10 @@
         }
     }
     else
+#ifdef DEBUG
         NSLog(@"scanApiTerminated");
+#endif
+    ;
     return result;
 }
 
@@ -1905,7 +1908,9 @@
                     result=[newCommand doCommand];
                     if(!SKTSUCCESS(result)){
                         ISktScanDevice*currentDevice=[newCommand getScanDevice];
+#ifdef DEBUG
                         NSLog(@"Remove the command/property because we failed to send it");
+#endif
                         [_commandContexts removeObject:newCommand];
                         i--;// the current command has been removed so stay at the same index
                         count--;

+ 4 - 4
RedAnt ERP Mobile/common/AES/NSData+CommonCrypto.h

@@ -49,9 +49,9 @@ extern NSString * const kCommonCryptoErrorDomain;
 
 @interface NSData (CommonDigest)
 
-- (NSData *) MD2Sum;
-- (NSData *) MD4Sum;
-- (NSData *) MD5Sum;
+//- (NSData *) MD2Sum;
+//- (NSData *) MD4Sum;
+//- (NSData *) MD5Sum;
 
 - (NSData *) SHA1Hash;
 - (NSData *) SHA224Hash;
@@ -109,4 +109,4 @@ extern NSString * const kCommonCryptoErrorDomain;
 - (NSData *) HMACWithAlgorithm: (CCHmacAlgorithm) algorithm;
 - (NSData *) HMACWithAlgorithm: (CCHmacAlgorithm) algorithm key: (id) key;
 
-@end
+@end

+ 21 - 21
RedAnt ERP Mobile/common/AES/NSData+CommonCrypto.m

@@ -111,26 +111,26 @@ NSString * const kCommonCryptoErrorDomain = @"CommonCryptoErrorDomain";
 
 @implementation NSData (CommonDigest)
 
-- (NSData *) MD2Sum
-{
-	unsigned char hash[CC_MD2_DIGEST_LENGTH];
-	(void) CC_MD2( [self bytes], (CC_LONG)[self length], hash );
-	return ( [NSData dataWithBytes: hash length: CC_MD2_DIGEST_LENGTH] );
-}
-
-- (NSData *) MD4Sum
-{
-	unsigned char hash[CC_MD4_DIGEST_LENGTH];
-	(void) CC_MD4( [self bytes], (CC_LONG)[self length], hash );
-	return ( [NSData dataWithBytes: hash length: CC_MD4_DIGEST_LENGTH] );
-}
-
-- (NSData *) MD5Sum
-{
-	unsigned char hash[CC_MD5_DIGEST_LENGTH];
-	(void) CC_MD5( [self bytes], (CC_LONG)[self length], hash );
-	return ( [NSData dataWithBytes: hash length: CC_MD5_DIGEST_LENGTH] );
-}
+//- (NSData *) MD2Sum
+//{
+//	unsigned char hash[CC_MD2_DIGEST_LENGTH];
+//	(void) CC_MD2( [self bytes], (CC_LONG)[self length], hash );
+//	return ( [NSData dataWithBytes: hash length: CC_MD2_DIGEST_LENGTH] );
+//}
+//
+//- (NSData *) MD4Sum
+//{
+//	unsigned char hash[CC_MD4_DIGEST_LENGTH];
+//	(void) CC_MD4( [self bytes], (CC_LONG)[self length], hash );
+//	return ( [NSData dataWithBytes: hash length: CC_MD4_DIGEST_LENGTH] );
+//}
+//
+//- (NSData *) MD5Sum
+//{
+//	unsigned char hash[CC_MD5_DIGEST_LENGTH];
+//	(void) CC_MD5( [self bytes], (CC_LONG)[self length], hash );
+//	return ( [NSData dataWithBytes: hash length: CC_MD5_DIGEST_LENGTH] );
+//}
 
 - (NSData *) SHA1Hash
 {
@@ -543,4 +543,4 @@ static void FixKeyLengths( CCAlgorithm algorithm, NSMutableData * keyData, NSMut
 	return ( [NSData dataWithBytes: buf length: (algorithm == kCCHmacAlgMD5 ? CC_MD5_DIGEST_LENGTH : CC_SHA1_DIGEST_LENGTH)] );
 }
 
-@end
+@end

+ 31 - 18
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -1183,9 +1183,9 @@ void UncaughtExceptionHandler(NSException *exception) {
     _order_code = order_code;
     
     if(order_code==nil)
-        NSLog(@"Clear order code");
+        DebugLog(@"Clear order code");
     else
-        NSLog(@"New order code %@",order_code);
+        DebugLog(@"New order code %@",order_code);
 }
 
 - (void)checkLogin:(BOOL)reloadCurVC {
@@ -3846,7 +3846,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 -(void)updateLog:(NSString*) log
 {
-//    NSLog(log);
+//    DebugLog(log);
 //
 //    self.strBTLog=[self.strBTLog stringByAppendingString:[log stringByAppendingString:@"\n"]];
 
@@ -3859,7 +3859,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 //查到外设后,停止扫描,连接设备
 -(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
 {
-//    NSLog(@"didDiscoverPeripheral");
+//    DebugLog(@"didDiscoverPeripheral");
     
     NSArray* pservice = advertisementData[@"kCBAdvDataServiceUUIDs"];
     if(pservice.count<=0)
@@ -3893,7 +3893,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         self.peripheral = peripheral;
         NSString* log = [NSString stringWithFormat:@"Reconnect to device %@ ...", peripheral.name];
         [self updateLog:log];
-        NSLog(@"Retrying");
+        DebugLog(@"Retrying");
         [self.manager connectPeripheral:peripheral options:nil];
     }
         
@@ -3908,7 +3908,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 
 //连接外设成功,开始发现服务
 - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {
-    NSLog(@"%@", [NSString stringWithFormat:@"成功连接 peripheral: %@ with UUID: %@",peripheral,peripheral.identifier]);
+    DebugLog(@"%@", [NSString stringWithFormat:@"成功连接 peripheral: %@ with UUID: %@",peripheral,peripheral.identifier]);
     [self updateLog:[NSString stringWithFormat:@"Connect peripheral: %@ with UUID: %@",peripheral,peripheral.identifier]];
     [self.peripheral setDelegate:self];
     [self.peripheral discoverServices:nil];
@@ -3921,18 +3921,31 @@ void UncaughtExceptionHandler(NSException *exception) {
 //连接外设失败
 -(void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
 {
-    NSLog(@"%@",error);
+    DebugLog(@"%@",error);
     [self updateLog:@"Failed to connect device."];
 }
--(void)peripheralDidUpdateRSSI:(CBPeripheral *)peripheral error:(NSError *)error
+- (void)peripheral:(CBPeripheral *)peripheral
+       didReadRSSI:(NSNumber *)RSSI
+             error:(NSError *)error
 {
-    NSLog(@"%s,%@",__PRETTY_FUNCTION__,peripheral);
-    int rssi = abs([peripheral.RSSI intValue]);
+    DebugLog(@"%s,%@",__PRETTY_FUNCTION__,peripheral);
+    int rssi = abs([RSSI intValue]);
     CGFloat ci = (rssi - 49) / (10 * 4.);
     NSString *length = [NSString stringWithFormat:@"Found hotpoint:%@,distence:%.1fm",_peripheral,pow(10,ci)];
     [self updateLog:[NSString stringWithFormat:@"Distence:%@", length]];
 }
 
+//
+//
+//-(void)peripheralDidUpdateRSSI:(CBPeripheral *)peripheral error:(NSError *)error
+//{
+//    DebugLog(@"%s,%@",__PRETTY_FUNCTION__,peripheral);
+//    int rssi = abs([peripheral.RSSI intValue]);
+//    CGFloat ci = (rssi - 49) / (10 * 4.);
+//    NSString *length = [NSString stringWithFormat:@"Found hotpoint:%@,distence:%.1fm",_peripheral,pow(10,ci)];
+//    [self updateLog:[NSString stringWithFormat:@"Distence:%@", length]];
+//}
+
 
 //已发现服务
 -(void) peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error{
@@ -3993,7 +4006,7 @@ void UncaughtExceptionHandler(NSException *exception) {
     
     if ([self.peripheral.identifier.UUIDString isEqualToString:peripheral.identifier.UUIDString]) {
         [self updateLog:@"Retrying..."];
-        NSLog(@"Retrying");
+        DebugLog(@"Retrying");
         [self.manager connectPeripheral:peripheral options:nil];
     }
 }
@@ -4002,7 +4015,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 
 - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
 {
-    NSLog(@"didUpdateValueForCharacteristic from Characteristic %@",characteristic.UUID);
+    DebugLog(@"didUpdateValueForCharacteristic from Characteristic %@",characteristic.UUID);
     NSData * data = characteristic.value;
     
     
@@ -4044,11 +4057,11 @@ void UncaughtExceptionHandler(NSException *exception) {
     datastring = [datastring stringByReplacingOccurrencesOfString:@"\r" withString:@""];
     if(datastring.length==0)
     {
-        NSLog(@"Scan Data is empty");
+        DebugLog(@"Scan Data is empty");
         return;
     }
     else
-        NSLog(@"Scan value %@",datastring);
+        DebugLog(@"Scan value %@",datastring);
     
     
     if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(onDecodedData:)])){
@@ -4091,14 +4104,14 @@ void UncaughtExceptionHandler(NSException *exception) {
 //中心读取外设实时数据
 - (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
     if (error) {
-        NSLog(@"Error changing notification state: %@", error.localizedDescription);
+        DebugLog(@"Error changing notification state: %@", error.localizedDescription);
     }
     // Notification has started
     if (characteristic.isNotifying) {
         [peripheral readValueForCharacteristic:characteristic];
     } else { // Notification has stopped
         // so disconnect from the peripheral
-        NSLog(@"Notification stopped on %@.  Disconnecting", characteristic);
+        DebugLog(@"Notification stopped on %@.  Disconnecting", characteristic);
         [self updateLog:[NSString stringWithFormat:@"Notification stopped on %@.  Disconnecting", characteristic]];
         [self.manager cancelPeripheralConnection:self.peripheral];
     }
@@ -4107,12 +4120,12 @@ void UncaughtExceptionHandler(NSException *exception) {
 -(void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
 {
     if (error) {
-        NSLog(@"=======%@",error.userInfo);
+        DebugLog(@"=======%@",error.userInfo);
         
         
         [self updateLog:[RAConvertor dict2string:error.userInfo]];
     }else{
-        NSLog(@"发送数据成功");
+        DebugLog(@"发送数据成功");
         [self updateLog:@"Send data."];
     }
     /* When a write occurs, need to set off a re-read of the local CBCharacteristic to update its value */

+ 1 - 1
RedAnt ERP Mobile/common/AutoScrollImage/CycleScrollView.m

@@ -27,7 +27,7 @@
 -(void) dealloc
 {
         [self.animationTimer invalidate];
-    NSLog(@"CycleScrollView dealloc");
+    DebugLog(@"CycleScrollView dealloc");
     
     
 }

+ 2 - 17
RedAnt ERP Mobile/common/ERP_Mobile_Cart.storyboard

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="ipad7_9" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -1189,21 +1189,6 @@ Stock</string>
             </objects>
             <point key="canvasLocation" x="3124" y="654"/>
         </scene>
-        <!--View Controller-->
-        <scene sceneID="Gb4-dm-AcB">
-            <objects>
-                <viewController id="H3V-ep-3dc" sceneMemberID="viewController">
-                    <view key="view" contentMode="scaleToFill" id="MLp-rr-7PZ">
-                        <rect key="frame" x="0.0" y="0.0" width="744" height="1133"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <viewLayoutGuide key="safeArea" id="Rxk-rC-Cfr"/>
-                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
-                    </view>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="LqY-Ba-cib" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="2820" y="1145"/>
-        </scene>
         <!--ItemNotesViewController-->
         <scene sceneID="KVI-6t-Fv8">
             <objects>

+ 89 - 96
RedAnt ERP Mobile/common/ERP_Mobile_Portfolio.storyboard

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -12,20 +12,16 @@
         <scene sceneID="As7-Qc-4n5">
             <objects>
                 <viewController storyboardIdentifier="PortfolioViewController" title="PortfolioViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="yR0-uM-vSf" customClass="PortfolioViewController" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="7R0-3m-S3Z"/>
-                        <viewControllerLayoutGuide type="bottom" id="mMI-H6-eH8"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="aoy-3H-jC3">
                         <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="120" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="usD-6y-qq3">
-                                <rect key="frame" x="0.0" y="0.0" width="768" height="974"/>
+                                <rect key="frame" x="0.0" y="20" width="768" height="954"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <prototypes>
                                     <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="WatchListItemCell" rowHeight="120" translatesAutoresizingMaskIntoConstraints="NO" id="6GU-0i-6NT" customClass="ModelItemCell">
-                                        <rect key="frame" x="0.0" y="28" width="768" height="120"/>
+                                        <rect key="frame" x="0.0" y="50" width="768" height="120"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6GU-0i-6NT" id="1hj-1W-Fag">
                                             <rect key="frame" x="0.0" y="0.0" width="768" height="120"/>
@@ -38,6 +34,7 @@
                                                         <constraint firstAttribute="width" constant="175" id="cB4-0g-vPZ"/>
                                                     </constraints>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1r5-8h-r4Y" userLabel="img">
@@ -67,6 +64,7 @@
                                                         <constraint firstAttribute="width" constant="175" id="YJr-PB-djd"/>
                                                     </constraints>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Available QTY:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="esh-zx-ipX">
@@ -92,6 +90,7 @@
                                                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="name aaaaaaaaaaaaa aaaaaaaaaa BBBBB  CCCCC" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="quP-Jk-B7a" userLabel="description">
                                                     <rect key="frame" x="123" y="10" width="397" height="100"/>
                                                     <fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="22"/>
+                                                    <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                             </subviews>
@@ -131,7 +130,7 @@
                                 </connections>
                             </tableView>
                             <label hidden="YES" opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cannot get data from server.
Tap to try again." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cL9-GG-7lo">
-                                <rect key="frame" x="262" y="489.5" width="244" height="45.5"/>
+                                <rect key="frame" x="263.5" y="489.5" width="241.5" height="45.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="19"/>
                                 <color key="textColor" red="0.33333333329999998" green="0.33333333329999998" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
@@ -171,21 +170,21 @@
                                 <color key="tintColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             </toolbar>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="YKc-nG-XYX"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
-                            <constraint firstItem="cL9-GG-7lo" firstAttribute="centerX" secondItem="aoy-3H-jC3" secondAttribute="centerX" id="00t-rC-6e1"/>
-                            <constraint firstItem="ANG-AP-5Eg" firstAttribute="centerX" secondItem="aoy-3H-jC3" secondAttribute="centerX" id="4x2-dE-LVR"/>
-                            <constraint firstItem="mMI-H6-eH8" firstAttribute="top" secondItem="bey-MA-fr3" secondAttribute="bottom" id="8PJ-3L-XrR"/>
-                            <constraint firstItem="usD-6y-qq3" firstAttribute="trailing" secondItem="9kc-hL-x5P" secondAttribute="trailing" id="BYX-Va-OnA"/>
-                            <constraint firstItem="usD-6y-qq3" firstAttribute="leading" secondItem="9kc-hL-x5P" secondAttribute="leading" id="OAs-fD-S8l"/>
-                            <constraint firstItem="bey-MA-fr3" firstAttribute="trailing" secondItem="9kc-hL-x5P" secondAttribute="trailing" id="SzU-g5-PS1"/>
-                            <constraint firstItem="usD-6y-qq3" firstAttribute="top" secondItem="7R0-3m-S3Z" secondAttribute="bottom" id="UWx-Nr-Aux"/>
-                            <constraint firstItem="bey-MA-fr3" firstAttribute="leading" secondItem="9kc-hL-x5P" secondAttribute="leading" id="WWu-Ew-8E8"/>
+                            <constraint firstItem="cL9-GG-7lo" firstAttribute="centerX" secondItem="YKc-nG-XYX" secondAttribute="centerX" id="00t-rC-6e1"/>
+                            <constraint firstItem="ANG-AP-5Eg" firstAttribute="centerX" secondItem="YKc-nG-XYX" secondAttribute="centerX" id="4x2-dE-LVR"/>
+                            <constraint firstItem="YKc-nG-XYX" firstAttribute="bottom" secondItem="bey-MA-fr3" secondAttribute="bottom" id="8PJ-3L-XrR"/>
+                            <constraint firstItem="usD-6y-qq3" firstAttribute="trailing" secondItem="YKc-nG-XYX" secondAttribute="trailing" id="BYX-Va-OnA"/>
+                            <constraint firstItem="usD-6y-qq3" firstAttribute="leading" secondItem="YKc-nG-XYX" secondAttribute="leading" id="OAs-fD-S8l"/>
+                            <constraint firstItem="bey-MA-fr3" firstAttribute="trailing" secondItem="YKc-nG-XYX" secondAttribute="trailing" id="SzU-g5-PS1"/>
+                            <constraint firstItem="usD-6y-qq3" firstAttribute="top" secondItem="YKc-nG-XYX" secondAttribute="top" id="UWx-Nr-Aux"/>
+                            <constraint firstItem="bey-MA-fr3" firstAttribute="leading" secondItem="YKc-nG-XYX" secondAttribute="leading" id="WWu-Ew-8E8"/>
                             <constraint firstItem="cL9-GG-7lo" firstAttribute="centerY" secondItem="aoy-3H-jC3" secondAttribute="centerY" id="pXI-Mr-1zD"/>
                             <constraint firstItem="ANG-AP-5Eg" firstAttribute="centerY" secondItem="aoy-3H-jC3" secondAttribute="centerY" id="pjc-Fa-VfM"/>
                             <constraint firstItem="bey-MA-fr3" firstAttribute="top" secondItem="usD-6y-qq3" secondAttribute="bottom" id="t7k-Kk-Yeh"/>
                         </constraints>
-                        <viewLayoutGuide key="safeArea" id="9kc-hL-x5P"/>
                     </view>
                     <connections>
                         <outlet property="btnCreatePort" destination="4qg-qC-65n" id="Wa3-g1-uXU"/>
@@ -199,21 +198,17 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="GvG-E4-m4S" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="440.625" y="-1649.4140625"/>
+            <point key="canvasLocation" x="564" y="-2815"/>
         </scene>
         <!--PortfolioEditQTYViewController-->
         <scene sceneID="8u3-Pe-3Wg">
             <objects>
                 <viewController storyboardIdentifier="PortfolioEditQTYViewController" title="Edit Available QTY" useStoryboardIdentifierAsRestorationIdentifier="YES" id="wPy-0C-asX" userLabel="PortfolioEditQTYViewController" customClass="PortfolioEditQTYViewController" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="79e-I1-SiI"/>
-                        <viewControllerLayoutGuide type="bottom" id="Tug-PS-qtK"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="0EI-89-hOQ">
                         <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <subviews>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Z5-Sd-PeA" customClass="DefaultImageButton">
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Z5-Sd-PeA" customClass="DefaultImageButton">
                                 <rect key="frame" x="354" y="430" width="102" height="30"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="102" id="IQi-DG-LGO"/>
@@ -234,7 +229,7 @@
                                 </connections>
                             </button>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Available QTY:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GQa-zm-VRC">
-                                <rect key="frame" x="60" y="94.5" width="109" height="21"/>
+                                <rect key="frame" x="60" y="114.5" width="109" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="2Qw-Xt-elm"/>
                                 </constraints>
@@ -243,7 +238,7 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Line Note:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g20-nR-GJM">
-                                <rect key="frame" x="60" y="370.5" width="78" height="21"/>
+                                <rect key="frame" x="60" y="390.5" width="78" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="Ldl-Q9-p63"/>
                                 </constraints>
@@ -252,11 +247,12 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" clipsSubviews="YES" tag="199" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="QTY" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="qQ5-G3-Vai">
-                                <rect key="frame" x="276" y="88" width="180" height="34"/>
+                                <rect key="frame" x="276" y="107.5" width="180" height="34"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="180" id="U3R-C6-QEI"/>
                                 </constraints>
+                                <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation"/>
                                 <connections>
@@ -264,7 +260,7 @@
                                 </connections>
                             </textField>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Current Available QTY:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="i9L-B6-ncy">
-                                <rect key="frame" x="60" y="186.5" width="321" height="21"/>
+                                <rect key="frame" x="60" y="206.5" width="321" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="1r7-7x-F4v"/>
                                 </constraints>
@@ -272,8 +268,8 @@
                                 <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ex0-jE-cOn">
-                                <rect key="frame" x="396" y="182" width="60" height="30"/>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ex0-jE-cOn">
+                                <rect key="frame" x="396" y="202" width="60" height="30"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="60" id="Gjd-WW-SCm"/>
                                 </constraints>
@@ -283,7 +279,7 @@
                                 </connections>
                             </button>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Price($):" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="weO-dk-M11">
-                                <rect key="frame" x="60" y="232.5" width="66.5" height="21"/>
+                                <rect key="frame" x="60" y="252.5" width="66" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="sP8-Bg-r5x"/>
                                 </constraints>
@@ -292,7 +288,7 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Discount(%)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YO5-Wc-hv3">
-                                <rect key="frame" x="60" y="278.5" width="94" height="21"/>
+                                <rect key="frame" x="60" y="298.5" width="95" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="Ncv-Du-7WD"/>
                                 </constraints>
@@ -301,11 +297,12 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Price" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="gPJ-Fo-wnW">
-                                <rect key="frame" x="276" y="226" width="180" height="34"/>
+                                <rect key="frame" x="276" y="245.5" width="180" height="34"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="180" id="qd7-Sf-xHQ"/>
                                 </constraints>
+                                <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation"/>
                                 <connections>
@@ -313,7 +310,7 @@
                                 </connections>
                             </textField>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Price after discount:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tf8-iU-Ipy">
-                                <rect key="frame" x="60" y="324.5" width="155" height="21"/>
+                                <rect key="frame" x="60" y="344.5" width="155" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="155" id="fS0-t0-csv"/>
                                     <constraint firstAttribute="height" constant="21" id="yOd-3I-NZ3"/>
@@ -323,11 +320,12 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" clipsSubviews="YES" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Discount" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="WMB-4W-q6p">
-                                <rect key="frame" x="276" y="272" width="180" height="34"/>
+                                <rect key="frame" x="276" y="291.5" width="180" height="34"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="180" id="Mho-aE-PyK"/>
                                 </constraints>
+                                <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits" keyboardType="decimalPad"/>
                                 <connections>
@@ -335,22 +333,23 @@
                                 </connections>
                             </textField>
                             <textField opaque="NO" clipsSubviews="YES" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Limit input to 20 charaters" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="26h-JF-dLL">
-                                <rect key="frame" x="216" y="364" width="240" height="34"/>
+                                <rect key="frame" x="216" y="383.5" width="240" height="34"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="240" id="6Sc-gE-osw"/>
                                 </constraints>
+                                <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits" keyboardType="decimalPad"/>
                             </textField>
                             <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k64-66-LJI">
-                                <rect key="frame" x="60" y="20" width="360" height="21"/>
+                                <rect key="frame" x="60" y="40" width="360" height="21"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ees-Xd-7k4" userLabel="new price">
-                                <rect key="frame" x="223" y="324" width="233" height="21"/>
+                                <rect key="frame" x="223" y="344" width="233" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="6MG-ns-4MC"/>
                                 </constraints>
@@ -359,7 +358,7 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="As Percentage:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eTr-vX-bwU">
-                                <rect key="frame" x="60" y="140.5" width="116" height="21"/>
+                                <rect key="frame" x="60" y="160.5" width="116" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="21" id="3je-Ga-IYK"/>
                                 </constraints>
@@ -368,13 +367,13 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="9jy-tP-Lud">
-                                <rect key="frame" x="407" y="135.5" width="51" height="31"/>
+                                <rect key="frame" x="407" y="155.5" width="51" height="31"/>
                                 <connections>
                                     <action selector="QTYPercentageValueChanged:" destination="wPy-0C-asX" eventType="valueChanged" id="g1v-gf-tvG"/>
                                 </connections>
                             </switch>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O0z-WA-hqd">
-                                <rect key="frame" x="21" y="93" width="24" height="24"/>
+                                <rect key="frame" x="21" y="113" width="24" height="24"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="24" id="28b-PD-5aZ"/>
                                     <constraint firstAttribute="height" constant="24" id="ybt-fm-EUS"/>
@@ -386,7 +385,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cGx-gI-KS4">
-                                <rect key="frame" x="21" y="231" width="24" height="24"/>
+                                <rect key="frame" x="21" y="251" width="24" height="24"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="24" id="BWX-qE-RIx"/>
                                     <constraint firstAttribute="height" constant="24" id="YEN-QN-3Yn"/>
@@ -398,7 +397,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xyw-kE-20W">
-                                <rect key="frame" x="21" y="369" width="24" height="24"/>
+                                <rect key="frame" x="21" y="389" width="24" height="24"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="24" id="8co-AU-KKA"/>
                                     <constraint firstAttribute="width" constant="24" id="maG-Fv-iu6"/>
@@ -410,7 +409,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="joH-dq-9dr">
-                                <rect key="frame" x="21" y="277" width="24" height="24"/>
+                                <rect key="frame" x="21" y="297" width="24" height="24"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="24" id="R52-Df-1cu"/>
                                     <constraint firstAttribute="height" constant="24" id="dEy-SH-crE"/>
@@ -422,12 +421,13 @@
                                 </connections>
                             </button>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="* Only Checked fields will be update" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qmo-qr-77s">
-                                <rect key="frame" x="60" y="49" width="360" height="20.5"/>
+                                <rect key="frame" x="60" y="69" width="360" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <color key="textColor" red="0.60000002379999995" green="0.40000000600000002" blue="0.20000000300000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="NQv-Jg-8sw"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
                             <constraint firstItem="YO5-Wc-hv3" firstAttribute="centerY" secondItem="joH-dq-9dr" secondAttribute="centerY" id="0BB-KW-9lv"/>
@@ -436,21 +436,21 @@
                             <constraint firstItem="Tf8-iU-Ipy" firstAttribute="leading" secondItem="GQa-zm-VRC" secondAttribute="leading" id="6Hw-cB-Pn4"/>
                             <constraint firstItem="ex0-jE-cOn" firstAttribute="firstBaseline" secondItem="i9L-B6-ncy" secondAttribute="firstBaseline" id="7d8-RZ-I64"/>
                             <constraint firstItem="g20-nR-GJM" firstAttribute="top" secondItem="Tf8-iU-Ipy" secondAttribute="bottom" constant="25" id="80T-ar-GwT"/>
-                            <constraint firstItem="Tug-PS-qtK" firstAttribute="top" secondItem="5Z5-Sd-PeA" secondAttribute="bottom" constant="20" id="83d-hK-TNM"/>
+                            <constraint firstItem="NQv-Jg-8sw" firstAttribute="bottom" secondItem="5Z5-Sd-PeA" secondAttribute="bottom" constant="20" id="83d-hK-TNM"/>
                             <constraint firstItem="26h-JF-dLL" firstAttribute="firstBaseline" secondItem="g20-nR-GJM" secondAttribute="firstBaseline" id="8k7-3t-xgl"/>
                             <constraint firstItem="qQ5-G3-Vai" firstAttribute="trailing" secondItem="26h-JF-dLL" secondAttribute="trailing" id="9eQ-cW-jem"/>
-                            <constraint firstItem="KHX-2Y-8a3" firstAttribute="trailing" secondItem="k64-66-LJI" secondAttribute="trailing" constant="60" id="AjM-Oi-4BF"/>
-                            <constraint firstItem="KHX-2Y-8a3" firstAttribute="trailing" secondItem="qQ5-G3-Vai" secondAttribute="trailing" constant="24" id="Bwp-CG-nef"/>
-                            <constraint firstItem="GQa-zm-VRC" firstAttribute="leading" secondItem="0EI-89-hOQ" secondAttribute="leading" constant="60" id="DAt-Ey-UwC"/>
+                            <constraint firstItem="NQv-Jg-8sw" firstAttribute="trailing" secondItem="k64-66-LJI" secondAttribute="trailing" constant="60" id="AjM-Oi-4BF"/>
+                            <constraint firstItem="NQv-Jg-8sw" firstAttribute="trailing" secondItem="qQ5-G3-Vai" secondAttribute="trailing" constant="24" id="Bwp-CG-nef"/>
+                            <constraint firstItem="GQa-zm-VRC" firstAttribute="leading" secondItem="NQv-Jg-8sw" secondAttribute="leading" constant="60" id="DAt-Ey-UwC"/>
                             <constraint firstItem="gPJ-Fo-wnW" firstAttribute="firstBaseline" secondItem="weO-dk-M11" secondAttribute="firstBaseline" id="DwG-As-jt2"/>
                             <constraint firstItem="GQa-zm-VRC" firstAttribute="leading" secondItem="O0z-WA-hqd" secondAttribute="trailing" constant="15" id="Gbt-Va-6fT"/>
                             <constraint firstItem="qQ5-G3-Vai" firstAttribute="trailing" secondItem="gPJ-Fo-wnW" secondAttribute="trailing" id="Gnk-0y-XgK"/>
                             <constraint firstItem="qQ5-G3-Vai" firstAttribute="trailing" secondItem="Ees-Xd-7k4" secondAttribute="trailing" id="L0y-O9-0Ii"/>
-                            <constraint firstItem="KHX-2Y-8a3" firstAttribute="trailing" secondItem="5Z5-Sd-PeA" secondAttribute="trailing" constant="24" id="Lfg-iL-gPq"/>
-                            <constraint firstItem="KHX-2Y-8a3" firstAttribute="trailing" secondItem="Qmo-qr-77s" secondAttribute="trailing" constant="60" id="M6k-KG-vIT"/>
+                            <constraint firstItem="NQv-Jg-8sw" firstAttribute="trailing" secondItem="5Z5-Sd-PeA" secondAttribute="trailing" constant="24" id="Lfg-iL-gPq"/>
+                            <constraint firstItem="NQv-Jg-8sw" firstAttribute="trailing" secondItem="Qmo-qr-77s" secondAttribute="trailing" constant="60" id="M6k-KG-vIT"/>
                             <constraint firstItem="YO5-Wc-hv3" firstAttribute="leading" secondItem="GQa-zm-VRC" secondAttribute="leading" id="Maa-ae-Z2f"/>
                             <constraint firstItem="ex0-jE-cOn" firstAttribute="leading" secondItem="i9L-B6-ncy" secondAttribute="trailing" constant="15" id="Mey-gC-7hE"/>
-                            <constraint firstItem="KHX-2Y-8a3" firstAttribute="trailing" secondItem="Qmo-qr-77s" secondAttribute="trailing" constant="60" id="OXd-Yq-2Ih"/>
+                            <constraint firstItem="NQv-Jg-8sw" firstAttribute="trailing" secondItem="Qmo-qr-77s" secondAttribute="trailing" constant="60" id="OXd-Yq-2Ih"/>
                             <constraint firstItem="WMB-4W-q6p" firstAttribute="firstBaseline" secondItem="YO5-Wc-hv3" secondAttribute="firstBaseline" id="Obs-BB-7gl"/>
                             <constraint firstItem="Ees-Xd-7k4" firstAttribute="leading" secondItem="Tf8-iU-Ipy" secondAttribute="trailing" constant="8" id="Po6-KN-8u7"/>
                             <constraint firstItem="eTr-vX-bwU" firstAttribute="top" secondItem="GQa-zm-VRC" secondAttribute="bottom" constant="25" id="QXc-rA-Lof"/>
@@ -462,14 +462,14 @@
                             <constraint firstItem="Qmo-qr-77s" firstAttribute="top" secondItem="k64-66-LJI" secondAttribute="bottom" constant="8" id="U88-Vj-Wk2"/>
                             <constraint firstItem="qQ5-G3-Vai" firstAttribute="trailing" secondItem="ex0-jE-cOn" secondAttribute="trailing" id="VGJ-RS-kCu"/>
                             <constraint firstItem="YO5-Wc-hv3" firstAttribute="top" secondItem="weO-dk-M11" secondAttribute="bottom" constant="25" id="WPW-Wq-pV8"/>
-                            <constraint firstItem="Qmo-qr-77s" firstAttribute="leading" secondItem="KHX-2Y-8a3" secondAttribute="leading" constant="60" id="bWa-0Q-p8F"/>
+                            <constraint firstItem="Qmo-qr-77s" firstAttribute="leading" secondItem="NQv-Jg-8sw" secondAttribute="leading" constant="60" id="bWa-0Q-p8F"/>
                             <constraint firstItem="qQ5-G3-Vai" firstAttribute="firstBaseline" secondItem="GQa-zm-VRC" secondAttribute="firstBaseline" id="bdH-in-OHP"/>
                             <constraint firstItem="eTr-vX-bwU" firstAttribute="leading" secondItem="GQa-zm-VRC" secondAttribute="leading" id="czv-3H-Jaw"/>
                             <constraint firstItem="weO-dk-M11" firstAttribute="leading" secondItem="cGx-gI-KS4" secondAttribute="trailing" constant="15" id="ekh-H9-l9H"/>
-                            <constraint firstItem="k64-66-LJI" firstAttribute="top" secondItem="79e-I1-SiI" secondAttribute="bottom" constant="20" id="ems-JO-ir8"/>
+                            <constraint firstItem="k64-66-LJI" firstAttribute="top" secondItem="NQv-Jg-8sw" secondAttribute="top" constant="20" id="ems-JO-ir8"/>
                             <constraint firstItem="weO-dk-M11" firstAttribute="centerY" secondItem="cGx-gI-KS4" secondAttribute="centerY" id="faA-Cd-cQa"/>
                             <constraint firstItem="g20-nR-GJM" firstAttribute="centerY" secondItem="Xyw-kE-20W" secondAttribute="centerY" id="gFM-MB-aiW"/>
-                            <constraint firstItem="k64-66-LJI" firstAttribute="leading" secondItem="KHX-2Y-8a3" secondAttribute="leading" constant="60" id="hBt-lg-MAO"/>
+                            <constraint firstItem="k64-66-LJI" firstAttribute="leading" secondItem="NQv-Jg-8sw" secondAttribute="leading" constant="60" id="hBt-lg-MAO"/>
                             <constraint firstItem="Ees-Xd-7k4" firstAttribute="firstBaseline" secondItem="Tf8-iU-Ipy" secondAttribute="firstBaseline" id="iCL-m0-w2k"/>
                             <constraint firstItem="GQa-zm-VRC" firstAttribute="top" secondItem="Qmo-qr-77s" secondAttribute="bottom" constant="25" id="js1-fc-ihm"/>
                             <constraint firstItem="weO-dk-M11" firstAttribute="leading" secondItem="GQa-zm-VRC" secondAttribute="leading" id="pba-Ud-wzt"/>
@@ -478,7 +478,6 @@
                             <constraint firstItem="9jy-tP-Lud" firstAttribute="centerY" secondItem="eTr-vX-bwU" secondAttribute="centerY" id="sXB-Zb-0oX"/>
                             <constraint firstItem="qQ5-G3-Vai" firstAttribute="trailing" secondItem="9jy-tP-Lud" secondAttribute="trailing" id="wqe-dz-s7f"/>
                         </constraints>
-                        <viewLayoutGuide key="safeArea" id="KHX-2Y-8a3"/>
                     </view>
                     <navigationItem key="navigationItem" title="Edit Portfolio" id="vk5-ma-BjE" userLabel="Edit Model Price">
                         <barButtonItem key="rightBarButtonItem" title="Close" id="agA-vb-Tdj">
@@ -512,22 +511,18 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="bGe-ri-RAl" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1219.53125" y="-1649.4140625"/>
+            <point key="canvasLocation" x="1561" y="-2815"/>
         </scene>
         <!--PortfolioListViewController-->
         <scene sceneID="1tV-iB-sci">
             <objects>
                 <viewController storyboardIdentifier="PortfolioListViewController" title="PortfolioListViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="UR2-2B-1AA" customClass="PortfolioListViewController" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="fig-h1-4jZ"/>
-                        <viewControllerLayoutGuide type="bottom" id="mVH-o4-2r3"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="WFW-Hb-Uqm">
                         <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OvS-DC-8eY">
-                                <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
+                                <rect key="frame" x="0.0" y="20" width="768" height="44"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="44" id="bpp-dQ-YH7"/>
@@ -553,32 +548,32 @@
                                 <color key="color" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             </activityIndicatorView>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="GUB-XJ-Xjd">
-                                <rect key="frame" x="0.0" y="44" width="768" height="980"/>
+                                <rect key="frame" x="0.0" y="64" width="768" height="960"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <prototypes>
                                     <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="PDFListTableViewCell" rowHeight="66" id="nvl-ai-zvr" customClass="PortfolioListTableViewCell">
-                                        <rect key="frame" x="0.0" y="28" width="768" height="66"/>
+                                        <rect key="frame" x="0.0" y="50" width="768" height="66"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="nvl-ai-zvr" id="dFo-Ab-QPD">
                                             <rect key="frame" x="0.0" y="0.0" width="768" height="66"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j5I-zo-iGe" userLabel="name">
-                                                    <rect key="frame" x="15" y="8" width="201" height="50"/>
+                                                    <rect key="frame" x="45" y="-47" width="23" height="51"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7zF-7S-Bxq" userLabel="time">
-                                                    <rect key="frame" x="514" y="23" width="208" height="21"/>
+                                                    <rect key="frame" x="-86" y="60" width="17" height="66"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FKE-5d-7eq" userLabel="name">
-                                                    <rect key="frame" x="209" y="8" width="769" height="50"/>
+                                                    <rect key="frame" x="-56" y="-60" width="80" height="27"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -599,28 +594,28 @@
                                 </connections>
                             </tableView>
                             <label hidden="YES" opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cannot get data from server.
Tap to try again." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dP6-eo-w8h">
-                                <rect key="frame" x="262" y="489.5" width="244" height="45.5"/>
+                                <rect key="frame" x="263.5" y="489.5" width="241.5" height="45.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="19"/>
                                 <color key="textColor" red="0.33333333329999998" green="0.33333333329999998" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="mZe-e6-73O"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
                             <constraint firstItem="GUB-XJ-Xjd" firstAttribute="top" secondItem="OvS-DC-8eY" secondAttribute="bottom" id="1Eb-r1-nfs"/>
-                            <constraint firstItem="OvS-DC-8eY" firstAttribute="top" secondItem="5YP-mX-WcN" secondAttribute="top" id="49S-hC-QIn"/>
-                            <constraint firstItem="dP6-eo-w8h" firstAttribute="centerX" secondItem="WFW-Hb-Uqm" secondAttribute="centerX" id="51m-cs-jA4"/>
-                            <constraint firstItem="GUB-XJ-Xjd" firstAttribute="leading" secondItem="5YP-mX-WcN" secondAttribute="leading" id="NAD-X9-EPi"/>
-                            <constraint firstItem="MG5-Qo-QiV" firstAttribute="centerX" secondItem="WFW-Hb-Uqm" secondAttribute="centerX" id="NJS-Lt-QRJ"/>
+                            <constraint firstItem="OvS-DC-8eY" firstAttribute="top" secondItem="mZe-e6-73O" secondAttribute="top" id="49S-hC-QIn"/>
+                            <constraint firstItem="dP6-eo-w8h" firstAttribute="centerX" secondItem="mZe-e6-73O" secondAttribute="centerX" id="51m-cs-jA4"/>
+                            <constraint firstItem="GUB-XJ-Xjd" firstAttribute="leading" secondItem="mZe-e6-73O" secondAttribute="leading" id="NAD-X9-EPi"/>
+                            <constraint firstItem="MG5-Qo-QiV" firstAttribute="centerX" secondItem="mZe-e6-73O" secondAttribute="centerX" id="NJS-Lt-QRJ"/>
                             <constraint firstItem="OvS-DC-8eY" firstAttribute="centerX" secondItem="MG5-Qo-QiV" secondAttribute="centerX" id="W4M-aO-jOh"/>
                             <constraint firstItem="OvS-DC-8eY" firstAttribute="centerX" secondItem="dP6-eo-w8h" secondAttribute="centerX" id="ezG-WL-z1s"/>
                             <constraint firstItem="OvS-DC-8eY" firstAttribute="leading" secondItem="GUB-XJ-Xjd" secondAttribute="leading" id="jEp-fw-40a"/>
                             <constraint firstItem="dP6-eo-w8h" firstAttribute="centerY" secondItem="WFW-Hb-Uqm" secondAttribute="centerY" id="tN9-2P-ZOS"/>
-                            <constraint firstItem="mVH-o4-2r3" firstAttribute="top" secondItem="GUB-XJ-Xjd" secondAttribute="bottom" id="tPF-nl-MlC"/>
+                            <constraint firstItem="mZe-e6-73O" firstAttribute="bottom" secondItem="GUB-XJ-Xjd" secondAttribute="bottom" id="tPF-nl-MlC"/>
                             <constraint firstItem="MG5-Qo-QiV" firstAttribute="centerY" secondItem="WFW-Hb-Uqm" secondAttribute="centerY" id="wdr-8Y-BVF"/>
-                            <constraint firstItem="GUB-XJ-Xjd" firstAttribute="trailing" secondItem="5YP-mX-WcN" secondAttribute="trailing" id="xCc-C6-7dD"/>
+                            <constraint firstItem="GUB-XJ-Xjd" firstAttribute="trailing" secondItem="mZe-e6-73O" secondAttribute="trailing" id="xCc-C6-7dD"/>
                         </constraints>
-                        <viewLayoutGuide key="safeArea" id="5YP-mX-WcN"/>
                     </view>
                     <connections>
                         <outlet property="label_net_err" destination="dP6-eo-w8h" id="87f-YC-0Vk"/>
@@ -632,62 +627,60 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="qdT-Ce-tiq" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1947" y="-1649"/>
+            <point key="canvasLocation" x="2492.1599999999999" y="-2814.2933333333335"/>
         </scene>
         <!--Portfolio Input Dialog-->
         <scene sceneID="MXM-3T-p81">
             <objects>
                 <viewController storyboardIdentifier="RAPortfolioInputDialog" useStoryboardIdentifierAsRestorationIdentifier="YES" id="d7z-RD-NKE" customClass="RAPortfolioInputDialog" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="4nV-Lv-Gvw"/>
-                        <viewControllerLayoutGuide type="bottom" id="rQO-Io-sJJ"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="8UU-Rs-B6c">
                         <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ann-Cc-MnG">
-                                <rect key="frame" x="10" y="10" width="748" height="20.5"/>
+                                <rect key="frame" x="10" y="30" width="748" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please Input Name:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OuM-pW-LFG">
-                                <rect key="frame" x="10" y="40.5" width="748" height="20.5"/>
+                                <rect key="frame" x="10" y="60.5" width="748" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oWD-f5-Wg8">
-                                <rect key="frame" x="10" y="71" width="748" height="34"/>
+                                <rect key="frame" x="10" y="91" width="748" height="34"/>
+                                <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <textInputTraits key="textInputTraits"/>
                             </textField>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please Input Note:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nv4-fy-vKK">
-                                <rect key="frame" x="10" y="115" width="748" height="20.5"/>
+                                <rect key="frame" x="10" y="135" width="748" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vW3-hY-Gcz">
-                                <rect key="frame" x="10" y="145.5" width="748" height="34"/>
+                                <rect key="frame" x="10" y="165.5" width="748" height="34"/>
+                                <color key="textColor" name="labelColor" catalog="iPhoneSDK" colorSpace="catalog"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <textInputTraits key="textInputTraits"/>
                             </textField>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5IO-YO-doG">
-                                <rect key="frame" x="0.0" y="184.5" width="768" height="0.5"/>
+                                <rect key="frame" x="0.0" y="204.5" width="768" height="0.5"/>
                                 <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="0.5" id="UyD-Rk-OsH"/>
                                 </constraints>
                             </view>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2sG-qD-RU4">
-                                <rect key="frame" x="10" y="190" width="748" height="40"/>
+                                <rect key="frame" x="10" y="210" width="748" height="40"/>
                                 <subviews>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Otf-po-oqC">
                                         <rect key="frame" x="0.0" y="0.0" width="374" height="40"/>
                                         <subviews>
-                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="knF-ac-TJw">
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="knF-ac-TJw">
                                                 <rect key="frame" x="163" y="5" width="48" height="30"/>
                                                 <state key="normal" title="Cancel"/>
                                                 <connections>
@@ -704,7 +697,7 @@
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iKB-6U-DeM">
                                         <rect key="frame" x="374" y="0.0" width="374" height="40"/>
                                         <subviews>
-                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tgv-Yx-fqS">
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tgv-Yx-fqS">
                                                 <rect key="frame" x="160" y="5" width="54" height="30"/>
                                                 <state key="normal" title="Preview"/>
                                                 <connections>
@@ -733,6 +726,7 @@
                                 </constraints>
                             </view>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="Hnu-G6-TGZ"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                             <constraint firstItem="OuM-pW-LFG" firstAttribute="leading" secondItem="Ann-Cc-MnG" secondAttribute="leading" id="0Sg-xw-UW8"/>
@@ -741,23 +735,22 @@
                             <constraint firstItem="nv4-fy-vKK" firstAttribute="leading" secondItem="oWD-f5-Wg8" secondAttribute="leading" id="A4W-5F-5Yk"/>
                             <constraint firstItem="oWD-f5-Wg8" firstAttribute="top" secondItem="OuM-pW-LFG" secondAttribute="bottom" constant="10" id="Cic-Q5-3dN"/>
                             <constraint firstItem="5IO-YO-doG" firstAttribute="width" secondItem="8UU-Rs-B6c" secondAttribute="width" id="Duk-TR-sXH"/>
-                            <constraint firstItem="5IO-YO-doG" firstAttribute="leading" secondItem="8UU-Rs-B6c" secondAttribute="leading" id="Gk1-Vy-DbO"/>
-                            <constraint firstAttribute="trailing" secondItem="Ann-Cc-MnG" secondAttribute="trailing" constant="10" id="NIc-hX-0Qt"/>
+                            <constraint firstItem="5IO-YO-doG" firstAttribute="leading" secondItem="Hnu-G6-TGZ" secondAttribute="leading" id="Gk1-Vy-DbO"/>
+                            <constraint firstItem="Hnu-G6-TGZ" firstAttribute="trailing" secondItem="Ann-Cc-MnG" secondAttribute="trailing" constant="10" id="NIc-hX-0Qt"/>
                             <constraint firstItem="nv4-fy-vKK" firstAttribute="trailing" secondItem="oWD-f5-Wg8" secondAttribute="trailing" id="PAD-26-do7"/>
                             <constraint firstItem="2sG-qD-RU4" firstAttribute="leading" secondItem="vW3-hY-Gcz" secondAttribute="leading" id="PbO-vt-JxL"/>
                             <constraint firstItem="2sG-qD-RU4" firstAttribute="top" secondItem="5IO-YO-doG" secondAttribute="bottom" constant="5" id="Sun-LM-Hln"/>
                             <constraint firstItem="vW3-hY-Gcz" firstAttribute="trailing" secondItem="nv4-fy-vKK" secondAttribute="trailing" id="Sxh-eM-6QC"/>
                             <constraint firstItem="oWD-f5-Wg8" firstAttribute="trailing" secondItem="OuM-pW-LFG" secondAttribute="trailing" id="WKC-j1-9Mu"/>
                             <constraint firstItem="vW3-hY-Gcz" firstAttribute="leading" secondItem="nv4-fy-vKK" secondAttribute="leading" id="Zgb-i2-CMh"/>
-                            <constraint firstItem="Ann-Cc-MnG" firstAttribute="leading" secondItem="8UU-Rs-B6c" secondAttribute="leading" constant="10" id="b4A-f1-Cxg"/>
-                            <constraint firstItem="Ann-Cc-MnG" firstAttribute="top" secondItem="4nV-Lv-Gvw" secondAttribute="bottom" constant="10" id="coq-Rq-zpx"/>
+                            <constraint firstItem="Ann-Cc-MnG" firstAttribute="leading" secondItem="Hnu-G6-TGZ" secondAttribute="leading" constant="10" id="b4A-f1-Cxg"/>
+                            <constraint firstItem="Ann-Cc-MnG" firstAttribute="top" secondItem="Hnu-G6-TGZ" secondAttribute="top" constant="10" id="coq-Rq-zpx"/>
                             <constraint firstItem="nv4-fy-vKK" firstAttribute="top" secondItem="oWD-f5-Wg8" secondAttribute="bottom" constant="10" id="eUw-n0-vhA"/>
                             <constraint firstItem="2sG-qD-RU4" firstAttribute="trailing" secondItem="vW3-hY-Gcz" secondAttribute="trailing" id="gkR-Jg-MId"/>
                             <constraint firstItem="OuM-pW-LFG" firstAttribute="top" secondItem="Ann-Cc-MnG" secondAttribute="bottom" constant="10" id="mek-0l-vgX"/>
                             <constraint firstItem="oWD-f5-Wg8" firstAttribute="leading" secondItem="OuM-pW-LFG" secondAttribute="leading" id="ofK-qS-Rhe"/>
                             <constraint firstItem="OuM-pW-LFG" firstAttribute="trailing" secondItem="Ann-Cc-MnG" secondAttribute="trailing" id="saK-GP-gjO"/>
                         </constraints>
-                        <viewLayoutGuide key="safeArea" id="PTF-c0-KP5"/>
                     </view>
                     <connections>
                         <outlet property="nameField" destination="oWD-f5-Wg8" id="2vo-ty-Kp0"/>
@@ -769,7 +762,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="958-ZU-33d" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="-512" y="-1649"/>
+            <point key="canvasLocation" x="-655.36000000000001" y="-2814.2933333333335"/>
         </scene>
     </scenes>
     <resources>

+ 19 - 19
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -710,7 +710,7 @@
                             
                             
                             
-                            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
                             [self presentViewController:navi animated:YES completion:^{
                                 
                                 DebugLog(@"login present.........");
@@ -753,7 +753,7 @@
         
         
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             DebugLog(@"login present.........");
@@ -791,7 +791,7 @@
             
             
             
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
             [self presentViewController:navi animated:YES completion:^{
                 
                 DebugLog(@"login present.........");
@@ -808,7 +808,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         DebugLog(@"login present.........");
@@ -885,7 +885,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -952,7 +952,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1028,7 +1028,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             
@@ -1118,7 +1118,7 @@
     
     
     toController.view.autoresizingMask =     UIViewAutoresizingFlexibleHeight  |UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
-    NSLog(@"MAIN VIEWCONTROLLER CHILD COUNT %lu",(unsigned long)self.childViewControllers.count);
+    DebugLog(@"MAIN VIEWCONTROLLER CHILD COUNT %lu",(unsigned long)self.childViewControllers.count);
     [self addChildViewController:toController];                                     //
     [fromController willMoveToParentViewController:nil];                            //
     
@@ -1513,7 +1513,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1739,7 +1739,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1797,7 +1797,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2660,7 +2660,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [self presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2700,7 +2700,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2758,7 +2758,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3004,7 +3004,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3047,7 +3047,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3109,7 +3109,7 @@
                 AppDelegate *appDelegate = (AppDelegate *)[app delegate];
                 if([appDelegate.password isEqualToString:titleTextField.text])
                 {
-                    NSLog(@"%@", @"run process");
+                    DebugLog(@"%@", @"run process");
 //                    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{
                     PopWaitAlert* pop = [RAUtils waiting_pop:@"Delete Account" completion:nil];
                         [RANetwork request_delete_account:^(NSMutableDictionary *result) {
@@ -3275,7 +3275,7 @@
                     UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
                     
                     navi.navigationBar.translucent = NO;
-                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
                     [strongself presentViewController:navi animated:YES completion:^{
                         
                     }];
@@ -3291,7 +3291,7 @@
             UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
             
             navi.navigationBar.translucent = NO;
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
             [self presentViewController:navi animated:YES completion:^{
                 
             }];

+ 27 - 13
RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m

@@ -1586,8 +1586,8 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
-
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     
     // 添加一个删除按钮
@@ -1597,7 +1597,8 @@
     if(tableView==self.table_order)
     {
         if(indexPath.row==self.content_data.count)
-            return @[];
+//            return @[];
+        return  [UISwipeActionsConfiguration configurationWithActions:@[]];
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         //    NSString* so= [self.content_data[indexPath.row] valueForKey:@"so#"];
         NSString* order_code= [self.content_data[indexPath.row] valueForKey:@"order_code"];
@@ -1606,7 +1607,8 @@
         
         if(true/*appDelegate.user_type==USER_ROLE_EMPLOYEE || (appDelegate.user_type==USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer)*/) {
             
-            UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//            UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+            UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
                 
                 DebugLog(@"delete click");
                 
@@ -1693,7 +1695,8 @@
                     [arr addObject:deleteRowAction];
                 //                if(appDelegate.can_cancel_order)
                 //                    [arr addObject:cancelAction];
-                return arr;
+//                return arr;
+                return  [UISwipeActionsConfiguration configurationWithActions:arr];
             }
             //        }
             
@@ -1701,7 +1704,8 @@
             
         }
         
-        return @[];
+//        return @[];
+        return  [UISwipeActionsConfiguration configurationWithActions:@[]];
     }
     else if(tableView==self.table_submit)
     {
@@ -1714,7 +1718,8 @@
         
         {
             
-            UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//            UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+            UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
                 
                 DebugLog(@"delete click");
                 
@@ -1767,7 +1772,8 @@
                     [arr addObject:deleteRowAction];
                 //                if(appDelegate.can_cancel_order)
                 //                    [arr addObject:cancelAction];
-                return arr;
+//                return arr;
+                return  [UISwipeActionsConfiguration configurationWithActions:arr];
             }
             //        }
             
@@ -1782,7 +1788,9 @@
         
         
         __weak typeof(self) weakself = self;
-        UITableViewRowAction *startAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Restart"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//        UITableViewRowAction *startAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Restart"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        UIContextualAction* startAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Restart" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
             
             if (Appdelegate.uploadManager.onlyWiFi && Appdelegate.uploadManager.reach.currentReachabilityStatus != ReachableViaWiFi) {
                 [weakself.view makeToast:@"Current Network is not WiFi" duration:3.0 position:CSToastPositionCenter];
@@ -1804,7 +1812,9 @@
         startAction.backgroundColor = UIColorFromRGB(0xff9933);
         
         
-        UITableViewRowAction *removeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Remove" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//        UITableViewRowAction *removeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Remove" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        UIContextualAction* removeAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Remove" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
             
             
             [Appdelegate.uploadManager removeTask:task];
@@ -1826,14 +1836,18 @@
         switch ([task[@"status"] intValue]) {
                 
             case TaskStatusFinish:
-                return @[removeAction];
+//                return @[removeAction];
+                return  [UISwipeActionsConfiguration configurationWithActions:@[removeAction]];
                 
             case TaskStatusError:
                 
-                return @[startAction,removeAction];
+//                return @[startAction,removeAction];
+                
+                return  [UISwipeActionsConfiguration configurationWithActions:@[startAction,removeAction]];
                 
             case TaskStatusStop:
-                return @[startAction];
+//                return @[startAction];
+                return  [UISwipeActionsConfiguration configurationWithActions:@[startAction]];
             default:
                 return nil;
                 break;

+ 4 - 4
RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m

@@ -92,7 +92,7 @@
          //   self.backgroundView.highLightRect = CGRectInset(self.focusZone.frame,6,6);
         self->_previewLayer.bounds = rect;
             
-            UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+        UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//= [[UIApplication sharedApplication]statusBarOrientation];
             switch (orientation) {
                     
                     
@@ -354,7 +354,7 @@
     _previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
     
 //    _previewLayer.orientation= AVCaptureVideoOrientationLandscapeRight;
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//= [[UIApplication sharedApplication]statusBarOrientation];
     switch (orientation) {
             
 //            UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
@@ -537,7 +537,7 @@
     
     
     self.scan_val = [transformed stringValue];
-    NSLog(@"scan result:%@",self.scan_val);
+    DebugLog(@"scan result:%@",self.scan_val);
 #ifdef SCANNER_ORDER
 //    if(RASingleton.sharedInstance.enable_OfflineOrder)
     {
@@ -698,7 +698,7 @@
 ////
 ////        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 ////
-////        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+////        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 ////        [self presentViewController:navi animated:YES completion:^{
 ////
 ////            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);

+ 384 - 364
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -93,6 +93,8 @@
 
 @property (nonatomic,assign) BOOL available;///<所有Model均有库存,才能Place Order。
 
+
+@property bool scan_response;
 @end
 
 @implementation CartViewController
@@ -426,7 +428,7 @@
     self.toolbar.hidden = false;
     
     //   DebugLog(@"begin edit %@",NSStringFromCGRect(self.cartItemView.frame));
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//= [[UIApplication sharedApplication]statusBarOrientation];
     if ( UIInterfaceOrientationIsPortrait(orientation))
         self.cartItemView.frame = CGRectMake(0,40,768,840);
     else
@@ -441,7 +443,7 @@
     //    DebugLog(@"end edit %@",NSStringFromCGRect(self.cartItemView.frame));
     
     
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//= [[UIApplication sharedApplication]statusBarOrientation];
     if ( UIInterfaceOrientationIsPortrait(orientation))
         self.cartItemView.frame = CGRectMake(0,40,768,760);
     else
@@ -698,11 +700,11 @@
 {
     if (self.dataOperationQueue.operationCount > 1) {
         
-        NSLog(@"operationCount >1 cancel");
+        DebugLog(@"operationCount >1 cancel");
         return;
     }
     
-    NSLog(@"operating...");
+    DebugLog(@"operating...");
     
     __block AppDelegate *appDelegate = nil;
     
@@ -846,11 +848,11 @@
 {
     if (self.dataOperationQueue.operationCount > 1) {
         
-        NSLog(@"operationCount >1 cancel");
+        DebugLog(@"operationCount >1 cancel");
         return;
     }
     
-    NSLog(@"operating...");
+    DebugLog(@"operating...");
     
     __block AppDelegate *appDelegate = nil;
     
@@ -890,10 +892,12 @@
 //        [self.mum startAnimating];
         DebugLog(@"reloading...");
 //        __block UIAlertController *loadingView = [RAUtils waiting_alert:self title:@"Loading" completion:^{
+        PopWaitAlert* pop = [RAUtils waiting_pop:@"Loading" completion:nil];
             [RANetwork request_cart:weakself.sortIndex completionHandler:^(NSMutableDictionary *result) {
                         DebugLog(@"BEGIN LOAD CART");
                         NSDictionary* cart_json = result;
-                        
+                [pop hide];
+                self.stop_response=false;
                         //
                         //                [self.mum stopAnimating];
 //                        [loadingView dismissViewControllerAnimated:YES completion:^{
@@ -1140,6 +1144,8 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
+    
+    
 //    if(_scanlock==nil)
 //        _scanlock=  [[NSLock alloc] init];
     
@@ -1349,7 +1355,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1616,7 +1622,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1757,343 +1763,343 @@
     [self presentViewController:alertControl animated:YES completion:nil];
 #endif
 }
--(void) newoloorder
-{
-    
-    NSString *orderdir =[OLDataProvider getScanPath];
-                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    appDelegate.can_set_cart_price = true;
-    appDelegate.can_see_price = true;
-    
-    
-    {
-        
-   
-        if(appDelegate.user_type== USER_ROLE_EMPLOYEE)
-        {
-           
-            
-            
-            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Select Customer type" message:@"" preferredStyle:UIAlertControllerStyleAlert];
-            //block代码块取代了delegate
-            
-            
-            
-            UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-                
-                NSMutableDictionary* dict = nil;
-                
+//-(void) newoloorder
+//{
+//
+//    NSString *orderdir =[OLDataProvider getScanPath];
+//                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    appDelegate.can_set_cart_price = true;
+//    appDelegate.can_see_price = true;
+//
+//
+//    {
+//
+//
+//        if(appDelegate.user_type== USER_ROLE_EMPLOYEE)
+//        {
+//
+//
+//
+//            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Select Customer type" message:@"" preferredStyle:UIAlertControllerStyleAlert];
+//            //block代码块取代了delegate
+//
+//
+//
+//            UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+//
 //                NSMutableDictionary* dict = nil;
-                
-                NSString* ordertemplate = nil;
-                if([RADataProvider getSiteHasERP])
-                    ordertemplate =@"e_order.json";
-                else
-                    ordertemplate =@"e_order_noerp.json";
-                
-                dict=[OLDataProvider loadScanTemplate:ordertemplate];
-                
-                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-                
-                
-                
-                [RAUtils dicttofile:orderPath dict:dict];
-                
-                
-
-                
-                
-                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-                
-                
-                
-                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-                
-                [self scanPlaceOrder];
-                
-            }];
-            
-            UIAlertAction *alert2 = [UIAlertAction actionWithTitle:@"New customer" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-                NSMutableDictionary* dict = nil;
-                dict=[OLDataProvider loadScanTemplate:@"n_order.json"];
-                
-                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-                
-                
-                
-                [RAUtils dicttofile:orderPath dict:dict];
-                
-                
-
-                
-                
-                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-                
-                
-                
-                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-                [self scanPlaceOrder];
-            }];
-            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                appDelegate.order_code = nil;
-                DebugLog(@"No");
-            }];
-            [alertControl addAction:actionOne];
-            [alertControl addAction:alert2];
-            [alertControl addAction:alertthree];
-            
-            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-            
-            
-            [self presentViewController:alertControl animated:YES completion:nil];
-            
-            DebugLog(@"%@",self.edit_select_arr);
-
-            
-        }
-        else
-        {
-            NSMutableDictionary* dict = nil;
-            
-            if([appDelegate.customerInfo[@"customer_cid"] stringValue].length ==0 )
-            {
-                dict=[OLDataProvider loadScanTemplate:@"nc_order.json"];
-            }
-            else
-                dict=[OLDataProvider loadScanTemplate:@"c_order.json"];
-            
-            NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-            
-            
-            
-            [RAUtils dicttofile:orderPath dict:dict];
-            
-            
-
-            
-            
-            NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-            
-            
-            
-            [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-            [self scanPlaceOrder];
-        }
-            
-
-//        NSMutableDictionary* dict=[OLDataProvider loadScanTemplate:@"scan_order.json"];
-
-
-        
-
-        
-        
-    }
-//    MainViewController * mainvc=(MainViewController * )appDelegate.main_vc;
-//    mainvc.btnScan.enabled = true;
-    
-//    [appDelegate updateScanButton:true];
-
-   
-    
-}
--(void) newoloorder1
-{
-                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-
-    appDelegate.can_set_cart_price = true;
-    appDelegate.can_see_price = true;
-    
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    NSString *documents = [paths objectAtIndex:0];
-    
-    {
-        
-        
-        NSString *orderdir =[OLDataProvider getScanPath];
-
-        if(appDelegate.user_type== USER_ROLE_EMPLOYEE)
-        {
-           
-            
-            
-            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Select Customer type" message:@"" preferredStyle:UIAlertControllerStyleAlert];
-            //block代码块取代了delegate
-            
-            
-            
-            UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-                
-                NSMutableDictionary* dict = nil;
-                
-                NSString* ordertemplate = nil;
-                if([RADataProvider getSiteHasERP])
-                    ordertemplate =@"e_order.json";
-                else
-                    ordertemplate =@"e_order_noerp.json";
-                
-                dict=[OLDataProvider loadScanTemplate:ordertemplate];
-                
-                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-                
-                
-                
-                [RAUtils dicttofile:orderPath dict:dict];
-                
-                
-
-                
-                
-                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-                
-                
-                
-                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-                
-                [self scanPlaceOrder];
-                
-            }];
-            
-            UIAlertAction *alert2 = [UIAlertAction actionWithTitle:@"New customer" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-                NSMutableDictionary* dict = nil;
-                dict=[OLDataProvider loadScanTemplate:@"n_order.json"];
-                
-                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-                
-                
-                
-                [RAUtils dicttofile:orderPath dict:dict];
-                
-                
-
-                
-                
-                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-                
-                
-                
-                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-                [self scanPlaceOrder];
-            }];
-            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                appDelegate.order_code = nil;
-                DebugLog(@"No");
-            }];
-            [alertControl addAction:actionOne];
-            [alertControl addAction:alert2];
-            [alertControl addAction:alertthree];
-            
-            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-            
-            
-            [self presentViewController:alertControl animated:YES completion:nil];
-            
-            DebugLog(@"%@",self.edit_select_arr);
-
-            
-        }
-        else
-        {
-            NSMutableDictionary* dict = nil;
-            if([appDelegate.customerInfo[@"customer_cid"] stringValue].length ==0 )
-            {
-                dict=[OLDataProvider loadScanTemplate:@"nc_order.json"];
-            }
-            else
-                dict=[OLDataProvider loadScanTemplate:@"c_order.json"];
-            
-            NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-            
-            
-            
-            [RAUtils dicttofile:orderPath dict:dict];
-            
-            
-
-            
-            
-            NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-            
-            
-            
-            [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-            [self scanPlaceOrder];
-        }
-            
-
-//        NSMutableDictionary* dict=[OLDataProvider loadScanTemplate:@"scan_order.json"];
-
-
-        
-
-        
-        
-    }
-//    MainViewController * mainvc=(MainViewController * )appDelegate.main_vc;
-//    mainvc.btnScan.enabled = true;
-    
-//    [appDelegate updateScanButton:true];
-
-   
-    
-}
--(void)newScanOrder1
-{
-    
 //
-//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+////                NSMutableDictionary* dict = nil;
+//
+//                NSString* ordertemplate = nil;
+//                if([RADataProvider getSiteHasERP])
+//                    ordertemplate =@"e_order.json";
+//                else
+//                    ordertemplate =@"e_order_noerp.json";
+//
+//                dict=[OLDataProvider loadScanTemplate:ordertemplate];
+//
+//                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
+//
+//
+//
+//                [RAUtils dicttofile:orderPath dict:dict];
+//
+//
+//
+//
+//
+//                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
+//
+//
+//
+//                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
+//
+//                [self scanPlaceOrder];
+//
+//            }];
+//
+//            UIAlertAction *alert2 = [UIAlertAction actionWithTitle:@"New customer" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//                NSMutableDictionary* dict = nil;
+//                dict=[OLDataProvider loadScanTemplate:@"n_order.json"];
+//
+//                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
+//
+//
+//
+//                [RAUtils dicttofile:orderPath dict:dict];
+//
+//
+//
+//
+//
+//                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
+//
+//
+//
+//                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
+//                [self scanPlaceOrder];
+//            }];
+//            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//                appDelegate.order_code = nil;
+//                DebugLog(@"No");
+//            }];
+//            [alertControl addAction:actionOne];
+//            [alertControl addAction:alert2];
+//            [alertControl addAction:alertthree];
+//
+//            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+//
+//
+//            [self presentViewController:alertControl animated:YES completion:nil];
+//
+//            DebugLog(@"%@",self.edit_select_arr);
+//
+//
+//        }
+//        else
+//        {
+//            NSMutableDictionary* dict = nil;
+//
+//            if([appDelegate.customerInfo[@"customer_cid"] stringValue].length ==0 )
+//            {
+//                dict=[OLDataProvider loadScanTemplate:@"nc_order.json"];
+//            }
+//            else
+//                dict=[OLDataProvider loadScanTemplate:@"c_order.json"];
+//
+//            NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
+//
+//
+//
+//            [RAUtils dicttofile:orderPath dict:dict];
+//
+//
 //
 //
-//    if(appDelegate.order_code.length>0)
+//
+//            NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
+//
+//
+//
+//            [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
+//            [self scanPlaceOrder];
+//        }
+//
+//
+////        NSMutableDictionary* dict=[OLDataProvider loadScanTemplate:@"scan_order.json"];
+//
+//
+//
+//
+//
+//
+//    }
+////    MainViewController * mainvc=(MainViewController * )appDelegate.main_vc;
+////    mainvc.btnScan.enabled = true;
+//
+////    [appDelegate updateScanButton:true];
+//
+//
+//
+//}
+//-(void) newoloorder1
+//{
+//                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//
+//    appDelegate.can_set_cart_price = true;
+//    appDelegate.can_see_price = true;
+//    
+////    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+////    NSString *documents = [paths objectAtIndex:0];
+//    
 //    {
-////        当前订单先关闭
-////        [OLDataProvider deleteScanOrder:appDelegate.order_code];
-//        appDelegate.order_code = nil;
-//        appDelegate.customerInfo = nil;
-//        RASingleton.sharedInstance.scan_cart = nil;
-//        appDelegate.contact_id = nil;
-////        [appDelegate updateScanButton:false];
+//        
+//        
+//        NSString *orderdir =[OLDataProvider getScanPath];
+//
+//        if(appDelegate.user_type== USER_ROLE_EMPLOYEE)
+//        {
+//           
+//            
+//            
+//            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Select Customer type" message:@"" preferredStyle:UIAlertControllerStyleAlert];
+//            //block代码块取代了delegate
+//            
+//            
+//            
+//            UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+//                
+//                NSMutableDictionary* dict = nil;
+//                
+//                NSString* ordertemplate = nil;
+//                if([RADataProvider getSiteHasERP])
+//                    ordertemplate =@"e_order.json";
+//                else
+//                    ordertemplate =@"e_order_noerp.json";
+//                
+//                dict=[OLDataProvider loadScanTemplate:ordertemplate];
+//                
+//                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
+//                
+//                
+//                
+//                [RAUtils dicttofile:orderPath dict:dict];
+//                
+//                
+//
+//                
+//                
+//                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
+//                
+//                
+//                
+//                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
+//                
+//                [self scanPlaceOrder];
+//                
+//            }];
+//            
+//            UIAlertAction *alert2 = [UIAlertAction actionWithTitle:@"New customer" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//                NSMutableDictionary* dict = nil;
+//                dict=[OLDataProvider loadScanTemplate:@"n_order.json"];
+//                
+//                NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
+//                
+//                
+//                
+//                [RAUtils dicttofile:orderPath dict:dict];
+//                
+//                
 //
-//        [appDelegate update_count_mark];
-//        [appDelegate closeOrder];
+//                
+//                
+//                NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
+//                
+//                
+//                
+//                [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
+//                [self scanPlaceOrder];
+//            }];
+//            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//                appDelegate.order_code = nil;
+//                DebugLog(@"No");
+//            }];
+//            [alertControl addAction:actionOne];
+//            [alertControl addAction:alert2];
+//            [alertControl addAction:alertthree];
+//            
+//            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+//            
+//            
+//            [self presentViewController:alertControl animated:YES completion:nil];
+//            
+//            DebugLog(@"%@",self.edit_select_arr);
 //
+//            
+//        }
+//        else
+//        {
+//            NSMutableDictionary* dict = nil;
+//            if([appDelegate.customerInfo[@"customer_cid"] stringValue].length ==0 )
+//            {
+//                dict=[OLDataProvider loadScanTemplate:@"nc_order.json"];
+//            }
+//            else
+//                dict=[OLDataProvider loadScanTemplate:@"c_order.json"];
+//            
+//            NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
+//            
+//            
+//            
+//            [RAUtils dicttofile:orderPath dict:dict];
+//            
+//            
+//
+//            
+//            
+//            NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
+//            
+//            
+//            
+//            [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
+//            [self scanPlaceOrder];
+//        }
+//            
+//
+////        NSMutableDictionary* dict=[OLDataProvider loadScanTemplate:@"scan_order.json"];
+//
+//
+//        
+//
+//        
+//        
 //    }
+////    MainViewController * mainvc=(MainViewController * )appDelegate.main_vc;
+////    mainvc.btnScan.enabled = true;
+//    
+////    [appDelegate updateScanButton:true];
 //
+//   
+//    
+//}
+//-(void)newScanOrder1
+//{
 //
-    {
-        [self newoloorder1];
-        
-    }
-}
--(void)newScanOrder
-{
-    
-    
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        
-
-    {
-        [self newoloorder];
-        
-    }
-}
+////
+////    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+////
+////
+////    if(appDelegate.order_code.length>0)
+////    {
+//////        当前订单先关闭
+//////        [OLDataProvider deleteScanOrder:appDelegate.order_code];
+////        appDelegate.order_code = nil;
+////        appDelegate.customerInfo = nil;
+////        RASingleton.sharedInstance.scan_cart = nil;
+////        appDelegate.contact_id = nil;
+//////        [appDelegate updateScanButton:false];
+////
+////        [appDelegate update_count_mark];
+////        [appDelegate closeOrder];
+////
+////    }
+////
+////
+//    {
+//        [self newoloorder1];
+//
+//    }
+//}
+//-(void)newScanOrder
+//{
+//
+//
+////    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//
+//
+//    {
+//        [self newoloorder];
+//
+//    }
+//}
 
 -(void)placeOrder
 {
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-#ifndef SCANNER_ORDER
-    if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-        
-        
-        if (![RASingleton sharedInstance].permissions_edit_order) {
-            
-            return;
-        }
-        
-
-        
-    }
-#endif
+//
+//#ifndef SCANNER_ORDER
+//    if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+//
+//
+//        if (![RASingleton sharedInstance].permissions_edit_order) {
+//
+//            return;
+//        }
+//
+//
+//
+//    }
+//#endif
 //    NSMutableArray* checked = [[NSMutableArray alloc] init];
     
     bool have_free = false;
@@ -2130,7 +2136,7 @@
 
 #ifdef SCANNER_ORDER
     
-
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if(appDelegate.bLogin==false)
     {
         LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
@@ -2161,7 +2167,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2548,7 +2554,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [parentvc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -2735,7 +2741,7 @@
     
     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [parentvc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -3618,7 +3624,8 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -3640,8 +3647,8 @@
     __weak typeof(self) weakself = self;
     
     
-    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" Delete " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
-        
+//    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" Delete " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@" Delete " handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         DebugLog(@"delete click");
         
          //[self.itemListTable setEditing:false animated:YES];
@@ -3772,8 +3779,8 @@
     
     deleteRowAction.backgroundColor = [UIColor redColor];
     
-    UITableViewRowAction *notifyMeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Notify Me" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
-        
+//    UITableViewRowAction *notifyMeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Notify Me" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+    UIContextualAction* notifyMeAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Notify Me" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         {
             
 //            __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
@@ -3834,8 +3841,10 @@
     notifyMeAction.backgroundColor = UIColorFromRGB(0x9BBF5A);
     
     
-    UITableViewRowAction *addWatchAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Move To Wish List" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *addWatchAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Move To Wish List" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
         
+        UIContextualAction* addWatchAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Move To Wish List" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         DebugLog(@"Wishlist click");
         
         
@@ -3915,8 +3924,9 @@
     
     
     // 添加一个编辑按钮
-    UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
         
+    UIContextualAction* editRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Edit Price" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         DebugLog(@"edit click");
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
             
@@ -4067,7 +4077,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [parentvc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -4142,16 +4152,18 @@
     //
     //    freeRowAction.backgroundColor = [UIColor lightGrayColor];
     
-    UITableViewRowAction *noteRowAction = nil;
-    
-    
-   // NSDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
-    
-    
-    
-    
-    noteRowAction=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Edit note" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *noteRowAction = nil;
+//
+//
+//   // NSDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
+//
+//
+//
+//
+//    noteRowAction=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Edit note" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
         
+        UIContextualAction* noteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Edit note" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         DebugLog(@"item note click");
         
         
@@ -4200,7 +4212,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [parentvc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -4223,8 +4235,10 @@
     noteRowAction.backgroundColor = [UIColor lightGrayColor];
 
 
-    UITableViewRowAction *move2BackAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Move to Back Order" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+//    UITableViewRowAction *move2BackAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Move to Back Order" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
         
+        
+        UIContextualAction* move2BackAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Move to Back Order" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         NSDictionary *item_json = [self itemJsonAtIndexPath:indexPath];
         NSString* cart_item_id = [item_json valueForKey:@"cart_item_id"];
         
@@ -4321,15 +4335,18 @@
 
         
         
-        
-        return arr;
+        return  [UISwipeActionsConfiguration configurationWithActions:arr];
+//        return arr;
         //    return @[deleteRowAction,addWatchAction, editRowAction,freeRowAction];
     } else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
         if (appDelegate.customer_type == CustomerTypeStore) {
 #ifndef SCANNER_ORDER
-            return @[notifyMeAction,deleteRowAction,addWatchAction,editRowAction];
+            
+            return  [UISwipeActionsConfiguration configurationWithActions:@[notifyMeAction,deleteRowAction,addWatchAction,editRowAction]];
+//            return @[notifyMeAction,deleteRowAction,addWatchAction,editRowAction];
 #else
-            return @[deleteRowAction];
+            return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
+//            return @[deleteRowAction];
 #endif
         } else {
             
@@ -4362,14 +4379,17 @@
                 [actionArray addObject:editRowAction];
             }
             
-            return actionArray;
+//            return actionArray;
+            return  [UISwipeActionsConfiguration configurationWithActions:actionArray];
         }
     }
     else
 #ifndef SCANNER_ORDER
-        return @[deleteRowAction,addWatchAction];
+        return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction,addWatchAction]];
+//        return @[deleteRowAction,addWatchAction];
 #else
-    return @[deleteRowAction];
+//    return @[deleteRowAction];
+    return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
 #endif
     
     
@@ -4481,7 +4501,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     {
         
 #if defined(USE_BLE_SCANNER) || defined(USE_MFI_SCANNER)
-//        self.stop_response=true;
+        self.stop_response=true;
         
     
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m

@@ -232,7 +232,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [vc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);

+ 10 - 10
RedAnt ERP Mobile/common/Functions/category/CategorySearchFilterViewController.m

@@ -938,7 +938,7 @@
 #pragma mark - Responding to keyboard events
 
 - (void)keyboardDidChangeFrame:(NSNotification *)notification {
-    NSLog(@"keyboardDidChangeFrame");
+    DebugLog(@"keyboardDidChangeFrame");
     
     
     // 使用tableContainer计算frame 保证屏幕旋转后table height正确
@@ -950,10 +950,10 @@
     //    //    duration *= 0.0;
     CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
     CGFloat keyboard_top = end.origin.y;
-    NSLog(@"keyboard rect: %@",NSStringFromCGRect(end));
+    DebugLog(@"keyboard rect: %@",NSStringFromCGRect(end));
     
-    NSLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
-    NSLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
+    DebugLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
+    DebugLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
     
     //    self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
     
@@ -1021,7 +1021,7 @@
     
 }
 //- (void)keyboardWillChangeFrame:(NSNotification *)notification {
-//    NSLog(@"keyboardWillChangeFrame");
+//    DebugLog(@"keyboardWillChangeFrame");
 //
 //
 //    // 使用tableContainer计算frame 保证屏幕旋转后table height正确
@@ -1033,10 +1033,10 @@
 //    //    //    duration *= 0.0;
 //    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
 //    CGFloat keyboard_top = end.origin.y;
-//    NSLog(@"keyboard rect: %@",NSStringFromCGRect(end));
+//    DebugLog(@"keyboard rect: %@",NSStringFromCGRect(end));
 //
-//    NSLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
-//    NSLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
+//    DebugLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
+//    DebugLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
 //
 //    //    self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
 //
@@ -1107,7 +1107,7 @@
 //static float table_origin_h = 0;
 
 - (void)keyboardWillShow:(NSNotification *)notification {
-    NSLog(@"keyboardWillShow");
+    DebugLog(@"keyboardWillShow");
     //
     //    if(self.keyboard_show)
     //        return;
@@ -1180,7 +1180,7 @@
     //    //  [self moveInputBarWithKeyboardHeight:keyboardRect.size.height withDuration:animationDuration];
 }
 - (void)keyboardWillHide:(NSNotification *)notification {
-    NSLog(@"keyboardWillHide");
+    DebugLog(@"keyboardWillHide");
     
     //    self.keyboard_show=false;
     //    NSDictionary* userInfo = [notification userInfo];

+ 13 - 7
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -342,7 +342,7 @@
     
     
 //    navi.preferredContentSize = CGSizeMake(540, 680);
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -634,7 +634,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -686,7 +686,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1510,7 +1510,7 @@
     } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
         
         self.headerView.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.headerView.bounds].CGPath;
-            self.toOrientation = [UIApplication sharedApplication].statusBarOrientation;
+        self.toOrientation = [RAUtils query_orientation:self];//= [UIApplication sharedApplication].statusBarOrientation;
         [self.collectionview.collectionViewLayout invalidateLayout];
     }];
 }
@@ -1683,7 +1683,13 @@
 
     [self checkToolBar];
     
-    self.toOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+    //    NSArray *scenes=[[[UIApplication sharedApplication] connectedScenes] allObjects];
+    //    NSArray *windows=[[scenes objectAtIndex:0] windows];
+    //
+    //    UIWindow* w=windows[0];
+    
+    
+    self.toOrientation = [RAUtils query_orientation:self];//= [[UIApplication sharedApplication] statusBarOrientation];
 
 //    [self.collectionview scrollToItemAtIndexPath:self.selectedIndexPath atScrollPosition:16 animated:YES];
     
@@ -1704,7 +1710,7 @@
     self.support_scanner = true;
 #endif
     
-    self.toOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+    self.toOrientation = [RAUtils query_orientation:self];//= [[UIApplication sharedApplication] statusBarOrientation];
     
     self.refresh_type = REFRESH_NONE;
     self.label_net_err.layer.borderColor = [UIColor darkGrayColor].CGColor;
@@ -2224,7 +2230,7 @@
 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
 {
     
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//[[UIApplication sharedApplication]statusBarOrientation];
     
     orientation = self.toOrientation; // 避免横排转竖屏时UICollectionViewFlowLayoutBreakForInvalidSizes警告
     

+ 13 - 13
RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m

@@ -49,7 +49,7 @@
     self.searchBar.text = nil;
     [self.content_data removeAllObjects];
     [self refresh_ui];
-    NSLog(@"%s removeAllObjects",__func__);
+    DebugLog(@"%s removeAllObjects",__func__);
 }
 - (void)viewDidLoad {
     [super viewDidLoad];
@@ -176,7 +176,7 @@
     
     self.offset = 0;
     [self.content_data removeAllObjects];
-    NSLog(@"%s removeAllObjects",__func__);
+    DebugLog(@"%s removeAllObjects",__func__);
     //    [self loadpage];
     
     
@@ -202,9 +202,9 @@
     self.keywords=self.searchBar.text;
     self.offset = 0;
     [self.content_data removeAllObjects];
-    NSLog(@"%s removeAllObjects",__func__);
+    DebugLog(@"%s removeAllObjects",__func__);
     [self.table reloadData];
-    NSLog(@"%s reloadData",__FUNCTION__);
+    DebugLog(@"%s reloadData",__FUNCTION__);
     UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:201];
     
     [reF endRefreshing];
@@ -240,13 +240,13 @@
     {
         self.offset = 0;
         [self.content_data removeAllObjects];
-        NSLog(@"%s removeAllObjects",__func__);
+        DebugLog(@"%s removeAllObjects",__func__);
         [self reload_data];
     }
     else
     {
         [self.table reloadData];
-        NSLog(@"%s reloadData",__FUNCTION__);
+        DebugLog(@"%s reloadData",__FUNCTION__);
     }
     
     
@@ -335,7 +335,7 @@
                 
                 
                 [self.table reloadData ];
-                NSLog(@"%s reloadData",__FUNCTION__);
+                DebugLog(@"%s reloadData",__FUNCTION__);
                 
             }
             else if([[content valueForKey:@"result"] intValue]==RESULT_NET_ERROR &&self.offset==0)
@@ -422,7 +422,7 @@
         self.keywords=nil;
         self.offset = 0;
         [self.content_data removeAllObjects];
-        NSLog(@"%s removeAllObjects",__func__);
+        DebugLog(@"%s removeAllObjects",__func__);
         [self loadpage];
         
         //        appDelegate.contact_id=[value valueForKey:@"customer_cid"];
@@ -434,7 +434,7 @@
 }
 - (IBAction)onNewCustomerClick:(id)sender {
     
-    NSLog(@"new click");
+    DebugLog(@"new click");
     
     NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
     
@@ -479,7 +479,7 @@
             DebugLog(@"!!!!!!!!!!!!!!!!!!!!!route!!!!!!!!!!!!!!!!!!!!!");
 
         [self.table reloadData];
-        NSLog(@"%s reloadData",__FUNCTION__);
+        DebugLog(@"%s reloadData",__FUNCTION__);
     }];
 }
 - (IBAction)onAssignClick:(id)sender {
@@ -526,7 +526,7 @@
                     
                     
                     [self.table reloadData];
-                    NSLog(@"%s reloadData",__FUNCTION__);
+                    DebugLog(@"%s reloadData",__FUNCTION__);
                     [self.navigationController popToRootViewControllerAnimated:false];
                     if(self.returnValue)
                         self.returnValue(data_init,self.from);
@@ -825,7 +825,7 @@
     self.keywords=searchBar.text;
     self.offset = 0;
     [self.content_data removeAllObjects];
-    NSLog(@"%s removeAllObjects",__func__);
+    DebugLog(@"%s removeAllObjects",__func__);
     self.adv_search=nil;
     [self loadpage];
     DebugLog(@"search");
@@ -841,7 +841,7 @@
         
         self.offset = 0;
         [self.content_data removeAllObjects];
-        NSLog(@"%s removeAllObjects",__func__);
+        DebugLog(@"%s removeAllObjects",__func__);
         self.adv_search=nil;
         [self loadpage];
         //        [self loadpage];

+ 1 - 1
RedAnt ERP Mobile/common/Functions/home/HomeViewController.m

@@ -26,7 +26,7 @@
 @implementation HomeViewController
 -(void) dealloc
 {
-    NSLog(@"HOME VIEWCONTROLLER DEALLOC");
+    DebugLog(@"HOME VIEWCONTROLLER DEALLOC");
 }
 -(void) refresh_on_login
 {

+ 12 - 11
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -17,7 +17,7 @@
 
 #import "ImageScrollerViewController.h"
 #import "CartUtils.h"
-#import "CustomIOSAlertView.h"
+//#import "CustomIOSAlertView.h"
 #import "TextUtils.h"
 
 
@@ -197,7 +197,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [vc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -235,7 +235,7 @@
             }
             else
             {
-                UIViewController *vc= [RAUtils getViewController:self];
+//                UIViewController *vc= [RAUtils getViewController:self];
                 [RAUtils message_box:@"Add to portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
             }
             
@@ -331,7 +331,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [vc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -371,7 +371,7 @@
             }
             else
             {
-                UIViewController *vc= [RAUtils getViewController:self];
+//                UIViewController *vc= [RAUtils getViewController:self];
                 [RAUtils message_box:@"Add Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
             }
             
@@ -476,7 +476,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [vc presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -663,12 +663,12 @@
 }
 -(void) addtocart:(int) count
 {
-    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    
 #ifdef MPACK
     if(self.cqty>0)
     {
         
-        
+        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:@"QTY: %d of this model already in cart. Continue ?",self.cqty] message:nil preferredStyle:UIAlertControllerStyleAlert];
         //block代码块取代了delegate
         
@@ -853,6 +853,7 @@
         
         
 #ifdef MPACK
+        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         int c=self.cqty+count;
         
         int m=c%self.step;
@@ -988,7 +989,7 @@
                 }
                 else
                 {
-                    UIViewController *vc= [RAUtils getViewController:self];
+//                    UIViewController *vc= [RAUtils getViewController:self];
                     
                     NSString *msg = [return_json valueForKey:@"err_msg"];
                     NSString *title = @"Add To Cart";
@@ -1210,7 +1211,7 @@
                 }
                 else
                 {
-                    UIViewController *vc= [RAUtils getViewController:self];
+//                    UIViewController *vc= [RAUtils getViewController:self];
                     NSString *msg = [return_json valueForKey:@"err_msg"];
                     NSString *title = @"Add To Cart";
                     if ([msg hasPrefix:@"Out of Stock.\n"]) {
@@ -1475,7 +1476,7 @@
         
         UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [vc presentViewController:navi animated:YES completion:^{
 
         }];

+ 40 - 66
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -600,38 +600,6 @@
                 first_name="";
             NSString *nsfirst_name= [[NSString alloc]initWithUTF8String:first_name];
             
-            //            [header setValue:[NSNumber numberWithBool:can_show_price]   forKey:@"can_show_price"];
-            //            [header setValue:[NSNumber numberWithBool:can_see_price]   forKey:@"can_see_price"];
-            //            [header setValue:nscontact_id   forKey:@"contact_id"];
-            //            [header setValue:[NSNumber numberWithBool:user_type]   forKey:@"user_type"];
-            //            [header setValue:[NSNumber numberWithBool:can_cancel_order]   forKey:@"can_cancel_order"];
-            //            [header setValue:[NSNumber numberWithBool:can_set_cart_price]   forKey:@"can_set_cart_price"];
-            //            [header setValue:[NSNumber numberWithBool:can_create_portfolio]   forKey:@"can_create_portfolio"];
-            //            [header setValue:[NSNumber numberWithBool:can_delete_order]   forKey:@"can_delete_order"];
-            //            [header setValue:[NSNumber numberWithBool:can_submit_order]   forKey:@"can_submit_order"];
-            //            [header setValue:[NSNumber numberWithBool:can_set_tearsheet_price]   forKey:@"can_set_tearsheet_price"];
-            //            [header setValue:[NSNumber numberWithBool:can_create_order]   forKey:@"can_create_order"];
-            //
-            //            [header setValue:[NSNumber numberWithBool:can_update_contact_info]   forKey:@"can_update_contact_info"];
-            //
-            //            [header setValue:nsusername   forKey:@"username"];
-            //
-            //            NSError* error=nil;
-            //
-            //            NSString* statusFilter =[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"offline_status_filter_cadedate" ofType:@"json"] encoding:NSUTF8StringEncoding error:&error];
-            //            [header setValue:statusFilter   forKey:@"statusFilter"];
-            //
-            //
-            //
-            //            int wish_count = [iSalesDB get_recordcount:db table:@"wishlist" where:@"is_delete is  NULL or is_delete != 1"];
-            //            [header setObject:[NSString stringWithFormat:@"%d",wish_count] forKey:@"wish_count"];
-            //
-            //            //            int portfolio_count = [iSalesDB get_recordcount:db table:@"portfoliolist" where:@"1=1"];
-            //            //            [header setObject:[NSString stringWithFormat:@"%d",wish_count] forKey:@"portfolio_count"];
-            //            int portfolio_count = [iSalesDB get_recordcount:db table:@"offline_portfolio" where:@"is_delete is  NULL or is_delete != 1"];
-            //            [header setObject:[NSString stringWithFormat:@"%d",portfolio_count] forKey:@"portfolio_count"];
-            //
-            //            [ret setObject:header forKey:@"header"];
             [ret setValue:nsfirst_name   forKey:@"first_name"];
             
             
@@ -646,9 +614,9 @@
     
     
     
-    
+#ifdef DEBUG
     DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-    
+#endif
     return ret;
 }
 +(NSMutableDictionary*) prepare_salesorder_data:(NSString*) order_code user:(NSString*) user type:(int) type
@@ -1206,9 +1174,9 @@
             //            char *logist = (char*)sqlite3_column_text(statement, 11);
             //            if(logist==nil)
             //                logist= "";
-            //            NSString *nslogist=[[NSString alloc]initWithUTF8String:logist];
+            //            NSString *DebugLogist=[[NSString alloc]initWithUTF8String:logist];
             //            if (status == -11 || status == 10 || status == 11) {
-            //                nslogist = [self textAtColumn:59 statement:statement];
+            //                DebugLogist = [self textAtColumn:59 statement:statement];
             //            };
             //
             //            NSString *shipping = [NSString stringWithFormat:@"$%.2f",sqlite3_column_double(statement, 12)];
@@ -1261,7 +1229,7 @@
             //            orderinfo = [self replaceHtml:orderinfo String:@"CustomerInfo_or_nbsp" withString:nscompany_name];
             //            orderinfo = [self replaceHtml:orderinfo String:@"CustomerName_or_nbsp" withString:nscustomer_contact];
             //            orderinfo = [self replaceHtml:orderinfo String:@"CustomerAddress_or_nbsp" withString:customer_address];
-            //            orderinfo = [self replaceHtml:orderinfo String:@"ShippingMethod_or_nbsp" withString:nslogist];
+            //            orderinfo = [self replaceHtml:orderinfo String:@"ShippingMethod_or_nbsp" withString:DebugLogist];
             //            orderinfo = [self replaceHtml:orderinfo String:@"Shipping_or_nbsp" withString:shipping];
             //            orderinfo = [self replaceHtml:orderinfo String:@"LiftgateFee_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",lift_gate]];
             //            orderinfo = [self replaceHtml:orderinfo String:@"GeneralNotes_or_nbsp" withString:nsgeneral_notes];
@@ -1409,7 +1377,9 @@
     
     data[@"order_type"]=order_type;
 
+#ifdef DEBUG
     DebugLog(@"debug sales order data:%@", [RAConvertor dict2string:data]);
+#endif
     return data;
 }
 +(NSData*) offline_request_salesorder :(NSMutableDictionary *) params
@@ -1985,7 +1955,7 @@
     {
         
         NSError *error = nil;
-        bool bsuccess=[fileManager createDirectoryAtPath:serverpath withIntermediateDirectories:YES attributes:nil error:&error];
+        [fileManager createDirectoryAtPath:serverpath withIntermediateDirectories:YES attributes:nil error:&error];
 
     }
     
@@ -2014,7 +1984,7 @@
     {
         
         NSError *error = nil;
-        bool bsuccess=[fileManager createDirectoryAtPath:userpath withIntermediateDirectories:YES attributes:nil error:&error];
+        [fileManager createDirectoryAtPath:userpath withIntermediateDirectories:YES attributes:nil error:&error];
 
     }
     return userpath;
@@ -2121,7 +2091,7 @@
         return;
     //        orderdirNSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     //        NSString *documents = [paths objectAtIndex:0];
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
     
     
 //    if([appDelegate.order_code isEqualToString:order_code])
@@ -2464,8 +2434,9 @@
 //    self.labelPrice2.text = price_group[@"price_2"][@"display"];//appDelegate.price2_name;
 //    self.labelPrice3.text = price_group[@"price_3"][@"display"];//appDelegate.price3_name;
 
-    NSLog( [RAConvertor dict2string:_modelJson]);
-    
+#ifdef DEBUG
+    DebugLog( [RAConvertor dict2string:_modelJson]);
+#endif
     NSString * port=_modelJson[@"port"];
     if(port.length==0)
         port = @"N/A";
@@ -4557,10 +4528,10 @@ if(stockUom==0)
     [iSalesDB close_db:db];
     
     
-    
+#ifdef DEBUG
     
     DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-    
+#endif
     return ret;
 }
 
@@ -5612,9 +5583,9 @@ if(stockUom==0)
     
     [iSalesDB close_db:db];
     
-    
+#ifdef DEBUG
     DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-    
+#endif
     return [RAConvertor dict2data:ret];
 }
 +(NSDictionary*) offline_contactinfo :(NSMutableDictionary *) params
@@ -5928,10 +5899,10 @@ if(stockUom==0)
     item[@"customer_truck_carrier"] = scarrier;
     
     [ret setObject:item forKey:@"customerInfo"];
-    
+#ifdef DEBUG
     
     DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-    
+#endif
     return ret;
 }
 
@@ -6734,7 +6705,7 @@ if(stockUom==0)
     return [self addAll:params from:2];
 }
 #pragma mark - Jack
-#warning 做SQL操作时转义!!
+
 
 + (NSDictionary *)offline_getAllCountryDefault:(NSString *)countryCode {
     //    "val_227" : {
@@ -7422,7 +7393,7 @@ if(stockUom==0)
     NSString *stateCode = nil;
     NSString *city = nil;
     NSString *zipCode = nil;
-    NSString *carrierCode = nil;
+//    NSString *carrierCode = nil;
     
     if ([params.allKeys containsObject:@"refresh_trigger"]) {
         
@@ -8392,9 +8363,9 @@ if(stockUom==0)
     
     
     [iSalesDB close_db:db];
-    
+#ifdef DEBUG
     DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-    
+#endif
     return ret;
     
 }
@@ -8752,9 +8723,9 @@ if(stockUom==0)
     }
     
     [iSalesDB close_db:db];
-    
+#ifdef DEBUG
     DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-    
+#endif
     return ret;
     
 }
@@ -8992,9 +8963,9 @@ if(stockUom==0)
             char *logist = (char*)sqlite3_column_text(statement, 11);
             if(logist==nil)
                 logist= "";
-            NSString *nslogist=[[NSString alloc]initWithUTF8String:logist];
+            NSString *DebugLogist=[[NSString alloc]initWithUTF8String:logist];
             if (/*status == -11 || */status == 10 || status == 11) {
-                nslogist = [self textAtColumn:59 statement:statement];
+                DebugLogist = [self textAtColumn:59 statement:statement];
             };
             
             NSString *shipping = [NSString stringWithFormat:@"$%.2f",sqlite3_column_double(statement, 12)];
@@ -9030,7 +9001,7 @@ if(stockUom==0)
             };
             [price_data setObject:liftgate_item forKey:@"item_2"];
             
-            //            if ([nslogist isEqualToString:@"WILL CALL"]) {
+            //            if ([DebugLogist isEqualToString:@"WILL CALL"]) {
             //                [ret removeObjectForKey:@"Shipping"];
             //                [ret removeObjectForKey:@"Liftgate Fee(No loading dock)"];
             //            }
@@ -9068,7 +9039,7 @@ if(stockUom==0)
             orderinfo = [self replaceHtml:orderinfo String:@"CustomerInfo_or_nbsp" withString:nscompany_name];
             orderinfo = [self replaceHtml:orderinfo String:@"CustomerName_or_nbsp" withString:nscustomer_contact];
             orderinfo = [self replaceHtml:orderinfo String:@"CustomerAddress_or_nbsp" withString:customer_address];
-            orderinfo = [self replaceHtml:orderinfo String:@"ShippingMethod_or_nbsp" withString:nslogist];
+            orderinfo = [self replaceHtml:orderinfo String:@"ShippingMethod_or_nbsp" withString:DebugLogist];
             orderinfo = [self replaceHtml:orderinfo String:@"Shipping_or_nbsp" withString:shipping];
             orderinfo = [self replaceHtml:orderinfo String:@"LiftgateFee_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",lift_gate]];
             orderinfo = [self replaceHtml:orderinfo String:@"GeneralNotes_or_nbsp" withString:nsgeneral_notes];
@@ -9453,7 +9424,7 @@ if(stockUom==0)
         
         NSDictionary *total_item = @{
             @"title":@"Total",
-            @"value":[NSString stringWithFormat:@"$%.2f",totalPrice*(1-(discount/100.0))]
+            @"value":[NSString stringWithFormat:@"$%.2f",payments_and_credist*(1-(discount/100.0))+ lift_gate + shippingFee + handlingFee]
         };
         
         NSDictionary *discount_item = @{
@@ -11997,7 +11968,7 @@ if(stockUom==0)
                     @"single_select" : @"true"
                 }
             };
-#endif;
+#endif
             [val setObject:sub_item forKey:@"sub_item"];
         }
         
@@ -14702,9 +14673,10 @@ if(stockUom==0)
         [iSalesDB close_db:db];
         
         
-        
+#ifdef DEBUG
         
         DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
+#endif
         dispatch_async(dispatch_get_main_queue(), ^{
             UIApplication * app = [UIApplication sharedApplication];
             AppDelegate *appDelegate = (AppDelegate *)[app delegate];
@@ -15016,9 +14988,9 @@ if(stockUom==0)
         
         
         [iSalesDB close_db:db];
-        
+#ifdef DEBUG
         DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-        
+#endif
         dispatch_async(dispatch_get_main_queue(), ^{
             //            UIApplication * app = [UIApplication sharedApplication];
             //            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
@@ -15168,8 +15140,9 @@ if(stockUom==0)
         
         
         
-        
+#ifdef DEBUG
         DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
+#endif
         dispatch_async(dispatch_get_main_queue(), ^{
             
             result(ret);
@@ -15817,8 +15790,9 @@ if(stockUom==0)
         
         
         [iSalesDB close_db:db];
+#ifdef DEBUG
         DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
-        
+#endif
         dispatch_async(dispatch_get_main_queue(), ^{
             
             
@@ -16139,7 +16113,7 @@ if(stockUom==0)
                 //            NSDate *row_date = [NSDate date];
                 
                 
-                NSMutableDictionary* itemjson = [[NSMutableDictionary alloc] init];
+//                NSMutableDictionary* itemjson = [[NSMutableDictionary alloc] init];
                 
                 
                 

+ 4 - 4
RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m

@@ -57,7 +57,7 @@
             
             //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
             
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
             [self presentViewController:navi animated:YES completion:^{
                 
                 //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -166,7 +166,7 @@
 //                        
 //                        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //                        
-//                        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//                        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //                        [self presentViewController:navi animated:YES completion:^{
 //                            
 //                            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -197,7 +197,7 @@
 //                            
 //                            //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //                            
-//                            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//                            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //                            [self presentViewController:navi animated:YES completion:^{
 //                                
 //                                //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -252,7 +252,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);

+ 38 - 14
RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.m

@@ -394,24 +394,48 @@
     
 }
 
-- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
+
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
+{
     
-    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Delete" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
-        
-        NSDictionary *dic = [self.mergeList objectAtIndex:indexPath.row];
-        [self.mergeList removeObject:dic];
+    UIContextualAction* deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
+    
+    NSDictionary *dic = [self.mergeList objectAtIndex:indexPath.row];
+    [self.mergeList removeObject:dic];
 //        self.mergeTo = nil;
-        NSString *order_id = [NSString stringWithFormat:@"%@",[dic objectForKey:@"order_id"]];
-        if (self.deleteBlock) {
-            self.deleteBlock(order_id);
-        }
-        
-        
-        [tableView reloadData];
-    }];
+    NSString *order_id = [NSString stringWithFormat:@"%@",[dic objectForKey:@"order_id"]];
+    if (self.deleteBlock) {
+        self.deleteBlock(order_id);
+    }
     
-    return @[deleteAction];
+    
+    [tableView reloadData];
+}];
+   return  [UISwipeActionsConfiguration configurationWithActions:@[deleteAction]];
 }
+//
+//
+//- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
+//    
+////    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Delete" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+//        
+//        
+//        UIContextualAction* deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
+//        
+//        NSDictionary *dic = [self.mergeList objectAtIndex:indexPath.row];
+//        [self.mergeList removeObject:dic];
+////        self.mergeTo = nil;
+//        NSString *order_id = [NSString stringWithFormat:@"%@",[dic objectForKey:@"order_id"]];
+//        if (self.deleteBlock) {
+//            self.deleteBlock(order_id);
+//        }
+//        
+//        
+//        [tableView reloadData];
+//    }];
+//    
+//    return @[deleteAction];
+//}
 
 //- (BOOL
 - (void)onCloseClick:(id)sender {

+ 6 - 4
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -11,7 +11,7 @@
 #import "MainViewController.h"
 #import "RASingleton.h"
 #import "config.h"
-#import "CustomIOSAlertView.h"
+//#import "CustomIOSAlertView.h"
 #import "AddressEditorViewController.h"
 #import "CreditCardEditorViewController.h"
 #import "JKTimerManager.h"
@@ -36,6 +36,7 @@
 
 - (void)onScanSwitchUserTypeClick:(id)sender
 {
+#ifdef SCANNER_ORDER
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString *orderdir =[OLDataProvider getScanPath];
     
@@ -375,7 +376,7 @@
     
  
 
-    
+#endif
 }
 - (void)alertMessage:(NSString *)msg {
     
@@ -833,7 +834,7 @@
         
         [alertController addAction:okAction];
         UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-            NSLog(@"Canelled");
+            DebugLog(@"Canelled");
         }];
         [alertController addAction:cancelAction];
         [self presentViewController:alertController animated:YES completion:nil];
@@ -2427,6 +2428,7 @@
         [RANetwork request_commit_order:upparams completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* editor_json =result;
 //                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
                         
@@ -3453,7 +3455,7 @@
                         }
                         [self prepareReturn:value];
                         
-                        __block UIViewController* message_parent = self.navigationController.topViewController;
+//                        __block UIViewController* message_parent = self.navigationController.topViewController;
                         [self.navigationController popToRootViewControllerAnimated:true];
                         if(pdf_url.length>0)
                         {

+ 1 - 1
RedAnt ERP Mobile/common/Functions/order/OrderDetailModelCell.m

@@ -47,7 +47,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [vc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);

+ 18 - 18
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -1968,9 +1968,9 @@
         cell.wkwebview.userInteractionEnabled = YES;
         
         cell.html =[section valueForKey:@"data"];
-        NSLog(@"wkwebview loadHTMLString 0");
+        DebugLog(@"wkwebview loadHTMLString 0");
         [cell.wkwebview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
-        NSLog(@"wkwebview loadHTMLString 1");
+        DebugLog(@"wkwebview loadHTMLString 1");
 
         return cell;
     } else if ([type isEqualToString:@"sign_url"]) { /** Sign */
@@ -2090,9 +2090,9 @@
         
         
         
-        NSLog(@"wkwebview loadHTMLString 3");
+        DebugLog(@"wkwebview loadHTMLString 3");
         [cell.wkwebview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
-        NSLog(@"wkwebview loadHTMLString 4");
+        DebugLog(@"wkwebview loadHTMLString 4");
         
         cell.backgroundColor = [UIColor whiteColor];
         return cell;
@@ -2362,9 +2362,9 @@
         cell.wkwebview.userInteractionEnabled = YES;
         
         cell.html =[section valueForKey:@"data"];
-        NSLog(@"wkwebview loadHTMLString 0");
+        DebugLog(@"wkwebview loadHTMLString 0");
         [cell.wkwebview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
-        NSLog(@"wkwebview loadHTMLString 1");
+        DebugLog(@"wkwebview loadHTMLString 1");
 
         return cell;
     } else if ([type isEqualToString:@"sign_url"]) { /** Sign */
@@ -2484,9 +2484,9 @@
               
               
               
-              NSLog(@"wkwebview loadHTMLString 3");
+              DebugLog(@"wkwebview loadHTMLString 3");
               [cell.wkwebview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
-              NSLog(@"wkwebview loadHTMLString 4");
+              DebugLog(@"wkwebview loadHTMLString 4");
               
               cell.backgroundColor = [UIColor whiteColor];
               return cell;
@@ -2887,9 +2887,9 @@
                           
                           
                           
-                          NSLog(@"wkwebview loadHTMLString 3");
+                          DebugLog(@"wkwebview loadHTMLString 3");
                           [cell.wkwebview loadHTMLString:[self.content_data valueForKey:@"more_order_info"] baseURL:nil];
-                          NSLog(@"wkwebview loadHTMLString 4");
+                          DebugLog(@"wkwebview loadHTMLString 4");
                           
                           cell.backgroundColor = [UIColor whiteColor];
                           return cell;
@@ -3329,17 +3329,17 @@
 - (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
 {
     //    message.body  --  Allowed types are NSNumber, NSString, NSDate, NSArray,NSDictionary, and NSNull.
-    NSLog(@"%@",message.name);
-    NSLog(@"body:%@",message.body);
+    DebugLog(@"%@",message.name);
+    DebugLog(@"body:%@",message.body);
 }
 #pragma mark - WKNavigationDelegate
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
 {
-     NSLog(@"wkwebview didFinishNavigation");
+     DebugLog(@"wkwebview didFinishNavigation");
     
 //    [webView  evaluateJavaScript:@"document.documentElement.outerHTML.toString()" completionHandler:^(id _Nullable html ,NSError * _Nullable error) {
 //
-//        NSLog(html);
+//        DebugLog(html);
 //        }];
         
         UITableViewCell *cell  = (UITableViewCell *)[[webView superview] superview];
@@ -3370,11 +3370,11 @@
         
     [webView  evaluateJavaScript:@"document.body.scrollHeight;" completionHandler:^(id _Nullable fitHeight,NSError * _Nullable error) {
         
-        NSLog(@"wkwebview evaluateJavaScript");
+        DebugLog(@"wkwebview evaluateJavaScript");
         CGRect frame = webView.frame;
        if(height==[fitHeight floatValue])
             {
-                NSLog(@"wkwebview return no need reload table");
+                DebugLog(@"wkwebview return no need reload table");
                 
                 
                  return;
@@ -3390,13 +3390,13 @@
         else
             self.web_moreinfo_height = frame.size.height;
          
-        NSLog(@"wkwebview need call table reload");
+        DebugLog(@"wkwebview need call table reload");
         
         
         dispatch_async(dispatch_get_main_queue(), ^{
             
             
-            NSLog(@"reload tableview!!! %f",frame.size.height);
+            DebugLog(@"reload tableview!!! %f",frame.size.height);
             // UI更新代码
     //         [self.detailTable reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
 //            [self.detailTable reloadData];

+ 24 - 12
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -1256,8 +1256,8 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
-
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     
     // 添加一个删除按钮
@@ -1266,7 +1266,8 @@
     
     
     if(indexPath.row==self.content_data.count)
-        return @[];
+//        return @[];
+        return  [UISwipeActionsConfiguration configurationWithActions:@[]];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString* so= [self.content_data[indexPath.row] valueForKey:@"so#"];
     NSString* orderid= [self.content_data[indexPath.row] valueForKey:@"order_id"];
@@ -1275,7 +1276,8 @@
     
     if(appDelegate.user_type==USER_ROLE_EMPLOYEE || (appDelegate.user_type==USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer)) {
 
-        UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//        UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+            UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
             
             DebugLog(@"delete click");
             
@@ -1369,8 +1371,11 @@
         deleteRowAction.backgroundColor = UIColorFromRGB(0x336699);
         
         // 添加一个编辑按钮
-        
-        UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Cancel Order"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//
+//        UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Cancel Order"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+            
+            
+            UIContextualAction* cancelAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Cancel Order" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
             
             DebugLog(@"edit click");
             
@@ -1466,7 +1471,8 @@
         
         
         if(/*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1&&appDelegate.can_cancel_order)
-            return @[cancelAction];
+//            return @[cancelAction];
+            return  [UISwipeActionsConfiguration configurationWithActions:@[cancelAction]];
         
         else
         {
@@ -1477,7 +1483,8 @@
                     [arr addObject:deleteRowAction];
                 if(appDelegate.can_cancel_order)
                     [arr addObject:cancelAction];
-                return arr;
+//                return arr;
+                return  [UISwipeActionsConfiguration configurationWithActions:arr];
             }
         }
         
@@ -1486,8 +1493,10 @@
     } else if (appDelegate.user_type==USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
 
-        // Cancel Order Action
-        UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Cancel Order"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//        // Cancel Order Action
+//        UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Cancel Order"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//
+            UIContextualAction* cancelAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"Cancel Order" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
             
             DebugLog(@"edit click");
             
@@ -1577,10 +1586,13 @@
         if(/*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1&&appDelegate.can_cancel_order)
             [actionArr addObject:cancelAction];
         
-        return actionArr;
+//        return actionArr;
+        return  [UISwipeActionsConfiguration configurationWithActions:actionArr];
     }
     
-    return @[];
+//    return @[];
+    
+    return  [UISwipeActionsConfiguration configurationWithActions:@[]];
     
 }
 

+ 3 - 3
RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m

@@ -342,7 +342,7 @@ static const int totalPage = 3;
         return;
     }
     // 结束编辑防止TextFiled在编辑中时返回,Table会Reload,此时TextFiled会结束编辑,但是Data已经改变。
-    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
+    [[RAUtils keyWindow] endEditing:YES];
     
     self.pageIndex--;
     
@@ -378,7 +378,7 @@ static const int totalPage = 3;
         return;
     }
     // 结束编辑防止TextFiled在编辑中时下一页,Table会Reload,此时TextFiled会结束编辑,但是Data已经改变。
-    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
+    [[RAUtils keyWindow]endEditing:YES];
     
     NSMutableDictionary* upparams = [self check_cancommit:true]; // 当前页上行参数
     if(self.cancommit==false)
@@ -823,7 +823,7 @@ static const int totalPage = 3;
         float handling_fee_value = [self getprice:@"handling_fee_value" section:indexPath.section];
         float lift_gate =[self getprice:@"lift_gate_value" section:indexPath.section];
         float tax = [self getprice:@"tax_percentage" section:indexPath.section]/100.0*paymentsAndCredits;
-        float totalprice=shipping+paymentsAndCredits+handling_fee_value+lift_gate+tax-order_discount;
+        float totalprice=shipping+paymentsAndCredits+handling_fee_value+lift_gate+tax+order_discount;
         
         section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
         int count=0;

+ 1 - 1
RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m

@@ -11,7 +11,7 @@
 #import "MainViewController.h"
 #import "RASingleton.h"
 #import "config.h"
-#import "CustomIOSAlertView.h"
+//#import "CustomIOSAlertView.h"
 #import "AddressEditorViewController.h"
 #import "CreditCardEditorViewController.h"
 #import "JKTimerManager.h"

+ 10 - 5
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m

@@ -612,13 +612,15 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
-
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     
     NSString* listid= [self.content_data[indexPath.row] valueForKey:@"tearsheetsId"];
     
-    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         
         DebugLog(@"delete click");
         
@@ -701,9 +703,12 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if([create_user isEqualToString:appDelegate.user])
     {
-         return @[deleteRowAction];
+//         return @[deleteRowAction];
+        return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
     }
-    return @[];
+//    return @[];
+    
+    return  [UISwipeActionsConfiguration configurationWithActions:@[]];
 
     
     

+ 23 - 13
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -169,7 +169,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [self presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -920,7 +920,7 @@
             
             //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
             
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
             [parentvc presentViewController:navi animated:YES completion:^{
                 
                 //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1017,7 +1017,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [parentvc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1444,7 +1444,8 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 
 {
     
@@ -1454,7 +1455,10 @@
 //    ModelItemCell * cell = [tableView cellForRowAtIndexPath:indexPath];
     
     
-    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        
+        UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         
         DebugLog(@"delete click");
         self.deleteIndexPath = indexPath;
@@ -1541,7 +1545,9 @@
     
     // edit qty
     
-    UITableViewRowAction *EditQTYAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"   Edit   " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *EditQTYAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"   Edit   " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        UIContextualAction* EditQTYAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"   Edit   " handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         
         DebugLog(@"edit click");
         
@@ -1651,7 +1657,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [parentvc presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1688,24 +1694,28 @@
             [arr addObject:EditQTYAction];
         }
         
-        return arr;
+//        return arr;
+        return  [UISwipeActionsConfiguration configurationWithActions:arr];
       //  return @[deleteRowAction, editRowAction];
     }
     else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
         if (appDelegate.customer_type == CustomerTypeStore) {
-            return @[deleteRowAction];
+//            return @[deleteRowAction];
+            return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
         } else {
             
             if(appDelegate.can_set_tearsheet_price) {
-                return @[deleteRowAction,EditQTYAction];
+//                return @[deleteRowAction,EditQTYAction];
+                return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction,EditQTYAction]];
             } else {
-                return @[deleteRowAction];
+//                return @[deleteRowAction];
+                return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
             }
         }
     }
     else
-    return @[deleteRowAction];
-    
+//    return @[deleteRowAction];
+    return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
     
 }
 

+ 10 - 10
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchFilterViewController.m

@@ -826,7 +826,7 @@
 
 - (void)keyboardDidChangeFrame:(NSNotification *)notification {
 //    return;
-    NSLog(@"keyboardDidChangeFrame");
+    DebugLog(@"keyboardDidChangeFrame");
     
     
     // 使用tableContainer计算frame 保证屏幕旋转后table height正确
@@ -838,10 +838,10 @@
     //    //    duration *= 0.0;
     CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
     CGFloat keyboard_top = end.origin.y;
-    NSLog(@"keyboard rect: %@",NSStringFromCGRect(end));
+    DebugLog(@"keyboard rect: %@",NSStringFromCGRect(end));
     
-    NSLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
-    NSLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
+    DebugLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
+    DebugLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
     
     //    self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
     
@@ -866,7 +866,7 @@
 }
 //- (void)keyboardWillChangeFrame:(NSNotification *)notification {
 ////    return;
-//    NSLog(@"keyboardWillChangeFrame");
+//    DebugLog(@"keyboardWillChangeFrame");
 //
 //
 //    // 使用tableContainer计算frame 保证屏幕旋转后table height正确
@@ -878,10 +878,10 @@
 //    //    //    duration *= 0.0;
 //    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
 //    CGFloat keyboard_top = end.origin.y;
-//    NSLog(@"keyboard rect: %@",NSStringFromCGRect(end));
+//    DebugLog(@"keyboard rect: %@",NSStringFromCGRect(end));
 //
-//    NSLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
-//    NSLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
+//    DebugLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
+//    DebugLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
 //
 //    //    self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
 //
@@ -908,11 +908,11 @@
 //static float table_origin_h = 0;
 
 - (void)keyboardWillShow:(NSNotification *)notification {
-    NSLog(@"keyboardWillShow");
+    DebugLog(@"keyboardWillShow");
     
 }
 - (void)keyboardWillHide:(NSNotification *)notification {
-    NSLog(@"keyboardWillHide");
+    DebugLog(@"keyboardWillHide");
     
  
 }

+ 8 - 8
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -436,7 +436,7 @@
     
     
 //    navi.preferredContentSize = CGSizeMake(540, 680);
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [self presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -490,7 +490,7 @@
     
     [self checkToolBar];
 
-    self.toOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+    self.toOrientation = [RAUtils query_orientation:self];[RAUtils query_orientation:self];//[[UIApplication sharedApplication] statusBarOrientation];
 
     [self.collectionview layoutIfNeeded];
 }
@@ -824,7 +824,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [self presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -964,7 +964,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1016,7 +1016,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1647,7 +1647,7 @@
     } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
         
         self.headerView.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.headerView.bounds].CGPath;
-            self.toOrientation = [UIApplication sharedApplication].statusBarOrientation;
+        self.toOrientation = [RAUtils query_orientation:self];//[UIApplication sharedApplication].statusBarOrientation;
         [self.collectionview.collectionViewLayout invalidateLayout];
     }];
 }
@@ -1931,7 +1931,7 @@
         }
         else
         {
-            NSLog(@"load image");
+            DebugLog(@"load image");
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                 
                 NSData*  downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
@@ -2001,7 +2001,7 @@
 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
 {
     
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//[[UIApplication sharedApplication]statusBarOrientation];
     
     orientation = self.toOrientation;
     

+ 7 - 7
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -221,7 +221,7 @@
     [self checkToolBar];
     [self checkSearchBar];
     
-    self.toOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+    self.toOrientation = [RAUtils query_orientation:self];//[[UIApplication sharedApplication] statusBarOrientation];
     [self.collectionview layoutIfNeeded];
 }
 
@@ -625,7 +625,7 @@
     //
     //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
     //
-    //        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    //        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     //        [self presentViewController:navi animated:YES completion:^{
     //
     //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -784,7 +784,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -836,7 +836,7 @@
         
         //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
         
-        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
             
             //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -1607,7 +1607,7 @@
     } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
         
         self.headerView.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.headerView.bounds].CGPath;
-        self.toOrientation = [UIApplication sharedApplication].statusBarOrientation;
+        self.toOrientation = [RAUtils query_orientation:self];//[UIApplication sharedApplication].statusBarOrientation;
         [self.collectionview.collectionViewLayout invalidateLayout];
     }];
 }
@@ -1939,7 +1939,7 @@
         }
         else
         {
-            NSLog(@"load image");
+            DebugLog(@"load image");
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                 
                 NSData*  downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
@@ -2010,7 +2010,7 @@
 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
 {
     
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+    UIInterfaceOrientation orientation = [RAUtils query_orientation:self];//[[UIApplication sharedApplication]statusBarOrientation];
     
     orientation = self.toOrientation;
     

+ 31 - 3
RedAnt ERP Mobile/common/Functions/sidemenu/FunctionTestViewController.m

@@ -9,6 +9,7 @@
 #import "FunctionTestViewController.h"
 #import "RAUtils.h"
 #import "AppDelegate.h"
+#import "SignatureViewController.h"
 
 @interface FunctionTestViewController ()
 
@@ -24,6 +25,33 @@
     
 self.airPrinterController = [UIPrintInteractionController sharedPrintController];
 }
+- (IBAction)onSignature:(id)sender {
+    //        SignatureViewController * signvc =[ [UIStoryboard storyboardWithName:@"signature" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"SignatureViewController"];
+    //        signvc.title = [item_json valueForKey:@"aname"];
+    //        signvc.indexPath = indexPath;
+    //        //        signvc.delegate = self;
+    //        CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [self.editorTable cellForRowAtIndexPath:indexPath];
+    //
+    //        signvc.existSignature = cell.imageviewSignature.image ;
+    //
+    //
+    //
+    //        [self.navigationController pushViewController:signvc animated:true];
+
+    __block UIImage* signimg=nil;
+    SignatureViewController * vc =[ [UIStoryboard storyboardWithName:@"signature" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"SignatureViewController"];
+    __weak typeof(self) weakself = self;
+    vc.onReturnImg = ^(UIImage* img)
+    {
+        signimg = img;
+        
+    
+        
+    };
+    
+    
+    [self.navigationController pushViewController:vc animated:NO];
+}
 - (void)viewWillAppear:(BOOL)animated
 {
     
@@ -72,7 +100,7 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
     
     void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
         if(completed && error)
-            NSLog(@"Printing failed due to error in domain %@ with error code %lu. Localized description: %@, and failure reason: %@", error.domain, (long)error.code, error.localizedDescription, error.localizedFailureReason);
+            DebugLog(@"Printing failed due to error in domain %@ with error code %lu. Localized description: %@, and failure reason: %@", error.domain, (long)error.code, error.localizedDescription, error.localizedFailureReason);
     };
     UIPrinter *airPrinter = [UIPrinter printerWithURL:self.printerURL];///*self.printer;*/
     
@@ -85,11 +113,11 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
          {
              
              [self.airPrinterController printToPrinter:airPrinter completionHandler:completionHandler];
-             NSLog(@"AIRPRINTER AVAILABLE");
+             DebugLog(@"AIRPRINTER AVAILABLE");
          }
          else
          {
-             NSLog(@"AIRPRINTER NOT AVAILABLE");
+             DebugLog(@"AIRPRINTER NOT AVAILABLE");
          }
      }];
     

+ 1 - 1
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -400,7 +400,7 @@
                                     
                                     //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
                                     
-                                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                                    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
                                     [appDelegate.main_vc presentViewController:navi animated:YES completion:^{
                                         
                                         

+ 31 - 0
RedAnt ERP Mobile/common/Functions/signature/AAPLShaderTypes.h

@@ -0,0 +1,31 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+Header containing types and enum constants shared between Metal shaders and C/ObjC source
+*/
+
+#ifndef AAPLShaderTypes_h
+#define AAPLShaderTypes_h
+
+#include <simd/simd.h>
+
+// Buffer index values shared between shader and C code to ensure Metal shader buffer inputs
+// match Metal API buffer set calls.
+typedef enum AAPLVertexInputIndex
+{
+    AAPLVertexInputIndexVertices     = 0,
+    AAPLVertexInputIndexViewportSize = 1,
+} AAPLVertexInputIndex;
+
+//  This structure defines the layout of vertices sent to the vertex
+//  shader. This header is shared between the .metal shader and C code, to guarantee that
+//  the layout of the vertex array in the C code matches the layout that the .metal
+//  vertex shader expects.
+typedef struct
+{
+    vector_float2 position;
+    vector_float4 color;
+} AAPLVertex;
+
+#endif /* AAPLShaderTypes_h */

+ 62 - 0
RedAnt ERP Mobile/common/Functions/signature/AAPLShaders.metal

@@ -0,0 +1,62 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+Metal shaders used for this sample
+*/
+
+#include <metal_stdlib>
+
+using namespace metal;
+
+// Include header shared between this Metal shader code and C code executing Metal API commands.
+#include "AAPLShaderTypes.h"
+
+// Vertex shader outputs and fragment shader inputs
+struct RasterizerData
+{
+    // The [[position]] attribute of this member indicates that this value
+    // is the clip space position of the vertex when this structure is
+    // returned from the vertex function.
+    float4 position [[position]];
+
+    // Since this member does not have a special attribute, the rasterizer
+    // interpolates its value with the values of the other triangle vertices
+    // and then passes the interpolated value to the fragment shader for each
+    // fragment in the triangle.
+    float4 color;
+};
+
+vertex RasterizerData
+vertexShader(uint vertexID [[vertex_id]],
+             constant AAPLVertex *vertices [[buffer(AAPLVertexInputIndexVertices)]],
+             constant vector_uint2 *viewportSizePointer [[buffer(AAPLVertexInputIndexViewportSize)]])
+{
+    RasterizerData out;
+
+    // Index into the array of positions to get the current vertex.
+    // The positions are specified in pixel dimensions (i.e. a value of 100
+    // is 100 pixels from the origin).
+    float2 pixelSpacePosition = vertices[vertexID].position.xy;
+
+    // Get the viewport size and cast to float.
+    vector_float2 viewportSize = vector_float2(*viewportSizePointer);
+    
+
+    // To convert from positions in pixel space to positions in clip-space,
+    //  divide the pixel coordinates by half the size of the viewport.
+    out.position = vector_float4(0.0, 0.0, 0.0, 1.0);
+    out.position.xy = pixelSpacePosition / (viewportSize / 2.0);
+
+    // Pass the input color directly to the rasterizer.
+    out.color = vertices[vertexID].color;
+
+    return out;
+}
+
+fragment float4 fragmentShader(RasterizerData in [[stage_in]])
+{
+    // Return the interpolated color.
+    return in.color;
+}
+

+ 26 - 0
RedAnt ERP Mobile/common/Functions/signature/SViewController.h

@@ -0,0 +1,26 @@
+//
+//  SViewController.h
+//  HelloTriangle
+//
+//  Created by Rui Zhang on 4/27/23.
+//  Copyright © 2023 Apple. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "SignatureViewM.h"
+NS_ASSUME_NONNULL_BEGIN
+@class SignatureViewController;
+@protocol SignatureViewControllerDelegate <NSObject>
+
+-(void) SignatureVCReturnImage:(UIImage *)image indexPath :(NSIndexPath*) indexPath;
+-(void) SignatureVCReturnData:(NSData *)imagedata indexPath :(NSIndexPath*) indexPath;
+@end
+@interface SViewController : UIViewController<UITextFieldDelegate>
+@property (strong, nonatomic) IBOutlet SignatureViewM *signatureView;
+@property (nonatomic, weak) id<SignatureViewControllerDelegate> Signaturedelegate;
+@property int linewidth;
+@property (strong,nonatomic) NSIndexPath *indexPath;
+@property (nonatomic , copy) void (^onReturnImg)(UIImage* img);
+@end
+
+NS_ASSUME_NONNULL_END

+ 200 - 0
RedAnt ERP Mobile/common/Functions/signature/SViewController.m

@@ -0,0 +1,200 @@
+//
+//  SViewController.m
+//  HelloTriangle
+//
+//  Created by Rui Zhang on 4/27/23.
+//  Copyright © 2023 Apple. All rights reserved.
+//
+#define INTNUMBERS @"0123456789\n"
+#import "SViewController.h"
+#import "const.h"
+
+@interface SViewController ()
+
+@end
+
+@implementation SViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    self.navigationItem.title = self.title;
+    
+    if(self.linewidth==0)
+        self.linewidth=5;
+    
+    
+    [self.signatureView setLineWidth:self.linewidth];
+    UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                                    style:UIBarButtonItemStylePlain
+                                                                   target:self
+                                                                   action:@selector( onBackClick:)];
+    
+ //   closeButton.tintColor = UIColorFromRGB(0x996633);
+    self.navigationItem.leftBarButtonItem=closeButton;
+    
+    
+    UIBarButtonItem *clearBtn=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"clear"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                               style:UIBarButtonItemStylePlain
+                                                              target:self
+                                                              action:@selector( onClear:)];
+     //   clearBtn.tintColor = UIColorFromRGB(0x996633);
+    UIBarButtonItem *doneBtn=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"save"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                              style:UIBarButtonItemStylePlain
+                                                             target:self
+                                                             action:@selector( onDone:)];
+     //   doneBtn.tintColor = UIColorFromRGB(0x996633);
+    
+    //  id aa = self.navigationItem;
+    
+    //  self.navi_item.title = @"ttttt";
+    
+    //  self.navigationItem.rightBarButtonItem = searchButton;
+    
+    UIBarButtonItem * settingBtn =[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"signature_setting"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                                   style:UIBarButtonItemStylePlain
+                                                                  target:self
+                                                                  action:@selector( onSetting:)];
+    
+//    UIBarButtonItem * settingBtn =[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
+//                                                                 target:self
+//                                                                 action:@selector( onSetting:)];
+    
+    
+    
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+        self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:doneBtn,clearBtn , nil];
+    } else {
+        self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:doneBtn,clearBtn,settingBtn , nil];
+    }
+
+    [self.navigationController.navigationBar layoutIfNeeded];
+    
+}
+
+- (void)onBackClick:(UIButton *)sender {
+    
+    
+    [self.navigationController popViewControllerAnimated:FALSE];
+}
+
+
+
+- (void)onSetting:(UIButton *)sender {
+    
+    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Change line width" message:nil preferredStyle:UIAlertControllerStyleAlert];
+    //block代码块取代了delegate
+    
+    
+    [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
+        textField.text = [NSString stringWithFormat:@"%d",self.linewidth];
+        textField.keyboardType=UIKeyboardTypeNumberPad;
+        textField.delegate = self;
+        
+        
+    }];
+    
+    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Save" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+        if(self.linewidth>16||self.linewidth<1)
+        {
+            int newlinewidth = 0;
+            if(self.linewidth>16)
+            {
+                self.linewidth = 16;
+                newlinewidth=16;
+            }
+            else if(self.linewidth<1)
+            {
+                self.linewidth = 1;
+                newlinewidth=1;
+            }
+
+            
+            
+//            [RAUtils message_box:@"Line width should between 1 and 16" message:[NSString stringWithFormat:@"Line width has been set to %d.",newlinewidth]  completion:nil];
+        }
+        
+            [self.signatureView setLineWidth:self.linewidth];
+
+    }];
+    
+    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+       // DebugLog(@"Cancel");
+    }];
+    [alertControl addAction:actionOne];
+    
+    [alertControl addAction:alertthree];
+    
+    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+    
+    
+    [self presentViewController:alertControl animated:YES completion:nil];
+    
+}
+
+- (void)onDone:(UIButton *)sender {
+    
+    DebugLog(@"onDone");
+    
+    UIImage* img = [self.signatureView signatureImage];
+
+//    return ;
+//    CGSize imgsize = img.size;
+//    NSData* data = [self.signatureView signatureData];
+//    
+//   if (self.Signaturedelegate && [self.Signaturedelegate respondsToSelector:@selector(SignatureVCReturnImage:indexPath:)]) {
+//       [self.Signaturedelegate SignatureVCReturnImage:img indexPath:self.indexPath];
+//   }
+//    
+//    if (self.Signaturedelegate && [self.Signaturedelegate respondsToSelector:@selector(SignatureVCReturnData:indexPath:)]) {
+//        [self.Signaturedelegate SignatureVCReturnData:data indexPath:self.indexPath];
+//    }
+
+    
+    
+    [self.navigationController popViewControllerAnimated:true];
+    if(self.onReturnImg)
+        self.onReturnImg(img);
+    //    [self.aBNewPersonNav dismissViewControllerAnimated:true completion:^{
+    //        ;
+    //    }];
+}
+- (void)onClear:(UIButton *)sender {
+    [self.signatureView clear];
+
+}
+
+
+#pragma mark textField delegate
+-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
+    
+     NSCharacterSet *cs;
+
+        cs = [[NSCharacterSet characterSetWithCharactersInString:INTNUMBERS]invertedSet];
+    
+    NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs]componentsJoinedByString:@""];
+    
+    BOOL canChange = [string isEqualToString:filtered];
+    
+   
+    return canChange;
+}
+- (void)textFieldDidEndEditing:(UITextField *)textField
+{
+    
+    self.linewidth = [textField.text intValue];
+  
+    
+}
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 42 - 0
RedAnt ERP Mobile/common/Functions/signature/SignatureRenderer.h

@@ -0,0 +1,42 @@
+//
+//  SignatureRenderer.h
+//  HelloTriangle
+//
+//  Created by Rui Zhang on 4/27/23.
+//  Copyright © 2023 Apple. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+@import MetalKit;
+
+@import simd;
+
+NS_ASSUME_NONNULL_BEGIN
+typedef enum AAPLVertexInputIndex
+{
+    AAPLVertexInputIndexVertices     = 0,
+    AAPLVertexInputIndexViewportSize = 1,
+} AAPLVertexInputIndex;
+
+
+struct PPSSignaturePoint
+{
+//    float        vertex[2]; // 2D positions,
+//    float        color[4]; //RGBA colors,
+    
+    vector_float2 position;
+    vector_float4 color;
+};
+
+typedef struct PPSSignaturePoint PPSSignaturePoint;
+
+@interface SignatureRenderer : NSObject<MTKViewDelegate>
+
+- (nonnull instancetype)initWithMetalKitView:(nonnull MTKView *)mtkView;
+
+@property PPSSignaturePoint* SignatureVertexData;
+@property int vertexTotal;
+@property (strong,nonatomic) NSMutableArray* parts;
+
+@end
+NS_ASSUME_NONNULL_END

+ 193 - 0
RedAnt ERP Mobile/common/Functions/signature/SignatureRenderer.m

@@ -0,0 +1,193 @@
+//
+//  SignatureRenderer.m
+//  HelloTriangle
+//
+//  Created by Rui Zhang on 4/27/23.
+//  Copyright © 2023 Apple. All rights reserved.
+//
+
+#import "SignatureRenderer.h"
+
+
+
+@implementation SignatureRenderer
+{
+    id<MTLDevice> _device;
+
+    // The render pipeline generated from the vertex and fragment shaders in the .metal shader file.
+    id<MTLRenderPipelineState> _pipelineState;
+
+    // The command queue used to pass commands to the device.
+    id<MTLCommandQueue> _commandQueue;
+
+    // The current size of the view, used as an input to the vertex shader.
+    vector_uint2 _viewportSize;
+}
+
+
+- (nonnull instancetype)initWithMetalKitView:(nonnull MTKView *)mtkView
+{
+    self = [super init];
+    if(self)
+    {
+        NSError *error;
+
+        _device = mtkView.device;
+        self.vertexTotal = 10000;
+
+        // Load all the shader files with a .metal file extension in the project.
+        id<MTLLibrary> defaultLibrary = [_device newDefaultLibrary];
+
+        id<MTLFunction> vertexFunction = [defaultLibrary newFunctionWithName:@"vertexShader"];
+        id<MTLFunction> fragmentFunction = [defaultLibrary newFunctionWithName:@"fragmentShader"];
+
+        // Configure a pipeline descriptor that is used to create a pipeline state.
+        MTLRenderPipelineDescriptor *pipelineStateDescriptor = [[MTLRenderPipelineDescriptor alloc] init];
+        pipelineStateDescriptor.label = @"Simple Pipeline";
+        pipelineStateDescriptor.vertexFunction = vertexFunction;
+        pipelineStateDescriptor.fragmentFunction = fragmentFunction;
+        pipelineStateDescriptor.colorAttachments[0].pixelFormat = mtkView.colorPixelFormat;
+        
+//        pipelineStateDescriptor.colorAttachments[0].cle = MTLClearColorMake(1.0, 1.0, 1.0, 1.0);
+
+        _pipelineState = [_device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor
+                                                                 error:&error];
+        
+        
+        
+        
+        // Pipeline State creation could fail if the pipeline descriptor isn't set up properly.
+        //  If the Metal API validation is enabled, you can find out more information about what
+        //  went wrong.  (Metal API validation is enabled by default when a debug build is run
+        //  from Xcode.)
+        NSAssert(_pipelineState, @"Failed to create pipeline state: %@", error);
+
+        // Create the command queue
+        _commandQueue = [_device newCommandQueue];
+    }
+
+    return self;
+}
+
+/// Called whenever view changes orientation or is resized
+- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size
+{
+    // Save the size of the drawable to pass to the vertex shader.
+    _viewportSize.x = size.width;
+    _viewportSize.y = size.height;
+}
+
+/// Called whenever the view needs to render a frame.
+- (void)drawInMTKView:(nonnull MTKView *)view
+{
+//    static const PPSSignaturePoint triangleVertices[] =
+//    {
+//        // 2D positions,    RGBA colors
+//        { {  0,  0 }, { 1, 1, 1, 1 } },
+//        { { 0,  580 }, { 1, 1, 1, 1 } },
+//        { {    580,   580 }, { 1, 1, 1, 1 } },
+//        { {    580,   0 }, { 1, 1, 1, 1 } },
+//        { {  0,  0 }, { 1, 1, 1, 1 } },
+//        { {    290,   -290 }, { 1, 1, 1, 1 } },
+//
+//    };
+
+    
+    
+    
+    // Create a new command buffer for each render pass to the current drawable.
+    id<MTLCommandBuffer> commandBuffer = [_commandQueue commandBuffer];
+    commandBuffer.label = @"MyCommand";
+
+    // Obtain a renderPassDescriptor generated from the view's drawable textures.
+    MTLRenderPassDescriptor *renderPassDescriptor = view.currentRenderPassDescriptor;
+
+    if(renderPassDescriptor != nil)
+    {
+        
+        renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(1.0, 1.0, 1.0, 0.0);
+        // Create a render command encoder.
+        id<MTLRenderCommandEncoder> renderEncoder =
+        [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
+        renderEncoder.label = @"MyRenderEncoder";
+
+        // Set the region of the drawable to draw into.
+        [renderEncoder setViewport:(MTLViewport){0.0, 0.0, _viewportSize.x, _viewportSize.y, 0.0, 1.0 }];
+        
+        [renderEncoder setRenderPipelineState:_pipelineState];
+
+        // Pass in the parameter data.
+//        renderEncoder setvertex
+        ;
+        
+//        for(int i=0;i<self.parts.count;i++)
+//        {
+//            if([self.parts[i] intValue]>0)
+//            {
+//                int begin = 0;
+//                if(i>0)
+//                    begin =[self.parts[i-1] intValue];
+//                int count = [self.parts[i] intValue];
+//                int length = count*sizeof(PPSSignaturePoint);
+//                [renderEncoder setVertexBytes:&self.SignatureVertexData[begin]
+//                                       length:length
+//                                      atIndex:AAPLVertexInputIndexVertices];
+//            }
+//        }
+        
+        
+        
+        id<MTLBuffer> buffer = [view.device newBufferWithBytes:self.SignatureVertexData length:sizeof(PPSSignaturePoint)*self.vertexTotal options:nil];
+        [renderEncoder setVertexBuffer:buffer offset:0 atIndex:0];
+        
+//        id<MTLBuffer> buffer = [view.device newBufferWithBytes:triangleVertices length:sizeof(PPSSignaturePoint)*self.vertexTotal options:nil];
+//        [renderEncoder setVertexBuffer:buffer offset:0 atIndex:0];
+        
+//        [renderEncoder setVertexBytes:triangleVertices
+//                               length:sizeof(PPSSignaturePoint)*100
+//                              atIndex:AAPLVertexInputIndexVertices];
+        
+        [renderEncoder setVertexBytes:&_viewportSize
+                               length:sizeof(_viewportSize)
+                              atIndex:AAPLVertexInputIndexViewportSize];
+
+        // Draw the triangle.
+//        [renderEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip
+//                          vertexStart:0
+//                          vertexCount:6];
+        
+        
+                for(int i=0;i<self.parts.count;i++)
+                {
+                    if([self.parts[i] intValue]>0)
+                    {
+                        int begin = 0;
+                        if(i>0)
+                            begin =[self.parts[i-1] intValue];
+                        int count = [self.parts[i] intValue];
+                        
+                        [renderEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip
+                                          vertexStart:begin
+                                          vertexCount:count];
+//                        int length = count*sizeof(PPSSignaturePoint);
+//                        [renderEncoder setVertexBytes:&self.SignatureVertexData[begin]
+//                                               length:length
+//                                              atIndex:AAPLVertexInputIndexVertices];
+                    }
+                }
+        
+//        [renderEncoder drawPrimitives:MTLPrimitiveTypeTriangle
+//                          vertexStart:1
+//                          vertexCount:3];
+
+        [renderEncoder endEncoding];
+
+        // Schedule a present once the framebuffer is complete using the current drawable.
+        [commandBuffer presentDrawable:view.currentDrawable];
+    }
+
+    // Finalize rendering here & push the command buffer to the GPU.
+    [commandBuffer commit];
+}
+
+@end

+ 3 - 2
RedAnt ERP Mobile/common/Functions/signature/SignatureView.m

@@ -8,6 +8,7 @@
 
 #import "SignatureView.h"
 #import <OpenGLES/ES2/glext.h>
+#import "const.h"
 
 //
 //@interface SignatureView ()
@@ -745,13 +746,13 @@ static PPSSignaturePoint ViewPointToGL(CGPoint viewPoint, CGRect bounds, GLKVect
 
 
 - (void)tap:(UITapGestureRecognizer *)t {
-    NSLog(@"on tap");
+    DebugLog(@"on tap");
     CGPoint l = [t locationInView:self];
     [self updateRectWithPoint:l];
     if (t.state == UIGestureRecognizerStateRecognized) {
         
         self.isSigned = YES;
-        NSLog(@"UIGestureRecognizerStateRecognized");
+        DebugLog(@"UIGestureRecognizerStateRecognized");
         glBindBuffer(GL_ARRAY_BUFFER, dotsBuffer);
         
         PPSSignaturePoint touchPoint = ViewPointToGL(l, self.bounds, (GLKVector3){1, 1, 1});

+ 1 - 1
RedAnt ERP Mobile/common/Functions/signature/SignatureViewController.m

@@ -213,7 +213,7 @@
 }
 - (void)onDone:(UIButton *)sender {
     
-    NSLog(@"onDone");
+    DebugLog(@"onDone");
     
     UIImage* img = [self.signatureView signatureImage];
 

+ 39 - 0
RedAnt ERP Mobile/common/Functions/signature/SignatureViewM.h

@@ -0,0 +1,39 @@
+//
+//  SignatureViewM.h
+//  HelloTriangle
+//
+//  Created by Rui Zhang on 4/20/23.
+//  Copyright © 2023 Apple. All rights reserved.
+//
+
+#import <MetalKit/MetalKit.h>
+
+#import "SignatureRenderer.h"
+NS_ASSUME_NONNULL_BEGIN
+#define MAX_LINEWIDTH 12
+
+@interface SignatureViewM : MTKView
+
+@property (nonatomic, strong) UIColor *foregroundLineColor;
+@property (nonatomic, strong) UIColor *backgroundLineColor;
+
+@property (nonatomic, assign) CGFloat foregroundLineWidth;
+@property (nonatomic, assign) CGFloat backgroundLineWidth;
+
+@property (nonatomic, assign) CGFloat MaxLineWidth;
+@property (nonatomic, assign) CGFloat MinLineWidth;
+
+@property (assign, nonatomic) UIColor *strokeColor;
+@property (assign, nonatomic) BOOL isSigned;
+//@property (strong, nonatomic) UIImage *signatureImage;
+
+- (UIImage *)signatureImage;
+- (NSData *)signatureData;
+- (void)setLineWidth:(CGFloat)width;
+//@property(nonatomic,copy)OkClick okClick;
+// 清除
+- (void)clear;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 716 - 0
RedAnt ERP Mobile/common/Functions/signature/SignatureViewM.m

@@ -0,0 +1,716 @@
+//
+//  SignatureViewM.m
+//  HelloTriangle
+//
+//  Created by Rui Zhang on 4/20/23.
+//  Copyright © 2023 Apple. All rights reserved.
+//
+
+#import "SignatureViewM.h"
+#import "const.h"
+//#import "AAPLRenderer.h"
+#define       STROKE_WIDTH_SMOOTHING 0.5   // Low pass filter alpha
+
+#define           VELOCITY_CLAMP_MIN 20
+#define           VELOCITY_CLAMP_MAX 5000
+
+#define QUADRATIC_DISTANCE_TOLERANCE 3.0   // Minimum distance to make a curve
+
+#define             MAXIMUM_VERTECES 100000
+
+static vector_float4 StrokeColor  = { 0, 0, 0, 1 };
+static vector_float4 clearColor = { 1, 1, 1, 0 };
+
+//typedef struct
+//{
+//
+//} AAPLVertex;
+
+
+
+static const uint maxLength = MAXIMUM_VERTECES;
+
+
+
+static inline void addVertex(uint *Totallength,NSMutableArray *partlength, PPSSignaturePoint v,PPSSignaturePoint* dest) {
+    if ((*Totallength) >= maxLength) {
+        return;
+    }
+    
+    
+    dest[*Totallength]=v;
+//
+//    GLvoid *data = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
+//    memcpy(data + sizeof(PPSSignaturePoint) * (*length), &v, sizeof(PPSSignaturePoint));
+//    glUnmapBufferOES(GL_ARRAY_BUFFER);
+//
+    
+    partlength[partlength.count-1]=@([partlength[partlength.count-1] intValue] +1);
+    
+    
+    
+    
+    
+    (*Totallength)++;
+    
+#ifdef DEBUG
+    NSLog(@"dest %p     total %d     part %ld ,partlength %@  vertex  (%f,%f)(%f,%f,%f,%f)",dest,*Totallength,partlength.count-1, partlength[partlength.count-1],v.position[0],v.position[1],v.color[0],v.color[1],v.color[2],v.color[3]);
+#endif
+    
+}
+
+
+static inline CGPoint QuadraticPointInCurve(CGPoint start, CGPoint end, CGPoint controlPoint, float percent) {
+    double a = pow((1.0 - percent), 2.0);
+    double b = 2.0 * percent * (1.0 - percent);
+    double c = pow(percent, 2.0);
+    
+    return (CGPoint) {
+        a * start.x + b * controlPoint.x + c * end.x,
+        a * start.y + b * controlPoint.y + c * end.y
+    };
+}
+
+static float generateRandom(float from, float to) { return random() % 10000 / 10000.0 * (to - from) + from; }
+static float clamp(float min, float max, float value) { return fmaxf(min, fminf(max, value)); }
+
+
+// Find perpendicular vector from two other vectors to compute triangle strip around line
+static vector_float2 perpendicular(PPSSignaturePoint p1, PPSSignaturePoint p2) {
+    
+    vector_float2 ret={0,0};
+//    GLKVector3 ret;
+    ret[0] = p2.position[1] - p1.position[1];
+    ret[1] = -1 * (p2.position[0] - p1.position[0]);
+    
+    return ret;
+}
+
+
+static PPSSignaturePoint ViewPointToMTK(CGPoint viewPoint, CGSize view_size,CGSize drawable_size ,vector_float4 color) {
+    
+    vector_float2 inverseViewSize={1.0f / view_size.width, 1.0f / view_size.height}; // passed in a buffer
+    float clipX = (2.0f * viewPoint.x * inverseViewSize.x) - 1.0f;
+    float clipY = (2.0f * -viewPoint.y * inverseViewSize.y) + 1.0f;
+    
+    
+    return (PPSSignaturePoint) {
+        {
+            clipX*drawable_size.width/2,
+            clipY*drawable_size.height/2
+        },
+        {color[0],color[1],color[2],color[3]}
+    };
+    
+    
+    
+    
+//
+
+//    float4 clipPosition(clipX, clipY, 0.0f, 1.0f);
+}
+
+@interface SignatureViewM ()
+@property(nonatomic,assign)CGPoint mixPoint;
+@property(nonatomic,assign)CGPoint maxPoint;
+
+//@property (assign, nonatomic) NSMutableArray *drawable;
+
+@end
+
+
+@interface SignatureViewM () {
+    // OpenGL state
+//    EAGLContext *context;
+//    GLKBaseEffect *effect;
+    
+//    GLuint vertexArray;
+//    GLuint vertexBuffer;
+//    GLuint dotsArray;
+//    GLuint dotsBuffer;
+//
+    
+    // Array of verteces, with current length
+    PPSSignaturePoint SignatureVertexData[maxLength];
+    uint vertexTotal;
+    NSMutableArray* vertexLength;
+    
+    PPSSignaturePoint SignatureDotsData[maxLength];
+    uint dotsTotal;
+//    NSMutableArray* dotsLength;
+    
+    // Width of line at current and previous vertex
+    float penThickness;
+    float previousThickness;
+    
+    
+    // Previous points for quadratic bezier computations
+    CGPoint previousPoint;
+    CGPoint previousMidPoint;
+    PPSSignaturePoint previousVertex;
+    PPSSignaturePoint currentVelocity;
+    
+    
+}
+
+@end
+
+
+@implementation SignatureViewM
+
+SignatureRenderer *_renderer;
+- (void)commonInit {
+    [self setLineWidth:5];
+    self.framebufferOnly=false;
+    vertexLength = [NSMutableArray new];
+    [vertexLength addObject:@0];
+//    dotsLength = [NSMutableArray new];
+//#define             STROKE_WIDTH_MIN 0.004 // Stroke width determined by touch velocity
+//#define             STROKE_WIDTH_MAX 0.010
+    self.MaxLineWidth = 0.010*1000;
+    self.MinLineWidth = 0.004*1000;
+    
+    self.device = MTLCreateSystemDefaultDevice();
+    
+    
+    NSAssert(self.device, @"Metal is not supported on this device");
+    
+    _renderer = [[SignatureRenderer alloc] initWithMetalKitView:self];
+    
+    _renderer.parts =vertexLength;
+    _renderer.SignatureVertexData = SignatureVertexData;
+    
+    NSAssert(_renderer, @"Renderer failed initialization");
+
+    // Initialize our renderer with the view size
+    [_renderer mtkView:self drawableSizeWillChange:self.drawableSize];
+
+    self.delegate = _renderer;
+    
+//    context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+//    
+//    if (context) {
+//        time(NULL);
+//        
+//        self.backgroundColor = [UIColor clearColor];
+//        self.opaque = YES;
+//        
+//        self.context = context;
+//        self.drawableDepthFormat = GLKViewDrawableDepthFormat24;
+//        self.enableSetNeedsDisplay = YES;
+//        
+//        // Turn on antialiasing
+//        self.drawableMultisample = GLKViewDrawableMultisample4X;
+//        
+//        [self setupGL];
+//        
+        // Capture touches
+        UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
+        pan.maximumNumberOfTouches = pan.minimumNumberOfTouches = 1;
+        pan.cancelsTouchesInView = YES;
+        [self addGestureRecognizer:pan];
+        
+        // For dotting your i's
+        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
+        tap.cancelsTouchesInView = YES;
+        tap.numberOfTapsRequired = 1;
+        [self addGestureRecognizer:tap];
+//        
+//         Erase with long press
+//        UILongPressGestureRecognizer *longer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+//        longer.cancelsTouchesInView = YES;
+//        [self addGestureRecognizer:longer];
+//
+//    } else [NSException raise:@"NSOpenGLES2ContextException" format:@"Failed to create OpenGL ES2 context"];
+}
+
+
+
+
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+    if (self = [super initWithCoder:aDecoder])
+    {
+        [self commonInit];
+        _mixPoint =CGPointMake(self.bounds.size.width, self.bounds.size.height);
+        _maxPoint =CGPointMake(0, 0);
+        
+    }
+    return self;
+}
+
+- (instancetype)initWithFrame:(CGRect)frameRect device:(id<MTLDevice>)device
+{
+    if(self=[super initWithFrame:frameRect device:device])
+    {
+        [self commonInit];
+        _mixPoint =CGPointMake(self.bounds.size.width, self.bounds.size.height);
+        _maxPoint =CGPointMake(0, 0);
+        
+        
+    }
+    return self;
+}
+
+- (void)setLineWidth:(CGFloat)width {
+    self.MaxLineWidth = width;//400.0;
+    self.MinLineWidth = width*0.4;//400.0*0.4;
+
+    penThickness = (self.MaxLineWidth - self.MinLineWidth)/2.0;
+}
+//清除画布
+- (void)clear {
+    [vertexLength removeAllObjects];
+    [vertexLength addObject:@0];
+    
+    vertexTotal =0;
+    
+//    _renderer.SignatureVertexData = SignatureVertexData;
+//    dotsLength = nil;
+    self.isSigned = NO;
+    _mixPoint =CGPointMake(self.bounds.size.width, self.bounds.size.height);
+    _maxPoint =CGPointMake(0, 0);
+    [self setNeedsDisplay];
+}
+
+
+- (UIImage *)signatureImage {
+    return [self Signature2Image];
+
+}
+
+- (NSData *)signatureData {
+
+    UIImage* signatureImage = [self Signature2Image];
+
+    return UIImagePNGRepresentation(signatureImage);
+}
+- (UIImage*)Signature2Image
+{
+    if (!self.isSigned)
+        return nil;
+    
+    UIImage *screenshot = [self snapshot];
+    if(screenshot==nil)
+    {
+        NSAssert(false, @"screenshot is null");
+    }
+    float x = _mixPoint.x - MAX_LINEWIDTH /2.0;
+    float y = _mixPoint.y - MAX_LINEWIDTH / 2.0;
+    if(x<0)
+        x=0;
+    if(y<0)
+        y=0;
+    
+    float screen_scale = [[UIScreen mainScreen] scale];
+    
+    CGRect rect =  CGRectMake(x*screenshot.scale*screen_scale, y*screenshot.scale*screen_scale, (_maxPoint.x-_mixPoint.x+MAX_LINEWIDTH)*screenshot.scale*screen_scale, (_maxPoint.y-_mixPoint.y+MAX_LINEWIDTH)*screenshot.scale*screen_scale);
+    
+    CGImageRef imageRef=screenshot.CGImage;
+    CGImageRef imagePartRef=CGImageCreateWithImageInRect(imageRef,rect);
+    UIImage*cropImage=[UIImage imageWithCGImage:imagePartRef];
+    CGImageRelease(imagePartRef);;
+    if(cropImage==nil)
+    {
+        NSAssert(false, @"Signature2Image: cropImage is nil");
+//        int debug = 1;
+    }
+    
+    return cropImage;
+
+}
+
+
+/** 按给定的方向旋转图片 */
+- (UIImage*)rotate:(UIImage*)source orient:(UIImageOrientation)orient
+{
+    CGRect bnds = CGRectZero;
+    UIImage* copy = nil;
+    CGContextRef ctxt = nil;
+    CGImageRef imag = source.CGImage;
+    CGRect rect = CGRectZero;
+    CGAffineTransform tran = CGAffineTransformIdentity;
+    
+    rect.size.width = CGImageGetWidth(imag);
+    rect.size.height = CGImageGetHeight(imag);
+    
+    bnds = rect;
+    
+    switch (orient)
+    {
+        case UIImageOrientationUp:
+            return source;
+            
+        case UIImageOrientationUpMirrored:
+            tran = CGAffineTransformMakeTranslation(rect.size.width, 0.0);
+            tran = CGAffineTransformScale(tran, -1.0, 1.0);
+            break;
+            
+        case UIImageOrientationDown:
+            tran = CGAffineTransformMakeTranslation(rect.size.width,
+                                                    rect.size.height);
+            tran = CGAffineTransformRotate(tran, M_PI);
+            break;
+            
+        case UIImageOrientationDownMirrored:
+            tran = CGAffineTransformMakeTranslation(0.0, rect.size.height);
+            tran = CGAffineTransformScale(tran, 1.0, -1.0);
+            break;
+            
+//        case UIImageOrientationLeft:
+//            bnds = swapWidthAndHeight(bnds);
+//            tran = CGAffineTransformMakeTranslation(0.0, rect.size.width);
+//            tran = CGAffineTransformRotate(tran, 3.0 * M_PI / 2.0);
+//            break;
+//
+//        case UIImageOrientationLeftMirrored:
+//            bnds = swapWidthAndHeight(bnds);
+//            tran = CGAffineTransformMakeTranslation(rect.size.height,
+//                                                    rect.size.width);
+//            tran = CGAffineTransformScale(tran, -1.0, 1.0);
+//            tran = CGAffineTransformRotate(tran, 3.0 * M_PI / 2.0);
+//            break;
+//
+//        case UIImageOrientationRight:
+//            bnds = swapWidthAndHeight(bnds);
+//            tran = CGAffineTransformMakeTranslation(rect.size.height, 0.0);
+//            tran = CGAffineTransformRotate(tran, M_PI / 2.0);
+//            break;
+//
+//        case UIImageOrientationRightMirrored:
+//            bnds = swapWidthAndHeight(bnds);
+//            tran = CGAffineTransformMakeScale(-1.0, 1.0);
+//            tran = CGAffineTransformRotate(tran, M_PI / 2.0);
+//            break;
+            
+        default:
+            return source;
+    }
+    
+    UIGraphicsBeginImageContext(bnds.size);
+    ctxt = UIGraphicsGetCurrentContext();
+    
+    switch (orient)
+    {
+        case UIImageOrientationLeft:
+        case UIImageOrientationLeftMirrored:
+        case UIImageOrientationRight:
+        case UIImageOrientationRightMirrored:
+            CGContextScaleCTM(ctxt, -1.0, 1.0);
+            CGContextTranslateCTM(ctxt, -rect.size.height, 0.0);
+            break;
+            
+        default:
+            CGContextScaleCTM(ctxt, 1.0, -1.0);
+            CGContextTranslateCTM(ctxt, 0.0, -rect.size.height);
+            break;
+    }
+    
+    CGContextConcatCTM(ctxt, tran);
+    CGContextDrawImage(UIGraphicsGetCurrentContext(), rect, imag);
+    
+    copy = UIGraphicsGetImageFromCurrentImageContext();
+    UIGraphicsEndImageContext();
+    
+    return copy;
+}
+
+
+-(UIImage*) snapshot
+{
+    
+    CIContext * context = [CIContext contextWithMTLDevice:self.device];
+    CIImage *outputImage = [[CIImage alloc] initWithMTLTexture:self.currentDrawable.texture options:@{kCIImageColorSpace:(__bridge_transfer id)CGColorSpaceCreateDeviceRGB()}];
+    CGImageRef cgImg = [context createCGImage:outputImage fromRect:CGRectMake(0, 0, [UIScreen mainScreen].nativeBounds.size.width, [UIScreen mainScreen].nativeBounds.size.height)];
+    UIImage *resultImg = [UIImage imageWithCGImage:cgImg scale:1.0 orientation:UIImageOrientationUp];
+    
+    resultImg = [self rotate:resultImg orient: UIImageOrientationDownMirrored];
+    
+//
+//    UIImageOrientationUp,            // default orientation
+//    UIImageOrientationDown,          // 180 deg rotation
+//    UIImageOrientationLeft,          // 90 deg CCW
+//    UIImageOrientationRight,         // 90 deg CW
+//    UIImageOrientationUpMirrored,    // as above but image mirrored along other axis. horizontal flip
+//    UIImageOrientationDownMirrored,  // horizontal flip
+//    UIImageOrientationLeftMirrored,  // vertical flip
+//    UIImageOrientationRightMirrored, // vertical flip
+
+    
+    
+    CGImageRelease(cgImg);
+    return resultImg;
+//    id<MTLTexture> lastDrawableDisplayed = [self.currentDrawable texture];
+//
+//        int width = (int)[lastDrawableDisplayed width];
+//        int height = (int)[lastDrawableDisplayed height];
+//        int rowBytes = width * 4;
+//        int selfturesize = width * height * 4;
+//
+//        void *p = malloc(selfturesize);
+//
+//
+//
+//        [lastDrawableDisplayed getBytes:p bytesPerRow:rowBytes fromRegion:MTLRegionMake2D(0, 0, width, height) mipmapLevel:0];
+//
+//        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+//        CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaFirst;
+//
+//        CGDataProviderRef provider = CGDataProviderCreateWithData(nil, p, selfturesize, nil);
+//        CGImageRef cgImageRef = CGImageCreate(width, height, 8, 32, rowBytes, colorSpace, bitmapInfo, provider, nil, true, (CGColorRenderingIntent)kCGRenderingIntentDefault);
+//
+//        UIImage *getImage = [UIImage imageWithCGImage:cgImageRef];
+//        CGImageRelease(cgImageRef);
+//
+//    CGDataProviderRelease(provider);
+//    CGColorSpaceRelease(colorSpace);
+//        free(p);
+//    return getImage;
+//
+//        NSData *pngData = UIImagePNGRepresentation(getImage);
+//        UIImage *pngImage = [UIImage imageWithData:pngData];
+}
+- (void)updateStrokeColor {
+    
+    CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0, white = 0.0;
+    if ( self.strokeColor && [self.strokeColor getRed:&red green:&green blue:&blue alpha:&alpha]) {
+        StrokeColor[0]=red;
+        StrokeColor[1]=green;
+        StrokeColor[2]=blue;
+        StrokeColor[3]=alpha;
+    } else if (self.strokeColor && [self.strokeColor getWhite:&white alpha:&alpha]) {
+        
+        StrokeColor[0]=white;
+        StrokeColor[1]=white;
+        StrokeColor[2]=white;
+        StrokeColor[3]=alpha;
+        
+        
+    } else
+        {
+            StrokeColor[0]=0;
+            StrokeColor[1]=0;
+            StrokeColor[2]=0;
+            StrokeColor[3]=1;
+        }
+//    StrokeColor
+}
+
+- (void)setBackgroundColor:(UIColor *)backgroundColor {
+    [super setBackgroundColor:backgroundColor];
+    
+    CGFloat red, green, blue, alpha, white;
+    if ([backgroundColor getRed:&red green:&green blue:&blue alpha:&alpha]) {
+        clearColor[0] = red;
+        clearColor[1] = green;
+        clearColor[2] = blue;
+    } else if ([backgroundColor getWhite:&white alpha:&alpha]) {
+        clearColor[0] = white;
+        clearColor[1] = white;
+        clearColor[2] = white;
+    }
+}
+
+- (void)setStrokeColor:(UIColor *)strokeColor {
+    _strokeColor = strokeColor;
+    [self updateStrokeColor];
+}
+- (void)updateRectWithPoint:(CGPoint)p
+{
+    if (p.x<_mixPoint.x) {
+        _mixPoint.x =p.x;
+    }
+    if (p.y<_mixPoint.y) {
+        _mixPoint.y =p.y;
+    }
+    if (p.x>_maxPoint.x) {
+        _maxPoint.x =p.x;
+    }
+    if (p.y>_maxPoint.y) {
+        _maxPoint.y =p.y;
+    }
+}
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+#pragma mark - Gesture Recognizers
+
+
+- (void)tap:(UITapGestureRecognizer *)t {
+    DebugLog(@"on tap");
+    CGPoint l = [t locationInView:self];
+    
+//    l=CGPointMake(self.bounds.size.width/2, 0);
+    [self updateRectWithPoint:l];
+    if (t.state == UIGestureRecognizerStateRecognized) {
+        
+        self.isSigned = YES;
+        DebugLog(@"UIGestureRecognizerStateRecognized");
+        
+        
+//        glBindBuffer(GL_ARRAY_BUFFER, dotsBuffer);
+//
+//        [dotsLength addObject:@0];
+        
+        
+        PPSSignaturePoint touchPoint = ViewPointToMTK(l, self.bounds.size, self.drawableSize, StrokeColor);
+        addVertex(&vertexTotal,vertexLength, touchPoint,SignatureVertexData);
+//
+        PPSSignaturePoint centerPoint = touchPoint;
+        
+        centerPoint.color =StrokeColor;
+        addVertex(&vertexTotal,vertexLength, centerPoint,SignatureVertexData);
+//
+        static int segments = 20;
+        vector_float2 radius = (vector_float2){
+            clamp(1, 8, penThickness * generateRandom(2, 12)),
+            clamp(1, 8, penThickness * generateRandom(2, 12))
+        };
+        vector_float2 velocityRadius = radius;
+        float angle = 0;
+
+        for (int i = 0; i <= segments; i++) {
+
+            PPSSignaturePoint p = centerPoint;
+            p.position.x += velocityRadius.x * cosf(angle);
+            p.position.y += velocityRadius.y * sinf(angle);
+
+            addVertex(&vertexTotal,vertexLength, p,SignatureVertexData);
+            addVertex(&vertexTotal,vertexLength, centerPoint,SignatureVertexData);
+
+            angle += M_PI * 2.0 / segments;
+        }
+
+        addVertex(&vertexTotal,vertexLength, touchPoint,SignatureVertexData);
+//
+//        glBindBuffer(GL_ARRAY_BUFFER, 0);
+    }
+    
+    [self setNeedsDisplay];
+}
+
+
+//- (void)longPress:(UILongPressGestureRecognizer *)lp {
+//    //注释regturn,可以打开长按清除
+//    return;
+//
+////    [self signatureImage];
+//    [self clear];
+//}
+
+- (void)pan:(UIPanGestureRecognizer *)p {
+    
+//    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
+//    
+    CGPoint v = [p velocityInView:self];
+    CGPoint l = [p locationInView:self];
+        [self updateRectWithPoint:l];
+    
+    currentVelocity = ViewPointToMTK(v, self.bounds.size, self.drawableSize,StrokeColor);
+    float distance = 0.;
+    if (previousPoint.x > 0) {
+        distance = sqrtf((l.x - previousPoint.x) * (l.x - previousPoint.x) + (l.y - previousPoint.y) * (l.y - previousPoint.y));
+    }
+    
+    float velocityMagnitude = sqrtf(v.x*v.x + v.y*v.y);
+    float clampedVelocityMagnitude = clamp(VELOCITY_CLAMP_MIN, VELOCITY_CLAMP_MAX, velocityMagnitude);
+    float normalizedVelocity = (clampedVelocityMagnitude - VELOCITY_CLAMP_MIN) / (VELOCITY_CLAMP_MAX - VELOCITY_CLAMP_MIN);
+    
+    float lowPassFilterAlpha = STROKE_WIDTH_SMOOTHING;
+    float newThickness = (self.MaxLineWidth - self.MinLineWidth) * (1 - normalizedVelocity) + self.MinLineWidth;
+    penThickness = penThickness * lowPassFilterAlpha + newThickness * (1 - lowPassFilterAlpha);
+    
+    if ([p state] == UIGestureRecognizerStateBegan) {
+        
+        previousPoint = l;
+        previousMidPoint = l;
+        
+        PPSSignaturePoint startPoint = ViewPointToMTK(l, self.bounds.size, self.drawableSize,StrokeColor);
+        previousVertex = startPoint;
+        previousThickness = penThickness;
+        
+        addVertex(&vertexTotal,vertexLength, startPoint,SignatureVertexData);
+        addVertex(&vertexTotal,vertexLength, previousVertex,SignatureVertexData);
+        
+        self.isSigned = YES;
+        
+    } else if ([p state] == UIGestureRecognizerStateChanged) {
+        
+        CGPoint mid = CGPointMake((l.x + previousPoint.x) / 2.0, (l.y + previousPoint.y) / 2.0);
+        
+        if (distance > QUADRATIC_DISTANCE_TOLERANCE) {
+            // Plot quadratic bezier instead of line
+            unsigned int i;
+            
+            int segments = (int) distance / 1.5;
+            
+            float startPenThickness = previousThickness;
+            float endPenThickness = penThickness;
+            previousThickness = penThickness;
+            
+            for (i = 0; i < segments; i++)
+            {
+                penThickness = startPenThickness + ((endPenThickness - startPenThickness) / segments) * i;
+                
+                CGPoint quadPoint = QuadraticPointInCurve(previousMidPoint, mid, previousPoint, (float)i / (float)(segments));
+                
+                PPSSignaturePoint v = ViewPointToMTK(quadPoint, self.bounds.size,self.drawableSize, StrokeColor);
+                [self addTriangleStripPointsForPrevious:previousVertex next:v];
+                
+                previousVertex = v;
+            }
+        } else if (distance > 1.0) {
+            
+            PPSSignaturePoint v = ViewPointToMTK(l, self.bounds.size,self.drawableSize, StrokeColor);
+            [self addTriangleStripPointsForPrevious:previousVertex next:v];
+            
+            previousVertex = v;
+            previousThickness = penThickness;
+        }
+        
+        previousPoint = l;
+        previousMidPoint = mid;
+        
+    } else if (p.state == UIGestureRecognizerStateEnded | p.state == UIGestureRecognizerStateCancelled) {
+        
+        PPSSignaturePoint v = ViewPointToMTK(l, self.bounds.size, self.drawableSize,StrokeColor);
+        addVertex(&vertexTotal,vertexLength, v,SignatureVertexData);
+        
+        previousVertex = v;
+        addVertex(&vertexTotal,vertexLength, previousVertex,SignatureVertexData);
+    }
+    
+    [self setNeedsDisplay];
+}
+
+- (void)addTriangleStripPointsForPrevious:(PPSSignaturePoint)previous next:(PPSSignaturePoint)next {
+    float toTravel = penThickness / 2.0;
+    
+    for (int i = 0; i < 2; i++) {
+        vector_float2 p = perpendicular(previous, next);
+        vector_float2 p1 = next.position;
+        vector_float2 ref = p1+p;
+        
+        float distance = simd_distance(p1,ref);
+        float difX = p1.x - ref.x;
+        float difY = p1.y - ref.y;
+        float ratio = -1.0 * (toTravel / distance);
+        
+        difX = difX * ratio;
+        difY = difY * ratio;
+        
+        PPSSignaturePoint stripPoint = {
+            { p1.x + difX, p1.y + difY},
+            StrokeColor
+        };
+        addVertex(&vertexTotal,vertexLength, stripPoint,SignatureVertexData);
+        
+        toTravel *= -1;
+    }
+}
+@end

+ 18 - 15
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -178,7 +178,7 @@
 //
 //        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
 //
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//        navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
 //        [self presentViewController:navi animated:YES completion:^{
 //
 //            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
@@ -756,15 +756,18 @@
 
 #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
-
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     
     // 添加一个删除按钮
     
     self.indexPath=indexPath;
     
-    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//    UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        
+        UIContextualAction* deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"Delete" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
         
         DebugLog(@"delete click");
         
@@ -828,17 +831,17 @@
  
     
     
-    
-    
-    
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
-        
-        return @[deleteRowAction];
-    
-    else
-        return @[deleteRowAction];
-    
+    return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
+//
+//
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
+//
+//        return @[deleteRowAction];
+//
+//    else
+//        return @[deleteRowAction];
+//
     
 }
 

+ 3 - 3
RedAnt ERP Mobile/common/PDFUtils.m

@@ -117,7 +117,7 @@
     NSString *default_path = file;//[[NSBundle mainBundle] pathForResource:file ofType:nil];
 //    const char *filename=[default_path UTF8String];
     
-    NSLog(@"%@",default_path);
+    DebugLog(@"%@",default_path);
     
     //关联上下文的对象
     
@@ -250,7 +250,7 @@ isnew:(bool)isNewDocument
     
     const char *filename=[newFilePath UTF8String];
     
-    NSLog(@"%@",newFilePath);
+    DebugLog(@"%@",newFilePath);
     //设置页面大小 Letter纸
     
     //CGPDFDocumentGetMediaBox(document,1);
@@ -525,7 +525,7 @@ isnew:(bool)isNewDocument
 //    
 //    const char *filename=[newFilePath UTF8String];
 //    
-//    NSLog(@"%@",newFilePath);
+//    DebugLog(@"%@",newFilePath);
 //    //设置页面大小 Letter纸
 //    
 //    //CGPDFDocumentGetMediaBox(document,1);

+ 2 - 0
RedAnt ERP Mobile/common/Reachability.m

@@ -69,6 +69,7 @@ static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char*
 {
 #if kShouldPrintReachabilityFlags
 
+#ifdef DEBUG
     NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
           (flags & kSCNetworkReachabilityFlagsIsWWAN)				? 'W' : '-',
           (flags & kSCNetworkReachabilityFlagsReachable)            ? 'R' : '-',
@@ -83,6 +84,7 @@ static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char*
           comment
           );
 #endif
+#endif
 }
 
 

+ 2 - 2
RedAnt ERP Mobile/common/TextUtils.m

@@ -24,13 +24,13 @@
     mobileNumber = [mobileNumber stringByReplacingOccurrencesOfString:@"-" withString:@""];
     mobileNumber = [mobileNumber stringByReplacingOccurrencesOfString:@"+" withString:@""];
     
-    NSLog(@"%@", mobileNumber);
+    DebugLog(@"%@", mobileNumber);
     
     int length = (int)[mobileNumber length];
     if(length > 10)
     {
         mobileNumber = [mobileNumber substringFromIndex: length-10];
-        NSLog(@"%@", mobileNumber);
+        DebugLog(@"%@", mobileNumber);
         
     }
     

+ 2 - 1
RedAnt ERP Mobile/common/customUI/ImageScrollerViewController.m

@@ -8,6 +8,7 @@
 
 #import "ImageScrollerViewController.h"
 #import "AppDelegate.h"
+#import "RAUtils.h"
 
 @interface ImageScrollerViewController ()
 
@@ -51,7 +52,7 @@
     [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
         // what ever you want to prepare
     } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
-            UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+        UIInterfaceOrientation orientation =[RAUtils query_orientation:self];// [[UIApplication sharedApplication]statusBarOrientation];
         if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
         {
             

+ 17 - 10
RedAnt ERP Mobile/common/data_provider/RADataProvider.h

@@ -18,31 +18,38 @@ NS_ASSUME_NONNULL_BEGIN
 +(void)request_commoneditor_partialrefresh: (NSMutableDictionary*)params url:(NSString*)url completionHandler:(resultHandler)result;
 +(void)SaveEditor:(NSMutableDictionary*)params completionHandler:(resultHandler)result;
 
++(void)request_autocomplete:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
++(NSString*)getSiteName;
+
+//+(void)request_scan_cid:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
+//+(void)request_scan_shipto_company:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
++(void)request_sign_up:user email:(NSString*)email password:(NSString*) pwd completionHandler:(resultHandler)result;
++(void)request_change_password:(NSString*) pwd completionHandler:(resultHandler)result;
 
+//+(void)encrypt_scan_models;
+
+
+
+#ifdef SCANNER_ORDER
 +(void)request_scansearch:(long ) offset limit :(long)limit keywords :(NSString*) keywords completionHandler:(resultHandler)result;
 +(void)request_scan_server:(resultHandler)result;
 +(void)request_scan_news:(resultHandler)result;
 +(void) request_scan_stock:(resultHandler)result;
 +(void)request_scan_stock:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
-+(void)request_autocomplete:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
-//+(void)request_scan_cid:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
-//+(void)request_scan_shipto_company:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
-+(void)request_sign_up:user email:(NSString*)email password:(NSString*) pwd completionHandler:(resultHandler)result;
+
 +(void)request_validate_scan_server:(NSString*)url name:(NSString*)name password:(NSString*)password completionHandler:(resultHandler)result;
-+(NSString*)getSiteName;
++(bool) scanRtime;
 +(bool)getSiteHasERP;
-+(void)request_change_password:(NSString*) pwd completionHandler:(resultHandler)result;
 +(void)load_scan_models;
 +(NSArray*)request_scan_model_by_names:(NSString*)names;
-+(void) updateTemplate:(UIViewController*) vc;
-+(void) updateStock:(UIViewController*) vc;
-//+(void)encrypt_scan_models;
-+(bool) scanRtime;
 +(NSString*) queryStock:(NSString*)modelname;
 +(NSString*) queryStockUpdateTime;
 +(void)default_price_group;
 +(NSDictionary*)get_price_group:(NSString*) groupname;
 +(NSMutableDictionary*)all_price_group;
++(void) updateTemplate:(UIViewController*) vc;
++(void) updateStock:(UIViewController*) vc;
+#endif
 @end
 
 NS_ASSUME_NONNULL_END

+ 56 - 54
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -11,6 +11,55 @@
 #import "ActiveViewController.h"
 @implementation RADataProvider
 
++(void)request_autocomplete:(NSMutableDictionary*)param completionHandler:(resultHandler)result
+{
+        param[@"site_name"]=[self getSiteName];
+//        param[@"_method"]=@"customerID";
+        AppDelegate *appDelegate = nil;
+    
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+        
+    
+    
+    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSString* full_url ;
+    if([param[@"full_url"] boolValue])
+        full_url =param[@"url"];
+    else
+    {
+            if(appDelegate.address==nil||[param[@"url"] stringValue].length==0)
+            {
+                NSMutableDictionary* ret=[[NSMutableDictionary alloc]init];
+                ret[@"result"]=@"8";
+                ret[@"err_msg"]=@"Missing query url, please contact administrator.";
+            }
+            full_url = [appDelegate.address stringByAppendingPathComponent:[param[@"url"] stringValue]];
+    }
+
+    
+   
+    
+        [self request_interface:full_url parameters:param err_record_url:nil completionHandler:result retry:0];
+}
++(NSString*)getSiteName
+{
+    NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];;
+    if (addressDic) {
+        NSString* ia=addressDic[@"internalAddress"];
+        NSString* ea=addressDic[@"externalAddress"];
+        NSString* sa=addressDic[@"serverAddress"];
+        if(sa.length==0)
+        {
+            if(ea.length>0)
+                sa=ea;
+            else if(ia.length>0)
+            sa=ia;
+        }
+       
+       return [addressDic objectForKey:@"name"];
+    }
+    return @"";
+}
 #ifdef SCANNER_ORDER
 
 +(NSMutableDictionary*)scan_search:(NSString*)keyword
@@ -82,9 +131,9 @@
     NSError *error;
     [stre writeToFile:templatefile atomically:YES encoding:NSUTF8StringEncoding error:&error];
     if (error) {
-        NSLog(@"导出失败");
+        DebugLog(@"导出失败");
     }else {
-        NSLog(@"导出成功");
+        DebugLog(@"导出成功");
     }
 }
 
@@ -607,7 +656,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-4-18"];
     }];
     
     return afterSortKeyArray;
-//    NSLog(@"afterSortKeyArray:%@",afterSortKeyArray);
+//    DebugLog(@"afterSortKeyArray:%@",afterSortKeyArray);
     
 //    //通过排列的key值获取value
 //    NSMutableArray *valueArray = [NSMutableArray array];
@@ -615,7 +664,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-4-18"];
 //        NSString *valueString = [dict objectForKey:sortsing];
 //        [valueArray addObject:valueString];
 //    }
-//    NSLog(@"valueArray:%@",valueArray);
+//    DebugLog(@"valueArray:%@",valueArray);
 }
 +(void) request_scan_stock:(resultHandler)result
 {
@@ -645,36 +694,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-4-18"];
     param[@"site_name"]=[RADataProvider getSiteName];
     [self request_interface:url parameters:param err_record_url:nil completionHandler:result retry:0];
 }
-+(void)request_autocomplete:(NSMutableDictionary*)param completionHandler:(resultHandler)result
-{
-        param[@"site_name"]=[self getSiteName];
-//        param[@"_method"]=@"customerID";
-        AppDelegate *appDelegate = nil;
-    
-        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-        
-    
-    
-    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-    NSString* full_url ;
-    if([param[@"full_url"] boolValue])
-        full_url =param[@"url"];
-    else
-    {
-            if(appDelegate.address==nil||[param[@"url"] stringValue].length==0)
-            {
-                NSMutableDictionary* ret=[[NSMutableDictionary alloc]init];
-                ret[@"result"]=@"8";
-                ret[@"err_msg"]=@"Missing query url, please contact administrator.";
-            }
-            full_url = [appDelegate.address stringByAppendingPathComponent:[param[@"url"] stringValue]];
-    }
 
-    
-   
-    
-        [self request_interface:full_url parameters:param err_record_url:nil completionHandler:result retry:0];
-}
 //+(void)request_scan_cid:(NSMutableDictionary*)param url:(NSString*) url completionHandler:(resultHandler)result
 //{
 //    param[@"site_name"]=[self getSiteName];
@@ -728,25 +748,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-4-18"];
     NSString* check_url = [NSString stringWithFormat:@"%@%@",url,URL_SERVER_CHECK];
     [self request_interface:check_url parameters:param err_record_url:nil completionHandler:result retry:0];
 }
-+(NSString*)getSiteName
-{
-    NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];;
-    if (addressDic) {
-        NSString* ia=addressDic[@"internalAddress"];
-        NSString* ea=addressDic[@"externalAddress"];
-        NSString* sa=addressDic[@"serverAddress"];
-        if(sa.length==0)
-        {
-            if(ea.length>0)
-                sa=ea;
-            else if(ia.length>0)
-            sa=ia;
-        }
-       
-       return [addressDic objectForKey:@"name"];
-    }
-    return @"";
-}
+
 +(bool)getSiteHasERP
 {
     AppDelegate *appDelegate = nil;
@@ -945,7 +947,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-4-18"];
                     if(bbreak)
                         break;
                     dispatch_async(dispatch_get_main_queue(), ^{
-                        NSLog(@"request cart delivery %d",i);
+                        DebugLog(@"request cart delivery %d",i);
                         [self request_interface:request_url parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *resulti) {
                             if(resulti!=nil)
                             {
@@ -958,7 +960,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-4-18"];
                                     if(!bbreak) //此判断保证result只调用一次。
                                     {
                                         result(resulti);
-                                        NSLog(@"result called at %d",i);
+                                        DebugLog(@"result called at %d",i);
                                     }
                                     bbreak=true;
                                 }

+ 2 - 1
RedAnt ERP Mobile/common/data_provider/RANetwork.h

@@ -278,6 +278,7 @@ extern NSString *const ScreenCodeOfflineSync;
 
 +(int)parse_logininfo : (NSMutableDictionary *) jsobj user:(NSString*) user password:(NSString*) password;
 
-
+#ifdef SCANNER_ORDER
 +(void) request_scan_bulkdiscount:(float) discount notes:(NSString*) notes completionHandler:(resultHandler)result;
+#endif
 @end

+ 4 - 3
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -291,7 +291,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
 //}
 +(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params //delegate:(id < NSURLConnectionDelegate >)delegate
 {
-    NSString *screenName = [params valueForKey:kScreenName];
+    
     NSString *userAction = [params valueForKey:kAction];
     NSMutableDictionary *extra = [[params valueForKey:kExtra] mutableCopy];
     if ([userAction isEqualToString:@"Login"]) {
@@ -301,6 +301,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
         [extra setObject:[params objectForKey:@"user"] forKey:@"user"];
     }
 #if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
+    NSString *screenName = [params valueForKey:kScreenName];
     [ERPUtils googleAnalyticsSendRequestString:url WithScreen:screenName Action:userAction Extra:extra];
 #endif
     return [self get_json:url parameters:params file:nil];
@@ -5366,7 +5367,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
                     if(bbreak)
                         break;
                     dispatch_async(dispatch_get_main_queue(), ^{
-                        NSLog(@"request cart delivery %d",i);
+                        DebugLog(@"request cart delivery %d",i);
                         [self request_interface:request_url parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *resulti) {
                             if(resulti!=nil)
                             {
@@ -5379,7 +5380,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
                                     if(!bbreak) //此判断保证result只调用一次。
                                     {
                                         result(resulti);
-                                        NSLog(@"result called at %d",i);
+                                        DebugLog(@"result called at %d",i);
                                     }
                                     bbreak=true;
                                 }

+ 2 - 2
RedAnt ERP Mobile/common/pdfCreator/RAPDFPage.m

@@ -144,7 +144,7 @@
     if(drawable_obj==nil)
         return;
     
-    NSLog(@"pdfpage directdraw begin");
+    DebugLog(@"pdfpage directdraw begin");
     
         NSRange range = NSMakeRange(0,self.rect.size.height);
 
@@ -155,7 +155,7 @@
             drawable_obj.delegate = self;
             [drawable_obj Draw:context dataSource:nil ParentRect:(CGRect)self.drawable_rect startX:0 startY:self.header_height flipHeight:self.rect.size.height range:range];
     
-    NSLog(@"pdfpage directdraw end");
+    DebugLog(@"pdfpage directdraw end");
 
     
 }

+ 25 - 24
RedAnt ERP Mobile/common/pdfCreator/TextDrawable.m

@@ -7,6 +7,7 @@
 //
 
 #import "TextDrawable.h"
+#import "const.h"
 #import <CoreText/CoreText.h>
 #import "TextUtils.h"
 #define DEBUG_STRING_VALUE0 @"DEBUG OFF"
@@ -38,7 +39,7 @@
     
     
     
-    NSLog(@"createTextTemplate text align : %@",textAlignment);
+    DebugLog(@"createTextTemplate text align : %@",textAlignment);
     
     if(textAlignment.length==0)
         textAlignment= @"Center";
@@ -72,7 +73,7 @@
     
     NSString* align= drawableTemplate[@"textAlignment"];
     
-        NSLog(@"setDrawableTemplate text align : %@",align);
+        DebugLog(@"setDrawableTemplate text align : %@",align);
     if(align.length==0 || [align.lowercaseString isEqualToString:@"left"])
     {
         self.textalignment= NSTextAlignmentLeft;
@@ -749,12 +750,12 @@
     if([self.text isEqualToString:DEBUG_STRING_VALUE1])
     {
       //  bool debug=true;
-        NSLog(@"textdrawable text:%@",self.text);
-        NSLog(@"string %@",string);
-        //        NSLog(@"compute size %@", NSStringFromCGSize(CGSizeMake(self.rect.size.width-self.margin_left-self.margin_right, MAXFLOAT)) );
-        //        NSLog(@"tmpSize %@", NSStringFromCGSize(tmpSize) );
-        //        NSLog(@"p_rect %@", NSStringFromCGRect(p_rect) );
-        //        NSLog(@"self.rect %@", NSStringFromCGRect(self.rect) );
+        DebugLog(@"textdrawable text:%@",self.text);
+        DebugLog(@"string %@",string);
+        //        DebugLog(@"compute size %@", NSStringFromCGSize(CGSizeMake(self.rect.size.width-self.margin_left-self.margin_right, MAXFLOAT)) );
+        //        DebugLog(@"tmpSize %@", NSStringFromCGSize(tmpSize) );
+        //        DebugLog(@"p_rect %@", NSStringFromCGRect(p_rect) );
+        //        DebugLog(@"self.rect %@", NSStringFromCGRect(self.rect) );
     }
     
     
@@ -807,14 +808,14 @@
     if([self.text isEqualToString:DEBUG_STRING_VALUE1])
     {
 //        bool debug=true;
-        NSLog(@"textdrawable text:%@",self.text);
-        NSLog(@"tmpSize %@", NSStringFromCGSize(tmpSize) );
-        NSLog(@"p_rect %@", NSStringFromCGRect(p_rect) );
-        NSLog(@"self.rect %@", NSStringFromCGRect(self.rect) );
+        DebugLog(@"textdrawable text:%@",self.text);
+        DebugLog(@"tmpSize %@", NSStringFromCGSize(tmpSize) );
+        DebugLog(@"p_rect %@", NSStringFromCGRect(p_rect) );
+        DebugLog(@"self.rect %@", NSStringFromCGRect(self.rect) );
         
-        NSLog(@"expand %@", expand?@"true":@"false" );
-        NSLog(@"height %f", height );
-        NSLog(@"expand_rect %@", NSStringFromCGRect(expand_rect) );
+        DebugLog(@"expand %@", expand?@"true":@"false" );
+        DebugLog(@"height %f", height );
+        DebugLog(@"expand_rect %@", NSStringFromCGRect(expand_rect) );
     }
     
     //    CGRect rect=[RAUtils rectAlign:parentrect rect:scalerect hAlign:self.hAlign vAlign:self.vAlign];
@@ -823,17 +824,17 @@
     if([self.text isEqualToString:DEBUG_STRING_VALUE1])
     {
    //     bool debug=true;
-        NSLog(@"textdrawable text:%@",self.text);
-        NSLog(@"tmpSize %@", NSStringFromCGSize(tmpSize) );
-        NSLog(@"p_rect %@", NSStringFromCGRect(p_rect) );
-        NSLog(@"self.rect %@", NSStringFromCGRect(self.rect) );
+        DebugLog(@"textdrawable text:%@",self.text);
+        DebugLog(@"tmpSize %@", NSStringFromCGSize(tmpSize) );
+        DebugLog(@"p_rect %@", NSStringFromCGRect(p_rect) );
+        DebugLog(@"self.rect %@", NSStringFromCGRect(self.rect) );
         
-        NSLog(@"expand %@", expand?@"true":@"false" );
-        NSLog(@"height %f", height );
-        NSLog(@"expand_rect %@", NSStringFromCGRect(expand_rect) );
+        DebugLog(@"expand %@", expand?@"true":@"false" );
+        DebugLog(@"height %f", height );
+        DebugLog(@"expand_rect %@", NSStringFromCGRect(expand_rect) );
         
-        NSLog(@"rect %@", NSStringFromCGRect(rect) );
-        NSLog(@"vAlign %@", self.vAlign );
+        DebugLog(@"rect %@", NSStringFromCGRect(rect) );
+        DebugLog(@"vAlign %@", self.vAlign );
     }
     
     // CGRect pdfrect = [self to_pdf_rect:p_rect pos:self.rect contextHeight:flip_height];

+ 8 - 2
RedAnt ERP Mobile/common/zip/ZipArchive.mm

@@ -164,7 +164,9 @@
 		unz_global_info  globalInfo = {0};
 		if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK )
 		{
+#ifdef DEBUG
             NSLog(@"%@", [NSString stringWithFormat:@"%lu entries in the zip file",globalInfo.number_entry] );
+#endif
 		}
 	}
 	return _unzFile!=NULL;
@@ -285,8 +287,10 @@
 				//		[attr  setValue:orgDate forKey:NSFileCreationDate];
 				if( ![[NSFileManager defaultManager] setAttributes:attr ofItemAtPath:fullPath error:nil] )
 				{
-					// cann't set attributes 
+					// cann't set attributes
+#ifdef DEBUG
 					NSLog(@"Failed to set attributes");
+#endif
 				}
 				
 			}
@@ -419,8 +423,10 @@
                 //		[attr  setValue:orgDate forKey:NSFileCreationDate];
                 if( ![[NSFileManager defaultManager] setAttributes:attr ofItemAtPath:fullPath error:nil] )
                 {
-                    // cann't set attributes 
+                    // cann't set attributes
+#ifdef DEBUG
                     NSLog(@"Failed to set attributes");
+#endif
                 }
                 
             }

+ 132 - 132
RedAnt ERP Mobile/common/zip/minizip/crypt.h

@@ -1,132 +1,132 @@
-/* crypt.h -- base code for crypt/uncrypt ZIPfile
-
-
-   Version 1.01e, February 12th, 2005
-
-   Copyright (C) 1998-2005 Gilles Vollant
-
-   This code is a modified version of crypting code in Infozip distribution
-
-   The encryption/decryption parts of this source code (as opposed to the
-   non-echoing password parts) were originally written in Europe.  The
-   whole source package can be freely distributed, including from the USA.
-   (Prior to January 2000, re-export from the US was a violation of US law.)
-
-   This encryption code is a direct transcription of the algorithm from
-   Roger Schlafly, described by Phil Katz in the file appnote.txt.  This
-   file (appnote.txt) is distributed with the PKZIP program (even in the
-   version without encryption capabilities).
-
-   If you don't need crypting in your application, just define symbols
-   NOCRYPT and NOUNCRYPT.
-
-   This code support the "Traditional PKWARE Encryption".
-
-   The new AES encryption added on Zip format by Winzip (see the page
-   http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
-   Encryption is not supported. 
-*/
-
-#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
-
-/***********************************************************************
- * Return the next byte in the pseudo-random sequence
- */
-static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
-{
-    unsigned temp;  /* POTENTIAL BUG:  temp*(temp^1) may overflow in an
-                     * unpredictable manner on 16-bit systems; not a problem
-                     * with any known compiler so far, though */
-
-    temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
-    return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
-}
-
-/***********************************************************************
- * Update the encryption keys with the next byte of plain text
- */
-static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
-{
-    (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
-    (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
-    (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
-    {
-      register int keyshift = (int)((*(pkeys+1)) >> 24);
-      (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
-    }
-    return c;
-}
-
-
-/***********************************************************************
- * Initialize the encryption keys and the random header according to
- * the given password.
- */
-static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
-{
-    *(pkeys+0) = 305419896L;
-    *(pkeys+1) = 591751049L;
-    *(pkeys+2) = 878082192L;
-    while (*passwd != '\0') {
-        update_keys(pkeys,pcrc_32_tab,(int)*passwd);
-        passwd++;
-    }
-}
-
-#define zdecode(pkeys,pcrc_32_tab,c) \
-    (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
-
-#define zencode(pkeys,pcrc_32_tab,c,t) \
-    (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
-
-#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
-
-#define RAND_HEAD_LEN  12
-   /* "last resort" source for second part of crypt seed pattern */
-#  ifndef ZCR_SEED2
-#    define ZCR_SEED2 3141592654UL     /* use PI as default pattern */
-#  endif
-
-static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
-    const char *passwd;         /* password string */
-    unsigned char *buf;         /* where to write header */
-    int bufSize;
-    unsigned long* pkeys;
-    const unsigned long* pcrc_32_tab;
-    unsigned long crcForCrypting;
-{
-    int n;                       /* index in random header */
-    int t;                       /* temporary */
-    int c;                       /* random byte */
-    unsigned char header[RAND_HEAD_LEN-2]; /* random header */
-    static unsigned calls = 0;   /* ensure different random header each time */
-
-    if (bufSize<RAND_HEAD_LEN)
-      return 0;
-
-    /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
-     * output of rand() to get less predictability, since rand() is
-     * often poorly implemented.
-     */
-    if (++calls == 1)
-    {
-        srand((unsigned)(time(NULL) ^ ZCR_SEED2));
-    }
-    init_keys(passwd, pkeys, pcrc_32_tab);
-    for (n = 0; n < RAND_HEAD_LEN-2; n++)
-    {
-        c = (rand() >> 7) & 0xff;
-        header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
-    }
-    /* Encrypt random header (last two bytes is high word of crc) */
-    init_keys(passwd, pkeys, pcrc_32_tab);
-    for (n = 0; n < RAND_HEAD_LEN-2; n++)
-    {
-        buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
-    }
-    buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
-    buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
-    return n;
-}
-
-#endif
+/* crypt.h -- base code for crypt/uncrypt ZIPfile
+
+
+   Version 1.01e, February 12th, 2005
+
+   Copyright (C) 1998-2005 Gilles Vollant
+
+   This code is a modified version of crypting code in Infozip distribution
+
+   The encryption/decryption parts of this source code (as opposed to the
+   non-echoing password parts) were originally written in Europe.  The
+   whole source package can be freely distributed, including from the USA.
+   (Prior to January 2000, re-export from the US was a violation of US law.)
+
+   This encryption code is a direct transcription of the algorithm from
+   Roger Schlafly, described by Phil Katz in the file appnote.txt.  This
+   file (appnote.txt) is distributed with the PKZIP program (even in the
+   version without encryption capabilities).
+
+   If you don't need crypting in your application, just define symbols
+   NOCRYPT and NOUNCRYPT.
+
+   This code support the "Traditional PKWARE Encryption".
+
+   The new AES encryption added on Zip format by Winzip (see the page
+   http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
+   Encryption is not supported.
+*/
+
+#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
+
+/***********************************************************************
+ * Return the next byte in the pseudo-random sequence
+ */
+static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
+{
+    unsigned temp;  /* POTENTIAL BUG:  temp*(temp^1) may overflow in an
+                     * unpredictable manner on 16-bit systems; not a problem
+                     * with any known compiler so far, though */
+
+    (void)pcrc_32_tab;
+    temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
+    return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
+}
+
+/***********************************************************************
+ * Update the encryption keys with the next byte of plain text
+ */
+static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
+{
+    (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
+    (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
+    (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
+    {
+      register int keyshift = (int)((*(pkeys+1)) >> 24);
+      (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
+    }
+    return c;
+}
+
+
+/***********************************************************************
+ * Initialize the encryption keys and the random header according to
+ * the given password.
+ */
+static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
+{
+    *(pkeys+0) = 305419896L;
+    *(pkeys+1) = 591751049L;
+    *(pkeys+2) = 878082192L;
+    while (*passwd != '\0') {
+        update_keys(pkeys,pcrc_32_tab,(int)*passwd);
+        passwd++;
+    }
+}
+
+#define zdecode(pkeys,pcrc_32_tab,c) \
+    (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
+
+#define zencode(pkeys,pcrc_32_tab,c,t) \
+    (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
+
+#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
+
+#define RAND_HEAD_LEN  12
+   /* "last resort" source for second part of crypt seed pattern */
+#  ifndef ZCR_SEED2
+#    define ZCR_SEED2 3141592654UL      /* use PI as default pattern */
+#  endif
+
+static unsigned crypthead(const char* passwd,       /* password string */
+                          unsigned char* buf,       /* where to write header */
+                          int bufSize,
+                          unsigned long* pkeys,
+                          const z_crc_t* pcrc_32_tab,
+                          unsigned long crcForCrypting)
+{
+    unsigned n;                  /* index in random header */
+    int t;                       /* temporary */
+    int c;                       /* random byte */
+    unsigned char header[RAND_HEAD_LEN-2]; /* random header */
+    static unsigned calls = 0;   /* ensure different random header each time */
+
+    if (bufSize<RAND_HEAD_LEN)
+      return 0;
+
+    /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
+     * output of rand() to get less predictability, since rand() is
+     * often poorly implemented.
+     */
+    if (++calls == 1)
+    {
+        srand((unsigned)(time(NULL) ^ ZCR_SEED2));
+    }
+    init_keys(passwd, pkeys, pcrc_32_tab);
+    for (n = 0; n < RAND_HEAD_LEN-2; n++)
+    {
+        c = (rand() >> 7) & 0xff;
+        header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
+    }
+    /* Encrypt random header (last two bytes is high word of crc) */
+    init_keys(passwd, pkeys, pcrc_32_tab);
+    for (n = 0; n < RAND_HEAD_LEN-2; n++)
+    {
+        buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
+    }
+    buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
+    buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
+    return n;
+}
+
+#endif

+ 257 - 177
RedAnt ERP Mobile/common/zip/minizip/ioapi.c

@@ -1,177 +1,257 @@
-/* ioapi.c -- IO base function header for compress/uncompress .zip
-   files using zlib + zip or unzip API
-
-   Version 1.01e, February 12th, 2005
-
-   Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "zlib.h"
-#include "ioapi.h"
-
-
-
-/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
-
-#ifndef SEEK_CUR
-#define SEEK_CUR    1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END    2
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET    0
-#endif
-
-voidpf ZCALLBACK fopen_file_func OF((
-   voidpf opaque,
-   const char* filename,
-   int mode));
-
-uLong ZCALLBACK fread_file_func OF((
-   voidpf opaque,
-   voidpf stream,
-   void* buf,
-   uLong size));
-
-uLong ZCALLBACK fwrite_file_func OF((
-   voidpf opaque,
-   voidpf stream,
-   const void* buf,
-   uLong size));
-
-long ZCALLBACK ftell_file_func OF((
-   voidpf opaque,
-   voidpf stream));
-
-long ZCALLBACK fseek_file_func OF((
-   voidpf opaque,
-   voidpf stream,
-   uLong offset,
-   int origin));
-
-int ZCALLBACK fclose_file_func OF((
-   voidpf opaque,
-   voidpf stream));
-
-int ZCALLBACK ferror_file_func OF((
-   voidpf opaque,
-   voidpf stream));
-
-
-voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
-   voidpf opaque;
-   const char* filename;
-   int mode;
-{
-    FILE* file = NULL;
-    const char* mode_fopen = NULL;
-    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
-        mode_fopen = "rb";
-    else
-    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
-        mode_fopen = "r+b";
-    else
-    if (mode & ZLIB_FILEFUNC_MODE_CREATE)
-        mode_fopen = "wb";
-
-    if ((filename!=NULL) && (mode_fopen != NULL))
-        file = fopen(filename, mode_fopen);
-    return file;
-}
-
-
-uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
-   voidpf opaque;
-   voidpf stream;
-   void* buf;
-   uLong size;
-{
-    uLong ret;
-    ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
-    return ret;
-}
-
-
-uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
-   voidpf opaque;
-   voidpf stream;
-   const void* buf;
-   uLong size;
-{
-    uLong ret;
-    ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
-    return ret;
-}
-
-long ZCALLBACK ftell_file_func (opaque, stream)
-   voidpf opaque;
-   voidpf stream;
-{
-    long ret;
-    ret = ftell((FILE *)stream);
-    return ret;
-}
-
-long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
-   voidpf opaque;
-   voidpf stream;
-   uLong offset;
-   int origin;
-{
-    int fseek_origin=0;
-    long ret;
-    switch (origin)
-    {
-    case ZLIB_FILEFUNC_SEEK_CUR :
-        fseek_origin = SEEK_CUR;
-        break;
-    case ZLIB_FILEFUNC_SEEK_END :
-        fseek_origin = SEEK_END;
-        break;
-    case ZLIB_FILEFUNC_SEEK_SET :
-        fseek_origin = SEEK_SET;
-        break;
-    default: return -1;
-    }
-    ret = 0;
-    fseek((FILE *)stream, offset, fseek_origin);
-    return ret;
-}
-
-int ZCALLBACK fclose_file_func (opaque, stream)
-   voidpf opaque;
-   voidpf stream;
-{
-    int ret;
-    ret = fclose((FILE *)stream);
-    return ret;
-}
-
-int ZCALLBACK ferror_file_func (opaque, stream)
-   voidpf opaque;
-   voidpf stream;
-{
-    int ret;
-    ret = ferror((FILE *)stream);
-    return ret;
-}
-
-void fill_fopen_filefunc (pzlib_filefunc_def)
-  zlib_filefunc_def* pzlib_filefunc_def;
-{
-    pzlib_filefunc_def->zopen_file = fopen_file_func;
-    pzlib_filefunc_def->zread_file = fread_file_func;
-    pzlib_filefunc_def->zwrite_file = fwrite_file_func;
-    pzlib_filefunc_def->ztell_file = ftell_file_func;
-    pzlib_filefunc_def->zseek_file = fseek_file_func;
-    pzlib_filefunc_def->zclose_file = fclose_file_func;
-    pzlib_filefunc_def->zerror_file = ferror_file_func;
-    pzlib_filefunc_def->opaque = NULL;
-}
+/* ioapi.h -- IO base function header for compress/uncompress .zip
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+*/
+
+#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
+        #define _CRT_SECURE_NO_WARNINGS
+#endif
+
+#if defined(__APPLE__) || defined(IOAPI_NO_64)
+// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
+#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
+#define FTELLO_FUNC(stream) ftello(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
+#else
+#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
+#define FTELLO_FUNC(stream) ftello64(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
+#endif
+
+
+#include "ioapi.h"
+
+voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
+{
+    if (pfilefunc->zfile_func64.zopen64_file != NULL)
+        return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
+    else
+    {
+        return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
+    }
+}
+
+long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
+{
+    if (pfilefunc->zfile_func64.zseek64_file != NULL)
+        return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
+    else
+    {
+        uLong offsetTruncated = (uLong)offset;
+        if (offsetTruncated != offset)
+            return -1;
+        else
+            return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
+    }
+}
+
+ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
+{
+    if (pfilefunc->zfile_func64.zseek64_file != NULL)
+        return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
+    else
+    {
+        uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
+        if ((tell_uLong) == MAXU32)
+            return (ZPOS64_T)-1;
+        else
+            return tell_uLong;
+    }
+}
+
+void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
+{
+    p_filefunc64_32->zfile_func64.zopen64_file = NULL;
+    p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
+    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
+    p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
+    p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
+    p_filefunc64_32->zfile_func64.ztell64_file = NULL;
+    p_filefunc64_32->zfile_func64.zseek64_file = NULL;
+    p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
+    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
+    p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
+    p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
+    p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
+}
+
+
+
+static voidpf  ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
+static uLong   ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+static uLong   ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
+static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
+static long    ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+static int     ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
+static int     ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
+
+static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
+{
+    FILE* file = NULL;
+    const char* mode_fopen = NULL;
+    (void)opaque;
+    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+        mode_fopen = "rb";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+        mode_fopen = "r+b";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+        mode_fopen = "wb";
+
+    if ((filename!=NULL) && (mode_fopen != NULL))
+        file = fopen(filename, mode_fopen);
+    return file;
+}
+
+static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
+{
+    FILE* file = NULL;
+    const char* mode_fopen = NULL;
+    (void)opaque;
+    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+        mode_fopen = "rb";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+        mode_fopen = "r+b";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+        mode_fopen = "wb";
+
+    if ((filename!=NULL) && (mode_fopen != NULL))
+        file = FOPEN_FUNC((const char*)filename, mode_fopen);
+    return file;
+}
+
+
+static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
+{
+    uLong ret;
+    (void)opaque;
+    ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
+    return ret;
+}
+
+static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
+{
+    uLong ret;
+    (void)opaque;
+    ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
+    return ret;
+}
+
+static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
+{
+    long ret;
+    (void)opaque;
+    ret = ftell((FILE *)stream);
+    return ret;
+}
+
+
+static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
+{
+    ZPOS64_T ret;
+    (void)opaque;
+    ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
+    return ret;
+}
+
+static long ZCALLBACK fseek_file_func (voidpf  opaque, voidpf stream, uLong offset, int origin)
+{
+    int fseek_origin=0;
+    long ret;
+    (void)opaque;
+    switch (origin)
+    {
+    case ZLIB_FILEFUNC_SEEK_CUR :
+        fseek_origin = SEEK_CUR;
+        break;
+    case ZLIB_FILEFUNC_SEEK_END :
+        fseek_origin = SEEK_END;
+        break;
+    case ZLIB_FILEFUNC_SEEK_SET :
+        fseek_origin = SEEK_SET;
+        break;
+    default: return -1;
+    }
+    ret = 0;
+    if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
+        ret = -1;
+    return ret;
+}
+
+static long ZCALLBACK fseek64_file_func (voidpf  opaque, voidpf stream, ZPOS64_T offset, int origin)
+{
+    int fseek_origin=0;
+    long ret;
+    (void)opaque;
+    switch (origin)
+    {
+    case ZLIB_FILEFUNC_SEEK_CUR :
+        fseek_origin = SEEK_CUR;
+        break;
+    case ZLIB_FILEFUNC_SEEK_END :
+        fseek_origin = SEEK_END;
+        break;
+    case ZLIB_FILEFUNC_SEEK_SET :
+        fseek_origin = SEEK_SET;
+        break;
+    default: return -1;
+    }
+    ret = 0;
+
+    if(FSEEKO_FUNC((FILE *)stream, (z_off_t)offset, fseek_origin) != 0)
+                        ret = -1;
+
+    return ret;
+}
+
+
+static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
+{
+    int ret;
+    (void)opaque;
+    ret = fclose((FILE *)stream);
+    return ret;
+}
+
+static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
+{
+    int ret;
+    (void)opaque;
+    ret = ferror((FILE *)stream);
+    return ret;
+}
+
+void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
+//  zlib_filefunc_def* pzlib_filefunc_def;
+{
+    pzlib_filefunc_def->zopen_file = fopen_file_func;
+    pzlib_filefunc_def->zread_file = fread_file_func;
+    pzlib_filefunc_def->zwrite_file = fwrite_file_func;
+    pzlib_filefunc_def->ztell_file = ftell_file_func;
+    pzlib_filefunc_def->zseek_file = fseek_file_func;
+    pzlib_filefunc_def->zclose_file = fclose_file_func;
+    pzlib_filefunc_def->zerror_file = ferror_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}
+
+void fill_fopen64_filefunc (zlib_filefunc64_def*  pzlib_filefunc_def)
+{
+    pzlib_filefunc_def->zopen64_file = fopen64_file_func;
+    pzlib_filefunc_def->zread_file = fread_file_func;
+    pzlib_filefunc_def->zwrite_file = fwrite_file_func;
+    pzlib_filefunc_def->ztell64_file = ftell64_file_func;
+    pzlib_filefunc_def->zseek64_file = fseek64_file_func;
+    pzlib_filefunc_def->zclose_file = fclose_file_func;
+    pzlib_filefunc_def->zerror_file = ferror_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}

+ 210 - 75
RedAnt ERP Mobile/common/zip/minizip/ioapi.h

@@ -1,75 +1,210 @@
-/* ioapi.h -- IO base function header for compress/uncompress .zip
-   files using zlib + zip or unzip API
-
-   Version 1.01e, February 12th, 2005
-
-   Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#ifndef _ZLIBIOAPI_H
-#define _ZLIBIOAPI_H
-
-
-#define ZLIB_FILEFUNC_SEEK_CUR (1)
-#define ZLIB_FILEFUNC_SEEK_END (2)
-#define ZLIB_FILEFUNC_SEEK_SET (0)
-
-#define ZLIB_FILEFUNC_MODE_READ      (1)
-#define ZLIB_FILEFUNC_MODE_WRITE     (2)
-#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
-
-#define ZLIB_FILEFUNC_MODE_EXISTING (4)
-#define ZLIB_FILEFUNC_MODE_CREATE   (8)
-
-
-#ifndef ZCALLBACK
-
-#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
-#define ZCALLBACK CALLBACK
-#else
-#define ZCALLBACK
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
-typedef uLong  (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
-typedef uLong  (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
-typedef long   (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
-typedef long   (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
-typedef int    (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
-typedef int    (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
-
-typedef struct zlib_filefunc_def_s
-{
-    open_file_func      zopen_file;
-    read_file_func      zread_file;
-    write_file_func     zwrite_file;
-    tell_file_func      ztell_file;
-    seek_file_func      zseek_file;
-    close_file_func     zclose_file;
-    testerror_file_func zerror_file;
-    voidpf              opaque;
-} zlib_filefunc_def;
-
-
-
-void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
-
-#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
-#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
-#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
-#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
-#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
-#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/* ioapi.h -- IO base function header for compress/uncompress .zip
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+         Changes
+
+    Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
+    Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
+               More if/def section may be needed to support other platforms
+    Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
+                          (but you should use iowin32.c for windows instead)
+
+*/
+
+#ifndef _ZLIBIOAPI64_H
+#define _ZLIBIOAPI64_H
+
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
+
+  // Linux needs this to support file operation on files larger then 4+GB
+  // But might need better if/def to select just the platforms that needs them.
+
+        #ifndef __USE_FILE_OFFSET64
+                #define __USE_FILE_OFFSET64
+        #endif
+        #ifndef __USE_LARGEFILE64
+                #define __USE_LARGEFILE64
+        #endif
+        #ifndef _LARGEFILE64_SOURCE
+                #define _LARGEFILE64_SOURCE
+        #endif
+        #ifndef _FILE_OFFSET_BIT
+                #define _FILE_OFFSET_BIT 64
+        #endif
+
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "zlib.h"
+
+#if defined(USE_FILE32API)
+#define fopen64 fopen
+#define ftello64 ftell
+#define fseeko64 fseek
+#else
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#define fopen64 fopen
+#define ftello64 ftello
+#define fseeko64 fseeko
+#endif
+#ifdef _MSC_VER
+ #define fopen64 fopen
+ #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
+  #define ftello64 _ftelli64
+  #define fseeko64 _fseeki64
+ #else // old MSC
+  #define ftello64 ftell
+  #define fseeko64 fseek
+ #endif
+#endif
+#endif
+
+/*
+#ifndef ZPOS64_T
+  #ifdef _WIN32
+                #define ZPOS64_T fpos_t
+  #else
+    #include <stdint.h>
+    #define ZPOS64_T uint64_t
+  #endif
+#endif
+*/
+
+#ifdef HAVE_MINIZIP64_CONF_H
+#include "mz64conf.h"
+#endif
+
+/* a type choosen by DEFINE */
+#ifdef HAVE_64BIT_INT_CUSTOM
+typedef  64BIT_INT_CUSTOM_TYPE ZPOS64_T;
+#else
+#ifdef HAS_STDINT_H
+#include "stdint.h"
+typedef uint64_t ZPOS64_T;
+#else
+
+
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+typedef unsigned __int64 ZPOS64_T;
+#else
+typedef unsigned long long int ZPOS64_T;
+#endif
+#endif
+#endif
+
+/* Maximum unsigned 32-bit value used as placeholder for zip64 */
+#ifndef MAXU32
+#define MAXU32 (0xffffffff)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define ZLIB_FILEFUNC_SEEK_CUR (1)
+#define ZLIB_FILEFUNC_SEEK_END (2)
+#define ZLIB_FILEFUNC_SEEK_SET (0)
+
+#define ZLIB_FILEFUNC_MODE_READ      (1)
+#define ZLIB_FILEFUNC_MODE_WRITE     (2)
+#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
+
+#define ZLIB_FILEFUNC_MODE_EXISTING (4)
+#define ZLIB_FILEFUNC_MODE_CREATE   (8)
+
+
+#ifndef ZCALLBACK
+ #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
+   #define ZCALLBACK CALLBACK
+ #else
+   #define ZCALLBACK
+ #endif
+#endif
+
+
+
+
+typedef voidpf   (ZCALLBACK *open_file_func)      OF((voidpf opaque, const char* filename, int mode));
+typedef uLong    (ZCALLBACK *read_file_func)      OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+typedef uLong    (ZCALLBACK *write_file_func)     OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+typedef int      (ZCALLBACK *close_file_func)     OF((voidpf opaque, voidpf stream));
+typedef int      (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
+
+typedef long     (ZCALLBACK *tell_file_func)      OF((voidpf opaque, voidpf stream));
+typedef long     (ZCALLBACK *seek_file_func)      OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+
+
+/* here is the "old" 32 bits structure structure */
+typedef struct zlib_filefunc_def_s
+{
+    open_file_func      zopen_file;
+    read_file_func      zread_file;
+    write_file_func     zwrite_file;
+    tell_file_func      ztell_file;
+    seek_file_func      zseek_file;
+    close_file_func     zclose_file;
+    testerror_file_func zerror_file;
+    voidpf              opaque;
+} zlib_filefunc_def;
+
+typedef ZPOS64_T (ZCALLBACK *tell64_file_func)    OF((voidpf opaque, voidpf stream));
+typedef long     (ZCALLBACK *seek64_file_func)    OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+typedef voidpf   (ZCALLBACK *open64_file_func)    OF((voidpf opaque, const void* filename, int mode));
+
+typedef struct zlib_filefunc64_def_s
+{
+    open64_file_func    zopen64_file;
+    read_file_func      zread_file;
+    write_file_func     zwrite_file;
+    tell64_file_func    ztell64_file;
+    seek64_file_func    zseek64_file;
+    close_file_func     zclose_file;
+    testerror_file_func zerror_file;
+    voidpf              opaque;
+} zlib_filefunc64_def;
+
+void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
+
+/* now internal definition, only for zip.c and unzip.h */
+typedef struct zlib_filefunc64_32_def_s
+{
+    zlib_filefunc64_def zfile_func64;
+    open_file_func      zopen32_file;
+    tell_file_func      ztell32_file;
+    seek_file_func      zseek32_file;
+} zlib_filefunc64_32_def;
+
+
+#define ZREAD64(filefunc,filestream,buf,size)     ((*((filefunc).zfile_func64.zread_file))   ((filefunc).zfile_func64.opaque,filestream,buf,size))
+#define ZWRITE64(filefunc,filestream,buf,size)    ((*((filefunc).zfile_func64.zwrite_file))  ((filefunc).zfile_func64.opaque,filestream,buf,size))
+//#define ZTELL64(filefunc,filestream)            ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
+//#define ZSEEK64(filefunc,filestream,pos,mode)   ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
+#define ZCLOSE64(filefunc,filestream)             ((*((filefunc).zfile_func64.zclose_file))  ((filefunc).zfile_func64.opaque,filestream))
+#define ZERROR64(filefunc,filestream)             ((*((filefunc).zfile_func64.zerror_file))  ((filefunc).zfile_func64.opaque,filestream))
+
+voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
+long    call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
+ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
+
+void    fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
+
+#define ZOPEN64(filefunc,filename,mode)         (call_zopen64((&(filefunc)),(filename),(mode)))
+#define ZTELL64(filefunc,filestream)            (call_ztell64((&(filefunc)),(filestream)))
+#define ZSEEK64(filefunc,filestream,pos,mode)   (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 291 - 283
RedAnt ERP Mobile/common/zip/minizip/mztools.c

@@ -1,283 +1,291 @@
-/*
-  Additional tools for Minizip
-  Code: Xavier Roche '2004
-  License: Same as ZLIB (www.gzip.org)
-*/
-
-/* Code */
-#pragma clang diagnostic ignored "-Wstrict-prototypes"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "zlib.h"
-#include "unzip.h"
-
-#define READ_8(adr)  ((unsigned char)*(adr))
-#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
-#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
-
-#define WRITE_8(buff, n) do { \
-  *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
-} while(0)
-#define WRITE_16(buff, n) do { \
-  WRITE_8((unsigned char*)(buff), n); \
-  WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
-} while(0)
-#define WRITE_32(buff, n) do { \
-  WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
-  WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
-} while(0)
-
-extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
-const char* file;
-const char* fileOut;
-const char* fileOutTmp;
-uLong* nRecovered;
-uLong* bytesRecovered;
-{
-  int err = Z_OK;
-  FILE* fpZip = fopen(file, "rb");
-  FILE* fpOut = fopen(fileOut, "wb");
-  FILE* fpOutCD = fopen(fileOutTmp, "wb");
-  if (fpZip != NULL &&  fpOut != NULL) {
-    int entries = 0;
-    uLong totalBytes = 0;
-    char header[30];
-    char filename[256];
-    char extra[1024];
-    int offset = 0;
-    int offsetCD = 0;
-    while ( fread(header, 1, 30, fpZip) == 30 ) {
-      int currentOffset = offset;
-
-      /* File entry */
-      if (READ_32(header) == 0x04034b50) {
-        unsigned int version = READ_16(header + 4);
-        unsigned int gpflag = READ_16(header + 6);
-        unsigned int method = READ_16(header + 8);
-        unsigned int filetime = READ_16(header + 10);
-        unsigned int filedate = READ_16(header + 12);
-        unsigned int crc = READ_32(header + 14); /* crc */
-        unsigned int cpsize = READ_32(header + 18); /* compressed size */
-        unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
-        unsigned int fnsize = READ_16(header + 26); /* file name length */
-        unsigned int extsize = READ_16(header + 28); /* extra field length */
-        filename[0] = extra[0] = '\0';
-        
-        /* Header */
-        if (fwrite(header, 1, 30, fpOut) == 30) {
-          offset += 30;
-        } else {
-          err = Z_ERRNO;
-          break;
-        }
-        
-        /* Filename */
-        if (fnsize > 0) {
-          if (fread(filename, 1, fnsize, fpZip) == fnsize) {
-            if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
-              offset += fnsize;
-            } else {
-              err = Z_ERRNO;
-              break;
-            }
-          } else {
-            err = Z_ERRNO;
-            break;
-          }
-        } else {
-          err = Z_STREAM_ERROR;
-          break;
-        }
-
-        /* Extra field */
-        if (extsize > 0) {
-          if (fread(extra, 1, extsize, fpZip) == extsize) {
-            if (fwrite(extra, 1, extsize, fpOut) == extsize) {
-              offset += extsize;
-            } else {
-              err = Z_ERRNO;
-              break;
-            }
-          } else {
-            err = Z_ERRNO;
-            break;
-          }
-        }
-        
-        /* Data */
-        {
-          int dataSize = cpsize;
-          if (dataSize == 0) {
-            dataSize = uncpsize;
-          }
-          if (dataSize > 0) {
-            char* data = malloc(dataSize);
-            if (data != NULL) {
-              if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
-                if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
-                  offset += dataSize;
-                  totalBytes += dataSize;
-                } else {
-                  err = Z_ERRNO;
-                }
-              } else {
-                err = Z_ERRNO;
-              }
-              free(data);
-              if (err != Z_OK) {
-                break;
-              }
-            } else {
-              err = Z_MEM_ERROR;
-              break;
-            }
-          }
-        }
-        
-        /* Central directory entry */
-        {
-          char header[46];
-          char* comment = "";
-          int comsize = (int) strlen(comment);
-          WRITE_32(header, 0x02014b50);
-          WRITE_16(header + 4, version);
-          WRITE_16(header + 6, version);
-          WRITE_16(header + 8, gpflag);
-          WRITE_16(header + 10, method);
-          WRITE_16(header + 12, filetime);
-          WRITE_16(header + 14, filedate);
-          WRITE_32(header + 16, crc);
-          WRITE_32(header + 20, cpsize);
-          WRITE_32(header + 24, uncpsize);
-          WRITE_16(header + 28, fnsize);
-          WRITE_16(header + 30, extsize);
-          WRITE_16(header + 32, comsize);
-          WRITE_16(header + 34, 0);     /* disk # */
-          WRITE_16(header + 36, 0);     /* int attrb */
-          WRITE_32(header + 38, 0);     /* ext attrb */
-          WRITE_32(header + 42, currentOffset);
-          /* Header */
-          if (fwrite(header, 1, 46, fpOutCD) == 46) {
-            offsetCD += 46;
-            
-            /* Filename */
-            if (fnsize > 0) {
-              if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
-                offsetCD += fnsize;
-              } else {
-                err = Z_ERRNO;
-                break;
-              }
-            } else {
-              err = Z_STREAM_ERROR;
-              break;
-            }
-            
-            /* Extra field */
-            if (extsize > 0) {
-              if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
-                offsetCD += extsize;
-              } else {
-                err = Z_ERRNO;
-                break;
-              }
-            }
-            
-            /* Comment field */
-            if (comsize > 0) {
-              if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
-                offsetCD += comsize;
-              } else {
-                err = Z_ERRNO;
-                break;
-              }
-            }
-            
-            
-          } else {
-            err = Z_ERRNO;
-            break;
-          }
-        }
-
-        /* Success */
-        entries++;
-
-      } else {
-        break;
-      }
-    }
-
-    /* Final central directory  */
-    {
-      int entriesZip = entries;
-      char header[22];
-      char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
-      int comsize = (int) strlen(comment);
-      if (entriesZip > 0xffff) {
-        entriesZip = 0xffff;
-      }
-      WRITE_32(header, 0x06054b50);
-      WRITE_16(header + 4, 0);    /* disk # */
-      WRITE_16(header + 6, 0);    /* disk # */
-      WRITE_16(header + 8, entriesZip);   /* hack */
-      WRITE_16(header + 10, entriesZip);  /* hack */
-      WRITE_32(header + 12, offsetCD);    /* size of CD */
-      WRITE_32(header + 16, offset);      /* offset to CD */
-      WRITE_16(header + 20, comsize);     /* comment */
-      
-      /* Header */
-      if (fwrite(header, 1, 22, fpOutCD) == 22) {
-        
-        /* Comment field */
-        if (comsize > 0) {
-          if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
-            err = Z_ERRNO;
-          }
-        }
-        
-      } else {
-        err = Z_ERRNO;
-      }
-    }
-
-    /* Final merge (file + central directory) */
-    fclose(fpOutCD);
-    if (err == Z_OK) {
-      fpOutCD = fopen(fileOutTmp, "rb");
-      if (fpOutCD != NULL) {
-        int nRead;
-        char buffer[8192];
-        while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
-          if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
-            err = Z_ERRNO;
-            break;
-          }
-        }
-        fclose(fpOutCD);
-      }
-    }
-    
-    /* Close */
-    fclose(fpZip);
-    fclose(fpOut);
-    
-    /* Wipe temporary file */
-    (void)remove(fileOutTmp);
-    
-    /* Number of recovered entries */
-    if (err == Z_OK) {
-      if (nRecovered != NULL) {
-        *nRecovered = entries;
-      }
-      if (bytesRecovered != NULL) {
-        *bytesRecovered = totalBytes;
-      }
-    }
-  } else {
-    err = Z_STREAM_ERROR;
-  }
-  return err;
-}
+/*
+  Additional tools for Minizip
+  Code: Xavier Roche '2004
+  License: Same as ZLIB (www.gzip.org)
+*/
+
+/* Code */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "zlib.h"
+#include "unzip.h"
+
+#define READ_8(adr)  ((unsigned char)*(adr))
+#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
+#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
+
+#define WRITE_8(buff, n) do { \
+  *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
+} while(0)
+#define WRITE_16(buff, n) do { \
+  WRITE_8((unsigned char*)(buff), n); \
+  WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
+} while(0)
+#define WRITE_32(buff, n) do { \
+  WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
+  WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
+} while(0)
+
+extern int ZEXPORT unzRepair(const char* file,const char* fileOut,const char* fileOutTmp,uLong* nRecovered,uLong* bytesRecovered)
+//const char* file;
+//const char* fileOut;
+//const char* fileOutTmp;
+//uLong* nRecovered;
+//uLong* bytesRecovered;
+{
+  int err = Z_OK;
+  FILE* fpZip = fopen(file, "rb");
+  FILE* fpOut = fopen(fileOut, "wb");
+  FILE* fpOutCD = fopen(fileOutTmp, "wb");
+  if (fpZip != NULL &&  fpOut != NULL) {
+    int entries = 0;
+    uLong totalBytes = 0;
+    char header[30];
+    char filename[1024];
+    char extra[1024];
+    int offset = 0;
+    int offsetCD = 0;
+    while ( fread(header, 1, 30, fpZip) == 30 ) {
+      int currentOffset = offset;
+
+      /* File entry */
+      if (READ_32(header) == 0x04034b50) {
+        unsigned int version = READ_16(header + 4);
+        unsigned int gpflag = READ_16(header + 6);
+        unsigned int method = READ_16(header + 8);
+        unsigned int filetime = READ_16(header + 10);
+        unsigned int filedate = READ_16(header + 12);
+        unsigned int crc = READ_32(header + 14); /* crc */
+        unsigned int cpsize = READ_32(header + 18); /* compressed size */
+        unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
+        unsigned int fnsize = READ_16(header + 26); /* file name length */
+        unsigned int extsize = READ_16(header + 28); /* extra field length */
+        filename[0] = extra[0] = '\0';
+
+        /* Header */
+        if (fwrite(header, 1, 30, fpOut) == 30) {
+          offset += 30;
+        } else {
+          err = Z_ERRNO;
+          break;
+        }
+
+        /* Filename */
+        if (fnsize > 0) {
+          if (fnsize < sizeof(filename)) {
+            if (fread(filename, 1, fnsize, fpZip) == fnsize) {
+                if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
+                offset += fnsize;
+              } else {
+                err = Z_ERRNO;
+                break;
+              }
+            } else {
+              err = Z_ERRNO;
+              break;
+            }
+          } else {
+            err = Z_ERRNO;
+            break;
+          }
+        } else {
+          err = Z_STREAM_ERROR;
+          break;
+        }
+
+        /* Extra field */
+        if (extsize > 0) {
+          if (extsize < sizeof(extra)) {
+            if (fread(extra, 1, extsize, fpZip) == extsize) {
+              if (fwrite(extra, 1, extsize, fpOut) == extsize) {
+                offset += extsize;
+                } else {
+                err = Z_ERRNO;
+                break;
+              }
+            } else {
+              err = Z_ERRNO;
+              break;
+            }
+          } else {
+            err = Z_ERRNO;
+            break;
+          }
+        }
+
+        /* Data */
+        {
+          int dataSize = cpsize;
+          if (dataSize == 0) {
+            dataSize = uncpsize;
+          }
+          if (dataSize > 0) {
+            char* data = malloc(dataSize);
+            if (data != NULL) {
+              if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
+                if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
+                  offset += dataSize;
+                  totalBytes += dataSize;
+                } else {
+                  err = Z_ERRNO;
+                }
+              } else {
+                err = Z_ERRNO;
+              }
+              free(data);
+              if (err != Z_OK) {
+                break;
+              }
+            } else {
+              err = Z_MEM_ERROR;
+              break;
+            }
+          }
+        }
+
+        /* Central directory entry */
+        {
+          char header[46];
+          char* comment = "";
+          int comsize = (int) strlen(comment);
+          WRITE_32(header, 0x02014b50);
+          WRITE_16(header + 4, version);
+          WRITE_16(header + 6, version);
+          WRITE_16(header + 8, gpflag);
+          WRITE_16(header + 10, method);
+          WRITE_16(header + 12, filetime);
+          WRITE_16(header + 14, filedate);
+          WRITE_32(header + 16, crc);
+          WRITE_32(header + 20, cpsize);
+          WRITE_32(header + 24, uncpsize);
+          WRITE_16(header + 28, fnsize);
+          WRITE_16(header + 30, extsize);
+          WRITE_16(header + 32, comsize);
+          WRITE_16(header + 34, 0);     /* disk # */
+          WRITE_16(header + 36, 0);     /* int attrb */
+          WRITE_32(header + 38, 0);     /* ext attrb */
+          WRITE_32(header + 42, currentOffset);
+          /* Header */
+          if (fwrite(header, 1, 46, fpOutCD) == 46) {
+            offsetCD += 46;
+
+            /* Filename */
+            if (fnsize > 0) {
+              if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
+                offsetCD += fnsize;
+              } else {
+                err = Z_ERRNO;
+                break;
+              }
+            } else {
+              err = Z_STREAM_ERROR;
+              break;
+            }
+
+            /* Extra field */
+            if (extsize > 0) {
+              if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
+                offsetCD += extsize;
+              } else {
+                err = Z_ERRNO;
+                break;
+              }
+            }
+
+            /* Comment field */
+            if (comsize > 0) {
+              if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
+                offsetCD += comsize;
+              } else {
+                err = Z_ERRNO;
+                break;
+              }
+            }
+
+
+          } else {
+            err = Z_ERRNO;
+            break;
+          }
+        }
+
+        /* Success */
+        entries++;
+
+      } else {
+        break;
+      }
+    }
+
+    /* Final central directory  */
+    {
+      int entriesZip = entries;
+      char header[22];
+      char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
+      int comsize = (int) strlen(comment);
+      if (entriesZip > 0xffff) {
+        entriesZip = 0xffff;
+      }
+      WRITE_32(header, 0x06054b50);
+      WRITE_16(header + 4, 0);    /* disk # */
+      WRITE_16(header + 6, 0);    /* disk # */
+      WRITE_16(header + 8, entriesZip);   /* hack */
+      WRITE_16(header + 10, entriesZip);  /* hack */
+      WRITE_32(header + 12, offsetCD);    /* size of CD */
+      WRITE_32(header + 16, offset);      /* offset to CD */
+      WRITE_16(header + 20, comsize);     /* comment */
+
+      /* Header */
+      if (fwrite(header, 1, 22, fpOutCD) == 22) {
+
+        /* Comment field */
+        if (comsize > 0) {
+          if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
+            err = Z_ERRNO;
+          }
+        }
+
+      } else {
+        err = Z_ERRNO;
+      }
+    }
+
+    /* Final merge (file + central directory) */
+    fclose(fpOutCD);
+    if (err == Z_OK) {
+      fpOutCD = fopen(fileOutTmp, "rb");
+      if (fpOutCD != NULL) {
+        int nRead;
+        char buffer[8192];
+        while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
+          if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
+            err = Z_ERRNO;
+            break;
+          }
+        }
+        fclose(fpOutCD);
+      }
+    }
+
+    /* Close */
+    fclose(fpZip);
+    fclose(fpOut);
+
+    /* Wipe temporary file */
+    (void)remove(fileOutTmp);
+
+    /* Number of recovered entries */
+    if (err == Z_OK) {
+      if (nRecovered != NULL) {
+        *nRecovered = entries;
+      }
+      if (bytesRecovered != NULL) {
+        *bytesRecovered = totalBytes;
+      }
+    }
+  } else {
+    err = Z_STREAM_ERROR;
+  }
+  return err;
+}

+ 37 - 31
RedAnt ERP Mobile/common/zip/minizip/mztools.h

@@ -1,31 +1,37 @@
-/*
-  Additional tools for Minizip
-  Code: Xavier Roche '2004
-  License: Same as ZLIB (www.gzip.org)
-*/
-
-#ifndef _zip_tools_H
-#define _zip_tools_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#include "unzip.h"
-
-/* Repair a ZIP file (missing central directory) 
-   file: file to recover
-   fileOut: output file after recovery
-   fileOutTmp: temporary file name used for recovery
-*/
-extern int ZEXPORT unzRepair(const char* file, 
-                             const char* fileOut, 
-                             const char* fileOutTmp, 
-                             uLong* nRecovered,
-                             uLong* bytesRecovered);
-
-#endif
+/*
+  Additional tools for Minizip
+  Code: Xavier Roche '2004
+  License: Same as ZLIB (www.gzip.org)
+*/
+
+#ifndef _zip_tools_H
+#define _zip_tools_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#include "unzip.h"
+
+/* Repair a ZIP file (missing central directory)
+   file: file to recover
+   fileOut: output file after recovery
+   fileOutTmp: temporary file name used for recovery
+*/
+extern int ZEXPORT unzRepair(const char* file,
+                             const char* fileOut,
+                             const char* fileOutTmp,
+                             uLong* nRecovered,
+                             uLong* bytesRecovered);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif

+ 2130 - 1599
RedAnt ERP Mobile/common/zip/minizip/unzip.c

@@ -1,1599 +1,2130 @@
-/* unzip.c -- IO for uncompress .zip files using zlib
-   Version 1.01e, February 12th, 2005
-
-   Copyright (C) 1998-2005 Gilles Vollant
-
-   Read unzip.h for more info
-*/
-
-/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
-compatibility with older software. The following is from the original crypt.c. Code
-woven in by Terry Thorsen 1/2003.
-*/
-/*
-  Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.
-
-  See the accompanying file LICENSE, version 2000-Apr-09 or later
-  (the contents of which are also included in zip.h) for terms of use.
-  If, for some reason, all these files are missing, the Info-ZIP license
-  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
-*/
-/*
-  crypt.c (full version) by Info-ZIP.      Last revised:  [see crypt.h]
-
-  The encryption/decryption parts of this source code (as opposed to the
-  non-echoing password parts) were originally written in Europe.  The
-  whole source package can be freely distributed, including from the USA.
-  (Prior to January 2000, re-export from the US was a violation of US law.)
- */
-
-/*
-  This encryption code is a direct transcription of the algorithm from
-  Roger Schlafly, described by Phil Katz in the file appnote.txt.  This
-  file (appnote.txt) is distributed with the PKZIP program (even in the
-  version without encryption capabilities).
- */
-
-#pragma clang diagnostic ignored "-Wparentheses-equality"
-#pragma clang diagnostic ignored "-Wunused-variable"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "zlib.h"
-#include "unzip.h"
-
-#ifdef STDC
-#  include <stddef.h>
-#  include <string.h>
-#  include <stdlib.h>
-#endif
-#ifdef NO_ERRNO_H
-    extern int errno;
-#else
-#   include <errno.h>
-#endif
-
-
-#ifndef local
-#  define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-
-#ifndef CASESENSITIVITYDEFAULT_NO
-#  if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
-#    define CASESENSITIVITYDEFAULT_NO
-#  endif
-#endif
-
-
-#ifndef UNZ_BUFSIZE
-#define UNZ_BUFSIZE (16384)
-#endif
-
-#ifndef UNZ_MAXFILENAMEINZIP
-#define UNZ_MAXFILENAMEINZIP (256)
-#endif
-
-#ifndef ALLOC
-# define ALLOC(size) (malloc(size))
-#endif
-#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
-#endif
-
-#define SIZECENTRALDIRITEM (0x2e)
-#define SIZEZIPLOCALHEADER (0x1e)
-
-
-
-
-const char unz_copyright[] =
-   " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
-
-/* unz_file_info_interntal contain internal info about a file in zipfile*/
-typedef struct unz_file_info_internal_s
-{
-    uLong offset_curfile;/* relative offset of local header 4 bytes */
-} unz_file_info_internal;
-
-
-/* file_in_zip_read_info_s contain internal information about a file in zipfile,
-    when reading and decompress it */
-typedef struct
-{
-    char  *read_buffer;         /* internal buffer for compressed data */
-    z_stream stream;            /* zLib stream structure for inflate */
-
-    uLong pos_in_zipfile;       /* position in byte on the zipfile, for fseek*/
-    uLong stream_initialised;   /* flag set if stream structure is initialised*/
-
-    uLong offset_local_extrafield;/* offset of the local extra field */
-    uInt  size_local_extrafield;/* size of the local extra field */
-    uLong pos_local_extrafield;   /* position in the local extra field in read*/
-
-    uLong crc32;                /* crc32 of all data uncompressed */
-    uLong crc32_wait;           /* crc32 we must obtain after decompress all */
-    uLong rest_read_compressed; /* number of byte to be decompressed */
-    uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
-    zlib_filefunc_def z_filefunc;
-    voidpf filestream;        /* io structore of the zipfile */
-    uLong compression_method;   /* compression method (0==store) */
-    uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
-    int   raw;
-} file_in_zip_read_info_s;
-
-
-/* unz_s contain internal information about the zipfile
-*/
-typedef struct
-{
-    zlib_filefunc_def z_filefunc;
-    voidpf filestream;        /* io structore of the zipfile */
-    unz_global_info gi;       /* public global information */
-    uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
-    uLong num_file;             /* number of the current file in the zipfile*/
-    uLong pos_in_central_dir;   /* pos of the current file in the central dir*/
-    uLong current_file_ok;      /* flag about the usability of the current file*/
-    uLong central_pos;          /* position of the beginning of the central dir*/
-
-    uLong size_central_dir;     /* size of the central directory  */
-    uLong offset_central_dir;   /* offset of start of central directory with
-                                   respect to the starting disk number */
-
-    unz_file_info cur_file_info; /* public info about the current file in zip*/
-    unz_file_info_internal cur_file_info_internal; /* private info about it*/
-    file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
-                                        file if we are decompressing it */
-    int encrypted;
-#    ifndef NOUNCRYPT
-    unsigned long keys[3];     /* keys defining the pseudo-random sequence */
-    const unsigned long* pcrc_32_tab;
-#    endif
-} unz_s;
-
-
-#ifndef NOUNCRYPT
-#include "crypt.h"
-#endif
-
-/* ===========================================================================
-     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
-   for end of file.
-   IN assertion: the stream s has been sucessfully opened for reading.
-*/
-
-
-local int unzlocal_getByte OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream,
-    int *pi));
-
-local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    int *pi;
-{
-    unsigned char c;
-    int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
-    if (err==1)
-    {
-        *pi = (int)c;
-        return UNZ_OK;
-    }
-    else
-    {
-        if (ZERROR(*pzlib_filefunc_def,filestream))
-            return UNZ_ERRNO;
-        else
-            return UNZ_EOF;
-    }
-}
-
-
-/* ===========================================================================
-   Reads a long in LSB order from the given gz_stream. Sets
-*/
-local int unzlocal_getShort OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream,
-    uLong *pX));
-
-local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    uLong *pX;
-{
-    uLong x ;
-    int i;
-    int err;
-
-    err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x = (uLong)i;
-
-    if (err==UNZ_OK)
-        err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<8;
-
-    if (err==UNZ_OK)
-        *pX = x;
-    else
-        *pX = 0;
-    return err;
-}
-
-local int unzlocal_getLong OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream,
-    uLong *pX));
-
-local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    uLong *pX;
-{
-    uLong x ;
-    int i;
-    int err;
-
-    err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x = (uLong)i;
-
-    if (err==UNZ_OK)
-        err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<8;
-
-    if (err==UNZ_OK)
-        err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<16;
-
-    if (err==UNZ_OK)
-        err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<24;
-
-    if (err==UNZ_OK)
-        *pX = x;
-    else
-        *pX = 0;
-    return err;
-}
-
-
-/* My own strcmpi / strcasecmp */
-local int strcmpcasenosensitive_internal (fileName1,fileName2)
-    const char* fileName1;
-    const char* fileName2;
-{
-    for (;;)
-    {
-        char c1=*(fileName1++);
-        char c2=*(fileName2++);
-        if ((c1>='a') && (c1<='z'))
-            c1 -= 0x20;
-        if ((c2>='a') && (c2<='z'))
-            c2 -= 0x20;
-        if (c1=='\0')
-            return ((c2=='\0') ? 0 : -1);
-        if (c2=='\0')
-            return 1;
-        if (c1<c2)
-            return -1;
-        if (c1>c2)
-            return 1;
-    }
-}
-
-
-#ifdef  CASESENSITIVITYDEFAULT_NO
-#define CASESENSITIVITYDEFAULTVALUE 2
-#else
-#define CASESENSITIVITYDEFAULTVALUE 1
-#endif
-
-#ifndef STRCMPCASENOSENTIVEFUNCTION
-#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
-#endif
-
-/*
-   Compare two filename (fileName1,fileName2).
-   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
-   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
-                                                                or strcasecmp)
-   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
-        (like 1 on Unix, 2 on Windows)
-
-*/
-extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
-    const char* fileName1;
-    const char* fileName2;
-    int iCaseSensitivity;
-{
-    if (iCaseSensitivity==0)
-        iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
-
-    if (iCaseSensitivity==1)
-        return strcmp(fileName1,fileName2);
-
-    return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
-}
-
-#ifndef BUFREADCOMMENT
-#define BUFREADCOMMENT (0x400)
-#endif
-
-/*
-  Locate the Central directory of a zipfile (at the end, just before
-    the global comment)
-*/
-local uLong unzlocal_SearchCentralDir OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream));
-
-local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-{
-    unsigned char* buf;
-    uLong uSizeFile;
-    uLong uBackRead;
-    uLong uMaxBack=0xffff; /* maximum size of global comment */
-    uLong uPosFound=0;
-
-    if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
-        return 0;
-
-
-    uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
-
-    if (uMaxBack>uSizeFile)
-        uMaxBack = uSizeFile;
-
-    buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
-    if (buf==NULL)
-        return 0;
-
-    uBackRead = 4;
-    while (uBackRead<uMaxBack)
-    {
-        uLong uReadSize,uReadPos ;
-        int i;
-        if (uBackRead+BUFREADCOMMENT>uMaxBack)
-            uBackRead = uMaxBack;
-        else
-            uBackRead+=BUFREADCOMMENT;
-        uReadPos = uSizeFile-uBackRead ;
-
-        uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
-                     (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
-        if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
-            break;
-
-        if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
-            break;
-
-        for (i=(int)uReadSize-3; (i--)>0;)
-            if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
-                ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
-            {
-                uPosFound = uReadPos+i;
-                break;
-            }
-
-        if (uPosFound!=0)
-            break;
-    }
-    TRYFREE(buf);
-    return uPosFound;
-}
-
-/*
-  Open a Zip file. path contain the full pathname (by example,
-     on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer
-     "zlib/zlib114.zip".
-     If the zipfile cannot be opened (file doesn't exist or in not valid), the
-       return value is NULL.
-     Else, the return value is a unzFile Handle, usable with other function
-       of this unzip package.
-*/
-extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
-    const char *path;
-    zlib_filefunc_def* pzlib_filefunc_def;
-{
-    unz_s us;
-    unz_s *s;
-    uLong central_pos,uL;
-
-    uLong number_disk;          /* number of the current dist, used for
-                                   spaning ZIP, unsupported, always 0*/
-    uLong number_disk_with_CD;  /* number the the disk with central dir, used
-                                   for spaning ZIP, unsupported, always 0*/
-    uLong number_entry_CD;      /* total number of entries in
-                                   the central dir
-                                   (same than number_entry on nospan) */
-
-    int err=UNZ_OK;
-
-    if (unz_copyright[0]!=' ')
-        return NULL;
-
-    if (pzlib_filefunc_def==NULL)
-        fill_fopen_filefunc(&us.z_filefunc);
-    else
-        us.z_filefunc = *pzlib_filefunc_def;
-
-    us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque,
-                                                 path,
-                                                 ZLIB_FILEFUNC_MODE_READ |
-                                                 ZLIB_FILEFUNC_MODE_EXISTING);
-    if (us.filestream==NULL)
-        return NULL;
-
-    central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream);
-    if (central_pos==0)
-        err=UNZ_ERRNO;
-
-    if (ZSEEK(us.z_filefunc, us.filestream,
-                                      central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
-        err=UNZ_ERRNO;
-
-    /* the signature, already checked */
-    if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    /* number of this disk */
-    if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    /* number of the disk with the start of the central directory */
-    if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    /* total number of entries in the central dir on this disk */
-    if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    /* total number of entries in the central dir */
-    if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if ((number_entry_CD!=us.gi.number_entry) ||
-        (number_disk_with_CD!=0) ||
-        (number_disk!=0))
-        err=UNZ_BADZIPFILE;
-
-    /* size of the central directory */
-    if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    /* offset of start of central directory with respect to the
-          starting disk number */
-    if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    /* zipfile comment length */
-    if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
-        (err==UNZ_OK))
-        err=UNZ_BADZIPFILE;
-
-    if (err!=UNZ_OK)
-    {
-        ZCLOSE(us.z_filefunc, us.filestream);
-        return NULL;
-    }
-
-    us.byte_before_the_zipfile = central_pos -
-                            (us.offset_central_dir+us.size_central_dir);
-    us.central_pos = central_pos;
-    us.pfile_in_zip_read = NULL;
-    us.encrypted = 0;
-
-
-    s=(unz_s*)ALLOC(sizeof(unz_s));
-    *s=us;
-    unzGoToFirstFile((unzFile)s);
-    return (unzFile)s;
-}
-
-
-extern unzFile ZEXPORT unzOpen (path)
-    const char *path;
-{
-    return unzOpen2(path, NULL);
-}
-
-/*
-  Close a ZipFile opened with unzipOpen.
-  If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
-    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
-  return UNZ_OK if there is no problem. */
-extern int ZEXPORT unzClose (file)
-    unzFile file;
-{
-    unz_s* s;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-
-    if (s->pfile_in_zip_read!=NULL)
-        unzCloseCurrentFile(file);
-
-    ZCLOSE(s->z_filefunc, s->filestream);
-    TRYFREE(s);
-    return UNZ_OK;
-}
-
-
-/*
-  Write info about the ZipFile in the *pglobal_info structure.
-  No preparation of the structure is needed
-  return UNZ_OK if there is no problem. */
-extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
-    unzFile file;
-    unz_global_info *pglobal_info;
-{
-    unz_s* s;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    *pglobal_info=s->gi;
-    return UNZ_OK;
-}
-
-
-/*
-   Translate date/time from Dos format to tm_unz (readable more easilty)
-*/
-local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
-    uLong ulDosDate;
-    tm_unz* ptm;
-{
-    uLong uDate;
-    uDate = (uLong)(ulDosDate>>16);
-    ptm->tm_mday = (uInt)(uDate&0x1f) ;
-    ptm->tm_mon =  (uInt)((((uDate)&0x1E0)/0x20)-1) ;
-    ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
-
-    ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
-    ptm->tm_min =  (uInt) ((ulDosDate&0x7E0)/0x20) ;
-    ptm->tm_sec =  (uInt) (2*(ulDosDate&0x1f)) ;
-}
-
-/*
-  Get Info about the current file in the zipfile, with internal only info
-*/
-local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
-                                                  unz_file_info *pfile_info,
-                                                  unz_file_info_internal
-                                                  *pfile_info_internal,
-                                                  char *szFileName,
-                                                  uLong fileNameBufferSize,
-                                                  void *extraField,
-                                                  uLong extraFieldBufferSize,
-                                                  char *szComment,
-                                                  uLong commentBufferSize));
-
-local int unzlocal_GetCurrentFileInfoInternal (file,
-                                              pfile_info,
-                                              pfile_info_internal,
-                                              szFileName, fileNameBufferSize,
-                                              extraField, extraFieldBufferSize,
-                                              szComment,  commentBufferSize)
-    unzFile file;
-    unz_file_info *pfile_info;
-    unz_file_info_internal *pfile_info_internal;
-    char *szFileName;
-    uLong fileNameBufferSize;
-    void *extraField;
-    uLong extraFieldBufferSize;
-    char *szComment;
-    uLong commentBufferSize;
-{
-    unz_s* s;
-    unz_file_info file_info;
-    unz_file_info_internal file_info_internal;
-    int err=UNZ_OK;
-    uLong uMagic;
-    long lSeek=0;
-
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    if (ZSEEK(s->z_filefunc, s->filestream,
-              s->pos_in_central_dir+s->byte_before_the_zipfile,
-              ZLIB_FILEFUNC_SEEK_SET)!=0)
-        err=UNZ_ERRNO;
-
-
-    /* we check the magic */
-    if (err==UNZ_OK)
-        if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
-            err=UNZ_ERRNO;
-        else if (uMagic!=0x02014b50)
-            err=UNZ_BADZIPFILE;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    lSeek+=file_info.size_filename;
-    if ((err==UNZ_OK) && (szFileName!=NULL))
-    {
-        uLong uSizeRead ;
-        if (file_info.size_filename<fileNameBufferSize)
-        {
-            *(szFileName+file_info.size_filename)='\0';
-            uSizeRead = file_info.size_filename;
-        }
-        else
-            uSizeRead = fileNameBufferSize;
-
-        if ((file_info.size_filename>0) && (fileNameBufferSize>0))
-            if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
-                err=UNZ_ERRNO;
-        lSeek -= uSizeRead;
-    }
-
-
-    if ((err==UNZ_OK) && (extraField!=NULL))
-    {
-        uLong uSizeRead ;
-        if (file_info.size_file_extra<extraFieldBufferSize)
-            uSizeRead = file_info.size_file_extra;
-        else
-            uSizeRead = extraFieldBufferSize;
-
-        if (lSeek!=0)
-            if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
-                lSeek=0;
-            else
-                err=UNZ_ERRNO;
-        if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
-            if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
-                err=UNZ_ERRNO;
-        lSeek += file_info.size_file_extra - uSizeRead;
-    }
-    else
-        lSeek+=file_info.size_file_extra;
-
-
-    if ((err==UNZ_OK) && (szComment!=NULL))
-    {
-        uLong uSizeRead ;
-        if (file_info.size_file_comment<commentBufferSize)
-        {
-            *(szComment+file_info.size_file_comment)='\0';
-            uSizeRead = file_info.size_file_comment;
-        }
-        else
-            uSizeRead = commentBufferSize;
-
-        if (lSeek!=0)
-            if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
-                lSeek=0;
-            else
-                err=UNZ_ERRNO;
-        if ((file_info.size_file_comment>0) && (commentBufferSize>0))
-            if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
-                err=UNZ_ERRNO;
-        lSeek+=file_info.size_file_comment - uSizeRead;
-    }
-    else
-        lSeek+=file_info.size_file_comment;
-
-    if ((err==UNZ_OK) && (pfile_info!=NULL))
-        *pfile_info=file_info;
-
-    if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
-        *pfile_info_internal=file_info_internal;
-
-    return err;
-}
-
-
-
-/*
-  Write info about the ZipFile in the *pglobal_info structure.
-  No preparation of the structure is needed
-  return UNZ_OK if there is no problem.
-*/
-extern int ZEXPORT unzGetCurrentFileInfo (file,
-                                          pfile_info,
-                                          szFileName, fileNameBufferSize,
-                                          extraField, extraFieldBufferSize,
-                                          szComment,  commentBufferSize)
-    unzFile file;
-    unz_file_info *pfile_info;
-    char *szFileName;
-    uLong fileNameBufferSize;
-    void *extraField;
-    uLong extraFieldBufferSize;
-    char *szComment;
-    uLong commentBufferSize;
-{
-    return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
-                                                szFileName,fileNameBufferSize,
-                                                extraField,extraFieldBufferSize,
-                                                szComment,commentBufferSize);
-}
-
-/*
-  Set the current file of the zipfile to the first file.
-  return UNZ_OK if there is no problem
-*/
-extern int ZEXPORT unzGoToFirstFile (file)
-    unzFile file;
-{
-    int err=UNZ_OK;
-    unz_s* s;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    s->pos_in_central_dir=s->offset_central_dir;
-    s->num_file=0;
-    err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
-                                             &s->cur_file_info_internal,
-                                             NULL,0,NULL,0,NULL,0);
-    s->current_file_ok = (err == UNZ_OK);
-    return err;
-}
-
-/*
-  Set the current file of the zipfile to the next file.
-  return UNZ_OK if there is no problem
-  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
-*/
-extern int ZEXPORT unzGoToNextFile (file)
-    unzFile file;
-{
-    unz_s* s;
-    int err;
-
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    if (!s->current_file_ok)
-        return UNZ_END_OF_LIST_OF_FILE;
-    if (s->gi.number_entry != 0xffff)    /* 2^16 files overflow hack */
-      if (s->num_file+1==s->gi.number_entry)
-        return UNZ_END_OF_LIST_OF_FILE;
-
-    s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
-            s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
-    s->num_file++;
-    err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
-                                               &s->cur_file_info_internal,
-                                               NULL,0,NULL,0,NULL,0);
-    s->current_file_ok = (err == UNZ_OK);
-    return err;
-}
-
-
-/*
-  Try locate the file szFileName in the zipfile.
-  For the iCaseSensitivity signification, see unzipStringFileNameCompare
-
-  return value :
-  UNZ_OK if the file is found. It becomes the current file.
-  UNZ_END_OF_LIST_OF_FILE if the file is not found
-*/
-extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
-    unzFile file;
-    const char *szFileName;
-    int iCaseSensitivity;
-{
-    unz_s* s;
-    int err;
-
-    /* We remember the 'current' position in the file so that we can jump
-     * back there if we fail.
-     */
-    unz_file_info cur_file_infoSaved;
-    unz_file_info_internal cur_file_info_internalSaved;
-    uLong num_fileSaved;
-    uLong pos_in_central_dirSaved;
-
-
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-
-    if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
-        return UNZ_PARAMERROR;
-
-    s=(unz_s*)file;
-    if (!s->current_file_ok)
-        return UNZ_END_OF_LIST_OF_FILE;
-
-    /* Save the current state */
-    num_fileSaved = s->num_file;
-    pos_in_central_dirSaved = s->pos_in_central_dir;
-    cur_file_infoSaved = s->cur_file_info;
-    cur_file_info_internalSaved = s->cur_file_info_internal;
-
-    err = unzGoToFirstFile(file);
-
-    while (err == UNZ_OK)
-    {
-        char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
-        err = unzGetCurrentFileInfo(file,NULL,
-                                    szCurrentFileName,sizeof(szCurrentFileName)-1,
-                                    NULL,0,NULL,0);
-        if (err == UNZ_OK)
-        {
-            if (unzStringFileNameCompare(szCurrentFileName,
-                                            szFileName,iCaseSensitivity)==0)
-                return UNZ_OK;
-            err = unzGoToNextFile(file);
-        }
-    }
-
-    /* We failed, so restore the state of the 'current file' to where we
-     * were.
-     */
-    s->num_file = num_fileSaved ;
-    s->pos_in_central_dir = pos_in_central_dirSaved ;
-    s->cur_file_info = cur_file_infoSaved;
-    s->cur_file_info_internal = cur_file_info_internalSaved;
-    return err;
-}
-
-
-/*
-///////////////////////////////////////////
-// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)
-// I need random access
-//
-// Further optimization could be realized by adding an ability
-// to cache the directory in memory. The goal being a single
-// comprehensive file read to put the file I need in a memory.
-*/
-
-/*
-typedef struct unz_file_pos_s
-{
-    uLong pos_in_zip_directory;   // offset in file
-    uLong num_of_file;            // # of file
-} unz_file_pos;
-*/
-
-extern int ZEXPORT unzGetFilePos(file, file_pos)
-    unzFile file;
-    unz_file_pos* file_pos;
-{
-    unz_s* s;
-
-    if (file==NULL || file_pos==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    if (!s->current_file_ok)
-        return UNZ_END_OF_LIST_OF_FILE;
-
-    file_pos->pos_in_zip_directory  = s->pos_in_central_dir;
-    file_pos->num_of_file           = s->num_file;
-
-    return UNZ_OK;
-}
-
-extern int ZEXPORT unzGoToFilePos(file, file_pos)
-    unzFile file;
-    unz_file_pos* file_pos;
-{
-    unz_s* s;
-    int err;
-
-    if (file==NULL || file_pos==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-
-    /* jump to the right spot */
-    s->pos_in_central_dir = file_pos->pos_in_zip_directory;
-    s->num_file           = file_pos->num_of_file;
-
-    /* set the current file */
-    err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
-                                               &s->cur_file_info_internal,
-                                               NULL,0,NULL,0,NULL,0);
-    /* return results */
-    s->current_file_ok = (err == UNZ_OK);
-    return err;
-}
-
-/*
-// Unzip Helper Functions - should be here?
-///////////////////////////////////////////
-*/
-
-/*
-  Read the local header of the current zipfile
-  Check the coherency of the local header and info in the end of central
-        directory about this file
-  store in *piSizeVar the size of extra info in local header
-        (filename and size of extra field data)
-*/
-local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
-                                                    poffset_local_extrafield,
-                                                    psize_local_extrafield)
-    unz_s* s;
-    uInt* piSizeVar;
-    uLong *poffset_local_extrafield;
-    uInt  *psize_local_extrafield;
-{
-    uLong uMagic,uData,uFlags;
-    uLong size_filename;
-    uLong size_extra_field;
-    int err=UNZ_OK;
-
-    *piSizeVar = 0;
-    *poffset_local_extrafield = 0;
-    *psize_local_extrafield = 0;
-
-    if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
-                                s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
-        return UNZ_ERRNO;
-
-
-    if (err==UNZ_OK)
-        if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
-            err=UNZ_ERRNO;
-        else if (uMagic!=0x04034b50)
-            err=UNZ_BADZIPFILE;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
-        err=UNZ_ERRNO;
-/*
-    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
-        err=UNZ_BADZIPFILE;
-*/
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
-        err=UNZ_ERRNO;
-    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
-        err=UNZ_BADZIPFILE;
-
-    if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
-                         (s->cur_file_info.compression_method!=Z_DEFLATED))
-        err=UNZ_BADZIPFILE;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
-        err=UNZ_ERRNO;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
-        err=UNZ_ERRNO;
-    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
-                              ((uFlags & 8)==0))
-        err=UNZ_BADZIPFILE;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
-        err=UNZ_ERRNO;
-    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
-                              ((uFlags & 8)==0))
-        err=UNZ_BADZIPFILE;
-
-    if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
-        err=UNZ_ERRNO;
-    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
-                              ((uFlags & 8)==0))
-        err=UNZ_BADZIPFILE;
-
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
-        err=UNZ_ERRNO;
-    else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
-        err=UNZ_BADZIPFILE;
-
-    *piSizeVar += (uInt)size_filename;
-
-    if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
-        err=UNZ_ERRNO;
-    *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
-                                    SIZEZIPLOCALHEADER + size_filename;
-    *psize_local_extrafield = (uInt)size_extra_field;
-
-    *piSizeVar += (uInt)size_extra_field;
-
-    return err;
-}
-
-/*
-  Open for reading data the current file in the zipfile.
-  If there is no error and the file is opened, the return value is UNZ_OK.
-*/
-extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
-    unzFile file;
-    int* method;
-    int* level;
-    int raw;
-    const char* password;
-{
-    int err=UNZ_OK;
-    uInt iSizeVar;
-    unz_s* s;
-    file_in_zip_read_info_s* pfile_in_zip_read_info;
-    uLong offset_local_extrafield;  /* offset of the local extra field */
-    uInt  size_local_extrafield;    /* size of the local extra field */
-#    ifndef NOUNCRYPT
-    char source[12];
-#    else
-    if (password != NULL)
-        return UNZ_PARAMERROR;
-#    endif
-
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    if (!s->current_file_ok)
-        return UNZ_PARAMERROR;
-
-    if (s->pfile_in_zip_read != NULL)
-        unzCloseCurrentFile(file);
-
-    if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
-                &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
-        return UNZ_BADZIPFILE;
-
-    pfile_in_zip_read_info = (file_in_zip_read_info_s*)
-                                        ALLOC(sizeof(file_in_zip_read_info_s));
-    if (pfile_in_zip_read_info==NULL)
-        return UNZ_INTERNALERROR;
-
-    pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
-    pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
-    pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
-    pfile_in_zip_read_info->pos_local_extrafield=0;
-    pfile_in_zip_read_info->raw=raw;
-
-    if (pfile_in_zip_read_info->read_buffer==NULL)
-    {
-        TRYFREE(pfile_in_zip_read_info);
-        return UNZ_INTERNALERROR;
-    }
-
-    pfile_in_zip_read_info->stream_initialised=0;
-
-    if (method!=NULL)
-        *method = (int)s->cur_file_info.compression_method;
-
-    if (level!=NULL)
-    {
-        *level = 6;
-        switch (s->cur_file_info.flag & 0x06)
-        {
-          case 6 : *level = 1; break;
-          case 4 : *level = 2; break;
-          case 2 : *level = 9; break;
-        }
-    }
-
-    if ((s->cur_file_info.compression_method!=0) &&
-        (s->cur_file_info.compression_method!=Z_DEFLATED))
-        err=UNZ_BADZIPFILE;
-
-    pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
-    pfile_in_zip_read_info->crc32=0;
-    pfile_in_zip_read_info->compression_method =
-            s->cur_file_info.compression_method;
-    pfile_in_zip_read_info->filestream=s->filestream;
-    pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
-    pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
-
-    pfile_in_zip_read_info->stream.total_out = 0;
-
-    if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
-        (!raw))
-    {
-      pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
-      pfile_in_zip_read_info->stream.zfree = (free_func)0;
-      pfile_in_zip_read_info->stream.opaque = (voidpf)0;
-      pfile_in_zip_read_info->stream.next_in = (voidpf)0;
-      pfile_in_zip_read_info->stream.avail_in = 0;
-
-      err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
-      if (err == Z_OK)
-        pfile_in_zip_read_info->stream_initialised=1;
-      else
-      {
-        TRYFREE(pfile_in_zip_read_info);
-        return err;
-      }
-        /* windowBits is passed < 0 to tell that there is no zlib header.
-         * Note that in this case inflate *requires* an extra "dummy" byte
-         * after the compressed stream in order to complete decompression and
-         * return Z_STREAM_END.
-         * In unzip, i don't wait absolutely Z_STREAM_END because I known the
-         * size of both compressed and uncompressed data
-         */
-    }
-    pfile_in_zip_read_info->rest_read_compressed =
-            s->cur_file_info.compressed_size ;
-    pfile_in_zip_read_info->rest_read_uncompressed =
-            s->cur_file_info.uncompressed_size ;
-
-
-    pfile_in_zip_read_info->pos_in_zipfile =
-            s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
-              iSizeVar;
-
-    pfile_in_zip_read_info->stream.avail_in = (uInt)0;
-
-    s->pfile_in_zip_read = pfile_in_zip_read_info;
-
-#    ifndef NOUNCRYPT
-    if (password != NULL)
-    {
-        int i;
-        s->pcrc_32_tab = get_crc_table();
-        init_keys(password,s->keys,s->pcrc_32_tab);
-        if (ZSEEK(s->z_filefunc, s->filestream,
-                  s->pfile_in_zip_read->pos_in_zipfile +
-                     s->pfile_in_zip_read->byte_before_the_zipfile,
-                  SEEK_SET)!=0)
-            return UNZ_INTERNALERROR;
-        if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
-            return UNZ_INTERNALERROR;
-
-        for (i = 0; i<12; i++)
-            zdecode(s->keys,s->pcrc_32_tab,source[i]);
-
-        s->pfile_in_zip_read->pos_in_zipfile+=12;
-        s->encrypted=1;
-    }
-#    endif
-
-
-    return UNZ_OK;
-}
-
-extern int ZEXPORT unzOpenCurrentFile (file)
-    unzFile file;
-{
-    return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
-}
-
-extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
-    unzFile file;
-    const char* password;
-{
-    return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
-}
-
-extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
-    unzFile file;
-    int* method;
-    int* level;
-    int raw;
-{
-    return unzOpenCurrentFile3(file, method, level, raw, NULL);
-}
-
-/*
-  Read bytes from the current file.
-  buf contain buffer where data must be copied
-  len the size of buf.
-
-  return the number of byte copied if somes bytes are copied
-  return 0 if the end of file was reached
-  return <0 with error code if there is an error
-    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
-*/
-extern int ZEXPORT unzReadCurrentFile  (file, buf, len)
-    unzFile file;
-    voidp buf;
-    unsigned len;
-{
-    int err=UNZ_OK;
-    uInt iRead = 0;
-    unz_s* s;
-    file_in_zip_read_info_s* pfile_in_zip_read_info;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    pfile_in_zip_read_info=s->pfile_in_zip_read;
-
-    if (pfile_in_zip_read_info==NULL)
-        return UNZ_PARAMERROR;
-
-
-    if ((pfile_in_zip_read_info->read_buffer == NULL))
-        return UNZ_END_OF_LIST_OF_FILE;
-    if (len==0)
-        return 0;
-
-    pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
-
-    pfile_in_zip_read_info->stream.avail_out = (uInt)len;
-
-    if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
-        (!(pfile_in_zip_read_info->raw)))
-        pfile_in_zip_read_info->stream.avail_out =
-            (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
-
-    if ((len>pfile_in_zip_read_info->rest_read_compressed+
-           pfile_in_zip_read_info->stream.avail_in) &&
-         (pfile_in_zip_read_info->raw))
-        pfile_in_zip_read_info->stream.avail_out =
-            (uInt)pfile_in_zip_read_info->rest_read_compressed+
-            pfile_in_zip_read_info->stream.avail_in;
-
-    while (pfile_in_zip_read_info->stream.avail_out>0)
-    {
-        if ((pfile_in_zip_read_info->stream.avail_in==0) &&
-            (pfile_in_zip_read_info->rest_read_compressed>0))
-        {
-            uInt uReadThis = UNZ_BUFSIZE;
-            if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
-                uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
-            if (uReadThis == 0)
-                return UNZ_EOF;
-            if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
-                      pfile_in_zip_read_info->filestream,
-                      pfile_in_zip_read_info->pos_in_zipfile +
-                         pfile_in_zip_read_info->byte_before_the_zipfile,
-                         ZLIB_FILEFUNC_SEEK_SET)!=0)
-                return UNZ_ERRNO;
-            if (ZREAD(pfile_in_zip_read_info->z_filefunc,
-                      pfile_in_zip_read_info->filestream,
-                      pfile_in_zip_read_info->read_buffer,
-                      uReadThis)!=uReadThis)
-                return UNZ_ERRNO;
-
-
-#            ifndef NOUNCRYPT
-            if(s->encrypted)
-            {
-                uInt i;
-                for(i=0;i<uReadThis;i++)
-                  pfile_in_zip_read_info->read_buffer[i] =
-                      zdecode(s->keys,s->pcrc_32_tab,
-                              pfile_in_zip_read_info->read_buffer[i]);
-            }
-#            endif
-
-
-            pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
-
-            pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
-
-            pfile_in_zip_read_info->stream.next_in =
-                (Bytef*)pfile_in_zip_read_info->read_buffer;
-            pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
-        }
-
-        if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
-        {
-            uInt uDoCopy,i ;
-
-            if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
-                (pfile_in_zip_read_info->rest_read_compressed == 0))
-                return (iRead==0) ? UNZ_EOF : iRead;
-
-            if (pfile_in_zip_read_info->stream.avail_out <
-                            pfile_in_zip_read_info->stream.avail_in)
-                uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
-            else
-                uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
-
-            for (i=0;i<uDoCopy;i++)
-                *(pfile_in_zip_read_info->stream.next_out+i) =
-                        *(pfile_in_zip_read_info->stream.next_in+i);
-
-            pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
-                                pfile_in_zip_read_info->stream.next_out,
-                                uDoCopy);
-            pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
-            pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
-            pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
-            pfile_in_zip_read_info->stream.next_out += uDoCopy;
-            pfile_in_zip_read_info->stream.next_in += uDoCopy;
-            pfile_in_zip_read_info->stream.total_out += uDoCopy;
-            iRead += uDoCopy;
-        }
-        else
-        {
-            uLong uTotalOutBefore,uTotalOutAfter;
-            const Bytef *bufBefore;
-            uLong uOutThis;
-            int flush=Z_SYNC_FLUSH;
-
-            uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
-            bufBefore = pfile_in_zip_read_info->stream.next_out;
-
-            /*
-            if ((pfile_in_zip_read_info->rest_read_uncompressed ==
-                     pfile_in_zip_read_info->stream.avail_out) &&
-                (pfile_in_zip_read_info->rest_read_compressed == 0))
-                flush = Z_FINISH;
-            */
-            err=inflate(&pfile_in_zip_read_info->stream,flush);
-
-            if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
-              err = Z_DATA_ERROR;
-
-            uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
-            uOutThis = uTotalOutAfter-uTotalOutBefore;
-
-            pfile_in_zip_read_info->crc32 =
-                crc32(pfile_in_zip_read_info->crc32,bufBefore,
-                        (uInt)(uOutThis));
-
-            pfile_in_zip_read_info->rest_read_uncompressed -=
-                uOutThis;
-
-            iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
-
-            if (err==Z_STREAM_END)
-                return (iRead==0) ? UNZ_EOF : iRead;
-            if (err!=Z_OK)
-                break;
-        }
-    }
-
-    if (err==Z_OK)
-        return iRead;
-    return err;
-}
-
-
-/*
-  Give the current position in uncompressed data
-*/
-extern z_off_t ZEXPORT unztell (file)
-    unzFile file;
-{
-    unz_s* s;
-    file_in_zip_read_info_s* pfile_in_zip_read_info;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    pfile_in_zip_read_info=s->pfile_in_zip_read;
-
-    if (pfile_in_zip_read_info==NULL)
-        return UNZ_PARAMERROR;
-
-    return (z_off_t)pfile_in_zip_read_info->stream.total_out;
-}
-
-
-/*
-  return 1 if the end of file was reached, 0 elsewhere
-*/
-extern int ZEXPORT unzeof (file)
-    unzFile file;
-{
-    unz_s* s;
-    file_in_zip_read_info_s* pfile_in_zip_read_info;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    pfile_in_zip_read_info=s->pfile_in_zip_read;
-
-    if (pfile_in_zip_read_info==NULL)
-        return UNZ_PARAMERROR;
-
-    if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
-        return 1;
-    else
-        return 0;
-}
-
-
-
-/*
-  Read extra field from the current file (opened by unzOpenCurrentFile)
-  This is the local-header version of the extra field (sometimes, there is
-    more info in the local-header version than in the central-header)
-
-  if buf==NULL, it return the size of the local extra field that can be read
-
-  if buf!=NULL, len is the size of the buffer, the extra header is copied in
-    buf.
-  the return value is the number of bytes copied in buf, or (if <0)
-    the error code
-*/
-extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
-    unzFile file;
-    voidp buf;
-    unsigned len;
-{
-    unz_s* s;
-    file_in_zip_read_info_s* pfile_in_zip_read_info;
-    uInt read_now;
-    uLong size_to_read;
-
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    pfile_in_zip_read_info=s->pfile_in_zip_read;
-
-    if (pfile_in_zip_read_info==NULL)
-        return UNZ_PARAMERROR;
-
-    size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
-                pfile_in_zip_read_info->pos_local_extrafield);
-
-    if (buf==NULL)
-        return (int)size_to_read;
-
-    if (len>size_to_read)
-        read_now = (uInt)size_to_read;
-    else
-        read_now = (uInt)len ;
-
-    if (read_now==0)
-        return 0;
-
-    if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
-              pfile_in_zip_read_info->filestream,
-              pfile_in_zip_read_info->offset_local_extrafield +
-              pfile_in_zip_read_info->pos_local_extrafield,
-              ZLIB_FILEFUNC_SEEK_SET)!=0)
-        return UNZ_ERRNO;
-
-    if (ZREAD(pfile_in_zip_read_info->z_filefunc,
-              pfile_in_zip_read_info->filestream,
-              buf,read_now)!=read_now)
-        return UNZ_ERRNO;
-
-    return (int)read_now;
-}
-
-/*
-  Close the file in zip opened with unzipOpenCurrentFile
-  Return UNZ_CRCERROR if all the file was read but the CRC is not good
-*/
-extern int ZEXPORT unzCloseCurrentFile (file)
-    unzFile file;
-{
-    int err=UNZ_OK;
-
-    unz_s* s;
-    file_in_zip_read_info_s* pfile_in_zip_read_info;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    pfile_in_zip_read_info=s->pfile_in_zip_read;
-
-    if (pfile_in_zip_read_info==NULL)
-        return UNZ_PARAMERROR;
-
-
-    if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
-        (!pfile_in_zip_read_info->raw))
-    {
-        if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
-            err=UNZ_CRCERROR;
-    }
-
-
-    TRYFREE(pfile_in_zip_read_info->read_buffer);
-    pfile_in_zip_read_info->read_buffer = NULL;
-    if (pfile_in_zip_read_info->stream_initialised)
-        inflateEnd(&pfile_in_zip_read_info->stream);
-
-    pfile_in_zip_read_info->stream_initialised = 0;
-    TRYFREE(pfile_in_zip_read_info);
-
-    s->pfile_in_zip_read=NULL;
-
-    return err;
-}
-
-
-/*
-  Get the global comment string of the ZipFile, in the szComment buffer.
-  uSizeBuf is the size of the szComment buffer.
-  return the number of byte copied or an error code <0
-*/
-extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
-    unzFile file;
-    char *szComment;
-    uLong uSizeBuf;
-{
-    int err=UNZ_OK;
-    unz_s* s;
-    uLong uReadThis ;
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-
-    uReadThis = uSizeBuf;
-    if (uReadThis>s->gi.size_comment)
-        uReadThis = s->gi.size_comment;
-
-    if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
-        return UNZ_ERRNO;
-
-    if (uReadThis>0)
-    {
-      *szComment='\0';
-      if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
-        return UNZ_ERRNO;
-    }
-
-    if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
-        *(szComment+s->gi.size_comment)='\0';
-    return (int)uReadThis;
-}
-
-/* Additions by RX '2004 */
-extern uLong ZEXPORT unzGetOffset (file)
-    unzFile file;
-{
-    unz_s* s;
-
-    if (file==NULL)
-          return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-    if (!s->current_file_ok)
-      return 0;
-    if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
-      if (s->num_file==s->gi.number_entry)
-         return 0;
-    return s->pos_in_central_dir;
-}
-
-extern int ZEXPORT unzSetOffset (file, pos)
-        unzFile file;
-        uLong pos;
-{
-    unz_s* s;
-    int err;
-
-    if (file==NULL)
-        return UNZ_PARAMERROR;
-    s=(unz_s*)file;
-
-    s->pos_in_central_dir = pos;
-    s->num_file = s->gi.number_entry;      /* hack */
-    err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
-                                              &s->cur_file_info_internal,
-                                              NULL,0,NULL,0,NULL,0);
-    s->current_file_ok = (err == UNZ_OK);
-    return err;
-}
+/* unzip.c -- IO for uncompress .zip files using zlib
+   Version 1.1, February 14h, 2010
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications of Unzip for Zip64
+         Copyright (C) 2007-2008 Even Rouault
+
+         Modifications for Zip64 support on both zip and unzip
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+
+  ------------------------------------------------------------------------------------
+  Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
+  compatibility with older software. The following is from the original crypt.c.
+  Code woven in by Terry Thorsen 1/2003.
+
+  Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.
+
+  See the accompanying file LICENSE, version 2000-Apr-09 or later
+  (the contents of which are also included in zip.h) for terms of use.
+  If, for some reason, all these files are missing, the Info-ZIP license
+  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
+
+        crypt.c (full version) by Info-ZIP.      Last revised:  [see crypt.h]
+
+  The encryption/decryption parts of this source code (as opposed to the
+  non-echoing password parts) were originally written in Europe.  The
+  whole source package can be freely distributed, including from the USA.
+  (Prior to January 2000, re-export from the US was a violation of US law.)
+
+        This encryption code is a direct transcription of the algorithm from
+  Roger Schlafly, described by Phil Katz in the file appnote.txt.  This
+  file (appnote.txt) is distributed with the PKZIP program (even in the
+  version without encryption capabilities).
+
+        ------------------------------------------------------------------------------------
+
+        Changes in unzip.c
+
+        2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos
+  2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz*
+  2007-2008 - Even Rouault - Remove old C style function prototypes
+  2007-2008 - Even Rouault - Add unzip support for ZIP64
+
+        Copyright (C) 2007-2008 Even Rouault
+
+
+        Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).
+  Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
+                                should only read the compressed/uncompressed size from the Zip64 format if
+                                the size from normal header was 0xFFFFFFFF
+  Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant
+        Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
+                                Patch created by Daniel Borca
+
+  Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
+
+  Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson
+
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef NOUNCRYPT
+//        #define NOUNCRYPT
+#endif
+
+#include "zlib.h"
+#include "unzip.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+
+#ifndef CASESENSITIVITYDEFAULT_NO
+#  if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
+#    define CASESENSITIVITYDEFAULT_NO
+#  endif
+#endif
+
+
+#ifndef UNZ_BUFSIZE
+#define UNZ_BUFSIZE (16384)
+#endif
+
+#ifndef UNZ_MAXFILENAMEINZIP
+#define UNZ_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) { free(p);}
+#endif
+
+#define SIZECENTRALDIRITEM (0x2e)
+#define SIZEZIPLOCALHEADER (0x1e)
+
+
+const char unz_copyright[] =
+   " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
+
+/* unz_file_info_interntal contain internal info about a file in zipfile*/
+typedef struct unz_file_info64_internal_s
+{
+    ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
+} unz_file_info64_internal;
+
+
+/* file_in_zip_read_info_s contain internal information about a file in zipfile,
+    when reading and decompress it */
+typedef struct
+{
+    char  *read_buffer;         /* internal buffer for compressed data */
+    z_stream stream;            /* zLib stream structure for inflate */
+
+#ifdef HAVE_BZIP2
+    bz_stream bstream;          /* bzLib stream structure for bziped */
+#endif
+
+    ZPOS64_T pos_in_zipfile;       /* position in byte on the zipfile, for fseek*/
+    uLong stream_initialised;   /* flag set if stream structure is initialised*/
+
+    ZPOS64_T offset_local_extrafield;/* offset of the local extra field */
+    uInt  size_local_extrafield;/* size of the local extra field */
+    ZPOS64_T pos_local_extrafield;   /* position in the local extra field in read*/
+    ZPOS64_T total_out_64;
+
+    uLong crc32;                /* crc32 of all data uncompressed */
+    uLong crc32_wait;           /* crc32 we must obtain after decompress all */
+    ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
+    ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
+    zlib_filefunc64_32_def z_filefunc;
+    voidpf filestream;        /* io structore of the zipfile */
+    uLong compression_method;   /* compression method (0==store) */
+    ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+    int   raw;
+} file_in_zip64_read_info_s;
+
+
+/* unz64_s contain internal information about the zipfile
+*/
+typedef struct
+{
+    zlib_filefunc64_32_def z_filefunc;
+    int is64bitOpenFunction;
+    voidpf filestream;        /* io structore of the zipfile */
+    unz_global_info64 gi;       /* public global information */
+    ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+    ZPOS64_T num_file;             /* number of the current file in the zipfile*/
+    ZPOS64_T pos_in_central_dir;   /* pos of the current file in the central dir*/
+    ZPOS64_T current_file_ok;      /* flag about the usability of the current file*/
+    ZPOS64_T central_pos;          /* position of the beginning of the central dir*/
+
+    ZPOS64_T size_central_dir;     /* size of the central directory  */
+    ZPOS64_T offset_central_dir;   /* offset of start of central directory with
+                                   respect to the starting disk number */
+
+    unz_file_info64 cur_file_info; /* public info about the current file in zip*/
+    unz_file_info64_internal cur_file_info_internal; /* private info about it*/
+    file_in_zip64_read_info_s* pfile_in_zip_read; /* structure about the current
+                                        file if we are decompressing it */
+    int encrypted;
+
+    int isZip64;
+
+#    ifndef NOUNCRYPT
+    unsigned long keys[3];     /* keys defining the pseudo-random sequence */
+    const z_crc_t* pcrc_32_tab;
+#    endif
+} unz64_s;
+
+
+#ifndef NOUNCRYPT
+#include "crypt.h"
+#endif
+
+/* ===========================================================================
+     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+   for end of file.
+   IN assertion: the stream s has been successfully opened for reading.
+*/
+
+
+local int unz64local_getByte OF((
+    const zlib_filefunc64_32_def* pzlib_filefunc_def,
+    voidpf filestream,
+    int *pi));
+
+local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
+{
+    unsigned char c;
+    int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
+    if (err==1)
+    {
+        *pi = (int)c;
+        return UNZ_OK;
+    }
+    else
+    {
+        if (ZERROR64(*pzlib_filefunc_def,filestream))
+            return UNZ_ERRNO;
+        else
+            return UNZ_EOF;
+    }
+}
+
+
+/* ===========================================================================
+   Reads a long in LSB order from the given gz_stream. Sets
+*/
+local int unz64local_getShort OF((
+    const zlib_filefunc64_32_def* pzlib_filefunc_def,
+    voidpf filestream,
+    uLong *pX));
+
+local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
+                             voidpf filestream,
+                             uLong *pX)
+{
+    uLong x ;
+    int i = 0;
+    int err;
+
+    err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x = (uLong)i;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((uLong)i)<<8;
+
+    if (err==UNZ_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+local int unz64local_getLong OF((
+    const zlib_filefunc64_32_def* pzlib_filefunc_def,
+    voidpf filestream,
+    uLong *pX));
+
+local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
+                            voidpf filestream,
+                            uLong *pX)
+{
+    uLong x ;
+    int i = 0;
+    int err;
+
+    err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x = (uLong)i;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((uLong)i)<<8;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((uLong)i)<<16;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x += ((uLong)i)<<24;
+
+    if (err==UNZ_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+local int unz64local_getLong64 OF((
+    const zlib_filefunc64_32_def* pzlib_filefunc_def,
+    voidpf filestream,
+    ZPOS64_T *pX));
+
+
+local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,
+                            voidpf filestream,
+                            ZPOS64_T *pX)
+{
+    ZPOS64_T x ;
+    int i = 0;
+    int err;
+
+    err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x = (ZPOS64_T)i;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<8;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<16;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<24;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<32;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<40;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<48;
+
+    if (err==UNZ_OK)
+        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x |= ((ZPOS64_T)i)<<56;
+
+    if (err==UNZ_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+/* My own strcmpi / strcasecmp */
+local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
+{
+    for (;;)
+    {
+        char c1=*(fileName1++);
+        char c2=*(fileName2++);
+        if ((c1>='a') && (c1<='z'))
+            c1 -= 0x20;
+        if ((c2>='a') && (c2<='z'))
+            c2 -= 0x20;
+        if (c1=='\0')
+            return ((c2=='\0') ? 0 : -1);
+        if (c2=='\0')
+            return 1;
+        if (c1<c2)
+            return -1;
+        if (c1>c2)
+            return 1;
+    }
+}
+
+
+#ifdef  CASESENSITIVITYDEFAULT_NO
+#define CASESENSITIVITYDEFAULTVALUE 2
+#else
+#define CASESENSITIVITYDEFAULTVALUE 1
+#endif
+
+#ifndef STRCMPCASENOSENTIVEFUNCTION
+#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
+#endif
+
+/*
+   Compare two filename (fileName1,fileName2).
+   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+                                                                or strcasecmp)
+   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+        (like 1 on Unix, 2 on Windows)
+
+*/
+extern int ZEXPORT unzStringFileNameCompare (const char*  fileName1,
+                                                 const char*  fileName2,
+                                                 int iCaseSensitivity)
+
+{
+    if (iCaseSensitivity==0)
+        iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
+
+    if (iCaseSensitivity==1)
+        return strcmp(fileName1,fileName2);
+
+    return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
+}
+
+#ifndef BUFREADCOMMENT
+#define BUFREADCOMMENT (0x400)
+#endif
+
+/*
+  Locate the Central directory of a zipfile (at the end, just before
+    the global comment)
+*/
+local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
+local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
+{
+    unsigned char* buf;
+    ZPOS64_T uSizeFile;
+    ZPOS64_T uBackRead;
+    ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
+    ZPOS64_T uPosFound=0;
+
+    if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
+        return 0;
+
+
+    uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
+
+    if (uMaxBack>uSizeFile)
+        uMaxBack = uSizeFile;
+
+    buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+    if (buf==NULL)
+        return 0;
+
+    uBackRead = 4;
+    while (uBackRead<uMaxBack)
+    {
+        uLong uReadSize;
+        ZPOS64_T uReadPos ;
+        int i;
+        if (uBackRead+BUFREADCOMMENT>uMaxBack)
+            uBackRead = uMaxBack;
+        else
+            uBackRead+=BUFREADCOMMENT;
+        uReadPos = uSizeFile-uBackRead ;
+
+        uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+                     (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
+        if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+            break;
+
+        if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
+            break;
+
+        for (i=(int)uReadSize-3; (i--)>0;)
+            if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+                ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+            {
+                uPosFound = uReadPos+(unsigned)i;
+                break;
+            }
+
+        if (uPosFound!=0)
+            break;
+    }
+    TRYFREE(buf);
+    return uPosFound;
+}
+
+
+/*
+  Locate the Central directory 64 of a zipfile (at the end, just before
+    the global comment)
+*/
+local ZPOS64_T unz64local_SearchCentralDir64 OF((
+    const zlib_filefunc64_32_def* pzlib_filefunc_def,
+    voidpf filestream));
+
+local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
+                                      voidpf filestream)
+{
+    unsigned char* buf;
+    ZPOS64_T uSizeFile;
+    ZPOS64_T uBackRead;
+    ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
+    ZPOS64_T uPosFound=0;
+    uLong uL;
+                ZPOS64_T relativeOffset;
+
+    if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
+        return 0;
+
+
+    uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
+
+    if (uMaxBack>uSizeFile)
+        uMaxBack = uSizeFile;
+
+    buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+    if (buf==NULL)
+        return 0;
+
+    uBackRead = 4;
+    while (uBackRead<uMaxBack)
+    {
+        uLong uReadSize;
+        ZPOS64_T uReadPos;
+        int i;
+        if (uBackRead+BUFREADCOMMENT>uMaxBack)
+            uBackRead = uMaxBack;
+        else
+            uBackRead+=BUFREADCOMMENT;
+        uReadPos = uSizeFile-uBackRead ;
+
+        uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+                     (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
+        if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+            break;
+
+        if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
+            break;
+
+        for (i=(int)uReadSize-3; (i--)>0;)
+            if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+                ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
+            {
+                uPosFound = uReadPos+(unsigned)i;
+                break;
+            }
+
+        if (uPosFound!=0)
+            break;
+    }
+    TRYFREE(buf);
+    if (uPosFound == 0)
+        return 0;
+
+    /* Zip64 end of central directory locator */
+    if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
+        return 0;
+
+    /* the signature, already checked */
+    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
+        return 0;
+
+    /* number of the disk with the start of the zip64 end of  central directory */
+    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
+        return 0;
+    if (uL != 0)
+        return 0;
+
+    /* relative offset of the zip64 end of central directory record */
+    if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
+        return 0;
+
+    /* total number of disks */
+    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
+        return 0;
+    if (uL != 1)
+        return 0;
+
+    /* Goto end of central directory record */
+    if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
+        return 0;
+
+     /* the signature */
+    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
+        return 0;
+
+    if (uL != 0x06064b50)
+        return 0;
+
+    return relativeOffset;
+}
+
+/*
+  Open a Zip file. path contain the full pathname (by example,
+     on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer
+     "zlib/zlib114.zip".
+     If the zipfile cannot be opened (file doesn't exist or in not valid), the
+       return value is NULL.
+     Else, the return value is a unzFile Handle, usable with other function
+       of this unzip package.
+*/
+local unzFile unzOpenInternal (const void *path,
+                               zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
+                               int is64bitOpenFunction)
+{
+    unz64_s us;
+    unz64_s *s;
+    ZPOS64_T central_pos;
+    uLong   uL;
+
+    uLong number_disk;          /* number of the current dist, used for
+                                   spaning ZIP, unsupported, always 0*/
+    uLong number_disk_with_CD;  /* number the the disk with central dir, used
+                                   for spaning ZIP, unsupported, always 0*/
+    ZPOS64_T number_entry_CD;      /* total number of entries in
+                                   the central dir
+                                   (same than number_entry on nospan) */
+
+    int err=UNZ_OK;
+
+    if (unz_copyright[0]!=' ')
+        return NULL;
+
+    us.z_filefunc.zseek32_file = NULL;
+    us.z_filefunc.ztell32_file = NULL;
+    if (pzlib_filefunc64_32_def==NULL)
+        fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
+    else
+        us.z_filefunc = *pzlib_filefunc64_32_def;
+    us.is64bitOpenFunction = is64bitOpenFunction;
+
+
+
+    us.filestream = ZOPEN64(us.z_filefunc,
+                                                 path,
+                                                 ZLIB_FILEFUNC_MODE_READ |
+                                                 ZLIB_FILEFUNC_MODE_EXISTING);
+    if (us.filestream==NULL)
+        return NULL;
+
+    central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
+    if (central_pos)
+    {
+        uLong uS;
+        ZPOS64_T uL64;
+
+        us.isZip64 = 1;
+
+        if (ZSEEK64(us.z_filefunc, us.filestream,
+                                      central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+        err=UNZ_ERRNO;
+
+        /* the signature, already checked */
+        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* size of zip64 end of central directory record */
+        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* version made by */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* version needed to extract */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* number of this disk */
+        if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* number of the disk with the start of the central directory */
+        if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* total number of entries in the central directory on this disk */
+        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* total number of entries in the central directory */
+        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        if ((number_entry_CD!=us.gi.number_entry) ||
+            (number_disk_with_CD!=0) ||
+            (number_disk!=0))
+            err=UNZ_BADZIPFILE;
+
+        /* size of the central directory */
+        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* offset of start of central directory with respect to the
+          starting disk number */
+        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        us.gi.size_comment = 0;
+    }
+    else
+    {
+        central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
+        if (central_pos==0)
+            err=UNZ_ERRNO;
+
+        us.isZip64 = 0;
+
+        if (ZSEEK64(us.z_filefunc, us.filestream,
+                                        central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+            err=UNZ_ERRNO;
+
+        /* the signature, already checked */
+        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* number of this disk */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* number of the disk with the start of the central directory */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
+            err=UNZ_ERRNO;
+
+        /* total number of entries in the central dir on this disk */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+            err=UNZ_ERRNO;
+        us.gi.number_entry = uL;
+
+        /* total number of entries in the central dir */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+            err=UNZ_ERRNO;
+        number_entry_CD = uL;
+
+        if ((number_entry_CD!=us.gi.number_entry) ||
+            (number_disk_with_CD!=0) ||
+            (number_disk!=0))
+            err=UNZ_BADZIPFILE;
+
+        /* size of the central directory */
+        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+            err=UNZ_ERRNO;
+        us.size_central_dir = uL;
+
+        /* offset of start of central directory with respect to the
+            starting disk number */
+        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+            err=UNZ_ERRNO;
+        us.offset_central_dir = uL;
+
+        /* zipfile comment length */
+        if (unz64local_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
+            err=UNZ_ERRNO;
+    }
+
+    if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
+        (err==UNZ_OK))
+        err=UNZ_BADZIPFILE;
+
+    if (err!=UNZ_OK)
+    {
+        ZCLOSE64(us.z_filefunc, us.filestream);
+        return NULL;
+    }
+
+    us.byte_before_the_zipfile = central_pos -
+                            (us.offset_central_dir+us.size_central_dir);
+    us.central_pos = central_pos;
+    us.pfile_in_zip_read = NULL;
+    us.encrypted = 0;
+
+
+    s=(unz64_s*)ALLOC(sizeof(unz64_s));
+    if( s != NULL)
+    {
+        *s=us;
+        unzGoToFirstFile((unzFile)s);
+    }
+    return (unzFile)s;
+}
+
+
+extern unzFile ZEXPORT unzOpen2 (const char *path,
+                                        zlib_filefunc_def* pzlib_filefunc32_def)
+{
+    if (pzlib_filefunc32_def != NULL)
+    {
+        zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
+        fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
+        return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);
+    }
+    else
+        return unzOpenInternal(path, NULL, 0);
+}
+
+extern unzFile ZEXPORT unzOpen2_64 (const void *path,
+                                     zlib_filefunc64_def* pzlib_filefunc_def)
+{
+    if (pzlib_filefunc_def != NULL)
+    {
+        zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
+        zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
+        zlib_filefunc64_32_def_fill.ztell32_file = NULL;
+        zlib_filefunc64_32_def_fill.zseek32_file = NULL;
+        return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
+    }
+    else
+        return unzOpenInternal(path, NULL, 1);
+}
+
+extern unzFile ZEXPORT unzOpen (const char *path)
+{
+    return unzOpenInternal(path, NULL, 0);
+}
+
+extern unzFile ZEXPORT unzOpen64 (const void *path)
+{
+    return unzOpenInternal(path, NULL, 1);
+}
+
+/*
+  Close a ZipFile opened with unzOpen.
+  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+    these files MUST be closed with unzCloseCurrentFile before call unzClose.
+  return UNZ_OK if there is no problem. */
+extern int ZEXPORT unzClose (unzFile file)
+{
+    unz64_s* s;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+
+    if (s->pfile_in_zip_read!=NULL)
+        unzCloseCurrentFile(file);
+
+    ZCLOSE64(s->z_filefunc, s->filestream);
+    TRYFREE(s);
+    return UNZ_OK;
+}
+
+
+/*
+  Write info about the ZipFile in the *pglobal_info structure.
+  No preparation of the structure is needed
+  return UNZ_OK if there is no problem. */
+extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info)
+{
+    unz64_s* s;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    *pglobal_info=s->gi;
+    return UNZ_OK;
+}
+
+extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32)
+{
+    unz64_s* s;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    /* to do : check if number_entry is not truncated */
+    pglobal_info32->number_entry = (uLong)s->gi.number_entry;
+    pglobal_info32->size_comment = s->gi.size_comment;
+    return UNZ_OK;
+}
+/*
+   Translate date/time from Dos format to tm_unz (readable more easilty)
+*/
+local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
+{
+    ZPOS64_T uDate;
+    uDate = (ZPOS64_T)(ulDosDate>>16);
+    ptm->tm_mday = (int)(uDate&0x1f) ;
+    ptm->tm_mon =  (int)((((uDate)&0x1E0)/0x20)-1) ;
+    ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
+
+    ptm->tm_hour = (int) ((ulDosDate &0xF800)/0x800);
+    ptm->tm_min =  (int) ((ulDosDate&0x7E0)/0x20) ;
+    ptm->tm_sec =  (int) (2*(ulDosDate&0x1f)) ;
+}
+
+/*
+  Get Info about the current file in the zipfile, with internal only info
+*/
+local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
+                                                  unz_file_info64 *pfile_info,
+                                                  unz_file_info64_internal
+                                                  *pfile_info_internal,
+                                                  char *szFileName,
+                                                  uLong fileNameBufferSize,
+                                                  void *extraField,
+                                                  uLong extraFieldBufferSize,
+                                                  char *szComment,
+                                                  uLong commentBufferSize));
+
+local int unz64local_GetCurrentFileInfoInternal (unzFile file,
+                                                  unz_file_info64 *pfile_info,
+                                                  unz_file_info64_internal
+                                                  *pfile_info_internal,
+                                                  char *szFileName,
+                                                  uLong fileNameBufferSize,
+                                                  void *extraField,
+                                                  uLong extraFieldBufferSize,
+                                                  char *szComment,
+                                                  uLong commentBufferSize)
+{
+    unz64_s* s;
+    unz_file_info64 file_info;
+    unz_file_info64_internal file_info_internal;
+    int err=UNZ_OK;
+    uLong uMagic;
+    long lSeek=0;
+    uLong uL;
+
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    if (ZSEEK64(s->z_filefunc, s->filestream,
+              s->pos_in_central_dir+s->byte_before_the_zipfile,
+              ZLIB_FILEFUNC_SEEK_SET)!=0)
+        err=UNZ_ERRNO;
+
+
+    /* we check the magic */
+    if (err==UNZ_OK)
+    {
+        if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
+            err=UNZ_ERRNO;
+        else if (uMagic!=0x02014b50)
+            err=UNZ_BADZIPFILE;
+    }
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    unz64local_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
+        err=UNZ_ERRNO;
+    file_info.compressed_size = uL;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
+        err=UNZ_ERRNO;
+    file_info.uncompressed_size = uL;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+                // relative offset of local header
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
+        err=UNZ_ERRNO;
+    file_info_internal.offset_curfile = uL;
+
+    lSeek+=file_info.size_filename;
+    if ((err==UNZ_OK) && (szFileName!=NULL))
+    {
+        uLong uSizeRead ;
+        if (file_info.size_filename<fileNameBufferSize)
+        {
+            *(szFileName+file_info.size_filename)='\0';
+            uSizeRead = file_info.size_filename;
+        }
+        else
+            uSizeRead = fileNameBufferSize;
+
+        if ((file_info.size_filename>0) && (fileNameBufferSize>0))
+            if (ZREAD64(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
+                err=UNZ_ERRNO;
+        lSeek -= uSizeRead;
+    }
+
+    // Read extrafield
+    if ((err==UNZ_OK) && (extraField!=NULL))
+    {
+        ZPOS64_T uSizeRead ;
+        if (file_info.size_file_extra<extraFieldBufferSize)
+            uSizeRead = file_info.size_file_extra;
+        else
+            uSizeRead = extraFieldBufferSize;
+
+        if (lSeek!=0)
+        {
+            if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+                lSeek=0;
+            else
+                err=UNZ_ERRNO;
+        }
+
+        if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
+            if (ZREAD64(s->z_filefunc, s->filestream,extraField,(uLong)uSizeRead)!=uSizeRead)
+                err=UNZ_ERRNO;
+
+        lSeek += file_info.size_file_extra - (uLong)uSizeRead;
+    }
+    else
+        lSeek += file_info.size_file_extra;
+
+
+    if ((err==UNZ_OK) && (file_info.size_file_extra != 0))
+    {
+                                uLong acc = 0;
+
+        // since lSeek now points to after the extra field we need to move back
+        lSeek -= file_info.size_file_extra;
+
+        if (lSeek!=0)
+        {
+            if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+                lSeek=0;
+            else
+                err=UNZ_ERRNO;
+        }
+
+        while(acc < file_info.size_file_extra)
+        {
+            uLong headerId;
+                                                uLong dataSize;
+
+            if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)
+                err=UNZ_ERRNO;
+
+            if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK)
+                err=UNZ_ERRNO;
+
+            /* ZIP64 extra fields */
+            if (headerId == 0x0001)
+            {
+                                                        uLong uL;
+
+                                                                if(file_info.uncompressed_size == MAXU32)
+                                                                {
+                                                                        if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
+                                                                                        err=UNZ_ERRNO;
+                                                                }
+
+                                                                if(file_info.compressed_size == MAXU32)
+                                                                {
+                                                                        if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
+                                                                                  err=UNZ_ERRNO;
+                                                                }
+
+                                                                if(file_info_internal.offset_curfile == MAXU32)
+                                                                {
+                                                                        /* Relative Header offset */
+                                                                        if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
+                                                                                err=UNZ_ERRNO;
+                                                                }
+
+                                                                if(file_info.disk_num_start == MAXU32)
+                                                                {
+                                                                        /* Disk Start Number */
+                                                                        if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
+                                                                                err=UNZ_ERRNO;
+                                                                }
+
+            }
+            else
+            {
+                if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
+                    err=UNZ_ERRNO;
+            }
+
+            acc += 2 + 2 + dataSize;
+        }
+    }
+
+    if ((err==UNZ_OK) && (szComment!=NULL))
+    {
+        uLong uSizeRead ;
+        if (file_info.size_file_comment<commentBufferSize)
+        {
+            *(szComment+file_info.size_file_comment)='\0';
+            uSizeRead = file_info.size_file_comment;
+        }
+        else
+            uSizeRead = commentBufferSize;
+
+        if (lSeek!=0)
+        {
+            if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+                lSeek=0;
+            else
+                err=UNZ_ERRNO;
+        }
+
+        if ((file_info.size_file_comment>0) && (commentBufferSize>0))
+            if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
+                err=UNZ_ERRNO;
+        lSeek+=file_info.size_file_comment - uSizeRead;
+    }
+    else
+        lSeek+=file_info.size_file_comment;
+
+
+    if ((err==UNZ_OK) && (pfile_info!=NULL))
+        *pfile_info=file_info;
+
+    if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
+        *pfile_info_internal=file_info_internal;
+
+    return err;
+}
+
+
+
+/*
+  Write info about the ZipFile in the *pglobal_info structure.
+  No preparation of the structure is needed
+  return UNZ_OK if there is no problem.
+*/
+extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
+                                          unz_file_info64 * pfile_info,
+                                          char * szFileName, uLong fileNameBufferSize,
+                                          void *extraField, uLong extraFieldBufferSize,
+                                          char* szComment,  uLong commentBufferSize)
+{
+    return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
+                                                szFileName,fileNameBufferSize,
+                                                extraField,extraFieldBufferSize,
+                                                szComment,commentBufferSize);
+}
+
+extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
+                                          unz_file_info * pfile_info,
+                                          char * szFileName, uLong fileNameBufferSize,
+                                          void *extraField, uLong extraFieldBufferSize,
+                                          char* szComment,  uLong commentBufferSize)
+{
+    int err;
+    unz_file_info64 file_info64;
+    err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
+                                                szFileName,fileNameBufferSize,
+                                                extraField,extraFieldBufferSize,
+                                                szComment,commentBufferSize);
+    if ((err==UNZ_OK) && (pfile_info != NULL))
+    {
+        pfile_info->version = file_info64.version;
+        pfile_info->version_needed = file_info64.version_needed;
+        pfile_info->flag = file_info64.flag;
+        pfile_info->compression_method = file_info64.compression_method;
+        pfile_info->dosDate = file_info64.dosDate;
+        pfile_info->crc = file_info64.crc;
+
+        pfile_info->size_filename = file_info64.size_filename;
+        pfile_info->size_file_extra = file_info64.size_file_extra;
+        pfile_info->size_file_comment = file_info64.size_file_comment;
+
+        pfile_info->disk_num_start = file_info64.disk_num_start;
+        pfile_info->internal_fa = file_info64.internal_fa;
+        pfile_info->external_fa = file_info64.external_fa;
+
+        pfile_info->tmu_date = file_info64.tmu_date,
+
+
+        pfile_info->compressed_size = (uLong)file_info64.compressed_size;
+        pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
+
+    }
+    return err;
+}
+/*
+  Set the current file of the zipfile to the first file.
+  return UNZ_OK if there is no problem
+*/
+extern int ZEXPORT unzGoToFirstFile (unzFile file)
+{
+    int err=UNZ_OK;
+    unz64_s* s;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    s->pos_in_central_dir=s->offset_central_dir;
+    s->num_file=0;
+    err=unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+                                             &s->cur_file_info_internal,
+                                             NULL,0,NULL,0,NULL,0);
+    s->current_file_ok = (err == UNZ_OK);
+    return err;
+}
+
+/*
+  Set the current file of the zipfile to the next file.
+  return UNZ_OK if there is no problem
+  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+extern int ZEXPORT unzGoToNextFile (unzFile  file)
+{
+    unz64_s* s;
+    int err;
+
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    if (!s->current_file_ok)
+        return UNZ_END_OF_LIST_OF_FILE;
+    if (s->gi.number_entry != 0xffff)    /* 2^16 files overflow hack */
+      if (s->num_file+1==s->gi.number_entry)
+        return UNZ_END_OF_LIST_OF_FILE;
+
+    s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
+            s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
+    s->num_file++;
+    err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+                                               &s->cur_file_info_internal,
+                                               NULL,0,NULL,0,NULL,0);
+    s->current_file_ok = (err == UNZ_OK);
+    return err;
+}
+
+
+/*
+  Try locate the file szFileName in the zipfile.
+  For the iCaseSensitivity signification, see unzStringFileNameCompare
+
+  return value :
+  UNZ_OK if the file is found. It becomes the current file.
+  UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
+{
+    unz64_s* s;
+    int err;
+
+    /* We remember the 'current' position in the file so that we can jump
+     * back there if we fail.
+     */
+    unz_file_info64 cur_file_infoSaved;
+    unz_file_info64_internal cur_file_info_internalSaved;
+    ZPOS64_T num_fileSaved;
+    ZPOS64_T pos_in_central_dirSaved;
+
+
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+
+    if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
+        return UNZ_PARAMERROR;
+
+    s=(unz64_s*)file;
+    if (!s->current_file_ok)
+        return UNZ_END_OF_LIST_OF_FILE;
+
+    /* Save the current state */
+    num_fileSaved = s->num_file;
+    pos_in_central_dirSaved = s->pos_in_central_dir;
+    cur_file_infoSaved = s->cur_file_info;
+    cur_file_info_internalSaved = s->cur_file_info_internal;
+
+    err = unzGoToFirstFile(file);
+
+    while (err == UNZ_OK)
+    {
+        char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
+        err = unzGetCurrentFileInfo64(file,NULL,
+                                    szCurrentFileName,sizeof(szCurrentFileName)-1,
+                                    NULL,0,NULL,0);
+        if (err == UNZ_OK)
+        {
+            if (unzStringFileNameCompare(szCurrentFileName,
+                                            szFileName,iCaseSensitivity)==0)
+                return UNZ_OK;
+            err = unzGoToNextFile(file);
+        }
+    }
+
+    /* We failed, so restore the state of the 'current file' to where we
+     * were.
+     */
+    s->num_file = num_fileSaved ;
+    s->pos_in_central_dir = pos_in_central_dirSaved ;
+    s->cur_file_info = cur_file_infoSaved;
+    s->cur_file_info_internal = cur_file_info_internalSaved;
+    return err;
+}
+
+
+/*
+///////////////////////////////////////////
+// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)
+// I need random access
+//
+// Further optimization could be realized by adding an ability
+// to cache the directory in memory. The goal being a single
+// comprehensive file read to put the file I need in a memory.
+*/
+
+/*
+typedef struct unz_file_pos_s
+{
+    ZPOS64_T pos_in_zip_directory;   // offset in file
+    ZPOS64_T num_of_file;            // # of file
+} unz_file_pos;
+*/
+
+extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos*  file_pos)
+{
+    unz64_s* s;
+
+    if (file==NULL || file_pos==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    if (!s->current_file_ok)
+        return UNZ_END_OF_LIST_OF_FILE;
+
+    file_pos->pos_in_zip_directory  = s->pos_in_central_dir;
+    file_pos->num_of_file           = s->num_file;
+
+    return UNZ_OK;
+}
+
+extern int ZEXPORT unzGetFilePos(
+    unzFile file,
+    unz_file_pos* file_pos)
+{
+    unz64_file_pos file_pos64;
+    int err = unzGetFilePos64(file,&file_pos64);
+    if (err==UNZ_OK)
+    {
+        file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
+        file_pos->num_of_file = (uLong)file_pos64.num_of_file;
+    }
+    return err;
+}
+
+extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos)
+{
+    unz64_s* s;
+    int err;
+
+    if (file==NULL || file_pos==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+
+    /* jump to the right spot */
+    s->pos_in_central_dir = file_pos->pos_in_zip_directory;
+    s->num_file           = file_pos->num_of_file;
+
+    /* set the current file */
+    err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+                                               &s->cur_file_info_internal,
+                                               NULL,0,NULL,0,NULL,0);
+    /* return results */
+    s->current_file_ok = (err == UNZ_OK);
+    return err;
+}
+
+extern int ZEXPORT unzGoToFilePos(
+    unzFile file,
+    unz_file_pos* file_pos)
+{
+    unz64_file_pos file_pos64;
+    if (file_pos == NULL)
+        return UNZ_PARAMERROR;
+
+    file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
+    file_pos64.num_of_file = file_pos->num_of_file;
+    return unzGoToFilePos64(file,&file_pos64);
+}
+
+/*
+// Unzip Helper Functions - should be here?
+///////////////////////////////////////////
+*/
+
+/*
+  Read the local header of the current zipfile
+  Check the coherency of the local header and info in the end of central
+        directory about this file
+  store in *piSizeVar the size of extra info in local header
+        (filename and size of extra field data)
+*/
+local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
+                                                    ZPOS64_T * poffset_local_extrafield,
+                                                    uInt  * psize_local_extrafield)
+{
+    uLong uMagic,uData,uFlags;
+    uLong size_filename;
+    uLong size_extra_field;
+    int err=UNZ_OK;
+
+    *piSizeVar = 0;
+    *poffset_local_extrafield = 0;
+    *psize_local_extrafield = 0;
+
+    if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
+                                s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
+        return UNZ_ERRNO;
+
+
+    if (err==UNZ_OK)
+    {
+        if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
+            err=UNZ_ERRNO;
+        else if (uMagic!=0x04034b50)
+            err=UNZ_BADZIPFILE;
+    }
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
+        err=UNZ_ERRNO;
+/*
+    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
+        err=UNZ_BADZIPFILE;
+*/
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
+        err=UNZ_ERRNO;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
+        err=UNZ_ERRNO;
+    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
+        err=UNZ_BADZIPFILE;
+
+    if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
+/* #ifdef HAVE_BZIP2 */
+                         (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
+/* #endif */
+                         (s->cur_file_info.compression_method!=Z_DEFLATED))
+        err=UNZ_BADZIPFILE;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
+        err=UNZ_ERRNO;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
+        err=UNZ_ERRNO;
+    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0))
+        err=UNZ_BADZIPFILE;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
+        err=UNZ_ERRNO;
+    else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0))
+        err=UNZ_BADZIPFILE;
+
+    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
+        err=UNZ_ERRNO;
+    else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0))
+        err=UNZ_BADZIPFILE;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
+        err=UNZ_ERRNO;
+    else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
+        err=UNZ_BADZIPFILE;
+
+    *piSizeVar += (uInt)size_filename;
+
+    if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
+        err=UNZ_ERRNO;
+    *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
+                                    SIZEZIPLOCALHEADER + size_filename;
+    *psize_local_extrafield = (uInt)size_extra_field;
+
+    *piSizeVar += (uInt)size_extra_field;
+
+    return err;
+}
+
+/*
+  Open for reading data the current file in the zipfile.
+  If there is no error and the file is opened, the return value is UNZ_OK.
+*/
+extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+                                            int* level, int raw, const char* password)
+{
+    int err=UNZ_OK;
+    uInt iSizeVar;
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    ZPOS64_T offset_local_extrafield;  /* offset of the local extra field */
+    uInt  size_local_extrafield;    /* size of the local extra field */
+#    ifndef NOUNCRYPT
+    char source[12];
+#    else
+    if (password != NULL)
+        return UNZ_PARAMERROR;
+#    endif
+
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    if (!s->current_file_ok)
+        return UNZ_PARAMERROR;
+
+    if (s->pfile_in_zip_read != NULL)
+        unzCloseCurrentFile(file);
+
+    if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
+        return UNZ_BADZIPFILE;
+
+    pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
+    if (pfile_in_zip_read_info==NULL)
+        return UNZ_INTERNALERROR;
+
+    pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
+    pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
+    pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
+    pfile_in_zip_read_info->pos_local_extrafield=0;
+    pfile_in_zip_read_info->raw=raw;
+
+    if (pfile_in_zip_read_info->read_buffer==NULL)
+    {
+        TRYFREE(pfile_in_zip_read_info);
+        return UNZ_INTERNALERROR;
+    }
+
+    pfile_in_zip_read_info->stream_initialised=0;
+
+    if (method!=NULL)
+        *method = (int)s->cur_file_info.compression_method;
+
+    if (level!=NULL)
+    {
+        *level = 6;
+        switch (s->cur_file_info.flag & 0x06)
+        {
+          case 6 : *level = 1; break;
+          case 4 : *level = 2; break;
+          case 2 : *level = 9; break;
+        }
+    }
+
+    if ((s->cur_file_info.compression_method!=0) &&
+/* #ifdef HAVE_BZIP2 */
+        (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
+/* #endif */
+        (s->cur_file_info.compression_method!=Z_DEFLATED))
+
+        err=UNZ_BADZIPFILE;
+
+    pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
+    pfile_in_zip_read_info->crc32=0;
+    pfile_in_zip_read_info->total_out_64=0;
+    pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method;
+    pfile_in_zip_read_info->filestream=s->filestream;
+    pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
+    pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
+
+    pfile_in_zip_read_info->stream.total_out = 0;
+
+    if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw))
+    {
+#ifdef HAVE_BZIP2
+      pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0;
+      pfile_in_zip_read_info->bstream.bzfree = (free_func)0;
+      pfile_in_zip_read_info->bstream.opaque = (voidpf)0;
+      pfile_in_zip_read_info->bstream.state = (voidpf)0;
+
+      pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+      pfile_in_zip_read_info->stream.zfree = (free_func)0;
+      pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+      pfile_in_zip_read_info->stream.next_in = (voidpf)0;
+      pfile_in_zip_read_info->stream.avail_in = 0;
+
+      err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
+      if (err == Z_OK)
+        pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
+      else
+      {
+        TRYFREE(pfile_in_zip_read_info->read_buffer);
+        TRYFREE(pfile_in_zip_read_info);
+        return err;
+      }
+#else
+      pfile_in_zip_read_info->raw=1;
+#endif
+    }
+    else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
+    {
+      pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+      pfile_in_zip_read_info->stream.zfree = (free_func)0;
+      pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+      pfile_in_zip_read_info->stream.next_in = 0;
+      pfile_in_zip_read_info->stream.avail_in = 0;
+
+      err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
+      if (err == Z_OK)
+        pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
+      else
+      {
+        TRYFREE(pfile_in_zip_read_info->read_buffer);
+        TRYFREE(pfile_in_zip_read_info);
+        return err;
+      }
+        /* windowBits is passed < 0 to tell that there is no zlib header.
+         * Note that in this case inflate *requires* an extra "dummy" byte
+         * after the compressed stream in order to complete decompression and
+         * return Z_STREAM_END.
+         * In unzip, i don't wait absolutely Z_STREAM_END because I known the
+         * size of both compressed and uncompressed data
+         */
+    }
+    pfile_in_zip_read_info->rest_read_compressed =
+            s->cur_file_info.compressed_size ;
+    pfile_in_zip_read_info->rest_read_uncompressed =
+            s->cur_file_info.uncompressed_size ;
+
+
+    pfile_in_zip_read_info->pos_in_zipfile =
+            s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+              iSizeVar;
+
+    pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+
+    s->pfile_in_zip_read = pfile_in_zip_read_info;
+                s->encrypted = 0;
+
+#    ifndef NOUNCRYPT
+    if (password != NULL)
+    {
+        int i;
+        s->pcrc_32_tab = get_crc_table();
+        init_keys(password,s->keys,s->pcrc_32_tab);
+        if (ZSEEK64(s->z_filefunc, s->filestream,
+                  s->pfile_in_zip_read->pos_in_zipfile +
+                     s->pfile_in_zip_read->byte_before_the_zipfile,
+                  SEEK_SET)!=0)
+            return UNZ_INTERNALERROR;
+        if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12)
+            return UNZ_INTERNALERROR;
+
+        for (i = 0; i<12; i++)
+            zdecode(s->keys,s->pcrc_32_tab,source[i]);
+
+        s->pfile_in_zip_read->pos_in_zipfile+=12;
+        s->encrypted=1;
+    }
+#    endif
+
+
+    return UNZ_OK;
+}
+
+extern int ZEXPORT unzOpenCurrentFile (unzFile file)
+{
+    return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
+}
+
+extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char*  password)
+{
+    return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
+}
+
+extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw)
+{
+    return unzOpenCurrentFile3(file, method, level, raw, NULL);
+}
+
+/** Addition for GDAL : START */
+
+extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
+{
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    s=(unz64_s*)file;
+    if (file==NULL)
+        return 0; //UNZ_PARAMERROR;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+    if (pfile_in_zip_read_info==NULL)
+        return 0; //UNZ_PARAMERROR;
+    return pfile_in_zip_read_info->pos_in_zipfile +
+                         pfile_in_zip_read_info->byte_before_the_zipfile;
+}
+
+/** Addition for GDAL : END */
+
+/*
+  Read bytes from the current file.
+  buf contain buffer where data must be copied
+  len the size of buf.
+
+  return the number of byte copied if somes bytes are copied
+  return 0 if the end of file was reached
+  return <0 with error code if there is an error
+    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+extern int ZEXPORT unzReadCurrentFile  (unzFile file, voidp buf, unsigned len)
+{
+    int err=UNZ_OK;
+    uInt iRead = 0;
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+    if (pfile_in_zip_read_info==NULL)
+        return UNZ_PARAMERROR;
+
+
+    if (pfile_in_zip_read_info->read_buffer == NULL)
+        return UNZ_END_OF_LIST_OF_FILE;
+    if (len==0)
+        return 0;
+
+    pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
+
+    pfile_in_zip_read_info->stream.avail_out = (uInt)len;
+
+    if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
+        (!(pfile_in_zip_read_info->raw)))
+        pfile_in_zip_read_info->stream.avail_out =
+            (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
+
+    if ((len>pfile_in_zip_read_info->rest_read_compressed+
+           pfile_in_zip_read_info->stream.avail_in) &&
+         (pfile_in_zip_read_info->raw))
+        pfile_in_zip_read_info->stream.avail_out =
+            (uInt)pfile_in_zip_read_info->rest_read_compressed+
+            pfile_in_zip_read_info->stream.avail_in;
+
+    while (pfile_in_zip_read_info->stream.avail_out>0)
+    {
+        if ((pfile_in_zip_read_info->stream.avail_in==0) &&
+            (pfile_in_zip_read_info->rest_read_compressed>0))
+        {
+            uInt uReadThis = UNZ_BUFSIZE;
+            if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
+                uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
+            if (uReadThis == 0)
+                return UNZ_EOF;
+            if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,
+                      pfile_in_zip_read_info->filestream,
+                      pfile_in_zip_read_info->pos_in_zipfile +
+                         pfile_in_zip_read_info->byte_before_the_zipfile,
+                         ZLIB_FILEFUNC_SEEK_SET)!=0)
+                return UNZ_ERRNO;
+            if (ZREAD64(pfile_in_zip_read_info->z_filefunc,
+                      pfile_in_zip_read_info->filestream,
+                      pfile_in_zip_read_info->read_buffer,
+                      uReadThis)!=uReadThis)
+                return UNZ_ERRNO;
+
+
+#            ifndef NOUNCRYPT
+            if(s->encrypted)
+            {
+                uInt i;
+                for(i=0;i<uReadThis;i++)
+                  pfile_in_zip_read_info->read_buffer[i] =
+                      zdecode(s->keys,s->pcrc_32_tab,
+                              pfile_in_zip_read_info->read_buffer[i]);
+            }
+#            endif
+
+
+            pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
+
+            pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
+
+            pfile_in_zip_read_info->stream.next_in =
+                (Bytef*)pfile_in_zip_read_info->read_buffer;
+            pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
+        }
+
+        if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
+        {
+            uInt uDoCopy,i ;
+
+            if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
+                (pfile_in_zip_read_info->rest_read_compressed == 0))
+                return (iRead==0) ? UNZ_EOF : (int)iRead;
+
+            if (pfile_in_zip_read_info->stream.avail_out <
+                            pfile_in_zip_read_info->stream.avail_in)
+                uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
+            else
+                uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
+
+            for (i=0;i<uDoCopy;i++)
+                *(pfile_in_zip_read_info->stream.next_out+i) =
+                        *(pfile_in_zip_read_info->stream.next_in+i);
+
+            pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy;
+
+            pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
+                                pfile_in_zip_read_info->stream.next_out,
+                                uDoCopy);
+            pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
+            pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
+            pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
+            pfile_in_zip_read_info->stream.next_out += uDoCopy;
+            pfile_in_zip_read_info->stream.next_in += uDoCopy;
+            pfile_in_zip_read_info->stream.total_out += uDoCopy;
+            iRead += uDoCopy;
+        }
+        else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED)
+        {
+#ifdef HAVE_BZIP2
+            uLong uTotalOutBefore,uTotalOutAfter;
+            const Bytef *bufBefore;
+            uLong uOutThis;
+
+            pfile_in_zip_read_info->bstream.next_in        = (char*)pfile_in_zip_read_info->stream.next_in;
+            pfile_in_zip_read_info->bstream.avail_in       = pfile_in_zip_read_info->stream.avail_in;
+            pfile_in_zip_read_info->bstream.total_in_lo32  = pfile_in_zip_read_info->stream.total_in;
+            pfile_in_zip_read_info->bstream.total_in_hi32  = 0;
+            pfile_in_zip_read_info->bstream.next_out       = (char*)pfile_in_zip_read_info->stream.next_out;
+            pfile_in_zip_read_info->bstream.avail_out      = pfile_in_zip_read_info->stream.avail_out;
+            pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out;
+            pfile_in_zip_read_info->bstream.total_out_hi32 = 0;
+
+            uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32;
+            bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out;
+
+            err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream);
+
+            uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32;
+            uOutThis = uTotalOutAfter-uTotalOutBefore;
+
+            pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
+
+            pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis));
+            pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;
+            iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+
+            pfile_in_zip_read_info->stream.next_in   = (Bytef*)pfile_in_zip_read_info->bstream.next_in;
+            pfile_in_zip_read_info->stream.avail_in  = pfile_in_zip_read_info->bstream.avail_in;
+            pfile_in_zip_read_info->stream.total_in  = pfile_in_zip_read_info->bstream.total_in_lo32;
+            pfile_in_zip_read_info->stream.next_out  = (Bytef*)pfile_in_zip_read_info->bstream.next_out;
+            pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out;
+            pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32;
+
+            if (err==BZ_STREAM_END)
+              return (iRead==0) ? UNZ_EOF : iRead;
+            if (err!=BZ_OK)
+              break;
+#endif
+        } // end Z_BZIP2ED
+        else
+        {
+            ZPOS64_T uTotalOutBefore,uTotalOutAfter;
+            const Bytef *bufBefore;
+            ZPOS64_T uOutThis;
+            int flush=Z_SYNC_FLUSH;
+
+            uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
+            bufBefore = pfile_in_zip_read_info->stream.next_out;
+
+            /*
+            if ((pfile_in_zip_read_info->rest_read_uncompressed ==
+                     pfile_in_zip_read_info->stream.avail_out) &&
+                (pfile_in_zip_read_info->rest_read_compressed == 0))
+                flush = Z_FINISH;
+            */
+            err=inflate(&pfile_in_zip_read_info->stream,flush);
+
+            if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
+              err = Z_DATA_ERROR;
+
+            uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
+            /* Detect overflow, because z_stream.total_out is uLong (32 bits) */
+            if (uTotalOutAfter<uTotalOutBefore)
+                uTotalOutAfter += 1LL << 32; /* Add maximum value of uLong + 1 */
+            uOutThis = uTotalOutAfter-uTotalOutBefore;
+
+            pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
+
+            pfile_in_zip_read_info->crc32 =
+                crc32(pfile_in_zip_read_info->crc32,bufBefore,
+                        (uInt)(uOutThis));
+
+            pfile_in_zip_read_info->rest_read_uncompressed -=
+                uOutThis;
+
+            iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+
+            if (err==Z_STREAM_END)
+                return (iRead==0) ? UNZ_EOF : (int)iRead;
+            if (err!=Z_OK)
+                break;
+        }
+    }
+
+    if (err==Z_OK)
+        return (int)iRead;
+    return err;
+}
+
+
+/*
+  Give the current position in uncompressed data
+*/
+extern z_off_t ZEXPORT unztell (unzFile file)
+{
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+    if (pfile_in_zip_read_info==NULL)
+        return UNZ_PARAMERROR;
+
+    return (z_off_t)pfile_in_zip_read_info->stream.total_out;
+}
+
+extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
+{
+
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    if (file==NULL)
+        return (ZPOS64_T)-1;
+    s=(unz64_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+    if (pfile_in_zip_read_info==NULL)
+        return (ZPOS64_T)-1;
+
+    return pfile_in_zip_read_info->total_out_64;
+}
+
+
+/*
+  return 1 if the end of file was reached, 0 elsewhere
+*/
+extern int ZEXPORT unzeof (unzFile file)
+{
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+    if (pfile_in_zip_read_info==NULL)
+        return UNZ_PARAMERROR;
+
+    if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+        return 1;
+    else
+        return 0;
+}
+
+
+
+/*
+Read extra field from the current file (opened by unzOpenCurrentFile)
+This is the local-header version of the extra field (sometimes, there is
+more info in the local-header version than in the central-header)
+
+  if buf==NULL, it return the size of the local extra field that can be read
+
+  if buf!=NULL, len is the size of the buffer, the extra header is copied in
+    buf.
+  the return value is the number of bytes copied in buf, or (if <0)
+    the error code
+*/
+extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
+{
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    uInt read_now;
+    ZPOS64_T size_to_read;
+
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+    if (pfile_in_zip_read_info==NULL)
+        return UNZ_PARAMERROR;
+
+    size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
+                pfile_in_zip_read_info->pos_local_extrafield);
+
+    if (buf==NULL)
+        return (int)size_to_read;
+
+    if (len>size_to_read)
+        read_now = (uInt)size_to_read;
+    else
+        read_now = (uInt)len ;
+
+    if (read_now==0)
+        return 0;
+
+    if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,
+              pfile_in_zip_read_info->filestream,
+              pfile_in_zip_read_info->offset_local_extrafield +
+              pfile_in_zip_read_info->pos_local_extrafield,
+              ZLIB_FILEFUNC_SEEK_SET)!=0)
+        return UNZ_ERRNO;
+
+    if (ZREAD64(pfile_in_zip_read_info->z_filefunc,
+              pfile_in_zip_read_info->filestream,
+              buf,read_now)!=read_now)
+        return UNZ_ERRNO;
+
+    return (int)read_now;
+}
+
+/*
+  Close the file in zip opened with unzOpenCurrentFile
+  Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+extern int ZEXPORT unzCloseCurrentFile (unzFile file)
+{
+    int err=UNZ_OK;
+
+    unz64_s* s;
+    file_in_zip64_read_info_s* pfile_in_zip_read_info;
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+    if (pfile_in_zip_read_info==NULL)
+        return UNZ_PARAMERROR;
+
+
+    if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
+        (!pfile_in_zip_read_info->raw))
+    {
+        if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
+            err=UNZ_CRCERROR;
+    }
+
+
+    TRYFREE(pfile_in_zip_read_info->read_buffer);
+    pfile_in_zip_read_info->read_buffer = NULL;
+    if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
+        inflateEnd(&pfile_in_zip_read_info->stream);
+#ifdef HAVE_BZIP2
+    else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
+        BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
+#endif
+
+
+    pfile_in_zip_read_info->stream_initialised = 0;
+    TRYFREE(pfile_in_zip_read_info);
+
+    s->pfile_in_zip_read=NULL;
+
+    return err;
+}
+
+
+/*
+  Get the global comment string of the ZipFile, in the szComment buffer.
+  uSizeBuf is the size of the szComment buffer.
+  return the number of byte copied or an error code <0
+*/
+extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)
+{
+    unz64_s* s;
+    uLong uReadThis ;
+    if (file==NULL)
+        return (int)UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+
+    uReadThis = uSizeBuf;
+    if (uReadThis>s->gi.size_comment)
+        uReadThis = s->gi.size_comment;
+
+    if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
+        return UNZ_ERRNO;
+
+    if (uReadThis>0)
+    {
+      *szComment='\0';
+      if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
+        return UNZ_ERRNO;
+    }
+
+    if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
+        *(szComment+s->gi.size_comment)='\0';
+    return (int)uReadThis;
+}
+
+/* Additions by RX '2004 */
+extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
+{
+    unz64_s* s;
+
+    if (file==NULL)
+          return 0; //UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+    if (!s->current_file_ok)
+      return 0;
+    if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
+      if (s->num_file==s->gi.number_entry)
+         return 0;
+    return s->pos_in_central_dir;
+}
+
+extern uLong ZEXPORT unzGetOffset (unzFile file)
+{
+    ZPOS64_T offset64;
+
+    if (file==NULL)
+          return 0; //UNZ_PARAMERROR;
+    offset64 = unzGetOffset64(file);
+    return (uLong)offset64;
+}
+
+extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
+{
+    unz64_s* s;
+    int err;
+
+    if (file==NULL)
+        return UNZ_PARAMERROR;
+    s=(unz64_s*)file;
+
+    s->pos_in_central_dir = pos;
+    s->num_file = s->gi.number_entry;      /* hack */
+    err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+                                              &s->cur_file_info_internal,
+                                              NULL,0,NULL,0,NULL,0);
+    s->current_file_ok = (err == UNZ_OK);
+    return err;
+}
+
+extern int ZEXPORT unzSetOffset (unzFile file, uLong pos)
+{
+    return unzSetOffset64(file,pos);
+}

+ 437 - 354
RedAnt ERP Mobile/common/zip/minizip/unzip.h

@@ -1,354 +1,437 @@
-/* unzip.h -- IO for uncompress .zip files using zlib
-   Version 1.01e, February 12th, 2005
-
-   Copyright (C) 1998-2005 Gilles Vollant
-
-   This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
-     WinZip, InfoZip tools and compatible.
-
-   Multi volume ZipFile (span) are not supported.
-   Encryption compatible with pkzip 2.04g only supported
-   Old compressions used by old PKZip 1.x are not supported
-
-
-   I WAIT FEEDBACK at mail info@winimage.com
-   Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
-
-   Condition of use and distribution are the same than zlib :
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-
-*/
-
-/* for more info about .ZIP format, see
-      http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
-      http://www.info-zip.org/pub/infozip/doc/
-   PkWare has also a specification at :
-      ftp://ftp.pkware.com/probdesc.zip
-*/
-
-#ifndef _unz_H
-#define _unz_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#ifndef _ZLIBIOAPI_H
-#include "ioapi.h"
-#endif
-
-#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
-/* like the STRICT of WIN32, we define a pointer that cannot be converted
-    from (void*) without cast */
-typedef struct TagunzFile__ { int unused; } unzFile__;
-typedef unzFile__ *unzFile;
-#else
-typedef voidp unzFile;
-#endif
-
-
-#define UNZ_OK                          (0)
-#define UNZ_END_OF_LIST_OF_FILE         (-100)
-#define UNZ_ERRNO                       (Z_ERRNO)
-#define UNZ_EOF                         (0)
-#define UNZ_PARAMERROR                  (-102)
-#define UNZ_BADZIPFILE                  (-103)
-#define UNZ_INTERNALERROR               (-104)
-#define UNZ_CRCERROR                    (-105)
-
-/* tm_unz contain date/time info */
-typedef struct tm_unz_s
-{
-    uInt tm_sec;            /* seconds after the minute - [0,59] */
-    uInt tm_min;            /* minutes after the hour - [0,59] */
-    uInt tm_hour;           /* hours since midnight - [0,23] */
-    uInt tm_mday;           /* day of the month - [1,31] */
-    uInt tm_mon;            /* months since January - [0,11] */
-    uInt tm_year;           /* years - [1980..2044] */
-} tm_unz;
-
-/* unz_global_info structure contain global data about the ZIPfile
-   These data comes from the end of central dir */
-typedef struct unz_global_info_s
-{
-    uLong number_entry;         /* total number of entries in
-                       the central dir on this disk */
-    uLong size_comment;         /* size of the global comment of the zipfile */
-} unz_global_info;
-
-
-/* unz_file_info contain information about a file in the zipfile */
-typedef struct unz_file_info_s
-{
-    uLong version;              /* version made by                 2 bytes */
-    uLong version_needed;       /* version needed to extract       2 bytes */
-    uLong flag;                 /* general purpose bit flag        2 bytes */
-    uLong compression_method;   /* compression method              2 bytes */
-    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */
-    uLong crc;                  /* crc-32                          4 bytes */
-    uLong compressed_size;      /* compressed size                 4 bytes */
-    uLong uncompressed_size;    /* uncompressed size               4 bytes */
-    uLong size_filename;        /* filename length                 2 bytes */
-    uLong size_file_extra;      /* extra field length              2 bytes */
-    uLong size_file_comment;    /* file comment length             2 bytes */
-
-    uLong disk_num_start;       /* disk number start               2 bytes */
-    uLong internal_fa;          /* internal file attributes        2 bytes */
-    uLong external_fa;          /* external file attributes        4 bytes */
-
-    tm_unz tmu_date;
-} unz_file_info;
-
-extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
-                                                 const char* fileName2,
-                                                 int iCaseSensitivity));
-/*
-   Compare two filename (fileName1,fileName2).
-   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
-   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
-                                or strcasecmp)
-   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
-    (like 1 on Unix, 2 on Windows)
-*/
-
-
-extern unzFile ZEXPORT unzOpen OF((const char *path));
-/*
-  Open a Zip file. path contain the full pathname (by example,
-     on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
-     "zlib/zlib113.zip".
-     If the zipfile cannot be opened (file don't exist or in not valid), the
-       return value is NULL.
-     Else, the return value is a unzFile Handle, usable with other function
-       of this unzip package.
-*/
-
-extern unzFile ZEXPORT unzOpen2 OF((const char *path,
-                                    zlib_filefunc_def* pzlib_filefunc_def));
-/*
-   Open a Zip file, like unzOpen, but provide a set of file low level API
-      for read/write the zip file (see ioapi.h)
-*/
-
-extern int ZEXPORT unzClose OF((unzFile file));
-/*
-  Close a ZipFile opened with unzipOpen.
-  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
-    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
-  return UNZ_OK if there is no problem. */
-
-extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
-                                        unz_global_info *pglobal_info));
-/*
-  Write info about the ZipFile in the *pglobal_info structure.
-  No preparation of the structure is needed
-  return UNZ_OK if there is no problem. */
-
-
-extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
-                                           char *szComment,
-                                           uLong uSizeBuf));
-/*
-  Get the global comment string of the ZipFile, in the szComment buffer.
-  uSizeBuf is the size of the szComment buffer.
-  return the number of byte copied or an error code <0
-*/
-
-
-/***************************************************************************/
-/* Unzip package allow you browse the directory of the zipfile */
-
-extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
-/*
-  Set the current file of the zipfile to the first file.
-  return UNZ_OK if there is no problem
-*/
-
-extern int ZEXPORT unzGoToNextFile OF((unzFile file));
-/*
-  Set the current file of the zipfile to the next file.
-  return UNZ_OK if there is no problem
-  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
-*/
-
-extern int ZEXPORT unzLocateFile OF((unzFile file,
-                     const char *szFileName,
-                     int iCaseSensitivity));
-/*
-  Try locate the file szFileName in the zipfile.
-  For the iCaseSensitivity signification, see unzStringFileNameCompare
-
-  return value :
-  UNZ_OK if the file is found. It becomes the current file.
-  UNZ_END_OF_LIST_OF_FILE if the file is not found
-*/
-
-
-/* ****************************************** */
-/* Ryan supplied functions */
-/* unz_file_info contain information about a file in the zipfile */
-typedef struct unz_file_pos_s
-{
-    uLong pos_in_zip_directory;   /* offset in zip file directory */
-    uLong num_of_file;            /* # of file */
-} unz_file_pos;
-
-extern int ZEXPORT unzGetFilePos(
-    unzFile file,
-    unz_file_pos* file_pos);
-
-extern int ZEXPORT unzGoToFilePos(
-    unzFile file,
-    unz_file_pos* file_pos);
-
-/* ****************************************** */
-
-extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
-                         unz_file_info *pfile_info,
-                         char *szFileName,
-                         uLong fileNameBufferSize,
-                         void *extraField,
-                         uLong extraFieldBufferSize,
-                         char *szComment,
-                         uLong commentBufferSize));
-/*
-  Get Info about the current file
-  if pfile_info!=NULL, the *pfile_info structure will contain somes info about
-        the current file
-  if szFileName!=NULL, the filemane string will be copied in szFileName
-            (fileNameBufferSize is the size of the buffer)
-  if extraField!=NULL, the extra field information will be copied in extraField
-            (extraFieldBufferSize is the size of the buffer).
-            This is the Central-header version of the extra field
-  if szComment!=NULL, the comment string of the file will be copied in szComment
-            (commentBufferSize is the size of the buffer)
-*/
-
-/***************************************************************************/
-/* for reading the content of the current zipfile, you can open it, read data
-   from it, and close it (you can close it before reading all the file)
-   */
-
-extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
-/*
-  Open for reading data the current file in the zipfile.
-  If there is no error, the return value is UNZ_OK.
-*/
-
-extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
-                                                  const char* password));
-/*
-  Open for reading data the current file in the zipfile.
-  password is a crypting password
-  If there is no error, the return value is UNZ_OK.
-*/
-
-extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
-                                           int* method,
-                                           int* level,
-                                           int raw));
-/*
-  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
-    if raw==1
-  *method will receive method of compression, *level will receive level of
-     compression
-  note : you can set level parameter as NULL (if you did not want known level,
-         but you CANNOT set method parameter as NULL
-*/
-
-extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
-                                           int* method,
-                                           int* level,
-                                           int raw,
-                                           const char* password));
-/*
-  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
-    if raw==1
-  *method will receive method of compression, *level will receive level of
-     compression
-  note : you can set level parameter as NULL (if you did not want known level,
-         but you CANNOT set method parameter as NULL
-*/
-
-
-extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
-/*
-  Close the file in zip opened with unzOpenCurrentFile
-  Return UNZ_CRCERROR if all the file was read but the CRC is not good
-*/
-
-extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
-                      voidp buf,
-                      unsigned len));
-/*
-  Read bytes from the current file (opened by unzOpenCurrentFile)
-  buf contain buffer where data must be copied
-  len the size of buf.
-
-  return the number of byte copied if somes bytes are copied
-  return 0 if the end of file was reached
-  return <0 with error code if there is an error
-    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
-*/
-
-extern z_off_t ZEXPORT unztell OF((unzFile file));
-/*
-  Give the current position in uncompressed data
-*/
-
-extern int ZEXPORT unzeof OF((unzFile file));
-/*
-  return 1 if the end of file was reached, 0 elsewhere
-*/
-
-extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
-                                             voidp buf,
-                                             unsigned len));
-/*
-  Read extra field from the current file (opened by unzOpenCurrentFile)
-  This is the local-header version of the extra field (sometimes, there is
-    more info in the local-header version than in the central-header)
-
-  if buf==NULL, it return the size of the local extra field
-
-  if buf!=NULL, len is the size of the buffer, the extra header is copied in
-    buf.
-  the return value is the number of bytes copied in buf, or (if <0)
-    the error code
-*/
-
-/***************************************************************************/
-
-/* Get the current file offset */
-extern uLong ZEXPORT unzGetOffset (unzFile file);
-
-/* Set the current file offset */
-extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _unz_H */
+/* unzip.h -- IO for uncompress .zip files using zlib
+   Version 1.1, February 14h, 2010
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications of Unzip for Zip64
+         Copyright (C) 2007-2008 Even Rouault
+
+         Modifications for Zip64 support on both zip and unzip
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+         ---------------------------------------------------------------------------------
+
+        Condition of use and distribution are the same than zlib :
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  ---------------------------------------------------------------------------------
+
+        Changes
+
+        See header of unzip64.c
+
+*/
+
+#ifndef _unz64_H
+#define _unz64_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#ifndef  _ZLIBIOAPI_H
+#include "ioapi.h"
+#endif
+
+#ifdef HAVE_BZIP2
+#include "bzlib.h"
+#endif
+
+#define Z_BZIP2ED 12
+
+#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+    from (void*) without cast */
+typedef struct TagunzFile__ { int unused; } unzFile__;
+typedef unzFile__ *unzFile;
+#else
+typedef voidp unzFile;
+#endif
+
+
+#define UNZ_OK                          (0)
+#define UNZ_END_OF_LIST_OF_FILE         (-100)
+#define UNZ_ERRNO                       (Z_ERRNO)
+#define UNZ_EOF                         (0)
+#define UNZ_PARAMERROR                  (-102)
+#define UNZ_BADZIPFILE                  (-103)
+#define UNZ_INTERNALERROR               (-104)
+#define UNZ_CRCERROR                    (-105)
+
+/* tm_unz contain date/time info */
+typedef struct tm_unz_s
+{
+    int tm_sec;             /* seconds after the minute - [0,59] */
+    int tm_min;             /* minutes after the hour - [0,59] */
+    int tm_hour;            /* hours since midnight - [0,23] */
+    int tm_mday;            /* day of the month - [1,31] */
+    int tm_mon;             /* months since January - [0,11] */
+    int tm_year;            /* years - [1980..2044] */
+} tm_unz;
+
+/* unz_global_info structure contain global data about the ZIPfile
+   These data comes from the end of central dir */
+typedef struct unz_global_info64_s
+{
+    ZPOS64_T number_entry;         /* total number of entries in
+                                     the central dir on this disk */
+    uLong size_comment;         /* size of the global comment of the zipfile */
+} unz_global_info64;
+
+typedef struct unz_global_info_s
+{
+    uLong number_entry;         /* total number of entries in
+                                     the central dir on this disk */
+    uLong size_comment;         /* size of the global comment of the zipfile */
+} unz_global_info;
+
+/* unz_file_info contain information about a file in the zipfile */
+typedef struct unz_file_info64_s
+{
+    uLong version;              /* version made by                 2 bytes */
+    uLong version_needed;       /* version needed to extract       2 bytes */
+    uLong flag;                 /* general purpose bit flag        2 bytes */
+    uLong compression_method;   /* compression method              2 bytes */
+    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */
+    uLong crc;                  /* crc-32                          4 bytes */
+    ZPOS64_T compressed_size;   /* compressed size                 8 bytes */
+    ZPOS64_T uncompressed_size; /* uncompressed size               8 bytes */
+    uLong size_filename;        /* filename length                 2 bytes */
+    uLong size_file_extra;      /* extra field length              2 bytes */
+    uLong size_file_comment;    /* file comment length             2 bytes */
+
+    uLong disk_num_start;       /* disk number start               2 bytes */
+    uLong internal_fa;          /* internal file attributes        2 bytes */
+    uLong external_fa;          /* external file attributes        4 bytes */
+
+    tm_unz tmu_date;
+} unz_file_info64;
+
+typedef struct unz_file_info_s
+{
+    uLong version;              /* version made by                 2 bytes */
+    uLong version_needed;       /* version needed to extract       2 bytes */
+    uLong flag;                 /* general purpose bit flag        2 bytes */
+    uLong compression_method;   /* compression method              2 bytes */
+    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */
+    uLong crc;                  /* crc-32                          4 bytes */
+    uLong compressed_size;      /* compressed size                 4 bytes */
+    uLong uncompressed_size;    /* uncompressed size               4 bytes */
+    uLong size_filename;        /* filename length                 2 bytes */
+    uLong size_file_extra;      /* extra field length              2 bytes */
+    uLong size_file_comment;    /* file comment length             2 bytes */
+
+    uLong disk_num_start;       /* disk number start               2 bytes */
+    uLong internal_fa;          /* internal file attributes        2 bytes */
+    uLong external_fa;          /* external file attributes        4 bytes */
+
+    tm_unz tmu_date;
+} unz_file_info;
+
+extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
+                                                 const char* fileName2,
+                                                 int iCaseSensitivity));
+/*
+   Compare two filename (fileName1,fileName2).
+   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+                                or strcasecmp)
+   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+    (like 1 on Unix, 2 on Windows)
+*/
+
+
+extern unzFile ZEXPORT unzOpen OF((const char *path));
+extern unzFile ZEXPORT unzOpen64 OF((const void *path));
+/*
+  Open a Zip file. path contain the full pathname (by example,
+     on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
+     "zlib/zlib113.zip".
+     If the zipfile cannot be opened (file don't exist or in not valid), the
+       return value is NULL.
+     Else, the return value is a unzFile Handle, usable with other function
+       of this unzip package.
+     the "64" function take a const void* pointer, because the path is just the
+       value passed to the open64_file_func callback.
+     Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path
+       is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
+       does not describe the reality
+*/
+
+
+extern unzFile ZEXPORT unzOpen2 OF((const char *path,
+                                    zlib_filefunc_def* pzlib_filefunc_def));
+/*
+   Open a Zip file, like unzOpen, but provide a set of file low level API
+      for read/write the zip file (see ioapi.h)
+*/
+
+extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
+                                    zlib_filefunc64_def* pzlib_filefunc_def));
+/*
+   Open a Zip file, like unz64Open, but provide a set of file low level API
+      for read/write the zip file (see ioapi.h)
+*/
+
+extern int ZEXPORT unzClose OF((unzFile file));
+/*
+  Close a ZipFile opened with unzOpen.
+  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+    these files MUST be closed with unzCloseCurrentFile before call unzClose.
+  return UNZ_OK if there is no problem. */
+
+extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+                                        unz_global_info *pglobal_info));
+
+extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
+                                        unz_global_info64 *pglobal_info));
+/*
+  Write info about the ZipFile in the *pglobal_info structure.
+  No preparation of the structure is needed
+  return UNZ_OK if there is no problem. */
+
+
+extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
+                                           char *szComment,
+                                           uLong uSizeBuf));
+/*
+  Get the global comment string of the ZipFile, in the szComment buffer.
+  uSizeBuf is the size of the szComment buffer.
+  return the number of byte copied or an error code <0
+*/
+
+
+/***************************************************************************/
+/* Unzip package allow you browse the directory of the zipfile */
+
+extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
+/*
+  Set the current file of the zipfile to the first file.
+  return UNZ_OK if there is no problem
+*/
+
+extern int ZEXPORT unzGoToNextFile OF((unzFile file));
+/*
+  Set the current file of the zipfile to the next file.
+  return UNZ_OK if there is no problem
+  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+
+extern int ZEXPORT unzLocateFile OF((unzFile file,
+                     const char *szFileName,
+                     int iCaseSensitivity));
+/*
+  Try locate the file szFileName in the zipfile.
+  For the iCaseSensitivity signification, see unzStringFileNameCompare
+
+  return value :
+  UNZ_OK if the file is found. It becomes the current file.
+  UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+
+
+/* ****************************************** */
+/* Ryan supplied functions */
+/* unz_file_info contain information about a file in the zipfile */
+typedef struct unz_file_pos_s
+{
+    uLong pos_in_zip_directory;   /* offset in zip file directory */
+    uLong num_of_file;            /* # of file */
+} unz_file_pos;
+
+extern int ZEXPORT unzGetFilePos(
+    unzFile file,
+    unz_file_pos* file_pos);
+
+extern int ZEXPORT unzGoToFilePos(
+    unzFile file,
+    unz_file_pos* file_pos);
+
+typedef struct unz64_file_pos_s
+{
+    ZPOS64_T pos_in_zip_directory;   /* offset in zip file directory */
+    ZPOS64_T num_of_file;            /* # of file */
+} unz64_file_pos;
+
+extern int ZEXPORT unzGetFilePos64(
+    unzFile file,
+    unz64_file_pos* file_pos);
+
+extern int ZEXPORT unzGoToFilePos64(
+    unzFile file,
+    const unz64_file_pos* file_pos);
+
+/* ****************************************** */
+
+extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
+                         unz_file_info64 *pfile_info,
+                         char *szFileName,
+                         uLong fileNameBufferSize,
+                         void *extraField,
+                         uLong extraFieldBufferSize,
+                         char *szComment,
+                         uLong commentBufferSize));
+
+extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
+                         unz_file_info *pfile_info,
+                         char *szFileName,
+                         uLong fileNameBufferSize,
+                         void *extraField,
+                         uLong extraFieldBufferSize,
+                         char *szComment,
+                         uLong commentBufferSize));
+/*
+  Get Info about the current file
+  if pfile_info!=NULL, the *pfile_info structure will contain somes info about
+        the current file
+  if szFileName!=NULL, the filemane string will be copied in szFileName
+            (fileNameBufferSize is the size of the buffer)
+  if extraField!=NULL, the extra field information will be copied in extraField
+            (extraFieldBufferSize is the size of the buffer).
+            This is the Central-header version of the extra field
+  if szComment!=NULL, the comment string of the file will be copied in szComment
+            (commentBufferSize is the size of the buffer)
+*/
+
+
+/** Addition for GDAL : START */
+
+extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
+
+/** Addition for GDAL : END */
+
+
+/***************************************************************************/
+/* for reading the content of the current zipfile, you can open it, read data
+   from it, and close it (you can close it before reading all the file)
+   */
+
+extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
+/*
+  Open for reading data the current file in the zipfile.
+  If there is no error, the return value is UNZ_OK.
+*/
+
+extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
+                                                  const char* password));
+/*
+  Open for reading data the current file in the zipfile.
+  password is a crypting password
+  If there is no error, the return value is UNZ_OK.
+*/
+
+extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
+                                           int* method,
+                                           int* level,
+                                           int raw));
+/*
+  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
+    if raw==1
+  *method will receive method of compression, *level will receive level of
+     compression
+  note : you can set level parameter as NULL (if you did not want known level,
+         but you CANNOT set method parameter as NULL
+*/
+
+extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
+                                           int* method,
+                                           int* level,
+                                           int raw,
+                                           const char* password));
+/*
+  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
+    if raw==1
+  *method will receive method of compression, *level will receive level of
+     compression
+  note : you can set level parameter as NULL (if you did not want known level,
+         but you CANNOT set method parameter as NULL
+*/
+
+
+extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
+/*
+  Close the file in zip opened with unzOpenCurrentFile
+  Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+
+extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
+                      voidp buf,
+                      unsigned len));
+/*
+  Read bytes from the current file (opened by unzOpenCurrentFile)
+  buf contain buffer where data must be copied
+  len the size of buf.
+
+  return the number of byte copied if somes bytes are copied
+  return 0 if the end of file was reached
+  return <0 with error code if there is an error
+    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+
+extern z_off_t ZEXPORT unztell OF((unzFile file));
+
+extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
+/*
+  Give the current position in uncompressed data
+*/
+
+extern int ZEXPORT unzeof OF((unzFile file));
+/*
+  return 1 if the end of file was reached, 0 elsewhere
+*/
+
+extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
+                                             voidp buf,
+                                             unsigned len));
+/*
+  Read extra field from the current file (opened by unzOpenCurrentFile)
+  This is the local-header version of the extra field (sometimes, there is
+    more info in the local-header version than in the central-header)
+
+  if buf==NULL, it return the size of the local extra field
+
+  if buf!=NULL, len is the size of the buffer, the extra header is copied in
+    buf.
+  the return value is the number of bytes copied in buf, or (if <0)
+    the error code
+*/
+
+/***************************************************************************/
+
+/* Get the current file offset */
+extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file);
+extern uLong ZEXPORT unzGetOffset (unzFile file);
+
+/* Set the current file offset */
+extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos);
+extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _unz64_H */

+ 2002 - 1219
RedAnt ERP Mobile/common/zip/minizip/zip.c

@@ -1,1219 +1,2002 @@
-/* zip.c -- IO on .zip files using zlib
-   Version 1.01e, February 12th, 2005
-
-   27 Dec 2004 Rolf Kalbermatter
-   Modification to zipOpen2 to support globalComment retrieval.
-
-   Copyright (C) 1998-2005 Gilles Vollant
-
-   Read zip.h for more info
-*/
-
-#pragma clang diagnostic ignored "-Wunused-function"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "zlib.h"
-#include "zip.h"
-
-#ifdef STDC
-#  include <stddef.h>
-#  include <string.h>
-#  include <stdlib.h>
-#endif
-#ifdef NO_ERRNO_H
-    extern int errno;
-#else
-#   include <errno.h>
-#endif
-
-
-#ifndef local
-#  define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-#ifndef VERSIONMADEBY
-# define VERSIONMADEBY   (0x0) /* platform depedent */
-#endif
-
-#ifndef Z_BUFSIZE
-#define Z_BUFSIZE (16384)
-#endif
-
-#ifndef Z_MAXFILENAMEINZIP
-#define Z_MAXFILENAMEINZIP (256)
-#endif
-
-#ifndef ALLOC
-# define ALLOC(size) (malloc(size))
-#endif
-#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
-#endif
-
-/*
-#define SIZECENTRALDIRITEM (0x2e)
-#define SIZEZIPLOCALHEADER (0x1e)
-*/
-
-/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
-
-#ifndef SEEK_CUR
-#define SEEK_CUR    1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END    2
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET    0
-#endif
-
-#ifndef DEF_MEM_LEVEL
-#if MAX_MEM_LEVEL >= 8
-#  define DEF_MEM_LEVEL 8
-#else
-#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
-#endif
-#endif
-const char zip_copyright[] =
-   " zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
-
-
-#define SIZEDATA_INDATABLOCK (4096-(4*4))
-
-#define LOCALHEADERMAGIC    (0x04034b50)
-#define CENTRALHEADERMAGIC  (0x02014b50)
-#define ENDHEADERMAGIC      (0x06054b50)
-
-#define FLAG_LOCALHEADER_OFFSET (0x06)
-#define CRC_LOCALHEADER_OFFSET  (0x0e)
-
-#define SIZECENTRALHEADER (0x2e) /* 46 */
-
-typedef struct linkedlist_datablock_internal_s
-{
-  struct linkedlist_datablock_internal_s* next_datablock;
-  uLong  avail_in_this_block;
-  uLong  filled_in_this_block;
-  uLong  unused; /* for future use and alignement */
-  unsigned char data[SIZEDATA_INDATABLOCK];
-} linkedlist_datablock_internal;
-
-typedef struct linkedlist_data_s
-{
-    linkedlist_datablock_internal* first_block;
-    linkedlist_datablock_internal* last_block;
-} linkedlist_data;
-
-
-typedef struct
-{
-    z_stream stream;            /* zLib stream structure for inflate */
-    int  stream_initialised;    /* 1 is stream is initialised */
-    uInt pos_in_buffered_data;  /* last written byte in buffered_data */
-
-    uLong pos_local_header;     /* offset of the local header of the file
-                                     currenty writing */
-    char* central_header;       /* central header data for the current file */
-    uLong size_centralheader;   /* size of the central header for cur file */
-    uLong flag;                 /* flag of the file currently writing */
-
-    int  method;                /* compression method of file currenty wr.*/
-    int  raw;                   /* 1 for directly writing raw data */
-    Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
-    uLong dosDate;
-    uLong crc32;
-    int  encrypt;
-#ifndef NOCRYPT
-    unsigned long keys[3];     /* keys defining the pseudo-random sequence */
-    const unsigned long* pcrc_32_tab;
-    int crypt_header_size;
-#endif
-} curfile_info;
-
-typedef struct
-{
-    zlib_filefunc_def z_filefunc;
-    voidpf filestream;        /* io structore of the zipfile */
-    linkedlist_data central_dir;/* datablock with central dir in construction*/
-    int  in_opened_file_inzip;  /* 1 if a file in the zip is currently writ.*/
-    curfile_info ci;            /* info on the file curretly writing */
-
-    uLong begin_pos;            /* position of the beginning of the zipfile */
-    uLong add_position_when_writting_offset;
-    uLong number_entry;
-#ifndef NO_ADDFILEINEXISTINGZIP
-    char *globalcomment;
-#endif
-} zip_internal;
-
-
-
-#ifndef NOCRYPT
-#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
-#include "crypt.h"
-#endif
-
-local linkedlist_datablock_internal* allocate_new_datablock()
-{
-    linkedlist_datablock_internal* ldi;
-    ldi = (linkedlist_datablock_internal*)
-                 ALLOC(sizeof(linkedlist_datablock_internal));
-    if (ldi!=NULL)
-    {
-        ldi->next_datablock = NULL ;
-        ldi->filled_in_this_block = 0 ;
-        ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
-    }
-    return ldi;
-}
-
-local void free_datablock(ldi)
-    linkedlist_datablock_internal* ldi;
-{
-    while (ldi!=NULL)
-    {
-        linkedlist_datablock_internal* ldinext = ldi->next_datablock;
-        TRYFREE(ldi);
-        ldi = ldinext;
-    }
-}
-
-local void init_linkedlist(ll)
-    linkedlist_data* ll;
-{
-    ll->first_block = ll->last_block = NULL;
-}
-
-local void free_linkedlist(ll)
-    linkedlist_data* ll;
-{
-    free_datablock(ll->first_block);
-    ll->first_block = ll->last_block = NULL;
-}
-
-
-local int add_data_in_datablock(ll,buf,len)
-    linkedlist_data* ll;
-    const void* buf;
-    uLong len;
-{
-    linkedlist_datablock_internal* ldi;
-    const unsigned char* from_copy;
-
-    if (ll==NULL)
-        return ZIP_INTERNALERROR;
-
-    if (ll->last_block == NULL)
-    {
-        ll->first_block = ll->last_block = allocate_new_datablock();
-        if (ll->first_block == NULL)
-            return ZIP_INTERNALERROR;
-    }
-
-    ldi = ll->last_block;
-    from_copy = (unsigned char*)buf;
-
-    while (len>0)
-    {
-        uInt copy_this;
-        uInt i;
-        unsigned char* to_copy;
-
-        if (ldi->avail_in_this_block==0)
-        {
-            ldi->next_datablock = allocate_new_datablock();
-            if (ldi->next_datablock == NULL)
-                return ZIP_INTERNALERROR;
-            ldi = ldi->next_datablock ;
-            ll->last_block = ldi;
-        }
-
-        if (ldi->avail_in_this_block < len)
-            copy_this = (uInt)ldi->avail_in_this_block;
-        else
-            copy_this = (uInt)len;
-
-        to_copy = &(ldi->data[ldi->filled_in_this_block]);
-
-        for (i=0;i<copy_this;i++)
-            *(to_copy+i)=*(from_copy+i);
-
-        ldi->filled_in_this_block += copy_this;
-        ldi->avail_in_this_block -= copy_this;
-        from_copy += copy_this ;
-        len -= copy_this;
-    }
-    return ZIP_OK;
-}
-
-
-
-/****************************************************************************/
-
-#ifndef NO_ADDFILEINEXISTINGZIP
-/* ===========================================================================
-   Inputs a long in LSB order to the given file
-   nbByte == 1, 2 or 4 (byte, short or long)
-*/
-
-local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
-                                voidpf filestream, uLong x, int nbByte));
-local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    uLong x;
-    int nbByte;
-{
-    unsigned char buf[4];
-    int n;
-    for (n = 0; n < nbByte; n++)
-    {
-        buf[n] = (unsigned char)(x & 0xff);
-        x >>= 8;
-    }
-    if (x != 0)
-      {     /* data overflow - hack for ZIP64 (X Roche) */
-      for (n = 0; n < nbByte; n++)
-        {
-          buf[n] = 0xff;
-        }
-      }
-
-    if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
-        return ZIP_ERRNO;
-    else
-        return ZIP_OK;
-}
-
-local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
-local void ziplocal_putValue_inmemory (dest, x, nbByte)
-    void* dest;
-    uLong x;
-    int nbByte;
-{
-    unsigned char* buf=(unsigned char*)dest;
-    int n;
-    for (n = 0; n < nbByte; n++) {
-        buf[n] = (unsigned char)(x & 0xff);
-        x >>= 8;
-    }
-
-    if (x != 0)
-    {     /* data overflow - hack for ZIP64 */
-       for (n = 0; n < nbByte; n++)
-       {
-          buf[n] = 0xff;
-       }
-    }
-}
-
-/****************************************************************************/
-
-
-local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
-    const tm_zip* ptm;
-    uLong dosDate;
-{
-    uLong year = (uLong)ptm->tm_year;
-    if (year>1980)
-        year-=1980;
-    else if (year>80)
-        year-=80;
-    return
-      (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
-        ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
-}
-
-
-/****************************************************************************/
-
-local int ziplocal_getByte OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream,
-    int *pi));
-
-local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    int *pi;
-{
-    unsigned char c;
-    int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
-    if (err==1)
-    {
-        *pi = (int)c;
-        return ZIP_OK;
-    }
-    else
-    {
-        if (ZERROR(*pzlib_filefunc_def,filestream))
-            return ZIP_ERRNO;
-        else
-            return ZIP_EOF;
-    }
-}
-
-
-/* ===========================================================================
-   Reads a long in LSB order from the given gz_stream. Sets
-*/
-local int ziplocal_getShort OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream,
-    uLong *pX));
-
-local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    uLong *pX;
-{
-    uLong x ;
-    int i;
-    int err;
-
-    err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x = (uLong)i;
-
-    if (err==ZIP_OK)
-        err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<8;
-
-    if (err==ZIP_OK)
-        *pX = x;
-    else
-        *pX = 0;
-    return err;
-}
-
-local int ziplocal_getLong OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream,
-    uLong *pX));
-
-local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-    uLong *pX;
-{
-    uLong x ;
-    int i;
-    int err;
-
-    err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x = (uLong)i;
-
-    if (err==ZIP_OK)
-        err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<8;
-
-    if (err==ZIP_OK)
-        err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<16;
-
-    if (err==ZIP_OK)
-        err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
-    x += ((uLong)i)<<24;
-
-    if (err==ZIP_OK)
-        *pX = x;
-    else
-        *pX = 0;
-    return err;
-}
-
-#ifndef BUFREADCOMMENT
-#define BUFREADCOMMENT (0x400)
-#endif
-/*
-  Locate the Central directory of a zipfile (at the end, just before
-    the global comment)
-*/
-local uLong ziplocal_SearchCentralDir OF((
-    const zlib_filefunc_def* pzlib_filefunc_def,
-    voidpf filestream));
-
-local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
-    const zlib_filefunc_def* pzlib_filefunc_def;
-    voidpf filestream;
-{
-    unsigned char* buf;
-    uLong uSizeFile;
-    uLong uBackRead;
-    uLong uMaxBack=0xffff; /* maximum size of global comment */
-    uLong uPosFound=0;
-
-    if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
-        return 0;
-
-
-    uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
-
-    if (uMaxBack>uSizeFile)
-        uMaxBack = uSizeFile;
-
-    buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
-    if (buf==NULL)
-        return 0;
-
-    uBackRead = 4;
-    while (uBackRead<uMaxBack)
-    {
-        uLong uReadSize,uReadPos ;
-        int i;
-        if (uBackRead+BUFREADCOMMENT>uMaxBack)
-            uBackRead = uMaxBack;
-        else
-            uBackRead+=BUFREADCOMMENT;
-        uReadPos = uSizeFile-uBackRead ;
-
-        uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
-                     (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
-        if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
-            break;
-
-        if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
-            break;
-
-        for (i=(int)uReadSize-3; (i--)>0;)
-            if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
-                ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
-            {
-                uPosFound = uReadPos+i;
-                break;
-            }
-
-        if (uPosFound!=0)
-            break;
-    }
-    TRYFREE(buf);
-    return uPosFound;
-}
-#endif /* !NO_ADDFILEINEXISTINGZIP*/
-
-/************************************************************/
-extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def)
-    const char *pathname;
-    int append;
-    zipcharpc* globalcomment;
-    zlib_filefunc_def* pzlib_filefunc_def;
-{
-    zip_internal ziinit;
-    zip_internal* zi;
-    int err=ZIP_OK;
-
-
-    if (pzlib_filefunc_def==NULL)
-        fill_fopen_filefunc(&ziinit.z_filefunc);
-    else
-        ziinit.z_filefunc = *pzlib_filefunc_def;
-
-    ziinit.filestream = (*(ziinit.z_filefunc.zopen_file))
-                 (ziinit.z_filefunc.opaque,
-                  pathname,
-                  (append == APPEND_STATUS_CREATE) ?
-                  (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
-                    (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));
-
-    if (ziinit.filestream == NULL)
-        return NULL;
-    ziinit.begin_pos = ZTELL(ziinit.z_filefunc,ziinit.filestream);
-    ziinit.in_opened_file_inzip = 0;
-    ziinit.ci.stream_initialised = 0;
-    ziinit.number_entry = 0;
-    ziinit.add_position_when_writting_offset = 0;
-    init_linkedlist(&(ziinit.central_dir));
-
-
-    zi = (zip_internal*)ALLOC(sizeof(zip_internal));
-    if (zi==NULL)
-    {
-        ZCLOSE(ziinit.z_filefunc,ziinit.filestream);
-        return NULL;
-    }
-
-    /* now we add file in a zipfile */
-#    ifndef NO_ADDFILEINEXISTINGZIP
-    ziinit.globalcomment = NULL;
-    if (append == APPEND_STATUS_ADDINZIP)
-    {
-        uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
-
-        uLong size_central_dir;     /* size of the central directory  */
-        uLong offset_central_dir;   /* offset of start of central directory */
-        uLong central_pos,uL;
-
-        uLong number_disk;          /* number of the current dist, used for
-                                    spaning ZIP, unsupported, always 0*/
-        uLong number_disk_with_CD;  /* number the the disk with central dir, used
-                                    for spaning ZIP, unsupported, always 0*/
-        uLong number_entry;
-        uLong number_entry_CD;      /* total number of entries in
-                                    the central dir
-                                    (same than number_entry on nospan) */
-        uLong size_comment;
-
-        central_pos = ziplocal_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream);
-        if (central_pos==0)
-            err=ZIP_ERRNO;
-
-        if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
-                                        central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
-            err=ZIP_ERRNO;
-
-        /* the signature, already checked */
-        if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&uL)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        /* number of this disk */
-        if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        /* number of the disk with the start of the central directory */
-        if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        /* total number of entries in the central dir on this disk */
-        if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        /* total number of entries in the central dir */
-        if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        if ((number_entry_CD!=number_entry) ||
-            (number_disk_with_CD!=0) ||
-            (number_disk!=0))
-            err=ZIP_BADZIPFILE;
-
-        /* size of the central directory */
-        if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        /* offset of start of central directory with respect to the
-            starting disk number */
-        if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        /* zipfile global comment length */
-        if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment)!=ZIP_OK)
-            err=ZIP_ERRNO;
-
-        if ((central_pos<offset_central_dir+size_central_dir) &&
-            (err==ZIP_OK))
-            err=ZIP_BADZIPFILE;
-
-        if (err!=ZIP_OK)
-        {
-            ZCLOSE(ziinit.z_filefunc, ziinit.filestream);
-            return NULL;
-        }
-
-        if (size_comment>0)
-        {
-            ziinit.globalcomment = ALLOC(size_comment+1);
-            if (ziinit.globalcomment)
-            {
-               size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
-               ziinit.globalcomment[size_comment]=0;
-            }
-        }
-
-        byte_before_the_zipfile = central_pos -
-                                (offset_central_dir+size_central_dir);
-        ziinit.add_position_when_writting_offset = byte_before_the_zipfile;
-
-        {
-            uLong size_central_dir_to_read = size_central_dir;
-            size_t buf_size = SIZEDATA_INDATABLOCK;
-            void* buf_read = (void*)ALLOC(buf_size);
-            if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
-                  offset_central_dir + byte_before_the_zipfile,
-                  ZLIB_FILEFUNC_SEEK_SET) != 0)
-                  err=ZIP_ERRNO;
-
-            while ((size_central_dir_to_read>0) && (err==ZIP_OK))
-            {
-                uLong read_this = SIZEDATA_INDATABLOCK;
-                if (read_this > size_central_dir_to_read)
-                    read_this = size_central_dir_to_read;
-                if (ZREAD(ziinit.z_filefunc, ziinit.filestream,buf_read,read_this) != read_this)
-                    err=ZIP_ERRNO;
-
-                if (err==ZIP_OK)
-                    err = add_data_in_datablock(&ziinit.central_dir,buf_read,
-                                                (uLong)read_this);
-                size_central_dir_to_read-=read_this;
-            }
-            TRYFREE(buf_read);
-        }
-        ziinit.begin_pos = byte_before_the_zipfile;
-        ziinit.number_entry = number_entry_CD;
-
-        if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
-                  offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
-            err=ZIP_ERRNO;
-    }
-
-    if (globalcomment)
-    {
-      *globalcomment = ziinit.globalcomment;
-    }
-#    endif /* !NO_ADDFILEINEXISTINGZIP*/
-
-    if (err != ZIP_OK)
-    {
-#    ifndef NO_ADDFILEINEXISTINGZIP
-        TRYFREE(ziinit.globalcomment);
-#    endif /* !NO_ADDFILEINEXISTINGZIP*/
-        TRYFREE(zi);
-        return NULL;
-    }
-    else
-    {
-        *zi = ziinit;
-        return (zipFile)zi;
-    }
-}
-
-extern zipFile ZEXPORT zipOpen (pathname, append)
-    const char *pathname;
-    int append;
-{
-    return zipOpen2(pathname,append,NULL,NULL);
-}
-
-extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
-                                         extrafield_local, size_extrafield_local,
-                                         extrafield_global, size_extrafield_global,
-                                         comment, method, level, raw,
-                                         windowBits, memLevel, strategy,
-                                         password, crcForCrypting)
-    zipFile file;
-    const char* filename;
-    const zip_fileinfo* zipfi;
-    const void* extrafield_local;
-    uInt size_extrafield_local;
-    const void* extrafield_global;
-    uInt size_extrafield_global;
-    const char* comment;
-    int method;
-    int level;
-    int raw;
-    int windowBits;
-    int memLevel;
-    int strategy;
-    const char* password;
-    uLong crcForCrypting;
-{
-    zip_internal* zi;
-    uInt size_filename;
-    uInt size_comment;
-    uInt i;
-    int err = ZIP_OK;
-
-#    ifdef NOCRYPT
-    if (password != NULL)
-        return ZIP_PARAMERROR;
-#    endif
-
-    if (file == NULL)
-        return ZIP_PARAMERROR;
-    if ((method!=0) && (method!=Z_DEFLATED))
-        return ZIP_PARAMERROR;
-
-    zi = (zip_internal*)file;
-
-    if (zi->in_opened_file_inzip == 1)
-    {
-        err = zipCloseFileInZip (file);
-        if (err != ZIP_OK)
-            return err;
-    }
-
-
-    if (filename==NULL)
-        filename="-";
-
-    if (comment==NULL)
-        size_comment = 0;
-    else
-        size_comment = (uInt)strlen(comment);
-
-    size_filename = (uInt)strlen(filename);
-
-    if (zipfi == NULL)
-        zi->ci.dosDate = 0;
-    else
-    {
-        if (zipfi->dosDate != 0)
-            zi->ci.dosDate = zipfi->dosDate;
-        else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate);
-    }
-
-    zi->ci.flag = 0;
-    if ((level==8) || (level==9))
-      zi->ci.flag |= 2;
-    if (level==2)
-      zi->ci.flag |= 4;
-    if (level==1)
-      zi->ci.flag |= 6;
-    if (password != NULL)
-      zi->ci.flag |= 1;
-
-    zi->ci.crc32 = 0;
-    zi->ci.method = method;
-    zi->ci.encrypt = 0;
-    zi->ci.stream_initialised = 0;
-    zi->ci.pos_in_buffered_data = 0;
-    zi->ci.raw = raw;
-    zi->ci.pos_local_header = ZTELL(zi->z_filefunc,zi->filestream) ;
-    zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename +
-                                      size_extrafield_global + size_comment;
-    zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader);
-
-    ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
-    /* version info */
-    ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4);
-    ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/
-    ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/
-    ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/
-    ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/
-
-    if (zipfi==NULL)
-        ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2);
-    else
-        ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2);
-
-    if (zipfi==NULL)
-        ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4);
-    else
-        ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4);
-
-    ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header- zi->add_position_when_writting_offset,4);
-
-    for (i=0;i<size_filename;i++)
-        *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
-
-    for (i=0;i<size_extrafield_global;i++)
-        *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) =
-              *(((const char*)extrafield_global)+i);
-
-    for (i=0;i<size_comment;i++)
-        *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
-              size_extrafield_global+i) = *(comment+i);
-    if (zi->ci.central_header == NULL)
-        return ZIP_INTERNALERROR;
-
-    /* write the local header */
-    err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC,4);
-
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2);
-
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2);
-
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4);
-
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */
-
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2);
-
-    if (err==ZIP_OK)
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield_local,2);
-
-    if ((err==ZIP_OK) && (size_filename>0))
-        if (ZWRITE(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename)
-                err = ZIP_ERRNO;
-
-    if ((err==ZIP_OK) && (size_extrafield_local>0))
-        if (ZWRITE(zi->z_filefunc,zi->filestream,extrafield_local,size_extrafield_local)
-                                                                           !=size_extrafield_local)
-                err = ZIP_ERRNO;
-
-    zi->ci.stream.avail_in = (uInt)0;
-    zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
-    zi->ci.stream.next_out = zi->ci.buffered_data;
-    zi->ci.stream.total_in = 0;
-    zi->ci.stream.total_out = 0;
-
-    if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
-    {
-        zi->ci.stream.zalloc = (alloc_func)0;
-        zi->ci.stream.zfree = (free_func)0;
-        zi->ci.stream.opaque = (voidpf)0;
-
-        if (windowBits>0)
-            windowBits = -windowBits;
-
-        err = deflateInit2(&zi->ci.stream, level,
-               Z_DEFLATED, windowBits, memLevel, strategy);
-
-        if (err==Z_OK)
-            zi->ci.stream_initialised = 1;
-    }
-#    ifndef NOCRYPT
-    zi->ci.crypt_header_size = 0;
-    if ((err==Z_OK) && (password != NULL))
-    {
-        unsigned char bufHead[RAND_HEAD_LEN];
-        unsigned int sizeHead;
-        zi->ci.encrypt = 1;
-        zi->ci.pcrc_32_tab = get_crc_table();
-        /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
-
-        sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
-        zi->ci.crypt_header_size = sizeHead;
-
-        if (ZWRITE(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
-                err = ZIP_ERRNO;
-    }
-#    endif
-
-    if (err==Z_OK)
-        zi->in_opened_file_inzip = 1;
-    return err;
-}
-
-extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
-                                        extrafield_local, size_extrafield_local,
-                                        extrafield_global, size_extrafield_global,
-                                        comment, method, level, raw)
-    zipFile file;
-    const char* filename;
-    const zip_fileinfo* zipfi;
-    const void* extrafield_local;
-    uInt size_extrafield_local;
-    const void* extrafield_global;
-    uInt size_extrafield_global;
-    const char* comment;
-    int method;
-    int level;
-    int raw;
-{
-    return zipOpenNewFileInZip3 (file, filename, zipfi,
-                                 extrafield_local, size_extrafield_local,
-                                 extrafield_global, size_extrafield_global,
-                                 comment, method, level, raw,
-                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
-                                 NULL, 0);
-}
-
-extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi,
-                                        extrafield_local, size_extrafield_local,
-                                        extrafield_global, size_extrafield_global,
-                                        comment, method, level)
-    zipFile file;
-    const char* filename;
-    const zip_fileinfo* zipfi;
-    const void* extrafield_local;
-    uInt size_extrafield_local;
-    const void* extrafield_global;
-    uInt size_extrafield_global;
-    const char* comment;
-    int method;
-    int level;
-{
-    return zipOpenNewFileInZip2 (file, filename, zipfi,
-                                 extrafield_local, size_extrafield_local,
-                                 extrafield_global, size_extrafield_global,
-                                 comment, method, level, 0);
-}
-
-local int zipFlushWriteBuffer(zi)
-  zip_internal* zi;
-{
-    int err=ZIP_OK;
-
-    if (zi->ci.encrypt != 0)
-    {
-#ifndef NOCRYPT
-        uInt i;
-        int t;
-        for (i=0;i<zi->ci.pos_in_buffered_data;i++)
-            zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab,
-                                       zi->ci.buffered_data[i],t);
-#endif
-    }
-    if (ZWRITE(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data)
-                                                                    !=zi->ci.pos_in_buffered_data)
-      err = ZIP_ERRNO;
-    zi->ci.pos_in_buffered_data = 0;
-    return err;
-}
-
-extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
-    zipFile file;
-    const void* buf;
-    unsigned len;
-{
-    zip_internal* zi;
-    int err=ZIP_OK;
-
-    if (file == NULL)
-        return ZIP_PARAMERROR;
-    zi = (zip_internal*)file;
-
-    if (zi->in_opened_file_inzip == 0)
-        return ZIP_PARAMERROR;
-
-    zi->ci.stream.next_in = (void*)buf;
-    zi->ci.stream.avail_in = len;
-    zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
-
-    while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
-    {
-        if (zi->ci.stream.avail_out == 0)
-        {
-            if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
-                err = ZIP_ERRNO;
-            zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
-            zi->ci.stream.next_out = zi->ci.buffered_data;
-        }
-
-
-        if(err != ZIP_OK)
-            break;
-
-        if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
-        {
-            uLong uTotalOutBefore = zi->ci.stream.total_out;
-            err=deflate(&zi->ci.stream,  Z_NO_FLUSH);
-            zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
-
-        }
-        else
-        {
-            uInt copy_this,i;
-            if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
-                copy_this = zi->ci.stream.avail_in;
-            else
-                copy_this = zi->ci.stream.avail_out;
-            for (i=0;i<copy_this;i++)
-                *(((char*)zi->ci.stream.next_out)+i) =
-                    *(((const char*)zi->ci.stream.next_in)+i);
-            {
-                zi->ci.stream.avail_in -= copy_this;
-                zi->ci.stream.avail_out-= copy_this;
-                zi->ci.stream.next_in+= copy_this;
-                zi->ci.stream.next_out+= copy_this;
-                zi->ci.stream.total_in+= copy_this;
-                zi->ci.stream.total_out+= copy_this;
-                zi->ci.pos_in_buffered_data += copy_this;
-            }
-        }
-    }
-
-    return err;
-}
-
-extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
-    zipFile file;
-    uLong uncompressed_size;
-    uLong crc32;
-{
-    zip_internal* zi;
-    uLong compressed_size;
-    int err=ZIP_OK;
-
-    if (file == NULL)
-        return ZIP_PARAMERROR;
-    zi = (zip_internal*)file;
-
-    if (zi->in_opened_file_inzip == 0)
-        return ZIP_PARAMERROR;
-    zi->ci.stream.avail_in = 0;
-
-    if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
-        while (err==ZIP_OK)
-    {
-        uLong uTotalOutBefore;
-        if (zi->ci.stream.avail_out == 0)
-        {
-            if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
-                err = ZIP_ERRNO;
-            zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
-            zi->ci.stream.next_out = zi->ci.buffered_data;
-        }
-        uTotalOutBefore = zi->ci.stream.total_out;
-        err=deflate(&zi->ci.stream,  Z_FINISH);
-        zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
-    }
-
-    if (err==Z_STREAM_END)
-        err=ZIP_OK; /* this is normal */
-
-    if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
-        if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
-            err = ZIP_ERRNO;
-
-    if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
-    {
-        err=deflateEnd(&zi->ci.stream);
-        zi->ci.stream_initialised = 0;
-    }
-
-    if (!zi->ci.raw)
-    {
-        crc32 = (uLong)zi->ci.crc32;
-        uncompressed_size = (uLong)zi->ci.stream.total_in;
-    }
-    compressed_size = (uLong)zi->ci.stream.total_out;
-#    ifndef NOCRYPT
-    compressed_size += zi->ci.crypt_header_size;
-#    endif
-
-    ziplocal_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/
-    ziplocal_putValue_inmemory(zi->ci.central_header+20,
-                                compressed_size,4); /*compr size*/
-    if (zi->ci.stream.data_type == Z_ASCII)
-        ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2);
-    ziplocal_putValue_inmemory(zi->ci.central_header+24,
-                                uncompressed_size,4); /*uncompr size*/
-
-    if (err==ZIP_OK)
-        err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header,
-                                       (uLong)zi->ci.size_centralheader);
-    free(zi->ci.central_header);
-
-    if (err==ZIP_OK)
-    {
-        long cur_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
-        if (ZSEEK(zi->z_filefunc,zi->filestream,
-                  zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0)
-            err = ZIP_ERRNO;
-
-        if (err==ZIP_OK)
-            err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */
-
-        if (err==ZIP_OK) /* compressed size, unknown */
-            err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4);
-
-        if (err==ZIP_OK) /* uncompressed size, unknown */
-            err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4);
-
-        if (ZSEEK(zi->z_filefunc,zi->filestream,
-                  cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0)
-            err = ZIP_ERRNO;
-    }
-
-    zi->number_entry ++;
-    zi->in_opened_file_inzip = 0;
-
-    return err;
-}
-
-extern int ZEXPORT zipCloseFileInZip (file)
-    zipFile file;
-{
-    return zipCloseFileInZipRaw (file,0,0);
-}
-
-extern int ZEXPORT zipClose (file, global_comment)
-    zipFile file;
-    const char* global_comment;
-{
-    zip_internal* zi;
-    int err = 0;
-    uLong size_centraldir = 0;
-    uLong centraldir_pos_inzip;
-    uInt size_global_comment;
-    if (file == NULL)
-        return ZIP_PARAMERROR;
-    zi = (zip_internal*)file;
-
-    if (zi->in_opened_file_inzip == 1)
-    {
-        err = zipCloseFileInZip (file);
-    }
-
-#ifndef NO_ADDFILEINEXISTINGZIP
-    if (global_comment==NULL)
-        global_comment = zi->globalcomment;
-#endif
-    if (global_comment==NULL)
-        size_global_comment = 0;
-    else
-        size_global_comment = (uInt)strlen(global_comment);
-
-    centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
-    if (err==ZIP_OK)
-    {
-        linkedlist_datablock_internal* ldi = zi->central_dir.first_block ;
-        while (ldi!=NULL)
-        {
-            if ((err==ZIP_OK) && (ldi->filled_in_this_block>0))
-                if (ZWRITE(zi->z_filefunc,zi->filestream,
-                           ldi->data,ldi->filled_in_this_block)
-                              !=ldi->filled_in_this_block )
-                    err = ZIP_ERRNO;
-
-            size_centraldir += ldi->filled_in_this_block;
-            ldi = ldi->next_datablock;
-        }
-    }
-    free_datablock(zi->central_dir.first_block);
-
-    if (err==ZIP_OK) /* Magic End */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
-
-    if (err==ZIP_OK) /* number of this disk */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
-
-    if (err==ZIP_OK) /* number of the disk with the start of the central directory */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
-
-    if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
-
-    if (err==ZIP_OK) /* total number of entries in the central dir */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
-
-    if (err==ZIP_OK) /* size of the central directory */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4);
-
-    if (err==ZIP_OK) /* offset of start of central directory with respect to the
-                            starting disk number */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,
-                                (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
-
-    if (err==ZIP_OK) /* zipfile comment length */
-        err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2);
-
-    if ((err==ZIP_OK) && (size_global_comment>0))
-        if (ZWRITE(zi->z_filefunc,zi->filestream,
-                   global_comment,size_global_comment) != size_global_comment)
-                err = ZIP_ERRNO;
-
-    if (ZCLOSE(zi->z_filefunc,zi->filestream) != 0)
-        if (err == ZIP_OK)
-            err = ZIP_ERRNO;
-
-#ifndef NO_ADDFILEINEXISTINGZIP
-    TRYFREE(zi->globalcomment);
-#endif
-    TRYFREE(zi);
-
-    return err;
-}
+/* zip.c -- IO on .zip files using zlib
+   Version 1.1, February 14h, 2010
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+         Changes
+   Oct-2009 - Mathias Svensson - Remove old C style function prototypes
+   Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
+   Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
+   Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
+                                 It is used when recreting zip archive with RAW when deleting items from a zip.
+                                 ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
+   Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
+   Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
+
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "zlib.h"
+#include "zip.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+#ifndef VERSIONMADEBY
+# define VERSIONMADEBY   (0x0) /* platform depedent */
+#endif
+
+#ifndef Z_BUFSIZE
+#define Z_BUFSIZE (64*1024) //(16384)
+#endif
+
+#ifndef Z_MAXFILENAMEINZIP
+#define Z_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) {if (p) free(p);}
+#endif
+
+/*
+#define SIZECENTRALDIRITEM (0x2e)
+#define SIZEZIPLOCALHEADER (0x1e)
+*/
+
+/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+
+
+// NOT sure that this work on ALL platform
+#define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32))
+
+#ifndef SEEK_CUR
+#define SEEK_CUR    1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END    2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET    0
+#endif
+
+#ifndef DEF_MEM_LEVEL
+#if MAX_MEM_LEVEL >= 8
+#  define DEF_MEM_LEVEL 8
+#else
+#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#endif
+#endif
+const char zip_copyright[] =" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
+
+
+#define SIZEDATA_INDATABLOCK (4096-(4*4))
+
+#define LOCALHEADERMAGIC    (0x04034b50)
+#define CENTRALHEADERMAGIC  (0x02014b50)
+#define ENDHEADERMAGIC      (0x06054b50)
+#define ZIP64ENDHEADERMAGIC      (0x6064b50)
+#define ZIP64ENDLOCHEADERMAGIC   (0x7064b50)
+
+#define FLAG_LOCALHEADER_OFFSET (0x06)
+#define CRC_LOCALHEADER_OFFSET  (0x0e)
+
+#define SIZECENTRALHEADER (0x2e) /* 46 */
+
+typedef struct linkedlist_datablock_internal_s
+{
+  struct linkedlist_datablock_internal_s* next_datablock;
+  uLong  avail_in_this_block;
+  uLong  filled_in_this_block;
+  uLong  unused; /* for future use and alignment */
+  unsigned char data[SIZEDATA_INDATABLOCK];
+} linkedlist_datablock_internal;
+
+typedef struct linkedlist_data_s
+{
+    linkedlist_datablock_internal* first_block;
+    linkedlist_datablock_internal* last_block;
+} linkedlist_data;
+
+
+typedef struct
+{
+    z_stream stream;            /* zLib stream structure for inflate */
+#ifdef HAVE_BZIP2
+    bz_stream bstream;          /* bzLib stream structure for bziped */
+#endif
+
+    int  stream_initialised;    /* 1 is stream is initialised */
+    uInt pos_in_buffered_data;  /* last written byte in buffered_data */
+
+    ZPOS64_T pos_local_header;     /* offset of the local header of the file
+                                     currenty writing */
+    char* central_header;       /* central header data for the current file */
+    uLong size_centralExtra;
+    uLong size_centralheader;   /* size of the central header for cur file */
+    uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
+    uLong flag;                 /* flag of the file currently writing */
+
+    int  method;                /* compression method of file currenty wr.*/
+    int  raw;                   /* 1 for directly writing raw data */
+    Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
+    uLong dosDate;
+    uLong crc32;
+    int  encrypt;
+    int  zip64;               /* Add ZIP64 extened information in the extra field */
+    ZPOS64_T pos_zip64extrainfo;
+    ZPOS64_T totalCompressedData;
+    ZPOS64_T totalUncompressedData;
+#ifndef NOCRYPT
+    unsigned long keys[3];     /* keys defining the pseudo-random sequence */
+    const z_crc_t* pcrc_32_tab;
+    unsigned crypt_header_size;
+#endif
+} curfile64_info;
+
+typedef struct
+{
+    zlib_filefunc64_32_def z_filefunc;
+    voidpf filestream;        /* io structore of the zipfile */
+    linkedlist_data central_dir;/* datablock with central dir in construction*/
+    int  in_opened_file_inzip;  /* 1 if a file in the zip is currently writ.*/
+    curfile64_info ci;            /* info on the file curretly writing */
+
+    ZPOS64_T begin_pos;            /* position of the beginning of the zipfile */
+    ZPOS64_T add_position_when_writing_offset;
+    ZPOS64_T number_entry;
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+    char *globalcomment;
+#endif
+
+} zip64_internal;
+
+
+#ifndef NOCRYPT
+#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
+#include "crypt.h"
+#endif
+
+local linkedlist_datablock_internal* allocate_new_datablock()
+{
+    linkedlist_datablock_internal* ldi;
+    ldi = (linkedlist_datablock_internal*)
+                 ALLOC(sizeof(linkedlist_datablock_internal));
+    if (ldi!=NULL)
+    {
+        ldi->next_datablock = NULL ;
+        ldi->filled_in_this_block = 0 ;
+        ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
+    }
+    return ldi;
+}
+
+local void free_datablock(linkedlist_datablock_internal* ldi)
+{
+    while (ldi!=NULL)
+    {
+        linkedlist_datablock_internal* ldinext = ldi->next_datablock;
+        TRYFREE(ldi);
+        ldi = ldinext;
+    }
+}
+
+local void init_linkedlist(linkedlist_data* ll)
+{
+    ll->first_block = ll->last_block = NULL;
+}
+
+local void free_linkedlist(linkedlist_data* ll)
+{
+    free_datablock(ll->first_block);
+    ll->first_block = ll->last_block = NULL;
+}
+
+
+local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
+{
+    linkedlist_datablock_internal* ldi;
+    const unsigned char* from_copy;
+
+    if (ll==NULL)
+        return ZIP_INTERNALERROR;
+
+    if (ll->last_block == NULL)
+    {
+        ll->first_block = ll->last_block = allocate_new_datablock();
+        if (ll->first_block == NULL)
+            return ZIP_INTERNALERROR;
+    }
+
+    ldi = ll->last_block;
+    from_copy = (unsigned char*)buf;
+
+    while (len>0)
+    {
+        uInt copy_this;
+        uInt i;
+        unsigned char* to_copy;
+
+        if (ldi->avail_in_this_block==0)
+        {
+            ldi->next_datablock = allocate_new_datablock();
+            if (ldi->next_datablock == NULL)
+                return ZIP_INTERNALERROR;
+            ldi = ldi->next_datablock ;
+            ll->last_block = ldi;
+        }
+
+        if (ldi->avail_in_this_block < len)
+            copy_this = (uInt)ldi->avail_in_this_block;
+        else
+            copy_this = (uInt)len;
+
+        to_copy = &(ldi->data[ldi->filled_in_this_block]);
+
+        for (i=0;i<copy_this;i++)
+            *(to_copy+i)=*(from_copy+i);
+
+        ldi->filled_in_this_block += copy_this;
+        ldi->avail_in_this_block -= copy_this;
+        from_copy += copy_this ;
+        len -= copy_this;
+    }
+    return ZIP_OK;
+}
+
+
+
+/****************************************************************************/
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+/* ===========================================================================
+   Inputs a long in LSB order to the given file
+   nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
+*/
+
+local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
+local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
+{
+    unsigned char buf[8];
+    int n;
+    for (n = 0; n < nbByte; n++)
+    {
+        buf[n] = (unsigned char)(x & 0xff);
+        x >>= 8;
+    }
+    if (x != 0)
+      {     /* data overflow - hack for ZIP64 (X Roche) */
+      for (n = 0; n < nbByte; n++)
+        {
+          buf[n] = 0xff;
+        }
+      }
+
+    if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
+        return ZIP_ERRNO;
+    else
+        return ZIP_OK;
+}
+
+local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
+local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
+{
+    unsigned char* buf=(unsigned char*)dest;
+    int n;
+    for (n = 0; n < nbByte; n++) {
+        buf[n] = (unsigned char)(x & 0xff);
+        x >>= 8;
+    }
+
+    if (x != 0)
+    {     /* data overflow - hack for ZIP64 */
+       for (n = 0; n < nbByte; n++)
+       {
+          buf[n] = 0xff;
+       }
+    }
+}
+
+/****************************************************************************/
+
+
+local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
+{
+    uLong year = (uLong)ptm->tm_year;
+    if (year>=1980)
+        year-=1980;
+    else if (year>=80)
+        year-=80;
+    return
+      (uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
+        (((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
+}
+
+
+/****************************************************************************/
+
+local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
+
+local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
+{
+    unsigned char c;
+    int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
+    if (err==1)
+    {
+        *pi = (int)c;
+        return ZIP_OK;
+    }
+    else
+    {
+        if (ZERROR64(*pzlib_filefunc_def,filestream))
+            return ZIP_ERRNO;
+        else
+            return ZIP_EOF;
+    }
+}
+
+
+/* ===========================================================================
+   Reads a long in LSB order from the given gz_stream. Sets
+*/
+local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
+
+local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
+{
+    uLong x ;
+    int i = 0;
+    int err;
+
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x = (uLong)i;
+
+    if (err==ZIP_OK)
+        err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x += ((uLong)i)<<8;
+
+    if (err==ZIP_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
+
+local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
+{
+    uLong x ;
+    int i = 0;
+    int err;
+
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x = (uLong)i;
+
+    if (err==ZIP_OK)
+        err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x += ((uLong)i)<<8;
+
+    if (err==ZIP_OK)
+        err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x += ((uLong)i)<<16;
+
+    if (err==ZIP_OK)
+        err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+    x += ((uLong)i)<<24;
+
+    if (err==ZIP_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
+
+
+local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
+{
+  ZPOS64_T x;
+  int i = 0;
+  int err;
+
+  err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x = (ZPOS64_T)i;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<8;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<16;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<24;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<32;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<40;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<48;
+
+  if (err==ZIP_OK)
+    err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
+  x += ((ZPOS64_T)i)<<56;
+
+  if (err==ZIP_OK)
+    *pX = x;
+  else
+    *pX = 0;
+
+  return err;
+}
+
+#ifndef BUFREADCOMMENT
+#define BUFREADCOMMENT (0x400)
+#endif
+/*
+  Locate the Central directory of a zipfile (at the end, just before
+    the global comment)
+*/
+local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
+
+local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
+{
+  unsigned char* buf;
+  ZPOS64_T uSizeFile;
+  ZPOS64_T uBackRead;
+  ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
+  ZPOS64_T uPosFound=0;
+
+  if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
+    return 0;
+
+
+  uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
+
+  if (uMaxBack>uSizeFile)
+    uMaxBack = uSizeFile;
+
+  buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+  if (buf==NULL)
+    return 0;
+
+  uBackRead = 4;
+  while (uBackRead<uMaxBack)
+  {
+    uLong uReadSize;
+    ZPOS64_T uReadPos ;
+    int i;
+    if (uBackRead+BUFREADCOMMENT>uMaxBack)
+      uBackRead = uMaxBack;
+    else
+      uBackRead+=BUFREADCOMMENT;
+    uReadPos = uSizeFile-uBackRead ;
+
+    uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+      (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
+    if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+      break;
+
+    if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
+      break;
+
+    for (i=(int)uReadSize-3; (i--)>0;)
+      if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+        ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+      {
+        uPosFound = uReadPos+(unsigned)i;
+        break;
+      }
+
+    if (uPosFound!=0)
+      break;
+  }
+  TRYFREE(buf);
+  return uPosFound;
+}
+
+/*
+Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
+the global comment)
+*/
+local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
+
+local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
+{
+  unsigned char* buf;
+  ZPOS64_T uSizeFile;
+  ZPOS64_T uBackRead;
+  ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
+  ZPOS64_T uPosFound=0;
+  uLong uL;
+  ZPOS64_T relativeOffset;
+
+  if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
+    return 0;
+
+  uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
+
+  if (uMaxBack>uSizeFile)
+    uMaxBack = uSizeFile;
+
+  buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+  if (buf==NULL)
+    return 0;
+
+  uBackRead = 4;
+  while (uBackRead<uMaxBack)
+  {
+    uLong uReadSize;
+    ZPOS64_T uReadPos;
+    int i;
+    if (uBackRead+BUFREADCOMMENT>uMaxBack)
+      uBackRead = uMaxBack;
+    else
+      uBackRead+=BUFREADCOMMENT;
+    uReadPos = uSizeFile-uBackRead ;
+
+    uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+      (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
+    if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+      break;
+
+    if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
+      break;
+
+    for (i=(int)uReadSize-3; (i--)>0;)
+    {
+      // Signature "0x07064b50" Zip64 end of central directory locater
+      if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
+      {
+        uPosFound = uReadPos+(unsigned)i;
+        break;
+      }
+    }
+
+      if (uPosFound!=0)
+        break;
+  }
+
+  TRYFREE(buf);
+  if (uPosFound == 0)
+    return 0;
+
+  /* Zip64 end of central directory locator */
+  if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
+    return 0;
+
+  /* the signature, already checked */
+  if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
+    return 0;
+
+  /* number of the disk with the start of the zip64 end of  central directory */
+  if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
+    return 0;
+  if (uL != 0)
+    return 0;
+
+  /* relative offset of the zip64 end of central directory record */
+  if (zip64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=ZIP_OK)
+    return 0;
+
+  /* total number of disks */
+  if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
+    return 0;
+  if (uL != 1)
+    return 0;
+
+  /* Goto Zip64 end of central directory record */
+  if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
+    return 0;
+
+  /* the signature */
+  if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
+    return 0;
+
+  if (uL != 0x06064b50) // signature of 'Zip64 end of central directory'
+    return 0;
+
+  return relativeOffset;
+}
+
+local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
+{
+  int err=ZIP_OK;
+  ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+
+  ZPOS64_T size_central_dir;     /* size of the central directory  */
+  ZPOS64_T offset_central_dir;   /* offset of start of central directory */
+  ZPOS64_T central_pos;
+  uLong uL;
+
+  uLong number_disk;          /* number of the current dist, used for
+                              spaning ZIP, unsupported, always 0*/
+  uLong number_disk_with_CD;  /* number the the disk with central dir, used
+                              for spaning ZIP, unsupported, always 0*/
+  ZPOS64_T number_entry;
+  ZPOS64_T number_entry_CD;      /* total number of entries in
+                                the central dir
+                                (same than number_entry on nospan) */
+  uLong VersionMadeBy;
+  uLong VersionNeeded;
+  uLong size_comment;
+
+  int hasZIP64Record = 0;
+
+  // check first if we find a ZIP64 record
+  central_pos = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream);
+  if(central_pos > 0)
+  {
+    hasZIP64Record = 1;
+  }
+  else if(central_pos == 0)
+  {
+    central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream);
+  }
+
+/* disable to allow appending to empty ZIP archive
+        if (central_pos==0)
+            err=ZIP_ERRNO;
+*/
+
+  if(hasZIP64Record)
+  {
+    ZPOS64_T sizeEndOfCentralDirectory;
+    if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0)
+      err=ZIP_ERRNO;
+
+    /* the signature, already checked */
+    if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&uL)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* size of zip64 end of central directory record */
+    if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &sizeEndOfCentralDirectory)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* version made by */
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionMadeBy)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* version needed to extract */
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionNeeded)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* number of this disk */
+    if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&number_disk)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* number of the disk with the start of the central directory */
+    if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&number_disk_with_CD)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* total number of entries in the central directory on this disk */
+    if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &number_entry)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* total number of entries in the central directory */
+    if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&number_entry_CD)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0))
+      err=ZIP_BADZIPFILE;
+
+    /* size of the central directory */
+    if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&size_central_dir)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* offset of start of central directory with respect to the
+    starting disk number */
+    if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&offset_central_dir)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    // TODO..
+    // read the comment from the standard central header.
+    size_comment = 0;
+  }
+  else
+  {
+    // Read End of central Directory info
+    if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+      err=ZIP_ERRNO;
+
+    /* the signature, already checked */
+    if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&uL)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* number of this disk */
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream,&number_disk)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* number of the disk with the start of the central directory */
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream,&number_disk_with_CD)!=ZIP_OK)
+      err=ZIP_ERRNO;
+
+    /* total number of entries in the central dir on this disk */
+    number_entry = 0;
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK)
+      err=ZIP_ERRNO;
+    else
+      number_entry = uL;
+
+    /* total number of entries in the central dir */
+    number_entry_CD = 0;
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK)
+      err=ZIP_ERRNO;
+    else
+      number_entry_CD = uL;
+
+    if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0))
+      err=ZIP_BADZIPFILE;
+
+    /* size of the central directory */
+    size_central_dir = 0;
+    if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK)
+      err=ZIP_ERRNO;
+    else
+      size_central_dir = uL;
+
+    /* offset of start of central directory with respect to the starting disk number */
+    offset_central_dir = 0;
+    if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK)
+      err=ZIP_ERRNO;
+    else
+      offset_central_dir = uL;
+
+
+    /* zipfile global comment length */
+    if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &size_comment)!=ZIP_OK)
+      err=ZIP_ERRNO;
+  }
+
+  if ((central_pos<offset_central_dir+size_central_dir) &&
+    (err==ZIP_OK))
+    err=ZIP_BADZIPFILE;
+
+  if (err!=ZIP_OK)
+  {
+    ZCLOSE64(pziinit->z_filefunc, pziinit->filestream);
+    return ZIP_ERRNO;
+  }
+
+  if (size_comment>0)
+  {
+    pziinit->globalcomment = (char*)ALLOC(size_comment+1);
+    if (pziinit->globalcomment)
+    {
+      size_comment = ZREAD64(pziinit->z_filefunc, pziinit->filestream, pziinit->globalcomment,size_comment);
+      pziinit->globalcomment[size_comment]=0;
+    }
+  }
+
+  byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir);
+  pziinit->add_position_when_writing_offset = byte_before_the_zipfile;
+
+  {
+    ZPOS64_T size_central_dir_to_read = size_central_dir;
+    size_t buf_size = SIZEDATA_INDATABLOCK;
+    void* buf_read = (void*)ALLOC(buf_size);
+    if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0)
+      err=ZIP_ERRNO;
+
+    while ((size_central_dir_to_read>0) && (err==ZIP_OK))
+    {
+      ZPOS64_T read_this = SIZEDATA_INDATABLOCK;
+      if (read_this > size_central_dir_to_read)
+        read_this = size_central_dir_to_read;
+
+      if (ZREAD64(pziinit->z_filefunc, pziinit->filestream,buf_read,(uLong)read_this) != read_this)
+        err=ZIP_ERRNO;
+
+      if (err==ZIP_OK)
+        err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this);
+
+      size_central_dir_to_read-=read_this;
+    }
+    TRYFREE(buf_read);
+  }
+  pziinit->begin_pos = byte_before_the_zipfile;
+  pziinit->number_entry = number_entry_CD;
+
+  if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
+    err=ZIP_ERRNO;
+
+  return err;
+}
+
+
+#endif /* !NO_ADDFILEINEXISTINGZIP*/
+
+
+/************************************************************/
+extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
+{
+    zip64_internal ziinit;
+    zip64_internal* zi;
+    int err=ZIP_OK;
+
+    ziinit.z_filefunc.zseek32_file = NULL;
+    ziinit.z_filefunc.ztell32_file = NULL;
+    if (pzlib_filefunc64_32_def==NULL)
+        fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
+    else
+        ziinit.z_filefunc = *pzlib_filefunc64_32_def;
+
+    ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
+                  pathname,
+                  (append == APPEND_STATUS_CREATE) ?
+                  (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
+                    (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));
+
+    if (ziinit.filestream == NULL)
+        return NULL;
+
+    if (append == APPEND_STATUS_CREATEAFTER)
+        ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END);
+
+    ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream);
+    ziinit.in_opened_file_inzip = 0;
+    ziinit.ci.stream_initialised = 0;
+    ziinit.number_entry = 0;
+    ziinit.add_position_when_writing_offset = 0;
+    init_linkedlist(&(ziinit.central_dir));
+
+
+
+    zi = (zip64_internal*)ALLOC(sizeof(zip64_internal));
+    if (zi==NULL)
+    {
+        ZCLOSE64(ziinit.z_filefunc,ziinit.filestream);
+        return NULL;
+    }
+
+    /* now we add file in a zipfile */
+#    ifndef NO_ADDFILEINEXISTINGZIP
+    ziinit.globalcomment = NULL;
+    if (append == APPEND_STATUS_ADDINZIP)
+    {
+      // Read and Cache Central Directory Records
+      err = LoadCentralDirectoryRecord(&ziinit);
+    }
+
+    if (globalcomment)
+    {
+      *globalcomment = ziinit.globalcomment;
+    }
+#    endif /* !NO_ADDFILEINEXISTINGZIP*/
+
+    if (err != ZIP_OK)
+    {
+#    ifndef NO_ADDFILEINEXISTINGZIP
+        TRYFREE(ziinit.globalcomment);
+#    endif /* !NO_ADDFILEINEXISTINGZIP*/
+        TRYFREE(zi);
+        return NULL;
+    }
+    else
+    {
+        *zi = ziinit;
+        return (zipFile)zi;
+    }
+}
+
+extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
+{
+    if (pzlib_filefunc32_def != NULL)
+    {
+        zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
+        fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
+        return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
+    }
+    else
+        return zipOpen3(pathname, append, globalcomment, NULL);
+}
+
+extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
+{
+    if (pzlib_filefunc_def != NULL)
+    {
+        zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
+        zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
+        zlib_filefunc64_32_def_fill.ztell32_file = NULL;
+        zlib_filefunc64_32_def_fill.zseek32_file = NULL;
+        return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
+    }
+    else
+        return zipOpen3(pathname, append, globalcomment, NULL);
+}
+
+
+
+extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
+{
+    return zipOpen3((const void*)pathname,append,NULL,NULL);
+}
+
+extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
+{
+    return zipOpen3(pathname,append,NULL,NULL);
+}
+
+local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
+{
+  /* write the local header */
+  int err;
+  uInt size_filename = (uInt)strlen(filename);
+  uInt size_extrafield = size_extrafield_local;
+
+  err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC, 4);
+
+  if (err==ZIP_OK)
+  {
+    if(zi->ci.zip64)
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2);/* version needed to extract */
+    else
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */
+  }
+
+  if (err==ZIP_OK)
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2);
+
+  if (err==ZIP_OK)
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2);
+
+  if (err==ZIP_OK)
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4);
+
+  // CRC / Compressed size / Uncompressed size will be filled in later and rewritten later
+  if (err==ZIP_OK)
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */
+  if (err==ZIP_OK)
+  {
+    if(zi->ci.zip64)
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xFFFFFFFF,4); /* compressed size, unknown */
+    else
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */
+  }
+  if (err==ZIP_OK)
+  {
+    if(zi->ci.zip64)
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xFFFFFFFF,4); /* uncompressed size, unknown */
+    else
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */
+  }
+
+  if (err==ZIP_OK)
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2);
+
+  if(zi->ci.zip64)
+  {
+    size_extrafield += 20;
+  }
+
+  if (err==ZIP_OK)
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield,2);
+
+  if ((err==ZIP_OK) && (size_filename > 0))
+  {
+    if (ZWRITE64(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename)
+      err = ZIP_ERRNO;
+  }
+
+  if ((err==ZIP_OK) && (size_extrafield_local > 0))
+  {
+    if (ZWRITE64(zi->z_filefunc, zi->filestream, extrafield_local, size_extrafield_local) != size_extrafield_local)
+      err = ZIP_ERRNO;
+  }
+
+
+  if ((err==ZIP_OK) && (zi->ci.zip64))
+  {
+      // write the Zip64 extended info
+      short HeaderID = 1;
+      short DataSize = 16;
+      ZPOS64_T CompressedSize = 0;
+      ZPOS64_T UncompressedSize = 0;
+
+      // Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
+      zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
+
+      err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
+      err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
+
+      err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
+      err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
+  }
+
+  return err;
+}
+
+/*
+ NOTE.
+ When writing RAW the ZIP64 extended information in extrafield_local and extrafield_global needs to be stripped
+ before calling this function it can be done with zipRemoveExtraInfoBlock
+
+ It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
+ unnecessary allocations.
+ */
+extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                         const void* extrafield_local, uInt size_extrafield_local,
+                                         const void* extrafield_global, uInt size_extrafield_global,
+                                         const char* comment, int method, int level, int raw,
+                                         int windowBits,int memLevel, int strategy,
+                                         const char* password, uLong crcForCrypting,
+                                         uLong versionMadeBy, uLong flagBase, int zip64)
+{
+    zip64_internal* zi;
+    uInt size_filename;
+    uInt size_comment;
+    uInt i;
+    int err = ZIP_OK;
+
+#    ifdef NOCRYPT
+    (crcForCrypting);
+    if (password != NULL)
+        return ZIP_PARAMERROR;
+#    endif
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+
+#ifdef HAVE_BZIP2
+    if ((method!=0) && (method!=Z_DEFLATED) && (method!=Z_BZIP2ED))
+      return ZIP_PARAMERROR;
+#else
+    if ((method!=0) && (method!=Z_DEFLATED))
+      return ZIP_PARAMERROR;
+#endif
+
+    zi = (zip64_internal*)file;
+
+    if (zi->in_opened_file_inzip == 1)
+    {
+        err = zipCloseFileInZip (file);
+        if (err != ZIP_OK)
+            return err;
+    }
+
+    if (filename==NULL)
+        filename="-";
+
+    if (comment==NULL)
+        size_comment = 0;
+    else
+        size_comment = (uInt)strlen(comment);
+
+    size_filename = (uInt)strlen(filename);
+
+    if (zipfi == NULL)
+        zi->ci.dosDate = 0;
+    else
+    {
+        if (zipfi->dosDate != 0)
+            zi->ci.dosDate = zipfi->dosDate;
+        else
+          zi->ci.dosDate = zip64local_TmzDateToDosDate(&zipfi->tmz_date);
+    }
+
+    zi->ci.flag = flagBase;
+    if ((level==8) || (level==9))
+      zi->ci.flag |= 2;
+    if (level==2)
+      zi->ci.flag |= 4;
+    if (level==1)
+      zi->ci.flag |= 6;
+    if (password != NULL)
+      zi->ci.flag |= 1;
+
+    zi->ci.crc32 = 0;
+    zi->ci.method = method;
+    zi->ci.encrypt = 0;
+    zi->ci.stream_initialised = 0;
+    zi->ci.pos_in_buffered_data = 0;
+    zi->ci.raw = raw;
+    zi->ci.pos_local_header = ZTELL64(zi->z_filefunc,zi->filestream);
+
+    zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment;
+    zi->ci.size_centralExtraFree = 32; // Extra space we have reserved in case we need to add ZIP64 extra info data
+
+    zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree);
+
+    zi->ci.size_centralExtra = size_extrafield_global;
+    zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
+    /* version info */
+    zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4);
+    zip64local_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/
+    zip64local_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/
+    zip64local_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/
+    zip64local_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2);
+    zip64local_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/
+
+    if (zipfi==NULL)
+        zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2);
+    else
+        zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2);
+
+    if (zipfi==NULL)
+        zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4);
+    else
+        zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4);
+
+    if(zi->ci.pos_local_header >= 0xffffffff)
+      zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4);
+    else
+      zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writing_offset,4);
+
+    for (i=0;i<size_filename;i++)
+        *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
+
+    for (i=0;i<size_extrafield_global;i++)
+        *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) =
+              *(((const char*)extrafield_global)+i);
+
+    for (i=0;i<size_comment;i++)
+        *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
+              size_extrafield_global+i) = *(comment+i);
+    if (zi->ci.central_header == NULL)
+        return ZIP_INTERNALERROR;
+
+    zi->ci.zip64 = zip64;
+    zi->ci.totalCompressedData = 0;
+    zi->ci.totalUncompressedData = 0;
+    zi->ci.pos_zip64extrainfo = 0;
+
+    err = Write_LocalFileHeader(zi, filename, size_extrafield_local, extrafield_local);
+
+#ifdef HAVE_BZIP2
+    zi->ci.bstream.avail_in = (uInt)0;
+    zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE;
+    zi->ci.bstream.next_out = (char*)zi->ci.buffered_data;
+    zi->ci.bstream.total_in_hi32 = 0;
+    zi->ci.bstream.total_in_lo32 = 0;
+    zi->ci.bstream.total_out_hi32 = 0;
+    zi->ci.bstream.total_out_lo32 = 0;
+#endif
+
+    zi->ci.stream.avail_in = (uInt)0;
+    zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+    zi->ci.stream.next_out = zi->ci.buffered_data;
+    zi->ci.stream.total_in = 0;
+    zi->ci.stream.total_out = 0;
+    zi->ci.stream.data_type = Z_BINARY;
+
+#ifdef HAVE_BZIP2
+    if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED || zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
+#else
+    if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+#endif
+    {
+        if(zi->ci.method == Z_DEFLATED)
+        {
+          zi->ci.stream.zalloc = (alloc_func)0;
+          zi->ci.stream.zfree = (free_func)0;
+          zi->ci.stream.opaque = (voidpf)0;
+
+          if (windowBits>0)
+              windowBits = -windowBits;
+
+          err = deflateInit2(&zi->ci.stream, level, Z_DEFLATED, windowBits, memLevel, strategy);
+
+          if (err==Z_OK)
+              zi->ci.stream_initialised = Z_DEFLATED;
+        }
+        else if(zi->ci.method == Z_BZIP2ED)
+        {
+#ifdef HAVE_BZIP2
+            // Init BZip stuff here
+          zi->ci.bstream.bzalloc = 0;
+          zi->ci.bstream.bzfree = 0;
+          zi->ci.bstream.opaque = (voidpf)0;
+
+          err = BZ2_bzCompressInit(&zi->ci.bstream, level, 0,35);
+          if(err == BZ_OK)
+            zi->ci.stream_initialised = Z_BZIP2ED;
+#endif
+        }
+
+    }
+
+#    ifndef NOCRYPT
+    zi->ci.crypt_header_size = 0;
+    if ((err==Z_OK) && (password != NULL))
+    {
+        unsigned char bufHead[RAND_HEAD_LEN];
+        unsigned int sizeHead;
+        zi->ci.encrypt = 1;
+        zi->ci.pcrc_32_tab = get_crc_table();
+        /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
+
+        sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
+        zi->ci.crypt_header_size = sizeHead;
+
+        if (ZWRITE64(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
+                err = ZIP_ERRNO;
+    }
+#    endif
+
+    if (err==Z_OK)
+        zi->in_opened_file_inzip = 1;
+    return err;
+}
+
+extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                         const void* extrafield_local, uInt size_extrafield_local,
+                                         const void* extrafield_global, uInt size_extrafield_global,
+                                         const char* comment, int method, int level, int raw,
+                                         int windowBits,int memLevel, int strategy,
+                                         const char* password, uLong crcForCrypting,
+                                         uLong versionMadeBy, uLong flagBase)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, raw,
+                                 windowBits, memLevel, strategy,
+                                 password, crcForCrypting, versionMadeBy, flagBase, 0);
+}
+
+extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                         const void* extrafield_local, uInt size_extrafield_local,
+                                         const void* extrafield_global, uInt size_extrafield_global,
+                                         const char* comment, int method, int level, int raw,
+                                         int windowBits,int memLevel, int strategy,
+                                         const char* password, uLong crcForCrypting)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, raw,
+                                 windowBits, memLevel, strategy,
+                                 password, crcForCrypting, VERSIONMADEBY, 0, 0);
+}
+
+extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                         const void* extrafield_local, uInt size_extrafield_local,
+                                         const void* extrafield_global, uInt size_extrafield_global,
+                                         const char* comment, int method, int level, int raw,
+                                         int windowBits,int memLevel, int strategy,
+                                         const char* password, uLong crcForCrypting, int zip64)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, raw,
+                                 windowBits, memLevel, strategy,
+                                 password, crcForCrypting, VERSIONMADEBY, 0, zip64);
+}
+
+extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                        const void* extrafield_local, uInt size_extrafield_local,
+                                        const void* extrafield_global, uInt size_extrafield_global,
+                                        const char* comment, int method, int level, int raw)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, raw,
+                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+                                 NULL, 0, VERSIONMADEBY, 0, 0);
+}
+
+extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                        const void* extrafield_local, uInt size_extrafield_local,
+                                        const void* extrafield_global, uInt size_extrafield_global,
+                                        const char* comment, int method, int level, int raw, int zip64)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, raw,
+                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+                                 NULL, 0, VERSIONMADEBY, 0, zip64);
+}
+
+extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                        const void* extrafield_local, uInt size_extrafield_local,
+                                        const void*extrafield_global, uInt size_extrafield_global,
+                                        const char* comment, int method, int level, int zip64)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, 0,
+                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+                                 NULL, 0, VERSIONMADEBY, 0, zip64);
+}
+
+extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
+                                        const void* extrafield_local, uInt size_extrafield_local,
+                                        const void*extrafield_global, uInt size_extrafield_global,
+                                        const char* comment, int method, int level)
+{
+    return zipOpenNewFileInZip4_64 (file, filename, zipfi,
+                                 extrafield_local, size_extrafield_local,
+                                 extrafield_global, size_extrafield_global,
+                                 comment, method, level, 0,
+                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+                                 NULL, 0, VERSIONMADEBY, 0, 0);
+}
+
+local int zip64FlushWriteBuffer(zip64_internal* zi)
+{
+    int err=ZIP_OK;
+
+    if (zi->ci.encrypt != 0)
+    {
+#ifndef NOCRYPT
+        uInt i;
+        int t;
+        for (i=0;i<zi->ci.pos_in_buffered_data;i++)
+            zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t);
+#endif
+    }
+
+    if (ZWRITE64(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data) != zi->ci.pos_in_buffered_data)
+      err = ZIP_ERRNO;
+
+    zi->ci.totalCompressedData += zi->ci.pos_in_buffered_data;
+
+#ifdef HAVE_BZIP2
+    if(zi->ci.method == Z_BZIP2ED)
+    {
+      zi->ci.totalUncompressedData += zi->ci.bstream.total_in_lo32;
+      zi->ci.bstream.total_in_lo32 = 0;
+      zi->ci.bstream.total_in_hi32 = 0;
+    }
+    else
+#endif
+    {
+      zi->ci.totalUncompressedData += zi->ci.stream.total_in;
+      zi->ci.stream.total_in = 0;
+    }
+
+
+    zi->ci.pos_in_buffered_data = 0;
+
+    return err;
+}
+
+extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
+{
+    zip64_internal* zi;
+    int err=ZIP_OK;
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+    zi = (zip64_internal*)file;
+
+    if (zi->in_opened_file_inzip == 0)
+        return ZIP_PARAMERROR;
+
+    zi->ci.crc32 = crc32(zi->ci.crc32,buf,(uInt)len);
+
+#ifdef HAVE_BZIP2
+    if(zi->ci.method == Z_BZIP2ED && (!zi->ci.raw))
+    {
+      zi->ci.bstream.next_in = (void*)buf;
+      zi->ci.bstream.avail_in = len;
+      err = BZ_RUN_OK;
+
+      while ((err==BZ_RUN_OK) && (zi->ci.bstream.avail_in>0))
+      {
+        if (zi->ci.bstream.avail_out == 0)
+        {
+          if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
+            err = ZIP_ERRNO;
+          zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE;
+          zi->ci.bstream.next_out = (char*)zi->ci.buffered_data;
+        }
+
+
+        if(err != BZ_RUN_OK)
+          break;
+
+        if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
+        {
+          uLong uTotalOutBefore_lo = zi->ci.bstream.total_out_lo32;
+//          uLong uTotalOutBefore_hi = zi->ci.bstream.total_out_hi32;
+          err=BZ2_bzCompress(&zi->ci.bstream,  BZ_RUN);
+
+          zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore_lo) ;
+        }
+      }
+
+      if(err == BZ_RUN_OK)
+        err = ZIP_OK;
+    }
+    else
+#endif
+    {
+      zi->ci.stream.next_in = (Bytef*)buf;
+      zi->ci.stream.avail_in = len;
+
+      while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
+      {
+          if (zi->ci.stream.avail_out == 0)
+          {
+              if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
+                  err = ZIP_ERRNO;
+              zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+              zi->ci.stream.next_out = zi->ci.buffered_data;
+          }
+
+
+          if(err != ZIP_OK)
+              break;
+
+          if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+          {
+              uLong uTotalOutBefore = zi->ci.stream.total_out;
+              err=deflate(&zi->ci.stream,  Z_NO_FLUSH);
+
+              zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
+          }
+          else
+          {
+              uInt copy_this,i;
+              if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
+                  copy_this = zi->ci.stream.avail_in;
+              else
+                  copy_this = zi->ci.stream.avail_out;
+
+              for (i = 0; i < copy_this; i++)
+                  *(((char*)zi->ci.stream.next_out)+i) =
+                      *(((const char*)zi->ci.stream.next_in)+i);
+              {
+                  zi->ci.stream.avail_in -= copy_this;
+                  zi->ci.stream.avail_out-= copy_this;
+                  zi->ci.stream.next_in+= copy_this;
+                  zi->ci.stream.next_out+= copy_this;
+                  zi->ci.stream.total_in+= copy_this;
+                  zi->ci.stream.total_out+= copy_this;
+                  zi->ci.pos_in_buffered_data += copy_this;
+              }
+          }
+      }// while(...)
+    }
+
+    return err;
+}
+
+extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
+{
+    return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
+}
+
+extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
+{
+    zip64_internal* zi;
+    ZPOS64_T compressed_size;
+    uLong invalidValue = 0xffffffff;
+    unsigned datasize = 0;
+    int err=ZIP_OK;
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+    zi = (zip64_internal*)file;
+
+    if (zi->in_opened_file_inzip == 0)
+        return ZIP_PARAMERROR;
+    zi->ci.stream.avail_in = 0;
+
+    if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+                {
+                        while (err==ZIP_OK)
+                        {
+                                uLong uTotalOutBefore;
+                                if (zi->ci.stream.avail_out == 0)
+                                {
+                                        if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
+                                                err = ZIP_ERRNO;
+                                        zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+                                        zi->ci.stream.next_out = zi->ci.buffered_data;
+                                }
+                                uTotalOutBefore = zi->ci.stream.total_out;
+                                err=deflate(&zi->ci.stream,  Z_FINISH);
+                                zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
+                        }
+                }
+    else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
+    {
+#ifdef HAVE_BZIP2
+      err = BZ_FINISH_OK;
+      while (err==BZ_FINISH_OK)
+      {
+        uLong uTotalOutBefore;
+        if (zi->ci.bstream.avail_out == 0)
+        {
+          if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
+            err = ZIP_ERRNO;
+          zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE;
+          zi->ci.bstream.next_out = (char*)zi->ci.buffered_data;
+        }
+        uTotalOutBefore = zi->ci.bstream.total_out_lo32;
+        err=BZ2_bzCompress(&zi->ci.bstream,  BZ_FINISH);
+        if(err == BZ_STREAM_END)
+          err = Z_STREAM_END;
+
+        zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore);
+      }
+
+      if(err == BZ_FINISH_OK)
+        err = ZIP_OK;
+#endif
+    }
+
+    if (err==Z_STREAM_END)
+        err=ZIP_OK; /* this is normal */
+
+    if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
+                {
+        if (zip64FlushWriteBuffer(zi)==ZIP_ERRNO)
+            err = ZIP_ERRNO;
+                }
+
+    if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+    {
+        int tmp_err = deflateEnd(&zi->ci.stream);
+        if (err == ZIP_OK)
+            err = tmp_err;
+        zi->ci.stream_initialised = 0;
+    }
+#ifdef HAVE_BZIP2
+    else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
+    {
+      int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream);
+                        if (err==ZIP_OK)
+                                err = tmperr;
+                        zi->ci.stream_initialised = 0;
+    }
+#endif
+
+    if (!zi->ci.raw)
+    {
+        crc32 = (uLong)zi->ci.crc32;
+        uncompressed_size = zi->ci.totalUncompressedData;
+    }
+    compressed_size = zi->ci.totalCompressedData;
+
+#    ifndef NOCRYPT
+    compressed_size += zi->ci.crypt_header_size;
+#    endif
+
+    // update Current Item crc and sizes,
+    if(compressed_size >= 0xffffffff || uncompressed_size >= 0xffffffff || zi->ci.pos_local_header >= 0xffffffff)
+    {
+      /*version Made by*/
+      zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)45,2);
+      /*version needed*/
+      zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)45,2);
+
+    }
+
+    zip64local_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/
+
+
+    if(compressed_size >= 0xffffffff)
+      zip64local_putValue_inmemory(zi->ci.central_header+20, invalidValue,4); /*compr size*/
+    else
+      zip64local_putValue_inmemory(zi->ci.central_header+20, compressed_size,4); /*compr size*/
+
+    /// set internal file attributes field
+    if (zi->ci.stream.data_type == Z_ASCII)
+        zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2);
+
+    if(uncompressed_size >= 0xffffffff)
+      zip64local_putValue_inmemory(zi->ci.central_header+24, invalidValue,4); /*uncompr size*/
+    else
+      zip64local_putValue_inmemory(zi->ci.central_header+24, uncompressed_size,4); /*uncompr size*/
+
+    // Add ZIP64 extra info field for uncompressed size
+    if(uncompressed_size >= 0xffffffff)
+      datasize += 8;
+
+    // Add ZIP64 extra info field for compressed size
+    if(compressed_size >= 0xffffffff)
+      datasize += 8;
+
+    // Add ZIP64 extra info field for relative offset to local file header of current file
+    if(zi->ci.pos_local_header >= 0xffffffff)
+      datasize += 8;
+
+    if(datasize > 0)
+    {
+      char* p = NULL;
+
+      if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
+      {
+        // we can not write more data to the buffer that we have room for.
+        return ZIP_BADZIPFILE;
+      }
+
+      p = zi->ci.central_header + zi->ci.size_centralheader;
+
+      // Add Extra Information Header for 'ZIP64 information'
+      zip64local_putValue_inmemory(p, 0x0001, 2); // HeaderID
+      p += 2;
+      zip64local_putValue_inmemory(p, datasize, 2); // DataSize
+      p += 2;
+
+      if(uncompressed_size >= 0xffffffff)
+      {
+        zip64local_putValue_inmemory(p, uncompressed_size, 8);
+        p += 8;
+      }
+
+      if(compressed_size >= 0xffffffff)
+      {
+        zip64local_putValue_inmemory(p, compressed_size, 8);
+        p += 8;
+      }
+
+      if(zi->ci.pos_local_header >= 0xffffffff)
+      {
+        zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8);
+        p += 8;
+      }
+
+      // Update how much extra free space we got in the memory buffer
+      // and increase the centralheader size so the new ZIP64 fields are included
+      // ( 4 below is the size of HeaderID and DataSize field )
+      zi->ci.size_centralExtraFree -= datasize + 4;
+      zi->ci.size_centralheader += datasize + 4;
+
+      // Update the extra info size field
+      zi->ci.size_centralExtra += datasize + 4;
+      zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)zi->ci.size_centralExtra,2);
+    }
+
+    if (err==ZIP_OK)
+        err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader);
+
+    free(zi->ci.central_header);
+
+    if (err==ZIP_OK)
+    {
+        // Update the LocalFileHeader with the new values.
+
+        ZPOS64_T cur_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream);
+
+        if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0)
+            err = ZIP_ERRNO;
+
+        if (err==ZIP_OK)
+            err = zip64local_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */
+
+        if(uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff )
+        {
+          if(zi->ci.pos_zip64extrainfo > 0)
+          {
+            // Update the size in the ZIP64 extended field.
+            if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_zip64extrainfo + 4,ZLIB_FILEFUNC_SEEK_SET)!=0)
+              err = ZIP_ERRNO;
+
+            if (err==ZIP_OK) /* compressed size, unknown */
+              err = zip64local_putValue(&zi->z_filefunc, zi->filestream, uncompressed_size, 8);
+
+            if (err==ZIP_OK) /* uncompressed size, unknown */
+              err = zip64local_putValue(&zi->z_filefunc, zi->filestream, compressed_size, 8);
+          }
+          else
+              err = ZIP_BADZIPFILE; // Caller passed zip64 = 0, so no room for zip64 info -> fatal
+        }
+        else
+        {
+          if (err==ZIP_OK) /* compressed size, unknown */
+              err = zip64local_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4);
+
+          if (err==ZIP_OK) /* uncompressed size, unknown */
+              err = zip64local_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4);
+        }
+
+        if (ZSEEK64(zi->z_filefunc,zi->filestream, cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0)
+            err = ZIP_ERRNO;
+    }
+
+    zi->number_entry ++;
+    zi->in_opened_file_inzip = 0;
+
+    return err;
+}
+
+extern int ZEXPORT zipCloseFileInZip (zipFile file)
+{
+    return zipCloseFileInZipRaw (file,0,0);
+}
+
+local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
+{
+  int err = ZIP_OK;
+  ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
+
+  err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
+
+  /*num disks*/
+    if (err==ZIP_OK) /* number of the disk with the start of the central directory */
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4);
+
+  /*relative offset*/
+    if (err==ZIP_OK) /* Relative offset to the Zip64EndOfCentralDirectory */
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream, pos,8);
+
+  /*total disks*/ /* Do not support spawning of disk so always say 1 here*/
+    if (err==ZIP_OK) /* number of the disk with the start of the central directory */
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4);
+
+    return err;
+}
+
+local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+{
+  int err = ZIP_OK;
+
+  uLong Zip64DataSize = 44;
+
+  err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4);
+
+  if (err==ZIP_OK) /* size of this 'zip64 end of central directory' */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(ZPOS64_T)Zip64DataSize,8); // why ZPOS64_T of this ?
+
+  if (err==ZIP_OK) /* version made by */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2);
+
+  if (err==ZIP_OK) /* version needed */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2);
+
+  if (err==ZIP_OK) /* number of this disk */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4);
+
+  if (err==ZIP_OK) /* number of the disk with the start of the central directory */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4);
+
+  if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
+    err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8);
+
+  if (err==ZIP_OK) /* total number of entries in the central dir */
+    err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8);
+
+  if (err==ZIP_OK) /* size of the central directory */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(ZPOS64_T)size_centraldir,8);
+
+  if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
+  {
+    ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
+  }
+  return err;
+}
+local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+{
+  int err = ZIP_OK;
+
+  /*signature*/
+  err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
+
+  if (err==ZIP_OK) /* number of this disk */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
+
+  if (err==ZIP_OK) /* number of the disk with the start of the central directory */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
+
+  if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
+  {
+    {
+      if(zi->number_entry >= 0xFFFF)
+        err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record
+      else
+        err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
+    }
+  }
+
+  if (err==ZIP_OK) /* total number of entries in the central dir */
+  {
+    if(zi->number_entry >= 0xFFFF)
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record
+    else
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
+  }
+
+  if (err==ZIP_OK) /* size of the central directory */
+    err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4);
+
+  if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
+  {
+    ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
+    if(pos >= 0xffffffff)
+    {
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4);
+    }
+    else
+      err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4);
+  }
+
+   return err;
+}
+
+local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
+{
+  int err = ZIP_OK;
+  uInt size_global_comment = 0;
+
+  if(global_comment != NULL)
+    size_global_comment = (uInt)strlen(global_comment);
+
+  err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2);
+
+  if (err == ZIP_OK && size_global_comment > 0)
+  {
+    if (ZWRITE64(zi->z_filefunc,zi->filestream, global_comment, size_global_comment) != size_global_comment)
+      err = ZIP_ERRNO;
+  }
+  return err;
+}
+
+extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
+{
+    zip64_internal* zi;
+    int err = 0;
+    uLong size_centraldir = 0;
+    ZPOS64_T centraldir_pos_inzip;
+    ZPOS64_T pos;
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+
+    zi = (zip64_internal*)file;
+
+    if (zi->in_opened_file_inzip == 1)
+    {
+        err = zipCloseFileInZip (file);
+    }
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+    if (global_comment==NULL)
+        global_comment = zi->globalcomment;
+#endif
+
+    centraldir_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream);
+
+    if (err==ZIP_OK)
+    {
+        linkedlist_datablock_internal* ldi = zi->central_dir.first_block;
+        while (ldi!=NULL)
+        {
+            if ((err==ZIP_OK) && (ldi->filled_in_this_block>0))
+            {
+                if (ZWRITE64(zi->z_filefunc,zi->filestream, ldi->data, ldi->filled_in_this_block) != ldi->filled_in_this_block)
+                    err = ZIP_ERRNO;
+            }
+
+            size_centraldir += ldi->filled_in_this_block;
+            ldi = ldi->next_datablock;
+        }
+    }
+    free_linkedlist(&(zi->central_dir));
+
+    pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
+    if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
+    {
+      ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
+      Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
+
+      Write_Zip64EndOfCentralDirectoryLocator(zi, Zip64EOCDpos);
+    }
+
+    if (err==ZIP_OK)
+      err = Write_EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
+
+    if(err == ZIP_OK)
+      err = Write_GlobalComment(zi, global_comment);
+
+    if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0)
+        if (err == ZIP_OK)
+            err = ZIP_ERRNO;
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+    TRYFREE(zi->globalcomment);
+#endif
+    TRYFREE(zi);
+
+    return err;
+}
+
+extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
+{
+  char* p = pData;
+  int size = 0;
+  char* pNewHeader;
+  char* pTmp;
+  short header;
+  short dataSize;
+
+  int retVal = ZIP_OK;
+
+  if(pData == NULL || dataLen == NULL || *dataLen < 4)
+    return ZIP_PARAMERROR;
+
+  pNewHeader = (char*)ALLOC((unsigned)*dataLen);
+  pTmp = pNewHeader;
+
+  while(p < (pData + *dataLen))
+  {
+    header = *(short*)p;
+    dataSize = *(((short*)p)+1);
+
+    if( header == sHeader ) // Header found.
+    {
+      p += dataSize + 4; // skip it. do not copy to temp buffer
+    }
+    else
+    {
+      // Extra Info block should not be removed, So copy it to the temp buffer.
+      memcpy(pTmp, p, dataSize + 4);
+      p += dataSize + 4;
+      size += dataSize + 4;
+    }
+
+  }
+
+  if(size < *dataLen)
+  {
+    // clean old extra info block.
+    memset(pData,0, *dataLen);
+
+    // copy the new extra info block over the old
+    if(size > 0)
+      memcpy(pData, pNewHeader, size);
+
+    // set the new extra info size
+    *dataLen = size;
+
+    retVal = ZIP_OK;
+  }
+  else
+    retVal = ZIP_ERRNO;
+
+  TRYFREE(pNewHeader);
+
+  return retVal;
+}

+ 367 - 235
RedAnt ERP Mobile/common/zip/minizip/zip.h

@@ -1,235 +1,367 @@
-/* zip.h -- IO for compress .zip files using zlib
-   Version 1.01e, February 12th, 2005
-
-   Copyright (C) 1998-2005 Gilles Vollant
-
-   This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
-     WinZip, InfoZip tools and compatible.
-   Multi volume ZipFile (span) are not supported.
-   Encryption compatible with pkzip 2.04g only supported
-   Old compressions used by old PKZip 1.x are not supported
-
-  For uncompress .zip file, look at unzip.h
-
-
-   I WAIT FEEDBACK at mail info@winimage.com
-   Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
-
-   Condition of use and distribution are the same than zlib :
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-
-*/
-
-/* for more info about .ZIP format, see
-      http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
-      http://www.info-zip.org/pub/infozip/doc/
-   PkWare has also a specification at :
-      ftp://ftp.pkware.com/probdesc.zip
-*/
-
-#ifndef _zip_H
-#define _zip_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#ifndef _ZLIBIOAPI_H
-#include "ioapi.h"
-#endif
-
-#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
-/* like the STRICT of WIN32, we define a pointer that cannot be converted
-    from (void*) without cast */
-typedef struct TagzipFile__ { int unused; } zipFile__;
-typedef zipFile__ *zipFile;
-#else
-typedef voidp zipFile;
-#endif
-
-#define ZIP_OK                          (0)
-#define ZIP_EOF                         (0)
-#define ZIP_ERRNO                       (Z_ERRNO)
-#define ZIP_PARAMERROR                  (-102)
-#define ZIP_BADZIPFILE                  (-103)
-#define ZIP_INTERNALERROR               (-104)
-
-#ifndef DEF_MEM_LEVEL
-#  if MAX_MEM_LEVEL >= 8
-#    define DEF_MEM_LEVEL 8
-#  else
-#    define DEF_MEM_LEVEL  MAX_MEM_LEVEL
-#  endif
-#endif
-/* default memLevel */
-
-/* tm_zip contain date/time info */
-typedef struct tm_zip_s
-{
-    uInt tm_sec;            /* seconds after the minute - [0,59] */
-    uInt tm_min;            /* minutes after the hour - [0,59] */
-    uInt tm_hour;           /* hours since midnight - [0,23] */
-    uInt tm_mday;           /* day of the month - [1,31] */
-    uInt tm_mon;            /* months since January - [0,11] */
-    uInt tm_year;           /* years - [1980..2044] */
-} tm_zip;
-
-typedef struct
-{
-    tm_zip      tmz_date;       /* date in understandable format           */
-    uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
-/*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
-
-    uLong       internal_fa;    /* internal file attributes        2 bytes */
-    uLong       external_fa;    /* external file attributes        4 bytes */
-} zip_fileinfo;
-
-typedef const char* zipcharpc;
-
-
-#define APPEND_STATUS_CREATE        (0)
-#define APPEND_STATUS_CREATEAFTER   (1)
-#define APPEND_STATUS_ADDINZIP      (2)
-
-extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
-/*
-  Create a zipfile.
-     pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
-       an Unix computer "zlib/zlib113.zip".
-     if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
-       will be created at the end of the file.
-         (useful if the file contain a self extractor code)
-     if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
-       add files in existing zip (be sure you don't add file that doesn't exist)
-     If the zipfile cannot be opened, the return value is NULL.
-     Else, the return value is a zipFile Handle, usable with other function
-       of this zip package.
-*/
-
-/* Note : there is no delete function into a zipfile.
-   If you want delete file into a zipfile, you must open a zipfile, and create another
-   Of couse, you can use RAW reading and writing to copy the file you did not want delte
-*/
-
-extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
-                                   int append,
-                                   zipcharpc* globalcomment,
-                                   zlib_filefunc_def* pzlib_filefunc_def));
-
-extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
-                       const char* filename,
-                       const zip_fileinfo* zipfi,
-                       const void* extrafield_local,
-                       uInt size_extrafield_local,
-                       const void* extrafield_global,
-                       uInt size_extrafield_global,
-                       const char* comment,
-                       int method,
-                       int level));
-/*
-  Open a file in the ZIP for writing.
-  filename : the filename in zip (if NULL, '-' without quote will be used
-  *zipfi contain supplemental information
-  if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
-    contains the extrafield data the the local header
-  if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
-    contains the extrafield data the the local header
-  if comment != NULL, comment contain the comment string
-  method contain the compression method (0 for store, Z_DEFLATED for deflate)
-  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
-*/
-
-
-extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
-                                            const char* filename,
-                                            const zip_fileinfo* zipfi,
-                                            const void* extrafield_local,
-                                            uInt size_extrafield_local,
-                                            const void* extrafield_global,
-                                            uInt size_extrafield_global,
-                                            const char* comment,
-                                            int method,
-                                            int level,
-                                            int raw));
-
-/*
-  Same than zipOpenNewFileInZip, except if raw=1, we write raw file
- */
-
-extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
-                                            const char* filename,
-                                            const zip_fileinfo* zipfi,
-                                            const void* extrafield_local,
-                                            uInt size_extrafield_local,
-                                            const void* extrafield_global,
-                                            uInt size_extrafield_global,
-                                            const char* comment,
-                                            int method,
-                                            int level,
-                                            int raw,
-                                            int windowBits,
-                                            int memLevel,
-                                            int strategy,
-                                            const char* password,
-                                            uLong crcForCtypting));
-
-/*
-  Same than zipOpenNewFileInZip2, except
-    windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
-    password : crypting password (NULL for no crypting)
-    crcForCtypting : crc of file to compress (needed for crypting)
- */
-
-
-extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
-                       const void* buf,
-                       unsigned len));
-/*
-  Write data in the zipfile
-*/
-
-extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
-/*
-  Close the current file in the zipfile
-*/
-
-extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
-                                            uLong uncompressed_size,
-                                            uLong crc32));
-/*
-  Close the current file in the zipfile, for fiel opened with
-    parameter raw=1 in zipOpenNewFileInZip2
-  uncompressed_size and crc32 are value for the uncompressed size
-*/
-
-extern int ZEXPORT zipClose OF((zipFile file,
-                const char* global_comment));
-/*
-  Close the zipfile
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _zip_H */
+/* zip.h -- IO on .zip files using zlib
+   Version 1.1, February 14h, 2010
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+         ---------------------------------------------------------------------------
+
+   Condition of use and distribution are the same than zlib :
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+        ---------------------------------------------------------------------------
+
+        Changes
+
+        See header of zip.h
+
+*/
+
+#ifndef _zip12_H
+#define _zip12_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//#define HAVE_BZIP2
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#ifndef _ZLIBIOAPI_H
+#include "ioapi.h"
+#endif
+
+#ifdef HAVE_BZIP2
+#include "bzlib.h"
+#endif
+
+#define Z_BZIP2ED 12
+
+#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+    from (void*) without cast */
+typedef struct TagzipFile__ { int unused; } zipFile__;
+typedef zipFile__ *zipFile;
+#else
+typedef voidp zipFile;
+#endif
+
+#define ZIP_OK                          (0)
+#define ZIP_EOF                         (0)
+#define ZIP_ERRNO                       (Z_ERRNO)
+#define ZIP_PARAMERROR                  (-102)
+#define ZIP_BADZIPFILE                  (-103)
+#define ZIP_INTERNALERROR               (-104)
+
+#ifndef DEF_MEM_LEVEL
+#  if MAX_MEM_LEVEL >= 8
+#    define DEF_MEM_LEVEL 8
+#  else
+#    define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#  endif
+#endif
+/* default memLevel */
+
+/* tm_zip contain date/time info */
+typedef struct tm_zip_s
+{
+    int tm_sec;             /* seconds after the minute - [0,59] */
+    int tm_min;             /* minutes after the hour - [0,59] */
+    int tm_hour;            /* hours since midnight - [0,23] */
+    int tm_mday;            /* day of the month - [1,31] */
+    int tm_mon;             /* months since January - [0,11] */
+    int tm_year;            /* years - [1980..2044] */
+} tm_zip;
+
+typedef struct
+{
+    tm_zip      tmz_date;       /* date in understandable format           */
+    uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
+/*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
+
+    uLong       internal_fa;    /* internal file attributes        2 bytes */
+    uLong       external_fa;    /* external file attributes        4 bytes */
+} zip_fileinfo;
+
+typedef const char* zipcharpc;
+
+
+#define APPEND_STATUS_CREATE        (0)
+#define APPEND_STATUS_CREATEAFTER   (1)
+#define APPEND_STATUS_ADDINZIP      (2)
+
+extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
+extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
+/*
+  Create a zipfile.
+     pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
+       an Unix computer "zlib/zlib113.zip".
+     if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
+       will be created at the end of the file.
+         (useful if the file contain a self extractor code)
+     if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
+       add files in existing zip (be sure you don't add file that doesn't exist)
+     If the zipfile cannot be opened, the return value is NULL.
+     Else, the return value is a zipFile Handle, usable with other function
+       of this zip package.
+*/
+
+/* Note : there is no delete function into a zipfile.
+   If you want delete file into a zipfile, you must open a zipfile, and create another
+   Of couse, you can use RAW reading and writing to copy the file you did not want delte
+*/
+
+extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
+                                   int append,
+                                   zipcharpc* globalcomment,
+                                   zlib_filefunc_def* pzlib_filefunc_def));
+
+extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
+                                   int append,
+                                   zipcharpc* globalcomment,
+                                   zlib_filefunc64_def* pzlib_filefunc_def));
+
+extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
+                                    int append,
+                                    zipcharpc* globalcomment,
+                                    zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
+
+extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
+                       const char* filename,
+                       const zip_fileinfo* zipfi,
+                       const void* extrafield_local,
+                       uInt size_extrafield_local,
+                       const void* extrafield_global,
+                       uInt size_extrafield_global,
+                       const char* comment,
+                       int method,
+                       int level));
+
+extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
+                       const char* filename,
+                       const zip_fileinfo* zipfi,
+                       const void* extrafield_local,
+                       uInt size_extrafield_local,
+                       const void* extrafield_global,
+                       uInt size_extrafield_global,
+                       const char* comment,
+                       int method,
+                       int level,
+                       int zip64));
+
+/*
+  Open a file in the ZIP for writing.
+  filename : the filename in zip (if NULL, '-' without quote will be used
+  *zipfi contain supplemental information
+  if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
+    contains the extrafield data the the local header
+  if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
+    contains the extrafield data the the local header
+  if comment != NULL, comment contain the comment string
+  method contain the compression method (0 for store, Z_DEFLATED for deflate)
+  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
+  zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
+                    this MUST be '1' if the uncompressed size is >= 0xffffffff.
+
+*/
+
+
+extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw));
+
+
+extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw,
+                                            int zip64));
+/*
+  Same than zipOpenNewFileInZip, except if raw=1, we write raw file
+ */
+
+extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw,
+                                            int windowBits,
+                                            int memLevel,
+                                            int strategy,
+                                            const char* password,
+                                            uLong crcForCrypting));
+
+extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw,
+                                            int windowBits,
+                                            int memLevel,
+                                            int strategy,
+                                            const char* password,
+                                            uLong crcForCrypting,
+                                            int zip64
+                                            ));
+
+/*
+  Same than zipOpenNewFileInZip2, except
+    windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
+    password : crypting password (NULL for no crypting)
+    crcForCrypting : crc of file to compress (needed for crypting)
+ */
+
+extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw,
+                                            int windowBits,
+                                            int memLevel,
+                                            int strategy,
+                                            const char* password,
+                                            uLong crcForCrypting,
+                                            uLong versionMadeBy,
+                                            uLong flagBase
+                                            ));
+
+
+extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw,
+                                            int windowBits,
+                                            int memLevel,
+                                            int strategy,
+                                            const char* password,
+                                            uLong crcForCrypting,
+                                            uLong versionMadeBy,
+                                            uLong flagBase,
+                                            int zip64
+                                            ));
+/*
+  Same than zipOpenNewFileInZip4, except
+    versionMadeBy : value for Version made by field
+    flag : value for flag field (compression level info will be added)
+ */
+
+
+extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
+                       const void* buf,
+                       unsigned len));
+/*
+  Write data in the zipfile
+*/
+
+extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
+/*
+  Close the current file in the zipfile
+*/
+
+extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
+                                            uLong uncompressed_size,
+                                            uLong crc32));
+
+extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
+                                            ZPOS64_T uncompressed_size,
+                                            uLong crc32));
+
+/*
+  Close the current file in the zipfile, for file opened with
+    parameter raw=1 in zipOpenNewFileInZip2
+  uncompressed_size and crc32 are value for the uncompressed size
+*/
+
+extern int ZEXPORT zipClose OF((zipFile file,
+                const char* global_comment));
+/*
+  Close the zipfile
+*/
+
+
+extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
+/*
+  zipRemoveExtraInfoBlock -  Added by Mathias Svensson
+
+  Remove extra information block from a extra information data for the local file header or central directory header
+
+  It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode.
+
+  0x0001 is the signature header for the ZIP64 extra information blocks
+
+  usage.
+                        Remove ZIP64 Extra information from a central director extra field data
+              zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
+
+                        Remove ZIP64 Extra information from a Local File Header extra field data
+        zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _zip64_H */

+ 24 - 12
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/project.pbxproj

@@ -72,13 +72,16 @@
 		3C69618323C7156D0075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617F23C7156D0075172A /* WebViewController.m */; };
 		3C69618423C7156D0075172A /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C69618023C7156D0075172A /* wkweb.storyboard */; };
 		3C7E5A8E237BDB0C006D0105 /* PortfolioListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7E5A8C237BDB0C006D0105 /* PortfolioListViewController.m */; };
+		3C87DB692A0E3B1D00B44F61 /* AAPLShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 3C87DB642A0E3B1D00B44F61 /* AAPLShaders.metal */; };
+		3C87DB6A2A0E3B1D00B44F61 /* SignatureViewM.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C87DB662A0E3B1D00B44F61 /* SignatureViewM.m */; };
+		3C87DB6B2A0E3B1D00B44F61 /* SViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C87DB682A0E3B1D00B44F61 /* SViewController.m */; };
+		3C87DB6F2A11C06400B44F61 /* SignatureRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C87DB6E2A11C06300B44F61 /* SignatureRenderer.m */; };
 		3CA6DDBE28E54B72003655FF /* ContrastModelItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA6DDBC28E54B72003655FF /* ContrastModelItemCell.m */; };
 		3CA6DDC428E575FB003655FF /* ModelItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA6DDC328E575FB003655FF /* ModelItemCell.m */; };
 		3CDDB25C273A564200681F78 /* DefaultTableHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB25A273A564200681F78 /* DefaultTableHeaderView.m */; };
 		3CDDB262273A59DF00681F78 /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB260273A59DF00681F78 /* TouchImageView.m */; };
 		3CDDB265273A59EF00681F78 /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB264273A59EF00681F78 /* RTLabel.m */; };
 		3CDDB268273A5A0400681F78 /* StrikethroughLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB267273A5A0400681F78 /* StrikethroughLabel.m */; };
-		3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */; };
 		3CDDB26E273A5A7800681F78 /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB26C273A5A7800681F78 /* RAUtils.m */; };
 		3CE660602874167100DDB14A /* OrderDiscountViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CE6605F2874167100DDB14A /* OrderDiscountViewController.m */; };
 		3CE660A8287FCD3B00DDB14A /* contactAdvanceSearch.json in Resources */ = {isa = PBXBuildFile; fileRef = 3CE660A7287FCD3A00DDB14A /* contactAdvanceSearch.json */; };
@@ -293,7 +296,6 @@
 		71DF74851C57608F00F2789C /* ImageUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74701C57608F00F2789C /* ImageUploadViewController.m */; };
 		71DF74861C57608F00F2789C /* ImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74721C57608F00F2789C /* ImageViewController.m */; };
 		71DF74871C57608F00F2789C /* NIDropDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74741C57608F00F2789C /* NIDropDown.m */; };
-		71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74761C57608F00F2789C /* PulldownMenu.m */; };
 		71DF74891C57608F00F2789C /* RadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74781C57608F00F2789C /* RadioButton.m */; };
 		71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF747C1C57608F00F2789C /* SimpleGrid.m */; };
 		71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74801C57608F00F2789C /* TouchLabel.m */; };
@@ -412,6 +414,14 @@
 		3C69618123C7156D0075172A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
 		3C7E5A8C237BDB0C006D0105 /* PortfolioListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListViewController.m; path = common/Functions/portfolio/PortfolioListViewController.m; sourceTree = SOURCE_ROOT; };
 		3C7E5A8D237BDB0C006D0105 /* PortfolioListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListViewController.h; path = common/Functions/portfolio/PortfolioListViewController.h; sourceTree = SOURCE_ROOT; };
+		3C87DB642A0E3B1D00B44F61 /* AAPLShaders.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; name = AAPLShaders.metal; path = common/Functions/signature/AAPLShaders.metal; sourceTree = SOURCE_ROOT; };
+		3C87DB652A0E3B1D00B44F61 /* SignatureViewM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SignatureViewM.h; path = common/Functions/signature/SignatureViewM.h; sourceTree = SOURCE_ROOT; };
+		3C87DB662A0E3B1D00B44F61 /* SignatureViewM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SignatureViewM.m; path = common/Functions/signature/SignatureViewM.m; sourceTree = SOURCE_ROOT; };
+		3C87DB672A0E3B1D00B44F61 /* SViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SViewController.h; path = common/Functions/signature/SViewController.h; sourceTree = SOURCE_ROOT; };
+		3C87DB682A0E3B1D00B44F61 /* SViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SViewController.m; path = common/Functions/signature/SViewController.m; sourceTree = SOURCE_ROOT; };
+		3C87DB6C2A0E3C2500B44F61 /* AAPLShaderTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AAPLShaderTypes.h; path = common/Functions/signature/AAPLShaderTypes.h; sourceTree = SOURCE_ROOT; };
+		3C87DB6D2A11C06300B44F61 /* SignatureRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SignatureRenderer.h; path = common/Functions/signature/SignatureRenderer.h; sourceTree = SOURCE_ROOT; };
+		3C87DB6E2A11C06300B44F61 /* SignatureRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SignatureRenderer.m; path = common/Functions/signature/SignatureRenderer.m; sourceTree = SOURCE_ROOT; };
 		3CA6DDBC28E54B72003655FF /* ContrastModelItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContrastModelItemCell.m; sourceTree = "<group>"; };
 		3CA6DDBD28E54B72003655FF /* ContrastModelItemCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContrastModelItemCell.h; sourceTree = "<group>"; };
 		3CA6DDC228E575FB003655FF /* ModelItemCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ModelItemCell.h; path = common/Functions/cart/ModelItemCell.h; sourceTree = SOURCE_ROOT; };
@@ -425,8 +435,6 @@
 		3CDDB264273A59EF00681F78 /* RTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RTLabel.m; path = ../../common/customUI/RTLabel.m; sourceTree = "<group>"; };
 		3CDDB266273A5A0400681F78 /* StrikethroughLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrikethroughLabel.h; path = ../../common/customUI/StrikethroughLabel.h; sourceTree = "<group>"; };
 		3CDDB267273A5A0400681F78 /* StrikethroughLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StrikethroughLabel.m; path = ../../common/customUI/StrikethroughLabel.m; sourceTree = "<group>"; };
-		3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomIOSAlertView.m; path = ../../common/customUI/CustomIOSAlertView.m; sourceTree = "<group>"; };
-		3CDDB26A273A5A1500681F78 /* CustomIOSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomIOSAlertView.h; path = ../../common/customUI/CustomIOSAlertView.h; sourceTree = "<group>"; };
 		3CDDB26C273A5A7800681F78 /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = ../../common/RAUtils.m; sourceTree = "<group>"; };
 		3CDDB26D273A5A7800681F78 /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = ../../common/RAUtils.h; sourceTree = "<group>"; };
 		3CE6605E2874167100DDB14A /* OrderDiscountViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OrderDiscountViewController.h; path = common/Functions/cart/OrderDiscountViewController.h; sourceTree = SOURCE_ROOT; };
@@ -808,8 +816,6 @@
 		71DF74721C57608F00F2789C /* ImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageViewController.m; path = common/customUI/ImageViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74731C57608F00F2789C /* NIDropDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIDropDown.h; path = common/customUI/NIDropDown.h; sourceTree = SOURCE_ROOT; };
 		71DF74741C57608F00F2789C /* NIDropDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIDropDown.m; path = common/customUI/NIDropDown.m; sourceTree = SOURCE_ROOT; };
-		71DF74751C57608F00F2789C /* PulldownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PulldownMenu.h; path = common/customUI/PulldownMenu.h; sourceTree = SOURCE_ROOT; };
-		71DF74761C57608F00F2789C /* PulldownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PulldownMenu.m; path = common/customUI/PulldownMenu.m; sourceTree = SOURCE_ROOT; };
 		71DF74771C57608F00F2789C /* RadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioButton.h; path = common/customUI/RadioButton.h; sourceTree = SOURCE_ROOT; };
 		71DF74781C57608F00F2789C /* RadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RadioButton.m; path = common/customUI/RadioButton.m; sourceTree = SOURCE_ROOT; };
 		71DF747B1C57608F00F2789C /* SimpleGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleGrid.h; path = common/customUI/SimpleGrid.h; sourceTree = SOURCE_ROOT; };
@@ -1130,6 +1136,14 @@
 		713393FE19936C980075BBAC /* Signature */ = {
 			isa = PBXGroup;
 			children = (
+				3C87DB642A0E3B1D00B44F61 /* AAPLShaders.metal */,
+				3C87DB6C2A0E3C2500B44F61 /* AAPLShaderTypes.h */,
+				3C87DB652A0E3B1D00B44F61 /* SignatureViewM.h */,
+				3C87DB662A0E3B1D00B44F61 /* SignatureViewM.m */,
+				3C87DB672A0E3B1D00B44F61 /* SViewController.h */,
+				3C87DB682A0E3B1D00B44F61 /* SViewController.m */,
+				3C87DB6D2A11C06300B44F61 /* SignatureRenderer.h */,
+				3C87DB6E2A11C06300B44F61 /* SignatureRenderer.m */,
 				71D01ADC1E08CB1C006620CE /* signature.storyboard */,
 				7162A5C61C58761500AB630E /* SignatureView.h */,
 				7162A5C71C58761500AB630E /* SignatureView.m */,
@@ -1553,8 +1567,6 @@
 		718600B31936C385004B6CDE /* customUI */ = {
 			isa = PBXGroup;
 			children = (
-				3CDDB26A273A5A1500681F78 /* CustomIOSAlertView.h */,
-				3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */,
 				71DF746B1C57608F00F2789C /* ImageScrollerView.h */,
 				71DF746C1C57608F00F2789C /* ImageScrollerView.m */,
 				71DF746D1C57608F00F2789C /* ImageScrollerViewController.h */,
@@ -1565,8 +1577,6 @@
 				71DF74721C57608F00F2789C /* ImageViewController.m */,
 				71DF74731C57608F00F2789C /* NIDropDown.h */,
 				71DF74741C57608F00F2789C /* NIDropDown.m */,
-				71DF74751C57608F00F2789C /* PulldownMenu.h */,
-				71DF74761C57608F00F2789C /* PulldownMenu.m */,
 				71DF74771C57608F00F2789C /* RadioButton.h */,
 				71DF74781C57608F00F2789C /* RadioButton.m */,
 				71DF747B1C57608F00F2789C /* SimpleGrid.h */,
@@ -2018,6 +2028,7 @@
 				71BF07081D2F3D2800981938 /* SyncControlPanelViewController.m in Sources */,
 				4289802D1E2492D2005F1BD8 /* PriceSettingViewController.m in Sources */,
 				714036F921646B8C0029B10F /* AppDelegateBase.m in Sources */,
+				3C87DB6F2A11C06400B44F61 /* SignatureRenderer.m in Sources */,
 				71FFBBEA1C60894900D91DC2 /* RANetwork.m in Sources */,
 				428980161E24924D005F1BD8 /* SortItemCell.m in Sources */,
 				3C51495C273D099600F78617 /* EnumSelectorCell.m in Sources */,
@@ -2078,7 +2089,6 @@
 				712AFED71DBA050200254965 /* BasicDrawable.m in Sources */,
 				3C51494E273D095900F78617 /* CommonEditorCellImg.m in Sources */,
 				71DF74891C57608F00F2789C /* RadioButton.m in Sources */,
-				3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */,
 				7162A5DF1C5876E300AB630E /* ScannerSettingViewController.m in Sources */,
 				3C23B3FC29D4202A008E7C14 /* RAPopviewContainer.m in Sources */,
 				71DF74831C57608F00F2789C /* ImageScrollerView.m in Sources */,
@@ -2086,7 +2096,6 @@
 				710274251CC606C4009FD219 /* UserListViewController.m in Sources */,
 				3CDDB265273A59EF00681F78 /* RTLabel.m in Sources */,
 				3C51494D273D095900F78617 /* CommonEditorCellSignature.m in Sources */,
-				71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */,
 				7141DD551C57459B00F7DF59 /* split.c in Sources */,
 				716AF8E11D7AA0E0001188E0 /* SelectUploadOrderViewController.m in Sources */,
 				712AFEDF1DBA050200254965 /* TextDrawable.m in Sources */,
@@ -2106,6 +2115,7 @@
 				7186C25D1C97A6EE00CB43F4 /* FunctionTestViewController.m in Sources */,
 				71C1D84E1F456CAA00CEA1C9 /* HWWeakTimer.m in Sources */,
 				3C514948273D095900F78617 /* CommonEditorCellTextView.m in Sources */,
+				3C87DB6A2A0E3B1D00B44F61 /* SignatureViewM.m in Sources */,
 				71D0344F1C9BF3C400E0F7AD /* PortfolioEditQTYViewController.m in Sources */,
 				7162A5B51C58738600AB630E /* ScannerViewController.m in Sources */,
 				3C51492F273CF9B900F78617 /* DBUtil.m in Sources */,
@@ -2124,6 +2134,7 @@
 				3C51497F273E07D600F78617 /* EnumSelectAndSortCell.m in Sources */,
 				71D30A2D1CFC0EF8006F9477 /* DefaultImageButton.m in Sources */,
 				7162A5841C5872EF00AB630E /* HomeTableViewCellTopic.m in Sources */,
+				3C87DB6B2A0E3B1D00B44F61 /* SViewController.m in Sources */,
 				7162A59F1C58733400AB630E /* OrderListViewController.m in Sources */,
 				4254CCDE1FB1AC2B00C8B4B6 /* RAOrderEditorViewController.m in Sources */,
 				712AFEE21DBA077F00254965 /* pdfCreator.m in Sources */,
@@ -2186,6 +2197,7 @@
 				4289802C1E2492D2005F1BD8 /* CategoryPriceViewController.m in Sources */,
 				71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */,
 				3C68314E239607B500AD5BD7 /* RAYTPlayer.m in Sources */,
+				3C87DB692A0E3B1D00B44F61 /* AAPLShaders.metal in Sources */,
 				3C514932273D092A00F78617 /* EnumSelectViewController.m in Sources */,
 				3C3300BA29431141005CFE7C /* CommonScannerSettingViewController.m in Sources */,
 				428980171E24924D005F1BD8 /* SortItemViewController.m in Sources */,

+ 1 - 1
RedAnt ERP Mobile/iSales-CONTRAST/ContrastModelItemCell.m

@@ -235,7 +235,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [vc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);

+ 85 - 85
RedAnt ERP Mobile/iSales-CONTRAST/config.h

@@ -58,138 +58,138 @@
 #ifdef test_server
 
 //------------------- chen server-----------------------
-#define  URL_BACK_ORDER_PREVIEW  @"http://192.168.0.161:8083/pjHmlg2//isales/cartDeliveryBackOrderReview.htm"
-#define  URL_MOVE_TO_BACK_ORDER @"http://192.168.0.161:8083/pjHmlg2//isales/moveToBackOrder.htm"
+#define  URL_BACK_ORDER_PREVIEW  @"http://192.168.0.142:8093/pjHmlg//isales/cartDeliveryBackOrderReview.htm"
+#define  URL_MOVE_TO_BACK_ORDER @"http://192.168.0.142:8093/pjHmlg//isales/moveToBackOrder.htm"
 #define URL_PRIVACY @"https://uwa.united-us.net/site/isales_uwa/privacyPolicy.htm"
 
-#define  URL_UPDATE_AUTH  @"http://192.168.0.161:8083/pjHmlg2//isales/login.htm"
-#define  URL_LOGOUT  @"http://192.168.0.161:8083/pjHmlg2//isales/loginOut.htm"
-#define  URL_RETRIEVE_PASS  @"http://192.168.0.161:8083/pjHmlg2//isales/forgotPassword.htm"
+#define  URL_UPDATE_AUTH  @"http://192.168.0.142:8093/pjHmlg//isales/login.htm"
+#define  URL_LOGOUT  @"http://192.168.0.142:8093/pjHmlg//isales/loginOut.htm"
+#define  URL_RETRIEVE_PASS  @"http://192.168.0.142:8093/pjHmlg//isales/forgotPassword.htm"
 
-#define  URL_REQUEST_CATMENU  @"http://192.168.0.161:8083/pjHmlg2//isales/menu.htm"
-#define  URL_LOAD_HOME  @"http://192.168.0.161:8083/pjHmlg2//isales/homePage.htm"
-#define  URL_CATEGORY @"http://192.168.0.161:8083/pjHmlg2//isales/distinctCategory.htm"
-#define  URL_SEARCH  @"http://192.168.0.161:8083/pjHmlg2//isales/search.htm"
-#define  URL_ITEM_SEARCH  @"http://192.168.0.161:8083/pjHmlg2//isales/itemSearch.htm"
-#define  URL_CATEGORY_LOADMORE  @"http://192.168.0.161:8083/pjHmlg2//isales/categoryMore.htm"
-#define  URL_CUSTOMER_ADV_SEARCH @"http://192.168.0.161:8083/pjHmlg2//isales/getContactAdvance.htm"
+#define  URL_REQUEST_CATMENU  @"http://192.168.0.142:8093/pjHmlg//isales/menu.htm"
+#define  URL_LOAD_HOME  @"http://192.168.0.142:8093/pjHmlg//isales/homePage.htm"
+#define  URL_CATEGORY @"http://192.168.0.142:8093/pjHmlg//isales/distinctCategory.htm"
+#define  URL_SEARCH  @"http://192.168.0.142:8093/pjHmlg//isales/search.htm"
+#define  URL_ITEM_SEARCH  @"http://192.168.0.142:8093/pjHmlg//isales/itemSearch.htm"
+#define  URL_CATEGORY_LOADMORE  @"http://192.168.0.142:8093/pjHmlg//isales/categoryMore.htm"
+#define  URL_CUSTOMER_ADV_SEARCH @"http://192.168.0.142:8093/pjHmlg//isales/getContactAdvance.htm"
 
 
-#define  URL_ORDER_LIST  @"http://192.168.0.161:8083/pjHmlg2//isales/orderList.htm"
-#define  URL_ORDER_DETAIL  @"http://192.168.0.161:8083/pjHmlg2//isales/orderDetail.htm"
-#define URL_COMMIT_ORDER @"http://192.168.0.161:8083/pjHmlg2//isales/createOrder.htm"
-#define URL_COPY_ORDER @"http://192.168.0.161:8083/pjHmlg2//isales/copyOrder.htm"
-#define URL_SIGN_ORDER @"http://192.168.0.161:8083/pjHmlg2//isales/updateOrderSign.htm"
-#define URL_SAVE_ORDER @"http://192.168.0.161:8083/pjHmlg2//isales/saveOrder.htm"
-#define URL_UPDATE_ORDERCUSTOMER @"http://192.168.0.161:8083/pjHmlg2//isales/updateOrderCustomerInfo.htm"
-#define  URL_NEW_ORDER  @"http://192.168.0.161:8083/pjHmlg2//isales/createNewOrder.htm"
-#define  URL_OPEN_ORDER  @"http://192.168.0.161:8083/pjHmlg2//isales/openOrder.htm"
-#define  URL_RELEASE_ORDER  @"http://192.168.0.161:8083/pjHmlg2//isales/closeOrder.htm"
-#define  URL_DELETE_ORDER  @"http://192.168.0.161:8083/pjHmlg2//isales/deleteOrder.htm"
-#define  URL_CANCEL_ORDER  @"http://192.168.0.161:8083/pjHmlg2//isales/cancelOrder.htm"
+#define  URL_ORDER_LIST  @"http://192.168.0.142:8093/pjHmlg//isales/orderList.htm"
+#define  URL_ORDER_DETAIL  @"http://192.168.0.142:8093/pjHmlg//isales/orderDetail.htm"
+#define URL_COMMIT_ORDER @"http://192.168.0.142:8093/pjHmlg//isales/createOrder.htm"
+#define URL_COPY_ORDER @"http://192.168.0.142:8093/pjHmlg//isales/copyOrder.htm"
+#define URL_SIGN_ORDER @"http://192.168.0.142:8093/pjHmlg//isales/updateOrderSign.htm"
+#define URL_SAVE_ORDER @"http://192.168.0.142:8093/pjHmlg//isales/saveOrder.htm"
+#define URL_UPDATE_ORDERCUSTOMER @"http://192.168.0.142:8093/pjHmlg//isales/updateOrderCustomerInfo.htm"
+#define  URL_NEW_ORDER  @"http://192.168.0.142:8093/pjHmlg//isales/createNewOrder.htm"
+#define  URL_OPEN_ORDER  @"http://192.168.0.142:8093/pjHmlg//isales/openOrder.htm"
+#define  URL_RELEASE_ORDER  @"http://192.168.0.142:8093/pjHmlg//isales/closeOrder.htm"
+#define  URL_DELETE_ORDER  @"http://192.168.0.142:8093/pjHmlg//isales/deleteOrder.htm"
+#define  URL_CANCEL_ORDER  @"http://192.168.0.142:8093/pjHmlg//isales/cancelOrder.htm"
 
 
-#define  URL_CART_SET_PRICE  @"http://192.168.0.161:8083/pjHmlg2//isales/setPrice.htm"
-#define  URL_CART_ITEM_NOTES  @"http://192.168.0.161:8083/pjHmlg2//isales/setItemNotes.htm"
-#define  URL_CART_GENERAL_NOTES  @"http://192.168.0.161:8083/pjHmlg2//isales/updateGeneralNote.htm"
+#define  URL_CART_SET_PRICE  @"http://192.168.0.142:8093/pjHmlg//isales/setPrice.htm"
+#define  URL_CART_ITEM_NOTES  @"http://192.168.0.142:8093/pjHmlg//isales/setItemNotes.htm"
+#define  URL_CART_GENERAL_NOTES  @"http://192.168.0.142:8093/pjHmlg//isales/updateGeneralNote.htm"
 
-#define  URL_CART_INCRESEMENT  @"http://192.168.0.161:8083/pjHmlg2//isales/increment.htm"
-#define  URL_CART  @"http://192.168.0.161:8083/pjHmlg2//isales/cartDtail.htm"
-#define  URL_CARTDELIVERY  @"http://192.168.0.161:8083/pjHmlg2//isales/cartDelivery.htm"
-#define  URL_ADD_TO_CART  @"http://192.168.0.161:8083/pjHmlg2//isales/addToCart.htm"
-#define  URL_CART_REMOVE  @"http://192.168.0.161:8083/pjHmlg2//isales/deleteToCart.htm"
-#define  URL_CART_CHECK  @"http://192.168.0.161:8083/pjHmlg2//isales/checkCartItem.htm"
-#define  URL_CART2WISH  @"http://192.168.0.161:8083/pjHmlg2//isales/cartRemoveToWishlist.htm"
-#define  URL_WISH2CART  @"http://192.168.0.161:8083/pjHmlg2//isales/wishlistRemoveToCart.htm"
+#define  URL_CART_INCRESEMENT  @"http://192.168.0.142:8093/pjHmlg//isales/increment.htm"
+#define  URL_CART  @"http://192.168.0.142:8093/pjHmlg//isales/cartDtail.htm"
+#define  URL_CARTDELIVERY  @"http://192.168.0.142:8093/pjHmlg//isales/cartDelivery.htm"
+#define  URL_ADD_TO_CART  @"http://192.168.0.142:8093/pjHmlg//isales/addToCart.htm"
+#define  URL_CART_REMOVE  @"http://192.168.0.142:8093/pjHmlg//isales/deleteToCart.htm"
+#define  URL_CART_CHECK  @"http://192.168.0.142:8093/pjHmlg//isales/checkCartItem.htm"
+#define  URL_CART2WISH  @"http://192.168.0.142:8093/pjHmlg//isales/cartRemoveToWishlist.htm"
+#define  URL_WISH2CART  @"http://192.168.0.142:8093/pjHmlg//isales/wishlistRemoveToCart.htm"
 
 
 
 
-#define  URL_CATEGORYADDALL  @"http://192.168.0.161:8083/pjHmlg2//isales/categoryAddAllTo.htm"
-#define  URL_SEARCHADDALL  @"http://192.168.0.161:8083/pjHmlg2//isales/searchAddAllTo.htm"
-#define  URL_ITEMSEARCHADDALL @"http://192.168.0.161:8083/pjHmlg2//isales/itemSearchAddAllTo.htm"
+#define  URL_CATEGORYADDALL  @"http://192.168.0.142:8093/pjHmlg//isales/categoryAddAllTo.htm"
+#define  URL_SEARCHADDALL  @"http://192.168.0.142:8093/pjHmlg//isales/searchAddAllTo.htm"
+#define  URL_ITEMSEARCHADDALL @"http://192.168.0.142:8093/pjHmlg//isales/itemSearchAddAllTo.htm"
 
 
-#define  URL_ITEM_DETAIL  @"http://192.168.0.161:8083/pjHmlg2//isales/modelDetail.htm"
+#define  URL_ITEM_DETAIL  @"http://192.168.0.142:8093/pjHmlg//isales/modelDetail.htm"
 
-#define  URL_ADD_TO_WATCHLIST  @"http://192.168.0.161:8083/pjHmlg2//isales/addToWishList.htm"
-#define  URL_WATCHLIST  @"http://192.168.0.161:8083/pjHmlg2//isales/wishList.htm"
-#define  URL_WATCHLIST_REMOVE  @"http://192.168.0.161:8083/pjHmlg2//isales/deleteToWishList.htm"
+#define  URL_ADD_TO_WATCHLIST  @"http://192.168.0.142:8093/pjHmlg//isales/addToWishList.htm"
+#define  URL_WATCHLIST  @"http://192.168.0.142:8093/pjHmlg//isales/wishList.htm"
+#define  URL_WATCHLIST_REMOVE  @"http://192.168.0.142:8093/pjHmlg//isales/deleteToWishList.htm"
 
 
 
-#define  URL_ADD_TO_PORTFOLIO @"http://192.168.0.161:8083/pjHmlg2//isales/addToPortfolio.htm"
-#define  URL_PORTFOLIO_REMOVE  @"http://192.168.0.161:8083/pjHmlg2//isales/deleteToPortfolio.htm"
-#define  URL_PORTFOLIOLIST_REMOVE  @"http://192.168.0.161:8083/pjHmlg2//isales/deleteTearSheetPdf.htm"
-#define  URL_PORTFOLIO  @"http://192.168.0.161:8083/pjHmlg2//isales/portfolios.htm"
-#define  URL_PORTFOLIO_SET_PRICE  @"http://192.168.0.161:8083/pjHmlg2//isales/setTearSheetPrice.htm"
-#define  URL_DM_PARAMS @"http://192.168.0.161:8083/pjHmlg2//isales/selectTearSheetParam.htm"
-#define  URL_REQUEST_DM @"http://192.168.0.161:8083/pjHmlg2//isales/getTearSheetPdf.htm"
-#define  URL_SAVE_DM_DIRECT @"http://192.168.0.161:8083/pjHmlg2//isales/getTearSheetPdf.htm"
-#define  URL_SAVE_DM @"http://192.168.0.161:8083/pjHmlg2//isales/saveTearSheetPdf.htm"
-#define  URL_DM_LIST @"http://192.168.0.161:8083/pjHmlg2//isales/tearSheetPdfList.htm"
-//#define  URL_DM_SET_QTY @"http://192.168.0.161:8083/pjHmlg2//isales/setTearSheetAvailableQty.htm"
-#define  URL_REQUEST_MODEL_QTY @"http://192.168.0.161:8083/pjHmlg2//isales/getTearSheetAvailableQty.htm"
+#define  URL_ADD_TO_PORTFOLIO @"http://192.168.0.142:8093/pjHmlg//isales/addToPortfolio.htm"
+#define  URL_PORTFOLIO_REMOVE  @"http://192.168.0.142:8093/pjHmlg//isales/deleteToPortfolio.htm"
+#define  URL_PORTFOLIOLIST_REMOVE  @"http://192.168.0.142:8093/pjHmlg//isales/deleteTearSheetPdf.htm"
+#define  URL_PORTFOLIO  @"http://192.168.0.142:8093/pjHmlg//isales/portfolios.htm"
+#define  URL_PORTFOLIO_SET_PRICE  @"http://192.168.0.142:8093/pjHmlg//isales/setTearSheetPrice.htm"
+#define  URL_DM_PARAMS @"http://192.168.0.142:8093/pjHmlg//isales/selectTearSheetParam.htm"
+#define  URL_REQUEST_DM @"http://192.168.0.142:8093/pjHmlg//isales/getTearSheetPdf.htm"
+#define  URL_SAVE_DM_DIRECT @"http://192.168.0.142:8093/pjHmlg//isales/getTearSheetPdf.htm"
+#define  URL_SAVE_DM @"http://192.168.0.142:8093/pjHmlg//isales/saveTearSheetPdf.htm"
+#define  URL_DM_LIST @"http://192.168.0.142:8093/pjHmlg//isales/tearSheetPdfList.htm"
+//#define  URL_DM_SET_QTY @"http://192.168.0.142:8093/pjHmlg//isales/setTearSheetAvailableQty.htm"
+#define  URL_REQUEST_MODEL_QTY @"http://192.168.0.142:8093/pjHmlg//isales/getTearSheetAvailableQty.htm"
 
-#define  URL_CONTACT_LIST  @"http://192.168.0.161:8083/pjHmlg2//isales/getAllContact.htm"
-#define  URL_SHIPTO_LIST  @"http://192.168.0.161:8083/pjHmlg2//isales/getShipToContact.htm"
+#define  URL_CONTACT_LIST  @"http://192.168.0.142:8093/pjHmlg//isales/getAllContact.htm"
+#define  URL_SHIPTO_LIST  @"http://192.168.0.142:8093/pjHmlg//isales/getShipToContact.htm"
 
-#define  URL_ADDRESS_EDOTOR  @"http://192.168.0.161:8083/pjHmlg2//isales/getAddAddress.htm"
-#define  URL_ADDRESS_SAVE  @"http://192.168.0.161:8083/pjHmlg2//isales/saveAddress.htm"
+#define  URL_ADDRESS_EDOTOR  @"http://192.168.0.142:8093/pjHmlg//isales/getAddAddress.htm"
+#define  URL_ADDRESS_SAVE  @"http://192.168.0.142:8093/pjHmlg//isales/saveAddress.htm"
 
 
-#define  URL_CREDITCARD_EDOTOR  @"http://192.168.0.161:8083/pjHmlg2//isales/creditCard.htm"
-#define  URL_CREDITCARD_SAVE  @"http://192.168.0.161:8083/pjHmlg2//isales/saveAddress.htm"
+#define  URL_CREDITCARD_EDOTOR  @"http://192.168.0.142:8093/pjHmlg//isales/creditCard.htm"
+#define  URL_CREDITCARD_SAVE  @"http://192.168.0.142:8093/pjHmlg//isales/saveAddress.htm"
 
 
 
-#define  URL_CUSTOMER_INFO  @"http://192.168.0.161:8083/pjHmlg2//isales/getCustomerInfoByContact.htm"
-#define  URL_CUSTOMER_PENDINGORDER  @"http://192.168.0.161:8083/pjHmlg2//isales/hasPendingOrderByContact.htm"
-#define  URL_NEW_CUSTOMER  @"http://192.168.0.161:8083/pjHmlg2//isales/getAddCustomer.htm"
-#define  URL_EDIT_CUSTOMER  @"http://192.168.0.161:8083/pjHmlg2//isales/getUpdateCustomerInfoByContact.htm"
-#define  URL_CUSTOMER_SAVE  @"http://192.168.0.161:8083/pjHmlg2//isales/saveCustomer.htm"
-#define  URL_CUSTOMER_UPDATE  @"http://192.168.0.161:8083/pjHmlg2//isales/updateCustomer.htm"
-#define  URL_UPDATE_CUSTOMER_BCARD  @"http://192.168.0.161:8083/pjHmlg2//isales/updateCustomerBusiCard.htm"
+#define  URL_CUSTOMER_INFO  @"http://192.168.0.142:8093/pjHmlg//isales/getCustomerInfoByContact.htm"
+#define  URL_CUSTOMER_PENDINGORDER  @"http://192.168.0.142:8093/pjHmlg//isales/hasPendingOrderByContact.htm"
+#define  URL_NEW_CUSTOMER  @"http://192.168.0.142:8093/pjHmlg//isales/getAddCustomer.htm"
+#define  URL_EDIT_CUSTOMER  @"http://192.168.0.142:8093/pjHmlg//isales/getUpdateCustomerInfoByContact.htm"
+#define  URL_CUSTOMER_SAVE  @"http://192.168.0.142:8093/pjHmlg//isales/saveCustomer.htm"
+#define  URL_CUSTOMER_UPDATE  @"http://192.168.0.142:8093/pjHmlg//isales/updateCustomer.htm"
+#define  URL_UPDATE_CUSTOMER_BCARD  @"http://192.168.0.142:8093/pjHmlg//isales/updateCustomerBusiCard.htm"
 
 #define URL_CHANGE_PASSWORD @""
 #define URL_SIGN_UP @""
 
-//#define  URL_ORDER_DISCOUNT  @"http://192.168.0.161:8083/pjHmlg2//isales/setOrderItemDiscount.htm"
-#define  URL_ORDER_DISCOUNT  @"http://192.168.0.161:8083/pjHmlg2//isales/setOrderDiscount.htm"
+//#define  URL_ORDER_DISCOUNT  @"http://192.168.0.142:8093/pjHmlg//isales/setOrderItemDiscount.htm"
+#define  URL_ORDER_DISCOUNT  @"http://192.168.0.142:8093/pjHmlg//isales/setOrderDiscount.htm"
 
-#define  URL_ERR_LOG  @"http://192.168.0.161:8083/pjHmlg2//isales/er_log.htm"
+#define  URL_ERR_LOG  @"http://192.168.0.142:8093/pjHmlg//isales/er_log.htm"
 
-#define  URL_UPLOAD_IMG  @"http://192.168.0.161:8083/pjHmlg2//isales/uploadImg.htm"
+#define  URL_UPLOAD_IMG  @"http://192.168.0.142:8093/pjHmlg//isales/uploadImg.htm"
 
 
-#define  URL_NPD_POLICY  @"http://192.168.0.161:8083/pjHmlg2//isales/generalPolicy.htm"
+#define  URL_NPD_POLICY  @"http://192.168.0.142:8093/pjHmlg//isales/generalPolicy.htm"
 
 
-#define  URL_CHECK_OFFLINE  @"http://192.168.0.161:8083/pjHmlg2//offline/initDatas.htm"
-#define  URL_UPLOAD_OFFLINE  @"http://192.168.0.161:8083/pjHmlg2//offline/uploadOfflineData.htm"
+#define  URL_CHECK_OFFLINE  @"http://192.168.0.142:8093/pjHmlg//offline/initDatas.htm"
+#define  URL_UPLOAD_OFFLINE  @"http://192.168.0.142:8093/pjHmlg//offline/uploadOfflineData.htm"
 
 
-#define  URL_DOWNLOAD_OFFLINE  @"http://192.168.0.161:8083/pjHmlg2//offline/downloadDatas.htm"
-#define  URL_FINISH_DOWNLOAD_OFFLINE  @"http://192.168.0.161:8083/pjHmlg2//offline/confirmVersion.htm"
+#define  URL_DOWNLOAD_OFFLINE  @"http://192.168.0.142:8093/pjHmlg//offline/downloadDatas.htm"
+#define  URL_FINISH_DOWNLOAD_OFFLINE  @"http://192.168.0.142:8093/pjHmlg//offline/confirmVersion.htm"
 
 
-#define  URL_GET_RESULT  @"http://192.168.0.161:8083/pjHmlg2//offline/getResultBySerial.htm"
+#define  URL_GET_RESULT  @"http://192.168.0.142:8093/pjHmlg//offline/getResultBySerial.htm"
 
-#define URL_SET_PRICE_TYPE @"http://192.168.0.161:8083/pjHmlg2//isales/setSeePriceType.htm"
+#define URL_SET_PRICE_TYPE @"http://192.168.0.142:8093/pjHmlg//isales/setSeePriceType.htm"
 
-#define URL_GET_CIVEN_PRICE @"http://192.168.0.161:8083/pjHmlg2//isales/getSeeGivenPrice.htm"
+#define URL_GET_CIVEN_PRICE @"http://192.168.0.142:8093/pjHmlg//isales/getSeeGivenPrice.htm"
 
-#define URL_SET_GIVEN_PRICE @"http://192.168.0.161:8083/pjHmlg2//isales/setSeeGivenPrice.htm"
+#define URL_SET_GIVEN_PRICE @"http://192.168.0.142:8093/pjHmlg//isales/setSeeGivenPrice.htm"
 
-#define URL_SET_MERGE_ORDER @"http://192.168.0.161:8083/pjHmlg2//isales/mergeOrder.htm"
+#define URL_SET_MERGE_ORDER @"http://192.168.0.142:8093/pjHmlg//isales/mergeOrder.htm"
 
-#define URL_REQUEST_LOGIN @"http://192.168.0.161:8083/pjHmlg2//isales/requestLogin.htm"
+#define URL_REQUEST_LOGIN @"http://192.168.0.142:8093/pjHmlg//isales/requestLogin.htm"
 
-#define URL_EMAIL_CART @"http://192.168.0.161:8083/pjHmlg2//isales/sendCartEmail.htm"
+#define URL_EMAIL_CART @"http://192.168.0.142:8093/pjHmlg//isales/sendCartEmail.htm"
 
-#define URL_NOTIFY_ME @"http://192.168.0.161:8083/pjHmlg2//isales/notifyMeEmail.htm"
+#define URL_NOTIFY_ME @"http://192.168.0.142:8093/pjHmlg//isales/notifyMeEmail.htm"
 
-#define URL_EMAIL_WISHLIST @"http://192.168.0.161:8083/pjHmlg2//isales/sendWishListEmail.htm"
+#define URL_EMAIL_WISHLIST @"http://192.168.0.142:8093/pjHmlg//isales/sendWishListEmail.htm"
 
 #define URL_BLOG @"http://12.196.120.217/blog"
 #define  URL_DELETE_ACCOUNT @""

+ 2 - 14
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -43,7 +43,6 @@
 		3CA210B12761DAAC000FC2F3 /* RASingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210AF2761DAAB000FC2F3 /* RASingleton.m */; };
 		3CA210B42761DAF2000FC2F3 /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210B32761DAF2000FC2F3 /* RAUtils.m */; };
 		3CA210BD2761DB42000FC2F3 /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210B52761DB42000FC2F3 /* TouchImageView.m */; };
-		3CA210BE2761DB42000FC2F3 /* CustomIOSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210B62761DB42000FC2F3 /* CustomIOSAlertView.m */; };
 		3CA210BF2761DB42000FC2F3 /* StrikethroughLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210B92761DB42000FC2F3 /* StrikethroughLabel.m */; };
 		3CA210C02761DB42000FC2F3 /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210BB2761DB42000FC2F3 /* RTLabel.m */; };
 		3CA210C92761DBC2000FC2F3 /* EnumModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CA210C22761DBC2000FC2F3 /* EnumModel.m */; };
@@ -287,7 +286,6 @@
 		71DF74851C57608F00F2789C /* ImageUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74701C57608F00F2789C /* ImageUploadViewController.m */; };
 		71DF74861C57608F00F2789C /* ImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74721C57608F00F2789C /* ImageViewController.m */; };
 		71DF74871C57608F00F2789C /* NIDropDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74741C57608F00F2789C /* NIDropDown.m */; };
-		71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74761C57608F00F2789C /* PulldownMenu.m */; };
 		71DF74891C57608F00F2789C /* RadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74781C57608F00F2789C /* RadioButton.m */; };
 		71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF747C1C57608F00F2789C /* SimpleGrid.m */; };
 		71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74801C57608F00F2789C /* TouchLabel.m */; };
@@ -353,8 +351,6 @@
 		3CA210B22761DAF2000FC2F3 /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = ../../common/RAUtils.h; sourceTree = "<group>"; };
 		3CA210B32761DAF2000FC2F3 /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = ../../common/RAUtils.m; sourceTree = "<group>"; };
 		3CA210B52761DB42000FC2F3 /* TouchImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TouchImageView.m; path = ../../common/customUI/TouchImageView.m; sourceTree = "<group>"; };
-		3CA210B62761DB42000FC2F3 /* CustomIOSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomIOSAlertView.m; path = ../../common/customUI/CustomIOSAlertView.m; sourceTree = "<group>"; };
-		3CA210B72761DB42000FC2F3 /* CustomIOSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomIOSAlertView.h; path = ../../common/customUI/CustomIOSAlertView.h; sourceTree = "<group>"; };
 		3CA210B82761DB42000FC2F3 /* StrikethroughLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrikethroughLabel.h; path = ../../common/customUI/StrikethroughLabel.h; sourceTree = "<group>"; };
 		3CA210B92761DB42000FC2F3 /* StrikethroughLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StrikethroughLabel.m; path = ../../common/customUI/StrikethroughLabel.m; sourceTree = "<group>"; };
 		3CA210BA2761DB42000FC2F3 /* TouchImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TouchImageView.h; path = ../../common/customUI/TouchImageView.h; sourceTree = "<group>"; };
@@ -794,8 +790,6 @@
 		71DF74721C57608F00F2789C /* ImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageViewController.m; path = common/customUI/ImageViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74731C57608F00F2789C /* NIDropDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIDropDown.h; path = common/customUI/NIDropDown.h; sourceTree = SOURCE_ROOT; };
 		71DF74741C57608F00F2789C /* NIDropDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIDropDown.m; path = common/customUI/NIDropDown.m; sourceTree = SOURCE_ROOT; };
-		71DF74751C57608F00F2789C /* PulldownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PulldownMenu.h; path = common/customUI/PulldownMenu.h; sourceTree = SOURCE_ROOT; };
-		71DF74761C57608F00F2789C /* PulldownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PulldownMenu.m; path = common/customUI/PulldownMenu.m; sourceTree = SOURCE_ROOT; };
 		71DF74771C57608F00F2789C /* RadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioButton.h; path = common/customUI/RadioButton.h; sourceTree = SOURCE_ROOT; };
 		71DF74781C57608F00F2789C /* RadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RadioButton.m; path = common/customUI/RadioButton.m; sourceTree = SOURCE_ROOT; };
 		71DF747B1C57608F00F2789C /* SimpleGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleGrid.h; path = common/customUI/SimpleGrid.h; sourceTree = SOURCE_ROOT; };
@@ -1525,16 +1519,12 @@
 				71DF74721C57608F00F2789C /* ImageViewController.m */,
 				71DF74731C57608F00F2789C /* NIDropDown.h */,
 				71DF74741C57608F00F2789C /* NIDropDown.m */,
-				71DF74751C57608F00F2789C /* PulldownMenu.h */,
-				71DF74761C57608F00F2789C /* PulldownMenu.m */,
 				71DF74771C57608F00F2789C /* RadioButton.h */,
 				71DF74781C57608F00F2789C /* RadioButton.m */,
 				71DF747B1C57608F00F2789C /* SimpleGrid.h */,
 				71DF747C1C57608F00F2789C /* SimpleGrid.m */,
 				3CA210BC2761DB42000FC2F3 /* RTLabel.h */,
 				3CA210BB2761DB42000FC2F3 /* RTLabel.m */,
-				3CA210B72761DB42000FC2F3 /* CustomIOSAlertView.h */,
-				3CA210B62761DB42000FC2F3 /* CustomIOSAlertView.m */,
 				3CA210B82761DB42000FC2F3 /* StrikethroughLabel.h */,
 				3CA210B92761DB42000FC2F3 /* StrikethroughLabel.m */,
 				3CA210BA2761DB42000FC2F3 /* TouchImageView.h */,
@@ -1997,7 +1987,6 @@
 				715001FF1D114D9100F5927F /* BundleDetailButton.m in Sources */,
 				3CA210C02761DB42000FC2F3 /* RTLabel.m in Sources */,
 				7162A5421C58719D00AB630E /* RATreeNodeCollectionController.m in Sources */,
-				3CA210BE2761DB42000FC2F3 /* CustomIOSAlertView.m in Sources */,
 				7162A5DE1C5876E300AB630E /* RetrievePassViewController.m in Sources */,
 				428980461E249339005F1BD8 /* JKLockButton.m in Sources */,
 				71C1D8541F456D2700CEA1C9 /* ModelDescriptionController.m in Sources */,
@@ -2033,7 +2022,6 @@
 				71DF74871C57608F00F2789C /* NIDropDown.m in Sources */,
 				3CA210FF2761DC95000FC2F3 /* DatePickerViewController.m in Sources */,
 				710274251CC606C4009FD219 /* UserListViewController.m in Sources */,
-				71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */,
 				7141DD551C57459B00F7DF59 /* split.c in Sources */,
 				716AF8E11D7AA0E0001188E0 /* SelectUploadOrderViewController.m in Sources */,
 				712AFEDF1DBA050200254965 /* TextDrawable.m in Sources */,
@@ -2348,7 +2336,7 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "iSales-NPD/iSales-NPD-Prefix.pch";
 				INFOPLIST_FILE = "$(SRCROOT)/iSales-NPD/iSales-NPD-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LIBRARY_SEARCH_PATHS = (
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",
@@ -2392,7 +2380,7 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "iSales-NPD/iSales-NPD-Prefix.pch";
 				INFOPLIST_FILE = "$(SRCROOT)/iSales-NPD/iSales-NPD-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LIBRARY_SEARCH_PATHS = (
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",

+ 12 - 3
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="jsC-F8-zYF">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="jsC-F8-zYF">
     <device id="ipad7_9" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
         <deployment version="4352" identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -1247,6 +1247,15 @@
                                     <action selector="OnPrintParamsClick:" destination="kPm-vh-Xir" eventType="touchUpInside" id="5NP-He-9AA"/>
                                 </connections>
                             </button>
+                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="es7-3g-P9E">
+                                <rect key="frame" x="106" y="444" width="97" height="35"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <state key="normal" title="Button"/>
+                                <buttonConfiguration key="configuration" style="plain" title="Signature"/>
+                                <connections>
+                                    <action selector="onSignature:" destination="kPm-vh-Xir" eventType="touchUpInside" id="w6A-I5-XgS"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="TDE-LW-r8Y"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -1810,7 +1819,7 @@ Email: redantsupport@united-us.net</string>
         </scene>
     </scenes>
     <resources>
-        <image name="about" width="72" height="72"/>
+        <image name="about" width="96" height="96"/>
         <image name="album" width="48" height="48"/>
         <image name="btn_cancel" width="102" height="30"/>
         <image name="btn_retrieve" width="102" height="30"/>

+ 0 - 12
RedAnt ERP Mobile/iSales-TRADESHOW.xcodeproj/project.pbxproj

@@ -41,7 +41,6 @@
 		3C9FFA4B274797200067830C /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA4A274797200067830C /* TouchImageView.m */; };
 		3C9FFA52274797460067830C /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA4D274797460067830C /* RTLabel.m */; };
 		3C9FFA53274797460067830C /* StrikethroughLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA4E274797460067830C /* StrikethroughLabel.m */; };
-		3C9FFA54274797460067830C /* CustomIOSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA51274797460067830C /* CustomIOSAlertView.m */; };
 		3C9FFA57274797850067830C /* DBUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA55274797840067830C /* DBUtil.m */; };
 		3C9FFA5A274797DE0067830C /* EnumSelectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA58274797DE0067830C /* EnumSelectViewController.m */; };
 		3C9FFA712747981F0067830C /* CommonEditorCellSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA5C2747981D0067830C /* CommonEditorCellSwitch.m */; };
@@ -295,7 +294,6 @@
 		71DF74851C57608F00F2789C /* ImageUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74701C57608F00F2789C /* ImageUploadViewController.m */; };
 		71DF74861C57608F00F2789C /* ImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74721C57608F00F2789C /* ImageViewController.m */; };
 		71DF74871C57608F00F2789C /* NIDropDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74741C57608F00F2789C /* NIDropDown.m */; };
-		71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74761C57608F00F2789C /* PulldownMenu.m */; };
 		71DF74891C57608F00F2789C /* RadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74781C57608F00F2789C /* RadioButton.m */; };
 		71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF747C1C57608F00F2789C /* SimpleGrid.m */; };
 		71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74801C57608F00F2789C /* TouchLabel.m */; };
@@ -355,12 +353,10 @@
 		3C9FFA44274796B30067830C /* VideoPreviewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoPreviewCell.h; sourceTree = "<group>"; };
 		3C9FFA49274797200067830C /* TouchImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TouchImageView.h; path = ../../common/customUI/TouchImageView.h; sourceTree = "<group>"; };
 		3C9FFA4A274797200067830C /* TouchImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TouchImageView.m; path = ../../common/customUI/TouchImageView.m; sourceTree = "<group>"; };
-		3C9FFA4C274797450067830C /* CustomIOSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomIOSAlertView.h; path = ../../common/customUI/CustomIOSAlertView.h; sourceTree = "<group>"; };
 		3C9FFA4D274797460067830C /* RTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RTLabel.m; path = ../../common/customUI/RTLabel.m; sourceTree = "<group>"; };
 		3C9FFA4E274797460067830C /* StrikethroughLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StrikethroughLabel.m; path = ../../common/customUI/StrikethroughLabel.m; sourceTree = "<group>"; };
 		3C9FFA4F274797460067830C /* StrikethroughLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrikethroughLabel.h; path = ../../common/customUI/StrikethroughLabel.h; sourceTree = "<group>"; };
 		3C9FFA50274797460067830C /* RTLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RTLabel.h; path = ../../common/customUI/RTLabel.h; sourceTree = "<group>"; };
-		3C9FFA51274797460067830C /* CustomIOSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomIOSAlertView.m; path = ../../common/customUI/CustomIOSAlertView.m; sourceTree = "<group>"; };
 		3C9FFA55274797840067830C /* DBUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DBUtil.m; path = common/DBUtil.m; sourceTree = SOURCE_ROOT; };
 		3C9FFA56274797850067830C /* DBUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBUtil.h; path = common/DBUtil.h; sourceTree = SOURCE_ROOT; };
 		3C9FFA58274797DE0067830C /* EnumSelectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EnumSelectViewController.m; path = ../../common/customUI/commoneditor/EnumSelectViewController.m; sourceTree = "<group>"; };
@@ -824,8 +820,6 @@
 		71DF74721C57608F00F2789C /* ImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageViewController.m; path = common/customUI/ImageViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74731C57608F00F2789C /* NIDropDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIDropDown.h; path = common/customUI/NIDropDown.h; sourceTree = SOURCE_ROOT; };
 		71DF74741C57608F00F2789C /* NIDropDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIDropDown.m; path = common/customUI/NIDropDown.m; sourceTree = SOURCE_ROOT; };
-		71DF74751C57608F00F2789C /* PulldownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PulldownMenu.h; path = common/customUI/PulldownMenu.h; sourceTree = SOURCE_ROOT; };
-		71DF74761C57608F00F2789C /* PulldownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PulldownMenu.m; path = common/customUI/PulldownMenu.m; sourceTree = SOURCE_ROOT; };
 		71DF74771C57608F00F2789C /* RadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioButton.h; path = common/customUI/RadioButton.h; sourceTree = SOURCE_ROOT; };
 		71DF74781C57608F00F2789C /* RadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RadioButton.m; path = common/customUI/RadioButton.m; sourceTree = SOURCE_ROOT; };
 		71DF747B1C57608F00F2789C /* SimpleGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleGrid.h; path = common/customUI/SimpleGrid.h; sourceTree = SOURCE_ROOT; };
@@ -1705,8 +1699,6 @@
 				71DF74721C57608F00F2789C /* ImageViewController.m */,
 				71DF74731C57608F00F2789C /* NIDropDown.h */,
 				71DF74741C57608F00F2789C /* NIDropDown.m */,
-				71DF74751C57608F00F2789C /* PulldownMenu.h */,
-				71DF74761C57608F00F2789C /* PulldownMenu.m */,
 				71DF74771C57608F00F2789C /* RadioButton.h */,
 				71DF74781C57608F00F2789C /* RadioButton.m */,
 				71DF747B1C57608F00F2789C /* SimpleGrid.h */,
@@ -1715,8 +1707,6 @@
 				71DF74801C57608F00F2789C /* TouchLabel.m */,
 				3C9FFA49274797200067830C /* TouchImageView.h */,
 				3C9FFA4A274797200067830C /* TouchImageView.m */,
-				3C9FFA4C274797450067830C /* CustomIOSAlertView.h */,
-				3C9FFA51274797460067830C /* CustomIOSAlertView.m */,
 				3C9FFA50274797460067830C /* RTLabel.h */,
 				3C9FFA4D274797460067830C /* RTLabel.m */,
 				3C9FFA4F274797460067830C /* StrikethroughLabel.h */,
@@ -2208,7 +2198,6 @@
 				71DF74831C57608F00F2789C /* ImageScrollerView.m in Sources */,
 				71DF74871C57608F00F2789C /* NIDropDown.m in Sources */,
 				710274251CC606C4009FD219 /* UserListViewController.m in Sources */,
-				71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */,
 				7141DD551C57459B00F7DF59 /* split.c in Sources */,
 				3C9FFA742747981F0067830C /* CommonEditorCellEnum.m in Sources */,
 				716AF8E11D7AA0E0001188E0 /* SelectUploadOrderViewController.m in Sources */,
@@ -2263,7 +2252,6 @@
 				7162A5751C58728D00AB630E /* LineView.m in Sources */,
 				3C9FFA7B2747981F0067830C /* CommonEditorCellEdit.m in Sources */,
 				712AFEDD1DBA050200254965 /* RAPDFPage.m in Sources */,
-				3C9FFA54274797460067830C /* CustomIOSAlertView.m in Sources */,
 				428980481E249339005F1BD8 /* JKMessageBoxController.m in Sources */,
 				7162A5741C58728D00AB630E /* DetailViewController.m in Sources */,
 				3C9FFA98274798BB0067830C /* EnumModel.m in Sources */,

+ 0 - 12
RedAnt ERP Mobile/iSales-UNITED WAVER.xcodeproj/project.pbxproj

@@ -41,7 +41,6 @@
 		3C3F4EE2276B338000B091AE /* SRMonthPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EE0276B338000B091AE /* SRMonthPicker.m */; };
 		3C3F4EE5276B339900B091AE /* DefaultTableHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EE3276B339800B091AE /* DefaultTableHeaderView.m */; };
 		3C3F4EEE276B33EC00B091AE /* StrikethroughLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EE6276B33EB00B091AE /* StrikethroughLabel.m */; };
-		3C3F4EEF276B33EC00B091AE /* CustomIOSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EE9276B33EB00B091AE /* CustomIOSAlertView.m */; };
 		3C3F4EF0276B33EC00B091AE /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EEC276B33EC00B091AE /* RTLabel.m */; };
 		3C3F4EF1276B33EC00B091AE /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EED276B33EC00B091AE /* TouchImageView.m */; };
 		3C3F4EF4276B342A00B091AE /* RADataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EF2276B342A00B091AE /* RADataProvider.m */; };
@@ -293,7 +292,6 @@
 		71DF74851C57608F00F2789C /* ImageUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74701C57608F00F2789C /* ImageUploadViewController.m */; };
 		71DF74861C57608F00F2789C /* ImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74721C57608F00F2789C /* ImageViewController.m */; };
 		71DF74871C57608F00F2789C /* NIDropDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74741C57608F00F2789C /* NIDropDown.m */; };
-		71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74761C57608F00F2789C /* PulldownMenu.m */; };
 		71DF74891C57608F00F2789C /* RadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74781C57608F00F2789C /* RadioButton.m */; };
 		71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF747C1C57608F00F2789C /* SimpleGrid.m */; };
 		71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74801C57608F00F2789C /* TouchLabel.m */; };
@@ -369,8 +367,6 @@
 		3C3F4EE4276B339800B091AE /* DefaultTableHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultTableHeaderView.h; path = ../../common/customUI/commoneditor/DefaultTableHeaderView.h; sourceTree = "<group>"; };
 		3C3F4EE6276B33EB00B091AE /* StrikethroughLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StrikethroughLabel.m; path = ../../common/customUI/StrikethroughLabel.m; sourceTree = "<group>"; };
 		3C3F4EE7276B33EB00B091AE /* RTLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RTLabel.h; path = ../../common/customUI/RTLabel.h; sourceTree = "<group>"; };
-		3C3F4EE8276B33EB00B091AE /* CustomIOSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomIOSAlertView.h; path = ../../common/customUI/CustomIOSAlertView.h; sourceTree = "<group>"; };
-		3C3F4EE9276B33EB00B091AE /* CustomIOSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomIOSAlertView.m; path = ../../common/customUI/CustomIOSAlertView.m; sourceTree = "<group>"; };
 		3C3F4EEA276B33EB00B091AE /* StrikethroughLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrikethroughLabel.h; path = ../../common/customUI/StrikethroughLabel.h; sourceTree = "<group>"; };
 		3C3F4EEB276B33EC00B091AE /* TouchImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TouchImageView.h; path = ../../common/customUI/TouchImageView.h; sourceTree = "<group>"; };
 		3C3F4EEC276B33EC00B091AE /* RTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RTLabel.m; path = ../../common/customUI/RTLabel.m; sourceTree = "<group>"; };
@@ -824,8 +820,6 @@
 		71DF74721C57608F00F2789C /* ImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageViewController.m; path = common/customUI/ImageViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74731C57608F00F2789C /* NIDropDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIDropDown.h; path = common/customUI/NIDropDown.h; sourceTree = SOURCE_ROOT; };
 		71DF74741C57608F00F2789C /* NIDropDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIDropDown.m; path = common/customUI/NIDropDown.m; sourceTree = SOURCE_ROOT; };
-		71DF74751C57608F00F2789C /* PulldownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PulldownMenu.h; path = common/customUI/PulldownMenu.h; sourceTree = SOURCE_ROOT; };
-		71DF74761C57608F00F2789C /* PulldownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PulldownMenu.m; path = common/customUI/PulldownMenu.m; sourceTree = SOURCE_ROOT; };
 		71DF74771C57608F00F2789C /* RadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioButton.h; path = common/customUI/RadioButton.h; sourceTree = SOURCE_ROOT; };
 		71DF74781C57608F00F2789C /* RadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RadioButton.m; path = common/customUI/RadioButton.m; sourceTree = SOURCE_ROOT; };
 		71DF747B1C57608F00F2789C /* SimpleGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleGrid.h; path = common/customUI/SimpleGrid.h; sourceTree = SOURCE_ROOT; };
@@ -1697,8 +1691,6 @@
 		718600B31936C385004B6CDE /* customUI */ = {
 			isa = PBXGroup;
 			children = (
-				3C3F4EE8276B33EB00B091AE /* CustomIOSAlertView.h */,
-				3C3F4EE9276B33EB00B091AE /* CustomIOSAlertView.m */,
 				3C3F4EE7276B33EB00B091AE /* RTLabel.h */,
 				3C3F4EEC276B33EC00B091AE /* RTLabel.m */,
 				3C3F4EEA276B33EB00B091AE /* StrikethroughLabel.h */,
@@ -1715,8 +1707,6 @@
 				71DF74721C57608F00F2789C /* ImageViewController.m */,
 				71DF74731C57608F00F2789C /* NIDropDown.h */,
 				71DF74741C57608F00F2789C /* NIDropDown.m */,
-				71DF74751C57608F00F2789C /* PulldownMenu.h */,
-				71DF74761C57608F00F2789C /* PulldownMenu.m */,
 				71DF74771C57608F00F2789C /* RadioButton.h */,
 				71DF74781C57608F00F2789C /* RadioButton.m */,
 				71DF747B1C57608F00F2789C /* SimpleGrid.h */,
@@ -2214,7 +2204,6 @@
 				71DF74871C57608F00F2789C /* NIDropDown.m in Sources */,
 				3C3F4E9E276B326300B091AE /* RASingleton.m in Sources */,
 				710274251CC606C4009FD219 /* UserListViewController.m in Sources */,
-				71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */,
 				7141DD551C57459B00F7DF59 /* split.c in Sources */,
 				716AF8E11D7AA0E0001188E0 /* SelectUploadOrderViewController.m in Sources */,
 				712AFEDF1DBA050200254965 /* TextDrawable.m in Sources */,
@@ -2308,7 +2297,6 @@
 				7162A59A1C58733400AB630E /* OrderDetailInfoCell.m in Sources */,
 				7162A5471C58719D00AB630E /* RATreeView+Private.m in Sources */,
 				3C3F4EA9276B32C100B091AE /* EnumSelectAndSortViewController.m in Sources */,
-				3C3F4EEF276B33EC00B091AE /* CustomIOSAlertView.m in Sources */,
 				428980041E2490C1005F1BD8 /* NotificationNameCenter.m in Sources */,
 				4289802C1E2492D2005F1BD8 /* CategoryPriceViewController.m in Sources */,
 				3C3F4ED0276B332400B091AE /* CommonEditorViewController.m in Sources */,

+ 0 - 12
RedAnt ERP Mobile/iSales-USAI.xcodeproj/project.pbxproj

@@ -70,7 +70,6 @@
 		3CDDB262273A59DF00681F78 /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB260273A59DF00681F78 /* TouchImageView.m */; };
 		3CDDB265273A59EF00681F78 /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB264273A59EF00681F78 /* RTLabel.m */; };
 		3CDDB268273A5A0400681F78 /* StrikethroughLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB267273A5A0400681F78 /* StrikethroughLabel.m */; };
-		3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */; };
 		3CDDB26E273A5A7800681F78 /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDDB26C273A5A7800681F78 /* RAUtils.m */; };
 		423CC87521D22FDE008BD2C4 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 423CC87421D22FDE008BD2C4 /* Launch Screen.storyboard */; };
 		424A02D11FFB3A0B0088DC56 /* RABackOrderSubmitAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 424A02D01FFB3A0B0088DC56 /* RABackOrderSubmitAlertController.m */; };
@@ -297,7 +296,6 @@
 		71DF74851C57608F00F2789C /* ImageUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74701C57608F00F2789C /* ImageUploadViewController.m */; };
 		71DF74861C57608F00F2789C /* ImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74721C57608F00F2789C /* ImageViewController.m */; };
 		71DF74871C57608F00F2789C /* NIDropDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74741C57608F00F2789C /* NIDropDown.m */; };
-		71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74761C57608F00F2789C /* PulldownMenu.m */; };
 		71DF74891C57608F00F2789C /* RadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74781C57608F00F2789C /* RadioButton.m */; };
 		71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF747C1C57608F00F2789C /* SimpleGrid.m */; };
 		71DF748D1C57608F00F2789C /* TouchLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74801C57608F00F2789C /* TouchLabel.m */; };
@@ -418,8 +416,6 @@
 		3CDDB264273A59EF00681F78 /* RTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RTLabel.m; path = ../../common/customUI/RTLabel.m; sourceTree = "<group>"; };
 		3CDDB266273A5A0400681F78 /* StrikethroughLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrikethroughLabel.h; path = ../../common/customUI/StrikethroughLabel.h; sourceTree = "<group>"; };
 		3CDDB267273A5A0400681F78 /* StrikethroughLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StrikethroughLabel.m; path = ../../common/customUI/StrikethroughLabel.m; sourceTree = "<group>"; };
-		3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomIOSAlertView.m; path = ../../common/customUI/CustomIOSAlertView.m; sourceTree = "<group>"; };
-		3CDDB26A273A5A1500681F78 /* CustomIOSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomIOSAlertView.h; path = ../../common/customUI/CustomIOSAlertView.h; sourceTree = "<group>"; };
 		3CDDB26C273A5A7800681F78 /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = ../../common/RAUtils.m; sourceTree = "<group>"; };
 		3CDDB26D273A5A7800681F78 /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = ../../common/RAUtils.h; sourceTree = "<group>"; };
 		423CC87421D22FDE008BD2C4 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = SOURCE_ROOT; };
@@ -836,8 +832,6 @@
 		71DF74721C57608F00F2789C /* ImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageViewController.m; path = common/customUI/ImageViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74731C57608F00F2789C /* NIDropDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIDropDown.h; path = common/customUI/NIDropDown.h; sourceTree = SOURCE_ROOT; };
 		71DF74741C57608F00F2789C /* NIDropDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIDropDown.m; path = common/customUI/NIDropDown.m; sourceTree = SOURCE_ROOT; };
-		71DF74751C57608F00F2789C /* PulldownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PulldownMenu.h; path = common/customUI/PulldownMenu.h; sourceTree = SOURCE_ROOT; };
-		71DF74761C57608F00F2789C /* PulldownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PulldownMenu.m; path = common/customUI/PulldownMenu.m; sourceTree = SOURCE_ROOT; };
 		71DF74771C57608F00F2789C /* RadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioButton.h; path = common/customUI/RadioButton.h; sourceTree = SOURCE_ROOT; };
 		71DF74781C57608F00F2789C /* RadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RadioButton.m; path = common/customUI/RadioButton.m; sourceTree = SOURCE_ROOT; };
 		71DF747B1C57608F00F2789C /* SimpleGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleGrid.h; path = common/customUI/SimpleGrid.h; sourceTree = SOURCE_ROOT; };
@@ -1724,8 +1718,6 @@
 		718600B31936C385004B6CDE /* customUI */ = {
 			isa = PBXGroup;
 			children = (
-				3CDDB26A273A5A1500681F78 /* CustomIOSAlertView.h */,
-				3CDDB269273A5A1400681F78 /* CustomIOSAlertView.m */,
 				71DF746B1C57608F00F2789C /* ImageScrollerView.h */,
 				71DF746C1C57608F00F2789C /* ImageScrollerView.m */,
 				71DF746D1C57608F00F2789C /* ImageScrollerViewController.h */,
@@ -1736,8 +1728,6 @@
 				71DF74721C57608F00F2789C /* ImageViewController.m */,
 				71DF74731C57608F00F2789C /* NIDropDown.h */,
 				71DF74741C57608F00F2789C /* NIDropDown.m */,
-				71DF74751C57608F00F2789C /* PulldownMenu.h */,
-				71DF74761C57608F00F2789C /* PulldownMenu.m */,
 				71DF74771C57608F00F2789C /* RadioButton.h */,
 				71DF74781C57608F00F2789C /* RadioButton.m */,
 				71DF747B1C57608F00F2789C /* SimpleGrid.h */,
@@ -2248,14 +2238,12 @@
 				712AFED71DBA050200254965 /* BasicDrawable.m in Sources */,
 				3C51494E273D095900F78617 /* CommonEditorCellImg.m in Sources */,
 				71DF74891C57608F00F2789C /* RadioButton.m in Sources */,
-				3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */,
 				7162A5DF1C5876E300AB630E /* ScannerSettingViewController.m in Sources */,
 				71DF74831C57608F00F2789C /* ImageScrollerView.m in Sources */,
 				71DF74871C57608F00F2789C /* NIDropDown.m in Sources */,
 				710274251CC606C4009FD219 /* UserListViewController.m in Sources */,
 				3CDDB265273A59EF00681F78 /* RTLabel.m in Sources */,
 				3C51494D273D095900F78617 /* CommonEditorCellSignature.m in Sources */,
-				71DF74881C57608F00F2789C /* PulldownMenu.m in Sources */,
 				7141DD551C57459B00F7DF59 /* split.c in Sources */,
 				716AF8E11D7AA0E0001188E0 /* SelectUploadOrderViewController.m in Sources */,
 				712AFEDF1DBA050200254965 /* TextDrawable.m in Sources */,

BIN
Redant Drivers/Redant Drivers.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 4 - 4
common/NetworkUtils.m

@@ -146,11 +146,11 @@ repeat:
         //http method
         [request setHTTPMethod:@"POST"];
         
-        NSLog(@"%@", [[NSString alloc] initWithData:myRequestData encoding:NSUTF8StringEncoding]);
+        DebugLog(@"%@", [[NSString alloc] initWithData:myRequestData encoding:NSUTF8StringEncoding]);
         NSHTTPURLResponse* urlResponse = nil;
         
         NSError *error = nil;
-        NSLog(@"begin request %@",url);
+        DebugLog(@"begin request %@",url);
 
         NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
         
@@ -160,7 +160,7 @@ repeat:
         DebugLog(@"response: %@",[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode]);
         
         
-        NSLog(@"get response");
+        DebugLog(@"get response");
         if (responseData==nil) {
             
             //            DebugLog(@"response error:%@", [error localizedDescription]);
@@ -765,7 +765,7 @@ repeat:
         NSURLSessionDataTask *dataTask =[urlSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
             
                         NSData *responseData =data;
-            NSLog(@"request_interface response");
+            DebugLog(@"request_interface response");
             DebugLog(@"request_interface result length:%ld", data.length);
                         NSHTTPURLResponse* urlResponse =(NSHTTPURLResponse*)response;
                         if (responseData==nil) {

+ 3 - 1
common/RAUtils.h

@@ -94,7 +94,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 //+(NSArray*) string2arr:(NSString*) string separator:(NSString*)separator;
 
-
++ (UIWindow *)keyWindow;
 
 + (bool)mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir error:(NSError**)err;
 
@@ -121,6 +121,8 @@ NS_ASSUME_NONNULL_BEGIN
 +(NSDictionary* )copyDict:(NSDictionary* ) source;
 +(void) playSound:(NSString*) name type:(NSString*) type;
 
++(UIInterfaceOrientation)query_orientation:(UIViewController*)vc;
+
 
 +(PopWaitAlert*) waiting_pop:(nullable NSString*) title completion:(void (^ __nullable)(void))completion;
 

+ 26 - 5
common/RAUtils.m

@@ -634,7 +634,7 @@
 {
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
     [parent presentViewController:alertController animated:YES completion:completion];
-    NSLog(@"show waiting alert %p",alertController);
+    DebugLog(@"show waiting alert %p",alertController);
     return alertController;
 
 }
@@ -675,7 +675,7 @@
     UIAlertAction *action_0 = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
     [alertController addAction:action_0];
     [vc presentViewController:alertController animated:YES completion:nil];
-    NSLog(@"show message alert %p",alertController);
+    DebugLog(@"show message alert %p",alertController);
     return alertController;
 
 }
@@ -695,7 +695,7 @@
     UIAlertAction *action_0 = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:action_handler];
     [alertController addAction:action_0];
     [vc presentViewController:alertController animated:YES completion:completion];
-    NSLog(@"show message alert %p",alertController);
+    DebugLog(@"show message alert %p",alertController);
     return alertController;
 
 }
@@ -1093,12 +1093,33 @@ done:
         [alertVC addAction:okAction];
         
         [vc presentViewController:alertVC animated:YES completion:nil];
-        NSLog(@"show alerttitle alert %p",alertVC);
+        DebugLog(@"show alerttitle alert %p",alertVC);
     }
     
 }
 
++ (UIWindow *)keyWindow
+{
+    NSArray<UIWindow *> *windows = [[UIApplication sharedApplication] windows];
+    for (UIWindow *window in windows) {
+        if (window.isKeyWindow) {
+            return window;
+        }
+    }
+    return nil;
+}
+
 
++(UIInterfaceOrientation)query_orientation:(UIViewController*)vc
+{
+    NSArray *scenes=[[[UIApplication sharedApplication] connectedScenes] allObjects];
+    NSArray *windows=[[scenes objectAtIndex:0] windows];
+
+    UIWindow* w=windows[0];
+
+    
+    return [w.windowScene interfaceOrientation];
+}
 
 + (CGSize)sizeWithFont:(NSString*)string font:(UIFont *)font constrainedToSize:(CGSize)maxsize lineBreakMode:(NSLineBreakMode)lineBreakMode
 {
@@ -1143,7 +1164,7 @@ done:
 }
 + (UIViewController *)getCurrentVC
 {
-    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
+    UIViewController *rootViewController = [RAUtils keyWindow].rootViewController;
     
     UIViewController *currentVC = [self getCurrentVCFrom:rootViewController];
     

+ 1 - 1
common/WK PDF+Web/RAPDFViewController.m

@@ -36,7 +36,7 @@
 - (void)viewDidLoad
 {
     
-    NSLog(@"pdf viewer loaded");
+    DebugLog(@"pdf viewer loaded");
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     UIRefreshControl *ref = [[UIRefreshControl alloc]init];

+ 10 - 7
common/Youtube/RAYTPlayer.m

@@ -7,6 +7,7 @@
 //
 
 #import "RAYTPlayer.h"
+#import "const.h"
 
 @interface RAYTPlayer ()
 
@@ -142,7 +143,7 @@
 //
 //
 //[self.wkwebView evaluateJavaScript:jsToExecute completionHandler:^(id _Nullable result, NSError * _Nullable error) {
-//                    NSLog(@"%@----%@",result, error);
+//                    DebugLog(@"%@----%@",result, error);
 //                }];
 //
 //}
@@ -178,11 +179,13 @@
 #pragma mark - WKNavigationDelegate
 
 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
-    NSLog(@"%s",__func__);
+    
+    
+    DebugLog(@"%s",__func__);
 }
 
 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {
-    NSLog(@"%s",__func__);
+    DebugLog(@"%s",__func__);
     
     
     //1)获取trust object
@@ -194,7 +197,7 @@
     
     //    CFArrayRef defaultPolicies = NULL;
     //    SecTrustCopyPolicies(trust, &defaultPolicies);
-    //    NSLog(@"default policies: %@",(__bridge id)defaultPolicies);
+    //    DebugLog(@"default policies: %@",(__bridge id)defaultPolicies);
     
     NSMutableArray *policies = [NSMutableArray array];
     [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
@@ -225,14 +228,14 @@
 
 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error
 {
-    NSLog(@"%@",error);
+    DebugLog(@"%@",error);
 }
 
 //禁止链接跳转
 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
     
-      NSLog(@"%s",__func__);
-        NSLog(@"navigationAction = %@, \r!!!!!!!!!!!!!!!!!!!!!!\n request = %@",navigationAction,navigationAction.request.URL);
+      DebugLog(@"%s",__func__);
+        DebugLog(@"navigationAction = %@, \r!!!!!!!!!!!!!!!!!!!!!!\n request = %@",navigationAction,navigationAction.request.URL);
 
     //    NSURLRequest * request = navigationAction.request;
 

+ 75 - 72
common/customUI/CustomIOSAlertView.m

@@ -11,6 +11,7 @@
 
 #import "CustomIOSAlertView.h"
 #import <QuartzCore/QuartzCore.h>
+#import "const.h"
 
 const static CGFloat kCustomIOSAlertViewDefaultButtonHeight       = 50;
 const static CGFloat kCustomIOSAlertViewDefaultButtonSpacerHeight = 1;
@@ -86,30 +87,31 @@ CGFloat buttonSpacerHeight = 0;
     } else {
 
         // On iOS7, calculate with orientation
-        if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
-            
-            UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
-            switch (interfaceOrientation) {
-                case UIInterfaceOrientationLandscapeLeft:
-                    self.transform = CGAffineTransformMakeRotation(M_PI * 270.0 / 180.0);
-                    break;
-                    
-                case UIInterfaceOrientationLandscapeRight:
-                    self.transform = CGAffineTransformMakeRotation(M_PI * 90.0 / 180.0);
-                    break;
-                    
-                case UIInterfaceOrientationPortraitUpsideDown:
-                    self.transform = CGAffineTransformMakeRotation(M_PI * 180.0 / 180.0);
-                    break;
-                    
-                default:
-                    break;
-            }
-            
-            [self setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
-
-        // On iOS8, just place the dialog in the middle
-        } else {
+//        if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
+//
+//            UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+//            switch (interfaceOrientation) {
+//                case UIInterfaceOrientationLandscapeLeft:
+//                    self.transform = CGAffineTransformMakeRotation(M_PI * 270.0 / 180.0);
+//                    break;
+//
+//                case UIInterfaceOrientationLandscapeRight:
+//                    self.transform = CGAffineTransformMakeRotation(M_PI * 90.0 / 180.0);
+//                    break;
+//
+//                case UIInterfaceOrientationPortraitUpsideDown:
+//                    self.transform = CGAffineTransformMakeRotation(M_PI * 180.0 / 180.0);
+//                    break;
+//
+//                default:
+//                    break;
+//            }
+//
+//            [self setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
+//
+//        // On iOS8, just place the dialog in the middle
+//        } else
+        {
 
             CGSize screenSize = [self countScreenSize];
             CGSize dialogSize = [self countDialogSize];
@@ -151,7 +153,7 @@ CGFloat buttonSpacerHeight = 0;
 // Default button behaviour
 - (void)customIOS7dialogButtonTouchUpInside: (CustomIOSAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
 {
-    NSLog(@"Button Clicked! %d, %d", (int)buttonIndex, (int)[alertView tag]);
+    DebugLog(@"Button Clicked! %d, %d", (int)buttonIndex, (int)[alertView tag]);
     [self close];
 }
 
@@ -292,15 +294,15 @@ CGFloat buttonSpacerHeight = 0;
     CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
 
     // On iOS7, screen width and height doesn't automatically follow orientation
-    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
-        UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
-        if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
-            CGFloat tmp = screenWidth;
-            screenWidth = screenHeight;
-            screenHeight = tmp;
-        }
-    }
-    
+//    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
+//        UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+//        if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
+//            CGFloat tmp = screenWidth;
+//            screenWidth = screenHeight;
+//            screenHeight = tmp;
+//        }
+//    }
+//
     return CGSizeMake(screenWidth, screenHeight);
 }
 
@@ -338,41 +340,41 @@ CGFloat buttonSpacerHeight = 0;
     [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
 }
 
-// Rotation changed, on iOS7
-- (void)changeOrientationForIOS7 {
-
-    UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
-    
-    CGFloat startRotation = [[self valueForKeyPath:@"layer.transform.rotation.z"] floatValue];
-    CGAffineTransform rotation;
-    
-    switch (interfaceOrientation) {
-        case UIInterfaceOrientationLandscapeLeft:
-            rotation = CGAffineTransformMakeRotation(-startRotation + M_PI * 270.0 / 180.0);
-            break;
-            
-        case UIInterfaceOrientationLandscapeRight:
-            rotation = CGAffineTransformMakeRotation(-startRotation + M_PI * 90.0 / 180.0);
-            break;
-            
-        case UIInterfaceOrientationPortraitUpsideDown:
-            rotation = CGAffineTransformMakeRotation(-startRotation + M_PI * 180.0 / 180.0);
-            break;
-            
-        default:
-            rotation = CGAffineTransformMakeRotation(-startRotation + 0.0);
-            break;
-    }
-
-    [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionTransitionNone
-                     animations:^{
-        self->dialogView.transform = rotation;
-                         
-                     }
-                     completion:nil
-     ];
-    
-}
+//// Rotation changed, on iOS7
+//- (void)changeOrientationForIOS7 {
+//
+//    UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
+//
+//    CGFloat startRotation = [[self valueForKeyPath:@"layer.transform.rotation.z"] floatValue];
+//    CGAffineTransform rotation;
+//
+//    switch (interfaceOrientation) {
+//        case UIInterfaceOrientationLandscapeLeft:
+//            rotation = CGAffineTransformMakeRotation(-startRotation + M_PI * 270.0 / 180.0);
+//            break;
+//
+//        case UIInterfaceOrientationLandscapeRight:
+//            rotation = CGAffineTransformMakeRotation(-startRotation + M_PI * 90.0 / 180.0);
+//            break;
+//
+//        case UIInterfaceOrientationPortraitUpsideDown:
+//            rotation = CGAffineTransformMakeRotation(-startRotation + M_PI * 180.0 / 180.0);
+//            break;
+//
+//        default:
+//            rotation = CGAffineTransformMakeRotation(-startRotation + 0.0);
+//            break;
+//    }
+//
+//    [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionTransitionNone
+//                     animations:^{
+//        self->dialogView.transform = rotation;
+//
+//                     }
+//                     completion:nil
+//     ];
+//
+//}
 
 // Rotation changed, on iOS8
 - (void)changeOrientationForIOS8: (NSNotification *)notification {
@@ -401,9 +403,10 @@ CGFloat buttonSpacerHeight = 0;
         return;
     }
 
-    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
-        [self changeOrientationForIOS7];
-    } else {
+//    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
+//        [self changeOrientationForIOS7];
+//    } else
+    {
         [self changeOrientationForIOS8:notification];
     }
 }

+ 1 - 1
common/customUI/commoneditor/CommonEditorAutoCompleteView.m

@@ -130,7 +130,7 @@
             }
             else
             {
-                NSLog(@"expired search");
+                DebugLog(@"expired search");
             }
         } ];
                 

+ 1 - 1
common/customUI/commoneditor/CommonEditorCellModel.m

@@ -66,7 +66,7 @@
     
     
     
-    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
     [vc presentViewController:navi animated:YES completion:^{
         
         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);

+ 121 - 95
common/customUI/commoneditor/CommonEditorViewController.m

@@ -33,7 +33,7 @@
 
 //#import "NetworkUtils.h"
 #import "config.h"
-#import "CustomIOSAlertView.h"
+//#import "CustomIOSAlertView.h"
 #import "DefaultAppearance.h"
 #import "DefaultTableHeaderView.h"
 #define INTNUMBERS @"0123456789\n"
@@ -283,18 +283,20 @@
 //{
 //
 //    [self.alert dismissViewControllerAnimated:YES completion:nil];
-//    NSLog(@"alert dismiss by viewwillDisapper %p",self.alert);
+//    DebugLog(@"alert dismiss by viewwillDisapper %p",self.alert);
 //}
 }
 
 -(void)manually_refresh
 {
     return;
-    UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
-    reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Refreshing"];
-    
-    if ([self respondsToSelector:@selector(reload_data)])
-        [self performSelector:@selector(reload_data) withObject:nil afterDelay:1];
+    //不支持手动刷新
+//
+//    UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
+//    reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Refreshing"];
+//
+//    if ([self respondsToSelector:@selector(reload_data)])
+//        [self performSelector:@selector(reload_data) withObject:nil afterDelay:1];
     //    DebugLog(@"refresh!!!!!!!!");
     
 }
@@ -552,7 +554,9 @@
 }
 -(NSMutableDictionary*) check_cancommit :(bool) alert
 {
-    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
+    [[RAUtils keyWindow] endEditing:YES];
+    
+    
     // [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder)];
     
     
@@ -987,33 +991,53 @@
         NSString* missfields=[fields componentsJoinedByString:@"\n"];
         NSString* msg = [NSString stringWithFormat:@"%@",missfields];
         
-        CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init];
-        
-        
-        
-        
-        // Add some custom content to the alert view
-        [alertView setContainerView:[self createDemoView:msg]];
-        
-        // Modify the parameters
         
         
+        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Warning"
+                                                                                 message:msg
+                                                                          preferredStyle:UIAlertControllerStyleAlert];
+        [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            
+        }]];
+//        [alertController addAction:[UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//            [self.presentedViewController dismissViewControllerAnimated:YES completion:nil];
+//            //            if (@available(iOS 10.0, *)) {
+//                            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
+//            //            } else {
+//            //                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID&path=com.xxx.xxx"]];//prefs:root=服务&path=项目bundleID     }
+//
+//        }]];
+        [self presentViewController:alertController animated:YES completion:nil];
         
-        [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"OK", nil]];
-        //[alertView setDelegate:self];
         
-        // You may use a Block, rather than a delegate.
-        [alertView setOnButtonTouchUpInside:^(CustomIOSAlertView *alertView, int buttonIndex) {
-            //   DebugLog(@"Block: Button at position %d is clicked on alertView %d.", buttonIndex, (int)[alertView tag]);
-            [alertView close];
-        }];
         
-        //  [alertView setUseMotionEffects:true];
+//        CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init];
+//
+//
+//
+//
+//        // Add some custom content to the alert view
+//        [alertView setContainerView:[self createDemoView:msg]];
+//
+//        // Modify the parameters
+//
         
-        // And launch the dialog
         
-        [alertView sizeToFit];
-        [alertView show];
+//        [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"OK", nil]];
+//        //[alertView setDelegate:self];
+//
+//        // You may use a Block, rather than a delegate.
+//        [alertView setOnButtonTouchUpInside:^(CustomIOSAlertView *alertView, int buttonIndex) {
+//            //   DebugLog(@"Block: Button at position %d is clicked on alertView %d.", buttonIndex, (int)[alertView tag]);
+//            [alertView close];
+//        }];
+//
+//        //  [alertView setUseMotionEffects:true];
+//
+//        // And launch the dialog
+//
+//        [alertView sizeToFit];
+//        [alertView show];
         
         //        [RAUtils alert_view:msg title:@"Please complete missing fields:"];
         self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
@@ -1356,7 +1380,7 @@
                 
 //                [waitalert dismissViewControllerAnimated:YES completion:^{
                 [pop hide];
-//                    NSLog(@"alert dismiss by network return %p",waitalert);
+//                    DebugLog(@"alert dismiss by network return %p",waitalert);
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
                         if(!discardDirty)
@@ -1788,7 +1812,7 @@
             [retarray addObject:sectionarr];
         }
         
-        NSLog(@"content control count = %ld",retarray.count);
+        DebugLog(@"content control count = %ld",retarray.count);
         return retarray;
         //    retjson setObject:sec forKey:<#(id<NSCopying>)#>
         //    return nil;
@@ -2483,12 +2507,12 @@
     
     
     
-#ifdef DEBUG
+//#ifdef DEBUG
     
-    DebugLog(@"endedit %d_%d",indexPath.section,indexPath.row);
+    DebugLog(@"endedit %ld_%ld",indexPath.section,indexPath.row);
 DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
     
-#endif
+//#endif
     
 
     NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
@@ -2593,6 +2617,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
                 [RADataProvider request_commoneditor_partialrefresh:params url:url completionHandler:^(NSMutableDictionary *result) {
                     NSDictionary* editor_json =result;
 //                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         if([[editor_json valueForKey:@"result"] intValue]==2)
                         {
                             
@@ -3058,7 +3083,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
 {
     
-    NSLog(@"numberOfSectionsInTableView  = %ld",self.content_data_control.count);
+    DebugLog(@"numberOfSectionsInTableView  = %ld",self.content_data_control.count);
     
     //    if(self.content_data_control.count>0)
     //        return 1;
@@ -3213,7 +3238,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
     
     
     
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
     
     NSDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
     NSString* control = [item_json valueForKey:@"control"];
@@ -3232,9 +3257,9 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
         NSString* align =[item_json valueForKey:@"align"];
         
         if([align isEqualToString:@"right"])
-            cell.textview.textAlignment= kCTTextAlignmentRight;
+            cell.textview.textAlignment= NSTextAlignmentRight;
         else
-            cell.textview.textAlignment =kCTTextAlignmentLeft;
+            cell.textview.textAlignment =NSTextAlignmentRight;
         
         int capital =[[item_json valueForKey:@"capital"] intValue];
         switch (capital) {
@@ -4767,17 +4792,17 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
     //    [myView addSubview:statuslabel];
     //
     myView.backgroundColor = UIColor.lightGrayColor;
-    UIColor * c=myView.backgroundColor;
+//    UIColor * c=myView.backgroundColor;
     return myView;
 }
 
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
 {
-    NSLog(@"Did Scroll %f",scrollView.contentOffset.y);
+    DebugLog(@"Did Scroll %f",scrollView.contentOffset.y);
 //    CGPoint contentOffsetPoint = scrollView.contentOffset;
     CGRect f = self.autocompleteView.frame;
     CGRect rframe=[RAUtils relativeFrameForScreenWithView:self.lastedit];
-    NSLog(@"edit y %f",rframe.origin.y);
+    DebugLog(@"edit y %f",rframe.origin.y);
     self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
     
 }
@@ -5002,7 +5027,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
             
             if(signimg!=nil)
             {
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 #ifdef SCANNER_ORDER
 //                if(RASingleton.sharedInstance.enable_OfflineOrder)
                 {
@@ -5125,7 +5150,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
                 NSData *imageData = UIImagePNGRepresentation(img);
                 
                 NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                 NSString *user = [RASingleton.sharedInstance globalParameterForKey:@"user"];
                 NSString *password = [RASingleton.sharedInstance globalParameterForKey:@"password"];
                 
@@ -5886,7 +5911,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
                
                     CGRect f = self.autocompleteView.frame;
                     CGRect rframe=[RAUtils relativeFrameForScreenWithView:textField];
-                    NSLog(@"edit y %f",rframe.origin.y);
+                    DebugLog(@"edit y %f",rframe.origin.y);
                     self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
                 NSString *substring = [NSString stringWithString:textField.text];
                 substring = [substring stringByReplacingCharactersInRange:range withString:string];
@@ -5907,7 +5932,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
                
                     CGRect f = self.autocompleteView.frame;
                     CGRect rframe=[RAUtils relativeFrameForScreenWithView:textField];
-                    NSLog(@"edit y %f",rframe.origin.y);
+                    DebugLog(@"edit y %f",rframe.origin.y);
                     self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
              
                 NSString *substring = [NSString stringWithString:textField.text];
@@ -5946,7 +5971,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
            
                 CGRect f = self.autocompleteView.frame;
                 CGRect rframe=[RAUtils relativeFrameForScreenWithView:textField];
-                NSLog(@"edit y %f",rframe.origin.y);
+                DebugLog(@"edit y %f",rframe.origin.y);
                 self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
          
             NSString *substring = [NSString stringWithString:textField.text];
@@ -5969,7 +5994,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
            
                 CGRect f = self.autocompleteView.frame;
                 CGRect rframe=[RAUtils relativeFrameForScreenWithView:textField];
-                NSLog(@"edit y %f",rframe.origin.y);
+                DebugLog(@"edit y %f",rframe.origin.y);
                 self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
          
             NSString *substring = [NSString stringWithString:textField.text];
@@ -6052,7 +6077,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
            self.autocompleteView.hidden = false;
            CGRect f = self.autocompleteView.frame;
            CGRect rframe=[RAUtils relativeFrameForScreenWithView:textField];
-           NSLog(@"edit y %f",rframe.origin.y);
+           DebugLog(@"edit y %f",rframe.origin.y);
            self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
          
          
@@ -6515,7 +6540,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
 //- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
 //{
 //
-//    NSLog(@"willDisplayCell");
+//    DebugLog(@"willDisplayCell");
 //    NSString *cellclass;
 //    const char *class_name_ch = object_getClassName([cell class]);
 //    cellclass = [NSString stringWithUTF8String:class_name_ch];
@@ -6532,7 +6557,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
 //- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath
 //{
 //
-//    NSLog(@"didEndDisplayingCell");
+//    DebugLog(@"didEndDisplayingCell");
 //    NSString *cellclass;
 //    const char *class_name_ch = object_getClassName([cell class]);
 //    cellclass = [NSString stringWithUTF8String:class_name_ch];
@@ -6563,11 +6588,11 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
     CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
     CGFloat end_y = end.origin.y;
     
-    CGRect screenframe=[[UIScreen mainScreen] bounds];
+//    CGRect screenframe=[[UIScreen mainScreen] bounds];
 //    CGRect controlframe= self.lastedit.frame;
 //    self.autocompleteView.frame= CGRectMake(200,200,200,200);//CGRectMake(screenframe.origin.x, screenframe.origin.y, screenframe.size.width, end_y);
     
-    NSIndexPath *indexPath = [self.editorTable indexPathForCell:self.editingcell];
+//    NSIndexPath *indexPath = [self.editorTable indexPathForCell:self.editingcell];
     
     CGRect table_frame = self.editorTable.frame;
     // table底部距离键盘顶部偏移
@@ -6614,10 +6639,11 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
                 
             }
 
-        } else {
-            // contentInset = (top = 64, left = 0, bottom = 0, right = 0),topAvailableHeight = -64
-            table_frame.size.height = table_origin_screen_frame.size.height - offset;
         }
+//        else {
+//            // contentInset = (top = 64, left = 0, bottom = 0, right = 0),topAvailableHeight = -64
+//            table_frame.size.height = table_origin_screen_frame.size.height - offset;
+//        }
         
 //        table_frame.size.height = CGRectGetHeight(table_origin_screen_frame) - (CGRectGetMaxY(table_origin_screen_frame) - end_y);
     } else {
@@ -6650,12 +6676,12 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
     int cover =CGRectGetMaxY(cell_screen_frame) - end_y;
     if (cover>0) {
         // Cell 被键盘遮挡后才滚动
-        NSLog(@"scrollToRowAtIndexPath");
+        DebugLog(@"scrollToRowAtIndexPath");
         NSString *cellclass;
         const char *class_name_ch = object_getClassName([self.editingcell class]);
         cellclass = [NSString stringWithUTF8String:class_name_ch];
         
-        CommonEditorCellTextView * tvcell=nil;
+//        CommonEditorCellTextView * tvcell=nil;
 //        if([cellclass isEqualToString:@"CommonEditorCellTextView"])
         {
 //            tvcell=(CommonEditorCellTextView*)self.editingcell;
@@ -6663,7 +6689,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
 
                CGPoint current_offset=self.editorTable.contentOffset;
                
-               NSLog(@"OFFSET %f",current_offset.y);
+               DebugLog(@"OFFSET %f",current_offset.y);
                CGPoint moveto= CGPointMake(self.editingcell.frame.origin.x,current_offset.y+cover);
                [self.editorTable setContentOffset:moveto];
         }
@@ -6677,7 +6703,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
         
 //        CGPoint current_offset=self.editorTable.contentOffset;
 //
-//        NSLog(@"OFFSET %f",current_offset.y);
+//        DebugLog(@"OFFSET %f",current_offset.y);
 //        CGPoint moveto= CGPointMake(self.editingcell.frame.origin.x,current_offset.y+cover);
      //   [self.editorTable setContentOffset:self.editingcell.frame.origin];
 //        [self.editorTable scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:NO];
@@ -6695,7 +6721,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
 }
 
 - (void)keyboardDidChangeFrame:(NSNotification *)notification {
-        NSLog(@"keyboardDidChangeFrame");
+        DebugLog(@"keyboardDidChangeFrame");
 //    NSString *cellclass;
 //    const char *class_name_ch = object_getClassName([self.editingcell class]);
 //    cellclass = [NSString stringWithUTF8String:class_name_ch];
@@ -6713,41 +6739,41 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
 
 
 
-    // 使用tableContainer计算frame 保证屏幕旋转后table height正确
-    //    CGRect table_origin_screen_frame = [self.tableContainer convertRect:self.tableContainer.bounds toView:self.view.window];
-
-    CGRect screen_rect = [RAUtils relativeFrameForScreenWithView:self.editorTable];
-    //
-    //    //    NSTimeInterval duration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
-    //    //    duration *= 0.0;
-    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
-//    CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
-    float kbheight = end.size.height;
-    CGFloat keyboard_top = end.origin.y;
-    NSLog(@"keyboard rect: %@",NSStringFromCGRect(end));
-
-    NSLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
-    NSLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
-
-    //    self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
-
-    float dark = screen_rect.origin.y+screen_rect.size.height-keyboard_top;
-
-    if(dark>0)
-    {
-//        self.editorTable.scrollEnabled = true;
-//        self.editorTable.contentSize = CGSizeMake(self.editorTable.frame.size.width, self.editorTable.frame.size.height+dark);
-        
-        self.editorTable.contentSize=CGSizeMake(self.editorTable.contentSize.width, self.editorTable.contentSize.height+kbheight);
-       
-    }
-    else
-    {
-//        self.editorTable.scrollEnabled = false;
-//        self.editorTable.contentSize = self.editorTable.frame.size;
-                self.editorTable.contentSize=CGSizeMake(self.editorTable.contentSize.width, self.editorTable.contentSize.height-kbheight);
-      
-    }
+//    // 使用tableContainer计算frame 保证屏幕旋转后table height正确
+//    //    CGRect table_origin_screen_frame = [self.tableContainer convertRect:self.tableContainer.bounds toView:self.view.window];
+//
+//    CGRect screen_rect = [RAUtils relativeFrameForScreenWithView:self.editorTable];
+//    //
+//    //    //    NSTimeInterval duration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
+//    //    //    duration *= 0.0;
+//    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+////    CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
+//    float kbheight = end.size.height;
+//    CGFloat keyboard_top = end.origin.y;
+//    DebugLog(@"keyboard rect: %@",NSStringFromCGRect(end));
+//
+//    DebugLog(@"view rect: %@",NSStringFromCGRect(self.view.frame));
+//    DebugLog(@"view screen rect: %@",NSStringFromCGRect(screen_rect));
+//
+//    //    self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
+//
+//    float dark = screen_rect.origin.y+screen_rect.size.height-keyboard_top;
+//
+//    if(dark>0)
+//    {
+////        self.editorTable.scrollEnabled = true;
+////        self.editorTable.contentSize = CGSizeMake(self.editorTable.frame.size.width, self.editorTable.frame.size.height+dark);
+//        
+//        self.editorTable.contentSize=CGSizeMake(self.editorTable.contentSize.width, self.editorTable.contentSize.height+kbheight);
+//       
+//    }
+//    else
+//    {
+////        self.editorTable.scrollEnabled = false;
+////        self.editorTable.contentSize = self.editorTable.frame.size;
+//                self.editorTable.contentSize=CGSizeMake(self.editorTable.contentSize.width, self.editorTable.contentSize.height-kbheight);
+//      
+//    }
 
 
 
@@ -6927,7 +6953,7 @@ DebugLog(@"endedit %@",[RAConvertor dict2string:self.content_data_control]);
     NSString* control = [item_json valueForKey:@"control"];
     id height_obj = [item_json objectForKey:@"height"];
     
-//    NSLog(@"indexPath: %@ origin height: %@ currentHeight: %f",indexPath,height_obj,contentHeight);
+//    DebugLog(@"indexPath: %@ origin height: %@ currentHeight: %f",indexPath,height_obj,contentHeight);
     
     if ([control isEqualToString:@"webview"] && [height_obj floatValue] != contentHeight)
     {

+ 2 - 1
common/customUI/commoneditor/EnumSelectAndSort/EnumSelectAndSortViewController.m

@@ -9,6 +9,7 @@
 #import "EnumSelectAndSortViewController.h"
 #import "EnumSelectAndSortCell.h"
 #import "EnumModel.h"
+#import "const.h"
 
 @interface EnumSelectAndSortViewController () <UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate>
 
@@ -249,7 +250,7 @@
         [_arrayDataSource insertObject:source_model atIndex:destinationIndexPath.row];
     }
     
-    NSLog(@"move %ld to %ld",sourceIndexPath.row,destinationIndexPath.row);
+    DebugLog(@"move %ld to %ld",sourceIndexPath.row,destinationIndexPath.row);
 //    // 修改Model Sort Id
 //    [_arrayDataSource enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
 //

+ 6 - 5
common/upload/RANetworkTaskDelegate.m

@@ -7,6 +7,7 @@
 //
 
 #import "RANetworkTaskDelegate.h"
+#import "const.h"
 
 
 @interface JLFileStream : NSObject
@@ -111,13 +112,13 @@
 //
 //        self.result.error = error;
 //        
-//        NSLog(@"Delegate recv Error: %@",error.localizedDescription);
+//        DebugLog(@"Delegate recv Error: %@",error.localizedDescription);
 //        
 //    }
 //        
 //    self.result.data = self.recvData;
 //
-//    NSLog(@"Delegate recv data %@",self.recvData);
+//    DebugLog(@"Delegate recv data %@",self.recvData);
 //    
 //
 //
@@ -138,7 +139,7 @@
                 }
             } else {
                 
-                NSLog(@"download task canceled");
+                DebugLog(@"download task canceled");
                 
             }
             
@@ -181,7 +182,7 @@
             
             NSMutableString *str = [[NSMutableString alloc] initWithData:self.recvData encoding:NSUTF8StringEncoding];
             
-            NSLog(@"data string: %@",str);
+            DebugLog(@"data string: %@",str);
             
             NSError *error1=nil;
             NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:self.recvData options:NSJSONReadingMutableLeaves error:&error1];
@@ -218,7 +219,7 @@
 }
 - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler {
     
-    NSLog(@"Delegate recv response: %@",response);
+    DebugLog(@"Delegate recv response: %@",response);
     
     if (self.isDownloadTask) {
         

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov