Subversion Repositories filter_foundry

Compare Revisions

Regard whitespace Rev 556 → Rev 557

/trunk/ff.h
114,7 → 114,9
 
// FFLoadingResult = 0 : Success
// FFLoadingResult > 0 : Error, message ID as described in language.h
#define LOADING_OK 0
typedef int FFLoadingResult;
#define SAVING_OK 0
typedef int FFSavingResult;
 
//#define DEBUG
/trunk/load_win.c
88,7 → 88,7
 
// First, try to read the file as AFS/PFF/TXT file
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (0 == (res = readfile_afs_pff(sfr))) {
if (LOADING_OK == (res = readfile_afs_pff(sfr))) {
gdata->obfusc = false;
parm_reset(true, false, true, false);
return 0;
103,7 → 103,7
 
// Try to read the file as FFL file
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (0 == (res = readfile_ffl(sfr))) {
if (LOADING_OK == (res = readfile_ffl(sfr))) {
gdata->obfusc = false;
parm_reset(true, true, true, true);
return 0;
118,7 → 118,7
 
// Is it a "Filters Unlimited" FFX filter? (Only partially compatible with Filter Factory!!!)
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (0 == (res = readfile_ffx(sfr))) {
if (LOADING_OK == (res = readfile_ffx(sfr))) {
return 0;
}
if (!fileHasExtension(sfr, TEXT(".ffx"))) {
132,7 → 132,7
// If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (hm = LoadLibraryEx(sfr->sfFile.szName, NULL, LOAD_LIBRARY_AS_DATAFILE)) {
if (0 == (res = readPARMresource(hm))) {
if (LOADING_OK == (res = readPARMresource(hm))) {
gdata->parm.standalone = false; // just because the loaded file is standalone, does not mean that WE are standalone
if (gdata->parm.iProtected) {
parm_reset(true, true, true, true);
150,7 → 150,7
// Is it a "Filters Unlimited" TXT filter? (Only partially compatible with Filter Factory!!!)
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (fileHasExtension(sfr, TEXT(".txt"))) {
if (0 == (res = readfile_picotxt_or_ffdecomp(sfr))) {
if (LOADING_OK == (res = readfile_picotxt_or_ffdecomp(sfr))) {
return 0;
}
}
159,7 → 159,7
// Is it a "GIMP UserFilter (GUF)" file? (Only partially compatible with Filter Factory!!!)
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (fileHasExtension(sfr, TEXT(".guf"))) {
if (0 == (res = readfile_guf(sfr))) {
if (LOADING_OK == (res = readfile_guf(sfr))) {
return 0;
}
}
168,7 → 168,7
// If nothing worked, we will try to find a PARM resource (MacOS plugin, or 64 bit 8BF on Win32 OS)
// Note that we cannot detect obfuscated filters here!
if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
if (0 == (res = readfile_8bf(sfr))) {
if (LOADING_OK == (res = readfile_8bf(sfr))) {
if (gdata->parm.iProtected) {
// This is for purely protected filters before the time when obfuscation and protection was merged
parm_reset(true, true, true, true);
/trunk/main.c
332,7 → 332,7
gdata = (globals_t*)malloc(sizeof(globals_t));
if (!gdata) break;
gdata->hWndMainDlg = (HWND)((PlatformData*)((AboutRecordPtr)pb)->platformData)->hwnd; // so that simplealert() works
parmReadOk = (0 == readPARMresource((HMODULE)hDllInstance));
parmReadOk = (LOADING_OK == readPARMresource((HMODULE)hDllInstance));
if (!parmReadOk) gdata->parm.standalone = false;
if (parmReadOk && (gdata->parm.cbSize != PARM_SIZE) && (gdata->parm.cbSize != PARM_SIZE_PREMIERE) && (gdata->parm.cbSize != PARM_SIG_MAC)) {
parm_reset(true, true, true, true);
422,7 → 422,7
restoreInternalState(tmpState);
}
 
if (saveres != 0) {
if (saveres != SAVING_OK) {
TCHAR* reason = FF_GetMsg_Cpy(saveres);
alertuser_id(MSG_CANNOT_SAVE_SETTINGS_ID, reason);
FF_GetMsg_Free(reason);
574,7 → 574,7
sfr.sfReplacing = true;
sfr.sfType = PS_FILTER_FILETYPE;
 
parmReadOk = (0 == readPARMresource((HMODULE)hDllInstance));
parmReadOk = (LOADING_OK == readPARMresource((HMODULE)hDllInstance));
if (!parmReadOk) gdata->parm.standalone = false;
if (parmReadOk && (gdata->parm.cbSize != PARM_SIZE) && (gdata->parm.cbSize != PARM_SIZE_PREMIERE) && (gdata->parm.cbSize != PARM_SIG_MAC)) {
parm_reset(true, true, true, true);
599,7 → 599,7
tmpState = saveInternalState();
}
 
if (0 == loadfile(&sfr)) {
if (LOADING_OK == loadfile(&sfr)) {
if (parmReadOk) {
// In the standalone filter, we only want the parameters (ctl,map) in the temporary .afs file, not the formulas
// We do not need to care about the metadata, because the AFS does not touch the metadata anyway
616,7 → 616,7
}
}
 
if( (bUninitializedParams = !(params && (0 == readparams_afs_pff(params, false)))) ){
if( (bUninitializedParams = !(params && (LOADING_OK == readparams_afs_pff(params, false)))) ){
/* either the parameter handle was uninitialised,
or the parameter data couldn't be read; set default values */
 
623,7 → 623,7
Boolean parmReadOk;
 
// see if saved parameters exist
parmReadOk = (0 == readPARMresource((HMODULE)hDllInstance));
parmReadOk = (LOADING_OK == readPARMresource((HMODULE)hDllInstance));
if (!parmReadOk) gdata->parm.standalone = false;
if (parmReadOk && (gdata->parm.cbSize != PARM_SIZE) && (gdata->parm.cbSize != PARM_SIZE_PREMIERE) && (gdata->parm.cbSize != PARM_SIG_MAC)) {
parm_reset(true, true, true, true);
/trunk/read.c
98,7 → 98,7
}
 
if(++exprcnt == 4){
res = 0;
res = LOADING_OK;
break; /* got everything we want */
}
 
324,7 → 324,7
strcpy(gdata->parm.szMap[2], "Map 2:");
strcpy(gdata->parm.szMap[3], "Map 3:");
 
res = 0;
res = LOADING_OK;
}
}
PIDISPOSEHANDLE(h);
332,7 → 332,7
FSClose(refnum);
}
 
if (res == 0) gdata->obfusc = false;
if (res == LOADING_OK) gdata->obfusc = false;
return res;
}
 
356,7 → 356,7
for( count /= 4 ; count >= PARM_SIZE/4 ; --count, ++q )
{
res = readPARM(&gdata->parm, (Ptr)q);
if (res == 0) break;
if (res == LOADING_OK) break;
}
 
PIDISPOSEHANDLE(h);
367,7 → 367,7
}else
res = MSG_CANNOT_OPEN_FILE_ID;
 
if (res == 0) gdata->obfusc = false;
if (res == LOADING_OK) gdata->obfusc = false;
return res;
}
 
760,7 → 760,7
}
}
 
res = 0;
res = LOADING_OK;
}
 
PIUNLOCKHANDLE(h);
793,7 → 793,7
if (tmpFileContents == NULL) return false;
sprintf(tmpFileContents, "\n%s\n[", inputwork);
for (iTmp = 0; iTmp < strlen(tmpFileContents); iTmp++) {
if (tmpFileContents[iTmp] == '\r') tmpFileContents[iTmp] = '\n';
if (tmpFileContents[iTmp] == CR) tmpFileContents[iTmp] = LF;
}
 
// Find the section begin
926,7 → 926,7
}
}
 
res = 0;
res = LOADING_OK;
}
 
PIUNLOCKHANDLE(h);
962,7 → 962,7
FFLoadingResult readfile_ffl(StandardFileReply* sfr) {
FILEREF rTmp, refnum;
Handle h, hTmp;
FFLoadingResult res = 0;
FFLoadingResult res = LOADING_OK;
StandardFileReply sfrTmp;
OSErr e;
char* p, * start;
1002,7 → 1002,7
size_t i;
char* token2 = my_strdup(token);
for (i = 0; i < strlen(token2); i++) {
if (token2[i] == '\r') token2[i] = '\0';
if (token2[i] == CR) token2[i] = '\0';
}
if (lineNumber == 0) {
// We already checked it above (in order to avoid an unnecessary memory copy)
1177,7 → 1177,7
FSClose(refnum);
}
 
if (res == 0) {
if (res == LOADING_OK) {
res = foundFilters == 0 ? MSG_FFL_NO_FILTERS_DETECTED_ID : MSG_FFL_CONVERTED_ID;
}
return res;
/trunk/save.c
273,7 → 273,7
FILEREF r;
Handle h;
Boolean bres = false;
FFSavingResult res = 0;
FFSavingResult res = SAVING_OK;
 
FSpDelete(&sfr->sfFile);
if (FSpCreate(&sfr->sfFile, SIG_SIMPLETEXT, TEXT_FILETYPE, sfr->sfScript) == noErr) {
/trunk/ui.c
116,7 → 116,7
 
/* traverse expression tree, looking for constant references to sliders/maps */
 
static int _checksl(struct node*p,int ctlflags[],int mapflags[]){
static int _checksl(struct node*p,bool32_t ctlflags[], bool32_t mapflags[]){
int s, i, result;
 
result = 0;
417,7 → 417,7
// Backup everything, otherwise we might lose parameter data if the loading fails
bakState = saveInternalState();
 
if (0 == (res = loadfile(&sfr))) {
if (LOADING_OK == (res = loadfile(&sfr))) {
updatedialog(dp);
maindlgupdate(dp);
}
500,7 → 500,7
 
if (saveDlgRet) {
FFSavingResult saveres = savefile_afs_pff_picotxt_guf(&sfr);
if (saveres != 0) {
if (saveres != SAVING_OK) {
TCHAR* reason = FF_GetMsg_Cpy(saveres);
alertuser_id(MSG_CANNOT_SAVE_SETTINGS_ID, reason);
FF_GetMsg_Free(reason);