Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316073 - [tcf][patch] MinGW/MSVC fixes for crash in TCF reference agent
Summary: [tcf][patch] MinGW/MSVC fixes for crash in TCF reference agent
Status: VERIFIED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 0.3   Edit
Assignee: Project Inbox CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-07 20:04 EDT by Ed Swartz CLA
Modified: 2013-06-05 06:26 EDT (History)
3 users (show)

See Also:


Attachments
update to replace %ll* with macros (5.38 KB, patch)
2010-06-07 20:04 EDT, Ed Swartz CLA
eugene: iplog-
mober.at+eclipse: review-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Swartz CLA 2010-06-07 20:04:07 EDT
Created attachment 171359 [details]
update to replace %ll* with macros

Due to some trace() logging for peers with invalid timestamps (discovery_udp.c:udp_receive_ack_slaves), we are seeing nearly immediate crashes of TCF agents built with MinGW.  (Apparently in our office we have a ton of dead TCF agents still kicking about.  ;)

In MinGW and MSVC, the interpretation in printf of "%lld" and "%llX" is "%u" and "%x" (for legacy compatibility, pre-C99).  So formatting this value (actually, any "%s" values after it) causes crashes in vfprintf().

This patch, thusly, replaces uses of "%lld" and "%llX" with macros that adapt to the build environment.  

Note: I only tested this build on MinGW.  It would be good if someone tested it on MSVC to double-check.  I did verify it doesn't break the Cygwin build.

And please feel free to rename the macros... they are a bit wordy.
Comment 1 Eugene Tarassov CLA 2010-06-08 16:20:27 EDT
On my Windows XP machine "%lld" works fine with both MinGW and MSVC.
You probably have some older version of MSVC runtime DLL.
Googling "%lld" shows it was not supported on Windows before VC++ 2005.

Anyway, I'm going to change the code to use ISO standard macros like PRId64.
Comment 2 Eugene Tarassov CLA 2010-06-08 21:37:18 EDT
Fixed: change the code to use standard printf format macros like PRId64.

Thanks
Comment 3 Martin Oberhuber CLA 2010-06-08 23:25:34 EDT
Comment on attachment 171359 [details]
update to replace %ll* with macros

Thanks Eugene for putting in the iplog-, this helps understanding that the patch was not used although the issue is resolved.
Comment 4 Ed Swartz CLA 2010-06-09 08:28:24 EDT
Thanks!
Comment 5 Martin Oberhuber CLA 2010-09-21 09:02:36 EDT
Comment on attachment 171359 [details]
update to replace %ll* with macros

Marking patch obsolete since it was not used.
Comment 6 Doug Schaefer CLA 2011-05-17 10:49:29 EDT
Moving bugs to new home for IP log.
Comment 7 Martin Oberhuber CLA 2013-06-05 06:26:56 EDT
Bulk change: Marking all bugs from the TM era (until June 2011) target 0.3