wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.78k stars 1.7k forks source link

WINCE SDK hasn't strnlen / wcsnlen function #10763

Closed wxtrac closed 15 years ago

wxtrac commented 15 years ago

Issue migrated from trac ticket # 10763

component: wxMSW-CE | priority: blocker | resolution: fixed | keywords: strnlen, wcsnlen

2009-05-02 15:24:57: alexodus (Alessandro) created the issue

wxtrac commented 15 years ago

2009-05-02 15:25:46: alexodus (Alessandro) uploaded file nostrnlen.patch (0.8 KiB)

patch for wxrtbase.h

wxtrac commented 15 years ago

2009-05-02 15:29:26: alexodus (Alessandro) commented


oops..sorry for missing description!:P but it's a trivial patch.

wxtrac commented 15 years ago

2009-05-02 15:39:59: @vadz changed status from new to confirmed

2009-05-02 15:39:59: @vadz commented

The patch is trivial however I'm afraid it's not totally correct as according to http://msdn.microsoft.com/en-us/library/aa934514.aspx Windows Embedded CE does provide these functions -- although it's true that Windows Mobile does not.

Unfortunately we don't have a specific define for Windows Mobile so we could either use __WXHANDHELD__ (which covers it if I read wx/platform.h correctly) or add yet another define... Does anybody have any preference or better ideas?

wxtrac commented 15 years ago

2009-05-02 16:56:24: alexodus (Alessandro) commented


Yes,it's right, but from sixth edition of OS (Windows Embedded CE 6.0). According http://msdn.microsoft.com/en-us/library/aa908874.aspx in this case we have _WIN32_WCE=600

Remember these: OS # WINCE 6.0(*) -> PlatformWindows Mobile 7(**) OS # WINCE 5.2 -> PlatformWindows Mobile 6 OS # WINCE 4.2 -> PlatformWindows Mobile 2003 OS # WINCE 3.0 -> PlatformPocketPC 2000/2002 etc..

(*) released on November 1, 2006 (**) is due for release on 1 June 2010

(see http://en.wikipedia.org/wiki/Windows_Embedded_CE_6.0 http://en.wikipedia.org/wiki/Windows_Mobile )

If it wasn't clear, Windows Mobile is only a platform that uses the underlying OS named Windows CE. So, we're going to see strnlen (and wcsnlen ) function in Windows Mobile 7 (or in windows CE 6.0 devices)

Sorry if it is a useless clarification

wxtrac commented 15 years ago

2009-05-02 17:25:40: @vadz changed status from confirmed to closed

2009-05-02 17:25:40: @vadz changed resolution from * to fixed*

2009-05-02 17:25:40: @vadz commented

(In [60476]) WinCE doesn't provide strnlen/wcsnlen() until version 6.0 (closes #10763)

wxtrac commented 15 years ago

2009-05-02 17:26:14: @vadz commented


If I understand it correctly, my fix above should hopefully fix this, please reopen if it didn't.

Thanks!

wxtrac commented 15 years ago

2009-05-02 18:11:10: alexodus (Alessandro) changed status from closed to reopened

2009-05-02 18:11:10: alexodus (Alessandro) changed resolution from fixed to **

2009-05-02 18:11:10: alexodus (Alessandro) commented

oops.... compilation fails!! So I saw that in PocketPC 2003 _WIN32_WCE = 0x420 (hex format) and not 400! 0x420=660 > 600!!

Googling I found this:

http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesnative/thread/8a97c59f-5a1c-4bc6-99e6-427f065ff439/

http://www.mail-archive.com/cegcc-devel@lists.sourceforge.net/msg00902.html

In practice I think that with new version of SDK they (MS) should use hex notation (http://stuff.mit.edu/afs/athena/software/qt-static/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf )

So replace 600 with 0x600!

wxtrac commented 15 years ago

2009-05-02 18:17:01: @vadz changed status from reopened to closed

2009-05-02 18:17:01: @vadz changed resolution from * to fixed*

2009-05-02 18:17:01: @vadz commented

(In [60480]) use correct Windows CE version number in strnlen() check (really closes #10763)

wxtrac commented 15 years ago

2009-05-02 18:17:44: @vadz commented


Sorry, I should have checked this more carefully. And thanks for testing!