You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-11 14:30:22 +02:00
Merge commit '33552a5f7b6ec7057516f487b1a902331f8c353e'
* commit '33552a5f7b6ec7057516f487b1a902331f8c353e': arm: Add mathops.h to ARCH_HEADERS list avstring: K&R formatting cosmetics Conflicts: libavutil/avstring.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
ARCH_HEADERS = mathops.h
|
||||||
|
|
||||||
OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \
|
OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \
|
||||||
arm/ac3dsp_arm.o
|
arm/ac3dsp_arm.o
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "avstring.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
#include "avstring.h"
|
||||||
|
|
||||||
int av_strstart(const char *str, const char *pfx, const char **ptr)
|
int av_strstart(const char *str, const char *pfx, const char **ptr)
|
||||||
{
|
{
|
||||||
@ -56,10 +57,10 @@ char *av_stristr(const char *s1, const char *s2)
|
|||||||
if (!*s2)
|
if (!*s2)
|
||||||
return (char*)(intptr_t)s1;
|
return (char*)(intptr_t)s1;
|
||||||
|
|
||||||
do {
|
do
|
||||||
if (av_stristart(s1, s2, NULL))
|
if (av_stristart(s1, s2, NULL))
|
||||||
return (char*)(intptr_t)s1;
|
return (char*)(intptr_t)s1;
|
||||||
} while (*s1++);
|
while (*s1++);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -122,8 +123,9 @@ end:
|
|||||||
|
|
||||||
char *av_d2str(double d)
|
char *av_d2str(double d)
|
||||||
{
|
{
|
||||||
char *str= av_malloc(16);
|
char *str = av_malloc(16);
|
||||||
if(str) snprintf(str, 16, "%f", d);
|
if (str)
|
||||||
|
snprintf(str, 16, "%f", d);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,31 +134,32 @@ char *av_d2str(double d)
|
|||||||
char *av_get_token(const char **buf, const char *term)
|
char *av_get_token(const char **buf, const char *term)
|
||||||
{
|
{
|
||||||
char *out = av_malloc(strlen(*buf) + 1);
|
char *out = av_malloc(strlen(*buf) + 1);
|
||||||
char *ret= out, *end= out;
|
char *ret = out, *end = out;
|
||||||
const char *p = *buf;
|
const char *p = *buf;
|
||||||
if (!out) return NULL;
|
if (!out)
|
||||||
|
return NULL;
|
||||||
p += strspn(p, WHITESPACES);
|
p += strspn(p, WHITESPACES);
|
||||||
|
|
||||||
while(*p && !strspn(p, term)) {
|
while (*p && !strspn(p, term)) {
|
||||||
char c = *p++;
|
char c = *p++;
|
||||||
if(c == '\\' && *p){
|
if (c == '\\' && *p) {
|
||||||
*out++ = *p++;
|
*out++ = *p++;
|
||||||
end= out;
|
end = out;
|
||||||
}else if(c == '\''){
|
} else if (c == '\'') {
|
||||||
while(*p && *p != '\'')
|
while (*p && *p != '\'')
|
||||||
*out++ = *p++;
|
*out++ = *p++;
|
||||||
if(*p){
|
if (*p) {
|
||||||
p++;
|
p++;
|
||||||
end= out;
|
end = out;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
*out++ = c;
|
*out++ = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do{
|
do
|
||||||
*out-- = 0;
|
*out-- = 0;
|
||||||
}while(out >= end && strspn(out, WHITESPACES));
|
while (out >= end && strspn(out, WHITESPACES));
|
||||||
|
|
||||||
*buf = p;
|
*buf = p;
|
||||||
|
|
||||||
@ -251,17 +254,11 @@ const char *av_dirname(char *path)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("Testing av_get_token()\n");
|
|
||||||
{
|
|
||||||
const char *strings[] = {
|
const char *strings[] = {
|
||||||
"''",
|
"''",
|
||||||
"",
|
"",
|
||||||
@ -291,7 +288,8 @@ int main(void)
|
|||||||
"\\'fo\\o\\:': foo ' :blahblah"
|
"\\'fo\\o\\:': foo ' :blahblah"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i=0; i < FF_ARRAY_ELEMS(strings); i++) {
|
printf("Testing av_get_token()\n");
|
||||||
|
for (i = 0; i < FF_ARRAY_ELEMS(strings); i++) {
|
||||||
const char *p = strings[i];
|
const char *p = strings[i];
|
||||||
char *q;
|
char *q;
|
||||||
printf("|%s|", p);
|
printf("|%s|", p);
|
||||||
@ -300,7 +298,6 @@ int main(void)
|
|||||||
printf(" + |%s|\n", p);
|
printf(" + |%s|\n", p);
|
||||||
av_free(q);
|
av_free(q);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user