diff --git a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp index 276f3647e68..3fd993cc646 100644 --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,7 @@ AwtFileDialog::Initialize(JNIEnv *env, jstring filterDescription) int length = env->GetStringLength(filterDescription); DASSERT(length + 1 < MAX_FILTER_STRING); LPCTSTR tmp = JNU_GetStringPlatformChars(env, filterDescription, NULL); - _tcscpy(s_fileFilterString, tmp); + _tcscpy_s(s_fileFilterString, MAX_FILTER_STRING, tmp); JNU_ReleaseStringPlatformChars(env, filterDescription, tmp); //AdditionalString should be terminated by two NULL characters (Windows @@ -353,7 +353,7 @@ AwtFileDialog::Show(void *p) if (!result) { dlgerr = ::CommDlgExtendedError(); if (dlgerr == FNERR_INVALIDFILENAME) { - _tcscpy(fileBuffer, TEXT("")); + _tcscpy_s(fileBuffer, bufferLimit, TEXT("")); if (mode == java_awt_FileDialog_LOAD) { result = AwtFileDialog::GetOpenFileName(&ofn); } else { diff --git a/jdk/src/windows/native/sun/windows/awt_Font.cpp b/jdk/src/windows/native/sun/windows/awt_Font.cpp index d0d31ff0d07..df3fbcbbb12 100644 --- a/jdk/src/windows/native/sun/windows/awt_Font.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Font.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -366,17 +366,6 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale) return awtFont; } -int CALLBACK FindFamilyName (ENUMLOGFONTEX *lpelfe, - NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam) -{ - if(_tcsstr((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName)) { - _tcscpy((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName); - return 0; - } else { - return 1; - } -} - static void strip_tail(wchar_t* text, wchar_t* tail) { // strips tail and any possible whitespace before it from the end of text if (wcslen(text)<=wcslen(tail)) { return; diff --git a/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp b/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp index 71a08d3df33..78272a6c521 100644 --- a/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp +++ b/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -422,17 +422,17 @@ BOOL AwtPrintControl::CreateDevModeAndDevNames(PRINTDLG *ppd, devnames->wOutputOffset = static_cast(sizeof(DEVNAMES)/sizeof(TCHAR) + lenDriverName + lenPrinterName); if (info2->pDriverName != NULL) { - _tcscpy(lpcDevnames + devnames->wDriverOffset, info2->pDriverName); + _tcscpy_s(lpcDevnames + devnames->wDriverOffset, devnameSize - devnames->wDriverOffset, info2->pDriverName); } else { *(lpcDevnames + devnames->wDriverOffset) = _T('\0'); } if (pPrinterName != NULL) { - _tcscpy(lpcDevnames + devnames->wDeviceOffset, pPrinterName); + _tcscpy_s(lpcDevnames + devnames->wDeviceOffset, devnameSize - devnames->wDeviceOffset, pPrinterName); } else { *(lpcDevnames + devnames->wDeviceOffset) = _T('\0'); } if (info2->pPortName != NULL) { - _tcscpy(lpcDevnames + devnames->wOutputOffset, info2->pPortName); + _tcscpy_s(lpcDevnames + devnames->wOutputOffset, devnameSize - devnames->wOutputOffset, info2->pPortName); } else { *(lpcDevnames + devnames->wOutputOffset) = _T('\0'); } diff --git a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp index 8a3ed22c17d..cdb5247d618 100644 --- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp @@ -228,7 +228,7 @@ BOOL AwtToolkit::activateKeyboardLayout(HKL hkl) { // create input locale string, e.g., "00000409", from hkl. TCHAR inputLocale[9]; TCHAR buf[9]; - _tcscpy(inputLocale, TEXT("00000000")); + _tcscpy_s(inputLocale, 9, TEXT("00000000")); // 64-bit: ::LoadKeyboardLayout() is such a weird API - a string of // the hex value you want?! Here we're converting our HKL value to diff --git a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp index 6cd2ce49954..c26769bf5f2 100644 --- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp +++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -711,7 +711,7 @@ void AwtTrayIcon::SetToolTip(LPCTSTR tooltip) _tcsncpy(m_nid.szTip, tooltip, TRAY_ICON_TOOLTIP_MAX_SIZE); m_nid.szTip[TRAY_ICON_TOOLTIP_MAX_SIZE - 1] = '\0'; } else { - _tcscpy(m_nid.szTip, tooltip); + _tcscpy_s(m_nid.szTip, TRAY_ICON_TOOLTIP_MAX_SIZE, tooltip); } SendTrayMessage(NIM_MODIFY); @@ -817,7 +817,7 @@ void AwtTrayIcon::DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType) m_nid.szInfoTitle[TRAY_ICON_BALLOON_TITLE_MAX_SIZE - 1] = '\0'; } else { - _tcscpy(m_nid.szInfoTitle, caption); + _tcscpy_s(m_nid.szInfoTitle, TRAY_ICON_BALLOON_TITLE_MAX_SIZE, caption); } if (text[0] == '\0') { @@ -830,7 +830,7 @@ void AwtTrayIcon::DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType) m_nid.szInfo[TRAY_ICON_BALLOON_INFO_MAX_SIZE - 1] = '\0'; } else { - _tcscpy(m_nid.szInfo, text); + _tcscpy_s(m_nid.szInfo, TRAY_ICON_BALLOON_INFO_MAX_SIZE, text); } SendTrayMessage(NIM_MODIFY); diff --git a/jdk/src/windows/native/sun/windows/awt_ole.cpp b/jdk/src/windows/native/sun/windows/awt_ole.cpp index 0643ad8afb9..68912e5545e 100644 --- a/jdk/src/windows/native/sun/windows/awt_ole.cpp +++ b/jdk/src/windows/native/sun/windows/awt_ole.cpp @@ -70,7 +70,7 @@ namespace SUN_DBG_NS{ bErrorReport?_T("Error:"):_T(""), szBuffer) < 0) { - _tcscpy(szBuffer1 + DTRACE_BUF_LEN - 5, _T("...")); //reserver for \n + _tcscpy_s(szBuffer1 + DTRACE_BUF_LEN - 5, 5, _T("...")); //reserver for \n } memcpy(szBuffer1, szTime, iTimeLen*sizeof(TCHAR)); _tcscat(szBuffer1, _T("\n"));