aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/mac_updater/mac_updater.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/mac_updater/mac_updater.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/mac_updater/mac_updater.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/linden/indra/mac_updater/mac_updater.cpp b/linden/indra/mac_updater/mac_updater.cpp
index 2061ab4..d05b73f 100644
--- a/linden/indra/mac_updater/mac_updater.cpp
+++ b/linden/indra/mac_updater/mac_updater.cpp
@@ -67,7 +67,7 @@ Boolean gCancelled = false;
67 67
68char *gUserServer; 68char *gUserServer;
69char *gProductName; 69char *gProductName;
70char gUpdateURL[2048]; 70char gUpdateURL[2048]; /* Flawfinder: ignore */
71 71
72void *updatethreadproc(void*); 72void *updatethreadproc(void*);
73 73
@@ -381,7 +381,7 @@ int main(int argc, char **argv)
381 llinfos << "Starting " << gProductName << " Updater" << llendl; 381 llinfos << "Starting " << gProductName << " Updater" << llendl;
382 382
383 // Build the URL to download the update 383 // Build the URL to download the update
384 snprintf(gUpdateURL, sizeof(gUpdateURL), "http://secondlife.com/update-macos.php?userserver=%s", gUserServer); 384 snprintf(gUpdateURL, sizeof(gUpdateURL), "http://secondlife.com/update-macos.php?userserver=%s", gUserServer); /* Flawfinder: ignore */
385 385
386 // Real UI... 386 // Real UI...
387 OSStatus err; 387 OSStatus err;
@@ -389,8 +389,8 @@ int main(int argc, char **argv)
389 389
390 err = CreateNibReference(CFSTR("AutoUpdater"), &nib); 390 err = CreateNibReference(CFSTR("AutoUpdater"), &nib);
391 391
392 char windowTitle[MAX_PATH]; 392 char windowTitle[MAX_PATH]; /* Flawfinder: ignore */
393 snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName); 393 snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName); /* Flawfinder: ignore */
394 CFStringRef windowTitleRef = NULL; 394 CFStringRef windowTitleRef = NULL;
395 windowTitleRef = CFStringCreateWithCString(NULL, windowTitle, kCFStringEncodingUTF8); 395 windowTitleRef = CFStringCreateWithCString(NULL, windowTitle, kCFStringEncodingUTF8);
396 396
@@ -507,7 +507,7 @@ bool isDirWritable(FSRef &dir)
507 // This is kinda lame, but will pretty much always give the right answer. 507 // This is kinda lame, but will pretty much always give the right answer.
508 508
509 OSStatus err = noErr; 509 OSStatus err = noErr;
510 char temp[PATH_MAX]; 510 char temp[PATH_MAX]; /* Flawfinder: ignore */
511 511
512 err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp)); 512 err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp));
513 513
@@ -557,15 +557,15 @@ static void utf8str_to_HFSUniStr255(HFSUniStr255 *dest, const char* src)
557 // Truncate to avoid stack smaching or other badness. 557 // Truncate to avoid stack smaching or other badness.
558 dest->length = 255; 558 dest->length = 255;
559 } 559 }
560 memcpy(dest->unicode, utf16str.data(), sizeof(UniChar)* dest->length); 560 memcpy(dest->unicode, utf16str.data(), sizeof(UniChar)* dest->length); /* Flawfinder: ignore */
561} 561}
562 562
563int restoreObject(const char* aside, const char* target, const char* path, const char* object) 563int restoreObject(const char* aside, const char* target, const char* path, const char* object)
564{ 564{
565 char source[PATH_MAX]; 565 char source[PATH_MAX]; /* Flawfinder: ignore */
566 char dest[PATH_MAX]; 566 char dest[PATH_MAX]; /* Flawfinder: ignore */
567 snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object); 567 snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object); /* Flawfinder: ignore */
568 snprintf(dest, sizeof(dest), "%s/%s", target, path); 568 snprintf(dest, sizeof(dest), "%s/%s", target, path); /* Flawfinder: ignore */
569 FSRef sourceRef; 569 FSRef sourceRef;
570 FSRef destRef; 570 FSRef destRef;
571 OSStatus err; 571 OSStatus err;
@@ -597,28 +597,28 @@ int restoreObject(const char* aside, const char* target, const char* path, const
597// Replace any mention of "Second Life" with the product name. 597// Replace any mention of "Second Life" with the product name.
598void filterFile(const char* filename) 598void filterFile(const char* filename)
599{ 599{
600 char temp[PATH_MAX]; 600 char temp[PATH_MAX]; /* Flawfinder: ignore */
601 // First copy the target's version, so we can run it through sed. 601 // First copy the target's version, so we can run it through sed.
602 snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename); 602 snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename); /* Flawfinder: ignore */
603 system(temp); 603 system(temp); /* Flawfinder: ignore */
604 604
605 // Now run it through sed. 605 // Now run it through sed.
606 snprintf(temp, sizeof(temp), 606 snprintf(temp, sizeof(temp), /* Flawfinder: ignore */
607 "sed 's/Second Life/%s/g' '%s.tmp' > '%s'", gProductName, filename, filename); 607 "sed 's/Second Life/%s/g' '%s.tmp' > '%s'", gProductName, filename, filename);
608 system(temp); 608 system(temp); /* Flawfinder: ignore */
609} 609}
610 610
611void *updatethreadproc(void*) 611void *updatethreadproc(void*)
612{ 612{
613 char tempDir[PATH_MAX] = ""; 613 char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */
614 FSRef tempDirRef; 614 FSRef tempDirRef;
615 char temp[PATH_MAX]; 615 char temp[PATH_MAX]; /* Flawfinder: ignore */
616 // *NOTE: This buffer length is used in a scanf() below. 616 // *NOTE: This buffer length is used in a scanf() below.
617 char deviceNode[1024] = ""; 617 char deviceNode[1024] = ""; /* Flawfinder: ignore */
618 FILE *downloadFile = NULL; 618 FILE *downloadFile = NULL;
619 OSStatus err; 619 OSStatus err;
620 ProcessSerialNumber psn; 620 ProcessSerialNumber psn;
621 char target[PATH_MAX]; 621 char target[PATH_MAX]; /* Flawfinder: ignore */
622 FSRef targetRef; 622 FSRef targetRef;
623 FSRef targetParentRef; 623 FSRef targetParentRef;
624 FSVolumeRefNum targetVol; 624 FSVolumeRefNum targetVol;
@@ -759,7 +759,7 @@ void *updatethreadproc(void*)
759 throw 0; 759 throw 0;
760 } 760 }
761 761
762 snprintf(target, sizeof(target), "/Applications/%s.app", gProductName); 762 snprintf(target, sizeof(target), "/Applications/%s.app", gProductName); /* Flawfinder: ignore */
763 763
764 memset(&targetRef, 0, sizeof(targetRef)); 764 memset(&targetRef, 0, sizeof(targetRef));
765 err = FSPathMakeRef((UInt8*)target, &targetRef, NULL); 765 err = FSPathMakeRef((UInt8*)target, &targetRef, NULL);
@@ -844,7 +844,7 @@ void *updatethreadproc(void*)
844 throw 0; 844 throw 0;
845 } 845 }
846 846
847 strcpy(tempDir, temp); 847 strcpy(tempDir, temp); /* Flawfinder: ignore */
848 848
849 llinfos << "tempDir is " << tempDir << llendl; 849 llinfos << "tempDir is " << tempDir << llendl;
850 850
@@ -855,9 +855,9 @@ void *updatethreadproc(void*)
855 855
856 chdir(tempDir); 856 chdir(tempDir);
857 857
858 snprintf(temp, sizeof(temp), "SecondLife.dmg"); 858 snprintf(temp, sizeof(temp), "SecondLife.dmg"); /* Flawfinder: ignore */
859 859
860 downloadFile = fopen(temp, "wb"); 860 downloadFile = fopen(temp, "wb"); /* Flawfinder: ignore */
861 if(downloadFile == NULL) 861 if(downloadFile == NULL)
862 { 862 {
863 throw 0; 863 throw 0;
@@ -902,7 +902,7 @@ void *updatethreadproc(void*)
902 // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, 902 // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder,
903 // but if our cleanup fails, this makes it much harder for the user to unmount the image. 903 // but if our cleanup fails, this makes it much harder for the user to unmount the image.
904 LLString mountOutput; 904 LLString mountOutput;
905 FILE *mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); 905 FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); /* Flawfinder: ignore */
906 906
907 if(mounter == NULL) 907 if(mounter == NULL)
908 { 908 {
@@ -937,8 +937,8 @@ void *updatethreadproc(void*)
937 937
938 if(sub != NULL) 938 if(sub != NULL)
939 { 939 {
940 sub += strlen(prefix); 940 sub += strlen(prefix); /* Flawfinder: ignore */
941 sscanf(sub, "%1023s", deviceNode); 941 sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */
942 } 942 }
943 } 943 }
944 944
@@ -953,7 +953,7 @@ void *updatethreadproc(void*)
953 953
954 // Get an FSRef to the new application on the disk image 954 // Get an FSRef to the new application on the disk image
955 FSRef sourceRef; 955 FSRef sourceRef;
956 snprintf(temp, sizeof(temp), "%s/mnt/Second Life.app", tempDir); 956 snprintf(temp, sizeof(temp), "%s/mnt/Second Life.app", tempDir); /* Flawfinder: ignore */
957 957
958 llinfos << "Source application is: " << temp << llendl; 958 llinfos << "Source application is: " << temp << llendl;
959 959
@@ -962,7 +962,7 @@ void *updatethreadproc(void*)
962 throw 0; 962 throw 0;
963 963
964 FSRef asideRef; 964 FSRef asideRef;
965 char aside[MAX_PATH]; 965 char aside[MAX_PATH]; /* Flawfinder: ignore */
966 966
967 // this will hold the name of the destination target 967 // this will hold the name of the destination target
968 HFSUniStr255 appNameUniStr; 968 HFSUniStr255 appNameUniStr;
@@ -985,8 +985,8 @@ void *updatethreadproc(void*)
985 else 985 else
986 { 986 {
987 // Construct the name of the target based on the product name 987 // Construct the name of the target based on the product name
988 char appName[MAX_PATH]; 988 char appName[MAX_PATH]; /* Flawfinder: ignore */
989 snprintf(appName, sizeof(appName), "%s.app", gProductName); 989 snprintf(appName, sizeof(appName), "%s.app", gProductName); /* Flawfinder: ignore */
990 utf8str_to_HFSUniStr255( &appNameUniStr, appName ); 990 utf8str_to_HFSUniStr255( &appNameUniStr, appName );
991 } 991 }
992 992
@@ -1034,8 +1034,8 @@ void *updatethreadproc(void*)
1034 1034
1035 llinfos << "Clearing cache..." << llendl; 1035 llinfos << "Clearing cache..." << llendl;
1036 1036
1037 char mask[LL_MAX_PATH]; 1037 char mask[LL_MAX_PATH]; /* Flawfinder: ignore */
1038 sprintf(mask, "%s*.*", gDirUtilp->getDirDelimiter().c_str()); 1038 snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str()); /* Flawfinder: ignore */
1039 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); 1039 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask);
1040 1040
1041 llinfos << "Clear complete." << llendl; 1041 llinfos << "Clear complete." << llendl;
@@ -1067,8 +1067,8 @@ void *updatethreadproc(void*)
1067 { 1067 {
1068 llinfos << "Detaching disk image." << llendl; 1068 llinfos << "Detaching disk image." << llendl;
1069 1069
1070 snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode); 1070 snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode); /* Flawfinder: ignore */
1071 system(temp); 1071 system(temp); /* Flawfinder: ignore */
1072 } 1072 }
1073 1073
1074 sendProgress(2, 3); 1074 sendProgress(2, 3);
@@ -1092,13 +1092,13 @@ void *updatethreadproc(void*)
1092 { 1092 {
1093 llinfos << "Touching application bundle." << llendl; 1093 llinfos << "Touching application bundle." << llendl;
1094 1094
1095 snprintf(temp, sizeof(temp), "touch '%s'", target); 1095 snprintf(temp, sizeof(temp), "touch '%s'", target); /* Flawfinder: ignore */
1096 system(temp); 1096 system(temp); /* Flawfinder: ignore */
1097 1097
1098 llinfos << "Launching updated application." << llendl; 1098 llinfos << "Launching updated application." << llendl;
1099 1099
1100 snprintf(temp, sizeof(temp), "open '%s'", target); 1100 snprintf(temp, sizeof(temp), "open '%s'", target); /* Flawfinder: ignore */
1101 system(temp); 1101 system(temp); /* Flawfinder: ignore */
1102 } 1102 }
1103 1103
1104 sendDone(); 1104 sendDone();