Skip to content

Commit

Permalink
remove deprecated function calls (#3859)
Browse files Browse the repository at this point in the history
Co-authored-by: Prabhat Roy <prabhatroy@fb.com>
  • Loading branch information
bjuncek and prabhat00155 authored May 21, 2021
1 parent 1a10a9a commit 231f80d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions torchvision/csrc/io/decoder/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ inline size_t getSize(const AVSubtitleRect& x) {
switch (y.type) {
case SUBTITLE_BITMAP:
for (int i = 0; i < y.nb_colors; ++i) {
s += sizeof(y.pict.linesize[i]);
s += y.pict.linesize[i];
s += sizeof(y.linesize[i]);
s += y.linesize[i];
}
break;
case SUBTITLE_TEXT:
Expand Down Expand Up @@ -93,14 +93,14 @@ inline bool serializeItem(
switch (x.type) {
case SUBTITLE_BITMAP:
for (int i = 0; i < x.nb_colors; ++i) {
if (!serializeItem(d, l, p, x.pict.linesize[i])) {
if (!serializeItem(d, l, p, x.linesize[i])) {
return false;
}
if (p + x.pict.linesize[i] > l) {
if (p + x.linesize[i] > l) {
return false;
}
memcpy(d + p, x.pict.data[i], x.pict.linesize[i]);
p += x.pict.linesize[i];
memcpy(d + p, x.data[i], x.linesize[i]);
p += x.linesize[i];
}
return true;
case SUBTITLE_TEXT: {
Expand Down Expand Up @@ -172,15 +172,15 @@ inline bool deserializeItem(
switch (x.type) {
case SUBTITLE_BITMAP:
for (int i = 0; i < x.nb_colors; ++i) {
if (!deserializeItem(y, l, p, x.pict.linesize[i])) {
if (!deserializeItem(y, l, p, x.linesize[i])) {
return false;
}
if (p + x.pict.linesize[i] > l) {
if (p + x.linesize[i] > l) {
return false;
}
x.pict.data[i] = (uint8_t*)av_malloc(x.pict.linesize[i]);
memcpy(x.pict.data[i], y + p, x.pict.linesize[i]);
p += x.pict.linesize[i];
x.data[i] = (uint8_t*)av_malloc(x.linesize[i]);
memcpy(x.data[i], y + p, x.linesize[i]);
p += x.linesize[i];
}
return true;
case SUBTITLE_TEXT: {
Expand Down

0 comments on commit 231f80d

Please sign in to comment.