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

Side by Side Diff: sdk/lib/io/http_utils.dart

Issue 12425004: Fix deprecation warnings in dart:io. Now completely warning free. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « sdk/lib/io/http_impl.dart ('k') | sdk/lib/io/mime_multipart_parser.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 class _HttpUtils { 7 class _HttpUtils {
8 static String decodeUrlEncodedString(String urlEncoded) { 8 static String decodeUrlEncodedString(String urlEncoded) {
9 // First check the string for any encoding. 9 // First check the string for any encoding.
10 int index = 0; 10 int index = 0;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // | "Sep" | "Oct" | "Nov" | "Dec" 97 // | "Sep" | "Oct" | "Nov" | "Dec"
98 98
99 // Format as RFC 1123 date. 99 // Format as RFC 1123 date.
100 static String formatDate(DateTime date) { 100 static String formatDate(DateTime date) {
101 const List wkday = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; 101 const List wkday = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
102 const List month = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 102 const List month = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
103 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; 103 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
104 104
105 DateTime d = date.toUtc(); 105 DateTime d = date.toUtc();
106 StringBuffer sb = new StringBuffer(); 106 StringBuffer sb = new StringBuffer();
107 sb.add(wkday[d.weekday - 1]); 107 sb.write(wkday[d.weekday - 1]);
108 sb.add(", "); 108 sb.write(", ");
109 sb.add(d.day.toString()); 109 sb.write(d.day.toString());
110 sb.add(" "); 110 sb.write(" ");
111 sb.add(month[d.month - 1]); 111 sb.write(month[d.month - 1]);
112 sb.add(" "); 112 sb.write(" ");
113 sb.add(d.year.toString()); 113 sb.write(d.year.toString());
114 sb.add(d.hour < 9 ? " 0" : " "); 114 sb.write(d.hour < 9 ? " 0" : " ");
115 sb.add(d.hour.toString()); 115 sb.write(d.hour.toString());
116 sb.add(d.minute < 9 ? ":0" : ":"); 116 sb.write(d.minute < 9 ? ":0" : ":");
117 sb.add(d.minute.toString()); 117 sb.write(d.minute.toString());
118 sb.add(d.second < 9 ? ":0" : ":"); 118 sb.write(d.second < 9 ? ":0" : ":");
119 sb.add(d.second.toString()); 119 sb.write(d.second.toString());
120 sb.add(" GMT"); 120 sb.write(" GMT");
121 return sb.toString(); 121 return sb.toString();
122 } 122 }
123 123
124 static DateTime parseDate(String date) { 124 static DateTime parseDate(String date) {
125 final int SP = 32; 125 final int SP = 32;
126 const List wkdays = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; 126 const List wkdays = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
127 const List weekdays = const ["Monday", "Tuesday", "Wednesday", "Thursday", 127 const List weekdays = const ["Monday", "Tuesday", "Wednesday", "Thursday",
128 "Friday", "Saturday", "Sunday"]; 128 "Friday", "Saturday", "Sunday"];
129 const List months = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 129 const List months = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
130 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; 130 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 int hour = toInt(timeList[0]); 352 int hour = toInt(timeList[0]);
353 int minute = toInt(timeList[1]); 353 int minute = toInt(timeList[1]);
354 int second = toInt(timeList[2]); 354 int second = toInt(timeList[2]);
355 if (hour > 23) error(); 355 if (hour > 23) error();
356 if (minute > 59) error(); 356 if (minute > 59) error();
357 if (second > 59) error(); 357 if (second > 59) error();
358 358
359 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0); 359 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
360 } 360 }
361 } 361 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | sdk/lib/io/mime_multipart_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698