Subversion Repositories filter_foundry

Rev

Rev 503 | Rev 518 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 503 Rev 505
Line 44... Line 44...
44
        }
44
        }
45
        return e;
45
        return e;
46
}
46
}
47
 
47
 
48
OSErr saveparams_afs_pff(Handle h){
48
OSErr saveparams_afs_pff(Handle h){
49
        char outbuf[CHOPLINES*2+2],*q,*p,*r,*start;
49
        char outbuf[CHOPLINES * 2 + 2] = "";
-
 
50
        char *q, * p, * r, * start;
50
        size_t n, chunk, j;
51
        size_t n, chunk, j;
51
        int i;
52
        int i;
52
        OSErr e;
53
        OSErr e;
53
        size_t est;
54
        size_t est;
54
        static char afs_sig[] = "%RGB-1.0\r";
55
        static char afs_sig[] = "%RGB-1.0\r";
Line 68... Line 69...
68
                for( i=0 ; i<8 ; ++i )
69
                for( i=0 ; i<8 ; ++i )
69
                        p += sprintf(p, "%d\r", slider[i]);
70
                        p += sprintf(p, "%d\r", slider[i]);
70
 
71
 
71
                /* expressions, broken into lines no longer than CHOPLINES characters */
72
                /* expressions, broken into lines no longer than CHOPLINES characters */
72
                for( i=0 ; i<4 ; ++i ){
73
                for( i=0 ; i<4 ; ++i ){
73
                        if( (r = expr[i]) )
74
                        if ((r = expr[i])) {
-
 
75
                                chunk = 0; // to avoid that compiler complains
74
                                for( n = strlen(r) ; n ; n -= chunk ){
76
                                for (n = strlen(r); n; n -= chunk) {
75
                                        chunk = n> (int)CHOPLINES ? (int)CHOPLINES : n;
77
                                        chunk = n > (int)CHOPLINES ? (int)CHOPLINES : n;
76
                                        for( j = chunk,q = outbuf ; j-- ; )
78
                                        for (j = chunk, q = outbuf; j--; )
77
                                                if(*r == CR){
79
                                                if (*r == CR) {
78
                                                        *q++ = '\\';
80
                                                        *q++ = '\\';
79
                                                        *q++ = 'r';
81
                                                        *q++ = 'r';
80
                                                        ++r;
82
                                                        ++r;
-
 
83
                                                }
81
                                                }else if (*r == LF) {
84
                                                else if (*r == LF) {
82
 
85
 
83
                                                        // This can only happen with Windows or Linux.
86
                                                        // This can only happen with Windows or Linux.
84
                                                        // Native Linux is not supported, and Windows always combines LF with CR. So we can ignore LF.
87
                                                        // Native Linux is not supported, and Windows always combines LF with CR. So we can ignore LF.
85
                                                        ++r;
88
                                                        ++r;
-
 
89
                                                }
86
                                                }else
90
                                                else
87
                                                        *q++ = *r++;
91
                                                        *q++ = *r++;
88
                                        *q++ = CR;
92
                                        *q++ = CR;
89
                                        *q = 0;
93
                                        *q = 0;
90
                                        p = cat(p,outbuf);
94
                                        p = cat(p, outbuf);
91
                                }
95
                                }
-
 
96
                        }
92
                        else
97
                        else
93
                                p = cat(p,(char*)("(null expr)\r")); // this shouldn't happen
98
                                p = cat(p,(char*)("(null expr)\r")); // this shouldn't happen
94
                        *p++ = CR;
99
                        *p++ = CR;
95
                }
100
                }
96
 
101
 
Line 196... Line 201...
196
        return e;
201
        return e;
197
}
202
}
198
 
203
 
199
OSErr savehandleintofile(Handle h,FILEREF r){
204
OSErr savehandleintofile(Handle h,FILEREF r){
200
        Ptr p;
205
        Ptr p;
201
        long n;
206
        FILECOUNT n;
202
        OSErr e;
207
        OSErr e;
203
 
208
 
204
        if (!h) return nilHandleErr;
209
        if (!h) return nilHandleErr;
205
        p = PILOCKHANDLE(h,false);
210
        p = PILOCKHANDLE(h,false);
206
        n = PIGETHANDLESIZE(h);
211
        n = (FILECOUNT)PIGETHANDLESIZE(h);
207
        e = FSWrite(r,&n,p);
212
        e = FSWrite(r,&n,p);
208
        PIUNLOCKHANDLE(h);
213
        PIUNLOCKHANDLE(h);
209
        return e;
214
        return e;
210
}
215
}
211
 
216