Skip to content

Wrong comparison of strings #27

@kuramayoko10

Description

@kuramayoko10

the method videoInput::getDeviceIDFromName(char * name) is implemented incorrectly. It is comparing two pointers (char*) instead of strings.

Is order to solve this, simply use the c function strcmp(char*,char*) like so:

int videoInput::getDeviceIDFromName(char * name) {
    if (listDevices(true) == 0) return -1;
    int deviceID = -1;
    for (int i = 0; i < VI_MAX_CAMERAS; i++) {
        if (strcmp(deviceNames[i], name) == 0) {
            deviceID = i;
            break;
        }
    }
    return deviceID;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions