You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(447) |
Nov
(163) |
Dec
(57) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(172) |
Feb
|
Mar
(123) |
Apr
(64) |
May
(1) |
Jun
(278) |
Jul
(89) |
Aug
(97) |
Sep
(62) |
Oct
(53) |
Nov
(119) |
Dec
(60) |
| 2006 |
Jan
(76) |
Feb
(1094) |
Mar
(363) |
Apr
(163) |
May
(57) |
Jun
(43) |
Jul
(39) |
Aug
(15) |
Sep
(33) |
Oct
(62) |
Nov
(8) |
Dec
|
| 2007 |
Jan
(9) |
Feb
(34) |
Mar
(2) |
Apr
(14) |
May
(8) |
Jun
(40) |
Jul
(21) |
Aug
(1) |
Sep
(20) |
Oct
(15) |
Nov
(26) |
Dec
|
| 2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(32) |
Jun
|
Jul
|
Aug
(3) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ted...@us...> - 2012-04-17 19:11:29
|
Revision: 1842
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1842&view=rev
Author: tedchoward
Date: 2012-04-17 19:11:18 +0000 (Tue, 17 Apr 2012)
Log Message:
-----------
fixed #defines for the windows build
Modified Paths:
--------------
Frontier/trunk/Common/source/icon.c
Modified: Frontier/trunk/Common/source/icon.c
===================================================================
--- Frontier/trunk/Common/source/icon.c 2011-11-01 18:20:44 UTC (rev 1841)
+++ Frontier/trunk/Common/source/icon.c 2012-04-17 19:11:18 UTC (rev 1842)
@@ -67,7 +67,9 @@
#define windoidwithtexticon 137
#define windoidwithnotexticon 138
+#if defined (MACVERSION)
OSStatus loadicondatafromodb(bigstring bsadricon, bigstring bsicondatatype, Handle *hicon);
+#endif
boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon) {
#if defined (MACVERSION)
@@ -149,6 +151,7 @@
#endif
}
+#if defined (MACVERSION)
OSStatus loadicondatafromodb(bigstring bsadricon, bigstring bsicondatatype, Handle *hicon) {
bigstring bsname;
hdlhashtable ht;
@@ -173,6 +176,7 @@
return noErr;
}
+#endif
boolean ploticonresource (const Rect *r, short align, short transform, short resid) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:20:50
|
Revision: 1841
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1841&view=rev
Author: tedchoward
Date: 2011-11-01 18:20:44 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
added missing signature to the header (bad patch)
Modified Paths:
--------------
Frontier/trunk/Common/headers/opicons.h
Modified: Frontier/trunk/Common/headers/opicons.h
===================================================================
--- Frontier/trunk/Common/headers/opicons.h 2011-11-01 18:20:30 UTC (rev 1840)
+++ Frontier/trunk/Common/headers/opicons.h 2011-11-01 18:20:44 UTC (rev 1841)
@@ -51,4 +51,6 @@
boolean opdrawheadiconcustomfromodb (bigstring bsadricon, const Rect *r, boolean flselected);
-boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath);
\ No newline at end of file
+boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath);
+
+boolean resolveHashTable(bigstring bsnodetype, bigstring bsadrnodepath);
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:20:38
|
Revision: 1840
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1840&view=rev
Author: tedchoward
Date: 2011-11-01 18:20:30 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
Made the odb nodeType table search recursive
A common occurrance is for the nodeType table to be stored in an
external tool and it's address is stored in the searched paths. The
lookup function now will continue to call itself as long as the
valueType returned is addressvaluetype.
Signed-off-by: Ted C. Howard <te...@te...>
Modified Paths:
--------------
Frontier/trunk/Common/source/opicons.c
Modified: Frontier/trunk/Common/source/opicons.c
===================================================================
--- Frontier/trunk/Common/source/opicons.c 2011-11-01 18:20:18 UTC (rev 1839)
+++ Frontier/trunk/Common/source/opicons.c 2011-11-01 18:20:30 UTC (rev 1840)
@@ -141,11 +141,25 @@
boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath) {
//user.tools.nodeTypes.[type]
//Frontier.tools.data.nodeTypes.[type]
+ boolean fllookup = false;
- bigstring bsname;
copystring(BIGSTRING("\x15" "user.tools.nodeTypes."), bsadrnodepath);
pushstring(bsnodetype, bsadrnodepath);
+ fllookup = resolveHashTable(bsnodetype, bsadrnodepath);
+
+ if (!fllookup) {
+ copystring(BIGSTRING("\x1E" "Frontier.tools.data.nodeTypes."), bsadrnodepath);
+ pushstring(bsnodetype, bsadrnodepath);
+
+ fllookup = resolveHashTable(bsnodetype, bsadrnodepath);
+ }
+
+ return fllookup;
+}
+
+boolean resolveHashTable(bigstring bsnodetype, bigstring bsadrnodepath) {
+ bigstring bsname;
hdlhashtable ht;
hdlhashnode hn;
tyvaluerecord iconvalue;
@@ -161,20 +175,10 @@
pophashtable ();
fllookup = hashtablelookup (ht, bsnodetype, &iconvalue, &hn);
-
- if (!fllookup) {
- copystring(BIGSTRING("\x1E" "Frontier.tools.data.nodeTypes."), bsadrnodepath);
- pushstring(bsnodetype, bsadrnodepath);
-
- pushhashtable (roottable);
-
- disablelangerror ();
-
- flexpanded = langexpandtodotparams (bsadrnodepath, &ht, bsname);
- enablelangerror ();
- pophashtable ();
-
- fllookup = hashtablelookup (ht, bsnodetype, &iconvalue, &hn);
+
+ if (fllookup && iconvalue.valuetype == addressvaluetype) {
+ copystring(*iconvalue.data.stringvalue, bsadrnodepath);
+ return resolveHashTable(bsnodetype, bsadrnodepath);
}
return fllookup;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:20:24
|
Revision: 1839
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1839&view=rev
Author: tedchoward
Date: 2011-11-01 18:20:18 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
update version to 10.1b17
So, I noticed that all the version properties for the different Apps
that could be built on top of Frontier were all the same, so I
consolidated them at the top of the file. I also bumped the build
status from alpha to beta. The version out in the wild for some time
has been the alpha build, so it seems time to bump to beta.
At any rate, I should be incrementing the version number every time I
post a build, so that practice can start now.
Signed-off-by: Ted C. Howard <te...@te...>
Modified Paths:
--------------
Frontier/trunk/Common/headers/versions.h
Modified: Frontier/trunk/Common/headers/versions.h
===================================================================
--- Frontier/trunk/Common/headers/versions.h 2011-11-01 18:20:05 UTC (rev 1838)
+++ Frontier/trunk/Common/headers/versions.h 2011-11-01 18:20:18 UTC (rev 1839)
@@ -43,9 +43,24 @@
/* common strings for all targets */
#define APP_COPYRIGHT_FROM "2004"
-#define APP_COPYRIGHT_TILL "2009"
+#define APP_COPYRIGHT_TILL "2011"
+/* 2011-08-03 tedchoward: these properties are identical for each app */
+#define APP_MAJOR_VERSION 10
+#define APP_MAJOR_VERSION_BCD 0x10 /* major version in BCD notation */
+#define APP_SUB_VERSION 1
+#define APP_MINOR_VERSION 0
+#define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
+
+#define APP_STAGE_CODE 0x60 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
+#define APP_REVISION_LEVEL 17 /* for non-final releases only */
+#define APP_BUILD_NUMBER 17 /* increment by one for every release, final or not */
+
+#define APP_VERSION_STRING "10.1b17"
+
+
+
/* target-specific strings and version info */
#ifdef PIKE
@@ -60,19 +75,6 @@
#define bs_APP_SLOGAN BIGSTRING ("\x2b" "The power of Web publishing on your desktop")
#define bs_APP_COPYRIGHT BIGSTRING ("\x23" "\xA9 " APP_COPYRIGHT_FROM "-" APP_COPYRIGHT_TILL " UserLand Software, Inc.")
#define bs_APP_URL BIGSTRING ("\x26" "http://frontierkernel.sourceforge.net/")
-
- #define APP_MAJOR_VERSION 10
- #define APP_MAJOR_VERSION_BCD 0x10 /* major version in BCD notation */
-
- #define APP_SUB_VERSION 1
- #define APP_MINOR_VERSION 0
- #define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
-
- #define APP_STAGE_CODE 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
- #define APP_REVISION_LEVEL 16 /* for non-final releases only */
- #define APP_BUILD_NUMBER 16 /* increment by one for every release, final or not */
-
- #define APP_VERSION_STRING "10.1a16"
#else
@@ -86,20 +88,7 @@
#define bs_APP_SLOGAN BIGSTRING ("\x25" "Powerful OPML editing on your desktop")
#define bs_APP_COPYRIGHT BIGSTRING ("\x20" "\xA9 " APP_COPYRIGHT_FROM "-" APP_COPYRIGHT_TILL " Scripting News, Inc.")
#define bs_APP_URL BIGSTRING ("\x18" "http://support.opml.org/")
-
- #define APP_MAJOR_VERSION 10
- #define APP_MAJOR_VERSION_BCD 0x10 /* major version in BCD notation */
-
- #define APP_SUB_VERSION 1
- #define APP_MINOR_VERSION 0
- #define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
-
- #define APP_STAGE_CODE 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
- #define APP_REVISION_LEVEL 16 /* for non-final releases only */
- #define APP_BUILD_NUMBER 16 /* increment by one for every release, final or not */
-
- #define APP_VERSION_STRING "10.1a16"
-
+
#endif
#else
@@ -112,20 +101,7 @@
#define bs_APP_SLOGAN BIGSTRING ("\x25" "Powerful cross-platform web scripting")
#define bs_APP_COPYRIGHT BIGSTRING ("\x23" "\xA9 " APP_COPYRIGHT_FROM "-" APP_COPYRIGHT_TILL " Frontier Kernel Project")
#define bs_APP_URL BIGSTRING ("\x26" "http://frontierkernel.sourceforge.net/")
-
- #define APP_MAJOR_VERSION 10
- #define APP_MAJOR_VERSION_BCD 0x10 /* major version in BCD notation */
-
- #define APP_SUB_VERSION 1
- #define APP_MINOR_VERSION 0
- #define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
-
- #define APP_STAGE_CODE 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
- #define APP_REVISION_LEVEL 16 /* for non-final releases only */
- #define APP_BUILD_NUMBER 16 /* increment by one for every release, final or not */
-
- #define APP_VERSION_STRING "10.1a16"
-
+
#endif
#define bs_APP_COPYRIGHT2 BIGSTRING ("\x22" "\xA9 1992-2004 UserLand Software, Inc")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:20:11
|
Revision: 1838
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1838&view=rev
Author: tedchoward
Date: 2011-11-01 18:20:05 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
fix some memory leaks
If I create handles, I should also destroy them when I'm done with them.
Signed-off-by: Ted C. Howard <te...@te...>
Modified Paths:
--------------
Frontier/trunk/Common/source/icon.c
Modified: Frontier/trunk/Common/source/icon.c
===================================================================
--- Frontier/trunk/Common/source/icon.c 2011-11-01 18:19:52 UTC (rev 1837)
+++ Frontier/trunk/Common/source/icon.c 2011-11-01 18:20:05 UTC (rev 1838)
@@ -70,6 +70,7 @@
OSStatus loadicondatafromodb(bigstring bsadricon, bigstring bsicondatatype, Handle *hicon);
boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon) {
+#if defined (MACVERSION)
//bigstring bsadricon = "\psystem.verbs.builtins.Frontier.tools.data.nodeTypes.link.icon.mac";
@@ -138,7 +139,14 @@
theErr = PlotIconRef(r, align, transform, kIconServicesNormalUsageFlag, iconRef);
}
+ setemptystring(bsadriconpart);
+ ReleaseIconRef(iconRef);
+ disposehandle((Handle) iconHand);
+
return theErr == noErr;
+#else if defined (WIN95VERSION)
+ return FALSE;
+#endif
}
OSStatus loadicondatafromodb(bigstring bsadricon, bigstring bsicondatatype, Handle *hicon) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:19:58
|
Revision: 1837
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1837&view=rev
Author: tedchoward
Date: 2011-11-01 18:19:52 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
Added code to search the ODB for nodeType data.
Specifically, for a given nodeType, we search users.tools.nodeTypes and
Frontier.tools.data.nodeTypes for the nodeType data structure which
contains the icon data. If an entry exists, we load the icon data from
that location and draw it (Mac only right now).
Signed-off-by: Ted C. Howard <te...@te...>
Modified Paths:
--------------
Frontier/trunk/Common/headers/opicons.h
Frontier/trunk/Common/source/opicons.c
Modified: Frontier/trunk/Common/headers/opicons.h
===================================================================
--- Frontier/trunk/Common/headers/opicons.h 2011-11-01 18:19:37 UTC (rev 1836)
+++ Frontier/trunk/Common/headers/opicons.h 2011-11-01 18:19:52 UTC (rev 1837)
@@ -49,4 +49,6 @@
boolean opdrawheadiconcustom (bigstring bsiconname, const Rect *r, boolean flselected);
+boolean opdrawheadiconcustomfromodb (bigstring bsadricon, const Rect *r, boolean flselected);
+boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath);
\ No newline at end of file
Modified: Frontier/trunk/Common/source/opicons.c
===================================================================
--- Frontier/trunk/Common/source/opicons.c 2011-11-01 18:19:37 UTC (rev 1836)
+++ Frontier/trunk/Common/source/opicons.c 2011-11-01 18:19:52 UTC (rev 1837)
@@ -34,8 +34,8 @@
#include "opicons.h"
#include "opdisplay.h"
#include "strings.h" /*7.0b9 PBS*/
+#include "tablestructure.h"
-
#define canexpandicon 475
#define cantexpandicon 476
#define canexpandcommenticon 477
@@ -126,7 +126,60 @@
return (ploticoncustom (r, 0, transform, bsiconname));
} /*opdrawheadiconcustom*/
+boolean opdrawheadiconcustomfromodb (bigstring bsadricon, const Rect *r, boolean flselected) {
+
+ short transform = 0;
+
+ if (flselected)
+ transform = kTransformSelected;
+
+ operaserect (*r);
+
+ return (ploticonfromodb (r, 0, transform, bsadricon));
+} /*opdrawheadiconcustom*/
+boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath) {
+ //user.tools.nodeTypes.[type]
+ //Frontier.tools.data.nodeTypes.[type]
+
+ bigstring bsname;
+ copystring(BIGSTRING("\x15" "user.tools.nodeTypes."), bsadrnodepath);
+ pushstring(bsnodetype, bsadrnodepath);
+
+ hdlhashtable ht;
+ hdlhashnode hn;
+ tyvaluerecord iconvalue;
+ boolean flexpanded = false;
+ boolean fllookup = false;
+
+ pushhashtable (roottable);
+
+ disablelangerror ();
+
+ flexpanded = langexpandtodotparams (bsadrnodepath, &ht, bsname);
+ enablelangerror ();
+ pophashtable ();
+
+ fllookup = hashtablelookup (ht, bsnodetype, &iconvalue, &hn);
+
+ if (!fllookup) {
+ copystring(BIGSTRING("\x1E" "Frontier.tools.data.nodeTypes."), bsadrnodepath);
+ pushstring(bsnodetype, bsadrnodepath);
+
+ pushhashtable (roottable);
+
+ disablelangerror ();
+
+ flexpanded = langexpandtodotparams (bsadrnodepath, &ht, bsname);
+ enablelangerror ();
+ pophashtable ();
+
+ fllookup = hashtablelookup (ht, bsnodetype, &iconvalue, &hn);
+ }
+
+ return fllookup;
+}
+
boolean opdefaultdrawicon (hdlheadrecord hnode, const Rect *iconrect, boolean flselected, boolean flinverted) {
#pragma unused(flselected, flinverted)
@@ -159,15 +212,30 @@
setemptystring (bsheadlinetype);
- #if (defined(MACVERSION) && defined(__ppc__)) || defined (WIN95VERSION)
-
if (opattributesgettypestring (hnode, bsheadlinetype)) { /*is there a type att?*/
+ /* Look up a custom icon in the odb and draw it if there is one. */
+
+ #if defined (MACVERSION)
+
+ bigstring bsadrnodepath;
+
+ if (stringlength(bsheadlinetype) > 0 && opgetnodetypetableadr(bsheadlinetype, bsadrnodepath)) {
+ pushstring(BIGSTRING("\x09" ".icon.mac"), bsadrnodepath);
+ flcustomicondrawn = opdrawheadiconcustomfromodb (bsadrnodepath, iconrect, false);
+ }
+
+ #endif
+
+ #if (defined(MACVERSION) && defined(__ppc__)) || defined (WIN95VERSION)
+
/*Draw a custom icon. If it returns false, there was no custom icon.*/
-
- flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
+ if (!flcustomicondrawn) {
+ flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
+ }
+
+ #endif
} /*if*/
- #endif
} /*if*/
} /*if*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:19:45
|
Revision: 1836
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1836&view=rev
Author: tedchoward
Date: 2011-11-01 18:19:37 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
We can now plot IconFamily data stored in the ODB
I added a function that loads the IconFamily data currently stored in
the odb, load it into an IconFamily data structure and use Icon Services
to render the nodetype icon in the outline.
Signed-off-by: Ted C. Howard <te...@te...>
Modified Paths:
--------------
Frontier/trunk/Common/headers/icon.h
Frontier/trunk/Common/source/icon.c
Modified: Frontier/trunk/Common/headers/icon.h
===================================================================
--- Frontier/trunk/Common/headers/icon.h 2011-11-01 18:19:22 UTC (rev 1835)
+++ Frontier/trunk/Common/headers/icon.h 2011-11-01 18:19:37 UTC (rev 1836)
@@ -52,6 +52,7 @@
#endif
/*function prototypes*/
+extern boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon);
extern void drawlabeledicon (const Rect *, short, bigstring, boolean);
Modified: Frontier/trunk/Common/source/icon.c
===================================================================
--- Frontier/trunk/Common/source/icon.c 2011-11-01 18:19:22 UTC (rev 1835)
+++ Frontier/trunk/Common/source/icon.c 2011-11-01 18:19:37 UTC (rev 1836)
@@ -41,6 +41,8 @@
#include "resources.h" /*7.0b9 PBS*/
#include "launch.h" /*7.0b9 PBS*/
+#include "tablestructure.h"
+
#include "byteorder.h"
/*
@@ -65,8 +67,105 @@
#define windoidwithtexticon 137
#define windoidwithnotexticon 138
+OSStatus loadicondatafromodb(bigstring bsadricon, bigstring bsicondatatype, Handle *hicon);
+boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon) {
+ //bigstring bsadricon = "\psystem.verbs.builtins.Frontier.tools.data.nodeTypes.link.icon.mac";
+
+ IconRef iconRef;
+ IconFamilyHandle iconHand;
+ SInt32 theSize;
+ OSStatus theErr;
+ Handle hicon;
+ bigstring bsadriconpart;
+
+ theErr = noErr;
+ theSize = sizeof(OSType) + sizeof(OSType);
+
+ newhandle(theSize, (Handle*) &iconHand);
+
+ //iconHand = (IconFamilyHandle) getnewhandle(theSize, false);
+
+ if (iconHand == NULL) theErr = memFullErr;
+
+ if (theErr == noErr) {
+ (*iconHand)->resourceType = EndianU32_NtoB(kIconFamilyType);
+ (*iconHand)->resourceSize = EndianU32_NtoB(theSize);
+ }
+
+ if (theErr == noErr) {
+ setemptystring(bsadriconpart);
+ copystring(bsadricon, bsadriconpart);
+ pushstring(BIGSTRING("\x05" ".ics4"), bsadriconpart);
+ theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics4"), &hicon);
+
+ if (theErr == noErr) {
+ theErr = SetIconFamilyData(iconHand, kSmall4BitData, hicon);
+ disposehandle(hicon);
+ }
+ }
+
+ if (theErr == noErr) {
+ setemptystring(bsadriconpart);
+ copystring(bsadricon, bsadriconpart);
+ pushstring(BIGSTRING("\x05" ".ics8"), bsadriconpart);
+ theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics8"), &hicon);
+
+ if (theErr == noErr) {
+ theErr = SetIconFamilyData(iconHand, kSmall8BitData, hicon);
+ disposehandle(hicon);
+ }
+ }
+
+ if (theErr == noErr) {
+ setemptystring(bsadriconpart);
+ copystring(bsadricon, bsadriconpart);
+ pushstring(BIGSTRING("\x09" ".icspound"), bsadriconpart);
+ theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x08" "icspound"), &hicon);
+
+ if (theErr == noErr) {
+ theErr = SetIconFamilyData(iconHand, kSmall1BitMask, hicon);
+ disposehandle(hicon);
+ }
+ }
+
+ if (theErr == noErr) {
+ theErr = GetIconRefFromIconFamilyPtr(*iconHand, GetHandleSize((Handle) iconHand), &iconRef);
+ }
+
+ if (theErr == noErr) {
+ theErr = PlotIconRef(r, align, transform, kIconServicesNormalUsageFlag, iconRef);
+ }
+
+ return theErr == noErr;
+}
+
+OSStatus loadicondatafromodb(bigstring bsadricon, bigstring bsicondatatype, Handle *hicon) {
+ bigstring bsname;
+ hdlhashtable ht;
+ hdlhashnode hn;
+ tyvaluerecord iconvalue;
+ //bigstring bsiconname = "\pics4";
+ boolean flexpanded = false;
+ boolean fllookup = false;
+
+ pushhashtable (roottable);
+
+ disablelangerror ();
+
+ flexpanded = langexpandtodotparams (bsadricon, &ht, bsname);
+ enablelangerror ();
+ pophashtable ();
+
+
+ fllookup = hashtablelookup (ht, bsicondatatype, &iconvalue, &hn);
+ copyhandle (iconvalue.data.binaryvalue, hicon);
+ stripbinarytypeid (*hicon);
+
+ return noErr;
+}
+
boolean ploticonresource (const Rect *r, short align, short transform, short resid) {
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ted...@us...> - 2011-11-01 18:19:28
|
Revision: 1835
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1835&view=rev
Author: tedchoward
Date: 2011-11-01 18:19:22 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
adding patch 001
Modified Paths:
--------------
Frontier/trunk/Common/source/opicons.c
Modified: Frontier/trunk/Common/source/opicons.c
===================================================================
--- Frontier/trunk/Common/source/opicons.c 2011-06-24 19:43:07 UTC (rev 1834)
+++ Frontier/trunk/Common/source/opicons.c 2011-11-01 18:19:22 UTC (rev 1835)
@@ -159,12 +159,15 @@
setemptystring (bsheadlinetype);
+ #if (defined(MACVERSION) && defined(__ppc__)) || defined (WIN95VERSION)
+
if (opattributesgettypestring (hnode, bsheadlinetype)) { /*is there a type att?*/
/*Draw a custom icon. If it returns false, there was no custom icon.*/
flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
} /*if*/
+ #endif
} /*if*/
} /*if*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2011-06-24 19:43:15
|
Revision: 1834
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1834&view=rev
Author: andreradke
Date: 2011-06-24 19:43:07 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
Fixed properties and line-endings for MoreFilesX.
Modified Paths:
--------------
Frontier/trunk/Common/MoreFilesX/MoreFilesX.c
Frontier/trunk/Common/MoreFilesX/MoreFilesX.h
Property Changed:
----------------
Frontier/trunk/Common/MoreFilesX/MoreFilesX.c
Frontier/trunk/Common/MoreFilesX/MoreFilesX.h
Modified: Frontier/trunk/Common/MoreFilesX/MoreFilesX.c
===================================================================
--- Frontier/trunk/Common/MoreFilesX/MoreFilesX.c 2011-03-01 06:06:29 UTC (rev 1833)
+++ Frontier/trunk/Common/MoreFilesX/MoreFilesX.c 2011-06-24 19:43:07 UTC (rev 1834)
@@ -1,2799 +1,2799 @@
-/*
-File: MoreFilesX.c
-
-Abstract: A collection of useful high-level File Manager routines which use
- the HFS Plus APIs wherever possible.
-
-Version: 1.0.2
-
-Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
-Computer, Inc. ("Apple") in consideration of your agreement to the
-following terms, and your use, installation, modification or
-redistribution of this Apple software constitutes acceptance of these
-terms. If you do not agree with these terms, please do not use,
-install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, Apple grants you a personal, non-exclusive
-license, under Apple's copyrights in this original Apple software (the
-"Apple Software"), to use, reproduce, modify and redistribute the Apple
-Software, with or without modifications, in source and/or binary forms;
-provided that if you redistribute the Apple Software in its entirety and
-without modifications, you must retain this notice and the following
-text and disclaimers in all such redistributions of the Apple Software.
-Neither the name, trademarks, service marks or logos of Apple Computer,
-Inc. may be used to endorse or promote products derived from the Apple
-Software without specific prior written permission from Apple. Except
-as expressly stated in this notice, no other rights or licenses, express
-or implied, are granted by Apple herein, including but not limited to
-any patent rights that may be infringed by your derivative works or by
-other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE
-MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
-THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
-OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
-OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
-MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
-AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
-STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-Copyright \xA9 1992-2005 Apple Computer, Inc., All Rights Reserved
-
-For bug reports, consult the following page on the World Wide Web:
- <http://developer.apple.com/bugreporter/>
-
-Change History (most recent first):
-
- <8> 17 Feb 2005 <rdar://problem/4012003>
- Fixed casting and comparison warnings when "-Werror
- -Wmissing-declarations -Wmissing-prototypes -Wall
- -W -Wcast-qual -Wpointer-arith -Wno-four-char-constants
- -Wno-unknown-pragmas" are used with XCode 2.0.
- <7> 18 Dec 2004 <rdar://problem/3926695>
- Replaced FSLockRange and FSUnlockRange with
- FSLockRangeCompat and FSUnlockRangeCompat.
- <6> 05 Jan 2004 <rdar://problem/3510800>
- Changed FSMoveRenameObjectUnicode to handle source
- and destination directories being the same, and to
- make sure the destination actually is a directory.
- <5> 22 Sep 2002 <rdar://problem/3016251>
- Changed FSMoveRenameObjectUnicode to not use the
- Temporary folder because it isn't available on NFS volumes.
- <4> 19 Apr 2002 <rdar://problem/2853905>
- Fixed #if test around header includes.
- <3> 19 Apr 2002 <rdar://problem/2850624>
- Fixed C++ compile errors and Project Builder warnings.
- <2> 19 Apr 2002 <rdar://problem/2853901>
- Updated standard disclaimer.
- <1> 25 Jan 2002 MoreFilesX 1.0
-*/
-
-#if defined(__MACH__)
- #include <Carbon/Carbon.h>
- #include <string.h>
-#else
- #include <Carbon.h>
- #include <string.h>
-#endif
-
-#include "MoreFilesX.h"
-
-/* Set BuildingMoreFilesXForMacOS9 to 1 if building for Mac OS 9 */
-#ifndef BuildingMoreFilesXForMacOS9
- #define BuildingMoreFilesXForMacOS9 0
-#endif
-
-/* macro for casting away const when you really have to */
-#define CONST_CAST(type, const_var) (*(type*)((void *)&(const_var)))
-
-/*****************************************************************************/
-
-#pragma mark ----- Local type definitions -----
-
-struct FSIterateContainerGlobals
-{
- IterateContainerFilterProcPtr iterateFilter; /* pointer to IterateFilterProc */
- FSCatalogInfoBitmap whichInfo; /* fields of the CatalogInfo to get */
- FSCatalogInfo catalogInfo; /* FSCatalogInfo */
- FSRef ref; /* FSRef */
- FSSpec spec; /* FSSpec */
- FSSpec *specPtr; /* pointer to spec field, or NULL */
- HFSUniStr255 name; /* HFSUniStr255 */
- HFSUniStr255 *namePtr; /* pointer to name field, or NULL */
- void *yourDataPtr; /* a pointer to caller supplied data the filter may need to access */
- ItemCount maxLevels; /* maximum levels to iterate through */
- ItemCount currentLevel; /* the current level FSIterateContainerLevel is on */
- Boolean quitFlag; /* set to true if filter wants to kill interation */
- Boolean containerChanged; /* temporary - set to true if the current container changed during iteration */
- OSErr result; /* result */
- ItemCount actualObjects; /* number of objects returned */
-};
-typedef struct FSIterateContainerGlobals FSIterateContainerGlobals;
-
-struct FSDeleteContainerGlobals
-{
- OSErr result; /* result */
- ItemCount actualObjects; /* number of objects returned */
- FSCatalogInfo catalogInfo; /* FSCatalogInfo */
-};
-typedef struct FSDeleteContainerGlobals FSDeleteContainerGlobals;
-
-/*****************************************************************************/
-
-#pragma mark ----- Local prototypes -----
-
-static
-void
-FSDeleteContainerLevel(
- const FSRef *container,
- FSDeleteContainerGlobals *theGlobals);
-
-static
-void
-FSIterateContainerLevel(
- FSIterateContainerGlobals *theGlobals);
-
-static
-OSErr
-GenerateUniqueHFSUniStr(
- long *startSeed,
- const FSRef *dir1,
- const FSRef *dir2,
- HFSUniStr255 *uniqueName);
-
-/*****************************************************************************/
-
-#pragma mark ----- File Access Routines -----
-
-/*****************************************************************************/
-
-OSErr
-FSCopyFork(
- SInt16 srcRefNum,
- SInt16 dstRefNum,
- void *copyBufferPtr,
- ByteCount copyBufferSize)
-{
- OSErr srcResult;
- OSErr dstResult;
- OSErr result;
- SInt64 forkSize;
- ByteCount readActualCount;
-
- /* check input parameters */
- require_action((NULL != copyBufferPtr) && (0 != copyBufferSize), BadParameter, result = paramErr);
-
- /* get source fork size */
- result = FSGetForkSize(srcRefNum, &forkSize);
- require_noerr(result, SourceFSGetForkSizeFailed);
-
- /* allocate disk space for destination fork */
- result = FSSetForkSize(dstRefNum, fsFromStart, forkSize);
- require_noerr(result, DestinationFSSetForkSizeFailed);
-
- /* reset source fork's position to 0 */
- result = FSSetForkPosition(srcRefNum, fsFromStart, 0);
- require_noerr(result, SourceFSSetForkPositionFailed);
-
- /* reset destination fork's position to 0 */
- result = FSSetForkPosition(dstRefNum, fsFromStart, 0);
- require_noerr(result, DestinationFSSetForkPositionFailed);
-
- /* If copyBufferSize is greater than 4K bytes, make it a multiple of 4k bytes */
- /* This will make writes on local volumes faster */
- if ( (copyBufferSize >= 0x00001000) && ((copyBufferSize & 0x00000fff) != 0) )
- {
- copyBufferSize &= ~(0x00001000 - 1);
- }
-
- /* copy source to destination */
- srcResult = dstResult = noErr;
- while ( (noErr == srcResult) && (noErr == dstResult) )
- {
- srcResult = FSReadFork(srcRefNum, fsAtMark + noCacheMask, 0, copyBufferSize, copyBufferPtr, &readActualCount);
- dstResult = FSWriteFork(dstRefNum, fsAtMark + noCacheMask, 0, readActualCount, copyBufferPtr, NULL);
- }
-
- /* make sure there were no errors at the destination */
- require_noerr_action(dstResult, DestinationFSWriteForkFailed, result = dstResult);
-
- /* make sure the error at the source was eofErr */
- require_action(eofErr == srcResult, SourceResultNotEofErr, result = srcResult);
-
- /* everything went as expected */
- result = noErr;
-
-SourceResultNotEofErr:
-DestinationFSWriteForkFailed:
-DestinationFSSetForkPositionFailed:
-SourceFSSetForkPositionFailed:
-DestinationFSSetForkSizeFailed:
-SourceFSGetForkSizeFailed:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-#pragma mark ----- Volume Access Routines -----
-
-/*****************************************************************************/
-
-OSErr
-FSGetVolParms(
- FSVolumeRefNum volRefNum,
- UInt32 bufferSize,
- GetVolParmsInfoBuffer *volParmsInfo,
- UInt32 *actualInfoSize)
-{
- OSErr result;
- HParamBlockRec pb;
-
- /* check parameters */
- require_action((NULL != volParmsInfo) && (NULL != actualInfoSize),
- BadParameter, result = paramErr);
-
- pb.ioParam.ioNamePtr = NULL;
- pb.ioParam.ioVRefNum = volRefNum;
- pb.ioParam.ioBuffer = (Ptr)volParmsInfo;
- pb.ioParam.ioReqCount = (SInt32)bufferSize;
- result = PBHGetVolParmsSync(&pb);
- require_noerr(result, PBHGetVolParmsSync);
-
- /* return number of bytes the file system returned in volParmsInfo buffer */
- *actualInfoSize = (UInt32)pb.ioParam.ioActCount;
-
-PBHGetVolParmsSync:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetVRefNum(
- const FSRef *ref,
- FSVolumeRefNum *vRefNum)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
-
- /* check parameters */
- require_action(NULL != vRefNum, BadParameter, result = paramErr);
-
- /* get the volume refNum from the FSRef */
- result = FSGetCatalogInfo(ref, kFSCatInfoVolume, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- /* return volume refNum from catalogInfo */
- *vRefNum = catalogInfo.volume;
-
-FSGetCatalogInfo:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetVInfo(
- FSVolumeRefNum volume,
- HFSUniStr255 *volumeName, /* can be NULL */
- UInt64 *freeBytes, /* can be NULL */
- UInt64 *totalBytes) /* can be NULL */
-{
- OSErr result;
- FSVolumeInfo info;
-
- /* ask for the volume's sizes only if needed */
- result = FSGetVolumeInfo(volume, 0, NULL,
- (((NULL != freeBytes) || (NULL != totalBytes)) ? kFSVolInfoSizes : kFSVolInfoNone),
- &info, volumeName, NULL);
- require_noerr(result, FSGetVolumeInfo);
-
- if ( NULL != freeBytes )
- {
- *freeBytes = info.freeBytes;
- }
- if ( NULL != totalBytes )
- {
- *totalBytes = info.totalBytes;
- }
-
-FSGetVolumeInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetVolFileSystemID(
- FSVolumeRefNum volume,
- UInt16 *fileSystemID, /* can be NULL */
- UInt16 *signature) /* can be NULL */
-{
- OSErr result;
- FSVolumeInfo info;
-
- result = FSGetVolumeInfo(volume, 0, NULL, kFSVolInfoFSInfo, &info, NULL, NULL);
- require_noerr(result, FSGetVolumeInfo);
-
- if ( NULL != fileSystemID )
- {
- *fileSystemID = info.filesystemID;
- }
- if ( NULL != signature )
- {
- *signature = info.signature;
- }
-
-FSGetVolumeInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetMountedVolumes(
- FSRef ***volumeRefsHandle, /* pointer to handle of FSRefs */
- ItemCount *numVolumes)
-{
- OSErr result;
- OSErr memResult;
- ItemCount volumeIndex;
- FSRef ref;
-
- /* check parameters */
- require_action((NULL != volumeRefsHandle) && (NULL != numVolumes),
- BadParameter, result = paramErr);
-
- /* No volumes yet */
- *numVolumes = 0;
-
- /* Allocate a handle for the results */
- *volumeRefsHandle = (FSRef **)NewHandle(0);
- require_action(NULL != *volumeRefsHandle, NewHandle, result = memFullErr);
-
- /* Call FSGetVolumeInfo in loop to get all volumes starting with the first */
- volumeIndex = 1;
- do
- {
- result = FSGetVolumeInfo(0, volumeIndex, NULL, kFSVolInfoNone, NULL, NULL, &ref);
- if ( noErr == result )
- {
- /* concatenate the FSRef to the end of the handle */
- PtrAndHand(&ref, (Handle)*volumeRefsHandle, sizeof(FSRef));
- memResult = MemError();
- require_noerr_action(memResult, MemoryAllocationFailed, result = memResult);
-
- ++(*numVolumes); /* increment the volume count */
- ++volumeIndex; /* and the volumeIndex to get the next volume*/
- }
- } while ( noErr == result );
-
- /* nsvErr is OK -- it just means there are no more volumes */
- require(nsvErr == result, FSGetVolumeInfo);
-
- return ( noErr );
-
- /**********************/
-
-MemoryAllocationFailed:
-FSGetVolumeInfo:
-
- /* dispose of handle if already allocated and clear the outputs */
- if ( NULL != *volumeRefsHandle )
- {
- DisposeHandle((Handle)*volumeRefsHandle);
- *volumeRefsHandle = NULL;
- }
- *numVolumes = 0;
-
-NewHandle:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-#pragma mark ----- FSRef/FSpec/Path/Name Conversion Routines -----
-
-/*****************************************************************************/
-
-OSErr
-FSRefMakeFSSpec(
- const FSRef *ref,
- FSSpec *spec)
-{
- OSErr result;
-
- /* check parameters */
- require_action(NULL != spec, BadParameter, result = paramErr);
-
- result = FSGetCatalogInfo(ref, kFSCatInfoNone, NULL, NULL, spec, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
-FSGetCatalogInfo:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSMakeFSRef(
- FSVolumeRefNum volRefNum,
- SInt32 dirID,
- ConstStr255Param name,
- FSRef *ref)
-{
- OSErr result;
- FSRefParam pb;
-
- /* check parameters */
- require_action(NULL != ref, BadParameter, result = paramErr);
-
- pb.ioVRefNum = volRefNum;
- pb.ioDirID = dirID;
- pb.ioNamePtr = CONST_CAST(StringPtr, name);
- pb.newRef = ref;
- result = PBMakeFSRefSync(&pb);
- require_noerr(result, PBMakeFSRefSync);
-
-PBMakeFSRefSync:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSStatus
-FSMakePath(
- SInt16 volRefNum,
- SInt32 dirID,
- ConstStr255Param name,
- UInt8 *path,
- UInt32 maxPathSize)
-{
- OSStatus result;
- FSRef ref;
-
- /* check parameters */
- require_action(NULL != path, BadParameter, result = paramErr);
-
- /* convert the inputs to an FSRef */
- result = FSMakeFSRef(volRefNum, dirID, name, &ref);
- require_noerr(result, FSMakeFSRef);
-
- /* and then convert the FSRef to a path */
- result = FSRefMakePath(&ref, path, maxPathSize);
- require_noerr(result, FSRefMakePath);
-
-FSRefMakePath:
-FSMakeFSRef:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSStatus
-FSPathMakeFSSpec(
- const UInt8 *path,
- FSSpec *spec,
- Boolean *isDirectory) /* can be NULL */
-{
- OSStatus result;
- FSRef ref;
-
- /* check parameters */
- require_action(NULL != spec, BadParameter, result = paramErr);
-
- /* convert the POSIX path to an FSRef */
- result = FSPathMakeRef(path, &ref, isDirectory);
- require_noerr(result, FSPathMakeRef);
-
- /* and then convert the FSRef to an FSSpec */
- result = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, spec, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
-FSGetCatalogInfo:
-FSPathMakeRef:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-UnicodeNameGetHFSName(
- UniCharCount nameLength,
- const UniChar *name,
- TextEncoding textEncodingHint,
- Boolean isVolumeName,
- Str31 hfsName)
-{
- OSStatus result;
- ByteCount unicodeByteLength;
- ByteCount unicodeBytesConverted;
- ByteCount actualPascalBytes;
- UnicodeMapping uMapping;
- UnicodeToTextInfo utInfo;
-
- /* check parameters */
- require_action(NULL != hfsName, BadParameter, result = paramErr);
-
- /* make sure output is valid in case we get errors or there's nothing to convert */
- hfsName[0] = 0;
-
- unicodeByteLength = nameLength * sizeof(UniChar);
- if ( 0 == unicodeByteLength )
- {
- /* do nothing */
- result = noErr;
- }
- else
- {
- /* if textEncodingHint is kTextEncodingUnknown, get a "default" textEncodingHint */
- if ( kTextEncodingUnknown == textEncodingHint )
- {
- ScriptCode script;
- RegionCode region;
-
- script = (ScriptCode)GetScriptManagerVariable(smSysScript);
- region = (RegionCode)GetScriptManagerVariable(smRegionCode);
- result = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare, region,
- NULL, &textEncodingHint );
- if ( paramErr == result )
- {
- /* ok, ignore the region and try again */
- result = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare,
- kTextRegionDontCare, NULL, &textEncodingHint );
- }
- if ( noErr != result )
- {
- /* ok... try something */
- textEncodingHint = kTextEncodingMacRoman;
- }
- }
-
- uMapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeV2_0,
- kUnicodeCanonicalDecompVariant, kUnicode16BitFormat);
- uMapping.otherEncoding = GetTextEncodingBase(textEncodingHint);
- uMapping.mappingVersion = kUnicodeUseHFSPlusMapping;
-
- result = CreateUnicodeToTextInfo(&uMapping, &utInfo);
- require_noerr(result, CreateUnicodeToTextInfo);
-
- result = ConvertFromUnicodeToText(utInfo, unicodeByteLength, name, kUnicodeLooseMappingsMask,
- 0, NULL, 0, NULL, /* offsetCounts & offsetArrays */
- isVolumeName ? kHFSMaxVolumeNameChars : kHFSMaxFileNameChars,
- &unicodeBytesConverted, &actualPascalBytes, &hfsName[1]);
- require_noerr(result, ConvertFromUnicodeToText);
-
- hfsName[0] = (unsigned char)actualPascalBytes; /* fill in length byte */
-
-ConvertFromUnicodeToText:
-
- /* verify the result in debug builds -- there's really not anything you can do if it fails */
- verify_noerr(DisposeUnicodeToTextInfo(&utInfo));
- }
-
-CreateUnicodeToTextInfo:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-HFSNameGetUnicodeName(
- ConstStr31Param hfsName,
- TextEncoding textEncodingHint,
- HFSUniStr255 *unicodeName)
-{
- ByteCount unicodeByteLength;
- OSStatus result;
- UnicodeMapping uMapping;
- TextToUnicodeInfo tuInfo;
- ByteCount pascalCharsRead;
-
- /* check parameters */
- require_action(NULL != unicodeName, BadParameter, result = paramErr);
-
- /* make sure output is valid in case we get errors or there's nothing to convert */
- unicodeName->length = 0;
-
- if ( 0 == StrLength(CONST_CAST(StringPtr, hfsName)) )
- {
- result = noErr;
- }
- else
- {
- /* if textEncodingHint is kTextEncodingUnknown, get a "default" textEncodingHint */
- if ( kTextEncodingUnknown == textEncodingHint )
- {
- ScriptCode script;
- RegionCode region;
-
- script = GetScriptManagerVariable(smSysScript);
- region = GetScriptManagerVariable(smRegionCode);
- result = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare, region,
- NULL, &textEncodingHint);
- if ( paramErr == result )
- {
- /* ok, ignore the region and try again */
- result = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare,
- kTextRegionDontCare, NULL, &textEncodingHint);
- }
- if ( noErr != result )
- {
- /* ok... try something */
- textEncodingHint = kTextEncodingMacRoman;
- }
- }
-
- uMapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeV2_0,
- kUnicodeCanonicalDecompVariant, kUnicode16BitFormat);
- uMapping.otherEncoding = GetTextEncodingBase(textEncodingHint);
- uMapping.mappingVersion = kUnicodeUseHFSPlusMapping;
-
- result = CreateTextToUnicodeInfo(&uMapping, &tuInfo);
- require_noerr(result, CreateTextToUnicodeInfo);
-
- result = ConvertFromTextToUnicode(tuInfo, hfsName[0], &hfsName[1],
- 0, /* no control flag bits */
- 0, NULL, 0, NULL, /* offsetCounts & offsetArrays */
- sizeof(unicodeName->unicode), /* output buffer size in bytes */
- &pascalCharsRead, &unicodeByteLength, unicodeName->unicode);
- require_noerr(result, ConvertFromTextToUnicode);
-
- /* convert from byte count to char count */
- unicodeName->length = unicodeByteLength / sizeof(UniChar);
-
-ConvertFromTextToUnicode:
-
- /* verify the result in debug builds -- there's really not anything you can do if it fails */
- verify_noerr(DisposeTextToUnicodeInfo(&tuInfo));
- }
-
-CreateTextToUnicodeInfo:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-#pragma mark ----- File/Directory Manipulation Routines -----
-
-/*****************************************************************************/
-
-Boolean FSRefValid(const FSRef *ref)
-{
- return ( noErr == FSGetCatalogInfo(ref, kFSCatInfoNone, NULL, NULL, NULL, NULL) );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetParentRef(
- const FSRef *ref,
- FSRef *parentRef)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
-
- /* check parameters */
- require_action(NULL != parentRef, BadParameter, result = paramErr);
-
- result = FSGetCatalogInfo(ref, kFSCatInfoNodeID, &catalogInfo, NULL, NULL, parentRef);
- require_noerr(result, FSGetCatalogInfo);
-
- /*
- * Note: FSRefs always point to real file system objects. So, there cannot
- * be a FSRef to the parent of volume root directories. Early versions of
- * Mac OS X do not handle this case correctly and incorrectly return a
- * FSRef for the parent of volume root directories instead of returning an
- * invalid FSRef (a cleared FSRef is invalid). The next three lines of code
- * ensure that you won't run into this bug. WW9D!
- */
- if ( fsRtDirID == catalogInfo.nodeID )
- {
- /* clear parentRef and return noErr which is the proper behavior */
- memset(parentRef, 0, sizeof(FSRef));
- }
-
-FSGetCatalogInfo:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetFileDirName(
- const FSRef *ref,
- HFSUniStr255 *outName)
-{
- OSErr result;
-
- /* check parameters */
- require_action(NULL != outName, BadParameter, result = paramErr);
-
- result = FSGetCatalogInfo(ref, kFSCatInfoNone, NULL, outName, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
-FSGetCatalogInfo:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetNodeID(
- const FSRef *ref,
- long *nodeID, /* can be NULL */
- Boolean *isDirectory) /* can be NULL */
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSCatalogInfoBitmap whichInfo;
-
- /* determine what catalog information to get */
- whichInfo = kFSCatInfoNone; /* start with none */
- if ( NULL != nodeID )
- {
- whichInfo |= kFSCatInfoNodeID;
- }
- if ( NULL != isDirectory )
- {
- whichInfo |= kFSCatInfoNodeFlags;
- }
-
- result = FSGetCatalogInfo(ref, whichInfo, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- if ( NULL != nodeID )
- {
- *nodeID = catalogInfo.nodeID;
- }
- if ( NULL != isDirectory )
- {
- *isDirectory = (0 != (kFSNodeIsDirectoryMask & catalogInfo.nodeFlags));
- }
-
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetUserPrivilegesPermissions(
- const FSRef *ref,
- UInt8 *userPrivileges, /* can be NULL */
- UInt32 permissions[4]) /* can be NULL */
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSCatalogInfoBitmap whichInfo;
-
- /* determine what catalog information to get */
- whichInfo = kFSCatInfoNone; /* start with none */
- if ( NULL != userPrivileges )
- {
- whichInfo |= kFSCatInfoUserPrivs;
- }
- if ( NULL != permissions )
- {
- whichInfo |= kFSCatInfoPermissions;
- }
-
- result = FSGetCatalogInfo(ref, whichInfo, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- if ( NULL != userPrivileges )
- {
- *userPrivileges = catalogInfo.userPrivileges;
- }
- if ( NULL != permissions )
- {
- BlockMoveData(&catalogInfo.permissions, permissions, sizeof(UInt32) * 4);
- }
-
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSCheckLock(
- const FSRef *ref)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSVolumeInfo volumeInfo;
-
- /* get nodeFlags and vRefNum for container */
- result = FSGetCatalogInfo(ref, kFSCatInfoNodeFlags + kFSCatInfoVolume, &catalogInfo, NULL, NULL,NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- /* is file locked? */
- if ( 0 != (catalogInfo.nodeFlags & kFSNodeLockedMask) )
- {
- result = fLckdErr; /* file is locked */
- }
- else
- {
- /* file isn't locked, but is volume locked? */
-
- /* get volume flags */
- result = FSGetVolumeInfo(catalogInfo.volume, 0, NULL, kFSVolInfoFlags, &volumeInfo, NULL, NULL);
- require_noerr(result, FSGetVolumeInfo);
-
- if ( 0 != (volumeInfo.flags & kFSVolFlagHardwareLockedMask) )
- {
- result = wPrErr; /* volume locked by hardware */
- }
- else if ( 0 != (volumeInfo.flags & kFSVolFlagSoftwareLockedMask) )
- {
- result = vLckdErr; /* volume locked by software */
- }
- }
-
-FSGetVolumeInfo:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetForkSizes(
- const FSRef *ref,
- UInt64 *dataLogicalSize, /* can be NULL */
- UInt64 *rsrcLogicalSize) /* can be NULL */
-{
- OSErr result;
- FSCatalogInfoBitmap whichInfo;
- FSCatalogInfo catalogInfo;
-
- whichInfo = kFSCatInfoNodeFlags;
- if ( NULL != dataLogicalSize )
- {
- /* get data fork size */
- whichInfo |= kFSCatInfoDataSizes;
- }
- if ( NULL != rsrcLogicalSize )
- {
- /* get resource fork size */
- whichInfo |= kFSCatInfoRsrcSizes;
- }
-
- /* get nodeFlags and catalog info */
- result = FSGetCatalogInfo(ref, whichInfo, &catalogInfo, NULL, NULL,NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- /* make sure FSRef was to a file */
- require_action(0 == (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask), FSRefNotFile, result = notAFileErr);
-
- if ( NULL != dataLogicalSize )
- {
- /* return data fork size */
- *dataLogicalSize = catalogInfo.dataLogicalSize;
- }
- if ( NULL != rsrcLogicalSize )
- {
- /* return resource fork size */
- *rsrcLogicalSize = catalogInfo.rsrcLogicalSize;
- }
-
-FSRefNotFile:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetTotalForkSizes(
- const FSRef *ref,
- UInt64 *totalLogicalSize, /* can be NULL */
- UInt64 *totalPhysicalSize, /* can be NULL */
- ItemCount *forkCount) /* can be NULL */
-{
- OSErr result;
- CatPositionRec forkIterator;
- SInt64 forkSize;
- SInt64 *forkSizePtr;
- UInt64 forkPhysicalSize;
- UInt64 *forkPhysicalSizePtr;
-
- /* Determine if forkSize needed */
- if ( NULL != totalLogicalSize)
- {
- *totalLogicalSize = 0;
- forkSizePtr = &forkSize;
- }
- else
- {
- forkSizePtr = NULL;
- }
-
- /* Determine if forkPhysicalSize is needed */
- if ( NULL != totalPhysicalSize )
- {
- *totalPhysicalSize = 0;
- forkPhysicalSizePtr = &forkPhysicalSize;
- }
- else
- {
- forkPhysicalSizePtr = NULL;
- }
-
- /* zero fork count if returning it */
- if ( NULL != forkCount )
- {
- *forkCount = 0;
- }
-
- /* Iterate through the forks to get the sizes */
- forkIterator.initialize = 0;
- do
- {
- result = FSIterateForks(ref, &forkIterator, NULL, forkSizePtr, forkPhysicalSizePtr);
- if ( noErr == result )
- {
- if ( NULL != totalLogicalSize )
- {
- *totalLogicalSize += forkSize;
- }
-
- if ( NULL != totalPhysicalSize )
- {
- *totalPhysicalSize += forkPhysicalSize;
- }
-
- if ( NULL != forkCount )
- {
- ++*forkCount;
- }
- }
- } while ( noErr == result );
-
- /* any error result other than errFSNoMoreItems is serious */
- require(errFSNoMoreItems == result, FSIterateForks);
-
- /* Normal exit */
- result = noErr;
-
-FSIterateForks:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSBumpDate(
- const FSRef *ref)
-{
- OSStatus result;
- FSCatalogInfo catalogInfo;
- UTCDateTime oldDateTime;
-#if !BuildingMoreFilesXForMacOS9
- FSRef parentRef;
- Boolean notifyParent;
-#endif
-
-#if !BuildingMoreFilesXForMacOS9
- /* Get the node flags, the content modification date and time, and the parent ref */
- result = FSGetCatalogInfo(ref, kFSCatInfoNodeFlags + kFSCatInfoContentMod, &catalogInfo, NULL, NULL, &parentRef);
- require_noerr(result, FSGetCatalogInfo);
-
- /* Notify the parent if this is a file */
- notifyParent = (0 == (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask));
-#else
- /* Get the content modification date and time */
- result = FSGetCatalogInfo(ref, kFSCatInfoContentMod, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-#endif
-
- oldDateTime = catalogInfo.contentModDate;
-
- /* Get the current date and time */
- result = GetUTCDateTime(&catalogInfo.contentModDate, kUTCDefaultOptions);
- require_noerr(result, GetUTCDateTime);
-
- /* if the old date and time is the the same as the current, bump the seconds by one */
- if ( (catalogInfo.contentModDate.fraction == oldDateTime.fraction) &&
- (catalogInfo.contentModDate.lowSeconds == oldDateTime.lowSeconds) &&
- (catalogInfo.contentModDate.highSeconds == oldDateTime.highSeconds) )
- {
- ++catalogInfo.contentModDate.lowSeconds;
- if ( 0 == catalogInfo.contentModDate.lowSeconds )
- {
- ++catalogInfo.contentModDate.highSeconds;
- }
- }
-
- /* Bump the content modification date and time */
- result = FSSetCatalogInfo(ref, kFSCatInfoContentMod, &catalogInfo);
- require_noerr(result, FSSetCatalogInfo);
-
-#if !BuildingMoreFilesXForMacOS9
- /*
- * The problem with FNNotify is that it is not available under Mac OS 9
- * and there's no way to test for that except for looking for the symbol
- * or something. So, I'll just conditionalize this for those who care
- * to send a notification.
- */
-
- /* Send a notification for the parent of the file, or for the directory */
- result = FNNotify(notifyParent ? &parentRef : ref, kFNDirectoryModifiedMessage, kNilOptions);
- require_noerr(result, FNNotify);
-#endif
-
- /* ignore errors from FSSetCatalogInfo (volume might be write protected) and FNNotify */
-FNNotify:
-FSSetCatalogInfo:
-
- return ( noErr );
-
- /**********************/
-
-GetUTCDateTime:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetFinderInfo(
- const FSRef *ref,
- FinderInfo *info, /* can be NULL */
- ExtendedFinderInfo *extendedInfo, /* can be NULL */
- Boolean *isDirectory) /* can be NULL */
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSCatalogInfoBitmap whichInfo;
-
- /* determine what catalog information is really needed */
- whichInfo = kFSCatInfoNone;
-
- if ( NULL != info )
- {
- /* get FinderInfo */
- whichInfo |= kFSCatInfoFinderInfo;
- }
-
- if ( NULL != extendedInfo )
- {
- /* get ExtendedFinderInfo */
- whichInfo |= kFSCatInfoFinderXInfo;
- }
-
- if ( NULL != isDirectory )
- {
- whichInfo |= kFSCatInfoNodeFlags;
- }
-
- result = FSGetCatalogInfo(ref, whichInfo, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- /* return FinderInfo if requested */
- if ( NULL != info )
- {
- BlockMoveData(catalogInfo.finderInfo, info, sizeof(FinderInfo));
- }
-
- /* return ExtendedFinderInfo if requested */
- if ( NULL != extendedInfo)
- {
- BlockMoveData(catalogInfo.extFinderInfo, extendedInfo, sizeof(ExtendedFinderInfo));
- }
-
- /* set isDirectory Boolean if requested */
- if ( NULL != isDirectory)
- {
- *isDirectory = (0 != (kFSNodeIsDirectoryMask & catalogInfo.nodeFlags));
- }
-
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSSetFinderInfo(
- const FSRef *ref,
- const FinderInfo *info,
- const ExtendedFinderInfo *extendedInfo)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSCatalogInfoBitmap whichInfo;
-
- /* determine what catalog information will be set */
- whichInfo = kFSCatInfoNone; /* start with none */
- if ( NULL != info )
- {
- /* set FinderInfo */
- whichInfo |= kFSCatInfoFinderInfo;
- BlockMoveData(info, catalogInfo.finderInfo, sizeof(FinderInfo));
- }
- if ( NULL != extendedInfo )
- {
- /* set ExtendedFinderInfo */
- whichInfo |= kFSCatInfoFinderXInfo;
- BlockMoveData(extendedInfo, catalogInfo.extFinderInfo, sizeof(ExtendedFinderInfo));
- }
-
- result = FSSetCatalogInfo(ref, whichInfo, &catalogInfo);
- require_noerr(result, FSGetCatalogInfo);
-
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSChangeCreatorType(
- const FSRef *ref,
- OSType fileCreator,
- OSType fileType)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSRef parentRef;
-
- /* get nodeFlags, finder info, and parent FSRef */
- result = FSGetCatalogInfo(ref, kFSCatInfoNodeFlags + kFSCatInfoFinderInfo, &catalogInfo , NULL, NULL, &parentRef);
- require_noerr(result, FSGetCatalogInfo);
-
- /* make sure FSRef was to a file */
- require_action(0 == (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask), FSRefNotFile, result = notAFileErr);
-
- /* If fileType not 0x00000000, change fileType */
- if ( fileType != (OSType)0x00000000 )
- {
- ((FileInfo *)&catalogInfo.finderInfo)->fileType = fileType;
- }
-
- /* If creator not 0x00000000, change creator */
- if ( fileCreator != (OSType)0x00000000 )
- {
- ((FileInfo *)&catalogInfo.finderInfo)->fileCreator = fileCreator;
- }
-
- /* now, save the new information back to disk */
- result = FSSetCatalogInfo(ref, kFSCatInfoFinderInfo, &catalogInfo);
- require_noerr(result, FSSetCatalogInfo);
-
- /* and attempt to bump the parent directory's mod date to wake up */
- /* the Finder to the change we just made (ignore errors from this) */
- verify_noerr(FSBumpDate(&parentRef));
-
-FSSetCatalogInfo:
-FSRefNotFile:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSChangeFinderFlags(
- const FSRef *ref,
- Boolean setBits,
- UInt16 flagBits)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
- FSRef parentRef;
-
- /* get the current finderInfo */
- result = FSGetCatalogInfo(ref, kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, &parentRef);
- require_noerr(result, FSGetCatalogInfo);
-
- /* set or clear the appropriate bits in the finderInfo.finderFlags */
- if ( setBits )
- {
- /* OR in the bits */
- ((FileInfo *)&catalogInfo.finderInfo)->finderFlags |= flagBits;
- }
- else
- {
- /* AND out the bits */
- ((FileInfo *)&catalogInfo.finderInfo)->finderFlags &= ~flagBits;
- }
-
- /* save the modified finderInfo */
- result = FSSetCatalogInfo(ref, kFSCatInfoFinderInfo, &catalogInfo);
- require_noerr(result, FSSetCatalogInfo);
-
- /* and attempt to bump the parent directory's mod date to wake up the Finder */
- /* to the change we just made (ignore errors from this) */
- verify_noerr(FSBumpDate(&parentRef));
-
-FSSetCatalogInfo:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSSetInvisible(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, true, kIsInvisible) );
-}
-
-OSErr
-FSClearInvisible(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, false, kIsInvisible) );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSSetNameLocked(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, true, kNameLocked) );
-}
-
-OSErr
-FSClearNameLocked(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, false, kNameLocked) );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSSetIsStationery(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, true, kIsStationery) );
-}
-
-OSErr
-FSClearIsStationery(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, false, kIsStationery) );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSSetHasCustomIcon(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, true, kHasCustomIcon) );
-}
-
-OSErr
-FSClearHasCustomIcon(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, false, kHasCustomIcon) );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSClearHasBeenInited(
- const FSRef *ref)
-{
- return ( FSChangeFinderFlags(ref, false, kHasBeenInited) );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSCopyFileMgrAttributes(
- const FSRef *sourceRef,
- const FSRef *destinationRef,
- Boolean copyLockBit)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
-
- /* get the source information */
- result = FSGetCatalogInfo(sourceRef, kFSCatInfoSettableInfo, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- /* don't copy the hasBeenInited bit; clear it */
- ((FileInfo *)&catalogInfo.finderInfo)->finderFlags &= ~kHasBeenInited;
-
- /* should the locked bit be copied? */
- if ( !copyLockBit )
- {
- /* no, make sure the locked bit is clear */
- catalogInfo.nodeFlags &= ~kFSNodeLockedMask;
- }
-
- /* set the destination information */
- result = FSSetCatalogInfo(destinationRef, kFSCatInfoSettableInfo, &catalogInfo);
- require_noerr(result, FSSetCatalogInfo);
-
-FSSetCatalogInfo:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSMoveRenameObjectUnicode(
- const FSRef *ref,
- const FSRef *destDirectory,
- UniCharCount nameLength,
- const UniChar *name, /* can be NULL (no rename during move) */
- TextEncoding textEncodingHint,
- FSRef *newRef) /* if function fails along the way, newRef is final location of file */
-{
- OSErr result;
- FSVolumeRefNum destVRefNum;
- UInt32 destDirID;
- FSCatalogInfo catalogInfo;
- FSRef originalDirectory;
- TextEncoding originalTextEncodingHint;
- HFSUniStr255 originalName;
- HFSUniStr255 uniqueName; /* unique name given to object while moving it to destination */
- long theSeed; /* the seed for generating unique names */
-
- /* check parameters */
- require_action(NULL != newRef, BadParameter, result = paramErr);
-
- /* newRef = input to start with */
- BlockMoveData(ref, newRef, sizeof(FSRef));
-
- /* get destDirectory's NodeFlags, vRefNum and dirID */
- result = FSGetCatalogInfo(destDirectory, kFSCatInfoNodeFlags | kFSCatInfoVolume | kFSCatInfoNodeID, &catalogInfo, NULL, NULL, NULL);
- require_noerr(result, DestinationBad);
-
- /* make sure destination is a directory */
- require_action(0 != (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask), DestinationBad, result = dirNFErr);
-
- /* save destVRefNum and dirID */
- destVRefNum = catalogInfo.volume;
- destDirID = catalogInfo.nodeID;
-
- /* get ref's vRefNum, parent DirID, TextEncoding, name and parent directory */
- result = FSGetCatalogInfo(ref, kFSCatInfoTextEncoding | kFSCatInfoVolume | kFSCatInfoParentDirID, &catalogInfo, &originalName, NULL, &originalDirectory);
- require_noerr(result, SourceBad);
-
- /* save TextEncoding */
- originalTextEncodingHint = catalogInfo.textEncodingHint;
-
- /* make sure ref and destDirectory are on same volume */
- require_action(destVRefNum == catalogInfo.volume, NotSameVolume, result = diffVolErr);
-
- /* Skip a few steps if we're not renaming */
- if ( NULL != name )
- {
- /* if we are not moving, only renaming, skip some more steps */
- if ( destDirID == catalogInfo.parentDirID )
- {
- /* Rename the object to new name */
- result = FSRenameUnicode(newRef, nameLength, name, textEncodingHint, newRef);
- require_noerr(result, FSRenameUnicodeSimple);
- }
- else
- {
- /* generate a name that is unique in both directories */
- theSeed = 0x4a696d4c; /* a fine unlikely filename */
-
- result = GenerateUniqueHFSUniStr(&theSeed, &originalDirectory, destDirectory, &uniqueName);
- require_noerr(result, GenerateUniqueHFSUniStrFailed);
-
- /* Rename the object to uniqueName */
- result = FSRenameUnicode(newRef, uniqueName.length, uniqueName.unicode, kTextEncodingUnknown, newRef);
- require_noerr(result, FSRenameUnicodeBeforeMoveFailed);
-
- /* Move object to its new home */
- result = FSMoveObject(newRef, destDirectory, newRef);
- require_noerr(result, FSMoveObjectAfterRenameFailed);
-
- /* Rename the object to new name */
- result = FSRenameUnicode(newRef, nameLength, name, textEncodingHint, newRef);
- require_noerr(result, FSRenameUnicodeAfterMoveFailed);
- }
- }
- else
- {
- /* if we are not moving, skip the move call (which will fail under 9.0 through 10.1.x) and return noErr */
- if ( destDirID != catalogInfo.parentDirID )
- {
- /* Move object to its new home */
- result = FSMoveObject(newRef, destDirectory, newRef);
- require_noerr(result, FSMoveObjectNoRenameFailed);
- }
- }
-
- return ( result );
-
- /*************/
-
-/*
- * failure handling code when renaming
- */
-
-FSRenameUnicodeAfterMoveFailed:
-
- /* Error handling: move object back to original location - ignore errors */
- verify_noerr(FSMoveObject(newRef, &originalDirectory, newRef));
-
-FSMoveObjectAfterRenameFailed:
-
- /* Error handling: rename object back to original name - ignore errors */
- verify_noerr(FSRenameUnicode(newRef, originalName.length, originalName.unicode, originalTextEncodingHint, newRef));
-
-FSRenameUnicodeBeforeMoveFailed:
-GenerateUniqueHFSUniStrFailed:
-FSRenameUnicodeSimple:
-
-/*
- * failure handling code for renaming or not
- */
-FSMoveObjectNoRenameFailed:
-NotSameVolume:
-SourceBad:
-DestinationBad:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-/*
- The FSDeleteContainerLevel function deletes the contents of a container
- directory. All files and subdirectories in the specified container are
- deleted. If a locked file or directory is encountered, it is unlocked
- and then deleted. If any unexpected errors are encountered,
- FSDeleteContainerLevel quits and returns to the caller.
-
- container --> FSRef to a directory.
- theGlobals --> A pointer to a FSDeleteContainerGlobals struct
- which contains the variables that do not need to
- be allocated each time FSDeleteContainerLevel
- recurses. That lets FSDeleteContainerLevel use
- less stack space per recursion level.
-*/
-
-static
-void
-FSDeleteContainerLevel(
- const FSRef *container,
- FSDeleteContainerGlobals *theGlobals)
-{
- /* level locals */
- FSIterator iterator;
- FSRef itemToDelete;
- UInt16 nodeFlags;
-
- /* Open FSIterator for flat access and give delete optimization hint */
- theGlobals->result = FSOpenIterator(container, kFSIterateFlat + kFSIterateDelete, &iterator);
- require_noerr(theGlobals->result, FSOpenIterator);
-
- /* delete the contents of the directory */
- do
- {
- /* get 1 item to delete */
- theGlobals->result = FSGetCatalogInfoBulk(iterator, 1, &theGlobals->actualObjects,
- NULL, kFSCatInfoNodeFlags, &theGlobals->catalogInfo,
- &itemToDelete, NULL, NULL);
- if ( (noErr == theGlobals->result) && (1 == theGlobals->actualObjects) )
- {
- /* save node flags in local in case we have to recurse */
- nodeFlags = theGlobals->catalogInfo.nodeFlags;
-
- /* is it a file or directory? */
- if ( 0 != (nodeFlags & kFSNodeIsDirectoryMask) )
- {
- /* it's a directory -- delete its contents before attempting to delete it */
- FSDeleteContainerLevel(&itemToDelete, theGlobals);
- }
- /* are we still OK to delete? */
- if ( noErr == theGlobals->result )
- {
- /* is item locked? */
- if ( 0 != (nodeFlags & kFSNodeLockedMask) )
- {
- /* then attempt to unlock it (ignore result since FSDeleteObject will set it correctly) */
- theGlobals->catalogInfo.nodeFlags = nodeFlags & ~kFSNodeLockedMask;
- (void) FSSetCatalogInfo(&itemToDelete, kFSCatInfoNodeFlags, &theGlobals->catalogInfo);
- }
- /* delete the item */
- theGlobals->result = FSDeleteObject(&itemToDelete);
- }
- }
- } while ( noErr == theGlobals->result );
-
- /* we found the end of the items normally, so return noErr */
- if ( errFSNoMoreItems == theGlobals->result )
- {
- theGlobals->result = noErr;
- }
-
- /* close the FSIterator (closing an open iterator should never fail) */
- verify_noerr(FSCloseIterator(iterator));
-
-FSOpenIterator:
-
- return;
-}
-
-/*****************************************************************************/
-
-OSErr
-FSDeleteContainerContents(
- const FSRef *container)
-{
- FSDeleteContainerGlobals theGlobals;
-
- /* delete container's contents */
- FSDeleteContainerLevel(container, &theGlobals);
-
- return ( theGlobals.result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSDeleteContainer(
- const FSRef *container)
-{
- OSErr result;
- FSCatalogInfo catalogInfo;
-
- /* get nodeFlags for container */
- result = FSGetCatalogInfo(container, kFSCatInfoNodeFlags, &catalogInfo, NULL, NULL,NULL);
- require_noerr(result, FSGetCatalogInfo);
-
- /* make sure container is a directory */
- require_action(0 != (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask), ContainerNotDirectory, result = dirNFErr);
-
- /* delete container's contents */
- result = FSDeleteContainerContents(container);
- require_noerr(result, FSDeleteContainerContents);
-
- /* is container locked? */
- if ( 0 != (catalogInfo.nodeFlags & kFSNodeLockedMask) )
- {
- /* then attempt to unlock container (ignore result since FSDeleteObject will set it correctly) */
- catalogInfo.nodeFlags &= ~kFSNodeLockedMask;
- (void) FSSetCatalogInfo(container, kFSCatInfoNodeFlags, &catalogInfo);
- }
-
- /* delete the container */
- result = FSDeleteObject(container);
-
-FSDeleteContainerContents:
-ContainerNotDirectory:
-FSGetCatalogInfo:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-/*
- The FSIterateContainerLevel function iterates the contents of a container
- directory and calls a IterateContainerFilterProc function once for each
- file and directory found.
-
- theGlobals --> A pointer to a FSIterateContainerGlobals struct
- which contains the variables needed globally by
- all recusion levels of FSIterateContainerLevel.
- That makes FSIterateContainer thread safe since
- each call to it uses its own global world.
- It also contains the variables that do not need
- to be allocated each time FSIterateContainerLevel
- recurses. That lets FSIterateContainerLevel use
- less stack space per recursion level.
-*/
-
-static
-void
-FSIterateContainerLevel(
- FSIterateContainerGlobals *theGlobals)
-{
- FSIterator iterator;
-
- /* If maxLevels is zero, we aren't checking levels */
- /* If currentLevel < maxLevels, look at this level */
- if ( (theGlobals->maxLevels == 0) ||
- (theGlobals->currentLevel < theGlobals->maxLevels) )
- {
- /* Open FSIterator for flat access to theGlobals->ref */
- theGlobals->result = FSOpenIterator(&theGlobals->ref, kFSIterateFlat, &iterator);
- require_noerr(theGlobals->result, FSOpenIterator);
-
- ++theGlobals->currentLevel; /* Go to next level */
-
- /* Call FSGetCatalogInfoBulk in loop to get all items in the container */
- do
- {
- theGlobals->result = FSGetCatalogInfoBulk(iterator, 1, &theGlobals->actualObjects,
- &theGlobals->containerChanged, theGlobals->whichInfo, &theGlobals->catalogInfo,
- &theGlobals->ref, theGlobals->specPtr, theGlobals->namePtr);
- if ( (noErr == theGlobals->result || errFSNoMoreItems == theGlobals->result) &&
- (0 != theGlobals->actualObjects) )
- {
- /* Call the IterateFilterProc */
- theGlobals->quitFlag = CallIterateContainerFilterProc(theGlobals->iterateFilter,
- theGlobals->containerChanged, theGlobals->currentLevel,
- &theGlobals->catalogInfo, &theGlobals->ref,
- theGlobals->specPtr, theGlobals->namePtr, theGlobals->yourDataPtr);
- /* Is it a directory? */
- if ( 0 != (theGlobals->catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) )
- {
- /* Keep going? */
- if ( !theGlobals->quitFlag )
- {
- /* Dive again if the IterateFilterProc didn't say "quit" */
- FSIterateContainerLevel(theGlobals);
- }
- }
- }
- /* time to fall back a level? */
- } while ( (noErr == theGlobals->result) && (!theGlobals->quitFlag) );
-
- /* errFSNoMoreItems is OK - it only means we hit the end of this level */
- /* afpAccessDenied is OK, too - it only means we cannot see inside a directory */
- if ( (errFSNoMoreItems == theGlobals->result) ||
- (afpAccessDenied == theGlobals->result) )
- {
- theGlobals->result = noErr;
- }
-
- --theGlobals->currentLevel; /* Return to previous level as we leave */
-
- /* Close the FSIterator (closing an open iterator should never fail) */
- verify_noerr(FSCloseIterator(iterator));
- }
-
-FSOpenIterator:
-
- return;
-}
-
-/*****************************************************************************/
-
-OSErr
-FSIterateContainer(
- const FSRef *container,
- ItemCount maxLevels,
- FSCatalogInfoBitmap whichInfo,
- Boolean wantFSSpec,
- Boolean wantName,
- IterateContainerFilterProcPtr iterateFilter,
- void *yourDataPtr)
-{
- OSErr result;
- FSIterateContainerGlobals theGlobals;
-
- /* make sure there is an iterateFilter */
- require_action(iterateFilter != NULL, NoIterateFilter, result = paramErr);
-
- /*
- * set up the globals we need to access from the recursive routine
- */
- theGlobals.iterateFilter = iterateFilter;
- /* we need the node flags no matter what was requested so we can detect files vs. directories */
- theGlobals.whichInfo = whichInfo | kFSCatInfoNodeFlags;
- /* start with input container -- the first OpenIterator will ensure it is a directory */
- theGlobals.ref = *container;
- if ( wantFSSpec )
- {
- theGlobals.specPtr = &theGlobals.spec;
- }
- else
- {
- theGlobals.specPtr = NULL;
- }
- if ( wantName )
- {
- theGlobals.namePtr = &theGlobals.name;
- }
- else
- {
- theGlobals.namePtr = NULL;
- }
- theGlobals.yourDataPtr = yourDataPtr;
- theGlobals.maxLevels = maxLevels;
- theGlobals.currentLevel = 0;
- theGlobals.quitFlag = false;
- theGlobals.containerChanged = false;
- theGlobals.result = noErr;
- theGlobals.actualObjects = 0;
-
- /* here we go into recursion land... */
- FSIterateContainerLevel(&theGlobals);
- result = theGlobals.result;
- require_noerr(result, FSIterateContainerLevel);
-
-FSIterateContainerLevel:
-NoIterateFilter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSGetDirectoryItems(
- const FSRef *container,
- FSRef ***refsHandle, /* pointer to handle of FSRefs */
- ItemCount *numRefs,
- Boolean *containerChanged)
-{
- /* Grab items 10 at a time. */
- enum { kMaxItemsPerBulkCall = 10 };
-
- OSErr result;
- OSErr memResult;
- FSIterator iterator;
- FSRef refs[kMaxItemsPerBulkCall];
- ItemCount actualObjects;
- Boolean changed;
-
- /* check parameters */
- require_action((NULL != refsHandle) && (NULL != numRefs) && (NULL != containerChanged),
- BadParameter, result = paramErr);
-
- *numRefs = 0;
- *containerChanged = false;
- *refsHandle = (FSRef **)NewHandle(0);
- require_action(NULL != *refsHandle, NewHandle, result = memFullErr);
-
- /* open an FSIterator */
- result = FSOpenIterator(container, kFSIterateFlat, &iterator);
- require_noerr(result, FSOpenIterator);
-
- /* Call FSGetCatalogInfoBulk in loop to get all items in the container */
- do
- {
- result = FSGetCatalogInfoBulk(iterator, kMaxItemsPerBulkCall, &actualObjects,
- &changed, kFSCatInfoNone, NULL, refs, NULL, NULL);
-
- /* if the container changed, set containerChanged for output, but keep going */
- if ( changed )
- {
- *containerChanged = changed;
- }
-
- /* any result other than noErr and errFSNoMoreItems is serious */
- require((noErr == result) || (errFSNoMoreItems == result), FSGetCatalogInfoBulk);
-
- /* add objects to output array and count */
- if ( 0 != actualObjects )
- {
- /* concatenate the FSRefs to the end of the handle */
- PtrAndHand(refs, (Handle)*refsHandle, actualObjects * sizeof(FSRef));
- memResult = MemError();
- require_noerr_action(memResult, MemoryAllocationFailed, result = memResult);
-
- *numRefs += actualObjects;
- }
- } while ( noErr == result );
-
- verify_noerr(FSCloseIterator(iterator)); /* closing an open iterator should never fail, but... */
-
- return ( noErr );
-
- /**********************/
-
-MemoryAllocationFailed:
-FSGetCatalogInfoBulk:
-
- /* close the iterator */
- verify_noerr(FSCloseIterator(iterator));
-
-FSOpenIterator:
- /* dispose of handle if already allocated and clear the outputs */
- if ( NULL != *refsHandle )
- {
- DisposeHandle((Handle)*refsHandle);
- *refsHandle = NULL;
- }
- *numRefs = 0;
-
-NewHandle:
-BadParameter:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-/*
- The GenerateUniqueName function generates a HFSUniStr255 name that is
- unique in both dir1 and dir2.
-
- startSeed --> A pointer to a long which is used to generate the
- unique name.
- <-- It is modified on output to a value which should
- be used to generate the next unique name.
- dir1 --> The first directory.
- dir2 --> The second directory.
- uniqueName <-- A pointer to a HFSUniStr255 where the unique name
- is to be returned.
-*/
-
-static
-OSErr
-GenerateUniqueHFSUniStr(
- long *startSeed,
- const FSRef *dir1,
- const FSRef *dir2,
- HFSUniStr255 *uniqueName)
-{
- OSErr result;
- long i;
- FSRefParam pb;
- FSRef newRef;
- unsigned char hexStr[17] = "0123456789ABCDEF";
-
- /* set up the parameter block */
- pb.name = uniqueName->unicode;
- pb.nameLength = 8; /* always 8 characters */
- pb.textEncodingHint = kTextEncodingUnknown;
- pb.newRef = &newRef;
-
- /* loop until we get fnfErr with a filename in both directories */
- result = noErr;
- while ( fnfErr != result )
- {
- /* convert startSeed to 8 character Unicode string */
- uniqueName->length = 8;
- for ( i = 0; i < 8; ++i )
- {
- uniqueName->unicode[i] = hexStr[((*startSeed >> ((7-i)*4)) & 0xf)];
- }
-
- /* try in dir1 */
- pb.ref = dir1;
- result = PBMakeFSRefUnicodeSync(&pb);
- if ( fnfErr == result )
- {
- /* try in dir2 */
- pb.ref = dir2;
- result = PBMakeFSRefUnicodeSync(&pb);
- if ( fnfErr != result )
- {
- /* exit if anything other than noErr or fnfErr */
- require_noerr(result, Dir2PBMakeFSRefUnicodeSyncFailed);
- }
- }
- else
- {
- /* exit if anything other than noErr or fnfErr */
- require_noerr(result, Dir1PBMakeFSRefUnicodeSyncFailed);
- }
-
- /* increment seed for next pass through loop, */
- /* or for next call to GenerateUniqueHFSUniStr */
- ++(*startSeed);
- }
-
- /* we have a unique file name which doesn't exist in dir1 or dir2 */
- result = noErr;
-
-Dir2PBMakeFSRefUnicodeSyncFailed:
-Dir1PBMakeFSRefUnicodeSyncFailed:
-
- return ( result );
-}
-
-/*****************************************************************************/
-
-OSErr
-FSExchangeObjectsCompat(
- const FSRef *sourceRef,
- const FSRef *destRef,
- FSRef *newSourceRef,
- FSRef *newDestRef)
-{
- enum
- {
- /* get all settable info except for mod dates, plus the volume refNum and parent directory ID */
- kGetCatInformationMask = (kFSCatInfoSettableInfo |
- kFSCatInfoVolume |
- kFSCatInfoParentDirID) &
- ~(kFSCatInfoContentMod | kFSCatInfoAttrMod),
- /* set everything possible except for mod dates */
- kSetCatinformationMask = kFSCatInfoSettableInfo &
- ~(kFSCatInfoContentMod | kFSCatInfoAttrMod)
- };
-
- OSErr result;
- GetVolParmsInfoBuffer volParmsInfo;
- UInt32 infoSize;
- FSCatalogInfo sourceCatalogInfo; /* source file's catalog information */
- FSCatalogInfo destCatalogInfo; /* destination file's catalog information */
- HFSUniStr255 sourceName; /* source file's Unicode name */
- HFSUniStr255 destName; /* destination file's Unicode name */
- FSRef sourceCurrentRef; /* FSRef to current location of source file throughout this function */
- FSRef destCurrentRef; /* FSRef to current location of destination file throughout this function */
- FSRef sourceParentRef; /* FSRef to parent directory of source file */
- FSRef destParentRef; /* FSRef to parent directory of destination file */
- HFSUniStr255 sourceUniqueName; /* unique name given to source file while exchanging it with destination */
- HFSUniStr255 destUniqueName; /* unique name given to destination file while exchanging it with source */
- long theSeed; /* the seed for generating unique names */
- Boolean sameParentDirs; /* true if source and destinatin parent directory is the same */
-
- /* check parameters */
- require_action((NULL != newSourceRef) && (NULL != newDestRef), BadParameter, result = paramErr);
-
- /* output refs and current refs = input refs to start with */
- BlockMoveData(sourceRef, newSourceRef, sizeof(FSRef));
- BlockMoveData(sourceRef, &sourceCurrentRef, sizeof(FSRef));
-
- BlockMoveData(destRef, newDestRef, sizeof(FSRef));
- BlockMoveData(destRef, &destCurrentRef, sizeof(FSRef));
-
- /* get source volume's vRefNum */
- result = FSGetCatalogInfo(&sourceCurrentRef, kFSCatInfoVolume, &sourceCatalogInfo, NULL, NULL, NULL);
- require_noerr(result, DetermineSourceVRefNumFailed);
-
- /* see if that volume supports FSExchangeObjects */
- result = FSGetVolParms(sourceCatalogInfo.volume, sizeof(GetVolParmsInfoBuffer),
- &volParmsInfo, &infoSize);
- if ( (noErr == result) && VolSupportsFSExchangeObjects(&volParmsInfo) )
- {
- /* yes - use FSExchangeObjects */
- result = FSExchangeObjects(sourceRef, destRef);
- }
- else
- {
- /* no - emulate FSExchangeObjects */
-
- /* Note: The compatibility case won't work for files with *Btree control blocks. */
- /* Right now the only *Btree files are created by the system. */
-
- /* get all catalog information and Unicode names for each file */
- result = FSGetCatalogInfo(&sourceCurrentRef, kGetCatInformationMask, &sourceCatalogInfo, &sourceName, NULL, &sourceParentRef);
- require_noerr(result, SourceFSGetCatalogInfoFailed);
-
- result = FSGetCatalogInfo(&destCurrentRef, kGetCatInformationMask, &destCatalogInfo, &destName, NULL, &destParentRef);
- require_noerr(result, DestFSGetCatalogInfoFailed);
-
- /* make sure source and destination are on same volume */
- require_action(sourceCatalogInfo.volume == destCatalogInfo.volume, NotSameVolume, result = diffVolErr);
-
- /* make sure both files are *really* files */
- require_action((0 == (sourceCatalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) &&
- (0 == (destCatalogInfo.nodeFlags & kFSNodeIsDirectoryMask)), NotAFile, result = notAFileErr);
-
- ...
[truncated message content] |
|
From: <pbr...@us...> - 2011-03-01 06:06:35
|
Revision: 1833
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1833&view=rev
Author: pbrentsimmons
Date: 2011-03-01 06:06:29 +0000 (Tue, 01 Mar 2011)
Log Message:
-----------
Fixed a bug loading custom icons in customiconload.
Modified Paths:
--------------
Frontier/trunk/Common/source/icon.c
Modified: Frontier/trunk/Common/source/icon.c
===================================================================
--- Frontier/trunk/Common/source/icon.c 2011-03-01 06:05:14 UTC (rev 1832)
+++ Frontier/trunk/Common/source/icon.c 2011-03-01 06:06:29 UTC (rev 1833)
@@ -239,63 +239,64 @@
} /*customicongetresid*/
- static boolean customiconload (bigstring bsiconname, short *rnum) {
-
- //
- // 2006-06-18 creedon: FSRef-ized
- //
- // 7.0b9 PBS: Open a resource file just once, store info about it, so it doesn't have to be opened for each rendering.
- //
-
- bigstring bsappearancefolder = "\x0a" "Appearance";
- bigstring bsiconsfolder = "\x05" "Icons";
- tyfilespec programfilespec, appearancefolder, iconsfolder, iconfilespec;
- short r, ixcurricon;
-
- if (ixnexticon >= maxcustomicontypes)
- return (false); // limit reached
-
- // get app filespec
-
- getapplicationfilespec (nil, &programfilespec);
-
- // get Appearances folder
-
- if (macgetfilespecchildfrombigstring (&programfilespec, bsappearancefolder, &appearancefolder) != noErr)
- return (false);
-
- // get Icons folder
-
- if (macgetfilespecchildfrombigstring (&appearancefolder, bsiconsfolder, &iconsfolder) != noErr)
- return (false);
-
- // get icon file
-
- if (macgetfilespecchildfrombigstring (&iconsfolder, bsiconname, &iconfilespec) != noErr)
- return (false);
-
- if (!openresourcefile (&iconfilespec, &r, resourcefork))
- return (false);
+static boolean customiconload (bigstring bsiconname, short *rnum) {
+
+ //
+ // 2006-06-18 creedon: FSRef-ized
+ //
+ // 7.0b9 PBS: Open a resource file just once, store info about it, so it doesn't have to be opened for each rendering.
+ //
+
+ bigstring bsappearancefolder = "\x0a" "Appearance";
+ bigstring bsiconsfolder = "\x05" "Icons";
+ tyfilespec programfilespec, appfolderfilespec, appearancefolder, iconsfolder, iconfilespec;
+ short r, ixcurricon;
+
+ if (ixnexticon >= maxcustomicontypes)
+ return (false); // limit reached
+
+ // get app filespec
+
+ getapplicationfilespec (nil, &programfilespec);
+ macgetfilespecparent(&programfilespec, &appfolderfilespec); //PBS 8 Sep 2010: need parent folder of app before getting Appearance folder
+
+ // get Appearances folder
+
+ if (macgetfilespecchildfrombigstring (&appfolderfilespec, bsappearancefolder, &appearancefolder) != noErr)
+ return (false);
+
+ // get Icons folder
+
+ if (macgetfilespecchildfrombigstring (&appearancefolder, bsiconsfolder, &iconsfolder) != noErr)
+ return (false);
+
+ // get icon file
+
+ if (macgetfilespecchildfrombigstring (&iconsfolder, bsiconname, &iconfilespec) != noErr)
+ return (false);
+
+ if (!openresourcefile (&iconfilespec, &r, resourcefork))
+ return (false);
+
+ if (r == -1)
+ return (false);
+
+ *rnum = r;
+
+ ixcurricon = ixnexticon;
+
+ ixnexticon++;
+
+ alllower (bsiconname);
+
+ copystring (bsiconname, icontypes [ixcurricon].bstype);
+
+ icontypes [ixcurricon].rnum = r;
+
+ return (true);
+
+} // customiconload
- if (r == -1)
- return (false);
-
- *rnum = r;
-
- ixcurricon = ixnexticon;
-
- ixnexticon++;
-
- alllower (bsiconname);
-
- copystring (bsiconname, icontypes [ixcurricon].bstype);
-
- icontypes [ixcurricon].rnum = r;
-
- return (true);
-
- } // customiconload
-
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pbr...@us...> - 2011-03-01 06:05:20
|
Revision: 1832
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1832&view=rev
Author: pbrentsimmons
Date: 2011-03-01 06:05:14 +0000 (Tue, 01 Mar 2011)
Log Message:
-----------
Fixed a memory leak in directorytopath. ioPath was created via CFStringCreateMutable -- a balancing CFRelease was missing.
Modified Paths:
--------------
Frontier/trunk/Common/source/filepath.c
Modified: Frontier/trunk/Common/source/filepath.c
===================================================================
--- Frontier/trunk/Common/source/filepath.c 2010-06-13 18:20:35 UTC (rev 1831)
+++ Frontier/trunk/Common/source/filepath.c 2011-03-01 06:05:14 UTC (rev 1832)
@@ -95,8 +95,10 @@
CFStringAppendCharacters (ioPath, &inSepChar, 1);
}
- return (CFStringGetPascalString (ioPath, path, 256, kCFStringEncodingMacRoman));
- } // directorytopath
+ boolean success = CFStringGetPascalString (ioPath, path, 256, kCFStringEncodingMacRoman);
+ CFRelease(ioPath); //PBS 2/28/11: fixed memory leak
+ return success;
+ } // directorytopath
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2010-06-13 18:20:42
|
Revision: 1831
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1831&view=rev
Author: andreradke
Date: 2010-06-13 18:20:35 +0000 (Sun, 13 Jun 2010)
Log Message:
-----------
Unhack sfdialog in filedialog.c and update to use modern Navigation Services APIs.
Modified Paths:
--------------
Frontier/trunk/Common/headers/file.h
Frontier/trunk/Common/source/filedialog.c
Frontier/trunk/Common/source/fileloop.c
Frontier/trunk/Common/source/fileops.c
Frontier/trunk/Common/source/fileverbs.c
Frontier/trunk/Common/source/opverbs.c
Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj
Modified: Frontier/trunk/Common/headers/file.h
===================================================================
--- Frontier/trunk/Common/headers/file.h 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/Common/headers/file.h 2010-06-13 18:20:35 UTC (rev 1831)
@@ -438,27 +438,8 @@
extern boolean sfdialog (tysfverb, bigstring, ptrsftypelist, ptrfilespec , OSType); /* 2005-10-06 creedon - added OSType */
extern boolean initfiledialog (void);
-
-#ifdef MACVERSION
-
- //Code change by Timothy Paustian Tuesday, June 20, 2000 2:22:02 PM
- //Nav services code for Frontier.
-
- extern OSErr TimsPutFile( bigstring, Str255, StandardFileReply *, OSType );
-
- extern OSErr TimsGetFolderOrVolume(bigstring prompt, SInt16 dialogType, StandardFileReply * outReply);
-
- extern pascal void NavEventProc(NavEventCallbackMessage callBackSelector,
- NavCBRecPtr callBackParms,
- NavCallBackUserData callBackUD);
-
- extern OSErr getafile (bigstring prompt, ptrsftypelist filetypes, StandardFileReply * outReply, OSType); /* 2005-09-23 creedon */
-
-#endif
-#endif
-
#pragma mark === filemp3.c ===
boolean getmp3info (const ptrfilespec , long *, long *, long *, long *, boolean *);
@@ -508,7 +489,7 @@
extern void fsnametobigstring(const tyfsnameptr fsname, bigstring bs); // 2009-09-05 aradke
- extern boolean CFStringRefToStr255 (CFStringRef input, StringPtr output); // 2006-08-08 creedon
+ extern boolean cfstringreftobigstring (CFStringRef input, StringPtr output); // 2006-08-08 creedon
extern OSStatus GetApplicationIconRef ( const ProcessSerialNumber * , const FSSpec* , IconRef * ); // 2006-06-04 creedon
@@ -556,3 +537,7 @@
extern boolean filestart (void); /*6.1b15 AR*/
+
+#endif //fileinclude
+
+
Modified: Frontier/trunk/Common/source/filedialog.c
===================================================================
--- Frontier/trunk/Common/source/filedialog.c 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/Common/source/filedialog.c 2010-06-13 18:20:35 UTC (rev 1831)
@@ -56,341 +56,21 @@
#ifdef MACVERSION
- #include "SetUpA5.h"
-
#define sfgetfileid 5000
#define sfputfileid 5001
#define sfgetfolderid 5002
#define sfgetdiskid 5003
- #define sfgetfolderbutton 11
- #define sfgetpromptitem 10
+ //Code change by Timothy Paustian Tuesday, June 20, 2000 2:22:02 PM
+ //Nav services code for Frontier.
+
+ static OSErr macputfiledialog (bigstring, ptrfilespec fs, OSType);
+ static OSErr macgetfiledialog (SInt16 dialogtype, bigstring prompt, ptrfilespec fs, OSType filecreator, ptrsftypelist filetypes); /* 2005-09-23 creedon */
- typedef struct tysfdata { /*data passed to hook routines*/
-
- StandardFileReply sfreply;
-
- bigstring sfprompt;
-
- Str63 sfname;
-
- ptrsftypelist sftypes;
- } tysfdata, *ptrsfdata;
-
#if ! TARGET_API_MAC_CARBON
- static pascal short sfputfilehook (short item, DialogPtr pdialog, tysfdata *pdata) {
-
- /*
- 6/11/93 dmb: added for System 7 Standard File
- */
-
- #ifdef flcomponent
- long curA5;
- #endif
-
- if (GetWRefCon (pdialog) != sfMainDialogRefCon)
- return (item);
-
- #ifdef flcomponent
-
- curA5 = SetUpAppA5 ();
-
- #endif
-
- if (item == sfHookFirstCall) {
-
- if ((*pdata).sfreply.sfFile.vRefNum != 0)
- item = sfHookChangeSelection;
- }
-
- #ifdef flcomponent
-
- RestoreA5 (curA5);
-
- #endif
-
- return (item);
- } /*sfputfilehook*/
-
-
- static pascal short sfprompthook (short item, DialogPtr pdialog, tysfdata *pdata) {
-
- /*
- 6/11/93 dmb: recoded to System 7 Standard File
- */
-
- #ifdef flcomponent
- long curA5;
- #endif
-
- if (GetWRefCon (pdialog) != sfMainDialogRefCon)
- return (item);
-
- #ifdef flcomponent
-
- curA5 = SetUpAppA5 ();
-
- #endif
-
- if (item == sfHookFirstCall) {
- Rect ritem, rdialog;
- CGrafPtr dialogPort;
- dialoggetobjectrect (pdialog, sfgetpromptitem, &ritem);
-
- //Code change by Timothy Paustian Sunday, April 30, 2000 9:20:45 PM
- //Changed to Opaque call for Carbon
-
- #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1
- dialogPort = GetDialogPort(pdialog);
- GetPortBounds(dialogPort, &rdialog);
- #else
- //old code
- #pragma unused(dialogPort)
- rdialog = (*pdialog).portRect;
- #endif
-
- if (isemptystring ((*pdata).sfprompt)) {
-
- rdialog.bottom = ritem.top;
-
- /*
- hidedialogitem (pdialog, sfgetpromptitem);
- */
- }
- else {
-
- rdialog.bottom = ritem.bottom + 4;
-
- setdialogtext (pdialog, sfgetpromptitem, (*pdata).sfprompt);
- }
-
- sizewindow (pdialog, rdialog.right - rdialog.left, rdialog.bottom - rdialog.top);
-
- if ((*pdata).sfreply.sfFile.vRefNum != 0)
- item = sfHookChangeSelection;
- }
-
- #ifdef flcomponent
-
- RestoreA5 (curA5);
-
- #endif
-
- return (item);
- } /*sfprompthook*/
-
-
- static pascal short sffolderhook (short item, DialogPtr pdialog, tysfdata *pdata) {
-
- /*
- 12/5/91 dmb: if a folder is selected, use it instead of the current folder
-
- 1/30/92 dmb: added code to handle folder aliases, which are files
-
- 9/15/92 dmb: save path in sfstring (255 chars) instead of reply.fName (63 chars)
-
- 6/11/93 dmb: recoded to System 7 Standard File
-
- 2.1b9 dmb: push dialog port when ellipsizing button title
- */
-
- bigstring bs;
-
- #ifdef flcomponent
- long curA5;
- #endif
-
- if (GetWRefCon (pdialog) != sfMainDialogRefCon)
- return (item);
-
- #ifdef flcomponent
-
- curA5 = SetUpAppA5 ();
-
- #endif
-
- item = sfprompthook (item, pdialog, pdata);
-
- switch (item) {
-
- case sfgetfolderbutton: {
-
- if ((*pdata).sfreply.sfFlags & kIsAlias) { /*must be the alias of a folder*/
- Boolean flfolder, flwasalias;
- OSErr errcode;
-
- errcode = ResolveAliasFile (&(*pdata).sfreply.sfFile, true, &flfolder, &flwasalias);
-
- switch (errcode) {
-
- case noErr:
- break;
-
- case userCanceledErr:
- item = sfHookNullEvent;
-
- goto exit;
-
- default:
- getsystemerrorstring (errcode, bs);
-
- parsedialogstring (bs, (*pdata).sfreply.sfFile.name, nil, nil, nil, bs);
-
- customalert (sferrordialogid, bs);
-
- item = sfHookNullEvent;
-
- goto exit;
- }
- }
-
- (*pdata).sfreply.sfGood = true;
-
- item = sfItemCancelButton; /*force exit*/
-
- break;
- };
-
- case sfHookNullEvent:
- if (!equalstrings ((*pdata).sfname, (*pdata).sfreply.sfFile.name)) { /*selection changed*/
- FSSpec fs;
-
- fs = (*pdata).sfreply.sfFile;
-
- copystring (fs.name, (*pdata).sfname); /*remember for next time before changing*/
-
- if (isemptystring (fs.name)) /*nothing selected*/
- FSMakeFSSpec (fs.vRefNum, fs.parID, nil, &fs);
-
- copystring (fs.name, bs);
- //Code change by Timothy Paustian Monday, August 21, 2000 4:20:21 PM
- //pushport must have a CGrafPtr on OS X
- {
- CGrafPtr thePort;
- #if TARGET_API_MAC_CARBON == 1
- thePort = GetDialogPort(pdialog);
- #else
- thePort = (CGrafPtr)pdialog;
- #endif
-
- pushport (thePort);
- }
- ellipsize (bs, 72);
-
- popport ();
-
- setdialogbutton (pdialog, sfgetfolderbutton, bs);
- }
-
- break;
- }
-
- exit:
-
- #ifdef flcomponent
-
- RestoreA5 (curA5);
-
- #endif
-
- return (item);
- } /*sffolderhook*/
-
-
- static pascal short sfdiskhook (short item, DialogPtr pdialog, tysfdata *pdata) {
-
- /*
- 6/11/93 dmb: recoded to System 7 Standard File; back to using Drive
- button like Frontier 1.0.
- */
-
- #ifdef flcomponent
- long curA5;
- #endif
-
- if (GetWRefCon (pdialog) != sfMainDialogRefCon)
- return (item);
-
- #ifdef flcomponent
-
- curA5 = SetUpAppA5 ();
-
- #endif
-
- item = sfprompthook (item, pdialog, pdata);
-
- switch (item) {
-
- case sfItemOpenButton:
- case sfHookOpenFolder:
- #if 0
-
- (*pdata).sfreply.vRefNum = -SFSaveDisk; /*IM IV-72*/
-
- setemptystring ((*pdata).sfreply.fName); /*we just want the volume*/
-
- #endif
-
- FSMakeFSSpec ((*pdata).sfreply.sfFile.vRefNum, 0, 0, &(*pdata).sfreply.sfFile);
-
- (*pdata).sfreply.sfGood = true;
-
- item = sfItemCancelButton; /*force exit*/
-
- break;
-
- case sfHookGoToDesktop:
- item = sfHookGoToNextDrive;
-
- break;
-
- case sfHookNullEvent:
- if ((*pdata).sfreply.sfIsVolume) /*need to open volume to enable Drive button*/
- item = sfHookOpenFolder;
- else {
- if (isemptystring ((*pdata).sfreply.sfFile.name)) /*no selection*/
- item = sfHookGoToParent;
- }
-
- break;
-
- case sfHookGoToParent:
- item = sfHookNullEvent;
-
- break;
-
- default:
- if (item >= sfHookCharOffset) /*typing -- ignore*/
- item = sfHookNullEvent;
- }
-
- #ifdef flcomponent
-
- RestoreA5 (curA5);
-
- #endif
-
- return (item);
- } /*sfdiskhook*/
-
-
- static pascal Boolean onlyfoldersfilter (ParmBlkPtr pb, tysfdata *pdata) {
- #pragma unused (pdata)
-
- /*
- if (foldertest (pb))
- */
-
- if (pb->fileParam.ioFlAttrib & ioDirMask)
- return (0);
-
- return (-1); /*...don't show files*/
- } /*onlyfoldersfilter*/
-
-
static pascal Boolean knowntypesfilter (ParmBlkPtr pb, tysfdata *pdata) {
short i;
@@ -427,30 +107,14 @@
#if !TARGET_RT_MAC_CFM
- #define onlyfoldersfilterUPP ((FileFilterYDUPP) &onlyfoldersfilter)
#define knowntypesfilterUPP ((FileFilterYDUPP) &knowntypesfilter)
- #define sfputfilehookUPP (&sfputfilehook)
- #define sfprompthookUPP (&sfprompthook)
- #define sffolderhookUPP (&sffolderhook)
- #define sfdiskhookUPP (&sfdiskhook)
#else
#if !TARGET_API_MAC_CARBON
- static RoutineDescriptor onlyfoldersfilterDesc = BUILD_ROUTINE_DESCRIPTOR (uppFileFilterYDProcInfo, onlyfoldersfilter);
static RoutineDescriptor knowntypesfilterDesc = BUILD_ROUTINE_DESCRIPTOR (uppFileFilterYDProcInfo, knowntypesfilter);
- static RoutineDescriptor sfputfilehookDesc = BUILD_ROUTINE_DESCRIPTOR (uppDlgHookYDProcInfo, sfputfilehook);
- static RoutineDescriptor sfprompthookDesc = BUILD_ROUTINE_DESCRIPTOR (uppDlgHookYDProcInfo, sfprompthook);
- static RoutineDescriptor sffolderhookDesc = BUILD_ROUTINE_DESCRIPTOR (uppDlgHookYDProcInfo, sffolderhook);
- static RoutineDescriptor sfdiskhookDesc = BUILD_ROUTINE_DESCRIPTOR (uppDlgHookYDProcInfo, sfdiskhook);
-
- #define onlyfoldersfilterUPP (&onlyfoldersfilterDesc)
#define knowntypesfilterUPP (&knowntypesfilterDesc)
- #define sfputfilehookUPP (&sfputfilehookDesc)
- #define sfprompthookUPP (&sfprompthookDesc)
- #define sffolderhookUPP (&sffolderhookDesc)
- #define sfdiskhookUPP (&sfdiskhookDesc)
#endif
@@ -487,19 +151,20 @@
//
// return true if the user selected a file with one of the SF routines, return false otherwise.
//
- // as a bonus, we return the full path for the selected file in the path string.
- //
-
+
#ifdef MACVERSION
+ // 2010-03-14 aradke: pick up default location from fspec, type filtering checks extension if file type not set
//
+ // 2009-09-20 aradke: discontinue use of FSSpecs and "un-hack" this routine (see 2000-06-20)
+ //
// 2006-11-04 creedon: fix a problem with returning gibberish if fs was pointing to a volume
//
// 2006-09-15 creedon: minimally FSRef-ized
//
// 2005-10-06 creedon: added filecreator parameter, used for get file dialog
//
- // 2005-09-21 creedon: changed from TimsGetFile to getafile
+ // 2005-09-21 creedon: changed from TimsGetFile to macgetfiledialog
//
// 2000-06-20 Timothy Paustian: I am going to hack the heck out of this routine. See what you think
//
@@ -534,48 +199,12 @@
// 8/1/90 dmb: if filetype is zero, show all files by passing zero to SFGetFile
//
- tysfdata sfdata;
- FSSpec *fs = &sfdata.sfreply.sfFile;
- FSSpec fspect;
OSErr err = noErr;
OSType filetype = 0;
- clearbytes ( &fspect, sizeof ( fspect ) );
-
- // move the switch statement to below because it's smarter to call it there when using the new routines for Nav
- // services.
-
- clearbytes (&sfdata, sizeof (sfdata));
-
- if ( sfverb == sfputfileverb ) {
-
- if (oserror (macgetfsspec (fspec, &fspect)))
- return (false);
- }
-
if ( filetypes != NULL )
filetype = ( *filetypes ).types [ 0 ];
- copystring (bsprompt, sfdata.sfprompt);
-
- sfdata.sftypes = filetypes;
-
- // setemptystring (bs);
-
- if ( ! isemptystring ( fspect.name ) ) { // if path is included, set default dir and strip to file name
-
- *fs = fspect; /*seed directory & file selection*/
-
- /*
- if (pathtofilespec (fname, fs) && ((*fs).vRefNum != 0))
- copystring ((*fs).name, fname);
- else
- filefrompath (fname, fname);
- */
- }
-
- setstringlength (sfdata.sfname, -1); /*make sure it can't match fsspec*/
-
shellwritescrap (textscraptype);
shellactivate ();
@@ -583,27 +212,19 @@
switch (sfverb) {
case sfputfileverb:
- if(gCanUseNavServ) {
- err = TimsPutFile (bsprompt, ( *fs ).name, &sfdata.sfreply, filetype);
- }
-
+ err = macputfiledialog (bsprompt, fspec, filetype);
break;
case sfgetfileverb:
- err = getafile (bsprompt, filetypes, &sfdata.sfreply, filecreator);
-
+ err = macgetfiledialog (sfgetfileid, bsprompt, fspec, filecreator, filetypes);
break;
case sfgetfolderverb:
- if(gCanUseNavServ)
- err = TimsGetFolderOrVolume(bsprompt, sfgetfolderid, &sfdata.sfreply);
-
+ err = macgetfiledialog (sfgetfolderid, bsprompt, fspec, kNavGenericSignature, NULL);
break;
case sfgetdiskverb:
- if(gCanUseNavServ)
- err = TimsGetFolderOrVolume(bsprompt, sfgetdiskid, &sfdata.sfreply);
-
+ err = macgetfiledialog (sfgetdiskid, bsprompt, fspec, kNavGenericSignature, NULL);
break;
}
@@ -613,37 +234,11 @@
if (userCanceledErr == err)
return false;
- if (oserror(err))
+ if (oserror (err))
return false;
- if (sfdata.sfreply.sfGood) { // canonize
+ return (true);
- FSRef fsref;
- bigstring bs;
-
- setemptystring (bs);
-
- fspec->flags.flvolume = (fs->parID == fsRtParID);
-
- if (fspec->flags.flvolume)
- copystring (fs->name, bs);
-
- err = FSMakeFSRef (fs->vRefNum, fs->parID, bs, &fsref);
-
- if (fspec->flags.flvolume) {
- fspec->ref = fsref;
- HFSNameGetUnicodeName (fs->name, kTextEncodingUnknown, &fspec->name);
- }
- else {
- macmakefilespec (&fsref, fspec);
- }
-
- return (true);
-
- }
-
- return (false);
-
#endif // MACVERSION
#ifdef WIN95VERSION
@@ -1003,212 +598,356 @@
} /*initfile*/
- OSErr TimsPutFile ( bigstring prompt, Str255 fileName, StandardFileReply *outReply, OSType filetype ) {
+ typedef struct {
+ ptrfilespec fslocation;
+ ptrsftypelist filtertypes;
+ OSType filecreator;
+ } navcallbackcontext;
+
+
+ pascal static void macnaveventcallback(NavEventCallbackMessage cbselector, NavCBRecPtr cbparams, void* refcon) {
+
+ // 2010-03-13 aradke: set initial location of file navigation dialog
+ switch (cbselector) {
+
+ case kNavCBStart: {
+
+ navcallbackcontext* context = (navcallbackcontext*) refcon;
+ ptrfilespec fs = context->fslocation;
+ FSRef fsref;
+
+ if (macgetfsref (fs, &fsref) != noErr) {
+
+ fsref = fs->ref; // try parent for putfile
+ }
+
+ if (FSRefValid (&fsref)) {
+
+ OSErr err;
+ AEDesc desc;
+
+ err = AECreateDesc (typeFSRef, &fsref, sizeof(FSRef), &desc);
+
+ if (err == noErr)
+ err = NavCustomControl (cbparams->context, kNavCtlSetLocation, (void*)&desc);
+ }
+ }
+ }/*switch*/
+ } /*macfiledialogeventcallback*/
+
+
+ pascal static boolean macnavfiltercallback(AEDesc *item, void* info, void* refcon, NavFilterModes mode) {
+
+ // 2010-03-13 aradke: filter by file creator, type and extension.
+ // file.type(f) returns the extension if no actual file type is set.
+ // with this callback, the file will be shown if the specified list of
+ // file types contains file.type(f).
+
+ if (mode == kNavFilteringBrowserList && item->descriptorType == typeFSRef) {
+
+ FSRef fsref;
+ LSItemInfoRecord iteminfo;
+ boolean flcontainer, flapp, flpackage;
+ OSErr err;
+
+ err = AEGetDescData (item, &fsref, sizeof(FSRef));
+
+ if (err != noErr)
+ return (false);
+
+ err = LSCopyItemInfoForRef (&fsref, kLSRequestAllInfo, &iteminfo);
+
+ if (err != noErr)
+ return (false);
+
+ flcontainer = ((iteminfo.flags & kLSItemInfoIsContainer) != 0);
+ flapp = ((iteminfo.flags & kLSItemInfoIsApplication) != 0);
+ flpackage = ((iteminfo.flags & kLSItemInfoIsPackage) != 0);
+
+ if (flcontainer && !flpackage && !flapp) {
+
+ return (true); // always show plain folders
+ }
+
+ navcallbackcontext* context = (navcallbackcontext*) refcon;
+ OSType filtercreator = context->filecreator;
+ ptrsftypelist filtertypes = context->filtertypes;
+
+ if (filtercreator != kNavGenericSignature)
+ if (iteminfo.creator != filtercreator)
+ return (false);
+
+ if (filtertypes == NULL || ((filtertypes->cttypes > 0) && (filtertypes->types[0] == kUnknownType)))
+ return (true);
+
+ OSType filetype = iteminfo.filetype;
+
+ if (filetype == kLSUnknownType) { // try file extension
+
+ if (iteminfo.extension == NULL)
+ return (false);
+
+ bigstring bsext;
+
+ cfstringreftobigstring (iteminfo.extension, bsext);
+
+ filetype = ' '; // init to four spaces in case actual extension is shorter
+
+ stringtoostype (bsext, &filetype);
+ }
+
+ for (short k = 0; k < filtertypes->cttypes; ++k) {
+
+ if ((filetype == filtertypes->types[k]) || (filtertypes->types[k] == kNavGenericSignature))
+ return (true);
+ }
+ }
+
+ return (false);
+ } /*macnavfiltercallback*/
+
+
+ static OSErr macputfiledialog (bigstring prompt, ptrfilespec fs, OSType filetype) {
+
+ // 2009-09-20 aradke: discontinue use of FSSpecs
+ //
// Code change by Timothy Paustian Tuesday, June 20, 2000 2:55:17 PM. New routine to use Nav services for this
// instead of CustomPutFile.
- OSErr err = noErr;
- NavReplyRecord reply;
- NavDialogOptions dialogOptions;
- NavEventUPP eventProc = NewNavEventUPP ( NavEventProc );
+ NavDialogCreationOptions options;
+ NavDialogRef dialog;
+ NavEventUPP eventupp;
+ navcallbackcontext context;
+ NavReplyRecord reply;
+ OSErr err = noErr;
+ boolean flfolder = false; // default
if ( filetype == 0 )
filetype = 'TEXT';
- err = NavGetDefaultDialogOptions ( &dialogOptions );
- copystring ( fileName, dialogOptions.savedFileName );
- copystring (prompt, dialogOptions.message );
- dialogOptions.dialogOptionFlags |= kNavNoTypePopup; // 2000-08-25 AR
+ err = NavGetDefaultDialogCreationOptions (&options);
- if (err == noErr) {
+ if (err != noErr)
+ return (err);
- err = NavPutFile ( nil, &reply, &dialogOptions, eventProc, filetype, 'LAND', nil );
+ options.clientName = CFStringCreateWithCString (kCFAllocatorDefault, APPNAME_SHORT, kCFStringEncodingMacRoman);
+
+ options.message = CFStringCreateWithPascalString (kCFAllocatorDefault, prompt, kCFStringEncodingMacRoman);
+
+ disablelangerror();
+
+ fileisfolder(fs, &flfolder);
+
+ enablelangerror();
+
+ if (!flfolder) {
+ options.saveFileName = CFStringCreateWithCharacters (kCFAllocatorDefault, fs->name.unicode, fs->name.length);
+ }
+ else {
+ bigstring bsuntitled;
- if ( err == noErr && reply.validRecord ) {
+ setemptystring (bsuntitled);
- AEKeyword theKeyword;
- DescType actualType;
- Size actualSize;
- FSSpec documentFSSpec;
+ getuntitledfilename (bsuntitled);
+
+ options.saveFileName = CFStringCreateWithPascalString (kCFAllocatorDefault, bsuntitled, kCFStringEncodingMacRoman);
+ }
+
+ options.optionFlags |= kNavNoTypePopup; // 2000-08-25 AR
+
+ context.fslocation = fs;
+ context.filtertypes = NULL;
+ context.filecreator = kNavGenericSignature;
+
+ eventupp = NewNavEventUPP(&macnaveventcallback);
+
+ err = NavCreatePutFileDialog (&options, filetype, 'LAND', eventupp, &context, &dialog);
+
+ if (err == noErr) {
- err = AEGetNthPtr ( &( reply.selection ), 1, typeFSS, &theKeyword, &actualType, &documentFSSpec,
- sizeof ( documentFSSpec ), &actualSize );
-
+ err = NavDialogRun(dialog);
+
+ if (err == noErr) {
+
+ err = NavDialogGetReply (dialog, &reply);
+
if (err == noErr) {
+
+ if (reply.validRecord) { // get fsref and name to make filespec
- outReply->sfReplacing = reply.replacing;
+ AEKeyword key;
+ DescType actualtype;
+ Size actualsize;
+ FSRef parentref;
+
+ err = AEGetNthPtr (&(reply.selection), 1, typeFSRef, &key, &actualtype, &parentref, sizeof (parentref), &actualsize);
+
+ if (err == noErr) {
+
+ assert (actualtype == typeFSRef);
+
+ fs->flags.flvolume = false;
+
+ fs->ref = parentref;
+
+ fs->name.length = CFStringGetBytes (reply.saveFileName, CFRangeMake (0, min(CFStringGetLength (reply.saveFileName), 255)),
+ kCFStringEncodingUnicode, 0, false, (UInt8 *)(fs->name.unicode), 255, NULL );
+ }
+ }
+ else {
+ err = userCanceledErr;
+ }
- FSMakeFSSpec (documentFSSpec.vRefNum, documentFSSpec.parID, documentFSSpec.name, &(outReply->sfFile));
- outReply->sfGood = true;
-
+ NavDisposeReply (&reply);
}
-
- ( void ) NavDisposeReply ( &reply );
+ }
+
+ NavDialogDispose (dialog);
}
- }
- DisposeNavEventUPP ( eventProc );
+ DisposeNavEventUPP(eventupp);
- return ( err );
+ CFRelease (options.clientName);
+ CFRelease (options.message);
+ CFRelease (options.saveFileName);
+
+ return (err);
- } // TimsPutFile
+ } // macputfiledialog
- OSErr getafile (bigstring prompt, ptrsftypelist filetypes, StandardFileReply * outReply, OSType filecreator) {
+ static OSErr macgetfiledialog (SInt16 dialogtype, bigstring prompt, ptrfilespec fs, OSType filecreator, ptrsftypelist filetypes) {
- /*
- 2005-10-06 creedon: added filecreator parameter
-
- 2005-09-21 creedon: created, cribbed from TimsGetFile
- */
+ // 2009-09-20 aradke: discontinue use of FSSpecs, merge with getfolderorvolumedialog
+ //
+ // 2005-10-06 creedon: added filecreator parameter
+ //
+ // 2005-09-21 creedon: created, cribbed from TimsGetFile
- NavDialogCreationOptions dialogOptions;
- NavDialogRef dialogRef;
- // NavEventUPP eventProc = NewNavEventUPP (NavEventProc);
- NavReplyRecord reply;
- NavTypeListHandle typeList = nil;
- OSErr anErr = noErr;
+ NavDialogCreationOptions options;
+ NavDialogRef dialog;
+ NavEventUPP eventupp;
+ NavObjectFilterUPP filterupp;
+ navcallbackcontext context;
+ NavReplyRecord reply;
+ //NavTypeListHandle typeList = NULL;
+ OSErr err;
- anErr = NavGetDefaultDialogCreationOptions (&dialogOptions);
+ err = NavGetDefaultDialogCreationOptions (&options);
- dialogOptions.clientName = CFStringCreateWithCString ( kCFAllocatorDefault, APPNAME_SHORT, kCFStringEncodingMacRoman );
- dialogOptions.message = CFStringCreateWithPascalString ( kCFAllocatorDefault, prompt, kCFStringEncodingMacRoman );
+ if (err != noErr)
+ return (err);
- if (anErr == noErr) {
+ options.clientName = CFStringCreateWithCString (kCFAllocatorDefault, APPNAME_SHORT, kCFStringEncodingMacRoman);
- if (filetypes == nil)
- dialogOptions.optionFlags -= kNavNoTypePopup;
- else
- dialogOptions.optionFlags += kNavAllFilesInPopup; // add all documents to show pop-up
+ options.message = CFStringCreateWithPascalString (kCFAllocatorDefault, prompt, kCFStringEncodingMacRoman );
+
+ options.optionFlags &= ~kNavAllowMultipleFiles; // no multiple files for now
+
+ options.optionFlags &= ~kNavAllowPreviews; // clear preview option
+
+ options.optionFlags |= kNavSupportPackages; // show packages
+
+ options.optionFlags |= kNavNoTypePopup; // disable type pop-up
- dialogOptions.optionFlags ^=kNavAllowMultipleFiles; //no multiple files for now
-
- dialogOptions.optionFlags ^= kNavAllowPreviews; // clear preview option
-
- dialogOptions.optionFlags += kNavSupportPackages; // see packages
-
- // dialogOptions.dialogOptionFlags += kNavAllowOpenPackages; // can open packages
-
- if (filetypes != nil) { // translate into a type list NavServices understands
-
- NavTypeListPtr typesP = nil;
- SInt32 hSize = (sizeof (NavTypeList) + sizeof (OSType) * (filetypes->cttypes - 1));
- newhandle (hSize, (Handle*) &typeList);
- typesP = (NavTypeListPtr) *((Handle) typeList);
+ // options.dialogOptionFlags |= kNavAllowOpenPackages; // can open packages
+
+ eventupp = NewNavEventUPP(&macnaveventcallback);
+ filterupp = NewNavObjectFilterUPP(&macnavfiltercallback);
+
+ context.fslocation = fs;
+ context.filtertypes = filetypes;
+ context.filecreator = filecreator;
+
+ if ((dialogtype == sfgetfileid)) { // translate into a type list NavServices understands
+
+ if ((filetypes != NULL) || (filecreator != kNavGenericSignature)) {
+ /*
+ NavTypeListPtr typesP = nil;
+ SInt32 hSize = (sizeof (NavTypeList) + sizeof (OSType) * (filetypes->cttypes - 1));
+
+ newhandle (hSize, (Handle*) &typeList);
+
+ typesP = (NavTypeListPtr) *((Handle) typeList);
+
typesP->componentSignature = filecreator;
typesP->reserved = 0;
typesP->osTypeCount = filetypes->cttypes;
BlockMoveData (&(filetypes->types), typesP->osType, (Size) (sizeof (OSType) * filetypes->cttypes));
+
+ options.optionFlags |= kNavAllFilesInPopup; // add "All Files" to pop-up
+ options.optionFlags |= kNavSelectAllReadableItem; // select "All Readable Items" in pop-up
+ options.optionFlags &= ~kNavNoTypePopup; // re-enable type pop-up
+
+ err = NavCreateGetFileDialog (&options, typeList, eventupp, NULL, filterupp, &context, &dialog);
+ */
+
+ err = NavCreateGetFileDialog (&options, NULL, eventupp, NULL, filterupp, &context, &dialog);
}
-
- anErr = NavCreateGetFileDialog (&dialogOptions, typeList, NULL, NULL, NULL, NULL, &dialogRef);
+ else {
- anErr = NavDialogRun (dialogRef);
+ err = NavCreateGetFileDialog (&options, NULL, eventupp, NULL, NULL, &context, &dialog);
+ }
+ }
+ else if (dialogtype == sfgetfolderid) {
+
+ err = NavCreateChooseFolderDialog (&options, eventupp, NULL, &context, &dialog);
+ }
+ else {
+ assert (dialogtype == sfgetdiskid);
- anErr = NavDialogGetReply (dialogRef, &reply);
+ err = NavCreateChooseVolumeDialog (&options, eventupp, NULL, &context, &dialog);
+ }
- if (anErr == noErr && reply.validRecord) {
+ if (err == noErr) {
+
+ err = NavDialogRun (dialog);
- AEKeyword theKeyword;
- DescType actualType;
- Size actualSize;
- FSSpec documentFSSpec;
-
- anErr = AEGetNthPtr (&(reply.selection), 1, typeFSS, &theKeyword, &actualType, &documentFSSpec, sizeof (documentFSSpec), &actualSize); // get a pointer to selected file
+ if (err == noErr) {
+
+ err = NavDialogGetReply (dialog, &reply);
- assert (actualType == typeFSS);
-
- if (anErr == noErr) {
- FSMakeFSSpec (documentFSSpec.vRefNum, documentFSSpec.parID, documentFSSpec.name, &(outReply->sfFile));
-
- outReply->sfGood = true;
- }
+ if (err == noErr) {
- anErr = NavDisposeReply (&reply); // dispose of NavReplyRecord, resources, descriptors
+ if (reply.validRecord) {
+
+ AEKeyword key;
+ DescType actualtype;
+ Size actualsize;
+ FSRef fsref;
+
+ err = AEGetNthPtr (&(reply.selection), 1, typeFSRef, &key, &actualtype, &fsref, sizeof (fsref), &actualsize);
+
+ if (err == noErr) {
+
+ assert (actualtype == typeFSRef);
+
+ err = macmakefilespec (&fsref, fs);
+ }
+ }
+ else {
+ err = userCanceledErr;
+ }
+
+ NavDisposeReply (&reply); // dispose of NavReplyRecord, resources, descriptors
+ }
}
+
+ NavDialogDispose (dialog);
}
-
- // DisposeNavEventUPP (eventProc);
- NavDialogDispose (dialogRef);
+ DisposeNavEventUPP(eventupp);
+ DisposeNavObjectFilterUPP(filterupp);
+
+ CFRelease (options.clientName);
+ CFRelease (options.message);
+
+ //disposehandle ((Handle) typeList);
- return anErr;
- } /* getafile */
+ return (err);
+ } /* macgetfiledialog */
-
- OSErr
- TimsGetFolderOrVolume(bigstring prompt, SInt16 dialogType, StandardFileReply * outReply)
- {
- NavDialogOptions dialogOptions;
- NavEventUPP eventProc = NewNavEventUPP(NavEventProc);
- OSErr anErr = noErr;
- NavReplyRecord reply;
-
- // Specify default options for dialog box
- //we don't really need to modify this, but it is needed for NavChooseFolder
- anErr = NavGetDefaultDialogOptions(&dialogOptions);
- copystring(prompt, dialogOptions.message);
-
- if(anErr == noErr)
- {
- //display the dialog
- if(sfgetfolderid == dialogType)
- anErr = NavChooseFolder(nil, &reply, &dialogOptions, eventProc, nil, nil);
- else
- {
- assert(sfgetdiskid == dialogType);
- anErr = NavChooseVolume(nil, &reply, &dialogOptions, eventProc, nil, nil);
- }
-
- if (anErr == noErr && reply.validRecord)
- {
- AEKeyword theKeyword;
- DescType actualType;
- Size actualSize;
- FSSpec documentFSSpec;
-
- // Get a pointer to selected file
- anErr = AEGetNthPtr(&(reply.selection), 1,
- typeFSS, &theKeyword,
- &actualType, &documentFSSpec,
- sizeof(documentFSSpec),
- &actualSize);
- assert(actualType == typeFSS);
- if (anErr == noErr)
- {
- FSMakeFSSpec (documentFSSpec.vRefNum, documentFSSpec.parID, documentFSSpec.name, &(outReply->sfFile));
- outReply->sfGood = true;
- }
- // Dispose of NavReplyRecord
- anErr = NavDisposeReply(&reply);
- }
- }
- DisposeNavEventUPP (eventProc);
- return anErr;
- }
-
-
- //Code change by Timothy Paustian Tuesday, June 20, 2000 9:07:26 PM
- //a very simple event proc so that Nav file service dialogs are movable and resizable.
- pascal void NavEventProc(NavEventCallbackMessage callBackSelector,
- NavCBRecPtr callBackParms,
- NavCallBackUserData callBackUD)
- {
- #pragma unused(callBackUD)
- if (callBackSelector == kNavCBEvent)
- {
- if( ((callBackParms->eventData).eventDataParms).event->what == updateEvt)
- {
- //I was having a crash due to getting the window ptr outside the switch statement.
- // This now works.
- //10/30/00 Timothy Paustian
- WindowPtr window = (WindowPtr)(((callBackParms->eventData).eventDataParms).event)->message;
- shellupdatenow(window);
- }
- }
- }
-
#endif
Modified: Frontier/trunk/Common/source/fileloop.c
===================================================================
--- Frontier/trunk/Common/source/fileloop.c 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/Common/source/fileloop.c 2010-06-13 18:20:35 UTC (rev 1831)
@@ -364,13 +364,13 @@
if ( fs.parID == fsRtParID ) {
- if ( equalstrings ( bsfile, "\x0F" ".Spotlight-V100" ) ) // skip Spotlight
+ if ( equalstrings ( bsfile, BIGSTRING ("\x0F" ".Spotlight-V100") ) ) // skip Spotlight
continue;
- if ( equalstrings ( bsfile, "\x04" ".vol" ) ) // skip .vol ( volfs )
+ if ( equalstrings ( bsfile, BIGSTRING ("\x04" ".vol" ) ) ) // skip .vol ( volfs )
continue;
- if ( equalstrings ( bsfile, "\x07" "Volumes" ) ) // skip Volumes
+ if ( equalstrings ( bsfile, BIGSTRING ("\x07" "Volumes") ) ) // skip Volumes
continue;
}
@@ -675,7 +675,7 @@
texthandletostring (hdata, bs);
- *flfolder = bs [*bs] == ':';
+ *flfolder = (lastchar (bs) == ':');
if (*flfolder)
--*bs;
Modified: Frontier/trunk/Common/source/fileops.c
===================================================================
--- Frontier/trunk/Common/source/fileops.c 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/Common/source/fileops.c 2010-06-13 18:20:35 UTC (rev 1831)
@@ -661,7 +661,7 @@
status = LSCopyItemInfoForRef ( ( *pb ).ref, kLSRequestExtension, &iteminfo );
if ( iteminfo.extension != NULL )
- CFStringRefToStr255 ( iteminfo.extension, bsext );
+ cfstringreftobigstring ( iteminfo.extension, bsext );
if ( isemptystring ( bsext ) || ( stringlength ( bsext ) > 4 ) ) // no extension
@@ -3739,7 +3739,7 @@
fss->vRefNum = catalogInfo.volume;
fss->parID = catalogInfo.nodeID;
- fsnametobigstring (&fs->name, fss->name);
+ fsnametobigstring (&fs->name, fss->name); // FIXME: what if fs->name is longer than fss->name has room for?
return (noErr);
} /*macgetfsspec*/
@@ -3907,14 +3907,14 @@
csr = CFStringCreateWithCharacters (kCFAllocatorDefault, fsname->unicode, fsname->length);
- CFStringRefToStr255 (csr, bs);
+ cfstringreftobigstring (csr, bs);
CFRelease (csr);
} /*fsnametobigstring*/
- boolean CFStringRefToStr255 (CFStringRef input, StringPtr output) {
+ boolean cfstringreftobigstring (CFStringRef input, StringPtr output) {
/*
2006-08-08 creedon: created, cribbed from < http://developer.apple.com/carbon/tipsandtricks.html#CFStringFromUnicode >
@@ -3932,7 +3932,7 @@
return (true);
- } // CFStringRefToStr255
+ } //cfstringreftobigstring
#endif /*MACVERSION*/
Modified: Frontier/trunk/Common/source/fileverbs.c
===================================================================
--- Frontier/trunk/Common/source/fileverbs.c 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/Common/source/fileverbs.c 2010-06-13 18:20:35 UTC (rev 1831)
@@ -748,7 +748,7 @@
}
- clearbytes (&fs, sizeof (fs));
+ clearfilespec (&fs);
//
// if (idstringvalue (htable, bsvarname, bsfname))
@@ -776,7 +776,7 @@
lastword ( bs, '.', bsext);
- if ( ! ( ( stringlength ( bs ) == stringlength ( bsext ) ) || ( stringlength ( bsext ) > 4 ) ) ) { // extension
+ if (!((stringlength (bs) == stringlength (bsext)) || (stringlength (bsext) > 4))) { // extension
stringtoostype (bsext, &ostype);
filetypes.cttypes = 1;
filetypes.types [0] = ostype;
@@ -2715,7 +2715,7 @@
CFStringRef csr = CFStringCreateWithCString ( kCFAllocatorDefault, bs, kCFStringEncodingUTF8 );
- CFStringRefToStr255 ( csr, bs );
+ cfstringreftobigstring ( csr, bs );
CFRelease ( csr );
Modified: Frontier/trunk/Common/source/opverbs.c
===================================================================
--- Frontier/trunk/Common/source/opverbs.c 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/Common/source/opverbs.c 2010-06-13 18:20:35 UTC (rev 1831)
@@ -1432,7 +1432,7 @@
status = LSCopyItemInfoForRef ( &fsref, kLSRequestTypeCreator || kLSRequestExtension, &iteminfo );
- CFStringRefToStr255 ( iteminfo.extension, bs );
+ cfstringreftobigstring ( iteminfo.extension, bs );
alllower ( bs );
Modified: Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj
===================================================================
--- Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj 2010-01-24 21:17:34 UTC (rev 1830)
+++ Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj 2010-06-13 18:20:35 UTC (rev 1831)
@@ -4084,7 +4084,6 @@
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
- "-Wno-long-double",
);
ZERO_LINK = NO;
};
@@ -4143,7 +4142,6 @@
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
- "-Wno-long-double",
);
ZERO_LINK = NO;
};
@@ -4156,6 +4154,7 @@
ppc,
i386,
);
+ GCC_VERSION = 4.0;
OTHER_CFLAGS = "";
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
@@ -4168,6 +4167,7 @@
ppc,
i386,
);
+ GCC_VERSION = 4.0;
OTHER_CFLAGS = "";
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2010-01-24 21:17:41
|
Revision: 1830
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1830&view=rev
Author: creecode
Date: 2010-01-24 21:17:34 +0000 (Sun, 24 Jan 2010)
Log Message:
-----------
fix for relative paths not working on mac
set fsdefault to the directory the application is in, not the path of the application itself.
the pathtofilespec function when trying to create a full path from a relative path on mac was creating a path with :: (double colons) in it.
Modified Paths:
--------------
Frontier/trunk/Common/source/filepath.c
Modified: Frontier/trunk/Common/source/filepath.c
===================================================================
--- Frontier/trunk/Common/source/filepath.c 2009-09-18 16:55:05 UTC (rev 1829)
+++ Frontier/trunk/Common/source/filepath.c 2010-01-24 21:17:34 UTC (rev 1830)
@@ -271,7 +271,13 @@
boolean pathtofilespec ( bigstring bspath, ptrfilespec fs ) {
-
+
+ //
+ // 2010-01-24 creedon: fix for relative paths not working on mac,
+ // bsfullpath was ending up with :: in it as well as
+ // the full path to the application, see initfsdefault
+ // function
+ //
// 2009-08-30 aradke: refactored mac version to make it easier to understand.
// fixed bug where a bspath containing a non-existing volume name was accepted as valid,
// e.g. filespec("foobar:"), thus deviating from previous behaviour.
@@ -280,17 +286,21 @@
//
// 5.0d8 dmb: clear fs first thing
//
- // 2.1b2 dmb: use new fsdefault for building filespec. note that if bspath isn't a partial path, the vref and dirid will be
- // ignored.
+ // 2.1b2 dmb: use new fsdefault for building filespec. note that if bspath
+ // isn't a partial path, the vref and dirid will be ignored.
//
- // 2.1b2 dmb: added special case for empty string. also, added drive number interpretation here.
+ // 2.1b2 dmb: added special case for empty string. also, added drive
+ // number interpretation here.
//
- // 1993-06-11 dmb: if FSMakeFSSpec returns fnfErr, the spec is cool (but file doesn't exist)
+ // 1993-06-11 dmb: if FSMakeFSSpec returns fnfErr, the spec is cool (but
+ // file doesn't exist)
//
- // 1991-012-17 dmb: dont append path to default directory if it's a full path
+ // 1991-012-17 dmb: dont append path to default directory if it's a full
+ // path
//
- // 1991-07-05 dmb: use FSMakeFSSpec if it's available. since it only returns noErr if the file exists, and we want to handle
- // non-existant files, we don't give up right away.
+ // 1991-07-05 dmb: use FSMakeFSSpec if it's available. since it only
+ // returns noErr if the file exists, and we want to handle
+ // non-existant files, we don't give up right away.
//
#ifdef MACVERSION
@@ -323,23 +333,25 @@
if ( ix == stringlength ( bspath ) ) // the colon we found is the last char, so bspath is a volume name
flvolume = true;
-
+
copystring ( bspathtmp, bsfullpath );
}
-
+
else {
// it's a partial path, prefix with default directory (see initfsdefault)
if ( ! filespectopath ( &fsdefault, bsfullpath ) ) // get path of default directory
return ( false );
-
- if ( bspathtmp [ 1 ] != chpathseparator ) // append path separator if partial path doesn't begin with one
- assurelastchariscolon ( bsfullpath );
-
+
+ // delete first path separator if partial path begins with one because bsfullpath always ends with one
+
+ if ( bspathtmp [ 1 ] == chpathseparator )
+ deletefirstchar ( bspathtmp );
+
pushstring ( bspathtmp, bsfullpath ); // append partial path
}
-
+
// now see if the full path resolves
if ( pathtofsref ( bsfullpath, &fsr ) == noErr ) {
@@ -505,15 +517,22 @@
void initfsdefault (void) {
//
+ // 2010-01-24 creedon: assign fsdefault the path that the application is
+ // in, not the path of the application itself,
+ // restoring previous behavior, fix for problem with
+ // relative paths not working
+ //
// 2006-06-18 creedon: FSRef-ized
//
// 2005-07-18 creedon, karstenw: created
//
-
+
#ifdef MACVERSION
getapplicationfilespec ( nil, &fsdefault );
+ macgetfilespecparent ( &fsdefault, &fsdefault );
+
#endif
} /* initfsdefault */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-09-18 16:55:13
|
Revision: 1829
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1829&view=rev
Author: andreradke
Date: 2009-09-18 16:55:05 +0000 (Fri, 18 Sep 2009)
Log Message:
-----------
Fix for Carbon OS X display glitch -- don't gray windows while saving because it would sometimes gray out the menubar and then let it stay grayed out indefinitely.
Modified Paths:
--------------
Frontier/trunk/Common/source/shellfile.c
Modified: Frontier/trunk/Common/source/shellfile.c
===================================================================
--- Frontier/trunk/Common/source/shellfile.c 2009-09-16 20:20:56 UTC (rev 1828)
+++ Frontier/trunk/Common/source/shellfile.c 2009-09-18 16:55:05 UTC (rev 1829)
@@ -369,6 +369,9 @@
7.0b16 PBS: Fix for Windows display glitch -- don't gray windows for save
if this is Windows, it leads to the display getting messed up for the frontmost
outline.
+
+ 2009-09-18 aradke: Fix for Carbon OS X display glitch -- don't gray windows while saving
+ because it would sometimes gray out the menubar and then let it stay grayed out indefinitely.
*/
initbeachball (left);
@@ -378,7 +381,8 @@
else
shellpartialeventloop (updateMask);
-#ifdef MACVERSION /*7.0b16 PBS: only Macs get grayed windows. Fix for Windows display glitch.*/
+#if 0 /*7.0b16 PBS: only Macs get grayed windows. Fix for Windows display glitch.*/
+ /*2009-09-18 aradke: graying out now causes display glitch on Mac OS X too */
#if TARGET_API_MAC_CARBON
{
//only gray the front window
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-09-16 20:21:04
|
Revision: 1828
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1828&view=rev
Author: andreradke
Date: 2009-09-16 20:20:56 +0000 (Wed, 16 Sep 2009)
Log Message:
-----------
Remove redundant build directory from FSCopyObject demo project.
Removed Paths:
-------------
Frontier/trunk/Common/FSCopyObject/build/
Property Changed:
----------------
Frontier/trunk/Common/FSCopyObject/
Property changes on: Frontier/trunk/Common/FSCopyObject
___________________________________________________________________
Added: svn:ignore
+ build
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-09-16 19:48:57
|
Revision: 1827
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1827&view=rev
Author: andreradke
Date: 2009-09-16 19:48:48 +0000 (Wed, 16 Sep 2009)
Log Message:
-----------
On Mac only, switch tyfilespec from using a CStringRef to a HFSUniStr255 for the name field in order to simplify memory management. See definition of tyfilespec in shelltypes.h for details.
Modified Paths:
--------------
Frontier/trunk/Common/headers/file.h
Frontier/trunk/Common/headers/shelltypes.h
Frontier/trunk/Common/headers/versions.h
Frontier/trunk/Common/source/about.c
Frontier/trunk/Common/source/claycallbacks.c
Frontier/trunk/Common/source/dbverbs.c
Frontier/trunk/Common/source/file.c
Frontier/trunk/Common/source/filedialog.c
Frontier/trunk/Common/source/fileloop.c
Frontier/trunk/Common/source/fileops.c
Frontier/trunk/Common/source/filepath.c
Frontier/trunk/Common/source/fileverbs.c
Frontier/trunk/Common/source/icon.c
Frontier/trunk/Common/source/langdll.c
Frontier/trunk/Common/source/langevaluate.c
Frontier/trunk/Common/source/langhtml.c
Frontier/trunk/Common/source/langipc.c
Frontier/trunk/Common/source/langpack.c
Frontier/trunk/Common/source/langsqlite.c
Frontier/trunk/Common/source/langsystypes.c
Frontier/trunk/Common/source/launch.c
Frontier/trunk/Common/source/menuverbs.c
Frontier/trunk/Common/source/opverbs.c
Frontier/trunk/Common/source/player.c
Frontier/trunk/Common/source/resources.c
Frontier/trunk/Common/source/shellfile.c
Frontier/trunk/Common/source/shellsysverbs.c
Frontier/trunk/Common/source/shellverbs.c
Frontier/trunk/Common/source/shellwindow.c
Frontier/trunk/Common/source/shellwindowverbs.c
Frontier/trunk/Common/source/tableexternal.c
Frontier/trunk/Common/source/wpverbs.c
Frontier/trunk/build_Xcode/Frontier.xcodeproj/project.pbxproj
Modified: Frontier/trunk/Common/headers/file.h
===================================================================
--- Frontier/trunk/Common/headers/file.h 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/headers/file.h 2009-09-16 19:48:48 UTC (rev 1827)
@@ -252,8 +252,6 @@
extern boolean folderfrompath (bigstring, bigstring);
-extern boolean getfileparentfolder (const ptrfilespec , ptrfilespec );
-
extern boolean deletefile ( const ptrfilespec );
extern boolean renamefile (const ptrfilespec , bigstring);
@@ -424,16 +422,6 @@
#ifdef MACVERSION
- extern boolean CFStringRefToHFSUniStr255 ( CFStringRef, HFSUniStr255 * ); // 2006-06-07 creedon
-
- extern boolean CFStringRefToStr255 ( CFStringRef, StringPtr ); // 2006-06-07 creedon
-
- extern boolean FSRefGetNameStr255 ( const FSRef *, Str255 ); // 2006-06-07 creedon
-
- extern boolean HFSUniStr255ToStr255 ( ConstHFSUniStr255Param, StringPtr ); // 2006-06-07 creedon
-
- extern boolean bigstringToHFSUniStr255 ( const bigstring, HFSUniStr255 * ); // 2006-06-07 creedon
-
extern void filegetinfofrompb ( FSRefParam *, tyfileinfo * );
extern void filegetinfofrompbcipbr ( CInfoPBRec *, tyfileinfo * );
@@ -442,30 +430,6 @@
extern boolean getmacfileinfocipbr ( const FSSpecPtr, CInfoPBRec * );
-/* 2006-08-11 creedon: cribbed from MoreFilesX.c and modded to work with Str255 */
-
-OSErr
-HFSNameGetUnicodeName255 (
- ConstStr255Param hfsName,
- TextEncoding textEncodingHint,
- HFSUniStr255 *unicodeName);
-
-/*
- The HFSNameGetUnicodeName function converts a Pascal Str255 string to an
- Unicode HFSUniStr255 string using the same routines as the File Manager.
-
- hfsName --> The Pascal string to convert.
- textEncodingHint --> The text encoding hint used for the conversion.
- You can pass kTextEncodingUnknown to use the
- "default" textEncodingHint.
- unicodeName <-- The Unicode string.
-
- __________
-
- Also see: HFSNameGetUnicodeName in MoreFilesX.c
-
-*/
-
#endif
@@ -502,16 +466,50 @@
#pragma mark === fileops.c ===
-extern boolean extendfilespec ( const ptrfilespec, ptrfilespec ); // 2006-06-23 creedon
+extern void clearfilespec(ptrfilespec); // 2009-09-05 aradke
-extern boolean getfilespecparent ( ptrfilespec ); // 2006-06-17 creedon
-
extern boolean setfilelabelindex (const ptrfilespec , short, boolean); // 2006-04-23 creedon */
-extern short getfilelabelindex (const ptrfilespec , short *); // 2006-04-23 creedon */
+extern short getfilelabelindex (const ptrfilespec , short *); // 2006-04-23 creedon */
#ifdef MACVERSION
+ extern boolean macfilespecisvalid(const ptrfilespec fs); // 2009-09-05 aradke
+
+ extern boolean macfilespecisresolvable(const ptrfilespec fs); // 2009-09-13 aradke
+
+ extern OSErr macgetfsref(const ptrfilespec fs, FSRef* fsref); // 2009-09-05 aradke
+
+ extern OSErr macgetfsspec(const ptrfilespec fs, FSSpec *fss); // 2009-09-06 aradke
+
+ extern OSErr macgetfilespecparent(const ptrfilespec fs, ptrfilespec fsparent); // 2009-09-05 aradke
+
+ extern OSErr macgetfilespecchild(const ptrfilespec fs, tyfsnameptr name, ptrfilespec fschild); // 2009-09-13 aradke
+
+ extern OSErr macgetfilespecchildfrombigstring(const ptrfilespec fs, bigstring bsname, ptrfilespec fschild); // 2009-09-13 aradke
+
+ extern OSErr macmakefilespec(const FSRef *fsref, ptrfilespec fs); // 2009-09-06 aradke
+
+ extern boolean macgetfsrefname(const FSRef *fsref, tyfsnameptr fsname); // 2009-09-05 aradke
+
+ extern boolean macgetfsrefnameasbigstring(const FSRef *fsref, bigstring bs); // 2009-09-05 aradke
+
+ extern void macgetfilespecname(const ptrfilespec fs, tyfsnameptr fsname); // 2009-09-05 aradke
+
+ extern void macgetfilespecnameasbigstring(const ptrfilespec fs, bigstring bs); // 2009-09-05 aradke
+
+ extern void clearfsname(tyfsnameptr fsname); // 2009-09-05 aradke
+
+ extern void copyfsname(const tyfsnameptr fssource, tyfsnameptr fsdest); // 2009-09-05 aradke
+
+ unsigned short fsnamelength(const tyfsnameptr fsname); // 2009-09-05 aradke
+
+ extern void bigstringtofsname(const bigstring bs, tyfsnameptr fsname); // 2009-09-05 aradke
+
+ extern void fsnametobigstring(const tyfsnameptr fsname, bigstring bs); // 2009-09-05 aradke
+
+ extern boolean CFStringRefToStr255 (CFStringRef input, StringPtr output); // 2006-08-08 creedon
+
extern OSStatus GetApplicationIconRef ( const ProcessSerialNumber * , const FSSpec* , IconRef * ); // 2006-06-04 creedon
extern OSStatus LSIsApplication( const FSRef *, Boolean *, Boolean * ); // 2006-05-25
@@ -521,7 +519,7 @@
#pragma mark === filepath.c ===
- extern boolean directorytopath ( const ptrfilespec, bigstring);
+extern boolean directorytopath ( const ptrfilespec, bigstring);
extern boolean volumerefnumtopath (short, bigstring);
@@ -543,7 +541,13 @@
extern void initfsdefault (void); /* 2005-07-18 creedon */
-
+#ifdef MACVERSION
+
+ extern OSStatus pathtofsref (bigstring, FSRef *);
+
+#endif // MACVERSION
+
+
#pragma mark === fileverbs.c ===
//extern filecheckdefaultpath (bigstring);
Modified: Frontier/trunk/Common/headers/shelltypes.h
===================================================================
--- Frontier/trunk/Common/headers/shelltypes.h 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/headers/shelltypes.h 2009-09-16 19:48:48 UTC (rev 1827)
@@ -163,15 +163,39 @@
#ifdef MACVERSION
- typedef struct ExtFSRef {
+ /*
+ 2009-09-03 aradke: FSSpec was deprecated on Mac OS X and FSRef is its replacement.
+ FSSpec could represent a non-existant file as long as its parent directory existed, but FSRef can not.
+ Therefore, we have to extend FSRef with a string to hold the name of the non-existant file.
+ The FSRef field usually points to the parent folder instead of to the file itself (even if the file exists).
+ However, volumes have no parent folder so the FSRef field points to the volume itself in that case.
+
+ We chose a fixed-size Unicode string for the name field to simplify memory management.
+ If we used a CFStringRef we would have to keep track of copying and releasing in lots of places.
- FSRef fsref;
- CFStringRef path;
+ Reference: Apple Technical Note TN2078 -- Migrating to FSRefs & long Unicode names from FSSpecs
+ http://developer.apple.com/legacy/mac/library/technotes/tn2002/tn2078.html
+ */
+
+ typedef struct tyfilespecflags {
+
+ //boolean flvalid; // true: ref and name have been set -- false: empty filespec
+ boolean flvolume; // true: ref points to volume -- false: ref points to parent of file/folder
- } ExtFSRef, *ExtFSRefPtr, **ExtFSRefHandle;
+ } tyfilespecflags;
+
+ typedef struct HFSUniStr255 tyfsname, *tyfsnameptr;
+
+ typedef struct tyfilespec {
+
+ tyfilespecflags flags;
+ FSRef ref;
+ tyfsname name;
- typedef ExtFSRef tyfilespec, *ptrfilespec, **hdlfilespec;
+ } tyfilespec;
+ typedef tyfilespec *ptrfilespec, **hdlfilespec;
+
#endif // MACVERSION
Modified: Frontier/trunk/Common/headers/versions.h
===================================================================
--- Frontier/trunk/Common/headers/versions.h 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/headers/versions.h 2009-09-16 19:48:48 UTC (rev 1827)
@@ -43,7 +43,7 @@
/* common strings for all targets */
#define APP_COPYRIGHT_FROM "2004"
-#define APP_COPYRIGHT_TILL "2007"
+#define APP_COPYRIGHT_TILL "2009"
/* target-specific strings and version info */
@@ -69,10 +69,10 @@
#define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
#define APP_STAGE_CODE 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
- #define APP_REVISION_LEVEL 15 /* for non-final releases only */
- #define APP_BUILD_NUMBER 15 /* increment by one for every release, final or not */
+ #define APP_REVISION_LEVEL 16 /* for non-final releases only */
+ #define APP_BUILD_NUMBER 16 /* increment by one for every release, final or not */
- #define APP_VERSION_STRING "10.1a15"
+ #define APP_VERSION_STRING "10.1a16"
#else
@@ -95,10 +95,10 @@
#define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
#define APP_STAGE_CODE 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
- #define APP_REVISION_LEVEL 15 /* for non-final releases only */
- #define APP_BUILD_NUMBER 15 /* increment by one for every release, final or not */
+ #define APP_REVISION_LEVEL 16 /* for non-final releases only */
+ #define APP_BUILD_NUMBER 16 /* increment by one for every release, final or not */
- #define APP_VERSION_STRING "10.1a15"
+ #define APP_VERSION_STRING "10.1a16"
#endif
#else
@@ -121,10 +121,10 @@
#define APP_SUBMINOR_VERSION_BCD 0x10 /* sub and minor version in BCD notation */
#define APP_STAGE_CODE 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
- #define APP_REVISION_LEVEL 15 /* for non-final releases only */
- #define APP_BUILD_NUMBER 15 /* increment by one for every release, final or not */
+ #define APP_REVISION_LEVEL 16 /* for non-final releases only */
+ #define APP_BUILD_NUMBER 16 /* increment by one for every release, final or not */
- #define APP_VERSION_STRING "10.1a15"
+ #define APP_VERSION_STRING "10.1a16"
#endif
@@ -134,60 +134,3 @@
#define APPNAME_SHORT APPNAME /* 2006-02-04 aradke */
#define APPNAME_TM APPNAME /* 2005-01-12 aradke: app names no longer include trademark character */
-
-
-
-
-/* 2006-02-07 aradke: old version switched off */
-
-#if 0
-
-/* Radio version information */
-
-#define radio_major_version 10
-#define radio_major_version_bcd 0x10 /* major version in BCD notation */
-
-#define radio_sub_version 1
-#define radio_minor_version 0
-#define radio_subminor_version_bcd 0x10 /* sub and minor version in BCD notation */
-
-#define radio_stage_code 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
-#define radio_revision_level 5 /* for non-final releases only */
-#define radio_build_number 5 /* increment by one for every release, final or not */
-
-#define radio_version_string "10.1a5"
-
-
-/* Frontier version information */
-
-#define frontier_major_version 10
-#define frontier_major_version_bcd 0x10 /* major version in BCD notation */
-
-#define frontier_sub_version 1
-#define frontier_minor_version 0
-#define frontier_subminor_version_bcd 0x10 /* sub and minor version in BCD notation */
-
-#define frontier_stage_code 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
-#define frontier_revision_level 5 /* for non-final releases only */
-#define frontier_build_number 5 /* increment by one for every release, final or not */
-
-#define frontier_version_string "10.1a5"
-
-
-/* OPML Editor version information */
-
-#define opml_major_version 10
-#define opml_major_version_bcd 0x10 /* major version in BCD notation */
-
-#define opml_sub_version 1
-#define opml_minor_version 0
-#define opml_subminor_version_bcd 0x10 /* sub and minor version in BCD notation */
-
-#define opml_stage_code 0x40 /* dev = 0x20, alpha = 0x40, beta = 0x60, final = 0x80 */
-#define opml_revision_level 5 /* for non-final releases only */
-#define opml_build_number 5 /* increment by one for every release, final or not */
-
-#define opml_version_string "10.1a5"
-
-#endif /* 2006-02-06 aradke: switched off, see below */
-
Modified: Frontier/trunk/Common/source/about.c
===================================================================
--- Frontier/trunk/Common/source/about.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/about.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -288,9 +288,7 @@
getapplicationfilespec (nil, &programfspec);
- ( void ) extendfilespec ( &programfspec, &programfspec );
-
- err = FSRefMakeFSSpec ( &programfspec.fsref, &fs );
+ err = macgetfsspec (&programfspec, &fs);
if (GetIconRefFromFile (&fs, &iconref, &label) == noErr) {
Modified: Frontier/trunk/Common/source/claycallbacks.c
===================================================================
--- Frontier/trunk/Common/source/claycallbacks.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/claycallbacks.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -830,58 +830,7 @@
return (true);
} /*expanddiskvisit*/
-#endif
-#if 0
-
-static boolean xxxclayinitializeoutline (void) {
-
-
- #if filebrowser
- tyexpandinfo expandinfo;
- expandinfo.hparent = nil; /*special case, see browserfindinsertionpoint*/
-
- expandinfo.ctlevels = 1;
-
- expandinfo.flsettmpbits = false;
-
- return (diskloop (&expanddiskvisit, (long) &expandinfo));
- #endif
-
- #if odbbrowser
- tybrowserspec fsroot;
- tybrowserinfo browserinfo;
- tyexpandinfo expandinfo;
- expandinfo.hparent = nil; /*special case, see browserfindinsertionpoint*/
-
- expandinfo.ctlevels = 1;
-
- expandinfo.flsettmpbits = false;
-
- fsroot.vRefNum = databasedata;
-
- /*
- fsroot.parID = roottable;
-
- setemptystring (fsroot.name);
- */
-
- fsroot.parID = nil;
-
- copystring (nameroottable, fsroot.name);
-
- claygetfileinfo (&fsroot, &browserinfo);
-
- return (clayfolderloop (&fsroot, false, browserexpandvisit, (long) &expandinfo));
-
- #endif
- } /*clayinitializeoutline*/
-
-#endif
-
-
-#if filebrowser
-
static void pushadjective (bigstring adjective, bigstring bs) {
bigstring adj;
Modified: Frontier/trunk/Common/source/dbverbs.c
===================================================================
--- Frontier/trunk/Common/source/dbverbs.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/dbverbs.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -478,8 +478,6 @@
if (!getfilespecvalue (hparam1, pnum, ptrfs))
return (false);
- ( void ) extendfilespec ( ptrfs, ptrfs );
-
for (hodb = hodblist; hodb != nil; hodb = (**hodb).hnext) {
if ( equalfilespecs ( &( **hodb ).fs, ptrfs ) ) {
@@ -641,8 +639,6 @@
if (!getbooleanvalue (hparam1, 2, &odbrec.flreadonly))
return (false);
-
- ( void ) extendfilespec ( &odbrec.fs, &odbrec.fs );
w = shellfindfilewindow ( &odbrec.fs );
Modified: Frontier/trunk/Common/source/file.c
===================================================================
--- Frontier/trunk/Common/source/file.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/file.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -55,6 +55,8 @@
boolean equalfilespecs ( const ptrfilespec fs1, const ptrfilespec fs2 ) {
//
+ // 2009-09-03 aradke: converted FSRef name field from CFStringRef to HFSUniStr255
+ //
// 2006-06-18 creedon: for Mac, FSRef-ized
//
// 5.0a25 dmb: until we set the volumeID to zero for all Win fsspecs, we must not compare them here
@@ -62,22 +64,25 @@
#ifdef MACVERSION
- if ( FSCompareFSRefs ( &( *fs1 ).fsref, &( *fs2 ).fsref ) != noErr )
- return ( false );
+ CFStringRef cfname1, cfname2;
+ boolean flequal;
+
+ if (fs1->flags.flvolume != fs2->flags.flvolume)
+ return (false);
+
+ if (FSCompareFSRefs (&fs1->ref, &fs2->ref) != noErr)
+ return (false);
- // seems like the checking could be improved for paths, what if one is NULL and the other is not?
-
- if ( ( ( *fs1 ).path != NULL ) && ( ( *fs2 ).path != NULL ) )
- if ( CFStringCompare ( ( *fs1 ).path, ( *fs2 ).path, 0 ) != kCFCompareEqualTo )
- return ( false );
-
- bigstring bs1, bs2;
+ cfname1 = CFStringCreateWithCharacters (kCFAllocatorDefault, fs1->name.unicode, fs1->name.length);
+ cfname2 = CFStringCreateWithCharacters (kCFAllocatorDefault, fs2->name.unicode, fs2->name.length);
+
+ flequal = ( CFStringCompare (cfname1, cfname2, 0) == kCFCompareEqualTo );
- getfsfile ( fs1, bs1 );
- getfsfile ( fs2, bs2 );
+ CFRelease (cfname1);
+ CFRelease (cfname2);
+
+ return (flequal);
- return ( equalstrings ( bs1, bs2 ) );
-
#endif
#ifdef WIN95VERSION
@@ -484,7 +489,7 @@
FSCatalogInfo catalogInfo;
OSErr err;
- err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoVolume, &catalogInfo, NULL, NULL, NULL );
+ err = FSGetCatalogInfo ( &fs->ref, kFSCatInfoVolume, &catalogInfo, NULL, NULL, NULL );
(*pb).volumeParam.ioVRefNum = catalogInfo.volume;
@@ -524,29 +529,25 @@
static boolean filecreateandopen ( ptrfilespec fs, OSType creator, OSType filetype, hdlfilenum *fnum) {
-
+
//
+ // 2009-09-03 aradke: converted tyfilespec.name field from CFStringRef to HFSUniStr255
+ //
// 2006-09-15 creedon: for Mac, FSRef-ized
//
#ifdef MACVERSION
- HFSUniStr255 name;
+ FSRef fsref;
OSErr err;
setfserrorparam ( fs );
- CFStringRefToHFSUniStr255 ( ( *fs ).path, &name );
+ err = FSCreateFileUnicode ( &( *fs ).ref, (*fs).name.length, (*fs).name.unicode, kFSCatInfoNone, NULL, &fsref, NULL );
- err = FSCreateFileUnicode ( &( *fs ).fsref, name.length, name.unicode, kFSCatInfoNone, NULL, &( *fs ).fsref, NULL );
-
if ( oserror ( err ) )
return (false);
- CFRelease ( ( *fs ).path );
-
- ( *fs ).path = NULL; // clear out path
-
HFSUniStr255 dataforkname;
err = FSGetDataForkName ( &dataforkname );
@@ -554,11 +555,11 @@
if ( oserror ( err ) )
return ( false );
- err = FSOpenFork ( &( *fs ).fsref, dataforkname.length, dataforkname.unicode, fsRdWrPerm, fnum );
+ err = FSOpenFork ( &fsref, dataforkname.length, dataforkname.unicode, fsRdWrPerm, fnum );
if ( oserror ( err ) ) {
- FSClose (*fnum);
+ FSCloseFork (*fnum); // FIXME: is *fnum actually valid if FSOpenFork failed?
deletefile (fs);
@@ -566,7 +567,7 @@
}
- FSSetNameLocked ( &( *fs ).fsref );
+ FSSetNameLocked ( &fsref );
return (true);
@@ -603,15 +604,12 @@
//
boolean flfolder;
- tyfilespec fst;
- ( void ) extendfilespec ( fs, &fst );
+ if ( fileexists ( fs, &flfolder ) ) { // file exists, delete it
- if ( fileexists ( &fst, &flfolder ) ) { // file exists, delete it
-
//WriteToConsole("We're deleting a file that already exists. No idea why.");
- if ( ! deletefile ( &fst ) )
+ if ( ! deletefile ( fs ) )
return ( false );
}
@@ -633,7 +631,7 @@
#ifdef MACVERSION
- OSErr err;
+ FSRef fsref;
short perm;
setfserrorparam ( fs ); // in case error message takes a filename parameter
@@ -645,21 +643,20 @@
HFSUniStr255 dataforkname;
- err = FSGetDataForkName ( &dataforkname );
+ if ( oserror ( FSGetDataForkName ( &dataforkname ) ) )
+ return ( false );
- if ( oserror ( err ) )
+ if ( oserror ( macgetfsref ( fs, &fsref ) ) )
return ( false );
- err = FSOpenFork ( &( *fs ).fsref, dataforkname.length, dataforkname.unicode, perm, fnum );
-
- if ( oserror ( err ) ) {
+ if ( oserror ( FSOpenFork ( &fsref, dataforkname.length, dataforkname.unicode, perm, fnum ) ) ) {
*fnum = 0;
return (false);
}
- FSSetNameLocked ( &( *fs ).fsref );
+ FSSetNameLocked ( &fsref );
return (true);
@@ -768,16 +765,17 @@
#ifdef MACVERSION
- OSErr err;
+ FSRef fsref;
setfserrorparam ( fs ); // in case error message takes a filename parameter
+
+ if ( oserror ( macgetfsref ( fs, &fsref ) ) )
+ return ( false );
- FSClearNameLocked ( &( *fs ).fsref );
+ FSClearNameLocked ( &fsref );
+
+ return ( ! oserror ( FSDeleteObject ( &fsref ) ) );
- err = FSDeleteObject ( &( *fs ).fsref );
-
- return ( ! oserror ( err ) );
-
#endif
#ifdef WIN95VERSION
@@ -824,6 +822,8 @@
//
// can't call filegetinfo because it has an error message if the file isn't found.
//
+ // 2009-09-03 aradke: converted tyfilespec.name field from CFStringRef to HFSUniStr255
+ //
// 2006-06-19 creedon: Mac OS X bundles/packages are not considered folders
//
// for Mac, FSRef-ized
@@ -838,24 +838,25 @@
#ifdef MACVERSION
FSCatalogInfo catalogInfo;
+ FSRef fsref;
*flfolder = false;
- if ( ( *fs ).path != NULL )
- return ( false );
+ if (macgetfsref(fs, &fsref) != noErr)
+ return (false);
- if ( FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNodeFlags, &catalogInfo, NULL, NULL, NULL ) != noErr )
- return ( false );
+ if (FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &catalogInfo, NULL, NULL, NULL) != noErr)
+ return (false);
- *flfolder = ( ( catalogInfo.nodeFlags & kFSNodeIsDirectoryMask ) != 0 );
+ *flfolder = ((catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0);
/* Mac OS X bundles/packages are not considered folders */ {
boolean flisapplication, flisbundle;
- LSIsApplication ( &( *fs ).fsref, &flisapplication, &flisbundle );
+ LSIsApplication (&fsref, &flisapplication, &flisbundle);
- if ( flisapplication || flisbundle )
+ if (flisapplication || flisbundle)
*flfolder = false;
}
@@ -901,215 +902,3 @@
} // fileexists
-
-#ifdef MACVERSION
-
- static OSErr FSRefGetName ( const FSRef *fsr, CFStringRef *name ) {
-
- //
- // the caller must dispose of the CFString
- //
- // 2007-08-01 creedon: changed variable fsRef to fsr to reduce
- // confusion with FSRef definition
- //
- // 2006-07-06 creedon: created
- //
-
- HFSUniStr255 hname;
- OSErr err = FSGetCatalogInfo ( fsr, kFSCatInfoNone, NULL, &hname,
- NULL, NULL );
-
- if ( err == noErr )
- *name = CFStringCreateWithCharacters ( kCFAllocatorDefault,
- hname.unicode, hname.length );
-
- return ( err );
-
- } // FSRefGetName
-
-
- boolean CFStringRefToStr255 ( CFStringRef input, StringPtr output ) {
-
- //
- // 2006-08-08 creedon: created, cribbed from < http://developer.apple.com/carbon/tipsandtricks.html#CFStringFromUnicode >
- //
-
- CFIndex usedBufLen;
-
- CFStringGetBytes ( input, CFRangeMake ( 0, MIN ( CFStringGetLength ( input ), 255 ) ),
- kCFStringEncodingMacRoman, '^', false, &( output [ 1 ] ), 255, &usedBufLen );
-
- output [ 0 ] = usedBufLen;
-
- if ( output [ 0 ] == 0 )
- return ( false );
-
- return ( true );
-
- } // CFStringRefToStr255
-
-
- boolean HFSUniStr255ToStr255 ( ConstHFSUniStr255Param input, StringPtr output ) {
-
- //
- // 2006-07-06 creedon; created
- //
-
- CFStringRef csr;
-
- csr = CFStringCreateWithCharacters ( kCFAllocatorDefault, input -> unicode, input -> length );
-
- CFStringRefToStr255 ( csr, output );
-
- CFRelease ( csr );
-
- return ( true );
-
- } // HFSUniStr255ToStr255
-
-
- boolean FSRefGetNameStr255 ( const FSRef *fsRef, Str255 bsname ) {
-
- //
- // 2006-07-06 creedon; created
- //
-
- CFStringRef csr;
- OSErr err = FSRefGetName ( fsRef, &csr );
-
- if ( err != noErr )
- return ( false );
-
- if ( csr == NULL )
- return ( false );
-
- if ( ! CFStringGetPascalString ( csr, bsname, 256, kCFStringEncodingMacRoman ) )
- return ( false );
-
- CFRelease ( csr );
-
- return ( true );
-
- } // FSRefGetNameStr255
-
-
- boolean bigstringToHFSUniStr255 ( const bigstring bs, HFSUniStr255 *output ) {
-
- //
- // 2006-07-06 creedon; created
- //
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bs, kCFStringEncodingMacRoman );
-
- ( *output ).length = CFStringGetLength ( csr );
-
- CFStringGetCharacters ( csr, CFRangeMake ( 0, ( *output ).length ), ( *output ).unicode );
-
- CFRelease ( csr );
-
- return ( true );
-
- } // bigstringToHFSUniStr255
-
-
- boolean CFStringRefToHFSUniStr255 ( CFStringRef input, HFSUniStr255 *output ) {
-
- //
- // 2006-08-11 creedon: created, cribbed from < http://developer.apple.com/carbon/tipsandtricks.html#CFStringFromUnicode >
- //
-
- ( *output ).length = CFStringGetBytes ( input, CFRangeMake ( 0, MIN ( CFStringGetLength ( input ), 255 ) ),
- kCFStringEncodingUnicode, 0, false, ( UInt8 * ) ( *output ).unicode, 255, NULL );
-
- if ( ( *output ).length == 0 )
- return ( false );
-
- return ( true );
-
- } // CFStringRefToHFSUniStr255
-
-
-/* 2006-08-11 creedon: cribbed from MoreFilesX.c and modded to work with Str255 */
-
-/* macro for casting away const when you really have to */
-#define CONST_CAST(type, const_var) (*(type*)((void *)&(const_var)))
-
-OSErr
-HFSNameGetUnicodeName255 (
- ConstStr255Param hfsName,
- TextEncoding textEncodingHint,
- HFSUniStr255 *unicodeName)
-{
- ByteCount unicodeByteLength;
- OSStatus result;
- UnicodeMapping uMapping;
- TextToUnicodeInfo tuInfo;
- ByteCount pascalCharsRead;
-
- /* check parameters */
- require_action(NULL != unicodeName, BadParameter, result = paramErr);
-
- /* make sure output is valid in case we get errors or there's nothing to convert */
- unicodeName->length = 0;
-
- if ( 0 == StrLength(CONST_CAST(StringPtr, hfsName)) )
- {
- result = noErr;
- }
- else
- {
- /* if textEncodingHint is kTextEncodingUnknown, get a "default" textEncodingHint */
- if ( kTextEncodingUnknown == textEncodingHint )
- {
- ScriptCode script;
- RegionCode region;
-
- script = GetScriptManagerVariable(smSysScript);
- region = GetScriptManagerVariable(smRegionCode);
- result = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare, region,
- NULL, &textEncodingHint);
- if ( paramErr == result )
- {
- /* ok, ignore the region and try again */
- result = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare,
- kTextRegionDontCare, NULL, &textEncodingHint);
- }
- if ( noErr != result )
- {
- /* ok... try something */
- textEncodingHint = kTextEncodingMacRoman;
- }
- }
-
- uMapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault,
- kUnicodeCanonicalDecompVariant, kUnicode16BitFormat);
- uMapping.otherEncoding = GetTextEncodingBase(textEncodingHint);
- uMapping.mappingVersion = kUnicodeUseHFSPlusMapping;
-
- result = CreateTextToUnicodeInfo(&uMapping, &tuInfo);
- require_noerr(result, CreateTextToUnicodeInfo);
-
- result = ConvertFromTextToUnicode(tuInfo, hfsName[0], &hfsName[1],
- 0, /* no control flag bits */
- 0, NULL, 0, NULL, /* offsetCounts & offsetArrays */
- sizeof(unicodeName->unicode), /* output buffer size in bytes */
- &pascalCharsRead, &unicodeByteLength, unicodeName->unicode);
- require_noerr(result, ConvertFromTextToUnicode);
-
- /* convert from byte count to char count */
- unicodeName->length = unicodeByteLength / sizeof(UniChar);
-
-ConvertFromTextToUnicode:
-
- /* verify the result in debug builds -- there's really not anything you can do if it fails */
- verify_noerr(DisposeTextToUnicodeInfo(&tuInfo));
- }
-
-CreateTextToUnicodeInfo:
-BadParameter:
-
- return ( result );
-}
-
- #endif
-
Modified: Frontier/trunk/Common/source/filedialog.c
===================================================================
--- Frontier/trunk/Common/source/filedialog.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/filedialog.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -535,9 +535,10 @@
//
tysfdata sfdata;
- FSSpec *fs = &sfdata.sfreply.sfFile, fspect;
+ FSSpec *fs = &sfdata.sfreply.sfFile;
+ FSSpec fspect;
OSErr err = noErr;
- OSType filetype = NULL;
+ OSType filetype = 0;
clearbytes ( &fspect, sizeof ( fspect ) );
@@ -547,23 +548,9 @@
clearbytes (&sfdata, sizeof (sfdata));
if ( sfverb == sfputfileverb ) {
-
- extendfilespec ( fspec, fspec );
-
- if ( ( *fspec ).path == NULL )
- FSGetCatalogInfo ( &( *fspec ).fsref, kFSCatInfoNone, NULL, NULL, &fspect, NULL );
- else {
- FSCatalogInfo catalogInfo;
-
- FSGetCatalogInfo ( &( *fspec ).fsref, kFSCatInfoVolume | kFSCatInfoNodeID, &catalogInfo, NULL, NULL,
- NULL );
-
- fspect.vRefNum = catalogInfo.volume;
- fspect.parID = catalogInfo.nodeID;
-
- CFStringRefToStr255 ( ( *fspec ).path, fspect.name );
-
- }
+
+ if (oserror (macgetfsspec (fspec, &fspect)))
+ return (false);
}
if ( filetypes != NULL )
@@ -597,7 +584,7 @@
case sfputfileverb:
if(gCanUseNavServ) {
- err = TimsPutFile ( bsprompt, ( *fs ).name, &sfdata.sfreply, filetype );
+ err = TimsPutFile (bsprompt, ( *fs ).name, &sfdata.sfreply, filetype);
}
break;
@@ -626,31 +613,32 @@
if (userCanceledErr == err)
return false;
- if(oserror(err))
+ if (oserror(err))
return false;
- if ( sfdata.sfreply.sfGood ) { // canonize
+ if (sfdata.sfreply.sfGood) { // canonize
+ FSRef fsref;
bigstring bs;
- boolean fl = ( *fs ).parID == fsRtParID;
- HFSUniStr255 name;
- setemptystring ( bs );
+ setemptystring (bs);
- if ( fl )
- copystring ( ( *fs ).name, bs );
+ fspec->flags.flvolume = (fs->parID == fsRtParID);
+
+ if (fspec->flags.flvolume)
+ copystring (fs->name, bs);
- err = FSMakeFSRef ( ( *fs ).vRefNum, ( *fs ).parID, bs, &( *fspec ).fsref );
+ err = FSMakeFSRef (fs->vRefNum, fs->parID, bs, &fsref);
- if ( ! fl ) {
-
- err = HFSNameGetUnicodeName ( ( *fs ).name, kTextEncodingUnknown, &name );
-
- ( *fspec ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
-
+ if (fspec->flags.flvolume) {
+ fspec->ref = fsref;
+ HFSNameGetUnicodeName (fs->name, kTextEncodingUnknown, &fspec->name);
}
+ else {
+ macmakefilespec (&fsref, fspec);
+ }
- return ( true );
+ return (true);
}
@@ -1025,7 +1013,7 @@
NavDialogOptions dialogOptions;
NavEventUPP eventProc = NewNavEventUPP ( NavEventProc );
- if ( filetype == NULL )
+ if ( filetype == 0 )
filetype = 'TEXT';
err = NavGetDefaultDialogOptions ( &dialogOptions );
@@ -1050,6 +1038,7 @@
if (err == noErr) {
outReply->sfReplacing = reply.replacing;
+
FSMakeFSSpec (documentFSSpec.vRefNum, documentFSSpec.parID, documentFSSpec.name, &(outReply->sfFile));
outReply->sfGood = true;
Modified: Frontier/trunk/Common/source/fileloop.c
===================================================================
--- Frontier/trunk/Common/source/fileloop.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/fileloop.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -195,45 +195,6 @@
return (false);
} /*diskinitloop*/
-
- boolean diskloop (tyfileloopcallback diskcallback, long refcon) {
-
- /*
- dmb 9/21/93: filegetvolumeinfo takes a vRefNum, not a string.
- */
-
- HVolumeParam pb;
- short ix;
-
- clearbytes (&pb, sizeof (pb)); /*init all fields to zero*/
-
- ix = 1; /*start with file index 1*/
-
- while (true) {
-
- bigstring bsvolume;
- tyfileinfo info;
- OSErr errcode;
-
- pb.ioVolIndex = ix++;
-
- pb.ioNamePtr = bsvolume;
-
- errcode = PBHGetVInfoSync ((HParmBlkPtr) &pb);
-
- if (errcode == nsvErr) /*not an error, just ran out of volumes*/
- return (true);
-
- if (oserror (errcode))
- return (false);
-
- filegetvolumeinfo (pb.ioVRefNum, &info);
-
- if (!(*diskcallback) (bsvolume, &info, refcon))
- return (false);
- } /*while*/
- } /*diskloop*/
-
#endif // MACVERSION
@@ -296,6 +257,8 @@
#ifdef MACVERSION
#pragma unused(filefilter)
+
+ // FIXME: fileloops should really be rewritten using FSRefs instead of pre-carbon apis
//
// a conglomeration of filemanager incantations which sets up a UserLand
@@ -322,12 +285,10 @@
short ix;
hdllistrecord hlist;
FSSpec fs;
- tyfilespec fst2;
- ( void ) extendfilespec ( fst, &fst2 );
-
- FSRefMakeFSSpec ( &fst2.fsref, &fs ); // might need to do more checking here to handle path
-
+ if (oserror (macgetfsspec (fst, &fs) ) )
+ return (false);
+
clearbytes (&pb, sizeof (CInfoPBRec)); // init all fields to zero
setoserrorparam ((ptrstring) fs.name);
@@ -535,7 +496,8 @@
tyfileinfo info;
OSErr ec;
- FSRefMakeFSSpec ( &( *pfs ).fsref, &fs ); // might need to do more checking here to handle path
+ if (oserror (macgetfsspec (pfs, &fs) ) )
+ return (false);
setoserrorparam ((ptrstring) fs.name);
@@ -681,6 +643,7 @@
long dirid;
OSErr err;
FSSpec fsfile;
+ FSRef fsref;
if (!opgetlisthandle ((**h).hfilelist, (**h).ixdirectory++, nil, &hdata))
return (false);
@@ -699,9 +662,9 @@
*flfolder = true; /*3.0.2b1*/
- FSpMakeFSRef ( &fsfile, &( *fsfilet ).fsref );
+ FSpMakeFSRef ( &fsfile, &fsref );
- ( void ) getfilespecparent ( &( *fsfilet ) );
+ macmakefilespec ( &fsref, fsfilet );
return (true);
@@ -727,12 +690,12 @@
if ((err == noErr) || (err == fnfErr)) { // 3.0.4b1 dmb
- err = FSpMakeFSRef ( &fsfile, &( *fsfilet ).fsref );
+ err = FSpMakeFSRef ( &fsfile, &fsref );
+ macmakefilespec ( &fsref, fsfilet );
+
if ( *flfolder )
( void ) fileisfolder ( fsfilet, flfolder );
-
- ( void ) getfilespecparent ( &( *fsfilet ) );
return ( true );
@@ -749,13 +712,13 @@
copystring (bs, fsfile.name);
- FSpMakeFSRef ( &fsfile, &( *fsfilet ).fsref );
+ FSpMakeFSRef ( &fsfile, &fsref );
+ macmakefilespec ( &fsref, fsfilet );
+
if ( *flfolder )
( void ) fileisfolder ( fsfilet, flfolder );
- ( void ) getfilespecparent ( &( *fsfilet ) );
-
return ( true );
}
Modified: Frontier/trunk/Common/source/fileops.c
===================================================================
--- Frontier/trunk/Common/source/fileops.c 2009-08-30 19:58:42 UTC (rev 1826)
+++ Frontier/trunk/Common/source/fileops.c 2009-09-16 19:48:48 UTC (rev 1827)
@@ -140,19 +140,15 @@
bigstring bs;
- if ( ( *fs ).path != NULL )
- CFStringRefToStr255 ( ( *fs ).path, bs );
- else
- if ( FSRefValid ( &( *fs ).fsref ) )
- FSRefGetNameStr255 ( &( *fs ).fsref, bs );
+ macgetfilespecnameasbigstring(fs, bs);
+
+ setoserrorparam(bs);
- setoserrorparam ( bs );
-
#endif // MACVERSION
#ifdef WIN95VERSION
- setoserrorparam ((ptrstring) fsname (fs));
+ setoserrorparam((ptrstring) fsname(fs));
#endif
@@ -279,20 +275,28 @@
*/
OSErr err;
+ FSRef fsref;
setfserrorparam ( fs ); // in case error message takes a filename parameter
+
+ err = macgetfsref(fs, &fsref);
- clearbytes ( pb, sizeof ( *pb ) );
- clearbytes ( catinfo, sizeof ( *catinfo ) );
+ if (err == noErr) {
- ( *pb ).catInfo = catinfo;
+ clearbytes(pb, sizeof(*pb));
+ clearbytes(catinfo, sizeof(*catinfo));
+
+ pb->catInfo = catinfo;
+
+ pb->ref = &fsref;
+ pb->whichInfo = kFSCatInfoGettableInfo;
+
+ err = PBGetCatalogInfoSync(pb);
+
+ pb->ref = NULL; // fsref is a local about to disappear
+ }
- ( *pb ).ref = &( *fs ).fsref;
- ( *pb ).whichInfo = kFSCatInfoGettableInfo;
-
- err = PBGetCatalogInfoSync ( pb );
-
- return ( ! oserror ( err ) );
+ return (!oserror(err));
} /* getmacfileinfo */
@@ -306,14 +310,14 @@
clearbytes (pb, sizeof (*pb));
- (*pb).hFileInfo.ioNamePtr = (StringPtr) (*fs).name;
+ pb->hFileInfo.ioNamePtr = (StringPtr) (*fs).name;
- (*pb).hFileInfo.ioVRefNum = (*fs).vRefNum;
+ pb->hFileInfo.ioVRefNum = (*fs).vRefNum;
- (*pb).hFileInfo.ioDirID = (*fs).parID;
+ pb->hFileInfo.ioDirID = (*fs).parID;
return (!oserror (PBGetCatInfoSync (pb)));
- } /*getmacfileinfo*/
+ } /*getmacfileinfocipbr*/
static boolean setmacfileinfo ( const ptrfilespec fs, FSRefParam *pb ) {
@@ -322,16 +326,29 @@
2.1b2 dmb: new fsspec-based version
*/
- setfserrorparam ( fs ); /*in case error message takes a filename parameter*/
+ OSErr err;
+ FSRef fsref;
- ( *pb ).ref = &( *fs ).fsref;
- ( *pb ).whichInfo = kFSCatInfoSettableInfo;
+ setfserrorparam(fs); /*in case error message takes a filename parameter*/
+
+ err = macgetfsref(fs, &fsref);
+
+ if (err == noErr) {
+
+ pb->ref = &fsref;
+
+ pb->whichInfo = kFSCatInfoSettableInfo;
- return ( ! oserror ( PBSetCatalogInfoSync ( pb ) ) );
+ err = PBSetCatalogInfoSync(pb);
+
+ pb->ref = NULL; // fsref is a local about to disappear
+ }
+
+ return (!oserror(err));
} /* setmacfileinfo */
- static boolean touchparentfolder ( const ptrfilespec fs ) {
+ static boolean touchparentfolder(const ptrfilespec fs) {
//
// touch the file date of the parent folder of fs
@@ -339,12 +356,12 @@
// 2006-06-18 creedon: FSRef-ized
//
- tyfilespec fsfolder = { { { 0 } }, 0 };
+ tyfilespec fsfolder;
- if ( FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, NULL, NULL, &fsfolder.fsref ) != noErr )
+ if (macgetfilespecparent(fs, &fsfolder) != noErr)
return (false);
- setfilemodified ( &fsfolder, timenow ( ) );
+ setfilemodified(&fsfolder, timenow());
return (true);
@@ -898,7 +915,7 @@
#endif
-boolean filegetinfo ( const ptrfilespec fs, tyfileinfo *info ) {
+boolean filegetinfo (const ptrfilespec fs, tyfileinfo *info) {
//
// 2006-06-25 creedon: for Mac, FSRef-ized
@@ -907,31 +924,26 @@
//
#ifdef MACVERSION
-
- setfserrorparam ( fs ); // in case error message takes a filename parameter
-
- if ( ( *fs ).path != NULL )
- return ( ! oserror ( fnfErr ) );
-
- if ( ! FSRefValid ( &( *fs ).fsref ) )
- return ( false );
-
+
+ FSRef fsref;
FSCatalogInfo catinfo;
FSRefParam pb;
- OSErr err;
+
+ setfserrorparam(fs); // in case error message takes a filename parameter
- clearbytes ( &pb, sizeof ( pb ) );
+ if (oserror(macgetfsref(fs, &fsref)))
+ return (false);
+
+ clearbytes(&pb, sizeof(pb));
pb.catInfo = &catinfo;
- pb.ref = &( *fs ).fsref;
+ pb.ref = &fsref;
pb.whichInfo = kFSCatInfoGettableInfo;
- err = PBGetCatalogInfoSync ( &pb );
-
- if ( oserror ( err ) )
- return ( false );
+ if (oserror(PBGetCatalogInfoSync(&pb)))
+ return (false);
- filegetinfofrompb ( &pb, info );
+ filegetinfofrompb(&pb, info);
#endif // MACVERSION
@@ -1194,22 +1206,22 @@
#ifdef MACVERSION
+ FSRef fsref;
OSErr err;
- if ( flvisible ) {
+ if (oserror (macgetfsref (fs, &fsref)))
+ return (false);
- err = FSClearInvisible ( &( *fs ).fsref );
-
- if ( err != noErr )
- return ( true );
+ if (flvisible) {
+ err = FSClearInvisible (&fsref);
}
else {
- err = FSSetInvisible ( &( *fs ).fsref );
-
- if ( err != noErr )
- return ( true );
+ err = FSSetInvisible (&fsref);
}
+ if (oserror (err))
+ return (false);
+
touchparentfolder (fs);
#endif
@@ -1299,17 +1311,21 @@
// Mac OS X bundles/packages are not considered folders
+ FSRef fsref;
boolean flisapplication, flisbundle;
- LSIsApplication ( &( *fs ).fsref, &flisapplication, &flisbundle );
+ if (macgetfsref (fs, &fsref) == noErr) {
+
+ if (LSIsApplication (&fsref, &flisapplication, &flisbundle) == noErr) {
- if ( flisapplication || flisbundle ) {
-
- *flfolder = false;
-
- return ( true );
-
- }
+ if (flisapplication || flisbundle) {
+
+ *flfolder = false;
+
+ return (true);
+ }
+ }
+ }
#endif
#ifdef WIN95VERSION
@@ -1339,7 +1355,7 @@
*flfolder = info.flfolder;
- return ( true );
+ return (true);
} // fileisfolder
@@ -1351,23 +1367,23 @@
//
#ifdef MACVERSION
-
- bigstring bsname;
- getfsfile ( fs, bsname );
-
- if ( isemptystring ( bsname ) )
- return ( false );
+ FSCatalogInfo catalogInfo;
+ FSRef fsref;
- FSCatalogInfo catalogInfo;
- OSErr err;
+ if (!fs->flags.flvolume)
+ return (false);
+
+ if (macgetfsref (fs, &fsref) != noErr)
+ return (false);
+
+ clearbytes (&catalogInfo, longsizeof (catalogInfo));
+
+ if (FSGetCatalogInfo (&fsref, kFSCatInfoGettableInfo, &catalogInfo, NULL, NULL, NULL) != noErr)
+ return (false);
+
+ return (catalogInfo.parentDirID == fsRtParID);
- clearbytes ( &catalogInfo, longsizeof ( catalogInfo ) );
-
- err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoGettableInfo, &catalogInfo, NULL, NULL, NULL ); // kFSCatInfoParentDirID
-
- return ( catalogInfo.parentDirID == fsRtParID );
-
#endif
#ifdef WIN95VERSION
@@ -1794,68 +1810,40 @@
#ifdef MACVERSION
-extern OSStatus LSIsApplication( const FSRef *inRef, Boolean *outIsApplication,
- Boolean *outIsBundled )
-{
- LSItemInfoRecord info;
- OSStatus err = LSCopyItemInfoForRef( inRef, kLSRequestBasicFlagsOnly,
- &info );
-
- if ( err == noErr )
- {
- *outIsApplication = ( kLSItemInfoIsApplication &info.flags ) != 0;
- *outIsBundled = ( kLSItemInfoIsPackage &info.flags ) != 0;
- }
- return( err );
-}
+ OSStatus LSIsApplication (const FSRef *inRef, Boolean *outIsApplication, Boolean *outIsBundled) {
- //
- // ConvertCStringToHFSUniStr is from HelloWorldTool.c of FSCopyObject with no changes, I didn't want to include
- // HelloWorldTool.c in this project because there is a whole bunch of code we don't need
- //
+ LSItemInfoRecord info;
+ OSStatus err;
- #define kCouldNotCreateCFString 4
- #define kCouldNotGetStringData 5
+ err = LSCopyItemInfoForRef (inRef, kLSRequestBasicFlagsOnly, &info);
- static OSErr ConvertCStringToHFSUniStr(const char* cStr, HFSUniStr255 *uniStr)
- {
- OSErr err = noErr;
- CFStringRef tmpStringRef = CFStringCreateWithCString( kCFAllocatorDefault, cStr, kCFStringEncodingMacRoman );
- if( tmpStringRef != NULL )
- {
- if( CFStringGetCString( tmpStringRef, (char*)uniStr->unicode, sizeof(uniStr->unicode), kCFStringEncodingUnicode ) )
- uniStr->length = CFStringGetLength( tmpStringRef );
- else
- err = kCouldNotGetStringData;
-
- CFRelease( tmpStringRef );
- }
- else
- err = kCouldNotCreateCFString;
-
- return err;
- }
+ if (err == noErr) {
+ *outIsApplication = (kLSItemInfoIsApplication & info.flags) != 0;
+ *outIsBundled = (kLSItemInfoIsPackage & info.flags) != 0;
+ }
+ return (err);
+ }/*LSIsApplication*/
+
#endif
+
boolean copyfile ( const ptrfilespec fsource, const ptrfilespec fdest, boolean fldata, boolean flresources ) {
//
// create a copy of the indicated file in the destination folder or volume, with the indicated name.
//
// 2006-06-18 creedon: for Mac, FSRef-ized
+ // combined the two definitions (Mac and Win) of this function into one, deleted old code, see
+ // revision 1329, use FSCopyObject code
//
- // combined the two definitions (Mac and Win) of this function into one deleted old code, see
- // revision 1329 use FSCopyObject code
- //
// 5.0.1 dmb: for Windows, if the file exists, overwrite it.
//
#ifdef MACVERSION
- bigstring bs;
boolean flsourcefolder;
- HFSUniStr255 name;
+ FSRef fsrefsource;
if ( ! fileisfolder ( fsource, &flsourcefolder ) )
return ( false );
@@ -1869,15 +1857,11 @@
return ( true );
}
-
- getfsfile ( fdest, bs );
- convertpstring ( bs );
-
- if ( oserror ( ConvertCStringToHFSUniStr ( bs , &name ) ) )
+ if ( oserror ( macgetfsref ( fsource, &fsrefsource ) ) )
return ( false );
- if ( oserror ( FSCopyObject ( &( *fsource ).fsref, &( *fdest ).fsref, 0, kFSCatInfoNone, kDupeActionReplace, &name,
+ if ( oserror ( FSCopyObject ( &fsrefsource, &fdest->ref, 0, kFSCatInfoNone, kDupeActionReplace, &fdest->name,
false, false, NULL, NULL, NULL, NULL ) ) )
return ( false );
@@ -1983,7 +1967,6 @@
getfsvolume ( &fs, ( long * ) vnum );
-
return (true);
} // pathtovolume
@@ -2015,8 +1998,8 @@
short ixlist;
OSType foldertype;
long attrs;
- OSErr err = errorNone;
bigstring bsfirst;
+ FSRef fsref;
if (!(gestalt (gestaltFindFolderAttr, &attrs) && (attrs & (1 << gestaltFindFolderPresent))))
return (false);
@@ -2038,29 +2021,32 @@
else {
firstword (bsfolder, chspace, bsfirst);
- if (findstringlist (bsfirst, specialfolderlistnumber, &ixlist))
+ if (findstringlist (bsfirst, specialfolderlistnumber, &ixlist))
{
foldertype = specialfolders [ixlist];
//temp items, we want to redirect to the users domain.
//if we don't do this then it is a read only directory at the root.
- if (ixlist == 11)
+ if (ixlist == 11) {
+
vnum = kUserDomain;
-
- }
- else
- err = dirNFErr;
+ }
+ }
+ else {
+
+ oserror ( dirNFErr );
+
+ return ( false );
+ }
}
- if ( err == noErr ) {
-
- err = FSFindFolder ( vnum, foldertype, flcreate, &( *fs ).fsref );
+ if ( oserror ( FSFindFolder ( vnum, foldertype, flcreate, &fsref ) ) )
+ return ( false );
- ( void ) getfilespecparent ( fs );
-
- }
+ if ( oserror ( macmakefilespec ( &fsref, fs ) ) )
+ return ( false );
- return ( ! oserror ( err ) );
+ return ( true );
#endif
@@ -2514,7 +2500,7 @@
//
long vnum;
- OptionBits flags = NULL;
+ OptionBits flags = 0;
pid_t dissenter;
getfsvolume ( fs, &vnum );
@@ -2580,6 +2566,7 @@
boolean getfilecomment (const ptrfilespec fs, bigstring bscomment) {
+ // 2009-09-06 aradke: FIXME: apparently, the proper way to get and set comments on OS X is to send Apple Events to the Finder (slow!?)
//
// 2006-06-25 creedon: minimally FSRef-ized
//
@@ -2591,17 +2578,18 @@
DTPBRec dt;
FSSpec fss;
- FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, NULL, &fss, NULL );
-
clearbytes (&dt, sizeof (dt));
setemptystring (bscomment); /*default return*/
- if ( ! surefile ( fs ) )
+ if (!surefile(fs))
return (false);
-
- if ( ! hasdesktopmanager ( fss.vRefNum ) )
+
+ if (oserror (macgetfsspec (fs, &fss)))
return (false);
+
+ if (!hasdesktopmanager (fss.vRefNum))
+ return (false);
dt.ioVRefNum = fss.vRefNum;
@@ -2639,12 +2627,13 @@
DTPBRec dt;
FSSpec fss;
- FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, NULL, &fss, NULL );
-
clearbytes (&dt, sizeof (dt));
if (!surefile (fs))
return (false);
+
+ if (oserror (macgetfsspec (fs, &fss)))
+ return (false);
if (!hasdesktopmanager (fss.vRefNum))
return (false);
@@ -2911,7 +2900,7 @@
#ifdef MACVERSION
- OSStatus status;
+ FSRef fsrefvolume;
bigstring bs, bsvolname;
short ix = 1;
@@ -2951,8 +2940,11 @@
}
- status = FSPathMakeRef ( bsvolname, &( *fs ).fsref, NULL );
+ if ( FSPathMakeRef ( bsvolname, &fsrefvolume, NULL ) != noErr )
+ return ( false );
+ return ( macmakefilespec ( &fsrefvolume, fs ) == noErr );
+
#endif
#ifdef WIN95VERSION
@@ -2976,18 +2968,21 @@
#ifdef MACVERSION
- boolean fileresolvealias ( ptrfilespec fs ) {
+ boolean fileresolvealias (ptrfilespec fs) {
//
// 2006-09-18 creedon: FSRef-ized
//
+ FSRef fsref;
boolean flfolder, flalias;
- setfserrorparam ( fs );
+ setfserrorparam (fs);
- return ( ! oserror ( FSResolveAliasFile ( &( *fs ).fsref, true, &flfolder, &flalias ) ) );
-
+ if (oserror (macgetfsref (fs, &fsref)))
+ return (false);
+
+ return (!oserror (FSResolveAliasFile ( &fsref, true, &flfolder, &flalias)));
} // fileresolvealias
#endif
@@ -3068,73 +3063,12 @@
} /*folderfrompath*/
-#ifdef MACVERSION
+boolean movefile (const ptrfilespec fs, const ptrfilespec fsto) {
- boolean getfileparentfolder ( const ptrfilespec fs, ptrfilespec fsparent ) {
-
- // 2009-08-30 aradke: handle null filespecs. don't fail silently if an error occurs.
- //
- // 2006-08-24 creedon: FSRef-ized
-
- HFSUniStr255 name;
- OSErr err;
-
- if ( !FSRefValid ( &(*fs).fsref ) ) {
-
- clearbytes ( fsparent, sizeof(tyfilespec) );
-
- return ( true );
- }
-
- err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fsparent ).fsref );
-
- if ( oserror(err) )
- return ( false );
-
- if ( ( *fs ).path == NULL ) {
-
- err = FSGetCatalogInfo ( &( *fsparent ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fsparent ).fsref );
-
- if ( oserror(err) )
- return ( false );
- }
-
- ( *fsparent ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
-
- return ( true );
-
- } // getfileparentfolder
-
-
- #if 0
-
- boolean getdefaultpath (bigstring bs) {
-
- ParamBlockRec pb;
- OSErr errcode;
-
- setstringlength (bs, 0);
-
- clearbytes (&pb, sizeof (pb));
-
- errcode = PBGetVolSync (&pb);
-
- if (oserror (errcode))
- return (false);
-
- return (filegetpath (pb.fileParam.ioVRefNum, bs));
- } /*getdefaultpath*/
-
- #endif
-
-#endif
-
-boolean movefile ( const ptrfilespec fs, const ptrfilespec fsto ) {
-
#ifdef MACVERSION
//
- // moves a file or folder speied in fs to the fcifolder specified by fsto. make sure that the new path is really a folder.
+ // moves a file or folder specified in fs to the folder specified by fsto. make sure that the new path is really a folder.
//
// 2006-10-23 creedon: use fileisfolder function to determine if fs is folder
//
@@ -3143,22 +3077,23 @@
// 1991-08-02 dmb: corrected error message params
//
- boolean fl;
+ boolean flfolder;
+ FSRef src, dst;
- ( void ) fileisfolder ( fs, &fl );
+ (void) fileisfolder (fs, &flfolder);
- if ( fl ) {
-
- oserror ( errorParam ); // not the best error message, but...
-
- return ( false );
-
+ if (flfolder) {
+ oserror (errorParam); // not the best error message, but...
+ return (false);
}
- setfserrorparam ( fs );
+ setfserrorparam (fs);
- return ( ! oserror ( FSMoveObject ( &( *fs ).fsref, &( *fsto ).fsref, NULL ) ) );
+ if (oserror (macgetfsref (fs, &src)) || oserror (macgetfsref (fsto, &dst)))
+ return (false);
+ return (!oserror (FSMoveObject (&src, &dst, NULL)));
+
#endif
#ifdef WIN95VERSION
@@ -3277,18 +3212,22 @@
fixes bug when it's a path to a folder.
*/
+ FSRef fsref;
+ tyfsname name;
+
if (!surefile (fs)) /*file doesn't exist -- catch error*/
return (false);
+ if (oserror (macgetfsref (fs, &fsref)))
+ return (false);
+
filefrompath (bsnew, bsnew);
setoserrorparam (bsnew); /*only likely errors from here on relate to new name*/
-
- HFSUniStr255 name;
- bigstringToHFSUniStr255 ( bsnew, &name );
+ bigstringtofsname (bsnew, &name);
- if ( oserror ( FSRenameUnicode ( &fs -> fsref, name.length, name.unicode, kTextEncodingUnknown, NULL ) ) )
+ if (oserror (FSRenameUnicode (&fsref, name.length, name.unicode, kTextEncodingUnknown, NULL)))
return (false);
touchparentfolder (fs);
@@ -3333,20 +3272,25 @@
#ifdef MACVERSION
+ FSRef fsref;
FSCatalogInfo catinfo;
- OSErr err;
- clearbytes ( &catinfo, sizeof ( catinfo ) );
+ clearbytes (&catinfo, sizeof (catinfo));
- setfserrorparam ( fs ); // in case error message takes a filename parameter
+ setfserrorparam (fs); // in case error message takes a filename parameter
- err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNodeFlags, &catinfo, NULL, NULL, NULL );
+ if (oserror (macgetfsref (fs, &fsref)))
+ return (false);
+ if (oserror (FSGetCatalogInfo (&fsref, kFSCatInfoNodeFlags, &catinfo, NULL, NULL, NULL)))
+ return (false);
+
catinfo.nodeFlags |= kFSNodeLockedMask;
- err = FSSetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNodeFlags, &catinfo );
+ if (oserror (FSSetCatalogInfo (&fsref, kFSCatInfoNodeFlags, &catinfo)))
+ return (false);
- return ( ! oserror ( err ) );
+ return (true);
#endif
@@ -3383,20 +3327,25 @@
#ifdef MACVERSION
+ FSRef fsref;
FSCatalogInfo catinfo;
- OSErr err;
- clearbytes ( &catinfo, sizeof ( catinfo ) );
+ clearbytes (&catinfo, sizeof (catinfo));
- setfserrorparam ( fs ); // in case error message takes a filename parameter
+ setfserrorparam (fs); // in case error message takes a filename parameter
- err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNodeFlags, &catinfo, NULL, NULL, NULL );
+ if (oserror (macgetfsref (fs, &fsref)))
+ return (false);
+
+ if (oserror (FSGetCatalogInfo (&fsref, kFSCatInfoNodeFlags, &catinfo, NULL, NULL, NULL)))
+ return (false);
catinfo.nodeFlags &= ~kFSNodeLockedMask;
- err = FSSetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNodeFlags, &catinfo );
+ if (oserror (FSSetCatalogInfo (&fsref, kFSCatInfoNodeFlags, &catinfo)))
+ return (false);
- return ( ! oserror ( err ) );
+ return (true);
#endif
@@ -3434,18 +3383,14 @@
//
#ifdef MACVERSION
-
- HFSUniStr255 name;
- long dirid;
- setfserrorparam ( fs );
+ setfserrorparam (fs);
- if ( ! CFStringRefToHFSUniStr255 ( ( *fs ).path, &name ) )
- return ( false );
+ if (oserror (FSCreateDirectoryUnicode (&fs->ref, fs->name.length, fs->name.unicode, kFSCatInfoNone, NULL, NULL, NULL, NULL)))
+ return (false);
- return ( ! oserror ( FSCreateDirectoryUnicode ( &( *fs ).fsref, name.length, name.unicode, kFSCatInfoNone, NULL,
- NULL, NULL, &dirid ) ) );
-
+ return (true);
+
#endif
#ifdef WIN95VERSION
@@ -3465,30 +3410,20 @@
boolean newfile ( const ptrfilespec fs, OSType creator, OSType filetype ) {
//
+ // 2009-09-03 aradke: switched tyfilespec.name field from CFStringRef to HFSUniStr255
+ //
// 2007-08-01 creedon: if path is NULL oserror
- //
// set err to bdNamErr by default
//
// 2006-06-18 creedon: for Mac, FSRef-ized
//
#ifdef MACVERSION
-
- HFSUniStr255 name;
- OSErr err = bdNamErr;
- setfserrorparam ( fs );
+ setfserrorparam (fs);
+
+ return (!oserror (FSCreateFileUnicode (&fs->ref, fs->name.length, fs->name.unicode, kFSCatInfoNone, NULL, NULL, NULL)));
- if ( ( *fs ).path != NULL ) {
-
- CFStringRefToHFSUniStr255 ( ( *fs ).path, &name );
-
- err = FSCreateFileUnicode ( &( *fs ).fsref, name.length,
- name.unicode, kFSCatInfoNone, NULL, &( *fs ).fsref, NULL );
- }
-
- return ( ! oserror ( err ) );
-
#endif
#ifdef WIN95VERSION
@@ -3529,20 +3464,24 @@
//
tyfilespec fs;
+ FSRef fsref;
setoserrorparam (bspath); /*in case error message takes a filename parameter*/
- insertstring ( BIGSTRING ( "\x09" "/Volumes/" ), bspath );
+ insertstring (BIGSTRING ("\x09" "/Volumes/"), bspath);
- stringreplaceall ( ':', '/', bspath );
+ stringreplaceall (':', '/', bspath);
- convertpstring ( bspath );
+ convertpstring (bspath);
- if ( oserror ( FSPathMakeRef ( bspath, &fs.fsref, NULL ) ) )
- return ( false );
+ if (oserror (FSPathMakeRef (bspath, &fsref, NULL)))
+ return (false);
- return ( filespectopath ( &fs, bspath ) );
+ if (oserror (macmakefilespec (&fsref, &fs)))
+ return (false);
+ return (filespectopath (&fs, bspath));
+
} // getfullfilepath
@@ -3552,11 +3491,12 @@
// 2006-06-25 creedon: FSRef-ized
//
- OSErr err;
+ FSRef fsref;
- err = FSMakeFSRef (vnum, dirid, fname, &( *pfs ).fsref);
+ if (FSMakeFSRef (vnum, dirid, fname, &fsref) != noErr)
+ return (false);
- return ( ( err == noErr ) || ( err == fnfErr ) );
+ return (macmakefilespec (&fsref, pfs) == noErr);
} // filemakespec
@@ -3603,7 +3543,7 @@
} /*initfile*/
-boolean findapplication ( OSType creator, ptrfilespec fsapp ) {
+boolean findapplication (OSType creator, ptrfilespec fsapp) {
//
// 2007-06-12 creedon: for Mac, use getfilespecparent
@@ -3634,21 +3574,17 @@
//
#ifdef MACVERSION
+
+ FSRef fsref;
- OSStatus status;
+ if ((UInt32) LSFindApplicationForInfo == (UInt32) kUnresolvedCFragSymbolAddress)
+ return (false);
- if ( ( UInt32 ) LSFindApplicationForInfo == ( UInt32 ) kUnresolvedCFragSymbolAddress )
- return ( false );
-
- status = LSFindApplicationForInfo ( creator, NULL, NULL, &( *fsapp ).fsref, NULL);
+ if (LSFindApplicationForInfo (creator, NULL, NULL, &fsref, NULL) != noErr)
+ return (false);
- if ( status != noErr )
- return ( false );
-
- getfilespecparent ( fsapp );
+ return (macmakefilespec (&fsref, fsapp) == noErr);
- return ( true );
-
#endif // MACVERSION
#ifdef WIN95VERSION
@@ -3697,62 +3633,307 @@
} // findapplication
-boolean extendfilespec ( const ptrfilespec fsin, ptrfilespec fsout ) {
+void clearfilespec (ptrfilespec fs) {
- //
- // 2006-06-23 creedon: created
- //
+ /*
+ 2009-09-04 aradke: init to nil filespec
+ */
+
+ clearbytes (fs, sizeof (tyfilespec));
- #ifdef MACVERSION
+ } /*clearfilespec*/
+
+
+#ifdef MACVERSION
+
+ boolean macfilespecisvalid (const ptrfilespec fs) {
+
+ /*
+ 2009-09-06 aradke: check if fs data is valid (though file may not exist)
+ */
+
+ return (FSRefValid (&fs->ref) && (fsnamelength (&fs->name) > 0));
+
+ } /*macfilespecisvalid*/
- tyfilespec fst;
- clearbytes ( &fst, sizeof ( fst ) );
+ boolean macfilespecisresolvable (const ptrfilespec fs) {
+
+ FSRef fsref;
+
+ return (macgetfsref (fs, &fsref) == noErr);
+ } /*macfilespecisresolvable*/
- if ( ! FSRefValid ( &( *fsin ).fsref ) )
- return ( false );
+
+ OSErr macgetfsref (const ptrfilespec fs, FSRef* fsref) {
- if ( ( *fsin ).path == NULL )
- return ( false );
+ /*
+ 2009-09-05 aradke: obtain the actual FSRef corresponding to our extended filespec.
+ if the file does not exist, we return an error.
+ */
- HFSUniStr255 name;
+ if (!macfilespecisvalid (fs))
+ return (fnfErr);
+
+ if (fs->flags.flvolume) {
+
+ *fsref = fs->ref;
+
+ return (noErr);
+ }
+
+ return (FSMakeFSRefUnicode (&fs->ref, fs->name.length, fs->name.unicode, kTextEncodingUnknown, fsref));
+ } /*macgetfsref*/
+
+
+ OSErr macmakefilespec (const FSRef *fsrefptr, ptrfilespec fs) {
+
+ /*
+ 2009-09-06 aradke: obtain the filespec corresponding to the fsref.
+ */
+
+ FSRef fsref = *fsrefptr; // local copy in case fsrefptr points to fs->ref
+ FSCatalogInfo catalogInfo;
OSErr err;
- CFStringRefToHFSUniStr255 ( ( *fsin ).path, &name );
+ clearfilespec (fs);
- err = FSMakeFSRefUnicode ( &( *fsin ).fsref, name.length, name.unicode, kTextEncodingUnknown, &fst.fsref ); // kTextEncodingUnicodeDefault
+ clearbytes (&catalogInfo, longsizeof(catalogInfo));
+
+ err = FSGetCatalogInfo (&fsref, kFSCatInfoGettableInfo, &catalogInfo, NULL, NULL, NULL);
- if ( err != noErr )
- return ( false );
+ if (err != noErr)
+ return (err);
- *fsout = fst;
+ if (catalogInfo.parentDirID == fsRtParID) {
- #endif // MACVERSION
+ fs->flags.flvolume = true;
+
+ fs->ref = fsref;
+
+ return (FSGetCatalogInfo (&fsref, kFSCatInfoNone, NULL, &fs->name, NULL, NULL));
+ }
+
+ return (FSGetCatalogInfo (&fsref, kFSCatInfoNone, NULL, &fs->name, NULL, &fs->ref));
+ } /*macmakefilespec*/
- return ( true );
- } // extendfilespec
+ OSErr macgetfsspec (const ptrfilespec fs, FSSpec *fss) {
+
+ /*
+ 2009-09-06 aradke: get an old-style FSSpec corresponding to our filespec.
+ FSSpecs are seriously deprecated ...
[truncated message content] |
|
From: <and...@us...> - 2009-08-30 19:58:58
|
Revision: 1826
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1826&view=rev
Author: andreradke
Date: 2009-08-30 19:58:42 +0000 (Sun, 30 Aug 2009)
Log Message:
-----------
In file.folderFromPath, don't fail silently if an nil filespec is passed in. Also don't accept a string containing just a non-existing volume name in filespec() coercion, restoring previous behaviour.
Modified Paths:
--------------
Frontier/trunk/Common/headers/strings.h
Frontier/trunk/Common/source/fileops.c
Frontier/trunk/Common/source/filepath.c
Frontier/trunk/Common/source/strings.c
Modified: Frontier/trunk/Common/headers/strings.h
===================================================================
--- Frontier/trunk/Common/headers/strings.h 2009-08-30 13:02:40 UTC (rev 1825)
+++ Frontier/trunk/Common/headers/strings.h 2009-08-30 19:58:42 UTC (rev 1826)
@@ -106,6 +106,8 @@
extern boolean stringreplaceall (char, char, bigstring);
+extern boolean stringswapall (char, char, bigstring);
+
extern boolean textlastword (ptrbyte, long, byte, bigstring);
extern boolean textfirstword (ptrbyte, long, byte, bigstring);
Modified: Frontier/trunk/Common/source/fileops.c
===================================================================
--- Frontier/trunk/Common/source/fileops.c 2009-08-30 13:02:40 UTC (rev 1825)
+++ Frontier/trunk/Common/source/fileops.c 2009-08-30 19:58:42 UTC (rev 1826)
@@ -3072,23 +3072,30 @@
boolean getfileparentfolder ( const ptrfilespec fs, ptrfilespec fsparent ) {
+ // 2009-08-30 aradke: handle null filespecs. don't fail silently if an error occurs.
//
// 2006-08-24 creedon: FSRef-ized
- //
- // this function used to use oserror but I don't think oserror can handle osstatus properly
+ HFSUniStr255 name;
+ OSErr err;
- HFSUniStr255 name;
- OSErr err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fsparent ).fsref );
+ if ( !FSRefValid ( &(*fs).fsref ) ) {
+
+ clearbytes ( fsparent, sizeof(tyfilespec) );
+
+ return ( true );
+ }
+
+ err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fsparent ).fsref );
- if ( err != noErr )
+ if ( oserror(err) )
return ( false );
if ( ( *fs ).path == NULL ) {
err = FSGetCatalogInfo ( &( *fsparent ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fsparent ).fsref );
- if ( err != noErr )
+ if ( oserror(err) )
return ( false );
}
Modified: Frontier/trunk/Common/source/filepath.c
===================================================================
--- Frontier/trunk/Common/source/filepath.c 2009-08-30 13:02:40 UTC (rev 1825)
+++ Frontier/trunk/Common/source/filepath.c 2009-08-30 19:58:42 UTC (rev 1826)
@@ -67,7 +67,7 @@
FSRef volumesfsref;
OSErr err;
- status = FSPathMakeRef ( "/Volumes", &volumesfsref, NULL );
+ status = FSPathMakeRef ( (UInt8*) "/Volumes", &volumesfsref, NULL );
err = FSCompareFSRefs ( &( *fs ).fsref , &volumesfsref );
@@ -267,8 +267,45 @@
} // filespectopath
+#ifdef MACVERSION
+
+static OSStatus pathtofsref ( bigstring bspath, FSRef *ref ) {
+
+ /*
+ 2009-08-30 aradke: mac-only helper function for pathtofilespec for converting from a pascal string (path) to an FSRef
+ */
+
+ bigstring bs;
+ CFStringRef csref;
+ char str[256];
+
+ copystring(bspath, bs);
+
+ // convert from colon-delimited to slash-delimited path
+
+ stringswapall(':', '/', bs);
+
+ // convert from Mac Roman to UTF-8 */
+
+ csref = CFStringCreateWithPascalString(kCFAllocatorDefault, bs, kCFStringEncodingMacRoman);
+
+ CFStringGetCString(csref, str, sizeof(str), kCFStringEncodingUTF8);
+
+ CFRelease(csref);
+
+ // finally, pass our temporary copy of the string to the underlying system function
+
+ return FSPathMakeRef((UInt8*) str, ref, NULL);
+ } /*pathtofsref*/
+
+#endif
+
+
boolean pathtofilespec ( bigstring bspath, ptrfilespec fs ) {
+ // 2009-08-30 aradke: refactored mac version to make it easier to understand.
+ // fixed bug where a bspath containing a non-existing volume name was accepted as valid,
+ // e.g. filespec("foobar:"), thus deviating from previous behaviour.
//
// 2006-10-16 creedon: for Mac, FSRef-ized
//
@@ -287,239 +324,96 @@
// non-existant files, we don't give up right away.
//
- bigstring bsfolder;
+ #ifdef MACVERSION
+ FSRef fsr;
+ HFSUniStr255 name;
+ OSErr err;
+ bigstring bspathtmp, bsfullpath, bsfile, bsfolder;
+ short ix = 1;
+ boolean flvolume = false;
+ #endif
+ #ifdef WIN95VERSION
+ bigstring bsfolder;
+ #endif
+
clearbytes ( fs, sizeof ( *fs ) );
if ( isemptystring ( bspath ) )
return ( true );
#ifdef MACVERSION
+
+ // create cleaned-up full path representation of our input suitable for pathtosref
- FSRef fsr;
- HFSUniStr255 name;
- OSErr err;
- OSStatus status;
- bigstring bs, bspathtmp;
- short ix = 1, ixslashpos = 0, slashpos [ 255 ];
-
copystring ( bspath, bspathtmp );
cleanendoffilename ( bspathtmp );
- if ( scanstring ( ':', bspath, &ix ) && ( ix > 1 ) ) { // full path, includes a colon, not the first character
+ if ( scanstring ( ':', bspath, &ix ) && ( ix > 1 ) ) {
- bigstring bsfile, bsfullpath;
+ // contains a colon but doesn't start with one, so it must be a full path
+
+ if ( ix == stringlength ( bspath ) ) // the colon we found is the last char, so bspath is a volume name
+ flvolume = true;
- copystring ( bspathtmp, bsfullpath );
+ copystring ( BIGSTRING ( "\x09" ":Volumes:" ), bsfullpath ); // FIXME: what if bspath was just a non-existing volume name like "foo:" ???
- insertstring ( BIGSTRING ( "\x09" ":Volumes:" ), bsfullpath );
+ pushstring ( bspathtmp, bsfullpath );
+ }
- copystring ( bsfullpath, bs );
-
- /* convert to / delimited path */ {
+ else {
+
+ // it's a partial path, prefix with default directory (see initfsdefault)
+
+ tyfilespec fst;
+ OSStatus status;
- while ( scanstring ( '/', bs, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
-
- stringreplaceall ( ':', '/', bs );
-
- while ( ixslashpos > 0 )
- setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, ':' );
- }
+ ( void ) extendfilespec ( &fsdefault, &fst );
- /* convert from Mac Roman to UTF-8 */ {
+ status = FSRefMakePath ( &fst.fsref, ( UInt8 * ) bsfullpath, sizeof(bsfullpath) ); // bsfullpath is now a c string
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bs,
- kCFStringEncodingMacRoman );
+ convertcstring ( bsfullpath ); // bsfullpath is now a bigstring
+
+ stringswapall ( '/', ':', bsfullpath ); // convert to colon-delimited path
- CFStringGetCString ( csr, ( char * ) bs, sizeof ( bs ), kCFStringEncodingUTF8 );
-
- CFRelease ( csr );
+ if ( bspathtmp [ 1 ] != chpathseparator ) // append path separator if partial path doesn't begin with one
+ pushchar ( chpathseparator, bsfullpath );
+
+ pushstring ( bspathtmp, bsfullpath ); // finally append partial path
+ }
- }
+ // now see if the full path resolves
- status = FSPathMakeRef ( bs, &fsr, NULL );
+ if ( pathtofsref ( bsfullpath, &fsr ) == noErr ) {
+
+ err = FSGetCatalogInfo ( &fsr, kFSCatInfoNone, NULL, &name, NULL, &fsr );
- if ( status == noErr ) {
+ ( *fs ).fsref = fsr;
- err = FSGetCatalogInfo ( &fsr, kFSCatInfoNone, NULL, &name, NULL, &fsr );
-
- ( *fs ).fsref = fsr;
-
- ( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
-
- return ( true );
-
- } // if
+ ( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
+
+ return ( true );
+ }
+ // full path did not resolve but we actually only require the parent folder to exist
+
+ if ( ! flvolume ) { // volumes don't have a parent folder
+
filefrompath ( bsfullpath, bsfile );
folderfrompath ( bsfullpath, bsfolder );
-
- /* convert to / delimited path */ {
-
- ix = 1;
- ixslashpos = 0;
-
- while ( scanstring ( '/', bsfolder, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
-
- stringreplaceall ( ':', '/', bsfolder );
-
- while ( ixslashpos > 0 )
- setstringcharacter ( bsfolder, slashpos [ --ixslashpos ] - 1, ':' );
- }
-
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfolder,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bsfolder, sizeof ( bsfolder ), kCFStringEncodingUTF8 );
-
- CFRelease ( csr );
-
- }
-
- status = FSPathMakeRef ( bsfolder, &fsr, NULL );
- if ( status == noErr ) {
+ if ( pathtofsref ( bsfolder, &fsr ) == noErr ) {
( *fs ).fsref = fsr;
- ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile,
- kCFStringEncodingMacRoman );
+ ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile, kCFStringEncodingMacRoman );
return ( true );
-
- } // if
-
- } // end full path
-
- else { // partial path
-
- bigstring bspartialpath;
- tyfilespec fst;
-
- copystring ( bspathtmp, bspartialpath );
-
- if ( bspartialpath [ 1 ] != chpathseparator )
- insertchar ( chpathseparator, bspartialpath );
-
- ( void ) extendfilespec ( &fsdefault, &fst );
-
- status = FSRefMakePath ( &fst.fsref, ( UInt8 * ) bs, 256 ); // bs is now a c string
-
- convertcstring ( bs ); // bs is now a bigstring
-
- /* convert bs to colon delimited path */ {
-
- ix = 1;
- ixslashpos = 0;
-
- while ( scanstring ( ':', bs, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
-
- stringreplaceall ( '/', ':', bs );
-
- while ( ixslashpos > 0 )
- setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, '/' );
}
-
- insertstring ( bs, bspartialpath ); // we now have a full path
-
- copystring ( bspartialpath, bs );
-
- /* convert bs to / delimited path */ {
-
- ix = 1;
- ixslashpos = 0;
-
- while ( scanstring ( '/', bs, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
-
- stringreplaceall ( ':', '/', bs );
-
- while ( ixslashpos > 0 )
- setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, ':' );
- }
-
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfolder,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bsfolder, sizeof ( bsfolder ), kCFStringEncodingUTF8 );
-
- CFRelease ( csr );
+ }
- }
-
- status = FSPathMakeRef ( bs, &fsr, NULL );
-
- if ( status == noErr ) {
-
- err = FSGetCatalogInfo ( &fsr, kFSCatInfoNone, NULL, &name, NULL, &fsr );
-
- ( *fs ).fsref = fsr;
-
- ( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
-
- return ( true );
-
- } // if
-
- /* try parent of path */ {
-
- bigstring bsfile;
-
- filefrompath ( bspartialpath, bsfile );
-
- folderfrompath ( bspartialpath, bsfolder );
-
- /* convert to slash delimited path */ {
-
- ix = 1;
- ixslashpos = 0;
-
- while ( scanstring ( '/', bsfolder, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
-
- stringreplaceall ( ':', '/', bsfolder );
-
- while ( ixslashpos > 0 )
- setstringcharacter ( bsfolder, slashpos [ --ixslashpos ] - 1, ':' );
- }
-
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfolder,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bsfolder, sizeof ( bsfolder ), kCFStringEncodingUTF8 );
-
- CFRelease ( csr );
-
- }
-
- status = FSPathMakeRef ( bsfolder, &fsr, NULL );
-
- if ( status == noErr ) {
-
- ( *fs ).fsref = fsr;
-
- ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile,
- kCFStringEncodingMacRoman );
-
- return ( true );
-
- } // if
-
- } // end try parent of path
-
- } // end partial path
-
return ( false );
#endif
Modified: Frontier/trunk/Common/source/strings.c
===================================================================
--- Frontier/trunk/Common/source/strings.c 2009-08-30 13:02:40 UTC (rev 1825)
+++ Frontier/trunk/Common/source/strings.c 2009-08-30 19:58:42 UTC (rev 1826)
@@ -687,6 +687,30 @@
} /*stringreplaceall*/
+boolean stringswapall (char ch1, char ch2, bigstring bs) {
+
+ /*
+ 2009-08-30 aradke: replace all instances of ch1 with ch2 and vice versa, useful for converting posix file paths
+ */
+
+ int ct = stringlength(bs);
+ unsigned char* p = stringbaseaddress(bs);
+
+ while (ct > 0) {
+
+ if (*p == ch1)
+ *p = ch2;
+ else if (*p == ch2)
+ *p = ch1;
+
+ p++;
+ ct--;
+ }
+
+ return (true);
+ } /*stringswapall*/
+
+
boolean textlastword (ptrbyte ptext, long len, byte chdelim, bigstring bsdest) {
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-08-30 13:02:56
|
Revision: 1825
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1825&view=rev
Author: andreradke
Date: 2009-08-30 13:02:40 +0000 (Sun, 30 Aug 2009)
Log Message:
-----------
Updated svn:ignore property on build_Xcode folder for newer Xcode versions
Property Changed:
----------------
Frontier/trunk/build_Xcode/
Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/
Frontier/trunk/build_Xcode/Frontier.xcodeproj/
Property changes on: Frontier/trunk/build_Xcode
___________________________________________________________________
Added: svn:ignore
+ build
Property changes on: Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj
___________________________________________________________________
Modified: svn:ignore
- *.mode1
*.pbxuser
+ *.mode1
*.mode1v?
*.pbxuser
Property changes on: Frontier/trunk/build_Xcode/Frontier.xcodeproj
___________________________________________________________________
Modified: svn:ignore
- *.mode1
*.pbxuser
+ *.mode1
*.mode1v?
*.pbxuser
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-08-30 12:44:09
|
Revision: 1824
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1824&view=rev
Author: andreradke
Date: 2009-08-30 12:43:57 +0000 (Sun, 30 Aug 2009)
Log Message:
-----------
Fixed typo in initial shell script build-phase that produced a spurious file-not-found error about libpaigemacho.a when building the OPML target.
Modified Paths:
--------------
Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj
Modified: Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj
===================================================================
--- Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj 2009-05-31 20:11:05 UTC (rev 1823)
+++ Frontier/trunk/build_Xcode/Frontier Universal Binary.xcodeproj/project.pbxproj 2009-08-30 12:43:57 UTC (rev 1824)
@@ -1161,7 +1161,7 @@
5D8F1EF30C25B51A00927B97 /* langmysql.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = langmysql.c; path = ../Common/source/langmysql.c; sourceTree = SOURCE_ROOT; };
5D8F1EF60C25B56600927B97 /* langmysql.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = langmysql.h; path = ../Common/headers/langmysql.h; sourceTree = SOURCE_ROOT; };
5DCA3B0B0AF552C700D6155D /* libpaigefat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpaigefat.a; path = tools/libpaigefat.a; sourceTree = SOURCE_ROOT; };
- 65059B4E09968C1400410571 /* OPML.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = OPML.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 65059B4E09968C1400410571 /* OPML.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OPML.app; sourceTree = BUILT_PRODUCTS_DIR; };
65059B760996945100410571 /* OPML.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = OPML.icns; path = ../resources/OPML/OPML.icns; sourceTree = SOURCE_ROOT; };
65059B770996945100410571 /* OPMLdoc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = OPMLdoc.icns; path = ../resources/OPML/OPMLdoc.icns; sourceTree = SOURCE_ROOT; };
65059B800996958700410571 /* BNDL.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = BNDL.r; path = ../resources/OPML/BNDL.r; sourceTree = SOURCE_ROOT; };
@@ -3173,10 +3173,12 @@
65152560072BFC6500411831 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 5D4E1D460AAA0B1400DF6890 /* Build configuration list for PBXProject "Frontier Universal Binary" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 6515255C072BFC6500411831;
productRefGroup = 6515255C072BFC6500411831;
projectDirPath = "";
+ projectRoot = ..;
targets = (
65152568072BFC6500411831 /* Frontier */,
6505996209968C1400410571 /* OPML */,
@@ -3307,7 +3309,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#set -x\ncp -f \"${SRCROOT}/../Common/Paige/libpaigefat.a\" \"${SRCROOT}/tools/libpaigefat.a\"\nranlib \"${SRCROOT}/tools/libpaigemacho.a\"";
+ shellScript = "#set -x\ncp -f \"${SRCROOT}/../Common/Paige/libpaigefat.a\" \"${SRCROOT}/tools/libpaigefat.a\"\nranlib \"${SRCROOT}/tools/libpaigefat.a\"";
};
DEA58A9E074359BA00BAB271 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <set...@us...> - 2009-05-31 20:11:08
|
Revision: 1823
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1823&view=rev
Author: sethdill
Date: 2009-05-31 20:11:05 +0000 (Sun, 31 May 2009)
Log Message:
-----------
bumped Conversant's version number
Modified Paths:
--------------
Frontier/branches/Conversant/Common/headers/versions.h
Modified: Frontier/branches/Conversant/Common/headers/versions.h
===================================================================
--- Frontier/branches/Conversant/Common/headers/versions.h 2009-05-31 19:30:12 UTC (rev 1822)
+++ Frontier/branches/Conversant/Common/headers/versions.h 2009-05-31 20:11:05 UTC (rev 1823)
@@ -124,7 +124,7 @@
#define APP_REVISION_LEVEL 15 /* for non-final releases only */
#define APP_BUILD_NUMBER 15 /* increment by one for every release, final or not */
- #define APP_VERSION_STRING "10.1a15c3"
+ #define APP_VERSION_STRING "10.1a15c5"
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <set...@us...> - 2009-05-31 19:30:21
|
Revision: 1822
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1822&view=rev
Author: sethdill
Date: 2009-05-31 19:30:12 +0000 (Sun, 31 May 2009)
Log Message:
-----------
Added a missing date function which was throwing everything off.
Modified Paths:
--------------
Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc
Modified: Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc
===================================================================
--- Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc 2009-05-29 22:26:19 UTC (rev 1821)
+++ Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc 2009-05-31 19:30:12 UTC (rev 1822)
@@ -313,7 +313,7 @@
"date\0",
false,
- 30,
+ 31,
"get\0",
"set\0",
"abbrevstring\0",
@@ -344,6 +344,7 @@
"hour\0",
"minute\0",
"seconds\0",
+ "format\0",
"dialog\0",
true,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <set...@us...> - 2009-05-29 22:26:26
|
Revision: 1821
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1821&view=rev
Author: sethdill
Date: 2009-05-29 22:26:19 +0000 (Fri, 29 May 2009)
Log Message:
-----------
Fixed some bugs with the kernelverbs.rc file.
Modified Paths:
--------------
Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc
Modified: Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc
===================================================================
--- Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc 2009-05-29 22:11:13 UTC (rev 1820)
+++ Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc 2009-05-29 22:26:19 UTC (rev 1821)
@@ -668,7 +668,8 @@
"readwholefile\0", /* 2006-04-11 aradke */
"getLabelIndex\0", /* 2006-04-23 creedon */
"setLabelIndex\0", /* 2006-04-23 creedon */
- "getLabelNames" /* 2006-04-23 creedon */
+ "getLabelNames\0", // 2006-04-23 creedon
+ "getPosixPath\0" // 2006-10-07 creedon
END
1008 /*idrezverbs*/ EFP DISCARDABLE
@@ -700,7 +701,7 @@
1, // Number of "blocks" in this resource
"window\0", // Function Processor Name
true, // Window required
- 30, // Count of verbs
+ 31, // Count of verbs
"isopen\0",
"open\0",
"isfront\0",
@@ -731,6 +732,7 @@
"about\0",
"getfile\0",
"isreadonly\0",
+ "setquickscript\0" // 2007-07-27 creedon
END
@@ -1064,7 +1066,7 @@
"sqrt\0"
END
-1025 /* cryptverbs */ EFP DISCARDABLE
+1025 /* cryptverbs */ EFP DISCARDABLE // 2006-03-07 creedon: crypt verbs
BEGIN
1, // Number of "blocks" in this resource
"crypt\0", // Function Processor name
@@ -1074,7 +1076,70 @@
"hmacMD5\0",
"MD5\0",
"SHA1\0",
- "hmacSHA1\0",
+ "hmacSHA1\0"
END
+
+1026 /* sqliteverbs */ EFP DISCARDABLE
+ BEGIN
+ 1, // Number of "blocks" in this resource
+ "sqlite\0", // Function Processor name
+ false, // Window required
+ 17, // Count of verbs
+ "open\0",
+ "compileQuery\0",
+ "clearQuery\0",
+ "resetQuery\0",
+ "stepQuery\0",
+ "getColumnCount\0",
+ "getColumnType\0",
+ "getColumnInt\0",
+ "getColumnDouble\0",
+ "getColumnText\0",
+ "getColumnName\0",
+ "getColumn\0",
+ "getRow\0",
+ "getErrorMessage\0",
+ "close\0",
+ "setColumnBlob\0", // 2007-08-25 creedon
+ "getLastInsertRowId\0" // 2007-08-28 creedon
+ END
+
+
+1027 /* mysqlverbs */ EFP DISCARDABLE
+ BEGIN
+ 1, // Number of "blocks" in this resource
+ "mysql\0", // Function Processor name
+ false, // Window required
+ 27, // Count of verbs
+ "init\0",
+ "end\0",
+ "connect\0",
+ "compileQuery\0",
+ "clearQuery\0",
+ "getRow\0",
+ "getErrorNumber\0",
+ "getErrorMessage\0",
+ "getClientInfo\0",
+ "getClientVersion\0",
+ "getHostInfo\0",
+ "getServerVersion\0",
+ "getProtocolInfo\0",
+ "getServerInfo\0",
+ "getQueryInfo\0",
+ "getAffectedRowCount\0",
+ "getSelectedRowCount\0",
+ "getColumnCount\0",
+ "getServerStatus\0",
+ "getQueryWarningCount\0",
+ "pingServer\0",
+ "seekRow\0",
+ "selectDatabase\0",
+ "getSQLSTATE\0",
+ "escapeString\0",
+ "isThreadSafe\0",
+ "close\0"
+ END
+
+
#include "conversantverbs.rc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <set...@us...> - 2009-05-29 22:11:23
|
Revision: 1820
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1820&view=rev
Author: sethdill
Date: 2009-05-29 22:11:13 +0000 (Fri, 29 May 2009)
Log Message:
-----------
Fixed the id number of the Conversant verbs, and added a new verb.
Modified Paths:
--------------
Frontier/branches/Conversant/Common/resources/Win32/conversantverbs.rc
Modified: Frontier/branches/Conversant/Common/resources/Win32/conversantverbs.rc
===================================================================
--- Frontier/branches/Conversant/Common/resources/Win32/conversantverbs.rc 2009-05-29 21:17:04 UTC (rev 1819)
+++ Frontier/branches/Conversant/Common/resources/Win32/conversantverbs.rc 2009-05-29 22:11:13 UTC (rev 1820)
@@ -21,11 +21,12 @@
******************************************************************************/
-1026 /*conversantverbs*/ EFP DISCARDABLE
+1028 /*conversantverbs*/ EFP DISCARDABLE
BEGIN
1, //Number of "blocks" in this resource
"conv\0", //Function Processor name
false, //Window required
- 1, //Count of verbs
- "compilestring\0"
+ 2, //Count of verbs
+ "compilestring\0",
+ "tabletostring\0"
END
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <set...@us...> - 2009-05-29 21:17:15
|
Revision: 1819
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1819&view=rev
Author: sethdill
Date: 2009-05-29 21:17:04 +0000 (Fri, 29 May 2009)
Log Message:
-----------
Removed the .ncb and .suo files because Andre says they're developer-specific. Removed the Frontier.sln (solution) file and replaced it with Frontier-Conversant.sln
Added Paths:
-----------
Frontier/branches/Conversant/build_VC2K8/Frontier-Conversant.sln
Removed Paths:
-------------
Frontier/branches/Conversant/build_VC2K8/Frontier.ncb
Frontier/branches/Conversant/build_VC2K8/Frontier.sln
Frontier/branches/Conversant/build_VC2K8/Frontier.suo
Added: Frontier/branches/Conversant/build_VC2K8/Frontier-Conversant.sln
===================================================================
--- Frontier/branches/Conversant/build_VC2K8/Frontier-Conversant.sln (rev 0)
+++ Frontier/branches/Conversant/build_VC2K8/Frontier-Conversant.sln 2009-05-29 21:17:04 UTC (rev 1819)
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Frontier", "Frontier.vcproj", "{D834EFC1-8805-4046-9A49-F9925A0808EF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ DbTracker|Win32 = DbTracker|Win32
+ Debug|Win32 = Debug|Win32
+ MemTracker|Win32 = MemTracker|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.DbTracker|Win32.ActiveCfg = DbTracker|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.DbTracker|Win32.Build.0 = DbTracker|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.Debug|Win32.Build.0 = Debug|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.MemTracker|Win32.ActiveCfg = MemTracker|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.MemTracker|Win32.Build.0 = MemTracker|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.Release|Win32.ActiveCfg = Release|Win32
+ {D834EFC1-8805-4046-9A49-F9925A0808EF}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Property changes on: Frontier/branches/Conversant/build_VC2K8/Frontier-Conversant.sln
___________________________________________________________________
Added: svn:executable
+ *
Deleted: Frontier/branches/Conversant/build_VC2K8/Frontier.ncb
===================================================================
(Binary files differ)
Deleted: Frontier/branches/Conversant/build_VC2K8/Frontier.sln
===================================================================
--- Frontier/branches/Conversant/build_VC2K8/Frontier.sln 2009-05-29 19:42:26 UTC (rev 1818)
+++ Frontier/branches/Conversant/build_VC2K8/Frontier.sln 2009-05-29 21:17:04 UTC (rev 1819)
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Frontier", "Frontier.vcproj", "{D834EFC1-8805-4046-9A49-F9925A0808EF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- DbTracker|Win32 = DbTracker|Win32
- Debug|Win32 = Debug|Win32
- MemTracker|Win32 = MemTracker|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.DbTracker|Win32.ActiveCfg = DbTracker|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.DbTracker|Win32.Build.0 = DbTracker|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.Debug|Win32.ActiveCfg = Debug|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.Debug|Win32.Build.0 = Debug|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.MemTracker|Win32.ActiveCfg = MemTracker|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.MemTracker|Win32.Build.0 = MemTracker|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.Release|Win32.ActiveCfg = Release|Win32
- {D834EFC1-8805-4046-9A49-F9925A0808EF}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
Deleted: Frontier/branches/Conversant/build_VC2K8/Frontier.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <set...@us...> - 2009-05-29 19:42:34
|
Revision: 1818
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1818&view=rev
Author: sethdill
Date: 2009-05-29 19:42:26 +0000 (Fri, 29 May 2009)
Log Message:
-----------
Changed the mime type to text/xml.
Modified Paths:
--------------
Frontier/branches/Conversant/build_VC2K5/Frontier.vcproj
Property Changed:
----------------
Frontier/branches/Conversant/build_VC2K5/Frontier.vcproj
Modified: Frontier/branches/Conversant/build_VC2K5/Frontier.vcproj
===================================================================
(Binary files differ)
Property changes on: Frontier/branches/Conversant/build_VC2K5/Frontier.vcproj
___________________________________________________________________
Modified: svn:mime-type
- application/octet-stream
+ text/xml
Deleted: svn:keywords
- Author Date Id Revision
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|