Subversion Repositories filter_foundry

Rev

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

Rev 488 Rev 505
Line 34... Line 34...
34
                )
34
                )
35
        {
35
        {
36
                // PICA Handle Suite 2.0
36
                // PICA Handle Suite 2.0
37
                hdl->signature = HDLVERSION_SUITE2;
37
                hdl->signature = HDLVERSION_SUITE2;
38
                if (gdata) gdata->lastKnownHandleVersion = hdl->signature;
38
                if (gdata) gdata->lastKnownHandleVersion = hdl->signature;
39
                hdl->handle = pSHandleSuite2->New(nBytes);
39
                hdl->handle = pSHandleSuite2->New((int32)nBytes);
40
                gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion2);
40
                gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion2);
41
        }
41
        }
42
        else if ((gpb->sSPBasic != 0) &&
42
        else if ((gpb->sSPBasic != 0) &&
43
                (gpb->sSPBasic->AcquireSuite(kPIHandleSuite, kPSHandleSuiteVersion1, (const void**)&pSHandleSuite1) == noErr) &&
43
                (gpb->sSPBasic->AcquireSuite(kPIHandleSuite, kPSHandleSuiteVersion1, (const void**)&pSHandleSuite1) == noErr) &&
44
                (pSHandleSuite1 != NULL) &&
44
                (pSHandleSuite1 != NULL) &&
Line 46... Line 46...
46
                )
46
                )
47
        {
47
        {
48
                // PICA Handle Suite 1.0
48
                // PICA Handle Suite 1.0
49
                hdl->signature = HDLVERSION_SUITE1;
49
                hdl->signature = HDLVERSION_SUITE1;
50
                if (gdata) gdata->lastKnownHandleVersion = hdl->signature;
50
                if (gdata) gdata->lastKnownHandleVersion = hdl->signature;
51
                hdl->handle = pSHandleSuite1->New(nBytes);
51
                hdl->handle = pSHandleSuite1->New((int32)nBytes);
52
                gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion1);
52
                gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion1);
53
        }
53
        }
54
        else {
54
        else {
55
                // Standard Handle Suite (deprecated)
55
                // Standard Handle Suite (deprecated)
56
                hdl->signature = HDLVERSION_STANDARD;
56
                hdl->signature = HDLVERSION_STANDARD;
57
                if (gdata) gdata->lastKnownHandleVersion = hdl->signature;
57
                if (gdata) gdata->lastKnownHandleVersion = hdl->signature;
58
                hdl->handle = gpb->handleProcs->newProc(nBytes);
58
                hdl->handle = gpb->handleProcs->newProc((int32)nBytes);
59
        }
59
        }
60
}
60
}
61
 
61
 
62
void disposeHandle(FFHandle* hdl) {
62
void disposeHandle(FFHandle* hdl) {
63
        if (hdl->signature == HDLVERSION_SUITE2) {
63
        if (hdl->signature == HDLVERSION_SUITE2) {
Line 137... Line 137...
137
                        (pSHandleSuite2 != NULL) &&
137
                        (pSHandleSuite2 != NULL) &&
138
                        (pSHandleSuite2 != (PSHandleSuite2*)gpb->handleProcs /* Just to be sure (although no bug is known) */)
138
                        (pSHandleSuite2 != (PSHandleSuite2*)gpb->handleProcs /* Just to be sure (although no bug is known) */)
139
                        )
139
                        )
140
                {
140
                {
141
                        // PICA Handle Suite 2.0
141
                        // PICA Handle Suite 2.0
142
                        OSErr ret = pSHandleSuite2->SetSize(hdl->handle, nBytes);
142
                        OSErr ret = pSHandleSuite2->SetSize(hdl->handle, (int32)nBytes);
143
                        gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion2);
143
                        gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion2);
144
                        return ret;
144
                        return ret;
145
                }
145
                }
146
        }
146
        }
147
        else if (hdl->signature == HDLVERSION_SUITE1) {
147
        else if (hdl->signature == HDLVERSION_SUITE1) {
Line 151... Line 151...
151
                        (pSHandleSuite1 != NULL) &&
151
                        (pSHandleSuite1 != NULL) &&
152
                        (pSHandleSuite1 != (PSHandleSuite1*)gpb->handleProcs /* Just to be sure (although no bug is known) */)
152
                        (pSHandleSuite1 != (PSHandleSuite1*)gpb->handleProcs /* Just to be sure (although no bug is known) */)
153
                        )
153
                        )
154
                {
154
                {
155
                        // PICA Handle Suite 1.0
155
                        // PICA Handle Suite 1.0
156
                        OSErr ret = pSHandleSuite1->SetSize(hdl->handle, nBytes);
156
                        OSErr ret = pSHandleSuite1->SetSize(hdl->handle, (int32)nBytes);
157
                        gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion1);
157
                        gpb->sSPBasic->ReleaseSuite(kPIHandleSuite, kPSHandleSuiteVersion1);
158
                        return ret;
158
                        return ret;
159
                }
159
                }
160
        }
160
        }
