Lines Matching defs:buffer
72 * \bug Reading from a memory buffer doesn't work.
87 * \param str Address of the destination buffer.
88 * \param size The size of the destination buffer.
89 * \return Pointer to the buffer if successful, otherwise \c NULL.
92 * the new-line character \c '\\n' if the line fits into the buffer.
233 snd_input_buffer_t *buffer = input->private_data;
234 free(buffer->buf);
235 free(buffer);
241 snd_input_buffer_t *buffer = input->private_data;
245 return vsscanf((char *)buffer->ptr, format, args);
250 snd_input_buffer_t *buffer = input->private_data;
251 size_t bsize = buffer->size;
253 unsigned char c = *buffer->ptr++;
259 if (bsize == buffer->size)
261 buffer->size = bsize;
268 snd_input_buffer_t *buffer = input->private_data;
269 if (buffer->size == 0)
271 buffer->size--;
272 return *buffer->ptr++;
277 snd_input_buffer_t *buffer = input->private_data;
278 if (buffer->ptr == buffer->buf)
280 buffer->ptr--;
281 assert(*buffer->ptr == (unsigned char) c);
282 buffer->size++;
296 * \brief Creates a new input object from a memory buffer.
299 * \param buf Address of the input buffer.
300 * \param size Size of the input buffer.
303 * This functions creates a copy of the input buffer, so the application is
304 * not required to preserve the buffer after this function has been called.
309 snd_input_buffer_t *buffer;
311 buffer = calloc(1, sizeof(*buffer));
312 if (!buffer)
316 free(buffer);
321 buffer->buf = malloc((size_t)size + 1);
322 if (!buffer->buf) {
324 free(buffer);
327 memcpy(buffer->buf, buf, (size_t) size);
328 buffer->buf[size] = 0;
329 buffer->ptr = buffer->buf;
330 buffer->size = size;
333 input->private_data = buffer;