videoInput icon indicating copy to clipboard operation
videoInput copied to clipboard

Wrong comparison of strings

Open kuramayoko10 opened this issue 8 years ago • 3 comments

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;
}

kuramayoko10 avatar Oct 02 '15 20:10 kuramayoko10

This issue is a clone of #20.

MIvanchev avatar Nov 12 '17 14:11 MIvanchev

Hi apologies! Trying to get back on top of VI stuff If you would like to submit a PR I will merge it in.

All the best! Theo

ofTheo avatar Nov 13 '17 22:11 ofTheo

Sure thing, I'll hit you up with a PR =)

MIvanchev avatar Nov 15 '17 17:11 MIvanchev