161
        else if (hdl->signature == HDLVERSION_STANDARD) {
161
        else if (hdl->signature == HDLVERSION_STANDARD) {
162
                // Standard Handle Suite (deprecated)
162
                // Standard Handle Suite (deprecated)
163
                return gpb->handleProcs->setSizeProc(hdl->handle, nBytes);
163
                return gpb->handleProcs->setSizeProc(hdl->handle, (int32)nBytes);
164
        }
164
        }
165
        return errMissingParameter;
165
        return errMissingParameter;
166
}
166
}
167
 
167
 
168
Ptr lockHandle(FFHandle* hdl) {
168
Ptr lockHandle(FFHandle* hdl) {
Line 259... Line 259...
259
        fh.signature = gdata->lastKnownHandleVersion;
259
        fh.signature = gdata->lastKnownHandleVersion;
260
        fh.handle = h;
260
        fh.handle = h;
261
        disposeHandle(&fh);
261
        disposeHandle(&fh);
262
}
262
}
263
 
263
 
264
int32 PIGETHANDLESIZE(Handle h) {
264
size_t PIGETHANDLESIZE(Handle h) {
265
        FFHandle fh;
265
        FFHandle fh;
266
        fh.signature = gdata->lastKnownHandleVersion;
266
        fh.signature = gdata->lastKnownHandleVersion;
267
        fh.handle = h;
267
        fh.handle = h;
268
        return getHandleSize(&fh);
268
        return getHandleSize(&fh);
269
}
269
}
Line 311... Line 311...
311
                // 
311
                // 
312
                // Side note:  64-bit support for Windows was established in Photoshop CS 4,
312
                // Side note:  64-bit support for Windows was established in Photoshop CS 4,
313
                //             PSBufferSuite2 was first documented in SDK CS 6,
313
                //             PSBufferSuite2 was first documented in SDK CS 6,
314
                //             pb->bufferProcs->allocateProc64 and spaceProc64 were documented in SDK CS 6,
314
                //             pb->bufferProcs->allocateProc64 and spaceProc64 were documented in SDK CS 6,
315
                //             pb->bufferSpace64 and pb->maxSpace64 were documented in SDK CC 2017.
315
                //             pb->bufferSpace64 and pb->maxSpace64 were documented in SDK CC 2017.
316
                unsigned32 siz = nBytes;
316
                unsigned32 siz = (unsigned32)nBytes;
317
                buf->signature = BUFVERSION_SUITE64;
317
                buf->signature = BUFVERSION_SUITE64;
318
                if (gdata) gdata->lastKnownBufferVersion = buf->signature;
318
                if (gdata) gdata->lastKnownBufferVersion = buf->signature;
319
                buf->suite = (Ptr)pSBufferSuite64->New(&siz, siz);
319
                buf->suite = (Ptr)pSBufferSuite64->New(&siz, siz);
320
                if (siz < nBytes) {
320
                if (siz < nBytes) {
321
                        buf->signature = BUFVERSION_NULL;
321
                        buf->signature = BUFVERSION_NULL;
Line 328... Line 328...
328
                (pSBufferSuite32 != NULL) &&
328
                (pSBufferSuite32 != NULL) &&
329
                (pSBufferSuite32 != (PSBufferSuite1*)gpb->bufferProcs /* Just to be sure (although no bug is known) */)
329
                (pSBufferSuite32 != (PSBufferSuite1*)gpb->bufferProcs /* Just to be sure (although no bug is known) */)
330
                )
330
                )
331
        {
331
        {
332
                // PICA Buffer Suite 1.0 (32 bit)
332
                // PICA Buffer Suite 1.0 (32 bit)
333
                unsigned32 siz = nBytes;
333
                unsigned32 siz = (unsigned32)nBytes;
334
                buf->signature = BUFVERSION_SUITE32;
334
                buf->signature = BUFVERSION_SUITE32;
335
                if (gdata) gdata->lastKnownBufferVersion = buf->signature;
335
                if (gdata) gdata->lastKnownBufferVersion = buf->signature;
336
                buf->suite = (Ptr)pSBufferSuite32->New(&siz, siz);
336
                buf->suite = (Ptr)pSBufferSuite32->New(&siz, siz);
337
                if (siz < nBytes) {
337
                if (siz < nBytes) {
338
                        buf->signature = BUFVERSION_NULL;
338
                        buf->signature = BUFVERSION_NULL;
Line 353... Line 353...
353
        else
353
        else
354
        {
354
        {
355
                // Standard Buffer Suite 32 bit (deprecated)
355
                // Standard Buffer Suite 32 bit (deprecated)
356
                buf->signature = BUFVERSION_STD32;
356
                buf->signature = BUFVERSION_STD32;
357
                if (gdata) gdata->lastKnownBufferVersion = buf->signature;
357
                if (gdata) gdata->lastKnownBufferVersion = buf->signature;
358
                if (gpb->bufferProcs->allocateProc(nBytes, &buf->standard) != noErr) {
358
                if (gpb->bufferProcs->allocateProc((int32)nBytes, &buf->standard) != noErr) {
359
                        buf->signature = BUFVERSION_NULL;
359
                        buf->signature = BUFVERSION_NULL;
360
                        buf->standard = NULL;
360
                        buf->standard = NULL;
361
                }
361
                }
362
        }
362
        }
363
}
363
}