ofTheo / videoInput

A video capture library for windows.
http://muonics.net/school/spring05/videoInput/
358 stars 176 forks source link

Wrong comparison of strings #27

Open kuramayoko10 opened 9 years ago

kuramayoko10 commented 9 years ago

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;
}
MIvanchev commented 6 years ago

This issue is a clone of #20.

ofTheo commented 6 years ago

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

MIvanchev commented 6 years ago

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