Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug in read_file_binary(FILE *fp, std::vector<uint8_t> &fileBufferBytes) #1821

Merged
merged 2 commits into from Jul 20, 2021

Conversation

fabyday
Copy link
Contributor

@fabyday fabyday commented Jun 1, 2021

Fixes # .

add fclose(File* fp).

from in file_utils.cpp

  if (!ferror(fp)) {
    fseek(fp, 0, SEEK_END);
    size_t sizeBytes = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    fileBufferBytes.resize(sizeBytes);

    if (fread((char*)fileBufferBytes.data(), 1, sizeBytes, fp) == sizeBytes) 
      return;
  }

to

  if (!ferror(fp)) {
    fseek(fp, 0, SEEK_END);
    size_t sizeBytes = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    fileBufferBytes.resize(sizeBytes);

    if (fread((char*)fileBufferBytes.data(), 1, sizeBytes, fp) == sizeBytes) {
      fclose(fp);
      return;
    }
  }

Checklist

  • All changes meet libigl style-guidelines.
  • Adds new .cpp file.
  • Adds corresponding unit test.
  • This is a minor change.

@alecjacobson alecjacobson merged commit 957dcf3 into libigl:main Jul 20, 2021
@jdumas jdumas added the bug label Jul 20, 2021
@jdumas jdumas added this to In progress in Core module via automation Jul 20, 2021
@jdumas jdumas added this to the v3.0.0 milestone Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Core module
In progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants