source: trunk/dports/aqua/launch/files/patch-main.c.diff @ 104672

Last change on this file since 104672 was 104672, checked in by ryandesign@…, 8 years ago

launch: fix building on OS X 10.8 and later by applying upstream revision 651 to remove an obsolete error code constant (#38600) and also fix a buffer overflow; apply upstream revision 314 to handle new error codes used by OS X 10.4 and later; use unversioned docdir; rename patch file

File size: 4.2 KB
  • main.c

    old new  
    6969
    7070static errList ERRS = {
    7171    // Launch Services errors
     72    { kLSAppInTrashErr, "application is in the Trash" },
     73    { kLSExecutableIncorrectFormat, "executable is unsupported on this processor architecture" },
    7274    { kLSUnknownErr, "unknown Launch Services error" },
    73     { kLSApplicationNotFoundErr, "application not found" },
     75    { kLSNotAnApplicationErr, "item is not an application" },
     76    { kLSDataUnavailableErr, "item metadata is unavailable" },
     77    { kLSApplicationNotFoundErr, "application not found for document" },
     78    { kLSUnknownTypeErr, "cannot determine item kind" },
    7479    { kLSLaunchInProgressErr, "application is being opened; please try again after the application is open" },
    75     { kLSNotRegisteredErr, "application not registered in Launch Services database" },
     80    { kLSServerCommunicationErr, "unable to connect to Launch Services.\nAre you logged in?" },
     81    { kLSIncompatibleSystemVersionErr, "application is incompatible with this version of Mac OS X" },
     82    { kLSNoLaunchPermissionErr, "no permission to launch this application", },
    7683    { kLSNoExecutableErr, "application package contains no executable, or an unusable executable" },
    7784    { kLSNoClassicEnvironmentErr, "Classic environment required but not available" },
    7885    { kLSMultipleSessionsNotSupportedErr, "unable to launch multiple instances of application" },
     
    8996    { nsvErr, "the volume cannot be found (buggy filesystem?)" },
    9097    { procNotFound, "unable to connect to system service.\nAre you logged in?" },
    9198    { kCGErrorIllegalArgument, "window server error.\nAre you logged in?" },
    92     { kCGErrorApplicationRequiresNewerSystem, "application requires a newer Mac OS X version" },
    9399    { fnfErr, "file not found" },
    94100    { 0, NULL }
    95101};
     
    147153    len = strlen(errDesc) + 10 * sizeof(char);
    148154    str = (char *)malloc(len);
    149155    if (str != NULL)
    150         snprintf(str, len, "%s (%ld)", errDesc, err);
     156        snprintf(str, len, "%s (%d)", errDesc, (int)err);
    151157    else
    152158        str = failedStr;
    153159    return str;
     
    580586    if (bigSize == 0) {
    581587        if (littleSize == 0) {
    582588            printf("zero bytes on disk (zero bytes used)\n"); return;
    583         } else if (littleSize < 1024) printf("%lu bytes", littleSize);
     589        } else if (littleSize < 1024) printf("%u bytes", (unsigned int)littleSize);
    584590        else {
    585591            UInt32 adjSize = littleSize >> 10;
    586592            if (adjSize < 1024) printf("%.1f KB", DFORMAT(littleSize));
     
    594600            }
    595601        }
    596602    } else {
    597         if (bigSize < 256) printf("%lu GB", bigSize);
     603        if (bigSize < 256) printf("%u GB", (unsigned int)bigSize);
    598604        else {
    599605            bigSize >>= 2;
    600             printf("%lu TB", bigSize);
     606            printf("%u TB", (unsigned int)bigSize);
    601607        }
    602608    }
    603609    printf(" on disk (%llu bytes used)\n", logicalSize);
     
    616622        switch (fscInfo.valence) {
    617623        case 0: printf("zero items\n"); break;
    618624        case 1: printf("1 item\n"); break;
    619         default: printf("%lu items\n", fscInfo.valence);
     625        default: printf("%u items\n", (unsigned int)fscInfo.valence);
    620626        }
    621627    } else {
    622628        printSizes("data fork size", fscInfo.dataLogicalSize, fscInfo.dataPhysicalSize, true);
     
    651657    CFStringRef typeStr = CFStringCreateWithBytes(NULL, (UInt8 *)&osType, 4, CFStringGetSystemEncoding(), false);
    652658    if (typeStr == NULL) {
    653659        // punt to displaying verbatim
    654         static char tmpBuffer[4];
     660        static char tmpBuffer[5];
    655661        tmpBuffer[4] = '\0';
    656662        strncpy(tmpBuffer, (const char *)&osType, 4);
    657663        return tmpBuffer;
     
    735741            printf("unknown (cputype %d, subtype %d)", fat[i].cputype, fat[i].cpusubtype);
    736742            continue;
    737743        }
    738         printf(arch->description);
     744        printf("%s", arch->description);
    739745    }
    740746    printf("\n");
    741747}
     
    880886
    881887        if (version != NULL) {
    882888            printf("\tversion: %s", utf8StringFromCFStringRef(version));
    883             if (intVersion != 0) printf(" [0x%lx = %lu]", intVersion, intVersion);
     889            if (intVersion != 0) printf(" [0x%x = %u]", (unsigned int)intVersion, (unsigned int)intVersion);
    884890            putchar('\n');
    885891            CFRelease(version);
    886892        }
Note: See TracBrowser for help on using the repository browser.