[Exif] Added logs in methods onEntered and onReturn
authorPiotr Kosko <p.kosko@samsung.com>
Wed, 27 May 2015 12:06:56 +0000 (14:06 +0200)
committerHyunjin Park <hj.na.park@samsung.com>
Mon, 1 Jun 2015 15:45:23 +0000 (00:45 +0900)
Change-Id: If1ef537b4b7d28de43b0772c475cc65aebf87e23
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/exif/exif_gps_location.cc
src/exif/exif_information.cc
src/exif/exif_tag_saver.cc
src/exif/get_exif_info.cc
src/exif/jpeg_file.cc

index 899040d..e478a05 100755 (executable)
@@ -27,6 +27,7 @@ namespace extension {
 namespace exif {
 
 GCSPosition::GCSPosition() {
+  LoggerD("Enter");
 }
 
 GCSPosition::GCSPosition(Rational _degrees, Rational _minutes,
@@ -34,9 +35,11 @@ GCSPosition::GCSPosition(Rational _degrees, Rational _minutes,
     degrees(_degrees),
     minutes(_minutes),
     seconds(_seconds) {
+      LoggerD("Enter");
 }
 
 bool GCSPosition::isValid() const {
+  LoggerD("Enter");
   if (!(degrees.isValid() && minutes.isValid() && seconds.isValid())) {
     return false;
   }
@@ -51,6 +54,7 @@ bool GCSPosition::isValid() const {
 }
 
 double GCSPosition::toDouble() const {
+  LoggerD("Enter");
   const double degrees_value = degrees.toDouble();
   const double minutes_value = minutes.toDouble();
   const double seconds_value = seconds.toDouble();
@@ -58,6 +62,7 @@ double GCSPosition::toDouble() const {
 }
 
 Rationals GCSPosition::toRationalsVector() const {
+  LoggerD("Enter");
   Rationals vec;
   vec.push_back(degrees);
   vec.push_back(minutes);
@@ -66,6 +71,7 @@ Rationals GCSPosition::toRationalsVector() const {
 }
 
 std::string GCSPosition::toDebugString() const {
+  LoggerD("Enter");
   std::stringstream ss;
   ss << degrees.toString() << "d ";
   ss << minutes.toString() << "m ";
@@ -120,12 +126,14 @@ ExifGPSLocation::ExifGPSLocation() :
     m_longitude_ref(GPS_LOCATION_WEST),
     m_latitude_ref(GPS_LOCATION_NORTH) {
   for (int i = 0; i < EXIF_GPS_LOCATION_ATTRIBUTE_NUMBER_OF_ATTRIBUTES; ++i) {
+    LoggerD("Enter");
     m_is_set[i] = false;
   }
   LoggerE("ExifGPSLocation::ExifGPSLocation()");
 }
 
 ExifGPSLocation::ExifGPSLocation(double longitude, double latitude) {
+  LoggerD("Enter");
   for (int i = 0; i < EXIF_GPS_LOCATION_ATTRIBUTE_NUMBER_OF_ATTRIBUTES; ++i) {
     m_is_set[i] = false;
   }
@@ -147,6 +155,7 @@ ExifGPSLocation::ExifGPSLocation(double longitude, double latitude) {
 }
 
 void ExifGPSLocation::setLongitude(const GCSPosition& longitude) {
+  LoggerD("Enter");
   if (!longitude.isValid()) {
     LoggerW("longitude is not valid!");
     return;
@@ -157,19 +166,23 @@ void ExifGPSLocation::setLongitude(const GCSPosition& longitude) {
 }
 
 const GCSPosition& ExifGPSLocation::getLongitude() const {
+  LoggerD("Enter");
   return m_longitude;
 }
 
 void ExifGPSLocation::setLongitudeRef(GPSLocationDirectionLongitude ref) {
+  LoggerD("Enter");
   m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LONGITUDE_REF] = true;
   m_longitude_ref = ref;
 }
 
 GPSLocationDirectionLongitude ExifGPSLocation::getLongitudeRef() const {
+  LoggerD("Enter");
   return m_longitude_ref;
 }
 
 void ExifGPSLocation::setLatitude(const GCSPosition& latitude) {
+  LoggerD("Enter");
   if (!latitude.isValid()) {
     LoggerW("latitude is not valid!");
     return;
@@ -180,27 +193,33 @@ void ExifGPSLocation::setLatitude(const GCSPosition& latitude) {
 }
 
 const GCSPosition& ExifGPSLocation::getLatitude() const {
+  LoggerD("Enter");
   return m_latitude;
 }
 
 void ExifGPSLocation::setLatitudeRef(GPSLocationDirectionLatitude ref) {
+  LoggerD("Enter");
   m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LATITUDE_REF] = true;
   m_latitude_ref = ref;
 }
 
 GPSLocationDirectionLatitude ExifGPSLocation::getLatitudeRef() const {
+  LoggerD("Enter");
   return m_latitude_ref;
 }
 
 bool ExifGPSLocation::isSet(ExifGPSLocationAttributes attribute) const {
+  LoggerD("Enter");
   return m_is_set[attribute];
 }
 
 void ExifGPSLocation::unset(ExifGPSLocationAttributes attribute) {
+  LoggerD("Enter");
   m_is_set[attribute] = false;
 }
 
 void ExifGPSLocation::unsetAll() {
+  LoggerD("Enter");
   m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LONGITUDE] = false;
   m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LONGITUDE_REF] = false;
   m_longitude =  GCSPosition();
@@ -211,6 +230,7 @@ void ExifGPSLocation::unsetAll() {
 }
 
 bool ExifGPSLocation::isComplete() const {
+  LoggerD("Enter");
   return m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LONGITUDE] &&
       m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LONGITUDE_REF] &&
       m_is_set[EXIF_GPS_LOCATION_ATTRIBUTE_LATITUDE] &&
@@ -219,10 +239,12 @@ bool ExifGPSLocation::isComplete() const {
 
 
 bool ExifGPSLocation::isValid() const {
+  LoggerD("Enter");
   return isComplete() && m_latitude.isValid() && m_longitude.isValid();
 }
 
 double ExifGPSLocation::getLongitudeValue() const {
+  LoggerD("Enter");
   const double longitude_dir =
       (m_longitude_ref == GPS_LOCATION_WEST) ? -1.0f : 1.0f;
   const double longitude = m_longitude.toDouble() * longitude_dir;
@@ -230,6 +252,7 @@ double ExifGPSLocation::getLongitudeValue() const {
 }
 
 double ExifGPSLocation::getLatitudeValue() const {
+  LoggerD("Enter");
   const double latitude_dir =
       (m_latitude_ref == GPS_LOCATION_SOUTH) ? -1.0f : 1.0f;
   const double latitude = m_latitude.toDouble() * latitude_dir;
index c16abde..be79fd1 100755 (executable)
@@ -50,6 +50,7 @@ constexpr unsigned int str2int(const char* str, int h = 0) {
 }
 
 IsoSpeedRatingsVector jsonArray2vector(const picojson::value& a) {
+  LoggerD("Enter");
   if (!a.is<picojson::array>()) {
     return IsoSpeedRatingsVector();
   }
@@ -68,6 +69,7 @@ IsoSpeedRatingsVector jsonArray2vector(const picojson::value& a) {
 }  // namespace
 
 ExifInformation::ExifInformation() {
+  LoggerD("Enter");
   for (int attr = 0;
       attr < EXIF_INFORMATION_ATTRIBUTE_NUMBER_OF_ATTRIBUTES; attr++) {
     unset(static_cast<ExifInformationAttribute>(attr));
@@ -75,6 +77,7 @@ ExifInformation::ExifInformation() {
 }
 
 ExifInformation::ExifInformation(const picojson::value& args) {
+  LoggerD("Enter");
   for (int attr = 0;
       attr < EXIF_INFORMATION_ATTRIBUTE_NUMBER_OF_ATTRIBUTES; attr++) {
     unset(static_cast<ExifInformationAttribute>(attr));
@@ -90,7 +93,9 @@ ExifInformation::ExifInformation(const picojson::value& args) {
   }
 }
 
-ExifInformation::~ExifInformation() { }
+ExifInformation::~ExifInformation() {
+  LoggerD("Enter");
+ }
 
 const std::string& ExifInformation::getUri() {
   LoggerD("Entered");
index 942b831..88c0a3c 100755 (executable)
@@ -41,6 +41,7 @@ void ExifTagSaver::removeExifEntryWithTag(const ExifTag tag,
 
 void ExifTagSaver::saveToExif(long int value, ExifTag tag,
                               ExifData* exif_data) {
+  LoggerD("Entered");
   ExifEntry* entry = prepareEntry(exif_data, tag);
   if (!entry) {
     // TODO return PlatformResult and handle error
@@ -79,6 +80,7 @@ void ExifTagSaver::saveToExif(long int value, ExifTag tag,
 void ExifTagSaver::saveToExif(const std::string& value, ExifTag tag,
                               ExifData* exif_data, ExifFormat format,
                               bool add_zero_character) {
+  LoggerD("Entered");
   ExifEntry* entry = prepareEntry(exif_data, tag);
   if (!entry) {
     // TODO return PlatformResult and handle error
@@ -111,6 +113,7 @@ void ExifTagSaver::saveToExif(const std::string& value, ExifTag tag,
 
 void ExifTagSaver::saveToExif(const Rational& value, ExifTag tag,
                               ExifData* exif_data) {
+  LoggerD("Entered");
   ExifEntry* entry = prepareEntry(exif_data, tag);
   if (!entry) {
     // TODO return PlatformResult and handle error
@@ -141,6 +144,7 @@ void ExifTagSaver::saveToExif(const Rational& value, ExifTag tag,
 
 void ExifTagSaver::saveToExif(const Rationals& value, ExifTag tag,
                               ExifData* exif_data) {
+  LoggerD("Entered");
   ExifEntry* entry = prepareEntry(exif_data, tag);
   if (!entry) {
     // TODO return PlatformResult and handle error
@@ -174,6 +178,7 @@ void ExifTagSaver::saveToExif(const Rationals& value, ExifTag tag,
 void ExifTagSaver::saveToExif(std::vector<long long int>& value,
                               ExifFormat store_as,
                               ExifTag tag, ExifData* exif_data) {
+  LoggerD("Entered");
   ExifEntry* entry = prepareEntry(exif_data, tag);
   if (!entry) {
     // TODO return PlatformResult and handle error
@@ -254,6 +259,7 @@ void ExifTagSaver::saveToExif(std::vector<long long int>& value,
 
 void ExifTagSaver::saveGpsLocationToExif(const ExifGPSLocation& gps_info,
                                          ExifData* exif_data) {
+  LoggerD("Entered");
   if (gps_info.isSet(EXIF_GPS_LOCATION_ATTRIBUTE_LATITUDE)) {
     auto latitude = gps_info.getLatitude();
     LoggerD("Saving latitude: %s", latitude.toDebugString().c_str());
@@ -317,6 +323,7 @@ ExifEntry* ExifTagSaver::createNewTag(ExifData* exif_data, ExifIfd ifd,
 }
 
 ExifIfd ExifTagSaver::deduceIfdSection(ExifTag tag) {
+  LoggerD("Entered");
   // TODO EXIF_TAG_* and EXIF_TAG_GPS_* are sharing same values,
   // they shouldn't be used in one switch statement.
 
@@ -361,6 +368,7 @@ ExifIfd ExifTagSaver::deduceIfdSection(ExifTag tag) {
 }
 
 ExifFormat ExifTagSaver::deduceDataFormat(ExifTag tag) {
+  LoggerD("Entered");
   // TODO EXIF_TAG_* and EXIF_TAG_GPS_* are sharing same values,
   // they shouldn't be used in one switch statement.
 
index ad83886..d710e40 100755 (executable)
@@ -38,6 +38,7 @@ struct ExifDataHolder {
 };
 
 Rational GetRationalFromEntry(ExifEntry *entry, ExifData* exif_data) {
+  LoggerD("Entered");
   if (EXIF_FORMAT_RATIONAL == entry->format
       && entry->components >= 1
       && entry->data) {
@@ -51,6 +52,7 @@ Rational GetRationalFromEntry(ExifEntry *entry, ExifData* exif_data) {
 bool GetRationalsFromEntry(ExifEntry* entry, ExifData* exif_data,
                            unsigned long required_count,
                            Rationals& out_rationals) {
+  LoggerD("Entered");
   if (EXIF_FORMAT_RATIONAL == entry->format &&
       entry->components >= required_count &&
       entry->data) {
@@ -71,6 +73,7 @@ bool GetRationalsFromEntry(ExifEntry* entry, ExifData* exif_data,
 bool GetGCSPositionFromEntry(ExifEntry* entry, ExifData* exif_data,
                              GCSPosition& out_pos) {
   // RATIONAL - 3
+  LoggerD("Entered");
   if (EXIF_FORMAT_RATIONAL == entry->format &&
       entry->components >= 3 &&
       entry->data) {
@@ -87,6 +90,7 @@ bool GetGCSPositionFromEntry(ExifEntry* entry, ExifData* exif_data,
 }
 
 bool DecomposeExifUndefined(ExifEntry* entry, std::string& type, std::string& value) {
+  LoggerD("Entered");
   if (!entry || !entry->data) {
     LoggerW("exif entry is NULL/empty");
     return false;
@@ -107,6 +111,7 @@ bool DecomposeExifUndefined(ExifEntry* entry, std::string& type, std::string& va
 PlatformResult GetExifInfo::ProcessEntry(ExifEntry* entry,
                                ExifData* exif_data,
                                JsonObject* result_obj) {
+  LoggerD("Entered");
   char buf[2000];
   exif_entry_get_value(entry, buf, sizeof(buf));
   ExifUtil::printExifEntryInfo(entry, exif_data);
@@ -467,6 +472,7 @@ PlatformResult GetExifInfo::ProcessEntry(ExifEntry* entry,
 }
 
 void GetExifInfo::ContentForeachFunctionProxy(ExifEntry *entry, void *user_data) {
+  LoggerD("Entered");
   ExifDataHolder* holder = static_cast<ExifDataHolder*>(user_data);
   if (!holder) {
     LoggerE("holder is NULL");
@@ -492,6 +498,7 @@ void GetExifInfo::DataForeachFunction(ExifContent *content, void *user_data) {
 
 PlatformResult GetExifInfo::LoadFromURI(const std::string& uri,
                                         JsonValue* result) {
+  LoggerD("Entered");
   // TODO(r.galka) it can be done on JS side
   const std::string& file_path = ExifUtil::convertUriToPath(uri);
   ExifData* ed = exif_data_new_from_file(file_path.c_str());
index c873161..c5285d8 100755 (executable)
@@ -118,6 +118,7 @@ JpegFile::~JpegFile() {
 }
 
 PlatformResult JpegFile::loadFile(const std::string& path, JpegFilePtr* jpg_ptr) {
+  LoggerD("Entered");
   JpegFile* new_jpg = new (std::nothrow) JpegFile();
   if (!new_jpg) {
     LoggerE("Couldn't allocate Jpegfile!");
@@ -187,6 +188,7 @@ PlatformResult JpegFile::load(const std::string& path) {
 std::string JpegFile::getPartOfFile(const std::size_t offset,
                                     const std::size_t num_bytes_before,
                                     const std::size_t num_bytes_after) {
+  LoggerD("Entered");
   long long int start = static_cast<long long int>(offset) - num_bytes_before;
   if (start < 0) {
     start = 0;
@@ -451,6 +453,7 @@ bool JpegFile::searchForTagInBuffer(const unsigned char* buffer_start,
 }
 
 PlatformResult JpegFile::setNewExifData(ExifData* new_exif_data) {
+  LoggerD("Entered");
   AssertMsg(new_exif_data, "Trying to set NULL exif_data!");
 
   JpegFileSectionPtr exif = getExifSection();
@@ -506,6 +509,7 @@ PlatformResult JpegFile::setNewExifData(ExifData* new_exif_data) {
 }
 
 ExifData* JpegFile::getExifData() {
+  LoggerD("Entered");
   JpegFileSectionPtr exif = getExifSection();
   if (!exif) {
     return NULL;
@@ -715,6 +719,7 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) {
 }
 
 JpegFileSectionPtr JpegFile::getExifSection() {
+  LoggerD("Entered");
   std::size_t num_exif_sections = 0;
   JpegFileSectionPtr first_exif_section;