~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/io/filesystem/filesystem.cc

  • Committer: The Widelands Bunnybot
  • Date: 2020-10-18 05:24:54 UTC
  • Revision ID: bunnybot@widelands.org-20201018052454-rm67qrulpbynp0l5
Fix simple cppcheck issues (#4355)

(by gunchleoc)
870c1e137dd3dd6a61306a16e894f8aa54f20b2f

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <cassert>
25
25
#include <cstdlib>
26
26
#include <list>
 
27
#include <string>
27
28
#ifdef _WIN32
28
29
#include <cstdio>
29
30
#endif
390
391
 */
391
392
std::vector<std::string> FileSystem::get_xdgdatadirs() {
392
393
        std::vector<std::string> xdgdatadirs;
393
 
        const char* environment_char;
 
394
        const char* environment_char = nullptr;
394
395
#ifdef HAS_GETENV
395
396
        environment_char = getenv("XDG_DATA_DIRS");
396
397
#endif
459
460
        std::string::size_type pos2;  //  next filesep character
460
461
 
461
462
        // Extract the first path component
462
 
        if (path.find(filesep) == 0) {  // Is this an absolute path?
 
463
        if (path.front() == filesep) {  // Is this an absolute path?
463
464
                pos = 1;
464
465
        } else {  // Relative path
465
466
                pos = 0;