return bytes;
}
-#define membuffer_write_data membuffer_write
-
static unsigned membuffer_write_atom_name(membuffer * buf, const char *data)
{
- return membuffer_write_data(buf, data, 4) == 4 ? 1 : 0;
+ return membuffer_write(buf, data, 4) == 4 ? 1 : 0;
}
static unsigned membuffer_write_int16(membuffer * buf, uint16_t data)
{
uint8_t temp[2] = { (uint8_t) (data >> 8), (uint8_t) data };
- return membuffer_write_data(buf, temp, 2);
+ return membuffer_write(buf, temp, 2);
}
static unsigned membuffer_write_int32(membuffer * buf, uint32_t data)
{
uint8_t temp[4] = { (uint8_t) (data >> 24), (uint8_t) (data >> 16),
(uint8_t) (data >> 8), (uint8_t) data };
- return membuffer_write_data(buf, temp, 4);
+ return membuffer_write(buf, temp, 4);
}
static void membuffer_write_track_tag(membuffer * buf, const char *name,
membuffer_write_atom_name(buf, "data");
membuffer_write_int32(buf, flags); //flags
membuffer_write_int32(buf, 0); //reserved
- membuffer_write_data(buf, value, strlen(value));
+ membuffer_write(buf, value, strlen(value));
}
static void membuffer_write_custom_tag(membuffer * buf, const char *name,
membuffer_write_int32(buf, 0x1C); //weirdo itunes atom
membuffer_write_atom_name(buf, "mean");
membuffer_write_int32(buf, 0);
- membuffer_write_data(buf, "com.apple.iTunes", 16);
+ membuffer_write(buf, "com.apple.iTunes", 16);
membuffer_write_int32(buf, 12 + strlen(name));
membuffer_write_atom_name(buf, "name");
membuffer_write_int32(buf, 0);
- membuffer_write_data(buf, name, strlen(name));
+ membuffer_write(buf, name, strlen(name));
membuffer_write_int32(buf,
8 /*data atom header */ +
8 /*flags + reserved */ + strlen(value));
membuffer_write_atom_name(buf, "data");
membuffer_write_int32(buf, 1); //flags
membuffer_write_int32(buf, 0); //reserved
- membuffer_write_data(buf, value, strlen(value));
+ membuffer_write(buf, value, strlen(value));
}
static unsigned membuffer_error(const membuffer * buf)
{
membuffer_write_int32(buf, size + 8);
membuffer_write_atom_name(buf, name);
- membuffer_write_data(buf, data, size);
+ membuffer_write(buf, data, size);
}
static void *membuffer_get_ptr(const membuffer * buf)
void *bufptr;
oldsize = membuffer_get_size(buf);
- if (membuffer_write_data(buf, 0, bytes) != bytes)
+ if (membuffer_write(buf, 0, bytes) != bytes)
return 0;
bufptr = membuffer_get_ptr(buf);