Skip to content

Commit

Permalink
Nit
Browse files Browse the repository at this point in the history
  • Loading branch information
msg7086 committed Feb 12, 2025
1 parent 5846d59 commit ec6564c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions common/lwindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,7 @@ static int parse_index
int64_t pos;
int64_t pts;
int64_t dts;
if( sscanf_unrolled1( buf, // "Index=%d,POS=%" SCNd64 ",PTS=%" SCNd64 ",DTS=%" SCNd64 ",EDI=%d",
if( sscanf_unrolled_main_index( buf, // "Index=%d,POS=%" SCNd64 ",PTS=%" SCNd64 ",DTS=%" SCNd64 ",EDI=%d",
&stream_index, &pos, &pts, &dts, &extradata_index ) != 5 )
goto fail_parsing;
if( !fgets( buf, sizeof(buf), index ) )
Expand Down Expand Up @@ -3111,7 +3111,7 @@ static int parse_index
int poc;
int repeat_pict;
int field_info;
if( sscanf_unrolled2( buf, // "Key=%d,Pic=%d,POC=%d,Repeat=%d,Field=%d",
if( sscanf_unrolled_video_index( buf, // "Key=%d,Pic=%d,POC=%d,Repeat=%d,Field=%d",
&key, &pict_type, &poc, &repeat_pict, &field_info ) != 5 )
goto fail_parsing;
if( vdhp->codec_id == AV_CODEC_ID_NONE )
Expand Down Expand Up @@ -3193,7 +3193,7 @@ static int parse_index
char *sample_fmt = stream_info[stream_index].fmt;
int bits_per_sample = stream_info[stream_index].bits_per_sample;
int frame_length;
if( sscanf_unrolled3( buf, // "Length=%d"
if( sscanf_unrolled_audio_index( buf, // "Length=%d",
&frame_length ) != 1 )
goto fail_parsing;
if( adhp->codec_id == AV_CODEC_ID_NONE )
Expand Down
13 changes: 5 additions & 8 deletions common/lwindex_sscanf_unrolled.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static inline int64_t my_strto_int64_t(const char *nptr, char **endptr) {
acc = 0;
for (;;s++) {
c = *s;
if (isdigit(c))
if (c >= '0' && c <= '9')
c -= '0';
else
break;
Expand Down Expand Up @@ -98,7 +98,7 @@ static inline int my_strto_int(const char *nptr, char **endptr) {
acc = 0;
for (;;s++) {
c = *s;
if (isdigit(c))
if (c >= '0' && c <= '9')
c -= '0';
else
break;
Expand All @@ -122,8 +122,7 @@ static inline int my_strto_int(const char *nptr, char **endptr) {
sscanf( buf, "Index=%d,POS=%" SCNd64 ",PTS=%" SCNd64 ",DTS=%" SCNd64 ",EDI=%d",
&stream_index, &pos, &pts, &dts, &extradata_index )
*/
static inline int sscanf_unrolled1( const char *buf, int *stream_index, int64_t *pos, int64_t *pts, int64_t *dts, int *extradata_index )
{
static inline int sscanf_unrolled_main_index(const char *buf, int *stream_index, int64_t *pos, int64_t *pts, int64_t *dts, int *extradata_index) {
char *p = (char *)buf;
int parsed_count = 0;

Expand All @@ -145,8 +144,7 @@ static inline int sscanf_unrolled1( const char *buf, int *stream_index, int64_t
sscanf( buf, "Key=%d,Pic=%d,POC=%d,Repeat=%d,Field=%d",
&key, &pict_type, &poc, &repeat_pict, &field_info )
*/
static inline int sscanf_unrolled2( const char *buf, int *key, int *pict_type, int *poc, int *repeat_pict, int *field_info )
{
static inline int sscanf_unrolled_video_index(const char *buf, int *key, int *pict_type, int *poc, int *repeat_pict, int *field_info) {
char *p = (char *)buf;
int parsed_count = 0;

Expand All @@ -167,8 +165,7 @@ static inline int sscanf_unrolled2( const char *buf, int *key, int *pict_type, i
Unroll the following sscanf:
sscanf( buf, "Length=%d", &frame_length )
*/
static inline int sscanf_unrolled3( const char *buf, int *frame_length )
{
static inline int sscanf_unrolled_audio_index(const char *buf, int *frame_length) {
char *p = (char *)buf;
int parsed_count = 0;

Expand Down

0 comments on commit ec6564c

Please sign in to comment.