diff options
author | 2018-01-24 10:02:35 -0800 | |
---|---|---|
committer | 2018-01-24 10:06:06 -0800 | |
commit | d9f93c42a50b1f1401d9c186eac0ae8dc9093c3b (patch) | |
tree | 178d1a692f56580c266139642b5a1d0d155c477e /tensorflow/core/lib/gif | |
parent | 7b62a71e2d46c148df7d5704972f4592bc5e0f1b (diff) |
Merge changes from github.
PiperOrigin-RevId: 183100142
Diffstat (limited to 'tensorflow/core/lib/gif')
-rw-r--r-- | tensorflow/core/lib/gif/gif_io.cc | 16 | ||||
-rw-r--r-- | tensorflow/core/lib/gif/gif_io.h | 3 |
2 files changed, 11 insertions, 8 deletions
diff --git a/tensorflow/core/lib/gif/gif_io.cc b/tensorflow/core/lib/gif/gif_io.cc index b5c0d9f621..0f6999c88f 100644 --- a/tensorflow/core/lib/gif/gif_io.cc +++ b/tensorflow/core/lib/gif/gif_io.cc @@ -17,6 +17,7 @@ limitations under the License. #include "tensorflow/core/lib/gif/gif_io.h" #include "tensorflow/core/lib/gtl/cleanup.h" +#include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/core/platform/gif.h" #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/mem.h" @@ -44,7 +45,8 @@ int input_callback(GifFileType* gif_file, GifByteType* buf, int size) { } uint8* Decode(const void* srcdata, int datasize, - std::function<uint8*(int, int, int, int)> allocate_output) { + const std::function<uint8*(int, int, int, int)>& allocate_output, + string* error_string) { int error_code = D_GIF_SUCCEEDED; InputBufferInfo info = {reinterpret_cast<const uint8*>(srcdata), datasize}; GifFileType* gif_file = @@ -57,17 +59,17 @@ uint8* Decode(const void* srcdata, int datasize, } }); if (error_code != D_GIF_SUCCEEDED) { - LOG(ERROR) << "Fail to open gif file, reason: " - << GifErrorString(error_code); + *error_string = strings::StrCat("failed to open gif file: ", + GifErrorString(error_code)); return nullptr; } if (DGifSlurp(gif_file) != GIF_OK) { - LOG(ERROR) << "Fail to slurp gif file, reason: " - << GifErrorString(gif_file->Error); + *error_string = strings::StrCat("failed to slurp gif file: ", + GifErrorString(gif_file->Error)); return nullptr; } if (gif_file->ImageCount <= 0) { - LOG(ERROR) << "Gif file does not contain any image"; + *error_string = strings::StrCat("gif file does not contain any image"); return nullptr; } @@ -83,7 +85,7 @@ uint8* Decode(const void* srcdata, int datasize, GifImageDesc* img_desc = &this_image->ImageDesc; if (img_desc->Left != 0 || img_desc->Top != 0 || img_desc->Width != width || img_desc->Height != height) { - LOG(ERROR) << "Can't process optimized gif."; + *error_string = strings::StrCat("can't process optimized gif"); return nullptr; } diff --git a/tensorflow/core/lib/gif/gif_io.h b/tensorflow/core/lib/gif/gif_io.h index 5399e6a538..0a7967a5a1 100644 --- a/tensorflow/core/lib/gif/gif_io.h +++ b/tensorflow/core/lib/gif/gif_io.h @@ -43,7 +43,8 @@ namespace tensorflow { namespace gif { uint8* Decode(const void* srcdata, int datasize, - std::function<uint8*(int, int, int, int)> allocate_output); + const std::function<uint8*(int, int, int, int)>& allocate_output, + string* error_string); } // namespace gif } // namespace tensorflow |