On Thu, Oct 08, 2009 at 03:33:53AM +0700, Antoine Martin wrote:
> > Antoine Martin wrote:
> >> Hi,

Hi,

please check my comments directly in the patch. Note I can't
test winvnc bits because currently I don't have any VC++
environment but changes there look fine for me. You don't have to
attach new patch, only let us know if changes suggested below works
for you (those changes is not a pedantry, they are actually needed to
make code compilable via MinGW).

Regards, Adam

> >>
> >> I eventually managed to build TigerVNC with VC++ 9
> >> Attached are the trivial changes that I had to make.
> >> Can anyone suggest a better way of fixing those compilation errors?
> >> What sort of a patch would be acceptable for merging?
> >>
> >> Mostly, just:
> >> * casts
> >> * afxres.h -> windows.h (and add #define IDC_STATIC -1)
> >>
> >> FYI: I also had to comment out this line in VC's stdio.h:
> >> _Check_return_opt_ _CRT_INSECURE_DEPRECATE(vsnprintf_s) _CRTIMP int
> >> __cdecl vsnprintf(_Out_cap_(_MaxCount) char * _DstBuf, _In_ size_t
> >> _MaxCount, _In_z_ _Printf_format_string_ const char * _Format, va_list
> >> _ArgList);
> >> Which gives me lots of warnings, but at least it builds...
> >>
> >> Now at least I can try to solve my real problems (PasswordFile, etc..)
> >>
> >> Cheers
> >> Antoine
> >>
> >>
> >> ------------------------------------------------------------------------
> >>
> >> ------------------------------------------------------------------------------
> >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> >> is the only developer event you need to attend this year. Jumpstart your
> >> developing skills, take BlackBerry mobile applications to market and stay 
> >> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> >> http://p.sf.net/sfu/devconference
> >>
> >>
> >> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Tigervnc-devel mailing list
> >> Tigervnc-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

> diff -ur a/rfb_win32/CKeyboard.cxx b/rfb_win32/CKeyboard.cxx
> --- a/rfb_win32/CKeyboard.cxx 2009-08-20 16:46:42.000000000 +0700
> +++ b/rfb_win32/CKeyboard.cxx 2009-10-08 01:39:22.000000000 +0700
> @@ -64,7 +64,7 @@
>      // be a comma and a DECIMAL to be a dot. 
>      if (extendedVkey == VK_DECIMAL || extendedVkey == VK_SEPARATOR) {
>        char buf[4];
> -      if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buf, 
> sizeof(buf))) {
> +      if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, (LPWSTR) buf, 
> sizeof(buf))) {

Per http://msdn.microsoft.com/en-us/library/dd318101(VS.85).aspx
(GetLocaleInfo description) the third argument is LPTSTR, not LPWSTR.

>       vlog.debug("failed to retrieve LOCALE_SDECIMAL");
>        } else {
>       switch (buf[0]) {
> diff -ur a/vncconfig/vncconfig.rc b/vncconfig/vncconfig.rc
> --- a/vncconfig/vncconfig.rc  2009-08-20 16:46:42.000000000 +0700
> +++ b/vncconfig/vncconfig.rc  2009-10-08 03:29:50.000000000 +0700
> @@ -7,7 +7,11 @@
>  //
>  // Generated from the TEXTINCLUDE 2 resource.
>  //
> -#include "afxres.h"
> +#include "windows.h"
> +
> +#ifndef IDC_STATIC
> +#define IDC_STATIC -1
> +#endif
>  
>  /////////////////////////////////////////////////////////////////////////////
>  #undef APSTUDIO_READONLY_SYMBOLS
> @@ -34,7 +38,7 @@
>  
>  2 TEXTINCLUDE DISCARDABLE 
>  BEGIN
> -    "#include ""afxres.h""\r\n"
> +    "#include ""windows.h""\r\n"
>      "\0"
>  END
>  
> diff -ur a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
> --- a/vncviewer/DesktopWindow.cxx     2009-08-20 16:46:42.000000000 +0700
> +++ b/vncviewer/DesktopWindow.cxx     2009-10-08 01:42:30.000000000 +0700
> @@ -75,7 +75,7 @@
>    try {
>      result = _this->processMessage(msg, wParam, lParam);
>    } catch (rfb::UnsupportedPixelFormatException &e) {
> -    MsgBox(0, e.str(), MB_OK | MB_ICONINFORMATION);
> +    MsgBox(0, (TCHAR *) e.str(), MB_OK | MB_ICONINFORMATION);
>      _this->getCallback()->closeWindow();
>    } catch (rdr::Exception& e) {
>      vlog.error("untrapped: %s", e.str());
> diff -ur a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
> --- a/vncviewer/OptionsDialog.cxx     2009-08-20 16:46:42.000000000 +0700
> +++ b/vncviewer/OptionsDialog.cxx     2009-10-08 01:43:06.000000000 +0700
> @@ -175,7 +175,7 @@
>          (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]);
>      }
>      if (dlg->options.autoScaling) {
> -      SetDlgItemText(handle, IDC_COMBO_SCALE, "Auto");
> +      SetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) "Auto");

