Skip to content

Failed to detect when body of function > 20 lines #20

@selena81792

Description

@selena81792

NormEZ did not warn about the length of this function, very sad

int	my_getnbr(char *str)
{
    int negative_multiplier;
    unsigned long long int storage;

    negative_multiplier = 1;
    storage = 0;
    while (*str && *str != '\0' && (*str == '+' || *str == '-')){
        if (*str == '-') negative_multiplier *= -1;
        str++;
    }
    while (*str && *str != '\0' && (*str >= '0' && *str <= '9')){
        if (storage > 214748364){
            return 0;
        }
        storage = storage*10 + *str-48;
        str++;
    }
    if (negative_multiplier == -1 && storage > 2147483648){
        return 0;
    } else if (negative_multiplier == 1 && storage > 2147483647){
        return 0;
    }
    storage *= negative_multiplier;
    return (storage);
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions