mirror of
https://github.com/reactos/reactos.git
synced 2025-06-19 22:15:20 +00:00
[MPG123] Update to version 1.26.1. CORE-17098
This commit is contained in:
parent
cab7e9ade8
commit
aa811c00e3
27 changed files with 2163 additions and 710 deletions
50
sdk/lib/3rdparty/libmpg123/stringbuf.c
vendored
50
sdk/lib/3rdparty/libmpg123/stringbuf.c
vendored
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
stringbuf: mimicking a bit of C++ to more safely handle strings
|
||||
|
||||
copyright 2006-17 by the mpg123 project
|
||||
copyright 2006-20 by the mpg123 project
|
||||
- free software under the terms of the LGPL 2.1
|
||||
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
||||
initially written by Thomas Orgis
|
||||
|
@ -14,6 +14,24 @@
|
|||
#include <string.h>
|
||||
#include "debug.h"
|
||||
|
||||
mpg123_string* attribute_align_arg mpg123_new_string(const char *val)
|
||||
{
|
||||
mpg123_string *sb = malloc(sizeof(mpg123_string));
|
||||
if(!sb)
|
||||
return NULL;
|
||||
mpg123_init_string(sb);
|
||||
mpg123_set_string(sb, val);
|
||||
return sb;
|
||||
}
|
||||
|
||||
void attribute_align_arg mpg123_delete_string(mpg123_string* sb)
|
||||
{
|
||||
if(!sb)
|
||||
return;
|
||||
mpg123_free_string(sb);
|
||||
free(sb);
|
||||
}
|
||||
|
||||
void attribute_align_arg mpg123_init_string(mpg123_string* sb)
|
||||
{
|
||||
/* Handing in NULL here is a fatal mistake and rightfully so. */
|
||||
|
@ -59,6 +77,12 @@ int attribute_align_arg mpg123_resize_string(mpg123_string* sb, size_t new)
|
|||
{
|
||||
sb->p = t;
|
||||
sb->size = new;
|
||||
if(sb->size < sb->fill)
|
||||
{
|
||||
// Cut short the existing data, properly.
|
||||
sb->fill = sb->size;
|
||||
sb->p[sb->fill-1] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else return 0;
|
||||
|
@ -95,6 +119,19 @@ int attribute_align_arg mpg123_copy_string(mpg123_string* from, mpg123_string* t
|
|||
else return 0;
|
||||
}
|
||||
|
||||
int attribute_align_arg mpg123_move_string(mpg123_string *from, mpg123_string *to)
|
||||
{
|
||||
if(to)
|
||||
mpg123_free_string(to);
|
||||
else
|
||||
mpg123_free_string(from);
|
||||
if(from && to)
|
||||
*to = *from;
|
||||
if(from)
|
||||
mpg123_init_string(from);
|
||||
return (from && to) ? 1 : 0;
|
||||
}
|
||||
|
||||
int attribute_align_arg mpg123_add_string(mpg123_string* sb, const char* stuff)
|
||||
{
|
||||
debug1("adding %s", stuff);
|
||||
|
@ -200,3 +237,14 @@ int attribute_align_arg mpg123_chomp_string(mpg123_string *sb)
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int attribute_align_arg mpg123_same_string(mpg123_string *a, mpg123_string *b)
|
||||
{
|
||||
if(!a || !b)
|
||||
return 0;
|
||||
if(a->fill != b->fill)
|
||||
return 0;
|
||||
if(memcmp(a->p, b->p, a->fill))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue