Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: webkit/tools/test_shell/test_shell_win.cc

Issue 16551: Add a terminating NULL to the text read from the edit control. This doesn't w... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windows.h> 5 #include <windows.h>
6 #include <atlbase.h> 6 #include <atlbase.h>
7 #include <commdlg.h> 7 #include <commdlg.h>
8 #include <objbase.h> 8 #include <objbase.h>
9 #include <shlwapi.h> 9 #include <shlwapi.h>
10 #include <wininet.h> 10 #include <wininet.h>
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 #define MAX_URL_LENGTH 1024 643 #define MAX_URL_LENGTH 1024
644 644
645 LRESULT CALLBACK TestShell::EditWndProc(HWND hwnd, UINT message, 645 LRESULT CALLBACK TestShell::EditWndProc(HWND hwnd, UINT message,
646 WPARAM wParam, LPARAM lParam) { 646 WPARAM wParam, LPARAM lParam) {
647 TestShell* shell = 647 TestShell* shell =
648 static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); 648 static_cast<TestShell*>(win_util::GetWindowUserData(hwnd));
649 649
650 switch (message) { 650 switch (message) {
651 case WM_CHAR: 651 case WM_CHAR:
652 if (wParam == VK_RETURN) { 652 if (wParam == VK_RETURN) {
653 wchar_t strPtr[MAX_URL_LENGTH]; 653 wchar_t strPtr[MAX_URL_LENGTH + 1]; // Leave room for adding a NULL;
654 *((LPWORD)strPtr) = MAX_URL_LENGTH; 654 *((LPWORD)strPtr) = MAX_URL_LENGTH;
655 LRESULT strLen = SendMessage(hwnd, EM_GETLINE, 0, (LPARAM)strPtr); 655 LRESULT strLen = SendMessage(hwnd, EM_GETLINE, 0, (LPARAM)strPtr);
656 if (strLen > 0) 656 if (strLen > 0) {
657 strPtr[strLen] = 0; // EM_GETLINE doesn't NULL terminate.
657 shell->LoadURL(strPtr); 658 shell->LoadURL(strPtr);
659 }
658 660
659 return 0; 661 return 0;
660 } 662 }
661 } 663 }
662 664
663 return (LRESULT) CallWindowProc(shell->default_edit_wnd_proc_, hwnd, 665 return (LRESULT) CallWindowProc(shell->default_edit_wnd_proc_, hwnd,
664 message, wParam, lParam); 666 message, wParam, lParam);
665 } 667 }
666 668
667 669
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 764
763 bool EnsureFontLoaded(HFONT font) { 765 bool EnsureFontLoaded(HFONT font) {
764 return true; 766 return true;
765 } 767 }
766 768
767 bool DownloadUrl(const std::string& url, HWND caller_window) { 769 bool DownloadUrl(const std::string& url, HWND caller_window) {
768 return false; 770 return false;
769 } 771 }
770 772
771 } // namespace webkit_glue 773 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698