Ejemplo n.º 1
0
static bool
_parcHashMapEntry_IsValid(_PARCHashMapEntry *hashEntry)
{
    bool result = false;

    if (hashEntry) {
        if (parcObject_IsValid(hashEntry->key)) {
            if (parcObject_IsValid(hashEntry->value)) {
                result = true;
            }
        }
    }

    return result;
}
Ejemplo n.º 2
0
bool
parcHashMap_IsValid(const PARCHashMap *map)
{
    bool result = false;

    if (map != NULL) {
        if (parcObject_IsValid(map)) {
            result = true;

            for (unsigned int i = 0; i < map->capacity; i++) {
                if (map->buckets[i] != NULL) {
                    if (parcLinkedList_IsValid(map->buckets[i]) == false) {
                        result = false;
                        break;
                    }
                }
            }
        }
    }

    return result;
}
Ejemplo n.º 3
0
static inline char *
_parcBuffer_CheckValidity(const PARCBuffer *buffer)
{
    char *result = NULL;

    if (buffer != NULL) {
        if (parcObject_IsValid(buffer)) {
            if (parcByteArray_IsValid(buffer->array)) {
                // 0 <= mark <= position <= limit <= capacity
                if (_markIsDiscarded(buffer) || buffer->mark <= buffer->position) {
                    if (buffer->position <= buffer->limit) {
                        if (buffer->limit <= buffer->capacity) {
                            if ((buffer->arrayOffset + buffer->capacity) <= parcByteArray_Capacity(buffer->array)) {
                                result = NULL;
                            } else {
                                result = "PARCBuffer offset+capacity exceeds the capacity of the underlying PARCByteArray";
                            }
                        } else {
                            result = "PARCBuffer limit exceeds the capacity.";
                        }
                    } else {
                        result = "PARCBuffer position exceeds the limit.";
                    }
                } else {
                    result = "PARCBuffer mark exceeds the current position";
                }
            } else {
                result = "PARCBuffer underlying PARCByteArray is invalid";
            }
        } else {
            result = "PARCBuffer is an invalid PARCObject.";
        }
    } else {
        result = "PARCBuffer is NULL";
    }

    return result;
}
Ejemplo n.º 4
0
bool
parcBuffer_IsValid(const PARCBuffer *buffer)
{
    bool result = false;

    if (buffer != NULL) {
        if (parcObject_IsValid(buffer)) {
            if (parcByteArray_IsValid(buffer->array)) {
                // 0 <= mark <= position <= limit <= capacity
                if (_markIsDiscarded(buffer) || buffer->mark <= buffer->position) {
                    if (buffer->position <= buffer->limit) {
                        if (buffer->limit <= buffer->capacity) {
                            if ((buffer->arrayOffset + buffer->capacity) <= parcByteArray_Capacity(buffer->array)) {
                                result = true;
                            }
                        }
                    }
                }
            }
        }
    }

    return result;
}