libopenraw
rw2container.cpp
1 /*
2  * libopenraw - rw2container.cpp
3  *
4  * Copyright (C) 2011-2017 Hubert Figuière
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <libopenraw/debug.h>
22 
23 #include "trace.hpp"
24 #include "rw2container.hpp"
25 
26 using namespace Debug;
27 
28 namespace OpenRaw {
29 
30 namespace Internals {
31 
32 Rw2Container::Rw2Container(const IO::Stream::Ptr &_file, off_t _offset)
33  : IfdFileContainer(_file, _offset), subtype_(0)
34 {
35 }
36 
38 {
39 }
40 
42 {
43  if (len < 4) {
44  // we need at least 4 bytes to check
45  return ENDIAN_NULL;
46  }
47  if ((p[0] == 'I') && (p[1] == 'I')) {
48  if ((p[2] == 'U') && (p[3] == 0)) {
49 
50  LOGDBG1("Identified EL RW2 file.\n");
51  return ENDIAN_LITTLE;
52  }
53  }
54 
55  LOGERR("Unidentified RW2 file\n");
56 
57  return ENDIAN_NULL;
58 }
59 }
60 }
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30
Definition: trace.cpp:30
virtual IfdFileContainer::EndianType isMagicHeader(const char *p, int len) override