Skip to main content
added 2 characters in body
Source Link
Ron Klein
  • 1.2k
  • 11
  • 19

FOA, code looks clear and clean, well indented and formatted. Thumbs up!!

Now, to the comments:

  • Some of the variable names might have more significant names: is can be changed to input_stream, for instance.
  • File size: it looks like you try to get the file size out of the stream by fetching the stream until reaching its end. I'd change that to an explicit call to a function provider by the hosting OS' API (see stat), or by a library that implements it, like boost.
  • Extract file size calculation to a function, to achieve code reuse.
  • Base64 format should convert a byte array (or a binary stream) to an ASCII string. It has nothing to do inwith Bitmap format in specific. I'd recommend you create some test cases using a C++ unit testing framework (there are some) and find the bug, if such exists.

Good luck!

FOA, code looks clear and clean, well indented and formatted. Thumbs up!!

Now, to the comments:

  • Some of the variable names might have more significant names: is can be changed to input_stream, for instance.
  • File size: it looks like you try to get the file size out of the stream by fetching the stream until reaching its end. I'd change that to an explicit call to a function provider by the hosting OS' API (see stat), or by a library that implements it, like boost.
  • Extract file size calculation to a function, to achieve code reuse.
  • Base64 format should convert a byte array (or a binary stream) to an ASCII string. It has nothing to do in Bitmap format in specific. I'd recommend you create some test cases using a C++ unit testing framework (there are some) and find the bug, if such exists.

Good luck!

FOA, code looks clear and clean, well indented and formatted. Thumbs up!!

Now, to the comments:

  • Some of the variable names might have more significant names: is can be changed to input_stream, for instance.
  • File size: it looks like you try to get the file size out of the stream by fetching the stream until reaching its end. I'd change that to an explicit call to a function provider by the hosting OS' API (see stat), or by a library that implements it, like boost.
  • Extract file size calculation to a function, to achieve code reuse.
  • Base64 format should convert a byte array (or a binary stream) to an ASCII string. It has nothing to do with Bitmap format in specific. I'd recommend you create some test cases using a C++ unit testing framework (there are some) and find the bug, if such exists.

Good luck!

Source Link
Ron Klein
  • 1.2k
  • 11
  • 19

FOA, code looks clear and clean, well indented and formatted. Thumbs up!!

Now, to the comments:

  • Some of the variable names might have more significant names: is can be changed to input_stream, for instance.
  • File size: it looks like you try to get the file size out of the stream by fetching the stream until reaching its end. I'd change that to an explicit call to a function provider by the hosting OS' API (see stat), or by a library that implements it, like boost.
  • Extract file size calculation to a function, to achieve code reuse.
  • Base64 format should convert a byte array (or a binary stream) to an ASCII string. It has nothing to do in Bitmap format in specific. I'd recommend you create some test cases using a C++ unit testing framework (there are some) and find the bug, if such exists.

Good luck!