author | Martin Trojer <martin.trojer@nokia.com> |
Fri, 15 Jan 2010 09:07:44 +0000 | |
changeset 34 | 92d87f2e53c2 |
permissions | -rwxr-xr-x |
34
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
1 |
/* |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
4 |
* |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU Lesser General Public License as published by |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
8 |
* (at your option) any later version. |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
9 |
* |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
13 |
* GNU Lesser General Public License for more details. |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
14 |
* |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU Lesser General Public License |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
18 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
19 |
#include <cassert> |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
20 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
21 |
#include "filefragment.h" |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
22 |
#include "outputfile.h" |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
23 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
24 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
25 |
FileFragmentData::~FileFragmentData(){ |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
26 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
27 |
} |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
28 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
29 |
FileFragmentOwner::~FileFragmentOwner(){ |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
30 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
31 |
} |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
32 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
33 |
FileFragment::~FileFragment(){ |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
34 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
35 |
} |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
36 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
37 |
void FileFragment::Write(OutputFile * aFile){ |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
38 |
FileFragmentData aData; |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
39 |
iOwner->GetFileFragmentData(aData); |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
40 |
assert(aData.GetSize() == iSize); |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
41 |
aFile->Write(iOffset, iSize, aData.GetData()); |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
42 |
iOwner->DeleteFileFragmentData(); |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
43 |
} |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
44 |
|
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
45 |
void FileFragmentOwner::AddData(OutputFile & aOutputFile){ |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
46 |
const FileFragment & aFileFrag = aOutputFile.GetFileFragment(this); |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
47 |
SetOffset(aFileFrag.GetOffset()); |
92d87f2e53c2
Added ELF4ROM and e32test-driver
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
48 |
} |