/*
/* This patch is required in order to build P4GT plug-in for Photoshop CC.
/*
/* source file location: ../p4gt/sdk/photoshop_cc/pluginsdk/samplecode/common/sources/PIUFile.cpp
/* target file location: ../p4gt/photoshop_cc/PIUFile.cpp
/*
/* Instructions:
/* Copy source file to target location and apply patch code [below]
/* to file in target location. Project file is pre-configured to use
/* PIUFile.cpp in target location.
/*
/* To make applying this patch much easier, you can download this 'patch.exe' utility
/* from GnuWin: http://gnuwin32.sourceforge.net/packages/patch.htm
/*
/* Then simply cd to directory ..\p4-gt\photoshop_cc and run this command:
/* patch.exe -u -l -o PIUFile.cpp PIUFile.cpp.patch ..\sdk\photoshop_cc\pluginsdk\samplecode\common\sources\PIUFile.cpp
/*
/* Patch follows...
/*
=>p4 diff2 -duw ..\sdk\photoshop_cc\pluginsdk\samplecode\common\sources\PIUFile.cpp PIUFile.cpp
==== //depot/main/p4-gt/sdk/photoshop_cc/pluginsdk/samplecode/common/sources/PIUFile.cpp#1 (text) - //depot/main/p4-gt/photoshop_cc/PIUFile.cpp#1 (text) ==== content
@@ -41,8 +41,6 @@
#elif defined(__PIWin__)
int32 length = sPSHandle->GetSize(aliasValue);
- if (length > maxPathLength - 1) return;
-
Boolean oldLock = FALSE;
Ptr pointer = NULL;
@@ -50,8 +48,7 @@
if (pointer != NULL)
{
- strncpy(fullPath, pointer, maxPathLength);
- fullPath[maxPathLength-1] = '\0';
+ strcpy(fullPath, pointer);
sPSHandle->SetLock(aliasValue, oldLock, &pointer, &oldLock);
}
@@ -69,20 +66,15 @@
(void) sPSAlias->MacNewAliasFromCString(fullPath, &aHandle);
aliasValue = (Handle)aHandle;
#else
- Boolean oldLock = FALSE;
- Ptr address = NULL;
- size_t pathLength = strlen(fullPath)+1;
- aliasValue = sPSHandle->New((int32)pathLength);
+ Boolean oldLock;
+ Ptr address;
+ aliasValue = sPSHandle->New((int32)(strlen(fullPath)+1));
if (aliasValue != NULL)
{
sPSHandle->SetLock(aliasValue, true, &address, &oldLock);
- if (address != NULL)
- {
- strncpy(address, fullPath, pathLength);
- address[pathLength-1] = '\0';
+ strncpy(address, fullPath, strlen(fullPath)+1);
sPSHandle->SetLock(aliasValue, false, &address, &oldLock);
}
- }
#endif
}
@@ -104,21 +96,18 @@
error = FSRefMakePath(&fsRef, (unsigned char*)fullPath, maxPathLength);
- strncat(fullPath, "/", maxPathLength);
- fullPath[maxPathLength-1]= '\0';
+ strcat(fullPath, "/");
#else
- HRESULT hr = SHGetFolderPath( NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, fullPath );
+ HRESULT hr = SHGetFolderPath( NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, (LPWSTR)fullPath );
if (FAILED(hr))
{
- strncpy(fullPath, "C:\\", maxPathLength);
- fullPath[maxPathLength-1]= '\0';
+ strcpy(fullPath, "C:\\");
}
else
{
- strncat(fullPath, "\\", maxPathLength);
- fullPath[maxPathLength-1]= '\0';
+ strcat(fullPath, "\\");
}
#endif