src/windows/native/java/io/canonicalize_md.c
int
canonicalizeWithPrefix(char* canonicalPrefix, char* pathWithCanonicalPrefix, char *result, int size)
{
    WIN32_FIND_DATA fd;
    HANDLE h;
    char *src, *dst, *dend;

    src = pathWithCanonicalPrefix;
    dst = result;        /* Place results here */
    dend = dst + size;   /* Don't go to or past here */

    h = FindFirstFile(pathWithCanonicalPrefix, &fd);    /* Look up file */
    if (h != INVALID_HANDLE_VALUE) {
        /* Lookup succeeded; concatenate true name to prefix */
        FindClose(h);
        if (!(dst = cp(dst, dend, '\0',
                       canonicalPrefix,
                       canonicalPrefix + strlen(canonicalPrefix)))) {
            return -1;
        }
        if (!(dst = cp(dst, dend, '\\',
                       fd.cFileName,
                       fd.cFileName + strlen(fd.cFileName)))) {
            return -1;
        }
    } else {
        if (!lastErrorReportable()) {
            if (!(dst = cp(dst, dend, '\0', src, src + strlen(src)))) {
                return -1;
            }
        } else {
            return -1;
        }
    }

    if (dst >= dend) {
        errno = ENAMETOOLONG;
        return -1;
    }
    *dst = '\0';
    return 0;
}
/* Convert a pathname to canonical form.  The input prefix is assumed
   to be in canonical form already, and the trailing filename must not
   contain any wildcard, dot/double dot, or other "tricky" characters
   that are rejected by the canonicalize() routine above.  This
   routine is present to allow the canonicalization prefix cache to be
   used while still returning canonical names with the correct
   capitalization. */
Convert a pathname to canonical form.  The input prefix is assumed
to be in canonical form already, and the trailing filename must not
contain any wildcard, dot/double dot, or other "tricky" characters
that are rejected by the canonicalize() routine above.  This
routine is present to allow the canonicalization prefix cache to be
used while still returning canonical names with the correct
capitalization.
Convert a pathname to canonical form . The input prefix is assumed to be in canonical form already and the trailing filename must not contain any wildcard dot / double dot or other " tricky " characters that are rejected by the canonicalize () routine above . This routine is present to allow the canonicalization prefix cache to be used while still returning canonical names with the correct capitalization .
int
canonicalizeWithPrefix(char* canonicalPrefix, char* pathWithCanonicalPrefix, char *result, int size)
{
    WIN32_FIND_DATA fd;
    HANDLE h;
    char *src, *dst, *dend;
    src = pathWithCanonicalPrefix;
    dst = result;        
    dend = dst + size;   
    h = FindFirstFile(pathWithCanonicalPrefix, &fd);    
    if (h != INVALID_HANDLE_VALUE) {
        FindClose(h);
        if (!(dst = cp(dst, dend, '\0',
                       canonicalPrefix,
                       canonicalPrefix + strlen(canonicalPrefix)))) {
            return -1;
        }
        if (!(dst = cp(dst, dend, '\\',
                       fd.cFileName,
                       fd.cFileName + strlen(fd.cFileName)))) {
            return -1;
        }
    } else {
        if (!lastErrorReportable()) {
            if (!(dst = cp(dst, dend, '\0', src, src + strlen(src)))) {
                return -1;
            }
        } else {
            return -1;
        }
    }
    if (dst >= dend) {
        errno = ENAMETOOLONG;
        return -1;
    }
    *dst = '\0';
    return 0;
}
int canonicalizeWithPrefix ( char * canonicalPrefix , char * pathWithCanonicalPrefix , char * result , int size ) { WIN32_FIND_DATA fd ; HANDLE h ; char * src , * dst , * dend ; src = pathWithCanonicalPrefix ; dst = result ; dend = dst + size ; h = FindFirstFile ( pathWithCanonicalPrefix , & fd ) ; if ( h != INVALID_HANDLE_VALUE ) { FindClose ( h ) ; if ( ! ( dst = cp ( dst , dend , ' \0 ' , canonicalPrefix , canonicalPrefix + strlen ( canonicalPrefix ) ) ) ) { return -1 ; } if ( ! ( dst = cp ( dst , dend , ' \\ ' , fd . cFileName , fd . cFileName + strlen ( fd . cFileName ) ) ) ) { return -1 ; } } else { if ( ! lastErrorReportable ( ) ) { if ( ! ( dst = cp ( dst , dend , ' \0 ' , src , src + strlen ( src ) ) ) ) { return -1 ; } } else { return -1 ; } } if ( dst >= dend ) { errno = ENAMETOOLONG ; return -1 ; } * dst = ' \0 ' ; return 0 ; }
Convert a pathname to canonical form.
Convert a pathname to canonical form .
/* Place results here */ /* Don't go to or past here */ /* Look up file */ /* Lookup succeeded; concatenate true name to prefix */