src/mess/image.c
| r955 | r956 | |
| 1112 | 1112 | |
| 1113 | 1113 | |
| 1114 | 1114 | /*------------------------------------------------- |
| 1115 | check_for_file |
| 1116 | -------------------------------------------------*/ |
| 1117 | |
| 1118 | static void check_for_file(mess_image *image) |
| 1119 | { |
| 1120 | assert_always(image->file != NULL, "Illegal operation on unmounted image"); |
| 1121 | } |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | /*------------------------------------------------- |
| 1115 | 1126 | image_length |
| 1116 | 1127 | -------------------------------------------------*/ |
| 1117 | 1128 | |
| 1118 | 1129 | UINT64 image_length(mess_image *image) |
| 1119 | 1130 | { |
| 1131 | check_for_file(image); |
| 1120 | 1132 | return core_fsize(image->file); |
| 1121 | 1133 | } |
| 1122 | 1134 | |
| r955 | r956 | |
| 1191 | 1203 | |
| 1192 | 1204 | UINT32 image_fread(mess_image *image, void *buffer, UINT32 length) |
| 1193 | 1205 | { |
| 1206 | check_for_file(image); |
| 1194 | 1207 | return core_fread(image->file, buffer, length); |
| 1195 | 1208 | } |
| 1196 | 1209 | |
| r955 | r956 | |
| 1202 | 1215 | |
| 1203 | 1216 | UINT32 image_fwrite(mess_image *image, const void *buffer, UINT32 length) |
| 1204 | 1217 | { |
| 1218 | check_for_file(image); |
| 1205 | 1219 | return core_fwrite(image->file, buffer, length); |
| 1206 | 1220 | } |
| 1207 | 1221 | |
| r955 | r956 | |
| 1213 | 1227 | |
| 1214 | 1228 | int image_fseek(mess_image *image, INT64 offset, int whence) |
| 1215 | 1229 | { |
| 1230 | check_for_file(image); |
| 1216 | 1231 | return core_fseek(image->file, offset, whence); |
| 1217 | 1232 | } |
| 1218 | 1233 | |
| r955 | r956 | |
| 1224 | 1239 | |
| 1225 | 1240 | UINT64 image_ftell(mess_image *image) |
| 1226 | 1241 | { |
| 1242 | check_for_file(image); |
| 1227 | 1243 | return core_ftell(image->file); |
| 1228 | 1244 | } |
| 1229 | 1245 | |
| r955 | r956 | |
| 1249 | 1265 | |
| 1250 | 1266 | int image_feof(mess_image *image) |
| 1251 | 1267 | { |
| 1268 | check_for_file(image); |
| 1252 | 1269 | return core_feof(image->file); |
| 1253 | 1270 | } |
| 1254 | 1271 | |
| r955 | r956 | |
| 1260 | 1277 | |
| 1261 | 1278 | void *image_ptr(mess_image *image) |
| 1262 | 1279 | { |
| 1280 | check_for_file(image); |
| 1263 | 1281 | return (void *) core_fbuffer(image->file); |
| 1264 | 1282 | } |
| 1265 | 1283 | |