MediaAddOn: missing const
Pretty much all add-ons are setting this to point to a const string, so we should make sure that nothing tries to modify it.
This commit is contained in:
@@ -38,8 +38,8 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct flavor_info {
|
struct flavor_info {
|
||||||
char* name;
|
const char* name;
|
||||||
char* info;
|
const char* info;
|
||||||
uint64 kinds; // node kind
|
uint64 kinds; // node kind
|
||||||
uint32 flavor_flags;
|
uint32 flavor_flags;
|
||||||
int32 internal_id; // For BMediaAddOn internal use
|
int32 internal_id; // For BMediaAddOn internal use
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ status_t EqualizerAddOn::GetFlavorAt(int32 idx, const flavor_info** info)
|
|||||||
f_info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
f_info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||||
f_info->possible_count = 0;
|
f_info->possible_count = 0;
|
||||||
f_info->flavor_flags = 0;
|
f_info->flavor_flags = 0;
|
||||||
f_info->info = (char *)"10 Band Equalizer.\nby 3dEyes**";
|
f_info->info = "10 Band Equalizer.\nby 3dEyes**";
|
||||||
f_info->name = (char *)"Equalizer (10 Band)";
|
f_info->name = "Equalizer (10 Band)";
|
||||||
|
|
||||||
media_format* format = new media_format;
|
media_format* format = new media_format;
|
||||||
format->type = B_MEDIA_RAW_AUDIO;
|
format->type = B_MEDIA_RAW_AUDIO;
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ AudioMixerAddon::AudioMixerAddon(image_id image)
|
|||||||
fFormat->u.raw_audio = media_raw_audio_format::wildcard;
|
fFormat->u.raw_audio = media_raw_audio_format::wildcard;
|
||||||
|
|
||||||
fInfo->internal_id = 0;
|
fInfo->internal_id = 0;
|
||||||
fInfo->name = (char *)"Audio Mixer";
|
fInfo->name = "Audio Mixer";
|
||||||
fInfo->info = (char *)"Audio Mixer media addon";
|
fInfo->info = "Audio Mixer media addon";
|
||||||
fInfo->kinds = B_BUFFER_PRODUCER | B_BUFFER_CONSUMER | B_SYSTEM_MIXER | B_CONTROLLABLE;
|
fInfo->kinds = B_BUFFER_PRODUCER | B_BUFFER_CONSUMER | B_SYSTEM_MIXER | B_CONTROLLABLE;
|
||||||
fInfo->flavor_flags = 0; // 0 = global or local instantiation allowed, no restrictions
|
fInfo->flavor_flags = 0; // 0 = global or local instantiation allowed, no restrictions
|
||||||
fInfo->possible_count = 0; // 0 = infinite
|
fInfo->possible_count = 0; // 0 = infinite
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ MultiAudioAddOn::GetFlavorAt(int32 index, const flavor_info** _info)
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
MultiAudioNode::GetFlavor(info, index);
|
MultiAudioNode::GetFlavor(info, index);
|
||||||
info->name = (char*)device->Description().friendly_name;
|
info->name = device->Description().friendly_name;
|
||||||
|
|
||||||
*_info = info;
|
*_info = info;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -2681,9 +2681,8 @@ OpenSoundNode::GetFlavor(flavor_info* outInfo, int32 id)
|
|||||||
outInfo->out_formats = 0;
|
outInfo->out_formats = 0;
|
||||||
outInfo->internal_id = id;
|
outInfo->internal_id = id;
|
||||||
|
|
||||||
outInfo->name = (char *)"OpenSoundNode Node";
|
outInfo->name = "OpenSoundNode Node";
|
||||||
outInfo->info = (char *)"The OpenSoundNode outputs to OpenSound System v4 "
|
outInfo->info = "The OpenSoundNode outputs to OpenSound System v4 drivers.";
|
||||||
"drivers.";
|
|
||||||
outInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_TIME_SOURCE
|
outInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_TIME_SOURCE
|
||||||
| B_PHYSICAL_OUTPUT | B_PHYSICAL_INPUT | B_CONTROLLABLE;
|
| B_PHYSICAL_OUTPUT | B_PHYSICAL_INPUT | B_CONTROLLABLE;
|
||||||
// TODO: If the OSS engine supports outputing encoded audio,
|
// TODO: If the OSS engine supports outputing encoded audio,
|
||||||
|
|||||||
@@ -44,9 +44,8 @@ status_t ToneProducerAddOn::GetFlavorAt(
|
|||||||
|
|
||||||
flavor_info* pInfo = new flavor_info;
|
flavor_info* pInfo = new flavor_info;
|
||||||
pInfo->internal_id = n;
|
pInfo->internal_id = n;
|
||||||
pInfo->name = (char *)"Demo Audio Producer";
|
pInfo->name = "Demo Audio Producer";
|
||||||
pInfo->info = (char *)
|
pInfo->info = "An add-on version of the ToneProducer node.\n"
|
||||||
"An add-on version of the ToneProducer node.\n"
|
|
||||||
"See the Be Developer Newsletter: 2 June, 1999\n"
|
"See the Be Developer Newsletter: 2 June, 1999\n"
|
||||||
"adapted by Eric Moon (4 June, 1999)";
|
"adapted by Eric Moon (4 June, 1999)";
|
||||||
pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
|
|||||||
fFlavorInfoInfoStr = "";
|
fFlavorInfoInfoStr = "";
|
||||||
fFlavorInfoInfoStr << fCamDeviceAddon.SupportedDevices()[fSupportedDeviceIndex].vendor;
|
fFlavorInfoInfoStr << fCamDeviceAddon.SupportedDevices()[fSupportedDeviceIndex].vendor;
|
||||||
fFlavorInfoInfoStr << " (" << fCamDeviceAddon.SupportedDevices()[fSupportedDeviceIndex].product << ") USB Webcam";
|
fFlavorInfoInfoStr << " (" << fCamDeviceAddon.SupportedDevices()[fSupportedDeviceIndex].product << ") USB Webcam";
|
||||||
fFlavorInfo.name = (char *)fFlavorInfoNameStr.String();
|
fFlavorInfo.name = fFlavorInfoNameStr.String();
|
||||||
fFlavorInfo.info = (char *)fFlavorInfoInfoStr.String();
|
fFlavorInfo.info = fFlavorInfoInfoStr.String();
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_WRITE_DUMP
|
#ifdef DEBUG_WRITE_DUMP
|
||||||
fDumpFD = open("/boot/home/webcam.out", O_CREAT|O_RDWR, 0644);
|
fDumpFD = open("/boot/home/webcam.out", O_CREAT|O_RDWR, 0644);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ MediaAddOn::MediaAddOn(image_id imid)
|
|||||||
: BMediaAddOn(imid)
|
: BMediaAddOn(imid)
|
||||||
{
|
{
|
||||||
/* Customize these parameters to match those of your node */
|
/* Customize these parameters to match those of your node */
|
||||||
fFlavorInfo.name = (char *)"Demo Video Producer";
|
fFlavorInfo.name = "Demo Video Producer";
|
||||||
fFlavorInfo.info = (char *)"Demo Video Producer";
|
fFlavorInfo.info = "Demo Video Producer";
|
||||||
fFlavorInfo.kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
fFlavorInfo.kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||||
fFlavorInfo.flavor_flags = 0;
|
fFlavorInfo.flavor_flags = 0;
|
||||||
fFlavorInfo.internal_id = 0;
|
fFlavorInfo.internal_id = 0;
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ VSTAddOn::GetFlavorAt(int32 idx, const flavor_info** info)
|
|||||||
f_info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
f_info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||||
f_info->possible_count = 0;
|
f_info->possible_count = 0;
|
||||||
f_info->flavor_flags = 0;
|
f_info->flavor_flags = 0;
|
||||||
f_info->name = (char *)plugin->ModuleName();
|
f_info->name = plugin->ModuleName();
|
||||||
f_info->info = (char *)plugin->Product();
|
f_info->info = plugin->Product();
|
||||||
|
|
||||||
media_format *format = new media_format;
|
media_format *format = new media_format;
|
||||||
format->type = B_MEDIA_RAW_AUDIO;
|
format->type = B_MEDIA_RAW_AUDIO;
|
||||||
|
|||||||
@@ -89,9 +89,8 @@ status_t AudioAdapterAddOn::GetFlavorAt(
|
|||||||
|
|
||||||
flavor_info* pInfo = new flavor_info;
|
flavor_info* pInfo = new flavor_info;
|
||||||
pInfo->internal_id = n;
|
pInfo->internal_id = n;
|
||||||
pInfo->name = (char *)"AudioAdapter";
|
pInfo->name = "AudioAdapter";
|
||||||
pInfo->info = (char *)
|
pInfo->info = "AudioAdapter (generic raw-audio format conversion).\n"
|
||||||
"AudioAdapter (generic raw-audio format conversion).\n"
|
|
||||||
"by Eric Moon (8 September 1999)";
|
"by Eric Moon (8 September 1999)";
|
||||||
pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||||
pInfo->flavor_flags = 0;
|
pInfo->flavor_flags = 0;
|
||||||
|
|||||||
@@ -80,9 +80,8 @@ status_t FlangerAddOn::GetFlavorAt(
|
|||||||
|
|
||||||
flavor_info* pInfo = new flavor_info;
|
flavor_info* pInfo = new flavor_info;
|
||||||
pInfo->internal_id = n;
|
pInfo->internal_id = n;
|
||||||
pInfo->name = (char *)B_TRANSLATE("Flanger");
|
pInfo->name = B_TRANSLATE("Flanger");
|
||||||
pInfo->info = (char *)
|
pInfo->info = B_TRANSLATE("An add-on version of FlangerNode.\n"
|
||||||
B_TRANSLATE("An add-on version of FlangerNode.\n"
|
|
||||||
"by Eric Moon (16 June, 1999)");
|
"by Eric Moon (16 June, 1999)");
|
||||||
pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||||
pInfo->flavor_flags = 0;
|
pInfo->flavor_flags = 0;
|
||||||
|
|||||||
@@ -85,9 +85,8 @@ status_t LoggingConsumerAddOn::GetFlavorAt(
|
|||||||
|
|
||||||
flavor_info* pInfo = new flavor_info;
|
flavor_info* pInfo = new flavor_info;
|
||||||
pInfo->internal_id = n;
|
pInfo->internal_id = n;
|
||||||
pInfo->name = (char*)B_TRANSLATE("LoggingConsumer");
|
pInfo->name = B_TRANSLATE("LoggingConsumer");
|
||||||
pInfo->info = (char*)B_TRANSLATE(
|
pInfo->info = B_TRANSLATE("An add-on version of the LoggingConsumer node.\n"
|
||||||
"An add-on version of the LoggingConsumer node.\n"
|
|
||||||
"See the Be Developer Newsletter III.18: 5 May, 1999\n"
|
"See the Be Developer Newsletter III.18: 5 May, 1999\n"
|
||||||
"adapted by Eric Moon (4 June, 1999)");
|
"adapted by Eric Moon (4 June, 1999)");
|
||||||
pInfo->kinds = B_BUFFER_CONSUMER | B_CONTROLLABLE;
|
pInfo->kinds = B_BUFFER_CONSUMER | B_CONTROLLABLE;
|
||||||
|
|||||||
@@ -409,20 +409,22 @@ dormant_flavor_info::Unflatten(type_code c, const void *buffer, ssize_t size)
|
|||||||
// struct flavor_info
|
// struct flavor_info
|
||||||
nameLength = *(int32*)buf; buf += sizeof(int32);
|
nameLength = *(int32*)buf; buf += sizeof(int32);
|
||||||
if (nameLength >= 0) { // if nameLength is -1, we leave name = 0
|
if (nameLength >= 0) { // if nameLength is -1, we leave name = 0
|
||||||
name = new(std::nothrow) char [nameLength + 1];
|
char* nameStorage = new(std::nothrow) char [nameLength + 1];
|
||||||
if (name) {
|
name = nameStorage;
|
||||||
memcpy(name, buf, nameLength);
|
if (nameStorage) {
|
||||||
name[nameLength] = 0;
|
memcpy(nameStorage, buf, nameLength);
|
||||||
|
nameStorage[nameLength] = 0;
|
||||||
buf += nameLength; // XXX not save
|
buf += nameLength; // XXX not save
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
infoLength = *(int32*)buf; buf += sizeof(int32);
|
infoLength = *(int32*)buf; buf += sizeof(int32);
|
||||||
if (infoLength >= 0) { // if infoLength is -1, we leave info = 0
|
if (infoLength >= 0) { // if infoLength is -1, we leave info = 0
|
||||||
info = new(std::nothrow) char [infoLength + 1];
|
char* infoStorage = new(std::nothrow) char [infoLength + 1];
|
||||||
if (info) {
|
info = infoStorage;
|
||||||
memcpy(info, buf, infoLength);
|
if (infoStorage) {
|
||||||
info[infoLength] = 0;
|
memcpy(infoStorage, buf, infoLength);
|
||||||
|
infoStorage[infoLength] = 0;
|
||||||
buf += infoLength; // XXX not save
|
buf += infoLength; // XXX not save
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user