Edits
[iotcloud.git] / version2 / src / C / Transaction.cc
index 51fcbf6b55a1863f99e72b03bfb68f8f49b4357d..77c3590f5689bd1e467cbe5d165c8191ba768157 100644 (file)
@@ -24,7 +24,7 @@ Transaction::Transaction() :
 }
 
 void Transaction::addPartEncode(TransactionPart *newPart) {
-       TransactionPart * old=parts->setExpand(newPart->getPartNumber(), newPart);
+       TransactionPart *old = parts->setExpand(newPart->getPartNumber(), newPart);
        if (old == NULL)
                partCount++;
        partsPendingSend->add(newPart->getPartNumber());
@@ -54,7 +54,7 @@ void Transaction::addPartDecode(TransactionPart *newPart) {
        TransactionPart *previouslySeenPart = parts->setExpand(newPart->getPartNumber(), newPart);
        if (previouslySeenPart == NULL)
                partCount++;
-       
+
        if (previouslySeenPart != NULL) {
                // Set dead the old one since the new one is a rescued version of this part
                previouslySeenPart->setDead();
@@ -101,10 +101,10 @@ int64_t Transaction::getSequenceNumber() {
 
 void Transaction::setSequenceNumber(int64_t _sequenceNumber) {
        sequenceNumber = _sequenceNumber;
-       
+
        for (int32_t i = 0; i < parts->size(); i++) {
-               TransactionPart * tp = parts->get(i);
-               if (tp !=NULL)
+               TransactionPart *tp = parts->get(i);
+               if (tp != NULL)
                        tp->setSequenceNumber(sequenceNumber);
        }
 }
@@ -161,9 +161,9 @@ void Transaction::removeSentParts(Vector<int32_t> *sentParts) {
        nextPartToSend = 0;
        bool changed = false;
        uint lastusedindex = 0;
-       for(uint i=0; i < partsPendingSend->size(); i++) {
+       for (uint i = 0; i < partsPendingSend->size(); i++) {
                int32_t parti = partsPendingSend->get(i);
-               for(uint j=0; j < sentParts->size(); j++) {
+               for (uint j = 0; j < sentParts->size(); j++) {
                        int32_t partj = sentParts->get(j);
                        if (parti == partj) {
                                changed = true;
@@ -171,7 +171,7 @@ void Transaction::removeSentParts(Vector<int32_t> *sentParts) {
                        }
                }
                partsPendingSend->set(lastusedindex++, parti);
-       NextElement:
+NextElement:
                ;
        }
        if (changed) {
@@ -214,7 +214,7 @@ void Transaction::setDead() {
                // Set dead
                isDead = true;
                // Make all the parts of this transaction dead
-               for (int32_t partNumber = 0; partNumber < parts->size(); partNumber ++) {
+               for (int32_t partNumber = 0; partNumber < parts->size(); partNumber++) {
                        TransactionPart *part = parts->get(partNumber);
                        if (part != NULL)
                                part->setDead();
@@ -265,8 +265,8 @@ void Transaction::decodeTransactionData() {
 }
 
 bool Transaction::evaluateGuard(Hashtable<IoTString *, KeyValue *> *committedKeyValueTable, Hashtable<IoTString *, KeyValue *> *speculatedKeyValueTable, Hashtable<IoTString *, KeyValue *> *pendingTransactionSpeculatedKeyValueTable) {
-       SetIterator<KeyValue *>* kvit=keyValueGuardSet->iterator();
-       while(kvit->hasNext()) {
+       SetIterator<KeyValue *> *kvit = keyValueGuardSet->iterator();
+       while (kvit->hasNext()) {
                KeyValue *kvGuard = kvit->next();
                // First check if the key is in the speculative table, this is the value of the latest assumption
                KeyValue *kv = NULL;