FastLED 3.9.15
Loading...
Searching...
No Matches

◆ set_file_offset()

static int32_t fl::third_party::vorbis::set_file_offset ( stb_vorbis * f,
uint32_t loc )
static

Definition at line 1121 of file stb_vorbis.cpp.hpp.

1122{
1123 #ifndef FL_STB_VORBIS_NO_PUSHDATA_API
1124 if (f->push_mode) return 0;
1125 #endif
1126 f->eof = 0;
1127 if (FL_STBV_USE_MEMORY(f)) {
1128 // Original check commented out: pointer overflow check triggers -Wtautological-compare
1129 // because compiler assumes no undefined behavior (pointer arithmetic overflow is UB).
1130 // Replaced with equivalent buffer size check using integer arithmetic.
1131 // if (f->stream_start + loc >= f->stream_end || f->stream_start + loc < f->stream_start) {
1132 if (loc >= (size_t)(f->stream_end - f->stream_start)) {
1133 f->stream = f->stream_end;
1134 f->eof = 1;
1135 return 0;
1136 } else {
1137 f->stream = f->stream_start + loc;
1138 return 1;
1139 }
1140 }
1141 #ifndef FL_STB_VORBIS_NO_STDIO
1142 if (loc + f->f_start < loc || loc >= 0x80000000) {
1143 loc = 0x7fffffff;
1144 f->eof = 1;
1145 } else {
1146 loc += f->f_start;
1147 }
1148 if (!fl::fseek(f->f, loc, fl::io::seek_set))
1149 return 1;
1150 f->eof = 1;
1152 return 0;
1153 #endif
1154}
constexpr int seek_set
Definition file_io.h:40
constexpr int seek_end
Definition file_io.h:42
int fseek(FILE *file, long offset, int origin)
Set file position.
Definition file_io.h:266
#define FL_STBV_USE_MEMORY(z)

References FL_NOEXCEPT, FL_STBV_USE_MEMORY, fl::fseek(), fl::io::seek_end, and fl::io::seek_set.

Referenced by get_seek_page_info(), go_to_page_before(), seek_to_sample_coarse(), stb_vorbis_seek_start(), stb_vorbis_stream_length_in_samples(), and vorbis_find_page().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: