Changeset 181 for trunk/src


Ignore:
Timestamp:
Jun 24, 1999, 6:54:24 PM (26 years ago)
Author:
achimha
Message:

More unicode fixes - not complete yet..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/comdlg32.cpp

    r162 r181  
    1 /* $Id: comdlg32.cpp,v 1.5 1999-06-23 16:39:29 achimha Exp $ */
     1/* $Id: comdlg32.cpp,v 1.6 1999-06-24 16:54:24 achimha Exp $ */
    22
    33/*
     
    280280    FreeAsciiString((char*)asciicf.lpTemplateName);
    281281
     282  // copy back fields
     283  lpcf->Flags = asciicf.Flags;
     284
    282285  return bResult;
    283286}
     
    394397  }
    395398
     399  // copy back fields
     400  lpfr->Flags = fr.Flags;
     401
    396402  return bResult;
    397403}
     
    456462  char*           szFile;
    457463  char*           szFileTitle;
     464  char*           szCustFilter;
    458465  BOOL            bResult;
    459466
     
    475482    ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
    476483
    477   if (lpofn->lpstrCustomFilter != NULL)
    478     ofn.lpstrCustomFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrCustomFilter);
    479 
    480484  if (lpofn->lpstrInitialDir != NULL)
    481485    ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
     
    488492
    489493  szFile             = (char*)malloc(lpofn->nMaxFile);
    490   szFileTitle        = (char*)malloc(lpofn->nMaxFileTitle);
    491   ofn.lpstrFile      = szFile;
    492   ofn.lpstrFileTitle = szFileTitle;
     494  szFile[0]          = 0;
     495
     496  if (*lpofn->lpstrFile != 0)
     497    UnicodeToAscii(lpofn->lpstrFile,
     498                   szFile);
     499
     500  if (lpofn->lpstrFileTitle != NULL)
     501  {
     502    szFileTitle        = (char*)malloc(lpofn->nMaxFileTitle);
     503    szFileTitle[0]     = 0;
     504
     505    if (*lpofn->lpstrFileTitle != 0)
     506      UnicodeToAscii(lpofn->lpstrFileTitle,
     507                     szFileTitle);
     508  }
     509  else
     510    szFileTitle = NULL;
     511
     512  if (lpofn->lpstrCustomFilter != NULL)
     513  {
     514    szCustFilter       = (char*)malloc(lpofn->nMaxCustFilter);
     515    szCustFilter[0]    = 0;
     516
     517
     518    if (*lpofn->lpstrCustomFilter != 0)
     519       UnicodeToAscii(lpofn->lpstrCustomFilter,
     520                      szCustFilter);
     521  }
     522  else
     523    szCustFilter = NULL;
     524
     525  ofn.lpstrFile         = szFile;
     526  ofn.lpstrFileTitle    = szFileTitle;
     527  ofn.lpstrCustomFilter = szCustFilter;
    493528
    494529  COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
     
    498533  if (ofn.lpTemplateName    != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
    499534  if (ofn.lpstrFilter       != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
    500   if (ofn.lpstrCustomFilter != NULL) FreeAsciiString((char*)ofn.lpstrCustomFilter);
    501535  if (ofn.lpstrInitialDir   != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
    502536  if (ofn.lpstrTitle        != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
     
    504538
    505539  // transform back the result
    506   AsciiToUnicodeN(ofn.lpstrFile,
    507                   lpofn->lpstrFile,
    508                   lpofn->nMaxFile);
    509 
    510   AsciiToUnicodeN(ofn.lpstrFileTitle,
    511                   lpofn->lpstrFileTitle,
    512                   lpofn->nMaxFileTitle);
    513 
     540  AsciiToUnicode(ofn.lpstrFile,
     541                 lpofn->lpstrFile);
    514542  free(szFile);
    515   free(szFileTitle);
     543
     544  if (lpofn->lpstrFileTitle != NULL)
     545  {
     546    AsciiToUnicode(ofn.lpstrFileTitle,
     547                   lpofn->lpstrFileTitle);
     548    free(szFileTitle);
     549  }
     550
     551  if (lpofn->lpstrCustomFilter != NULL)
     552  {
     553    AsciiToUnicode(ofn.lpstrCustomFilter,
     554                   lpofn->lpstrCustomFilter);
     555    free(szCustFilter);
     556  }
     557
     558  // copy over some altered flags
     559  lpofn->nFilterIndex   = ofn.nFilterIndex;
     560  lpofn->Flags          = ofn.Flags;
     561  lpofn->nFileOffset    = ofn.nFileOffset;
     562  lpofn->nFileExtension = ofn.nFileExtension;
    516563
    517564  return bResult;
     
    537584  char*           szFile;
    538585  char*           szFileTitle;
     586  char*           szCustFilter;
    539587  BOOL            bResult;
    540588
     
    556604    ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
    557605
    558   if (lpofn->lpstrCustomFilter != NULL)
    559     ofn.lpstrCustomFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrCustomFilter);
    560 
    561606  if (lpofn->lpstrInitialDir != NULL)
    562607    ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
     
    568613    ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
    569614
    570   // prepare szFile and szFileTitle
    571615  szFile             = (char*)malloc(lpofn->nMaxFile);
    572   szFileTitle        = (char*)malloc(lpofn->nMaxFileTitle);
    573 
    574   if (*lpofn->lpstrFile == 0)
    575     szFile[0] = 0;
    576   else
    577     UnicodeToAsciiN(lpofn->lpstrFile,
    578                     szFile,
    579                     lpofn->nMaxFile);
    580 
    581   if (*lpofn->lpstrFileTitle == 0)
    582     szFileTitle[0] = 0;
    583   else
    584     UnicodeToAsciiN(lpofn->lpstrFileTitle,
    585                     szFileTitle,
    586                     lpofn->nMaxFileTitle);
    587 
    588   ofn.lpstrFile      = szFile;
    589   ofn.lpstrFileTitle = szFileTitle;
     616  szFile[0]          = 0;
     617
     618  if (*lpofn->lpstrFile != 0)
     619    UnicodeToAscii(lpofn->lpstrFile,
     620                   szFile);
     621
     622  if (lpofn->lpstrFileTitle != NULL)
     623  {
     624    szFileTitle        = (char*)malloc(lpofn->nMaxFileTitle);
     625    szFileTitle[0]     = 0;
     626
     627    if (*lpofn->lpstrFileTitle != 0)
     628      UnicodeToAscii(lpofn->lpstrFileTitle,
     629                     szFileTitle);
     630  }
     631  else
     632    szFileTitle = NULL;
     633
     634  if (lpofn->lpstrCustomFilter != NULL)
     635  {
     636    szCustFilter       = (char*)malloc(lpofn->nMaxCustFilter);
     637    szCustFilter[0]    = 0;
     638
     639
     640    if (*lpofn->lpstrCustomFilter != 0)
     641       UnicodeToAscii(lpofn->lpstrCustomFilter,
     642                      szCustFilter);
     643  }
     644  else
     645    szCustFilter = NULL;
     646
     647  ofn.lpstrFile         = szFile;
     648  ofn.lpstrFileTitle    = szFileTitle;
     649  ofn.lpstrCustomFilter = szCustFilter;
    590650
    591651  COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
     
    595655  if (ofn.lpTemplateName    != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
    596656  if (ofn.lpstrFilter       != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
    597   if (ofn.lpstrCustomFilter != NULL) FreeAsciiString((char*)ofn.lpstrCustomFilter);
    598657  if (ofn.lpstrInitialDir   != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
    599658  if (ofn.lpstrTitle        != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
     
    601660
    602661  // transform back the result
     662  AsciiToUnicode(ofn.lpstrFile,
     663                 lpofn->lpstrFile);
     664  free(szFile);
     665
     666  if (lpofn->lpstrFileTitle != NULL)
     667  {
     668    AsciiToUnicode(ofn.lpstrFileTitle,
     669                   lpofn->lpstrFileTitle);
     670    free(szFileTitle);
     671  }
     672
     673  if (lpofn->lpstrCustomFilter != NULL)
     674  {
     675    AsciiToUnicode(ofn.lpstrCustomFilter,
     676                   lpofn->lpstrCustomFilter);
     677    free(szCustFilter);
     678  }
     679
     680  // copy over some altered flags
     681  lpofn->nFilterIndex   = ofn.nFilterIndex;
     682  lpofn->Flags          = ofn.Flags;
    603683  lpofn->nFileOffset    = ofn.nFileOffset;
    604684  lpofn->nFileExtension = ofn.nFileExtension;
    605   // @@@PH: remark - are these all required pass-back fields ?
    606 
    607   AsciiToUnicodeN(ofn.lpstrFile,
    608                   lpofn->lpstrFile,
    609                   lpofn->nMaxFile);
    610 
    611   AsciiToUnicodeN(ofn.lpstrFileTitle,
    612                   lpofn->lpstrFileTitle,
    613                   lpofn->nMaxFileTitle);
    614 
    615   free(szFile);
    616   free(szFileTitle);
    617685
    618686  return bResult;
    619687}
     688
    620689
    621690/*****************************************************************************
     
    693762
    694763  // copy back result
     764  lppd->Flags     = pd.Flags;
    695765  lppd->nFromPage = pd.nFromPage;
    696766  lppd->nToPage   = pd.nToPage;
     
    794864  }
    795865
     866  // copy back fields
     867  lpfr->Flags = fr.Flags;
     868
    796869  return bResult;
    797 
    798870}
    799871
Note: See TracChangeset for help on using the changeset viewer.