diff --git a/veejay-current/veejay-server/libstream/v4l2utils.c b/veejay-current/veejay-server/libstream/v4l2utils.c index 0e87cdec..0e3cc9cb 100644 --- a/veejay-current/veejay-server/libstream/v4l2utils.c +++ b/veejay-current/veejay-server/libstream/v4l2utils.c @@ -1722,10 +1722,19 @@ char **v4l2_get_device_list() memset( files, 0, sizeof(char*) * (n_devices+1)); for( i = 0;i < n_devices; i ++ ) { - files[i] = (char*) malloc(sizeof(char) * (strlen(list[i]) + 5)); - sprintf(files[i],"%s%s",v4lprefix, list[i]); - veejay_msg(VEEJAY_MSG_DEBUG, "Found %s", files[i]); - } + char tmp[1024]; + + snprintf(tmp, sizeof(tmp) - 1, "%03dDevice %02d%03d%s%s", + 9, // 'Device xx' + i, // 'device num' + (5 + strlen(list[i])), //@ '/dev/' + device + v4lprefix, // '/dev/' + list[i] // 'video0' + ); + files[i] = strdup(tmp); + veejay_msg(VEEJAY_MSG_DEBUG, "Found '%s'", list[i]); + } + files[n_devices] = NULL; return files; } diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index ae95d917..4c2364da 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -237,7 +237,7 @@ char *vj_tag_scan_devices( void ) const char *default_str = "000000"; int num = 0; int i; - int len = 6; + int len = 0; #ifdef HAVE_UNICAP char **device_list = vj_unicap_get_devices(unicap_data_, &num); #else @@ -254,14 +254,16 @@ char *vj_tag_scan_devices( void ) for( i = 0; device_list[i] != NULL ;i++ ) len += strlen( device_list[i] ); - char *n = (char*) vj_calloc(sizeof(char) * (len+1) ); + char *n = (char*) vj_calloc(sizeof(char) * (6 + len) ); char *p = n + 6; - sprintf(n, "%06d", (len-6) ); + sprintf(n, "%06d", len ); for( i = 0; device_list[i] != NULL ;i++ ) { - int str_len = strlen(device_list[i]); - veejay_memcpy( p, device_list[i], str_len); + char tmp[1024]; + snprintf( tmp, sizeof(tmp)-1, "%s", device_list[i] ); + int str_len = strlen(tmp); + strncpy( p, tmp, str_len ); p += str_len; free(device_list[i]); } diff --git a/veejay-current/veejay-server/libvjmem/memcpy.c b/veejay-current/veejay-server/libvjmem/memcpy.c index 4553e28b..d57bb097 100644 --- a/veejay-current/veejay-server/libvjmem/memcpy.c +++ b/veejay-current/veejay-server/libvjmem/memcpy.c @@ -209,11 +209,11 @@ static inline unsigned long long int rdtsc() #define small_memset(to,val,n) memset(to,val,n) char *veejay_strncpy( char *dest, const char *src, size_t n ) { -// dest[n-1] = '\0'; return strncpy( dest,src, n-1 ); } -char *veejay_strncat( char *s1, char *s2, size_t n ) { -// s2[n] = '\0'; + +char *veejay_strncat( char *s1, char *s2, size_t n ) +{ return strncat( s1,s2, n); } diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index 40bf503b..eb160b2f 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -9051,49 +9051,6 @@ void vj_event_send_editlist ( void *ptr, const char format[], va_list ap ) free(s_print_buf); } -void vj_event_send_devices ( void *ptr, const char format[], va_list ap ) -{ - char str[255]; - struct dirent **namelist; - int n_dev = 0; - int n; - char device_list[512]; - char useable_devices[2]; - int *args = NULL; - veejay_t *v = (veejay_t*)ptr; - P_A(args,str,format,ap); - veejay_memset(device_list,0,512); - - n = scandir(str,&namelist,0,alphasort); - if( n<= 0) - { - veejay_msg(VEEJAY_MSG_ERROR, "No device information in [%s]",str); - SEND_MSG(v,"0000"); - return; - } - - - while(n--) - { - if( strncmp(namelist[n]->d_name, "video", 4)==0) - { - FILE *fd; - char filename[300]; - sprintf(filename,"%s%s",str,namelist[n]->d_name); - fd = fopen( filename, "r"); - if(fd) - { - fclose(fd); - } - } - } - sprintf(useable_devices,"%02d", n_dev); - - APPEND_MSG( device_list, useable_devices ); - SEND_MSG(v,device_list); - -} - void vj_event_send_frame ( void *ptr, const char format[], va_list ap ) { veejay_t *v = (veejay_t*) ptr;