@@ -76,6 +76,7 @@ inline std::string getPlatformName(ur_platform_handle_t platform) {
7676 std::string name (nameSize, ' \0 ' );
7777 UR_CHECK (urPlatformGetInfo (platform, UR_PLATFORM_INFO_NAME, nameSize,
7878 name.data (), &nameSize));
79+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
7980 return name;
8081}
8182
@@ -86,6 +87,7 @@ inline std::string getDeviceName(ur_device_handle_t device) {
8687 std::string name (nameSize, ' \0 ' );
8788 UR_CHECK (urDeviceGetInfo (device, UR_DEVICE_INFO_NAME, nameSize, name.data (),
8889 &nameSize));
90+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
8991 return name;
9092}
9193
@@ -96,6 +98,7 @@ inline std::string getDeviceVersion(ur_device_handle_t device) {
9698 std::string name (versionSize, ' \0 ' );
9799 UR_CHECK (urDeviceGetInfo (device, UR_DEVICE_INFO_VERSION, versionSize,
98100 name.data (), &versionSize));
101+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
99102 return name;
100103}
101104
@@ -107,6 +110,7 @@ inline std::string getDeviceDriverVersion(ur_device_handle_t device) {
107110 UR_CHECK (urDeviceGetInfo (device, UR_DEVICE_INFO_DRIVER_VERSION,
108111 driverVersionSize, name.data (),
109112 &driverVersionSize));
113+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
110114 return name;
111115}
112116
@@ -136,6 +140,7 @@ printLoaderConfigInfo<char[]>(ur_loader_config_handle_t loaderConfig,
136140 std::string str (size, ' \0 ' );
137141 UR_CHECK_WEAK (
138142 urLoaderConfigGetInfo (loaderConfig, info, size, str.data (), nullptr ));
143+ str.pop_back (); // std::string does not need a terminating NULL, remove it here
139144 std::cout << str << " \n " ;
140145}
141146
@@ -179,6 +184,7 @@ inline void printPlatformInfo<char[]>(ur_platform_handle_t platform,
179184 UR_CHECK_WEAK (urPlatformGetInfo (platform, info, 0 , nullptr , &size));
180185 std::string str (size, ' \0 ' );
181186 UR_CHECK_WEAK (urPlatformGetInfo (platform, info, size, str.data (), nullptr ));
187+ str.pop_back (); // std::string does not need a terminating NULL, remove it here
182188 std::cout << str << " \n " ;
183189}
184190
@@ -235,6 +241,7 @@ inline void printDeviceInfo<char[]>(ur_device_handle_t device,
235241 UR_CHECK_WEAK (urDeviceGetInfo (device, info, 0 , nullptr , &size));
236242 std::string str (size, 0 );
237243 UR_CHECK_WEAK (urDeviceGetInfo (device, info, size, str.data (), nullptr ));
244+ str.pop_back (); // std::string does not need a terminating NULL, remove it here
238245 std::cout << str << " \n " ;
239246}
240247} // namespace urinfo
0 commit comments