浏览代码

Merged revisions 1028-1030,1033-1034,1049-1051 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@1052 -

peter 20 年之前
父节点
当前提交
4e44b18abe
共有 7 个文件被更改,包括 94 次插入14 次删除
  1. 12 10
      fcl/inc/registry.pp
  2. 32 0
      fcl/inc/syncob.inc
  3. 12 0
      fcl/inc/syncobh.inc
  4. 16 0
      packages/extra/zlib/zlib.pp
  5. 5 0
      rtl/objpas/sysutils/sysinth.inc
  6. 12 4
      rtl/unix/cwstring.pp
  7. 5 0
      rtl/win32/sysutils.pp

+ 12 - 10
fcl/inc/registry.pp

@@ -328,17 +328,19 @@ Var
 
 begin
   GetDataInfo(Name,Info);
-  If Not (Info.RegData in [rdString,rdExpandString]) then
-    Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
-  SetLength(Result,Info.DataSize);
-  If Info.DataSize>0 then
+  if info.datasize>0 then
     begin
-    If StringSizeIncludesNull then
-      SetLength(Result, Info.DataSize-1)
-    else
-      SetLength(Result, Info.DataSize);
-    GetData(Name,@Result[1],Info.DataSize,Info.RegData);
-    end;
+     If Not (Info.RegData in [rdString,rdExpandString]) then
+       Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
+     SetLength(Result,Info.DataSize);
+     If StringSizeIncludesNull then
+       SetLength(Result, Info.DataSize-1)
+     else
+       SetLength(Result, Info.DataSize);
+     GetData(Name,@Result[1],Info.DataSize,Info.RegData);
+   end
+  else
+    result:='';
 end;
 
 function TRegistry.ReadTime(const Name: string): TDateTime;

+ 32 - 0
fcl/inc/syncob.inc

@@ -30,3 +30,35 @@ procedure TCriticalSection.Leave;
 begin
   Release;
 end;
+
+constructor TMultiReadExclusiveWriteSynchronizer.Create;
+
+begin
+  Crit:=tcriticalsection.create;
+end;
+
+destructor TMultiReadExclusiveWriteSynchronizer.Destroy;
+begin
+  Crit.free;
+end;
+
+procedure  TMultiReadExclusiveWriteSynchronizer.Beginwrite;
+begin
+  Crit.acquire;
+end;
+
+procedure  TMultiReadExclusiveWriteSynchronizer.Endwrite;
+begin
+  Crit.release;
+end;
+
+procedure  TMultiReadExclusiveWriteSynchronizer.Beginread;
+begin
+  Crit.acquire;
+end;
+
+procedure  TMultiReadExclusiveWriteSynchronizer.Endread;
+begin
+  Crit.acquire;
+end;
+

+ 12 - 0
fcl/inc/syncobh.inc

@@ -62,3 +62,15 @@ type
    TSimpleEvent = class(TEventObject)
       constructor Create;
    end;
+
+   TMultiReadExclusiveWriteSynchronizer = class
+   private
+      crit:TCriticalsection;
+   public
+      constructor Create; virtual;
+      destructor  Destroy; override;
+      procedure Beginwrite;
+      procedure Endwrite;
+      procedure Beginread;
+      procedure Endread;
+   end;

+ 16 - 0
packages/extra/zlib/zlib.pp

@@ -54,6 +54,7 @@ type
     adler : uLong;
     reserved : uLong;
   end;
+  TZStreamRec = TZStream;
   PZstream = ^TZStream;
   gzFile = pointer;
 
@@ -141,6 +142,8 @@ function zError(err:longint):string;
 function inflateSyncPoint(z:PZstream):longint;cdecl;external libz name 'inflateSyncPoint';
 function get_crc_table:pointer;cdecl;external libz name 'get_crc_table';
 
+function zlibAllocMem(AppData: Pointer; Items, Size: Integer): Pointer; cdecl;
+procedure zlibFreeMem(AppData, Block: Pointer);  cdecl;
 
 implementation
 
@@ -177,4 +180,17 @@ function zError(err:longint):string;
      zerror:=Strpas(zErrorpchar(err));
   end;
 
+function zlibAllocMem(AppData: Pointer; Items, Size: Integer): Pointer; cdecl;
+
+  begin
+    Result := AllocMem(Items * Size);
+  end;
+
+procedure zlibFreeMem(AppData, Block: Pointer);  cdecl;
+
+  begin
+    FreeMem(Block);
+  end;
+
+
 end.

+ 5 - 0
rtl/objpas/sysutils/sysinth.inc

@@ -129,6 +129,11 @@ Const
 
 type
   TSysLocale = record
+    { Delphi compat fields}
+    DefaultLCID,
+    PriLangID,
+    SubLangID  : Integer;
+
     case byte of
       { win32 names }
       1 : (FarEast: boolean; MiddleEast: Boolean);

+ 12 - 4
rtl/unix/cwstring.pp

@@ -57,6 +57,7 @@ var
 function towlower(__wc:wint_t):wint_t;cdecl;external libiconvname name 'towlower';
 function towupper(__wc:wint_t):wint_t;cdecl;external libiconvname name 'towupper';
 function wcscoll (__s1:pwchar_t; __s2:pwchar_t):cint;cdecl;external libiconvname name 'wcscoll';
+function strcoll (__s1:pchar; __s2:pchar):cint;cdecl;external libiconvname name 'strcoll';
 
 const
 {$ifdef linux}
@@ -227,11 +228,16 @@ function CompareTextWideString(const s1, s2 : WideString): PtrInt;
   begin
   end;
 
-Var
-  CWideStringManager : TWideStringManager;
 
-Procedure SetCWideStringManager;
+function StrCompAnsi(s1,s2 : PChar): PtrInt;
+  begin
+    result:=strcoll(s1,s2);
+  end;
+
 
+Procedure SetCWideStringManager;
+Var
+  CWideStringManager : TWideStringManager;
 begin
   CWideStringManager:=widestringmanager;
   With CWideStringManager do
@@ -250,7 +256,9 @@ begin
       LowerAnsiStringProc
       CompareStrAnsiStringProc
       CompareTextAnsiStringProc
-      StrCompAnsiStringProc
+      }
+      StrCompAnsiStringProc:=@StrCompAnsi;
+      {
       StrICompAnsiStringProc
       StrLCompAnsiStringProc
       StrLICompAnsiStringProc

+ 5 - 0
rtl/win32/sysutils.pp

@@ -653,6 +653,11 @@ begin
   old8087CW:=Get8087CW;
   SysLocale.MBCS:=GetSystemMetrics(SM_DBCSENABLED)<>0;
   SysLocale.RightToLeft:=GetSystemMetrics(SM_MIDEASTENABLED)<>0;
+  SysLocale.DefaultLCID := $0409;
+  SysLocale.PriLangID := LANG_ENGLISH;
+  SysLocale.SubLangID := SUBLANG_ENGLISH_US;
+  // probably needs update with getthreadlocale. post 2.0.2
+
   Set8087CW(old8087CW);
   InitAnsi;
   GetFormatSettings;