diff options
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llcamera.cpp | 16 | ||||
-rw-r--r-- | indra/llmath/llcoordframe.cpp | 16 | ||||
-rw-r--r-- | indra/llmath/llvolume.cpp | 61 | ||||
-rw-r--r-- | indra/llmath/llvolumemgr.cpp | 4 | ||||
-rw-r--r-- | indra/llmath/v3color.h | 6 |
5 files changed, 58 insertions, 45 deletions
diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp index 675659c68a..eaeb83f625 100644 --- a/indra/llmath/llcamera.cpp +++ b/indra/llmath/llcamera.cpp @@ -102,25 +102,25 @@ void LLCamera::setFar(F32 far_plane) size_t LLCamera::writeFrustumToBuffer(char *buffer) const { - memcpy(buffer, &mView, sizeof(F32)); + memcpy(buffer, &mView, sizeof(F32)); /* Flawfinder: ignore */ buffer += sizeof(F32); - memcpy(buffer, &mAspect, sizeof(F32)); + memcpy(buffer, &mAspect, sizeof(F32)); /* Flawfinder: ignore */ buffer += sizeof(F32); - memcpy(buffer, &mNearPlane, sizeof(F32)); + memcpy(buffer, &mNearPlane, sizeof(F32)); /* Flawfinder: ignore */ buffer += sizeof(F32); - memcpy(buffer, &mFarPlane, sizeof(F32)); + memcpy(buffer, &mFarPlane, sizeof(F32)); /* Flawfinder: ignore */ return 4*sizeof(F32); } size_t LLCamera::readFrustumFromBuffer(const char *buffer) { - memcpy(&mView, buffer, sizeof(F32)); + memcpy(&mView, buffer, sizeof(F32)); /* Flawfinder: ignore */ buffer += sizeof(F32); - memcpy(&mAspect, buffer, sizeof(F32)); + memcpy(&mAspect, buffer, sizeof(F32)); /* Flawfinder: ignore */ buffer += sizeof(F32); - memcpy(&mNearPlane, buffer, sizeof(F32)); + memcpy(&mNearPlane, buffer, sizeof(F32)); /* Flawfinder: ignore */ buffer += sizeof(F32); - memcpy(&mFarPlane, buffer, sizeof(F32)); + memcpy(&mFarPlane, buffer, sizeof(F32)); /* Flawfinder: ignore */ return 4*sizeof(F32); } diff --git a/indra/llmath/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp index c8b69e57cd..ae20c9e6d7 100644 --- a/indra/llmath/llcoordframe.cpp +++ b/indra/llmath/llcoordframe.cpp @@ -441,26 +441,26 @@ void LLCoordFrame::getRotMatrixToParent(LLMatrix4& mat) const size_t LLCoordFrame::writeOrientation(char *buffer) const { - memcpy(buffer, mOrigin.mV, 3*sizeof(F32)); + memcpy(buffer, mOrigin.mV, 3*sizeof(F32)); /*Flawfinder: ignore */ buffer += 3*sizeof(F32); - memcpy(buffer, mXAxis.mV, 3*sizeof(F32)); + memcpy(buffer, mXAxis.mV, 3*sizeof(F32)); /*Flawfinder: ignore */ buffer += 3*sizeof(F32); - memcpy(buffer, mYAxis.mV, 3*sizeof(F32)); + memcpy(buffer, mYAxis.mV, 3*sizeof(F32));/*Flawfinder: ignore */ buffer += 3*sizeof(F32); - memcpy(buffer, mZAxis.mV, 3*sizeof(F32)); + memcpy(buffer, mZAxis.mV, 3*sizeof(F32)); /*Flawfinder: ignore */ return 12*sizeof(F32); } size_t LLCoordFrame::readOrientation(const char *buffer) { - memcpy(mOrigin.mV, buffer, 3*sizeof(F32)); + memcpy(mOrigin.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */ buffer += 3*sizeof(F32); - memcpy(mXAxis.mV, buffer, 3*sizeof(F32)); + memcpy(mXAxis.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */ buffer += 3*sizeof(F32); - memcpy(mYAxis.mV, buffer, 3*sizeof(F32)); + memcpy(mYAxis.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */ buffer += 3*sizeof(F32); - memcpy(mZAxis.mV, buffer, 3*sizeof(F32)); + memcpy(mZAxis.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */ if( !isFinite() ) { diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 0f8adb2f5c..75e4042f07 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -705,11 +705,11 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split) BOOL LLProfileParams::importFile(FILE *fp) { const S32 BUFSIZE = 16384; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; /* Flawfinder: ignore */ // *NOTE: changing the size or type of these buffers will require // changing the sscanf below. - char keyword[256]; - char valuestr[256]; + char keyword[256]; /* Flawfinder: ignore */ + char valuestr[256]; /* Flawfinder: ignore */ keyword[0] = 0; valuestr[0] = 0; F32 tempF32; @@ -718,7 +718,10 @@ BOOL LLProfileParams::importFile(FILE *fp) while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %255s %255s", keyword, valuestr); + sscanf( /* Flawfinder: ignore */ + buffer, + " %255s %255s", + keyword, valuestr); if (!keyword) { continue; @@ -777,11 +780,11 @@ BOOL LLProfileParams::exportFile(FILE *fp) const BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) { const S32 BUFSIZE = 16384; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; /* Flawfinder: ignore */ // *NOTE: changing the size or type of these buffers will require // changing the sscanf below. - char keyword[256]; - char valuestr[256]; + char keyword[256]; /* Flawfinder: ignore */ + char valuestr[256]; /* Flawfinder: ignore */ keyword[0] = 0; valuestr[0] = 0; F32 tempF32; @@ -790,7 +793,11 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %255s %255s", keyword, valuestr); + sscanf( /* Flawfinder: ignore */ + buffer, + " %255s %255s", + keyword, + valuestr); if (!keyword) { continue; @@ -1199,11 +1206,11 @@ BOOL LLDynamicPath::generate(F32 detail, S32 split) BOOL LLPathParams::importFile(FILE *fp) { const S32 BUFSIZE = 16384; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; /* Flawfinder: ignore */ // *NOTE: changing the size or type of these buffers will require // changing the sscanf below. - char keyword[256]; - char valuestr[256]; + char keyword[256]; /* Flawfinder: ignore */ + char valuestr[256]; /* Flawfinder: ignore */ keyword[0] = 0; valuestr[0] = 0; @@ -1214,7 +1221,10 @@ BOOL LLPathParams::importFile(FILE *fp) while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %255s %255s", keyword, valuestr); + sscanf( /* Flawfinder: ignore */ + buffer, + " %255s %255s", + keyword, valuestr); if (!keyword) { continue; @@ -1340,11 +1350,11 @@ BOOL LLPathParams::exportFile(FILE *fp) const BOOL LLPathParams::importLegacyStream(std::istream& input_stream) { const S32 BUFSIZE = 16384; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; /* Flawfinder: ignore */ // *NOTE: changing the size or type of these buffers will require // changing the sscanf below. - char keyword[256]; - char valuestr[256]; + char keyword[256]; /* Flawfinder: ignore */ + char valuestr[256]; /* Flawfinder: ignore */ keyword[0] = 0; valuestr[0] = 0; @@ -1355,7 +1365,10 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %255s %255s", keyword, valuestr); + sscanf( /* Flawfinder: ignore */ + buffer, + " %255s %255s", + keyword, valuestr); if (!keyword) { continue; @@ -2166,7 +2179,7 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const size_s_out = getProfile().getTotalOut(); size_t = getPath().mPath.size(); - if (open) + if (open) /* Flawfinder: ignore */ { if (hollow) { @@ -2788,7 +2801,7 @@ noindices: return NULL; } num_indices = count; - memcpy(indices, index, count * sizeof(S32)); + memcpy(indices, index, count * sizeof(S32)); /* Flawfinder: ignore */ return indices; } @@ -3291,7 +3304,7 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices, *output_triangles = new S32[cur_tri*3]; num_output_triangles = cur_tri; - memcpy(*output_triangles, sorted_tris, 3*cur_tri*sizeof(S32)); + memcpy(*output_triangles, sorted_tris, 3*cur_tri*sizeof(S32)); /* Flawfinder: ignore */ /* llinfos << "Out vertices: " << num_output_vertices << llendl; @@ -3328,16 +3341,16 @@ BOOL LLVolumeParams::importFile(FILE *fp) { //llinfos << "importing volume" << llendl; const S32 BUFSIZE = 16384; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; /* Flawfinder: ignore */ // *NOTE: changing the size or type of this buffer will require // changing the sscanf below. - char keyword[256]; + char keyword[256]; /* Flawfinder: ignore */ keyword[0] = 0; while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %255s", keyword); + sscanf(buffer, " %255s", keyword); /* Flawfinder: ignore */ if (!keyword) { continue; @@ -3384,8 +3397,8 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) const S32 BUFSIZE = 16384; // *NOTE: changing the size or type of this buffer will require // changing the sscanf below. - char buffer[BUFSIZE]; - char keyword[256]; + char buffer[BUFSIZE]; /* Flawfinder: ignore */ + char keyword[256]; /* Flawfinder: ignore */ keyword[0] = 0; while (input_stream.good()) diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 54be916c12..0e41d110fc 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -267,7 +267,7 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail) F32 LLVolumeLODGroup::dump() { - char dump_str[255]; + char dump_str[255]; /* Flawfinder: ignore */ F32 usage = 0.f; for (S32 i = 0; i < NUM_LODS; i++) { @@ -278,7 +278,7 @@ F32 LLVolumeLODGroup::dump() } usage = usage / (F32)NUM_LODS; - sprintf(dump_str, "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); + snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); /* Flawfinder: ignore */ llinfos << dump_str << llendl; return usage; diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index 3777c00054..956cca614d 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -147,7 +147,7 @@ inline LLColor3::LLColor3(const F32 *vec) inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF { - if (strlen(color_string) < 6) + if (strlen(color_string) < 6) /* Flawfinder: ignore */ { mV[0] = 0.f; mV[1] = 0.f; @@ -155,8 +155,8 @@ inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGB return; } - static char tempstr[7]; - strncpy(tempstr,color_string,6); + static char tempstr[7]; /* Flawfinder: ignore */ + strncpy(tempstr,color_string,6); /* Flawfinder: ignore */ tempstr[6] = '\0'; mV[VZ] = (F32)strtol(&tempstr[4],NULL,16)/255.f; tempstr[4] = '\0'; |