Changes required to build and debug with CodeWarrior Pro 7.2 and Universal Headers 3.4.1. r=wtc
authorsfraser%netscape.com
Wed, 27 Mar 2002 04:17:20 +0000
changeset 2309 db693ec11be437454b95fa8eb72c76285badd299
parent 2307 879ed5860b962cff737d1f24f6e0ec770a2e20cd
child 2310 cd113ec369ea58fd0228d16fede3c368b2568ed8
push idunknown
push userunknown
push dateunknown
reviewerswtc
Changes required to build and debug with CodeWarrior Pro 7.2 and Universal Headers 3.4.1. r=wtc
pr/src/md/mac/macdll.c
pr/src/md/mac/macsocket.h
pr/src/md/mac/macsockotpt.c
--- a/pr/src/md/mac/macdll.c
+++ b/pr/src/md/mac/macdll.c
@@ -499,25 +499,36 @@ done:
 	Load the named fragment from the specified file. Aliases must
 	have been resolved by this point.
 
 -----------------------------------------------------------------*/
 
 OSErr NSLoadNamedFragment(const FSSpec *fileSpec, const char* fragmentName, CFragConnectionID *outConnectionID)
 {
 	UInt32		fragOffset, fragLength;
+    short       fragNameLength;
 	Ptr				main;
-	Str255		fragName = "\p";
+    Str255      fragName;
 	Str255		errName;
 	OSErr			err;
 	
 	err = GetNamedFragmentOffsets(fileSpec, fragmentName, &fragOffset, &fragLength);
 	if (err != noErr) return err;
 				
-	err = GetDiskFragment(fileSpec, fragOffset, fragLength, fileSpec->name, 
+    // convert fragment name to pascal string
+    fragNameLength = strlen(fragmentName);
+    if (fragNameLength > 255)
+        fragNameLength = 255;
+    BlockMoveData(fragmentName, &fragName[1], fragNameLength);
+    fragName[0] = fragNameLength;
+    
+    // Note that we pass the fragment name as the 4th param to GetDiskFragment.
+    // This value affects the ability of debuggers, and the Talkback system,
+    // to match code fragments with symbol files
+    err = GetDiskFragment(fileSpec, fragOffset, fragLength, fragName, 
 					kLoadCFrag, outConnectionID, &main, errName);
 
 	return err;
 }
 
 
 /*-----------------------------------------------------------------
 
@@ -550,17 +561,20 @@ OSErr NSLoadIndexedFragment(const FSSpec
 	{
 		UInt32 nameLen = strlen(fragNameBlock);
 		if (nameLen > 63)
 			nameLen = 63;
 		BlockMoveData(fragNameBlock, &fragName[1], nameLen);
 		fragName[0] = nameLen;
 	}
 
-	err = GetDiskFragment(fileSpec, fragOffset, fragLength, fileSpec->name, 
+    // Note that we pass the fragment name as the 4th param to GetDiskFragment.
+    // This value affects the ability of debuggers, and the Talkback system,
+    // to match code fragments with symbol files
+    err = GetDiskFragment(fileSpec, fragOffset, fragLength, fragName, 
 					kLoadCFrag, outConnectionID, &main, errName);
 	if (err != noErr)
 	{
 		free(fragNameBlock);
 		return err;
 	}
 
 	*outFragName = fragNameBlock;
--- a/pr/src/md/mac/macsocket.h
+++ b/pr/src/md/mac/macsocket.h
@@ -34,16 +34,17 @@
 
 #ifndef macksocket_h___
 #define macksocket_h___
 
 // macsock.h
 // Interface visible to xp code
 // C socket type definitions and routines
 // from sys/socket.h
+#include <Files.h>
 #include <OpenTptInternet.h>	// All the internet typedefs
 #include <utime.h>				// For timeval
 /*
  * sleep and delay conflict with the same in unistd.h from Metrowerks.  OT
  * defines them as 
  *
  *    extern pascal void		OTDelay(UInt32 seconds);
  *    extern pascal void		OTIdle(void);
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -33,16 +33,17 @@
  */
 
 /* This turns on UNIX style errors in OT 1.1 headers */
 #define OTUNIXERRORS 1
 
 #include <string.h>
 
 #include <Gestalt.h>
+#include <Files.h>
 #include <OpenTransport.h>
 #include <OSUtils.h>
 
 #define GESTALT_OPEN_TPT_PRESENT        gestaltOpenTptPresentMask
 #define GESTALT_OPEN_TPT_TCP_PRESENT    gestaltOpenTptTCPPresentMask
 
 #include <OpenTptInternet.h>    // All the internet typedefs