|
From: <lab...@us...> - 2011-05-11 21:02:04
|
Revision: 1363
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1363&view=rev
Author: labviewer
Date: 2011-05-11 21:01:56 +0000 (Wed, 11 May 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2011-05-11 20:56:17 UTC (rev 1362)
+++ trunk/lvzip/c_source/lvutil.c 2011-05-11 21:01:56 UTC (rev 1363)
@@ -1119,6 +1119,8 @@
Boolean isDir = FALSE;
uInt32 enc = CFStringGetSystemEncoding();
+ #error "Remove me"
+
if (!len)
return mgArgErr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2014-07-15 14:33:00
|
Revision: 1497
http://sourceforge.net/p/opengtoolkit/svn/1497
Author: labviewer
Date: 2014-07-15 14:32:57 +0000 (Tue, 15 Jul 2014)
Log Message:
-----------
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2014-07-15 14:11:25 UTC (rev 1496)
+++ trunk/lvzip/c_source/lvutil.c 2014-07-15 14:32:57 UTC (rev 1497)
@@ -1708,16 +1708,21 @@
#if Unix
#define UStrBuf(s) (wchar_t*)LStrbuf(s)
#ifdef HAVE_ICONV
-static char *iconv_getcharset(uInt32 codePage)
+TH_UI static char *iconv_getcharset(uInt32 codePage)
{
+ static char[10] cp;
switch (codePage)
{
case CP_ACP:
- return "ACP";
+ return "CHAR";
case CP_OEMCP:
+ /* FIXME: determine current local and return according OEM */
return "OEM";
case CP_UTF8:
- return "UTF8";
+ return "UTF-8";
+ default:
+ sprintf_s(cp, 10, "CP%d", codepage);
+ return cp;
}
return NULL;
}
@@ -1745,10 +1750,12 @@
return UnixToMgErr();
}
#else
-static MgErr unix_convert(const char *src, size_t len, UStrHandle *dest, const char *charset)
+/* We don't have a good way of converting from an arbitrary character set to wide char and back.
+ Just do default mbcs to wide char and vice versa ??? */
+static MgErr unix_convert_mbtow(const char *src, size_t len, UStrHandle *dest, const char *charset)
{
- size_t max = LStrLen(*src), numChars = 0, length;
- char *pt = LStrBuf(*src);
+ size_t max = len, numChars = 0, length;
+ char *pt = (char*)src;
#if HAVE_MBRTOWC
mbstate_t mbs;
@@ -1778,7 +1785,6 @@
#endif
if (numChars > 0)
{
- numChars;
err = NumericArrayResize(uB, 1, (UHandle*)dest, numChars * sizeof(wchar_t));
if (!err)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-03 19:14:27
|
Revision: 1522
http://sourceforge.net/p/opengtoolkit/svn/1522
Author: labviewer
Date: 2015-05-03 19:14:24 +0000 (Sun, 03 May 2015)
Log Message:
-----------
Silence some compile warnings on unix
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-05-03 18:50:52 UTC (rev 1521)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-03 19:14:24 UTC (rev 1522)
@@ -1059,8 +1059,8 @@
{
#if MacOSX || Unix
struct stat st;
- char *buf;
- int len;
+ char *buf = NULL;
+ int len = 0;
if (lstat((const char*)LStrBuf(*src), &st))
{
@@ -1085,7 +1085,7 @@
}
else if (retval < len)
{
- err = LVPath_FromText(buf, retval, target, LV_FALSE);
+ err = LVPath_FromText((CStr)buf, retval, target, LV_FALSE);
free(buf);
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-15 13:44:40
|
Revision: 1526
http://sourceforge.net/p/opengtoolkit/svn/1526
Author: labviewer
Date: 2015-05-15 13:44:37 +0000 (Fri, 15 May 2015)
Log Message:
-----------
Fix a few MacOSX issues
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-05-06 17:23:50 UTC (rev 1525)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-15 13:44:37 UTC (rev 1526)
@@ -1066,7 +1066,7 @@
{
err = UnixToLVFileErr();
}
- else
+ else if (S_ISLNK(st.st_mode))
{
len = st.st_size + 1;
buf = malloc(len);
@@ -1075,6 +1075,10 @@
err = mFullErr;
}
}
+ else
+ {
+ err = mgArgErr;
+ }
while (!err)
{
@@ -1535,6 +1539,10 @@
return err;
}
+#if MacOSX && usesPosixPath
+static char *namedResourceFork = "/..namedfork/rsrc";
+#endif
+
LibAPI(MgErr) LVFile_OpenFile(LVRefNum *refnum, Path path, uInt8 rsrc, uInt32 openMode, uInt32 denyMode)
{
MgErr err;
@@ -1663,10 +1671,10 @@
return mgArgErr;
}
- err = MakePathDSString(path, &lstr, 5);
+ err = MakePathDSString(path, &lstr, strlen(namedResourceFork));
if (!err && rsrc)
{
- strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), "/rsrc");
+ strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), namedResourceFork);
}
if (err)
return err;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2018-12-11 20:19:12
|
Revision: 1561
http://sourceforge.net/p/opengtoolkit/svn/1561
Author: labviewer
Date: 2018-12-11 20:19:11 +0000 (Tue, 11 Dec 2018)
Log Message:
-----------
Add some comments as to what code is used on what platform compile
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2018-12-11 12:18:11 UTC (rev 1560)
+++ trunk/lvzip/c_source/lvutil.c 2018-12-11 20:19:11 UTC (rev 1561)
@@ -132,7 +132,7 @@
#if usesHFSPath
#define kPathSeperator ':'
-typedef SInt16 FileRefNum;
+typedef FSIORefNum FileRefNum;
#elif usesPosixPath
#define kPathSeperator '/'
typedef FILE* FileRefNum;
@@ -770,7 +770,7 @@
return HRESULTToLVErr(err);
}
-static BOOL ModifyBackupPrivilege(BOOL fEnable)
+static BOOL Win32ModifyBackupPrivilege(BOOL fEnable)
{
HANDLE handle;
BOOL success = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &handle);
@@ -806,7 +806,7 @@
}
// Need to acquire backup privileges in order to be able to retrieve a handle to a directory below or call symlink kernel entry points
- ModifyBackupPrivilege(TRUE);
+ Win32ModifyBackupPrivilege(TRUE);
while (!err && *dwAttrs & FILE_ATTRIBUTE_REPARSE_POINT)
{
// Open the link file or directory
@@ -913,7 +913,7 @@
}
}
}
- ModifyBackupPrivilege(FALSE);
+ Win32ModifyBackupPrivilege(FALSE);
if (buffer)
DSDisposePtr((UPtr)buffer);
if (tempPath)
@@ -1187,10 +1187,12 @@
LibAPI(MgErr) LVPath_HasResourceFork(Path path, LVBoolean *hasResFork, uInt32 *sizeLow, uInt32 *sizeHigh)
{
MgErr err = mgNoErr;
+#if Mac
#if usesHFSPath
FSRef ref;
-#elif MacOSX
+#else
LStrHandle lstr = NULL;
+#endif
#else
Unused(path);
#endif
@@ -1201,7 +1203,8 @@
if (sizeHigh)
*sizeHigh = 0;
-#if usesHFSPath
+#if Mac
+#if usesHFSPath // 32-Bit MacOSX
err = FSMakePathRef(path, &ref);
if (!err)
{
@@ -1222,7 +1225,7 @@
*sizeHigh = Hi32(catalogInfo.rsrcLogicalSize);
}
}
-#elif MacOSX
+#else // 64-Bit MacOSX
err = LVPath_ToText(path, &lstr);
if (!err)
{
@@ -1240,6 +1243,7 @@
DSDisposeHandle((UHandle)lstr);
}
#endif
+#endif
return err;
}
@@ -1250,19 +1254,19 @@
LStrHandle comment)
{
MgErr err = mgNoErr;
-#if Win32 && !defined(EMBEDDED)
+#if Win32 && !defined(EMBEDDED) // Windows
LWStrPtr lstr = NULL;
HANDLE handle = NULL;
WIN32_FIND_DATAW fi = {0};
uInt64 count = 0;
-#elif usesHFSPath
+#elif usesHFSPath // MacOS and MacOSX 32-Bit
FSRef ref;
-#elif usesPosixPath
+#elif usesPosixPath // Unix, VxWorks, and MacOSX 64-Bit
LWStrPtr lstr = NULL;
struct stat statbuf;
struct utimbuf buf;
uInt64 count = 0;
-#else
+#else // Pharlap ETS
FInfoRec infoRec;
#endif
@@ -1624,14 +1628,14 @@
LibAPI(MgErr) LVPath_EncodeMacbinary(Path srcPath, Path dstPath)
{
#if MacOS && !MacOSX
- MacSpec srcFSSpec;
- MacSpec dstFSSpec;
+ FSSpec srcFSSpec;
+ FScSpec dstFSSpec;
MgErr err;
- err = MakeMacSpec(srcPath, &srcFSSpec);
+ err = MakeFSSpec(srcPath, &srcFSSpec);
if (!err)
{
- err = MakeMacSpec(dstPath, &dstFSSpec);
+ err = MakeFSSpec(dstPath, &dstFSSpec);
if (!err)
err = OSErrToLVErr(EncodeMacbinaryFiles(&srcFSSpec, &dstFSSpec));
}
@@ -1646,14 +1650,14 @@
LibAPI(MgErr) LVPath_DecodeMacbinary(Path srcPath, Path dstPath)
{
#if MacOS && !MacOSX
- MacSpec srcFSSpec;
- MacSpec dstFSSpec;
+ FSSpec srcFSSpec;
+ FSSpec dstFSSpec;
MgErr err;
- err = MakeMacSpec(srcPath, &srcFSSpec);
+ err = MakeFSSpec(srcPath, &srcFSSpec);
if (!err)
{
- err = MakeMacSpec(dstPath, &dstFSSpec);
+ err = MakeFSSpec(dstPath, &dstFSSpec);
if (!err)
err = OSErrToLVErr(DecodeMacBinaryFiles(&srcFSSpec, &dstFSSpec));
}
@@ -1664,7 +1668,10 @@
return mgNotSupported;
#endif
}
-
+/*
+ These two APIs will use the platform specific path syntax except for the
+ MacOSX 32-bit plaform where it will use posix format
+*/
LibAPI(MgErr) LVPath_ToText(Path path, LStrHandle *str)
{
int32 pathLen = -1;
@@ -1907,7 +1914,7 @@
if (!err)
{
// Need to acquire backup privileges in order to be able to call symlink kernel entry points
- ModifyBackupPrivilege(TRUE);
+ Win32ModifyBackupPrivilege(TRUE);
if (flags & kLinkHard)
{
err = Win32CreateHardLinkW(UStrBuf(src), UStrBuf(tgt), NULL);
@@ -1916,7 +1923,7 @@
{
err = Win32CreateSymbolicLinkW(UStrBuf(src), UStrBuf(tgt), flags & kLinkDir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0);
}
- ModifyBackupPrivilege(FALSE);
+ Win32ModifyBackupPrivilege(FALSE);
}
#else
err = mgNotSupported;
@@ -2076,7 +2083,13 @@
return err;
}
-
+/*
+ The lvfile internal functions work on the same file object as the LabVIEW internal functions.
+ This is the file handle or file descriptor that a LabVIEW File Refnum wraps.
+ MacOS and MacOSX 32-Bit: FSIORefNum (int)
+ Windows: HANDLE
+ Unix: FILE*
+*/
static MgErr lvfile_CloseFile(FileRefNum ioRefNum)
{
MgErr err = mgNoErr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|