summaryrefslogtreecommitdiff
path: root/source/LCM/Hash.cpp
diff options
context:
space:
mode:
authorxmarvla <vlatko.markovic@seavus.com>2011-12-26 11:39:55 +0100
committerViktor Mladenovski <viktor.mladenovski@seavus.com>2012-05-25 14:40:23 +0200
commitf2be658909048b1050bf66c14324cccce852a931 (patch)
tree6d706961731e8dd2864581491ae4ca8fc6574359 /source/LCM/Hash.cpp
parent7500cbd59a6faa7dd69b278d7a02da2c8fa96060 (diff)
Flash tool cli cannot work with network path
Resolve problems in error handling for process file command when path to non-existing file is given as input paramter to LCDriver. Fix AStyle code formatting. ST-Ericsson ID: 402761 ST-Ericsson FOSS-OUT ID: NA Change-Id: Ia6539a7ebab97a078bc0d105b23b6a0545762194 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/43810 Reviewed-by: QABUILD Tested-by: Aleksandar GASOSKI <aleksandar.gasoski@seavus.com> Reviewed-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com> Tested-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com>
Diffstat (limited to 'source/LCM/Hash.cpp')
-rw-r--r--source/LCM/Hash.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/source/LCM/Hash.cpp b/source/LCM/Hash.cpp
index 4f5962c..7836604 100644
--- a/source/LCM/Hash.cpp
+++ b/source/LCM/Hash.cpp
@@ -23,21 +23,21 @@
**********************************************************************/
const uint32 red[16] = {
0,
- (0x1 << 16) ^(0x1021 << 0), \
- (0x2 << 16) ^(0x1021 << 1), \
- (0x3 << 16) ^(0x1021 << 1) ^(0x1021 << 0), \
- (0x4 << 16) ^(0x1021 << 2), \
- (0x5 << 16) ^(0x1021 << 2) ^(0x1021 << 0), \
- (0x6 << 16) ^(0x1021 << 2) ^(0x1021 << 1), \
- (0x7 << 16) ^(0x1021 << 2) ^(0x1021 << 1) ^(0x1021 << 0), \
- (0x8 << 16) ^(0x1021 << 3), \
- (0x9 << 16) ^(0x1021 << 3) ^(0x1021 << 0), \
- (0xa << 16) ^(0x1021 << 3) ^(0x1021 << 1), \
- (0xb << 16) ^(0x1021 << 3) ^(0x1021 << 1) ^(0x1021 << 0), \
- (0xc << 16) ^(0x1021 << 3) ^(0x1021 << 2), \
- (0xd << 16) ^(0x1021 << 3) ^(0x1021 << 2) ^(0x1021 << 0), \
- (0xe << 16) ^(0x1021 << 3) ^(0x1021 << 2) ^(0x1021 << 1), \
- (0xf << 16) ^(0x1021 << 3) ^(0x1021 << 2) ^(0x1021 << 1) ^(0x1021 << 0)
+ (0x1 << 16) ^ (0x1021 << 0), \
+ (0x2 << 16) ^ (0x1021 << 1), \
+ (0x3 << 16) ^ (0x1021 << 1) ^ (0x1021 << 0), \
+ (0x4 << 16) ^ (0x1021 << 2), \
+ (0x5 << 16) ^ (0x1021 << 2) ^ (0x1021 << 0), \
+ (0x6 << 16) ^ (0x1021 << 2) ^ (0x1021 << 1), \
+ (0x7 << 16) ^ (0x1021 << 2) ^ (0x1021 << 1) ^ (0x1021 << 0), \
+ (0x8 << 16) ^ (0x1021 << 3), \
+ (0x9 << 16) ^ (0x1021 << 3) ^ (0x1021 << 0), \
+ (0xa << 16) ^ (0x1021 << 3) ^ (0x1021 << 1), \
+ (0xb << 16) ^ (0x1021 << 3) ^ (0x1021 << 1) ^ (0x1021 << 0), \
+ (0xc << 16) ^ (0x1021 << 3) ^ (0x1021 << 2), \
+ (0xd << 16) ^ (0x1021 << 3) ^ (0x1021 << 2) ^ (0x1021 << 0), \
+ (0xe << 16) ^ (0x1021 << 3) ^ (0x1021 << 2) ^ (0x1021 << 1), \
+ (0xf << 16) ^ (0x1021 << 3) ^ (0x1021 << 2) ^ (0x1021 << 1) ^ (0x1021 << 0)
};
Hash::Hash()
@@ -93,6 +93,7 @@ void *Hash::WorkerThread(void *arg)
}
break;
+
case HASH_CRC16:
memset(request->Hash_p, 0, CRC16_LENGTH);
@@ -102,6 +103,7 @@ void *Hash::WorkerThread(void *arg)
}
break;
+
case HASH_SIMPLE_XOR:
request->Hash_p[0] = 0;
@@ -110,8 +112,10 @@ void *Hash::WorkerThread(void *arg)
}
break;
+
case HASH_NONE:
break;
+
default:
// unsupported hash type, nothing to do
delete request;
@@ -184,12 +188,12 @@ uint16 Hash::crc16(const uint8 *p, int count, uint16 crc_in)
register uint32 crc = crc_in;
while (--count >= 0) {
- crc = crc ^(uint8) * p++ << 8;
- crc ^= red[crc>>16];
+ crc = crc ^ (uint8) * p++ << 8;
+ crc ^= red[crc >> 16];
crc = (crc << 4);
- crc ^= red[crc>>16];
+ crc ^= red[crc >> 16];
crc = (crc << 4);
- crc ^= red[crc>>16];
+ crc ^= red[crc >> 16];
}