MCPcopy Create free account
hub / github.com/LAStools/LAStools / add_appendix

Method add_appendix

LASlib/src/laswriter.cpp:1262–1284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1260}
1261
1262void LASwriteOpener::add_appendix(const CHAR* appendix)
1263{
1264 if (appendix == 0) appendix = this->appendix;
1265
1266 if (file_name && appendix)
1267 {
1268 I32 len = (I32)strlen(file_name);
1269 CHAR* new_file_name = (CHAR*)malloc_las(len + strlen(appendix) + 5);
1270 while ((len > 0) && (file_name[len] != '.') && (file_name[len] != '\\') && (file_name[len] != '/') && (file_name[len] != ':')) len--;
1271
1272 if ((len == 0) || (file_name[len] == '\\') || (file_name[len] == '/') || (file_name[len] == ':'))
1273 {
1274 snprintf(new_file_name, strlen(appendix) + 5, "%s%s", file_name, appendix);
1275 }
1276 else if (new_file_name)
1277 {
1278 strncpy_las(new_file_name, len + strlen(appendix) + 5, file_name, len);
1279 snprintf(&(new_file_name[len]), len + strlen(appendix) + 5, "%s%s", appendix, &(file_name[len]));
1280 }
1281 free(file_name);
1282 file_name = new_file_name;
1283 }
1284}
1285
1286#ifdef __GNUC__
1287#pragma GCC diagnostic push

Callers

nothing calls this directly

Calls 2

malloc_lasFunction · 0.85
strncpy_lasFunction · 0.85

Tested by

no test coverage detected