Browse Source

Remove wrong close call after failed Reset

git-svn-id: trunk@29200 -
pierre 10 years ago
parent
commit
606b0a99c7
1 changed files with 17 additions and 20 deletions
  1. 17 20
      rtl/inc/charset.pp

+ 17 - 20
rtl/inc/charset.pp

@@ -73,15 +73,15 @@ unit charset;
     ) : punicodemap;overload;
     ) : punicodemap;overload;
     procedure registermapping(p : punicodemap);
     procedure registermapping(p : punicodemap);
     function registerbinarymapping(const directory,cpname : string):Boolean;
     function registerbinarymapping(const directory,cpname : string):Boolean;
-    function getmap(const s : string) : punicodemap; 
-    function getmap(cp : word) : punicodemap;   
+    function getmap(const s : string) : punicodemap;
+    function getmap(cp : word) : punicodemap;
     function mappingavailable(const s : string) : boolean;inline;
     function mappingavailable(const s : string) : boolean;inline;
     function mappingavailable(cp :word) : boolean;inline;
     function mappingavailable(cp :word) : boolean;inline;
     function getunicode(c : char;p : punicodemap) : tunicodechar;inline;
     function getunicode(c : char;p : punicodemap) : tunicodechar;inline;
     function getunicode(
     function getunicode(
       AAnsiStr : pansichar;
       AAnsiStr : pansichar;
       AAnsiLen : LongInt;
       AAnsiLen : LongInt;
-      AMap     : punicodemap; 
+      AMap     : punicodemap;
       ADest    : tunicodestring
       ADest    : tunicodestring
     ) : LongInt;
     ) : LongInt;
     function getascii(c : tunicodechar;p : punicodemap) : string;
     function getascii(c : tunicodechar;p : punicodemap) : string;
@@ -421,10 +421,7 @@ unit charset;
         Assign(f,filename);
         Assign(f,filename);
         Reset(f);
         Reset(f);
         if (IOResult<>0) then
         if (IOResult<>0) then
-          begin
-            Close(f);
-            exit;
-          end;
+          exit;
         locSize:=FileSize(f);
         locSize:=FileSize(f);
         if (locSize<SizeOf(TSerializedMapHeader)) then
         if (locSize<SizeOf(TSerializedMapHeader)) then
           begin
           begin
@@ -624,7 +621,7 @@ unit charset;
     function getunicode(
     function getunicode(
       AAnsiStr : pansichar;
       AAnsiStr : pansichar;
       AAnsiLen : LongInt;
       AAnsiLen : LongInt;
-      AMap     : punicodemap; 
+      AMap     : punicodemap;
       ADest    : tunicodestring
       ADest    : tunicodestring
     ) : LongInt;
     ) : LongInt;
 
 
@@ -632,11 +629,11 @@ unit charset;
          i, c, k, destLen : longint;
          i, c, k, destLen : longint;
          ps : pansichar;
          ps : pansichar;
          pd : ^tunicodechar;
          pd : ^tunicodechar;
-         
+
       begin
       begin
         if (AAnsiStr=nil) or (AAnsiLen<=0) then
         if (AAnsiStr=nil) or (AAnsiLen<=0) then
           exit(0);
           exit(0);
-        ps:=AAnsiStr;   
+        ps:=AAnsiStr;
         if (ADest=nil) then
         if (ADest=nil) then
           begin
           begin
             c:=AAnsiLen-1;
             c:=AAnsiLen-1;
@@ -651,12 +648,12 @@ unit charset;
                         Inc(ps);
                         Inc(ps);
                         i:=i+1;
                         i:=i+1;
                       end;
                       end;
-                  end;  
-                i:=i+1;  
+                  end;
+                i:=i+1;
                 Inc(ps);
                 Inc(ps);
                 destLen:=destLen+1;
                 destLen:=destLen+1;
-              end; 
-            exit(destLen);  
+              end;
+            exit(destLen);
           end;
           end;
 
 
         pd:=ADest;
         pd:=ADest;
@@ -668,7 +665,7 @@ unit charset;
               begin
               begin
                 if (AMap^.map[ord(ps^)].flag=umf_leadbyte) then
                 if (AMap^.map[ord(ps^)].flag=umf_leadbyte) then
                   begin
                   begin
-                    if (i<c) then 
+                    if (i<c) then
                       begin
                       begin
                         k:=(Ord(ps^)*256);
                         k:=(Ord(ps^)*256);
                         Inc(ps);
                         Inc(ps);
@@ -681,16 +678,16 @@ unit charset;
                       end
                       end
                     else
                     else
                       pd^:=UNKNOW_CHAR_W;
                       pd^:=UNKNOW_CHAR_W;
-                  end                       
-                else   
+                  end
+                else
                   pd^:=AMap^.map[ord(ps^)].unicode
                   pd^:=AMap^.map[ord(ps^)].unicode
-              end  
+              end
             else
             else
               pd^:=UNKNOW_CHAR_W;
               pd^:=UNKNOW_CHAR_W;
-            i:=i+1;  
+            i:=i+1;
             Inc(ps);
             Inc(ps);
             Inc(pd);
             Inc(pd);
-          end; 
+          end;
         result:=((PtrUInt(pd)-PtrUInt(ADest)) div SizeOf(tunicodechar));
         result:=((PtrUInt(pd)-PtrUInt(ADest)) div SizeOf(tunicodechar));
       end;
       end;