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

Side by Side Diff: app/clipboard/clipboard_linux.cc

Issue 518022: Don't shoehorn a size_t into an int -- especially if the int is used in an su... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 10 years, 12 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
« 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/clipboard/clipboard.h" 5 #include "app/clipboard/clipboard.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 InsertMapping("COMPOUND_TEXT", data, text_len); 162 InsertMapping("COMPOUND_TEXT", data, text_len);
163 } 163 }
164 164
165 void Clipboard::WriteHTML(const char* markup_data, 165 void Clipboard::WriteHTML(const char* markup_data,
166 size_t markup_len, 166 size_t markup_len,
167 const char* url_data, 167 const char* url_data,
168 size_t url_len) { 168 size_t url_len) {
169 // TODO(estade): We need to expand relative links with |url_data|. 169 // TODO(estade): We need to expand relative links with |url_data|.
170 static const char* html_prefix = "<meta http-equiv=\"content-type\" " 170 static const char* html_prefix = "<meta http-equiv=\"content-type\" "
171 "content=\"text/html; charset=utf-8\">"; 171 "content=\"text/html; charset=utf-8\">";
172 int html_prefix_len = strlen(html_prefix); 172 size_t html_prefix_len = strlen(html_prefix);
173 int total_len = html_prefix_len + markup_len; 173 size_t total_len = html_prefix_len + markup_len;
174 174
175 char* data = new char[total_len]; 175 char* data = new char[total_len];
176 snprintf(data, total_len, "%s", html_prefix); 176 snprintf(data, total_len, "%s", html_prefix);
177 memcpy(data + html_prefix_len, markup_data, markup_len); 177 memcpy(data + html_prefix_len, markup_data, markup_len);
178 178
179 InsertMapping(kMimeHtml, data, total_len); 179 InsertMapping(kMimeHtml, data, total_len);
180 } 180 }
181 181
182 // Write an extra flavor that signifies WebKit was the last to modify the 182 // Write an extra flavor that signifies WebKit was the last to modify the
183 // pasteboard. This flavor has no data. 183 // pasteboard. This flavor has no data.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 switch (clipboard) { 389 switch (clipboard) {
390 case BUFFER_STANDARD: 390 case BUFFER_STANDARD:
391 return clipboard_; 391 return clipboard_;
392 case BUFFER_SELECTION: 392 case BUFFER_SELECTION:
393 return primary_selection_; 393 return primary_selection_;
394 default: 394 default:
395 NOTREACHED(); 395 NOTREACHED();
396 return NULL; 396 return NULL;
397 } 397 }
398 } 398 }
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