| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/nix/mime_util_xdg.h" | 5 #include "base/nix/mime_util_xdg.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 if (size + info->threshold < info->size) | 337 if (size + info->threshold < info->size) |
| 338 return info->size - size - info->threshold; | 338 return info->size - size - info->threshold; |
| 339 if (size > info->size + info->threshold) | 339 if (size > info->size + info->threshold) |
| 340 return size - info->size - info->threshold; | 340 return size - info->size - info->threshold; |
| 341 return 0; | 341 return 0; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 std::string IconTheme::ReadLine(FILE* fp) { | 345 std::string IconTheme::ReadLine(FILE* fp) { |
| 346 if (!fp) | 346 if (!fp) |
| 347 return ""; | 347 return std::string(); |
| 348 | 348 |
| 349 std::string result = ""; | 349 std::string result; |
| 350 const size_t kBufferSize = 100; | 350 const size_t kBufferSize = 100; |
| 351 char buffer[kBufferSize]; | 351 char buffer[kBufferSize]; |
| 352 while ((fgets(buffer, kBufferSize - 1, fp)) != NULL) { | 352 while ((fgets(buffer, kBufferSize - 1, fp)) != NULL) { |
| 353 result += buffer; | 353 result += buffer; |
| 354 size_t len = result.length(); | 354 size_t len = result.length(); |
| 355 if (len == 0) | 355 if (len == 0) |
| 356 break; | 356 break; |
| 357 char end = result[len - 1]; | 357 char end = result[len - 1]; |
| 358 if (end == '\n' || end == '\0') | 358 if (end == '\n' || end == '\0') |
| 359 break; | 359 break; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 icon_file = LookupIconInDefaultTheme(icon_names[i], size); | 646 icon_file = LookupIconInDefaultTheme(icon_names[i], size); |
| 647 if (!icon_file.empty()) | 647 if (!icon_file.empty()) |
| 648 return icon_file; | 648 return icon_file; |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 return FilePath(); | 651 return FilePath(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 } // namespace nix | 654 } // namespace nix |
| 655 } // namespace base | 655 } // namespace base |
| OLD | NEW |