aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/lscript')
-rw-r--r--linden/indra/lscript/lscript_compile/indra.l9
-rw-r--r--linden/indra/lscript/lscript_compile/indra.y4
-rw-r--r--linden/indra/lscript/lscript_compile/lscript_bytecode.cpp5
-rw-r--r--linden/indra/lscript/lscript_execute/lscript_execute.cpp14
-rw-r--r--linden/indra/lscript/lscript_execute/lscript_readlso.cpp14
5 files changed, 38 insertions, 8 deletions
diff --git a/linden/indra/lscript/lscript_compile/indra.l b/linden/indra/lscript/lscript_compile/indra.l
index c219cec..0beffe5 100644
--- a/linden/indra/lscript/lscript_compile/indra.l
+++ b/linden/indra/lscript/lscript_compile/indra.l
@@ -1,3 +1,4 @@
1
1N [0-9] 2N [0-9]
2L [a-zA-Z_] 3L [a-zA-Z_]
3H [a-fA-F0-9] 4H [a-fA-F0-9]
@@ -41,6 +42,12 @@ void parse_string();
41#define YYLMAX 16384 42#define YYLMAX 16384
42#define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */ 43#define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */
43 44
45#ifdef ECHO
46#undef ECHO
47#endif
48
49#define ECHO do { } while (0)
50
44#if defined(__cplusplus) 51#if defined(__cplusplus)
45extern "C" { int yylex( void ); } 52extern "C" { int yylex( void ); }
46extern "C" { int yyparse( void ); } 53extern "C" { int yyparse( void ); }
@@ -750,7 +757,7 @@ BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE)
750 757
751S32 yywrap() 758S32 yywrap()
752{ 759{
753#ifdef FLEX_SCANNER 760#if defined(FLEX_SCANNER) && !defined(LL_WINDOWS)
754 // get gcc to stop complaining about lack of use of yyunput 761 // get gcc to stop complaining about lack of use of yyunput
755 (void) yyunput; 762 (void) yyunput;
756#endif 763#endif
diff --git a/linden/indra/lscript/lscript_compile/indra.y b/linden/indra/lscript/lscript_compile/indra.y
index c7a4fd6..49d0c38 100644
--- a/linden/indra/lscript/lscript_compile/indra.y
+++ b/linden/indra/lscript/lscript_compile/indra.y
@@ -15,6 +15,10 @@
15 #define getenv getenv_workaround 15 #define getenv getenv_workaround
16 #endif 16 #endif
17 17
18 #ifdef LL_WINDOWS
19 #pragma warning( disable : 4065 ) // warning: switch statement contains 'default' but no 'case' labels
20 #endif
21
18 #ifdef __cplusplus 22 #ifdef __cplusplus
19 } 23 }
20 #endif 24 #endif
diff --git a/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp b/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp
index a1ea22b..0d75eee 100644
--- a/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp
+++ b/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp
@@ -308,7 +308,10 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp)
308 set_register(mCompleteCode, LREG_TM, mTotalSize); 308 set_register(mCompleteCode, LREG_TM, mTotalSize);
309 309
310 310
311 fwrite(mCompleteCode, 1, mTotalSize, bcfp); 311 if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != mTotalSize)
312 {
313 llwarns << "Short write" << llendl;
314 }
312 } 315 }
313 else 316 else
314 { 317 {
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.cpp b/linden/indra/lscript/lscript_execute/lscript_execute.cpp
index 2f81416..9e8be15 100644
--- a/linden/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/linden/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -63,11 +63,19 @@ LLScriptExecute::LLScriptExecute(FILE *fp)
63 U8 sizearray[4]; 63 U8 sizearray[4];
64 S32 filesize; 64 S32 filesize;
65 S32 pos = 0; 65 S32 pos = 0;
66 fread(&sizearray, 1, 4, fp); 66 if (fread(&sizearray, 1, 4, fp) != 4)
67 filesize = bytestream2integer(sizearray, pos); 67 {
68 llwarns << "Short read" << llendl;
69 filesize = 0;
70 } else {
71 filesize = bytestream2integer(sizearray, pos);
72 }
68 mBuffer = new U8[filesize]; 73 mBuffer = new U8[filesize];
69 fseek(fp, 0, SEEK_SET); 74 fseek(fp, 0, SEEK_SET);
70 fread(mBuffer, 1, filesize, fp); 75 if (fread(mBuffer, 1, filesize, fp) != filesize)
76 {
77 llwarns << "Short read" << llendl;
78 }
71 fclose(fp); 79 fclose(fp);
72 80
73 init(); 81 init();
diff --git a/linden/indra/lscript/lscript_execute/lscript_readlso.cpp b/linden/indra/lscript/lscript_execute/lscript_readlso.cpp
index 077e47c..f84abc5 100644
--- a/linden/indra/lscript/lscript_execute/lscript_readlso.cpp
+++ b/linden/indra/lscript/lscript_execute/lscript_readlso.cpp
@@ -37,11 +37,19 @@ LLScriptLSOParse::LLScriptLSOParse(FILE *fp)
37 U8 sizearray[4]; 37 U8 sizearray[4];
38 S32 filesize; 38 S32 filesize;
39 S32 pos = 0; 39 S32 pos = 0;
40 fread(&sizearray, 1, 4, fp); 40 if (fread(&sizearray, 1, 4, fp) != 4)
41 filesize = bytestream2integer(sizearray, pos); 41 {
42 llwarns << "Short read" << llendl;
43 filesize = 0;
44 } else {
45 filesize = bytestream2integer(sizearray, pos);
46 }
42 mRawData = new U8[filesize]; 47 mRawData = new U8[filesize];
43 fseek(fp, 0, SEEK_SET); 48 fseek(fp, 0, SEEK_SET);
44 fread(mRawData, 1, filesize, fp); 49 if (fread(mRawData, 1, filesize, fp) != filesize)
50 {
51 llwarns << "Short read" << llendl;
52 }
45 53
46 initOpCodePrinting(); 54 initOpCodePrinting();
47} 55}