GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: a tiny graphical app kit for ruby
Homepage: http://code.whytheluckystiff.net/shoes
Clone URL: git://github.com/why/shoes.git
 * req/binject/ext/binject_c/hfslib.c: windows fixes to use HFS_BUFSIZE 
 rather than BUFSIZE.  fixes the dmg output crash.
why (author)
Sat Sep 13 21:19:25 -0700 2008
commit  90b844f08f688057afc1226cdb0e1f6702c701d5
tree    f3281eecb3c69a26c1ed09c7fbc54e3382c0eaec
parent  f6a9cf75de7fd0890c11428ed1b2ca2cf40c7cb5
...
8
9
10
11
 
12
13
14
 
15
16
17
...
26
27
28
29
30
 
 
31
32
33
 
34
35
36
37
 
 
38
39
40
...
50
51
52
53
 
54
55
56
...
59
60
61
62
63
64
65
...
68
69
70
71
72
73
 
 
 
74
75
76
 
 
77
78
79
 
 
80
81
82
 
83
84
85
 
86
87
88
...
8
9
10
 
11
12
13
 
14
15
16
17
...
26
27
28
 
 
29
30
31
32
 
33
34
35
 
 
36
37
38
39
40
...
50
51
52
 
53
54
55
56
...
59
60
61
 
62
63
64
...
67
68
69
 
 
 
70
71
72
73
 
 
74
75
76
 
 
77
78
79
80
 
81
82
83
 
84
85
86
87
0
@@ -8,10 +8,10 @@
0
 #include "abstractfile.h"
0
 #include <sys/stat.h>
0
 
0
-#define BUFSIZE 1024*1024
0
+#define HFS_BUFSIZE 32768
0
 
0
 void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume) {
0
- unsigned char buffer[BUFSIZE];
0
+ unsigned char buffer[HFS_BUFSIZE];
0
   io_func* io;
0
   off_t curPosition;
0
   size_t bytesLeft;
0
@@ -26,15 +26,15 @@ void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume)
0
   bytesLeft = file->dataFork.logicalSize;
0
   
0
   while(bytesLeft > 0) {
0
- if(bytesLeft > BUFSIZE) {
0
- if(!READ(io, curPosition, BUFSIZE, buffer)) {
0
+ if(bytesLeft > HFS_BUFSIZE) {
0
+ if(!READ(io, curPosition, HFS_BUFSIZE, buffer)) {
0
         panic("error reading");
0
       }
0
- if(output->write(output, buffer, BUFSIZE) != BUFSIZE) {
0
+ if(output->write(output, buffer, HFS_BUFSIZE) != HFS_BUFSIZE) {
0
         panic("error writing");
0
       }
0
- curPosition += BUFSIZE;
0
- bytesLeft -= BUFSIZE;
0
+ curPosition += HFS_BUFSIZE;
0
+ bytesLeft -= HFS_BUFSIZE;
0
     } else {
0
       if(!READ(io, curPosition, bytesLeft, buffer)) {
0
         panic("error reading");
0
@@ -50,7 +50,7 @@ void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume)
0
 }
0
 
0
 void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volume) {
0
- unsigned char buffer[BUFSIZE];
0
+ unsigned char buffer[HFS_BUFSIZE];
0
   io_func* io;
0
   off_t curPosition;
0
   off_t bytesLeft;
0
@@ -59,7 +59,6 @@ void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volum
0
 
0
   io = openRawFile(file->fileID, &file->dataFork, (HFSPlusCatalogRecord*)file, volume);
0
   if(io == NULL) {
0
- panic("error opening file");
0
     return;
0
   }
0
   
0
@@ -68,21 +67,21 @@ void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volum
0
   allocate((RawFile*)io->data, bytesLeft);
0
   
0
   while(bytesLeft > 0) {
0
- if(bytesLeft > BUFSIZE) {
0
- if(input->read(input, buffer, BUFSIZE) != BUFSIZE) {
0
- panic("error reading");
0
+ if(bytesLeft > HFS_BUFSIZE) {
0
+ if(input->read(input, buffer, HFS_BUFSIZE) != HFS_BUFSIZE) {
0
+ break;
0
       }
0
- if(!WRITE(io, curPosition, BUFSIZE, buffer)) {
0
- panic("error writing");
0
+ if(!WRITE(io, curPosition, HFS_BUFSIZE, buffer)) {
0
+ break;
0
       }
0
- curPosition += BUFSIZE;
0
- bytesLeft -= BUFSIZE;
0
+ curPosition += HFS_BUFSIZE;
0
+ bytesLeft -= HFS_BUFSIZE;
0
     } else {
0
       if(input->read(input, buffer, (size_t)bytesLeft) != (size_t)bytesLeft) {
0
- panic("error reading");
0
+ break;
0
       }
0
       if(!WRITE(io, curPosition, (size_t)bytesLeft, buffer)) {
0
- panic("error reading");
0
+ break;
0
       }
0
       curPosition += bytesLeft;
0
       bytesLeft -= bytesLeft;

Comments

    No one has commented yet.