MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / seekoff

Method seekoff

framework/physfs_fs.cpp:84–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 }
83
84 pos_type seekoff(off_type pos, std::ios_base::seekdir dir,
85 std::ios_base::openmode mode) override
86 {
87 switch (dir)
88 {
89 case std::ios_base::beg:
90 PHYSFS_seek(file, pos);
91 break;
92 case std::ios_base::cur:
93 PHYSFS_seek(file, (PHYSFS_tell(file) + pos) - (egptr() - gptr()));
94 break;
95 case std::ios_base::end:
96 PHYSFS_seek(file, PHYSFS_fileLength(file) + pos);
97 break;
98 default:
99 LogError("Unknown direction in seekoff (%d)", dir);
100 LogAssert(0);
101 }
102
103 if (mode & std::ios_base::in)
104 {
105 setg(egptr(), egptr(), egptr());
106 }
107
108 if (mode & std::ios_base::out)
109 {
110 LogError("ios::out set on read-only IFile \"%s\"", this->systemPath);
111 LogAssert(0);
112 setp(buffer.get(), buffer.get());
113 }
114
115 return PHYSFS_tell(file);
116 }
117
118 pos_type seekpos(pos_type pos, std::ios_base::openmode mode) override
119 {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected