Skip to content

Commit ec58588

Browse files
committed
Switch std::string::c_str() to C++11 std::string::data()
1 parent aa5309c commit ec58588

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lsl_inlet_c.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ LIBLSL_C_API double lsl_pull_sample_str(
116116
if (ec) *ec = lsl_internal_error;
117117
return 0.0;
118118
}
119-
memcpy(buffer[k], tmp[k].c_str(), tmp[k].size());
119+
memcpy(buffer[k], tmp[k].data(), tmp[k].size());
120120
buffer[k][tmp[k].size()] = '\0';
121121
}
122122
return result;
@@ -219,7 +219,7 @@ LIBLSL_C_API unsigned long lsl_pull_chunk_str(lsl_inlet in, char **data_buffer,
219219
if (ec) *ec = lsl_internal_error;
220220
return 0;
221221
}
222-
memcpy(data_buffer[k], tmp[k].c_str(), tmp[k].size());
222+
memcpy(data_buffer[k], tmp[k].data(), tmp[k].size());
223223
data_buffer[k][tmp[k].size()] = '\0';
224224
}
225225
return result;
@@ -248,7 +248,7 @@ LIBLSL_C_API unsigned long lsl_pull_chunk_buf(lsl_inlet in, char **data_buffer,
248248
return 0;
249249
}
250250
lengths_buffer[k] = (uint32_t)tmp[k].size();
251-
memcpy(data_buffer[k], tmp[k].c_str(), tmp[k].size());
251+
memcpy(data_buffer[k], tmp[k].data(), tmp[k].size());
252252
data_buffer[k][tmp[k].size()] = '\0';
253253
}
254254
return result;

src/lsl_streaminfo_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ LIBLSL_C_API char *lsl_get_xml(lsl_streaminfo info) {
5959
LOG_F(ERROR, "Error allocating memory for xmlinfo");
6060
return nullptr;
6161
}
62-
memcpy(result, tmp.c_str(), tmp.size());
62+
memcpy(result, tmp.data(), tmp.size());
6363
result[tmp.size()] = '\0';
6464
return result;
6565
} catch (std::exception &e) {

0 commit comments

Comments
 (0)