Browse Source

lavu/avstring: deprecate av_d2str().

It is no longer used in our code base and does not seem
to be used much in other projects.
tags/n4.4
Nicolas George 5 years ago
parent
commit
06f2651204
5 changed files with 18 additions and 0 deletions
  1. +4
    -0
      doc/APIchanges
  2. +2
    -0
      libavutil/avstring.c
  3. +5
    -0
      libavutil/avstring.h
  4. +4
    -0
      libavutil/tests/avstring.c
  5. +3
    -0
      libavutil/version.h

+ 4
- 0
doc/APIchanges View File

@@ -15,6 +15,10 @@ libavutil: 2017-10-21


API changes, most recent first: API changes, most recent first:


=======
2020-08-21 - xxxxxxxxxx - lavu 56.58.100 - avstring.h
Deprecate av_d2str(). Use av_asprintf() instead.

2020-08-04 - xxxxxxxxxx - lavu 56.58.100 - channel_layout.h 2020-08-04 - xxxxxxxxxx - lavu 56.58.100 - channel_layout.h
Add AV_CH_LAYOUT_22POINT2 together with its newly required pieces: Add AV_CH_LAYOUT_22POINT2 together with its newly required pieces:
AV_CH_TOP_SIDE_LEFT, AV_CH_TOP_SIDE_RIGHT, AV_CH_BOTTOM_FRONT_CENTER, AV_CH_TOP_SIDE_LEFT, AV_CH_TOP_SIDE_RIGHT, AV_CH_BOTTOM_FRONT_CENTER,


+ 2
- 0
libavutil/avstring.c View File

@@ -136,6 +136,7 @@ end:
return p; return p;
} }


#if FF_API_D2STR
char *av_d2str(double d) char *av_d2str(double d)
{ {
char *str = av_malloc(16); char *str = av_malloc(16);
@@ -143,6 +144,7 @@ char *av_d2str(double d)
snprintf(str, 16, "%f", d); snprintf(str, 16, "%f", d);
return str; return str;
} }
#endif


#define WHITESPACES " \n\t\r" #define WHITESPACES " \n\t\r"




+ 5
- 0
libavutil/avstring.h View File

@@ -24,6 +24,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "attributes.h" #include "attributes.h"
#include "version.h"


/** /**
* @addtogroup lavu_string * @addtogroup lavu_string
@@ -155,10 +156,14 @@ static inline size_t av_strnlen(const char *s, size_t len)
*/ */
char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2); char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);


#if FF_API_D2STR
/** /**
* Convert a number to an av_malloced string. * Convert a number to an av_malloced string.
* @deprecated use av_asprintf() with "%f" or a more specific format
*/ */
attribute_deprecated
char *av_d2str(double d); char *av_d2str(double d);
#endif


/** /**
* Unescape the given string until a non escaped terminating char, * Unescape the given string until a non escaped terminating char,


+ 4
- 0
libavutil/tests/avstring.c View File

@@ -109,6 +109,8 @@ int main(void)
TEST_STRIREPLACE(haystack, needle [2], "Education consists mainly in what we have instead."); TEST_STRIREPLACE(haystack, needle [2], "Education consists mainly in what we have instead.");
TEST_STRIREPLACE(haystack, needle [1], "Education consists mainly in what we have instead"); TEST_STRIREPLACE(haystack, needle [1], "Education consists mainly in what we have instead");


#if FF_API_D2STR
FF_DISABLE_DEPRECATION_WARNINGS
/*Testing av_d2str()*/ /*Testing av_d2str()*/
#define TEST_D2STR(value, expected) \ #define TEST_D2STR(value, expected) \
if((ptr = av_d2str(value)) == NULL){ \ if((ptr = av_d2str(value)) == NULL){ \
@@ -121,5 +123,7 @@ int main(void)
TEST_D2STR(0 , "0.000000"); TEST_D2STR(0 , "0.000000");
TEST_D2STR(-1.2333234, "-1.233323"); TEST_D2STR(-1.2333234, "-1.233323");
TEST_D2STR(-1.2333237, "-1.233324"); TEST_D2STR(-1.2333237, "-1.233324");
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return 0; return 0;
} }

+ 3
- 0
libavutil/version.h View File

@@ -132,6 +132,9 @@
#ifndef FF_API_CHILD_CLASS_NEXT #ifndef FF_API_CHILD_CLASS_NEXT
#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) #define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
#endif #endif
#ifndef FF_API_D2STR
#define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58)
#endif


/** /**
* @} * @}


Loading…
Cancel
Save