- Component-Wise Functions for Quaternions
- Fixed Allocation Bug with Strings
This commit is contained in:
@@ -307,7 +307,7 @@ bool file::erase() {
|
||||
}
|
||||
|
||||
// Close the file
|
||||
path path = move(_path);
|
||||
const path path = move(_path);
|
||||
if (close()) {
|
||||
return true;
|
||||
}
|
||||
@@ -512,7 +512,7 @@ bool file::rename(const path& p) {
|
||||
}
|
||||
|
||||
// Validate path
|
||||
path fpath = p.absolute();
|
||||
const path fpath = p.absolute();
|
||||
if (_path == fpath) {
|
||||
return false;
|
||||
}
|
||||
@@ -783,7 +783,7 @@ file file::copy(const path& p) {
|
||||
}
|
||||
|
||||
// Validate path
|
||||
path fpath = p.absolute();
|
||||
const path fpath = p.absolute();
|
||||
if (_path == fpath) {
|
||||
return file();
|
||||
}
|
||||
@@ -951,7 +951,7 @@ size_t file::read(void* data, size_t size, size_t n) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t read = fread(data, size, n, _handle);
|
||||
const size_t read = fread(data, size, n, _handle);
|
||||
if (read != size && ferror(_handle)) {
|
||||
_error = strerror(errno);
|
||||
}
|
||||
@@ -971,7 +971,7 @@ string file::getline() {
|
||||
// Read the next line;
|
||||
char* line = nullptr;
|
||||
size_t size = 0;
|
||||
size_t read = ::getline(&line, &size, _handle);
|
||||
const size_t read = ::getline(&line, &size, _handle);
|
||||
if (read == npos && ferror(_handle)) {
|
||||
_error = strerror(errno);
|
||||
if (line) free(line);
|
||||
@@ -1053,7 +1053,7 @@ size_t file::write(const void* data, size_t size, size_t n) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t r = fwrite(data, size, n, _handle);
|
||||
const size_t r = fwrite(data, size, n, _handle);
|
||||
|
||||
if (r != size && ferror(_handle)) {
|
||||
_error = strerror(errno);
|
||||
|
||||
Reference in New Issue
Block a user