#include <iostream>
#include <sstream>
#include <iomanip>
+#include <vector>
#include <glibmm.h>
static void
snprintf_bounded_null_filled (char* target, size_t target_size, char const * fmt, ...)
{
- char buf[target_size+1];
+ std::vector<char> buf(target_size+1);
va_list ap;
va_start (ap, fmt);
- vsnprintf (buf, target_size+1, fmt, ap);
+ vsnprintf (&buf[0], target_size+1, fmt, ap);
va_end (ap);
memset (target, 0, target_size);
- memcpy (target, buf, target_size);
+ memcpy (target, &buf[0], target_size);
}
#include "ardour/export_graph_builder.h"
+#include <vector>
+
#include <glibmm/miscutils.h>
#include "audiographer/process_context.h"
{
std::string tmpfile_path = parent.session.session_directory().export_path();
tmpfile_path = Glib::build_filename(tmpfile_path, "XXXXXX");
- char tmpfile_path_buf[tmpfile_path.size() + 1];
- std::copy(tmpfile_path.begin(), tmpfile_path.end(), tmpfile_path_buf);
+ std::vector<char> tmpfile_path_buf(tmpfile_path.size() + 1);
+ std::copy(tmpfile_path.begin(), tmpfile_path.end(), tmpfile_path_buf.begin());
tmpfile_path_buf[tmpfile_path.size()] = '\0';
config = new_config;
normalizer->add_output (threader);
int format = ExportFormatBase::F_RAW | ExportFormatBase::SF_Float;
- tmp_file.reset (new TmpFile<float> (tmpfile_path_buf, format, channels, config.format->sample_rate()));
+ tmp_file.reset (new TmpFile<float> (&tmpfile_path_buf[0], format, channels, config.format->sample_rate()));
tmp_file->FileWritten.connect_same_thread (post_processing_connection,
boost::bind (&Normalizer::start_post_processing, this));
#include <fstream>
#include <algorithm>
#include <cmath>
+#include <vector>
#include <unistd.h>
#include <locale.h>
limit = name_size - _session.engine().client_name().length() - (suffix.length() + 5);
- char buf1[name_size+1];
- char buf2[name_size+1];
+ std::vector<char> buf1(name_size+1);
+ std::vector<char> buf2(name_size+1);
/* colons are illegal in port names, so fix that */
string nom = _name.val();
replace_all (nom, ":", ";");
- snprintf (buf1, name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str());
+ snprintf (&buf1[0], name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str());
- int port_number = find_port_hole (buf1);
- snprintf (buf2, name_size+1, "%s %d", buf1, port_number);
+ int port_number = find_port_hole (&buf1[0]);
+ snprintf (&buf2[0], name_size+1, "%s %d", buf1, port_number);
- return string (buf2);
+ return string (&buf2[0]);
}
int32_t
*/
for (n = 1; n < 9999; ++n) {
- char buf[jack_port_name_size()];
+ std::vector<char> buf(jack_port_name_size());
PortSet::iterator i = _ports.begin();
- snprintf (buf, jack_port_name_size(), _("%s %u"), base, n);
+ snprintf (&buf[0], jack_port_name_size(), _("%s %u"), base, n);
for ( ; i != _ports.end(); ++i) {
- if (i->name() == buf) {
+ if (string(i->name()) == string(&buf[0])) {
break;
}
}
lrdf_defaults defaults;
defaults.count = input_parameter_pids.size ();
- lrdf_portvalue portvalues[input_parameter_pids.size()];
- defaults.items = portvalues;
+ std::vector<lrdf_portvalue> portvalues(input_parameter_pids.size());
+ defaults.items = &portvalues[0];
for (vector<int>::size_type i = 0; i < input_parameter_pids.size(); ++i) {
portvalues[i].pid = input_parameter_pids[i];
uint32_t size,
const uint8_t* body)
{
- const uint32_t buf_size = sizeof(UIMessage) + size;
- uint8_t buf[buf_size];
+ const uint32_t buf_size = sizeof(UIMessage) + size;
+ vector<uint8_t> buf(buf_size);
- UIMessage* msg = (UIMessage*)buf;
+ UIMessage* msg = (UIMessage*)&buf[0];
msg->index = index;
msg->protocol = protocol;
msg->size = size;
memcpy(msg + 1, body, size);
- return (dest->write(buf, buf_size) == buf_size);
+ return (dest->write(&buf[0], buf_size) == buf_size);
}
bool
error << "Error reading from Plugin=>UI RingBuffer" << endmsg;
break;
}
- uint8_t body[msg.size];
- if (_to_ui->read(body, msg.size) != msg.size) {
+ vector<uint8_t> body(msg.size);
+ if (_to_ui->read(&body[0], msg.size) != msg.size) {
error << "Error reading from Plugin=>UI RingBuffer" << endmsg;
break;
}
- sink(controller, msg.index, msg.size, msg.protocol, body);
+ sink(controller, msg.index, msg.size, msg.protocol, &body[0]);
read_space -= sizeof(msg) + msg.size;
}
error << "Error reading from UI=>Plugin RingBuffer" << endmsg;
break;
}
- uint8_t body[msg.size];
- if (_from_ui->read(body, msg.size) != msg.size) {
+ vector<uint8_t> body(msg.size);
+ if (_from_ui->read(&body[0], msg.size) != msg.size) {
error << "Error reading from UI=>Plugin RingBuffer" << endmsg;
break;
}
if (msg.protocol == urids.atom_eventTransfer) {
LV2_Evbuf* buf = _ev_buffers[msg.index];
LV2_Evbuf_Iterator i = lv2_evbuf_end(buf);
- const LV2_Atom* const atom = (const LV2_Atom*)body;
+ const LV2_Atom* const atom = (const LV2_Atom*)&body[0];
if (!lv2_evbuf_write(&i, nframes, 0, atom->type, atom->size,
(const uint8_t*)(atom + 1))) {
error << "Failed to write data to LV2 event buffer\n";
uint32_t number;
string::size_type len = old.length() + 64;
string remainder;
- char buf[len];
+ std::vector<char> buf(len);
if ((last_period = old.find_last_of ('.')) == string::npos) {
number++;
- snprintf (buf, len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str());
- sbuf = buf;
+ snprintf (&buf[0], len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str());
+ sbuf = &buf[0];
if (region_name_map.find (sbuf) == region_name_map.end ()) {
break;
}
if (number != (UINT_MAX-1)) {
- return buf;
+ return &buf[0];
}
error << string_compose (_("cannot create new name for region \"%1\""), old) << endmsg;
} else if (xfade < xfade_frames) {
- gain_t in[xfade];
- gain_t out[xfade];
+ std::vector<gain_t> in(xfade);
+ std::vector<gain_t> out(xfade);
/* short xfade, compute custom curve */
- compute_equal_power_fades (xfade, in, out);
+ compute_equal_power_fades (xfade, &in[0], &out[0]);
for (framecnt_t n = 0; n < xfade; ++n) {
xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]);