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:
parent
857c79a6b8
commit
fb5c24d812
@ -38,8 +38,8 @@ enum {
|
||||
};
|
||||
|
||||
struct flavor_info {
|
||||
char* name;
|
||||
char* info;
|
||||
const char* name;
|
||||
const char* info;
|
||||
uint64 kinds; // node kind
|
||||
uint32 flavor_flags;
|
||||
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->possible_count = 0;
|
||||
f_info->flavor_flags = 0;
|
||||
f_info->info = (char *)"10 Band Equalizer.\nby 3dEyes**";
|
||||
f_info->name = (char *)"Equalizer (10 Band)";
|
||||
f_info->info = "10 Band Equalizer.\nby 3dEyes**";
|
||||
f_info->name = "Equalizer (10 Band)";
|
||||
|
||||
media_format* format = new media_format;
|
||||
format->type = B_MEDIA_RAW_AUDIO;
|
||||
|
@ -33,8 +33,8 @@ AudioMixerAddon::AudioMixerAddon(image_id image)
|
||||
fFormat->u.raw_audio = media_raw_audio_format::wildcard;
|
||||
|
||||
fInfo->internal_id = 0;
|
||||
fInfo->name = (char *)"Audio Mixer";
|
||||
fInfo->info = (char *)"Audio Mixer media addon";
|
||||
fInfo->name = "Audio Mixer";
|
||||
fInfo->info = "Audio Mixer media addon";
|
||||
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->possible_count = 0; // 0 = infinite
|
||||
|
@ -94,7 +94,7 @@ MultiAudioAddOn::GetFlavorAt(int32 index, const flavor_info** _info)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
MultiAudioNode::GetFlavor(info, index);
|
||||
info->name = (char*)device->Description().friendly_name;
|
||||
info->name = device->Description().friendly_name;
|
||||
|
||||
*_info = info;
|
||||
return B_OK;
|
||||
|
@ -2681,9 +2681,8 @@ OpenSoundNode::GetFlavor(flavor_info* outInfo, int32 id)
|
||||
outInfo->out_formats = 0;
|
||||
outInfo->internal_id = id;
|
||||
|
||||
outInfo->name = (char *)"OpenSoundNode Node";
|
||||
outInfo->info = (char *)"The OpenSoundNode outputs to OpenSound System v4 "
|
||||
"drivers.";
|
||||
outInfo->name = "OpenSoundNode Node";
|
||||
outInfo->info = "The OpenSoundNode outputs to OpenSound System v4 drivers.";
|
||||
outInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_TIME_SOURCE
|
||||
| B_PHYSICAL_OUTPUT | B_PHYSICAL_INPUT | B_CONTROLLABLE;
|
||||
// TODO: If the OSS engine supports outputing encoded audio,
|
||||
|
@ -44,9 +44,8 @@ status_t ToneProducerAddOn::GetFlavorAt(
|
||||
|
||||
flavor_info* pInfo = new flavor_info;
|
||||
pInfo->internal_id = n;
|
||||
pInfo->name = (char *)"Demo Audio Producer";
|
||||
pInfo->info = (char *)
|
||||
"An add-on version of the ToneProducer node.\n"
|
||||
pInfo->name = "Demo Audio Producer";
|
||||
pInfo->info = "An add-on version of the ToneProducer node.\n"
|
||||
"See the Be Developer Newsletter: 2 June, 1999\n"
|
||||
"adapted by Eric Moon (4 June, 1999)";
|
||||
pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||
|
@ -56,8 +56,8 @@ CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
|
||||
fFlavorInfoInfoStr = "";
|
||||
fFlavorInfoInfoStr << fCamDeviceAddon.SupportedDevices()[fSupportedDeviceIndex].vendor;
|
||||
fFlavorInfoInfoStr << " (" << fCamDeviceAddon.SupportedDevices()[fSupportedDeviceIndex].product << ") USB Webcam";
|
||||
fFlavorInfo.name = (char *)fFlavorInfoNameStr.String();
|
||||
fFlavorInfo.info = (char *)fFlavorInfoInfoStr.String();
|
||||
fFlavorInfo.name = fFlavorInfoNameStr.String();
|
||||
fFlavorInfo.info = fFlavorInfoInfoStr.String();
|
||||
}
|
||||
#ifdef DEBUG_WRITE_DUMP
|
||||
fDumpFD = open("/boot/home/webcam.out", O_CREAT|O_RDWR, 0644);
|
||||
|
@ -15,8 +15,8 @@ MediaAddOn::MediaAddOn(image_id imid)
|
||||
: BMediaAddOn(imid)
|
||||
{
|
||||
/* Customize these parameters to match those of your node */
|
||||
fFlavorInfo.name = (char *)"Demo Video Producer";
|
||||
fFlavorInfo.info = (char *)"Demo Video Producer";
|
||||
fFlavorInfo.name = "Demo Video Producer";
|
||||
fFlavorInfo.info = "Demo Video Producer";
|
||||
fFlavorInfo.kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||
fFlavorInfo.flavor_flags = 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->possible_count = 0;
|
||||
f_info->flavor_flags = 0;
|
||||
f_info->name = (char *)plugin->ModuleName();
|
||||
f_info->info = (char *)plugin->Product();
|
||||
f_info->name = plugin->ModuleName();
|
||||
f_info->info = plugin->Product();
|
||||
|
||||
media_format *format = new media_format;
|
||||
format->type = B_MEDIA_RAW_AUDIO;
|
||||
|
@ -89,9 +89,8 @@ status_t AudioAdapterAddOn::GetFlavorAt(
|
||||
|
||||
flavor_info* pInfo = new flavor_info;
|
||||
pInfo->internal_id = n;
|
||||
pInfo->name = (char *)"AudioAdapter";
|
||||
pInfo->info = (char *)
|
||||
"AudioAdapter (generic raw-audio format conversion).\n"
|
||||
pInfo->name = "AudioAdapter";
|
||||
pInfo->info = "AudioAdapter (generic raw-audio format conversion).\n"
|
||||
"by Eric Moon (8 September 1999)";
|
||||
pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||
pInfo->flavor_flags = 0;
|
||||
|
@ -80,9 +80,8 @@ status_t FlangerAddOn::GetFlavorAt(
|
||||
|
||||
flavor_info* pInfo = new flavor_info;
|
||||
pInfo->internal_id = n;
|
||||
pInfo->name = (char *)B_TRANSLATE("Flanger");
|
||||
pInfo->info = (char *)
|
||||
B_TRANSLATE("An add-on version of FlangerNode.\n"
|
||||
pInfo->name = B_TRANSLATE("Flanger");
|
||||
pInfo->info = B_TRANSLATE("An add-on version of FlangerNode.\n"
|
||||
"by Eric Moon (16 June, 1999)");
|
||||
pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||
pInfo->flavor_flags = 0;
|
||||
|
@ -85,9 +85,8 @@ status_t LoggingConsumerAddOn::GetFlavorAt(
|
||||
|
||||
flavor_info* pInfo = new flavor_info;
|
||||
pInfo->internal_id = n;
|
||||
pInfo->name = (char*)B_TRANSLATE("LoggingConsumer");
|
||||
pInfo->info = (char*)B_TRANSLATE(
|
||||
"An add-on version of the LoggingConsumer node.\n"
|
||||
pInfo->name = B_TRANSLATE("LoggingConsumer");
|
||||
pInfo->info = B_TRANSLATE("An add-on version of the LoggingConsumer node.\n"
|
||||
"See the Be Developer Newsletter III.18: 5 May, 1999\n"
|
||||
"adapted by Eric Moon (4 June, 1999)");
|
||||
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
|
||||
nameLength = *(int32*)buf; buf += sizeof(int32);
|
||||
if (nameLength >= 0) { // if nameLength is -1, we leave name = 0
|
||||
name = new(std::nothrow) char [nameLength + 1];
|
||||
if (name) {
|
||||
memcpy(name, buf, nameLength);
|
||||
name[nameLength] = 0;
|
||||
char* nameStorage = new(std::nothrow) char [nameLength + 1];
|
||||
name = nameStorage;
|
||||
if (nameStorage) {
|
||||
memcpy(nameStorage, buf, nameLength);
|
||||
nameStorage[nameLength] = 0;
|
||||
buf += nameLength; // XXX not save
|
||||
}
|
||||
}
|
||||
|
||||
infoLength = *(int32*)buf; buf += sizeof(int32);
|
||||
if (infoLength >= 0) { // if infoLength is -1, we leave info = 0
|
||||
info = new(std::nothrow) char [infoLength + 1];
|
||||
if (info) {
|
||||
memcpy(info, buf, infoLength);
|
||||
info[infoLength] = 0;
|
||||
char* infoStorage = new(std::nothrow) char [infoLength + 1];
|
||||
info = infoStorage;
|
||||
if (infoStorage) {
|
||||
memcpy(infoStorage, buf, infoLength);
|
||||
infoStorage[infoLength] = 0;
|
||||
buf += infoLength; // XXX not save
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user