mirror of https://gitee.com/bigwinds/arangodb
cppcheck
This commit is contained in:
parent
44ad4eea48
commit
9fc03ec85f
|
@ -646,15 +646,19 @@ int TRI_MoveMarkerVocShaper (TRI_shaper_t* s,
|
|||
if (marker->_type == TRI_DF_MARKER_SHAPE) {
|
||||
char* p = ((char*) marker) + sizeof(TRI_df_shape_marker_t);
|
||||
TRI_shape_t* l = (TRI_shape_t*) p;
|
||||
void* f;
|
||||
|
||||
MUTEX_LOCKER(shaper->_shapeLock);
|
||||
|
||||
// remove the old marker
|
||||
// and re-insert the marker with the new pointer
|
||||
void* f = TRI_InsertKeyAssociativeSynced(&shaper->_shapeIds, &l->_sid, l, true);
|
||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_shapeIds, &l->_sid, l, true);
|
||||
// note: this assertion is wrong if the recovery collects the shape in the WAL and it has not been transferred
|
||||
// into the collection datafile yet
|
||||
// TRI_ASSERT(f != nullptr);
|
||||
if (f != nullptr) {
|
||||
LOG_TRACE("shape already existed in shape ids array");
|
||||
}
|
||||
|
||||
// same for the shape dictionary
|
||||
// delete and re-insert
|
||||
|
@ -662,6 +666,9 @@ int TRI_MoveMarkerVocShaper (TRI_shaper_t* s,
|
|||
// note: this assertion is wrong if the recovery collects the shape in the WAL and it has not been transferred
|
||||
// into the collection datafile yet
|
||||
// TRI_ASSERT(f != nullptr);
|
||||
if (f != nullptr) {
|
||||
LOG_TRACE("shape already existed in shape dictionary");
|
||||
}
|
||||
}
|
||||
else if (marker->_type == TRI_DF_MARKER_ATTRIBUTE) {
|
||||
TRI_df_attribute_marker_t* m = (TRI_df_attribute_marker_t*) marker;
|
||||
|
|
|
@ -425,9 +425,6 @@ int Slots::closeLogfile (Slot::TickType& lastCommittedTick,
|
|||
return res;
|
||||
}
|
||||
|
||||
// advance to next slot
|
||||
slot = &_slots[_handoutIndex];
|
||||
|
||||
_logfileManager->setLogfileOpen(_logfile);
|
||||
worked = true;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
|
|
@ -606,6 +606,8 @@ namespace triagens {
|
|||
if (len >= (SIZE_MAX - 1) / 6) {
|
||||
THROW_OUT_OF_MEMORY_ERROR();
|
||||
}
|
||||
|
||||
bool corrupted = false;
|
||||
|
||||
char * buffer = new char [6 * len + 1];
|
||||
char * qtr = buffer;
|
||||
|
@ -717,12 +719,14 @@ namespace triagens {
|
|||
// corrupted unicode
|
||||
else {
|
||||
*qtr = *ptr;
|
||||
corrupted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// corrupted unicode
|
||||
else {
|
||||
*qtr = *ptr;
|
||||
corrupted = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -744,21 +748,25 @@ namespace triagens {
|
|||
// corrupted unicode
|
||||
else {
|
||||
*qtr = *ptr;
|
||||
corrupted = true;
|
||||
}
|
||||
}
|
||||
// corrupted unicode
|
||||
else {
|
||||
*qtr = *ptr;
|
||||
corrupted = true;
|
||||
}
|
||||
}
|
||||
// corrupted unicode
|
||||
else {
|
||||
*qtr = *ptr;
|
||||
corrupted = true;
|
||||
}
|
||||
}
|
||||
// corrupted unicode
|
||||
else {
|
||||
*qtr = *ptr;
|
||||
corrupted = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -779,6 +787,10 @@ namespace triagens {
|
|||
|
||||
delete[] buffer;
|
||||
|
||||
if (corrupted) {
|
||||
LOG_WARNING("escaped corrupted unicode string");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2984,7 +2996,6 @@ namespace triagens {
|
|||
string ret;
|
||||
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
unsigned char const* bytesToEncode = reinterpret_cast<unsigned char const*>(in.c_str());
|
||||
size_t in_len = in.size();
|
||||
|
@ -3007,7 +3018,7 @@ namespace triagens {
|
|||
}
|
||||
|
||||
if (i != 0) {
|
||||
for(j = i; j < 3; j++) {
|
||||
for(int j = i; j < 3; j++) {
|
||||
charArray3[j] = '\0';
|
||||
}
|
||||
|
||||
|
@ -3016,7 +3027,7 @@ namespace triagens {
|
|||
charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6);
|
||||
charArray4[3] = charArray3[2] & 0x3f;
|
||||
|
||||
for (j = 0; (j < i + 1); j++) {
|
||||
for (int j = 0; (j < i + 1); j++) {
|
||||
ret += BASE64_CHARS[charArray4[j]];
|
||||
}
|
||||
|
||||
|
@ -3037,7 +3048,6 @@ namespace triagens {
|
|||
string ret;
|
||||
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int inp = 0;
|
||||
|
||||
int in_len = (int) source.size();
|
||||
|
@ -3065,11 +3075,11 @@ namespace triagens {
|
|||
}
|
||||
|
||||
if (i) {
|
||||
for (j = i; j < 4; j++) {
|
||||
for (int j = i; j < 4; j++) {
|
||||
charArray4[j] = 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
charArray4[j] = BASE64_REVS[charArray4[j]];
|
||||
}
|
||||
|
||||
|
@ -3077,7 +3087,7 @@ namespace triagens {
|
|||
charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
|
||||
charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3];
|
||||
|
||||
for (j = 0; j < i - 1; j++) {
|
||||
for (int j = 0; j < i - 1; j++) {
|
||||
ret += charArray3[j];
|
||||
}
|
||||
}
|
||||
|
@ -3223,11 +3233,10 @@ namespace triagens {
|
|||
}
|
||||
|
||||
size_t k = 0;
|
||||
size_t delPos;
|
||||
size_t offSet = 0;
|
||||
|
||||
while (true) {
|
||||
delPos = sourceStr.find(delimiter, offSet);
|
||||
size_t delPos = sourceStr.find(delimiter, offSet);
|
||||
|
||||
if ((delPos == sourceStr.npos) || (delPos >= sourceLength) || (offSet >= sourceLength)) {
|
||||
return sourceStr.substr(offSet);
|
||||
|
|
|
@ -1342,11 +1342,10 @@ TRI_vector_t* TRI_BufferLogging (TRI_log_level_e level, uint64_t start, bool use
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_FreeBufferLogging (TRI_vector_t* buffer) {
|
||||
TRI_log_buffer_t* buf;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < buffer->_length; ++i) {
|
||||
buf = TRI_AtVector(buffer, i);
|
||||
TRI_log_buffer_t* buf = TRI_AtVector(buffer, i);
|
||||
|
||||
TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, buf->_text);
|
||||
}
|
||||
|
|
|
@ -48,11 +48,6 @@ using namespace triagens::rest;
|
|||
// --SECTION-- public static functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialise
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -285,25 +280,12 @@ void Version::getJson (TRI_memory_zone_t* zone, TRI_json_t* dst) {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public static variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::map<std::string, std::string> Version::Values;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
|
||||
|
|
|
@ -51,34 +51,20 @@ namespace triagens {
|
|||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create the version information
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Version ();
|
||||
Version (const Version&);
|
||||
Version& operator= (const Version&);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Version () = delete;
|
||||
Version (Version const&) = delete;
|
||||
Version& operator= (Version const&) = delete;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public static functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -171,27 +157,14 @@ namespace triagens {
|
|||
|
||||
static void getJson (struct TRI_memory_zone_s*, struct TRI_json_s*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public static variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
static std::map<std::string, std::string> Values;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue