@@ -76,6 +76,7 @@ inline std::string getPlatformName(ur_platform_handle_t platform) {
76
76
std::string name (nameSize, ' \0 ' );
77
77
UR_CHECK (urPlatformGetInfo (platform, UR_PLATFORM_INFO_NAME, nameSize,
78
78
name.data (), &nameSize));
79
+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
79
80
return name;
80
81
}
81
82
@@ -86,6 +87,7 @@ inline std::string getDeviceName(ur_device_handle_t device) {
86
87
std::string name (nameSize, ' \0 ' );
87
88
UR_CHECK (urDeviceGetInfo (device, UR_DEVICE_INFO_NAME, nameSize, name.data (),
88
89
&nameSize));
90
+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
89
91
return name;
90
92
}
91
93
@@ -96,6 +98,7 @@ inline std::string getDeviceVersion(ur_device_handle_t device) {
96
98
std::string name (versionSize, ' \0 ' );
97
99
UR_CHECK (urDeviceGetInfo (device, UR_DEVICE_INFO_VERSION, versionSize,
98
100
name.data (), &versionSize));
101
+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
99
102
return name;
100
103
}
101
104
@@ -107,6 +110,7 @@ inline std::string getDeviceDriverVersion(ur_device_handle_t device) {
107
110
UR_CHECK (urDeviceGetInfo (device, UR_DEVICE_INFO_DRIVER_VERSION,
108
111
driverVersionSize, name.data (),
109
112
&driverVersionSize));
113
+ name.pop_back (); // std::string does not need a terminating NULL, remove it here
110
114
return name;
111
115
}
112
116
@@ -136,6 +140,7 @@ printLoaderConfigInfo<char[]>(ur_loader_config_handle_t loaderConfig,
136
140
std::string str (size, ' \0 ' );
137
141
UR_CHECK_WEAK (
138
142
urLoaderConfigGetInfo (loaderConfig, info, size, str.data (), nullptr ));
143
+ str.pop_back (); // std::string does not need a terminating NULL, remove it here
139
144
std::cout << str << " \n " ;
140
145
}
141
146
@@ -179,6 +184,7 @@ inline void printPlatformInfo<char[]>(ur_platform_handle_t platform,
179
184
UR_CHECK_WEAK (urPlatformGetInfo (platform, info, 0 , nullptr , &size));
180
185
std::string str (size, ' \0 ' );
181
186
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
182
188
std::cout << str << " \n " ;
183
189
}
184
190
@@ -235,6 +241,7 @@ inline void printDeviceInfo<char[]>(ur_device_handle_t device,
235
241
UR_CHECK_WEAK (urDeviceGetInfo (device, info, 0 , nullptr , &size));
236
242
std::string str (size, 0 );
237
243
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
238
245
std::cout << str << " \n " ;
239
246
}
240
247
} // namespace urinfo
0 commit comments