summaryrefslogtreecommitdiff
path: root/lib/cdutils.cpp
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-10 02:59:30 +0000
committerpixel <pixel>2003-12-10 02:59:30 +0000
commit5695a4b1e91154f8b9bae6d62eb9313b973fc6bd (patch)
tree071dff4a418b445451954efb04d0c1286b315387 /lib/cdutils.cpp
parent0b266c95523f944e62acf9251eb27450a8d73a04 (diff)
LUALUALUALUALUALUALUALUALUA
Diffstat (limited to 'lib/cdutils.cpp')
-rw-r--r--lib/cdutils.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/cdutils.cpp b/lib/cdutils.cpp
index ba830f6..685d0f1 100644
--- a/lib/cdutils.cpp
+++ b/lib/cdutils.cpp
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: cdutils.cpp,v 1.17 2003-12-08 15:12:57 pixel Exp $ */
+/* $Id: cdutils.cpp,v 1.18 2003-12-10 02:59:31 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -202,7 +202,7 @@ long cdutils::read_sector(Byte * buffer, int type, int number) {
return sec_sizes[type];
}
-void cdutils::read_datas(Byte * buffer, int type, int number, long size) {
+void cdutils::read_datas(Byte * buffer, long size, int type, int number) {
Byte sector[2352];
int i, n, reste;
@@ -224,7 +224,7 @@ void cdutils::read_datas(Byte * buffer, int type, int number, long size) {
}
}
-void cdutils::read_file(Handle * file, int type, int number, long size) {
+void cdutils::read_file(Handle * file, long size, int type, int number) {
Byte sector[2352];
int i, n, reste;
@@ -279,7 +279,7 @@ void cdutils::write_sector(Byte * buffer, int type, int number) {
}
}
-void cdutils::write_datas(Byte * buffer, int type, int number, long size) {
+void cdutils::write_datas(Byte * buffer, long size, int type, int number) {
long nbsectors, i;
unsigned char sector[2352];
@@ -304,8 +304,8 @@ void cdutils::write_datas(Byte * buffer, int type, int number, long size) {
}
}
-void cdutils::write_file(Handle * file, int type, int number) {
- long size, nbsectors, i;
+void cdutils::write_file(Handle * file, long size, int type, int number) {
+ long nbsectors, i;
unsigned char buffer[2352];
if (type == GUESS) {
@@ -316,7 +316,8 @@ void cdutils::write_file(Handle * file, int type, int number) {
sector_seek(number);
}
- size = file->GetSize();
+ if (size < 0)
+ size = file->GetSize();
nbsectors = size / sec_sizes[type];
if (size % sec_sizes[type]) {
@@ -391,7 +392,7 @@ int cdutils::show_dir(struct DirEntry * dir) {
}
buffer = (Byte *) malloc(dir->Size);
- read_datas(buffer, GUESS, dir->Sector, dir->Size);
+ read_datas(buffer, dir->Size, GUESS, dir->Sector);
ptr = 0;
while(ptr < dir->Size) {
@@ -412,7 +413,7 @@ struct cdutils::DirEntry cdutils::find_dir_entry(struct DirEntry * dir, String n
}
buffer = (unsigned char *) malloc(size = dir->Size);
- read_datas(buffer, GUESS, dir->Sector, dir->Size);
+ read_datas(buffer, dir->Size, GUESS, dir->Sector);
ptr = 0;
while(ptr < size) {
@@ -442,7 +443,7 @@ struct cdutils::DirEntry * cdutils::find_dir_entry(Byte ** bufout, struct cdutil
}
buffer = (Byte *) malloc(size = dir->Size);
- read_datas(buffer, GUESS, dir->Sector, dir->Size);
+ read_datas(buffer, dir->Size, GUESS, dir->Sector);
ptr = 0;
while(ptr < size) {
@@ -584,7 +585,7 @@ int cdutils::get_pt_infos() {
}
buffer = (Byte *) malloc(ptl);
- read_datas(buffer, GUESS, !pt1 ? pt2 : pt1, ptl);
+ read_datas(buffer, ptl, GUESS, !pt1 ? pt2 : pt1);
if (buffer[0] == 1)
if (buffer[1] == 0)
@@ -613,7 +614,7 @@ int cdutils::show_pt_infos() {
}
buffer = (Byte *) malloc(ptl);
- read_datas(buffer, GUESS, !pt1 ? pt2 : pt1, ptl);
+ read_datas(buffer, ptl, GUESS, !pt1 ? pt2 : pt1);
printm(M_BARE, "node^paren@sector : name\n");
for (ptr = 0, i = 1; buffer[ptr]; ptr += ptr & 1, i++) {
@@ -851,7 +852,7 @@ ssize_t cdfile::read(void *buf, size_t count) throw (GeneralException) {
buf = (Byte *) buf + nstartbytes;
if (count) {
- cd->read_datas((Byte *) buf, mode, startsec + 1, count);
+ cd->read_datas((Byte *) buf, count, mode, startsec + 1);
}
itell += count + nstartbytes;