mirror of https://github.com/mpv-player/mpv
filter_sdh: remove pointless set_pos function
This change was requested during patch review, but apparently it was overlooked on merge.
This commit is contained in:
parent
19db7a79d4
commit
f4cb4fb962
|
@ -43,13 +43,6 @@ static void init_buf(struct buffer *buf, int length)
|
||||||
buf->length = length;
|
buf->length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_pos(struct sd *sd, struct buffer *buf, int pos)
|
|
||||||
{
|
|
||||||
if (pos < 0 || pos >= buf->length)
|
|
||||||
return;
|
|
||||||
buf->pos = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int append(struct sd *sd, struct buffer *buf, char c)
|
static inline int append(struct sd *sd, struct buffer *buf, char c)
|
||||||
{
|
{
|
||||||
if (buf->pos >= 0 && buf->pos < buf->length) {
|
if (buf->pos >= 0 && buf->pos < buf->length) {
|
||||||
|
@ -136,13 +129,13 @@ static void skip_speaker_label(struct sd *sd, char **rpp, struct buffer *buf)
|
||||||
rp[0] == '#' || rp[0] == '.' || rp[0] == ',') {
|
rp[0] == '#' || rp[0] == '.' || rp[0] == ',') {
|
||||||
rp++;
|
rp++;
|
||||||
} else {
|
} else {
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!*rp) {
|
if (!*rp) {
|
||||||
// : was not found
|
// : was not found
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rp++; // skip :
|
rp++; // skip :
|
||||||
|
@ -162,7 +155,7 @@ static void skip_speaker_label(struct sd *sd, char **rpp, struct buffer *buf)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// non space follows - no speaker label
|
// non space follows - no speaker label
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*rpp = rp;
|
*rpp = rp;
|
||||||
|
@ -202,7 +195,7 @@ static bool skip_bracketed(struct sd *sd, char **rpp, struct buffer *buf)
|
||||||
}
|
}
|
||||||
if (!*rp) {
|
if (!*rp) {
|
||||||
// ] was not found
|
// ] was not found
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rp++; // skip ]
|
rp++; // skip ]
|
||||||
|
@ -256,18 +249,18 @@ static bool skip_parenthesed(struct sd *sd, char **rpp, struct buffer *buf)
|
||||||
only_digits = false;
|
only_digits = false;
|
||||||
rp++;
|
rp++;
|
||||||
} else {
|
} else {
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!*rp) {
|
if (!*rp) {
|
||||||
// ) was not found
|
// ) was not found
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (only_digits) {
|
if (only_digits) {
|
||||||
// number within parentheses is probably not SDH
|
// number within parentheses is probably not SDH
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rp++; // skip )
|
rp++; // skip )
|
||||||
|
@ -306,12 +299,12 @@ static void remove_leading_hyphen_space(struct sd *sd, int start_pos, struct buf
|
||||||
|
|
||||||
// if there is not a leading '-' no removing will be done
|
// if there is not a leading '-' no removing will be done
|
||||||
if (buf->string[start_pos] != '-') {
|
if (buf->string[start_pos] != '-') {
|
||||||
set_pos(sd, buf, old_pos);
|
buf->pos = old_pos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *rp = &buf->string[start_pos]; // read from here
|
char *rp = &buf->string[start_pos]; // read from here
|
||||||
set_pos(sd, buf, start_pos); // start writing here
|
buf->pos = start_pos; // start writing here
|
||||||
rp++; // skip '-'
|
rp++; // skip '-'
|
||||||
copy_ass(sd, &rp, buf);
|
copy_ass(sd, &rp, buf);
|
||||||
while (rp[0] == ' ') {
|
while (rp[0] == ' ') {
|
||||||
|
@ -442,7 +435,7 @@ char *filter_SDH(struct sd *sd, char *format, int n_ignored, char *data, int len
|
||||||
// if no normal text i last line - remove last line
|
// if no normal text i last line - remove last line
|
||||||
// by moving write pointer to start of last line
|
// by moving write pointer to start of last line
|
||||||
if (!line_with_text) {
|
if (!line_with_text) {
|
||||||
set_pos(sd, buf, wp_line_end);
|
buf->pos = wp_line_end;
|
||||||
} else {
|
} else {
|
||||||
contains_text = true;
|
contains_text = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue