OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/net_errors.h" | 5 #include "net/base/net_errors.h" |
6 | 6 |
7 #include <winsock2.h> | 7 #include <winsock2.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 case ERROR_TOO_MANY_OPEN_FILES: // The system cannot open the file. | 63 case ERROR_TOO_MANY_OPEN_FILES: // The system cannot open the file. |
64 return ERR_INSUFFICIENT_RESOURCES; | 64 return ERR_INSUFFICIENT_RESOURCES; |
65 case ERROR_ACCESS_DENIED: // Access is denied. | 65 case ERROR_ACCESS_DENIED: // Access is denied. |
66 return ERR_ACCESS_DENIED; | 66 return ERR_ACCESS_DENIED; |
67 case ERROR_INVALID_HANDLE: // The handle is invalid. | 67 case ERROR_INVALID_HANDLE: // The handle is invalid. |
68 return ERR_INVALID_HANDLE; | 68 return ERR_INVALID_HANDLE; |
69 case ERROR_NOT_ENOUGH_MEMORY: // Not enough storage is available to | 69 case ERROR_NOT_ENOUGH_MEMORY: // Not enough storage is available to |
70 return ERR_OUT_OF_MEMORY; // process this command. | 70 return ERR_OUT_OF_MEMORY; // process this command. |
71 case ERROR_OUTOFMEMORY: // Not enough storage is available to complete | 71 case ERROR_OUTOFMEMORY: // Not enough storage is available to complete |
72 return ERR_OUT_OF_MEMORY; // this operation. | 72 return ERR_OUT_OF_MEMORY; // this operation. |
73 case ERROR_WRITE_PROTECT: // The media is write protected. | 73 case ERROR_WRITE_PROTECT: // The media is write protected. |
74 return ERR_ACCESS_DENIED; | 74 return ERR_ACCESS_DENIED; |
75 case ERROR_SHARING_VIOLATION: // Cannot access the file because it is | 75 case ERROR_SHARING_VIOLATION: // Cannot access the file because it is |
76 return ERR_ACCESS_DENIED; // being used by another process. | 76 return ERR_ACCESS_DENIED; // being used by another process. |
77 case ERROR_LOCK_VIOLATION: // The process cannot access the file because | 77 case ERROR_LOCK_VIOLATION: // The process cannot access the file because |
78 return ERR_ACCESS_DENIED; // another process has locked the file. | 78 return ERR_ACCESS_DENIED; // another process has locked the file. |
79 case ERROR_HANDLE_EOF: // Reached the end of the file. | 79 case ERROR_HANDLE_EOF: // Reached the end of the file. |
80 return ERR_FAILED; | 80 return ERR_FAILED; |
81 case ERROR_HANDLE_DISK_FULL: // The disk is full. | 81 case ERROR_HANDLE_DISK_FULL: // The disk is full. |
82 return ERR_FILE_NO_SPACE; | 82 return ERR_FILE_NO_SPACE; |
83 case ERROR_FILE_EXISTS: // The file exists. | 83 case ERROR_FILE_EXISTS: // The file exists. |
84 return ERR_FILE_EXISTS; | 84 return ERR_FILE_EXISTS; |
85 case ERROR_INVALID_PARAMETER: // The parameter is incorrect. | 85 case ERROR_INVALID_PARAMETER: // The parameter is incorrect. |
86 return ERR_INVALID_ARGUMENT; | 86 return ERR_INVALID_ARGUMENT; |
87 case ERROR_BUFFER_OVERFLOW: // The file name is too long. | 87 case ERROR_BUFFER_OVERFLOW: // The file name is too long. |
88 return ERR_FILE_PATH_TOO_LONG; | 88 return ERR_FILE_PATH_TOO_LONG; |
89 case ERROR_DISK_FULL: // There is not enough space on the disk. | 89 case ERROR_DISK_FULL: // There is not enough space on the disk. |
90 return ERR_FILE_NO_SPACE; | 90 return ERR_FILE_NO_SPACE; |
91 case ERROR_CALL_NOT_IMPLEMENTED: // This function is not supported on | 91 case ERROR_CALL_NOT_IMPLEMENTED: // This function is not supported on |
92 return ERR_NOT_IMPLEMENTED; // this system. | 92 return ERR_NOT_IMPLEMENTED; // this system. |
93 case ERROR_INVALID_NAME: // The filename, directory name, or volume | 93 case ERROR_INVALID_NAME: // The filename, directory name, or volume |
94 return ERR_INVALID_ARGUMENT; // label syntax is incorrect. | 94 return ERR_INVALID_ARGUMENT; // label syntax is incorrect. |
95 case ERROR_DIR_NOT_EMPTY: // The directory is not empty. | 95 case ERROR_DIR_NOT_EMPTY: // The directory is not empty. |
96 return ERR_FAILED; | 96 return ERR_FAILED; |
97 case ERROR_BUSY: // The requested resource is in use. | 97 case ERROR_BUSY: // The requested resource is in use. |
98 return ERR_ACCESS_DENIED; | 98 return ERR_ACCESS_DENIED; |
99 case ERROR_ALREADY_EXISTS: // Cannot create a file when that file | 99 case ERROR_ALREADY_EXISTS: // Cannot create a file when that file |
100 return ERR_FILE_EXISTS; // already exists. | 100 return ERR_FILE_EXISTS; // already exists. |
101 case ERROR_FILENAME_EXCED_RANGE: // The filename or extension is too long. | 101 case ERROR_FILENAME_EXCED_RANGE: // The filename or extension is too long. |
102 return ERR_FILE_PATH_TOO_LONG; | 102 return ERR_FILE_PATH_TOO_LONG; |
103 case ERROR_FILE_TOO_LARGE: // The file size exceeds the limit allowed | 103 case ERROR_FILE_TOO_LARGE: // The file size exceeds the limit allowed |
104 return ERR_FILE_NO_SPACE; // and cannot be saved. | 104 return ERR_FILE_NO_SPACE; // and cannot be saved. |
105 case ERROR_VIRUS_INFECTED: // Operation failed because the file | 105 case ERROR_VIRUS_INFECTED: // Operation failed because the file |
106 return ERR_FILE_VIRUS_INFECTED; // contains a virus. | 106 return ERR_FILE_VIRUS_INFECTED; // contains a virus. |
107 case ERROR_IO_DEVICE: // The request could not be performed | 107 case ERROR_IO_DEVICE: // The request could not be performed |
108 return ERR_ACCESS_DENIED; // because of an I/O device error. | 108 return ERR_ACCESS_DENIED; // because of an I/O device error. |
109 case ERROR_POSSIBLE_DEADLOCK: // A potential deadlock condition has | 109 case ERROR_POSSIBLE_DEADLOCK: // A potential deadlock condition has |
110 return ERR_ACCESS_DENIED; // been detected. | 110 return ERR_ACCESS_DENIED; // been detected. |
111 case ERROR_BAD_DEVICE: // The specified device name is invalid. | 111 case ERROR_BAD_DEVICE: // The specified device name is invalid. |
112 return ERR_INVALID_ARGUMENT; | 112 return ERR_INVALID_ARGUMENT; |
113 case ERROR_BROKEN_PIPE: // Pipe is not connected. | 113 case ERROR_BROKEN_PIPE: // Pipe is not connected. |
114 return ERR_CONNECTION_RESET; | 114 return ERR_CONNECTION_RESET; |
115 | 115 |
116 case ERROR_SUCCESS: | 116 case ERROR_SUCCESS: |
117 return OK; | 117 return OK; |
118 default: | 118 default: |
119 LOG(WARNING) << "Unknown error " << os_error | 119 LOG(WARNING) << "Unknown error " << os_error |
120 << " mapped to net::ERR_FAILED"; | 120 << " mapped to net::ERR_FAILED"; |
121 return ERR_FAILED; | 121 return ERR_FAILED; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 } // namespace net | 125 } // namespace net |
OLD | NEW |