Per http://msdn.microsoft.com/en-us/library/ms645521(VS.85).aspx the
third parameter is LPCTSTR.

>      } else {
>        SetDlgItemInt(handle, IDC_COMBO_SCALE, dlg->options.scale, FALSE);
>      }
> @@ -195,8 +195,8 @@
>        dlg->options.autoScaling = false;
>      } else {
>        char scaleStr[20];
> -      GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
> -      if (strcmp(scaleStr, "Auto") == 0) {
> +      GetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) scaleStr, 20);

LPWSTR -> LPTSTR.

> +      if (strcmp(scaleStr, (const char *) "Auto") == 0) {
>          dlg->options.autoScaling = true;
>        }
>      }
> @@ -212,7 +212,7 @@
>            int index = SendMessage(handleComboScale, CB_GETCURSEL, 0, 0);
>            SendMessage(handleComboScale, CB_GETLBTEXT, (WPARAM)index, 
> (LPARAM)scaleStr);
>          } else {
> -          GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
> +          GetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) scaleStr, 20);

LPWSTR -> LPTSTR.

>          }
>          return true;
>        }
> diff -ur a/vncviewer/ViewerToolBar.cxx b/vncviewer/ViewerToolBar.cxx
> --- a/vncviewer/ViewerToolBar.cxx     2009-08-20 16:46:42.000000000 +0700
> +++ b/vncviewer/ViewerToolBar.cxx     2009-10-08 01:37:19.000000000 +0700
> @@ -63,34 +63,34 @@
>  
>        switch (TTStr->hdr.idFrom) {
>        case ID_OPTIONS:
> -        TTStr->lpszText = "Connection options...";
> +        TTStr->lpszText = (LPWSTR) "Connection options...";

Per http://msdn.microsoft.com/en-us/library/aa297203(VS.60).aspx
lpszText is LPTSTR, not LPWSTR. This applies to all assignments
below.

>          break;
>        case ID_INFO:
> -        TTStr->lpszText = "Connection info";
> +        TTStr->lpszText = (LPWSTR) "Connection info";
>          break;
>        case ID_FULLSCREEN:
> -        TTStr->lpszText = "Full screen";
> +        TTStr->lpszText = (LPWSTR) "Full screen";
>          break;
>        case ID_REQUEST_REFRESH:
> -        TTStr->lpszText = "Request screen refresh";
> +        TTStr->lpszText = (LPWSTR) "Request screen refresh";
>          break;
>        case ID_SEND_CAD:
> -        TTStr->lpszText = "Send Ctrl-Alt-Del";
> +        TTStr->lpszText = (LPWSTR) "Send Ctrl-Alt-Del";
>          break;
>        case ID_SEND_CTLESC:
> -        TTStr->lpszText = "Send Ctrl-Esc";
> +        TTStr->lpszText = (LPWSTR) "Send Ctrl-Esc";
>          break;
>        case ID_CTRL_KEY:
> -        TTStr->lpszText = "Send Ctrl key press/release";
> +        TTStr->lpszText = (LPWSTR) "Send Ctrl key press/release";
>          break;
>        case ID_ALT_KEY:
> -        TTStr->lpszText = "Send Alt key press/release";
> +        TTStr->lpszText = (LPWSTR) "Send Alt key press/release";
>          break;
>        case ID_NEW_CONNECTION:
> -        TTStr->lpszText = "New connection...";
> +        TTStr->lpszText = (LPWSTR) "New connection...";
>          break;
>        case ID_CONN_SAVE_AS:
> -        TTStr->lpszText = "Save connection info as...";
> +        TTStr->lpszText = (LPWSTR) "Save connection info as...";
>          break;
>        default:
>          break;
> diff -ur a/vncviewer/vncviewer.rc b/vncviewer/vncviewer.rc
> --- a/vncviewer/vncviewer.rc  2009-08-20 16:46:42.000000000 +0700
> +++ b/vncviewer/vncviewer.rc  2009-10-08 03:29:47.000000000 +0700
> @@ -7,7 +7,11 @@
>  //
>  // Generated from the TEXTINCLUDE 2 resource.
>  //
> -#include "afxres.h"
> +#include "windows.h"
> +
> +#ifndef IDC_STATIC
> +#define IDC_STATIC -1
> +#endif
>  
>  /////////////////////////////////////////////////////////////////////////////
>  #undef APSTUDIO_READONLY_SYMBOLS
> @@ -34,7 +38,7 @@
>  
>  2 TEXTINCLUDE DISCARDABLE 
>  BEGIN
> -    "#include ""afxres.h""\r\n"
> +    "#include ""windows.h""\r\n"
>      "\0"
>  END
>  
> diff -ur a/winvnc/ControlPanel.cxx b/winvnc/ControlPanel.cxx
> --- a/winvnc/ControlPanel.cxx 2009-08-20 16:46:42.000000000 +0700
> +++ b/winvnc/ControlPanel.cxx 2009-10-08 02:05:54.000000000 +0700
> @@ -18,9 +18,9 @@
>  void ControlPanel::initDialog()
>  {
>    TCHAR *ColumnsStrings[] = {
> -    "IP address",
> -    "Time connected",
> -    "Status"
> +    (TCHAR *) "IP address",
> +    (TCHAR *) "Time connected",
> +    (TCHAR *) "Status"
>    };
>    InitLVColumns(IDC_LIST_CONNECTIONS, handle, 120, 3, ColumnsStrings,
>                  LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
> @@ -90,7 +90,7 @@
>  
>    for (ListConn.iBegin(); !ListConn.iEnd(); ListConn.iNext()) {
>      ListConn.iGetCharInfo(ItemString);
> -    InsertLVItem(IDC_LIST_CONNECTIONS, handle, i, ItemString, 3);
> +    InsertLVItem(IDC_LIST_CONNECTIONS, handle, i, (TCHAR **) ItemString, 3);
>      for (ListSelConn.iBegin(); !ListSelConn.iEnd(); ListSelConn.iNext()) {
>        if (ListSelConn.iGetConn() == ListConn.iGetConn())
>          SelectLVItem(IDC_LIST_CONNECTIONS, handle, i);
> diff -ur a/winvnc/winvnc.rc b/winvnc/winvnc.rc
> --- a/winvnc/winvnc.rc        2009-08-20 16:46:42.000000000 +0700
> +++ b/winvnc/winvnc.rc        2009-10-08 02:42:12.000000000 +0700
> @@ -7,7 +7,7 @@
>  //
>  // Generated from the TEXTINCLUDE 2 resource.
>  //
> -#include "afxres.h"
> +#include "windows.h"
>  
>  /////////////////////////////////////////////////////////////////////////////
>  #undef APSTUDIO_READONLY_SYMBOLS
> @@ -34,7 +34,7 @@
>  
>  2 TEXTINCLUDE DISCARDABLE 
>  BEGIN
> -    "#include ""afxres.h""\r\n"
> +    "#include ""windows.h""\r\n"
>      "\0"
>  END
>  
> diff -ur a/wm_hooks/wm_hooks.rc b/wm_hooks/wm_hooks.rc
> --- a/wm_hooks/wm_hooks.rc    2009-08-20 16:46:42.000000000 +0700
> +++ b/wm_hooks/wm_hooks.rc    2009-10-08 02:14:52.000000000 +0700
> @@ -7,7 +7,7 @@
>  //
>  // Generated from the TEXTINCLUDE 2 resource.
>  //
> -#include "afxres.h"
> +#include "windows.h"
>  
>  /////////////////////////////////////////////////////////////////////////////
>  #undef APSTUDIO_READONLY_SYMBOLS
> @@ -34,7 +34,7 @@
>  
>  2 TEXTINCLUDE DISCARDABLE 
>  BEGIN
> -    "#include ""afxres.h""\r\n"
> +    "#include ""windows.h""\r\n"
>      "\0"
>  END
>  

> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference

> _______________________________________________
> Tigervnc-devel mailing list
> Tigervnc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


-- 
Adam Tkac, Red Hat, Inc.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to