Browse Source

+ some variant stuff fixed and added

florian 20 years ago
parent
commit
74c89e2b87
2 changed files with 16 additions and 8 deletions
  1. 6 4
      rtl/inc/variant.inc
  2. 10 4
      rtl/objpas/varutils.inc

+ 6 - 4
rtl/inc/variant.inc

@@ -24,7 +24,6 @@ procedure invalidvariantop;
   end;
   end;
 
 
 procedure vardisperror;
 procedure vardisperror;
-
   begin
   begin
      HandleErrorFrame(222,get_frame);
      HandleErrorFrame(222,get_frame);
   end;
   end;
@@ -95,13 +94,13 @@ function fpc_dynarray_to_variant(dynarr : pointer;typeinfo : pointer) : variant;
 
 
 function fpc_variant_to_interface(const v : variant) : iinterface;compilerproc;
 function fpc_variant_to_interface(const v : variant) : iinterface;compilerproc;
   begin
   begin
-        variantmanager.vartointf(result,v);
+    variantmanager.vartointf(result,v);
   end;
   end;
 
 
 
 
 function fpc_interface_to_variant(const i : iinterface) : variant;compilerproc;
 function fpc_interface_to_variant(const i : iinterface) : variant;compilerproc;
   begin
   begin
-        variantmanager.varfromintf(result,i);
+    variantmanager.varfromintf(result,i);
   end;
   end;
 
 
 
 
@@ -595,7 +594,10 @@ procedure initvariantmanager;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.24  2005-02-14 17:13:29  peter
+  Revision 1.25  2005-02-24 22:36:36  florian
+    + some variant stuff fixed and added
+
+  Revision 1.24  2005/02/14 17:13:29  peter
     * truncate log
     * truncate log
 
 
   Revision 1.23  2005/02/01 20:22:24  florian
   Revision 1.23  2005/02/01 20:22:24  florian

+ 10 - 4
rtl/objpas/varutils.inc

@@ -638,7 +638,7 @@ begin
   Result:=CheckVarArray(psa);
   Result:=CheckVarArray(psa);
   if Result<>VAR_OK then
   if Result<>VAR_OK then
     exit;
     exit;
-  Inc(psa^.LockCount);
+  InterlockedIncrement(psa^.LockCount);
 end;
 end;
 
 
 Function SafeArrayUnlock(psa: PVarArray): HRESULT;stdcall;
 Function SafeArrayUnlock(psa: PVarArray): HRESULT;stdcall;
@@ -646,8 +646,11 @@ begin
   Result:=CheckVarArray(psa);
   Result:=CheckVarArray(psa);
   if (Result<>VAR_OK) then
   if (Result<>VAR_OK) then
     exit;
     exit;
-  If (psa^.LockCount>0) then
-    Dec(psa^.LockCount);
+  if InterlockedDecrement(psa^.LockCount)<0 then
+    begin
+      InterlockedIncrement(psa^.LockCount);
+      result:=VAR_UNEXPECTED;
+    end;
 end;
 end;
 
 
 Function SafeArrayGetElement(psa: PVarArray; Indices: PVarArrayCoorArray;
 Function SafeArrayGetElement(psa: PVarArray; Indices: PVarArrayCoorArray;
@@ -712,7 +715,10 @@ end;
 {$endif HASVARIANT}
 {$endif HASVARIANT}
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2005-02-14 17:13:31  peter
+  Revision 1.20  2005-02-24 22:36:36  florian
+    + some variant stuff fixed and added
+
+  Revision 1.19  2005/02/14 17:13:31  peter
     * truncate log
     * truncate log
 
 
   Revision 1.18  2005/02/08 21:17:25  florian
   Revision 1.18  2005/02/08 21:17:25  florian