Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

odb_event: encode 32-bit integer (OSType) as cons with two integers

to preserve high bits on 32bit builds.

Revert "ODB support: store remote-id as string".
The string based method failed for some `remote-id' values (signed?),
as coming from nvALT.

This reverts commit 524141c.
  • Loading branch information...
commit ddd95ec4c27886d9be03f493306a93b66bc5cae7 1 parent 4247f28
@davidswelt authored
Showing with 27 additions and 20 deletions.
  1. +2 −4 aquamacs/doc/latex/changelog.tex
  2. +15 −4 src/nsfns.m
  3. +10 −12 src/nsterm.m
View
6 aquamacs/doc/latex/changelog.tex
@@ -24,6 +24,8 @@ \subsection{Changes--- 2.4}
\item When deleting several words in a row (killing them to append them to the kill ring), they are no longer added as run-in words in smart spacing mode. Spaces are addes where appropriate.
\item When expanding the load path (e.g., for library files) in directories such as Library/Application~Support/Aquamacs~Emacs, a file called {.nosearch} now prevents Aquamacs from adding the present and subordinate directories. (The previous {\tt .ignore} file only worked at the topmost level.}
Reported by Nathaniel Cunningham.
+\item Fixed issue that could lead to a crash when using Aquamacs as an editor (ODB standard) from certain other applications.
+Reported by Kevin Kirkup.
\end{itemize}
@@ -36,10 +38,6 @@ \subsection{Changes--- 2.3}
Reported by Konrad Podczeck.
\item Fix insertion of the Euro sign with Option-e under emulate-mac-*-keyboard-mode.
Reported by Viktor Rosenfeld.
-\item Fix an issue where the selecting another frame by mouse click after selecting a region of text by mouse failed to switch the menu over to the different buffer.
-Patch by Konrad Podczeck and Chong Yidong.
-\item Correct ODB support for external editors (``Error during notification'').
-Reported by Alan Schmitt, Don Morrison, et al.
\item Updated ESS (Emacs Speaks Statistics) to version 5.13.
\end{itemize}
View
19 src/nsfns.m
@@ -2709,6 +2709,7 @@ OSStatus odb_event (struct buffer *buffer,
Lisp_Object Qremote_token_type = intern("remote-token-type");
Lisp_Object remote_id, remote_token_data, remote_token_type;
+ OSType rid;
remote_id = Fcdr (Fassq (Qremote_id, parms));
remote_token_data = Fcdr (Fassq (Qremote_token_data, parms));
@@ -2716,13 +2717,17 @@ OSStatus odb_event (struct buffer *buffer,
if (NILP (remote_id))
return -1000;
- CHECK_STRING (remote_id);
+
+ if (Fcdr (remote_id))
+ rid = (XUINT (Fcar (remote_id)) << 16) | XUINT (Fcdr (remote_id));
+ else
+ rid = XUINT (remote_id);
/* Destination Process */
NSAppleEventDescriptor *targetDesc = [NSAppleEventDescriptor
descriptorWithDescriptorType:typeApplSignature
- bytes:SDATA (remote_id)
- length:strlen (SDATA (remote_id))];
+ bytes:&rid
+ length:sizeof(OSType)];
/* file name */
@@ -2748,7 +2753,13 @@ OSStatus odb_event (struct buffer *buffer,
dataUsingEncoding:NSNonLossyASCIIStringEncoding];
if (tokenData)
{
- DescType tokenType = (unsigned int) XUINT (remote_token_type);
+ DescType tokenType;
+
+ if (Fcdr (remote_token_type))
+ tokenType = (XUINT (Fcar (remote_token_type)) << 16) | XUINT (Fcdr (remote_token_type));
+ else
+ tokenType = XUINT (remote_token_type);
+
[event setParamDescriptor:
[NSAppleEventDescriptor descriptorWithDescriptorType:tokenType
data:tokenData]
View
22 src/nsterm.m
@@ -4628,15 +4628,15 @@ - (void)extractArgumentsFromOdocEvent: (NSAppleEventDescriptor *)desc
[odbdesc paramDescriptorForKeyword:keyFileSender];
if (p)
{
- NSString *str = [NSString alloc];
+ /* Compiled for 32bit architectures, Emacs does not support full
+ long values in EMACS_INT. make_number() produces a float if
+ numbers are large, which may lose significant bits (or at least
+ can't be simply converted with XUINT on the other end. */
ns_input_parms = Fcons (Fcons (intern("remote-id"),
- build_string ([[str initWithData:[p data] encoding:NSNonLossyASCIIStringEncoding]
- UTF8String])),
- ns_input_parms);
- [str release];
+ Fcons(make_number ((unsigned long) ([p typeCodeValue] >> 16)),
+ make_number ((unsigned long) ([p typeCodeValue]) & 0xFFFF))),
+ ns_input_parms);
}
- // [dict setObject:[NSNumber numberWithUnsignedInt:[p typeCodeValue]]
- // forKey:@"remoteID"];
p = [odbdesc paramDescriptorForKeyword:keyFileCustomPath];
if (p)
ns_input_parms = Fcons (Fcons (intern("remote-path"),
@@ -4646,16 +4646,14 @@ - (void)extractArgumentsFromOdocEvent: (NSAppleEventDescriptor *)desc
p = [odbdesc paramDescriptorForKeyword:keyFileSenderToken];
if (p) {
ns_input_parms = Fcons (Fcons (intern("remote-token-type"),
- make_number ([p descriptorType])),
+ Fcons(make_number ((unsigned long) ([p descriptorType] >> 16)),
+ make_number ((unsigned long) ([p descriptorType]) & 0xFFFF))),
ns_input_parms);
-
- NSString *str = [NSString alloc];
ns_input_parms = Fcons (Fcons (intern("remote-token-data"),
/* To do: check that this doesn't lose data. */
- build_string ([[str initWithData:[p data] encoding:NSNonLossyASCIIStringEncoding]
+ build_string ([[[NSString string] initWithData:[p data] encoding:NSNonLossyASCIIStringEncoding]
UTF8String])),
ns_input_parms);
- [str release];
// [dict setObject:[NSNumber numberWithUnsignedLong:[p descriptorType]]
// forKey:@"remoteTokenDescType"];
Please sign in to comment.
Something went wrong with that request. Please try again.