慎用USES_CONVERSION

本文介绍了ATL中的USES_CONVERSION宏定义及其用途,主要用于编码转换,特别是CString到LPCWSTR的转换。文中提醒开发者使用该宏定义时应注意内存管理,避免栈溢出,并提供了一个安全使用的示例。

USES_CONVERSION是ATL中的一个 宏定义。用于编码转换(用的比较多的是CString向LPCWSTR转换)。在ATL下使用要包含头文件#include "atlconv.h"

使用USES_CONVERSION一定要小心,它们从堆栈上分配内存,直到调用它的函数返回,该内存不会被释放。如果在一个循环中,这个宏被反复调用几万次,将不可避免的产生stackoverflow。

解决方法是:将用到该宏的语句独立封装成一个函数,这样就可以无限次调用了。

例:

void fn()

{

       while (true)

      {

              USES_CONVERSION;

              DoSomething(A2W("Something"));

      }

}

改成------------------------------->

void fn2()

{

          USES_CONVERSION;

        DoSomething(A2W("Something"));

}

void fn()

{

         while(true)

       {

                fn2();

       }

}

(pdal-env) D:\scau_lidar_data\output>3d-tiles-tools lasTo3dtiles -i C22.las -o h Usage: 3d-tiles-tools <command> [options] Commands: convert Convert between tilesets and tileset package formats. The input and output can be one of the following: - The path of a tileset JSON file - The path of a directory that contains a 'tileset.json' file - The path of a '.3tz' file - The path of a '.3dtiles' file The input can also be the path of a ZIP file that contains the tileset data. The tileset JSON file in this ZIP is determined by the 'inputTilesetJsonFileName', which is 'tileset.json' by default. glbToB3dm Repackage the input glb as a b3dm with a basic header. glbToI3dm Repackage the input glb as a i3dm with a basic header. b3dmToGlb Extract the binary glTF asset from the input b3dm. i3dmToGlb Extract the binary glTF asset from the input i3dm. cmptToGlb Extract the binary glTF assets from the input cmpt. splitCmpt Split the input cmpt and write out its inner tiles. convertB3dmToGlb Convert a b3dm file into a glTF asset that uses glTF extensions to represent the batch- and feature table information convertPntsToGlb Convert a pnts file into a glTF asset that uses glTF extensions to represent the point properties and batch- and feature table information convertI3dmToGlb Convert an i3dm file into a glTF asset that uses glTF extensions to represent the batch- and feature table information. This conversion may be lossy if the GLB of the input i3dm contains animations. optimizeB3dm Pass the input b3dm through gltf-pipeline. To pass options to gltf-pipeline, place them after --options. (--options -h for gltf-pipeline help) optimizeI3dm Pass the input i3dm through gltf-pipeline. To pass options to gltf-pipeline, place them after --options. (--options -h for gltf-pipeline help) updateAlignment Update the alignment of the batch- and feature table and the tile dataas a whole, to meet the alignment requirements of the specification. This can be applied to B3DM, I3DM, PNTS, or CMPT tile data. gzip Gzips the input tileset directory. ungzip Ungzips the input tileset directory. combine Combines all external tilesets into a single tileset.json file. merge Merge any number of tilesets together into a single tileset. mergeJson Merge any number of tilesets together into a single tileset without copying resources to output directory. upgrade Upgrades legacy tilesets to comply to the 3D Tiles specification. By default, this will upgrade legacy tilesets to comply to 3D Tiles 1.0. These upgrades include: - The asset version will be set to '1.0' - Content that uses a 'url' will be upgraded to use 'uri'. - The 'refine' value will be converted to be in all-uppercase. - glTF 1.0 models in B3DM or I3DM will be upgraded to glTF 2.0. When specifying '--targetVersion 1.1', then the upgrades will include: - The asset version will be set to '1.1' - Content that uses a 'url' will be upgraded to use 'uri'. - The 'refine' value will be converted to be in all-uppercase. - The '3DTILES_content_gltf' extension declaration will be removed. - PNTS, B3DM, and I3DM content will be converted to glTF. pipeline Execute a pipeline that is provided as a JSON file analyze Analyze the input file, and write the results to the output directory. This will accept B3DM, I3DM, PNTS, CMPT, and GLB files (both for glTF 1.0 and for glTF 2.0), and write files into the output directory that contain the feature table, batch table, layout information, the GLB, and the JSON of the GLB tilesetToDatabase Create a sqlite database for a tileset. (Deprecated - use 'convert' instead) databaseToTileset Unpack a tileset database to a tileset folder. (Deprecated - use 'convert' instead) createTilesetJson Creates a tileset JSON file that just refers to given tile content files. If the input is a single file, then this will result in a single (root) tile with the input file as its tile content. If the input is a directory, then all content files in this directory will be used as tile content, recursively. The exact set of file types that are considered to be 'tile content' is not specified, but it will include GLB, B3DM, PNTS, I3DM, and CMPT files. Options: --version Show version number [boolean] -h, --help Show help [boolean] -f, --force Output can be overwritten if it already exists. [boolean] [default: false] --logLevel The log level. Valid values are 'trace', 'debug', 'info', 'warn', 'error', 'fatal', and 'silent' [string] [default: "info"] --logJson Whether log messages should be printed as JSON instead of pretty-printing [boolean] [default: false] Unknown arguments: i, o, lasTo3dtiles
最新发布
10-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值