0024023: Revamp the OCCT Handle -- downcast (automatic)
[occt.git] / src / TDataStd / TDataStd_ByteArray.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 017c6c8..3d824ac
@@ -1,8 +1,17 @@
-// File:        TDataStd_ByteArray.cxx
-// Created:     May 29 11:40:00 2007
-// Author:      Vlad Romashko
-//             <vladislav.romashko@opencascade.com>
-//Copyright:    Open CasCade SA 2007
+// Created on: 2007-05-29
+// Created by: Vlad Romashko
+// Copyright (c) 2007-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 #include <TDataStd_ByteArray.ixx>
 #include <TDataStd_DeltaOnModificationOfByteArray.hxx>
@@ -65,6 +74,8 @@ Handle(TDataStd_ByteArray) TDataStd_ByteArray::Set(const TDF_Label&       label,
 void TDataStd_ByteArray::SetValue (const Standard_Integer index,
                                   const Standard_Byte value) 
 {
+  if (myValue.IsNull()) 
+    return;
   if (value == myValue->Value(index))
     return;
   Backup();
@@ -227,7 +238,7 @@ Handle(TDF_DeltaOnModification) TDataStd_ByteArray::DeltaOnModification
 (const Handle(TDF_Attribute)& OldAttribute) const
 {
   if(myIsDelta)
-    return new TDataStd_DeltaOnModificationOfByteArray(*((Handle(TDataStd_ByteArray)*)&OldAttribute));
+    return new TDataStd_DeltaOnModificationOfByteArray(Handle(TDataStd_ByteArray)::DownCast (OldAttribute));
   else return new TDF_DefaultDeltaOnModification(OldAttribute);
 }