Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4940

value should inialization when defined

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Not A Problem
    • 0.13.0
    • 0.13.0
    • Compiler (General)
    • None
    • win7, visual studio 2015, thrift-master

    Description

      i debug the compiler in compiler\cpp\src\thrift\generate\main.cc line 169, values should inialization before beused. a little improvement i suggest.

      /**
       * Win32 doesn't have realpath, so use fallback implementation in that case,
       * otherwise this just calls through to realpath
       */
      char* saferealpath(const char* path, char* resolved_path) {
      #ifdef _WIN32
        char buf[MAX_PATH];
        char* basename;
        DWORD len = GetFullPathNameA(path, MAX_PATH, buf, &basename);
        if (len == 0 || len > MAX_PATH - 1) {
          strcpy(resolved_path, path);
        } else {
          strcpy(resolved_path, buf);
        }
      
        // Replace backslashes with forward slashes so the
        // rest of the code behaves correctly.
        size_t resolved_len = strlen(resolved_path);
        for (size_t i = 0; i < resolved_len; i++) {
          if (resolved_path[i] == '\\') {
            resolved_path[i] = '/';
          }
        }
        return resolved_path;
      #else
        return realpath(path, resolved_path);
      #endif
      }
      

      thanks.
      zhouhu.

      Attachments

        Issue Links

          Activity

            People

              jensg Jens Geyer
              pengzhouhu pengzhouhu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m