aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:04 -0500
committerJacek Antonelli2008-08-15 23:45:04 -0500
commit117e22047c5752352342d64e3fb7ce00a4eb8113 (patch)
treee32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/newview/llpreviewscript.cpp
parentSecond Life viewer sources 1.18.0.6 (diff)
downloadmeta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz
Second Life viewer sources 1.18.1.2
Diffstat (limited to 'linden/indra/newview/llpreviewscript.cpp')
-rw-r--r--linden/indra/newview/llpreviewscript.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp
index 9f3533e..a2ea141 100644
--- a/linden/indra/newview/llpreviewscript.cpp
+++ b/linden/indra/newview/llpreviewscript.cpp
@@ -1094,9 +1094,6 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect,
1094 1094
1095 gUICtrlFactory->buildFloater(this,"floater_script_preview.xml", &factory_map); 1095 gUICtrlFactory->buildFloater(this,"floater_script_preview.xml", &factory_map);
1096 1096
1097 moveResizeHandleToFront();
1098
1099
1100 const LLInventoryItem* item = getItem(); 1097 const LLInventoryItem* item = getItem();
1101 1098
1102 childSetCommitCallback("desc", LLPreview::onText, this); 1099 childSetCommitCallback("desc", LLPreview::onText, this);
@@ -1342,7 +1339,10 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename,
1342 LLString line; 1339 LLString line;
1343 while(!feof(fp)) 1340 while(!feof(fp))
1344 { 1341 {
1345 fgets(buffer, MAX_STRING, fp); 1342 if (fgets(buffer, MAX_STRING, fp) == NULL)
1343 {
1344 buffer[0] = '\0';
1345 }
1346 if(feof(fp)) 1346 if(feof(fp))
1347 { 1347 {
1348 break; 1348 break;
@@ -1617,8 +1617,6 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name,
1617 LLCallbackMap::map_t factory_map; 1617 LLCallbackMap::map_t factory_map;
1618 factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); 1618 factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
1619 1619
1620 moveResizeHandleToFront();
1621
1622 gUICtrlFactory->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); 1620 gUICtrlFactory->buildFloater(this,"floater_live_lsleditor.xml", &factory_map);
1623 1621
1624 1622
@@ -1849,12 +1847,16 @@ void LLLiveLSLEditor::loadScriptText(const char* filename)
1849 { 1847 {
1850 // read in the whole file 1848 // read in the whole file
1851 fseek(file, 0L, SEEK_END); 1849 fseek(file, 0L, SEEK_END);
1852 S32 file_length = ftell(file); 1850 long file_length = ftell(file);
1853 fseek(file, 0L, SEEK_SET); 1851 fseek(file, 0L, SEEK_SET);
1854 char* buffer = new char[file_length+1]; 1852 char* buffer = new char[file_length+1];
1855 fread(buffer, file_length, 1, file); 1853 size_t nread = fread(buffer, 1, file_length, file);
1854 if (nread < (size_t) file_length)
1855 {
1856 llwarns << "Short read" << llendl;
1857 }
1858 buffer[nread] = '\0';
1856 fclose(file); 1859 fclose(file);
1857 buffer[file_length] = 0;
1858 mScriptEd->mEditor->setText(buffer); 1860 mScriptEd->mEditor->setText(buffer);
1859 mScriptEd->mEditor->makePristine(); 1861 mScriptEd->mEditor->makePristine();
1860 delete[] buffer; 1862 delete[] buffer;
@@ -2049,6 +2051,13 @@ void LLLiveLSLEditor::saveIfNeeded()
2049 return; 2051 return;
2050 } 2052 }
2051 LLString utf8text = mScriptEd->mEditor->getText(); 2053 LLString utf8text = mScriptEd->mEditor->getText();
2054
2055 // Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889
2056 if ( utf8text.size() == 0 )
2057 {
2058 utf8text = " ";
2059 }
2060
2052 fputs(utf8text.c_str(), fp); 2061 fputs(utf8text.c_str(), fp);
2053 fclose(fp); 2062 fclose(fp);
2054 fp = NULL; 2063 fp = NULL;
@@ -2118,7 +2127,10 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
2118 while(!feof(fp)) 2127 while(!feof(fp))
2119 { 2128 {
2120 2129
2121 fgets(buffer, MAX_STRING, fp); 2130 if (fgets(buffer, MAX_STRING, fp) == NULL)
2131 {
2132 buffer[0] = '\0';
2133 }
2122 if(feof(fp)) 2134 if(feof(fp))
2123 { 2135 {
2124 break; 2136 break;