-// ANNA - Anna is Not 'N' Anymore
+// ANNA - Anna is Not Nothingness Anymore
//
// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
//
-// https://bitbucket.org/testillano/anna
+// http://redmine.teslayout.com/projects/anna-suite
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
-// * Neither the name of Google Inc. nor the names of its
+// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
return result;
}
-const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, Integer64& value)
+const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, S64& value)
throw(RuntimeException) {
- const Integer64 backup(value);
+ const S64 backup(value);
const Variable* result = insert(name, id, a_variables, value);
value = backup;
return result;
if(variable == NULL)
throw RuntimeException(functions::asString("Id %d is not defined", id), ANNA_FILE_LOCATION);
- switch(variable->isNull()) {
- case true:
-
+ if(variable->isNull()) {
if(isNull == false) a_nullCounter --;
-
- break;
- case false:
-
+ }
+ else {
if(isNull == true) a_nullCounter ++;
-
- break;
}
variable->setNull(isNull);
void comm::CompatCodec::setNull(const comm::Variable* variable, const bool isNull)
throw() {
- switch(variable->isNull()) {
- case true:
-
+ if(variable->isNull()) {
if(isNull == false) a_nullCounter --;
-
- break;
- case false:
-
+ }
+ else {
if(isNull == true) a_nullCounter ++;
-
- break;
}
const_cast <comm::Variable*>(variable)->setNull(isNull);
//-----------------------------------------------------------------------
const DataBlock& comm::CompatCodec::code()
throw(RuntimeException) {
- register unsigned char c(0);
+ unsigned char c(0);
iterator ii;
iterator maxii(a_variables.end());
- register Variable* variable;
+ Variable* variable;
int stringLen;
const char* string;
- char aux [sizeof(Integer64)];
+ char aux [sizeof(S64)];
if(a_scramble == true) // (1)
while(c == 0) c = rand() % 0xff;
break;
case Variable::Type::Integer64:
self += variable->codec();
- self.append(comm::functions::codeInteger64(aux, variable->getInteger64()), sizeof(Integer64));
+ self.append(comm::functions::codeInteger64(aux, variable->getInteger64()), sizeof(S64));
break;
case Variable::Type::Boolean:
self.append(comm::functions::codeShort(aux, variable->getId()), sizeof(short int)); // (3)
self += codec;
}
break;
+ default: break;
}
}
char* data = const_cast <char*>(self.getData());
int size = self.getSize();
- for(register int i = 1, key = data [0]; i < size; i ++)
+ for(int i = 1, key = data [0]; i < size; i ++)
data [i] ^= key ++;
}
throw RuntimeException("Can not decode an empty DataBlock", ANNA_FILE_LOCATION);
if(data [0] != 0)
- for(register int i = 1, key(data [0]); i < size; i ++)
+ for(int i = 1, key(data [0]); i < size; i ++)
const_cast <char*>(data)[i] ^= key ++;
LOGDEBUG(Logger::write(Logger::Debug, "comm::CompatCodec::decode", dataBlock, ANNA_FILE_LOCATION));
break;
case Variable::Type::Integer64:
variable->setValue(comm::functions::decodeInteger64(++ data));
- data += sizeof(Integer64);
+ data += sizeof(S64);
break;
case Variable::Type::Boolean:
variable->setBoolean((*data & 0x80) ? true : false);
break;
case Variable::Type::Integer64:
variable->setValue(comm::functions::decodeInteger64(++ data));
- data += sizeof(Integer64);
+ data += sizeof(S64);
break;
case Variable::Type::Boolean:
variable->setBoolean((*data & 0x80) ? true : false);
comm::Variable* comm::CompatCodec::VariableContainer::find(const int id)
throw() {
- for(register int ii = 0; ii < a_size; ii ++) {
+ for(int ii = 0; ii < a_size; ii ++) {
if(a_variables [ii]->getId() == id)
return a_variables [ii];
}
const comm::Variable* comm::CompatCodec::VariableContainer::find(const int id) const
throw() {
- for(register int ii = 0; ii < a_size; ii ++) {
+ for(int ii = 0; ii < a_size; ii ++) {
if(a_variables [ii]->getId() == id)
return a_variables [ii];
}