Re: revised direct sound capture patches
"Robert Reif" <reif(a)earthlink.net> wrote:
wineoss.diff starts to add support for a real direct sound capture driver. It also changes the capture fragment size but this still needs tuning for best performance.
@@ -534,11 +536,11 @@ #ifdef EMULATE_SB16 ossdev->in_caps.wMid = 0x0002; ossdev->in_caps.wPid = 0x0004; - strcpy(ossdev->in_caps.szPname, "SB16 Wave In"); + strncpy(ossdev->in_caps.szPname, "SB16 Wave In",MAXPNAMELEN-1); #else ossdev->in_caps.wMid = 0x00FF; /* Manufac ID */ ossdev->in_caps.wPid = 0x0001; /* Product ID */ - strcpy(ossdev->in_caps.szPname, "OpenSoundSystem WAVIN Driver"); + strncpy(ossdev->in_caps.szPname, "OpenSoundSystem WAVIN Driver",MAXPNAMELEN-1);
Why do you need these changes? MAXPNAMELEN in include/mmsystem.h is defined as #define MAXPNAMELEN 32 /* max product name length (including NULL) */ so it's perfectly correct to use strcpy here. -- Dmitry.
Yes it's correct as is but I made the change to prevent possible problems if the name changes here or when it's cut and pasted into another driver. Just trying to prevent a possible future bug. Dmitry Timoshkov wrote:
"Robert Reif" <reif(a)earthlink.net> wrote:
wineoss.diff starts to add support for a real direct sound capture driver. It also changes the capture fragment size but this still needs tuning for best performance.
@@ -534,11 +536,11 @@ #ifdef EMULATE_SB16 ossdev->in_caps.wMid = 0x0002; ossdev->in_caps.wPid = 0x0004; - strcpy(ossdev->in_caps.szPname, "SB16 Wave In"); + strncpy(ossdev->in_caps.szPname, "SB16 Wave In",MAXPNAMELEN-1); #else ossdev->in_caps.wMid = 0x00FF; /* Manufac ID */ ossdev->in_caps.wPid = 0x0001; /* Product ID */ - strcpy(ossdev->in_caps.szPname, "OpenSoundSystem WAVIN Driver"); + strncpy(ossdev->in_caps.szPname, "OpenSoundSystem WAVIN Driver",MAXPNAMELEN-1);
Why do you need these changes? MAXPNAMELEN in include/mmsystem.h is defined as #define MAXPNAMELEN 32 /* max product name length (including NULL) */
so it's perfectly correct to use strcpy here.
-- Dmitry.
"Robert Reif" <reif(a)earthlink.net> wrote:
Yes it's correct as is but I made the change to prevent possible problems if the name changes here or when it's cut and pasted into another driver. Just trying to prevent a possible future bug.
Just adding a comment would suffice IMO. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
Robert Reif