Subversion Repositories filter_foundry

Rev

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

Rev 453 Rev 454
Line 38... Line 38...
38
        MAXLINE = 0x200,
38
        MAXLINE = 0x200,
39
};
39
};
40
 
40
 
41
Boolean readparams_afs_pff(Handle h,char **reason){
41
Boolean readparams_afs_pff(Handle h,char **reason){
42
        Boolean res = false;
42
        Boolean res = false;
43
        char linebuf[MAXLINE+1],curexpr[MAXEXPR+1],*p,*dataend,*q;
43
        char linebuf[MAXLINE + 1] = { 0 };
-
 
44
        char curexpr[MAXEXPR + 1] = { 0 };
-
 
45
        char *p, *dataend, *q;
44
        char c;
46
        char c;
45
        int linecnt, lineptr, exprcnt;
47
        int linecnt, lineptr, exprcnt;
46
 
48
 
47
        if(!h){
49
        if(!h){
48
                *reason = _strdup("readparams: Null parameter handle.");
50
                *reason = _strdup("readparams: Null parameter handle.");
Line 184... Line 186...
184
        uint32_t len;
186
        uint32_t len;
185
        char* val;
187
        char* val;
186
 
188
 
187
        len = *((uint32_t*)*q);
189
        len = *((uint32_t*)*q);
188
        *q += sizeof(uint32_t);
190
        *q += sizeof(uint32_t);
189
        val = (char*)malloc(len + 1);
191
        val = (char*)malloc((size_t)len + 1);
190
        if (val != NULL) {
192
        if (val != NULL) {
191
                memcpy(val, (char*)*q, len);
193
                memcpy(val, (char*)*q, len);
192
                val[len] = 0;
194
                val[len] = 0;
193
        }
195
        }
194
        *q += len;
196
        *q += len;
Line 416... Line 418...
416
        // Case #1: Mac is reading Windows (Win16/32/64) plugin
418
        // Case #1: Mac is reading Windows (Win16/32/64) plugin
417
        if (fromwin && tomac) {
419
        if (fromwin && tomac) {
418
                size_t i;
420
                size_t i;
419
 
421
 
420
                // Convert copyright CRLF to CR (actually, just removing LF)
422
                // Convert copyright CRLF to CR (actually, just removing LF)
421
                char copyrightCRLF[256];
423
                char copyrightCRLF[256] = { 0 };
422
                char* p = &copyrightCRLF[0];
424
                char* p = &copyrightCRLF[0];
423
                for (i = 0; i < strlen(pparm->szCopyright); i++) {
425
                for (i = 0; i < strlen(pparm->szCopyright); i++) {
424
                        if (pparm->szCopyright[i] != LF) {
426
                        if (pparm->szCopyright[i] != LF) {
425
                                *p++ = pparm->szCopyright[i];
427
                                *p++ = pparm->szCopyright[i];
426
                        }
428
                        }
Line 444... Line 446...
444
        // Note: You must read the ".rsrc" resource fork, not the standalone binary!
446
        // Note: You must read the ".rsrc" resource fork, not the standalone binary!
445
        if (frommac && towin) {
447
        if (frommac && towin) {
446
                size_t i;
448
                size_t i;
447
 
449
 
448
                // Convert CR in the copyright field to CRLF.
450
                // Convert CR in the copyright field to CRLF.
449
                char copyrightCRLF[256];
451
                char copyrightCRLF[256] = { 0 };
450
                char* p = &copyrightCRLF[0];
452
                char* p = &copyrightCRLF[0];
451
                for (i = 0; i < strlen(pparm->szCopyright); i++) {
453
                for (i = 0; i < strlen(pparm->szCopyright); i++) {
452
                        *p++ = pparm->szCopyright[i];
454
                        *p++ = pparm->szCopyright[i];
453
                        if (pparm->szCopyright[i] == CR) {
455
                        if (pparm->szCopyright[i] == CR) {
454
                                *p++ = LF;
456
                                *p++ = LF;
Line 559... Line 561...
559
        // Check parameters
561
        // Check parameters
560
        if (maxOutput == 0) return false;
562
        if (maxOutput == 0) return false;
561
        if (inputFile == 0) return false;
563
        if (inputFile == 0) return false;
562
        // Let input memory be read-only, +1 for terminal zero
564
        // Let input memory be read-only, +1 for terminal zero
563
        //char* inputwork = inputFile;
565
        //char* inputwork = inputFile;
564
        inputwork = (char*)malloc(maxInput + 1);
566
        inputwork = (char*)malloc((size_t)maxInput + 1);
565
        inputworkinitial = inputwork;
567
        inputworkinitial = inputwork;
566
        if (inputwork == 0) return false;
568
        if (inputwork == 0) return false;
567
        memcpy(inputwork, inputFile, maxInput);
569
        memcpy(inputwork, inputFile, maxInput);
568
        inputwork[maxInput] = 0; // otherwise strstr() will crash
570
        inputwork[maxInput] = 0; // otherwise strstr() will crash
569
 
571