diff options
author | Steve Block <steveblock@google.com> | 2012-01-06 19:10:19 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2012-01-06 19:10:19 +0000 |
commit | 7a314dab81f01bac02d617ffca9dbf7b6cc00700 (patch) | |
tree | c3f9a847b75151ab8d646b6ce64c3b575ac9a3a0 | |
parent | d282614624d8e5e6f049bff9af237a76f3b14e31 (diff) | |
download | jhead-7a314dab81f01bac02d617ffca9dbf7b6cc00700.tar.gz |
Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220
Bug: 5449033
Change-Id: Iec4192a0fbd58352a3a967095b2d51b5a715dc05
-rw-r--r-- | exif.c | 8 | ||||
-rw-r--r-- | gpsinfo.c | 2 | ||||
-rw-r--r-- | jhead.c | 2 | ||||
-rwxr-xr-x | jpgfile.c | 54 | ||||
-rw-r--r-- | main.c | 68 |
5 files changed, 67 insertions, 67 deletions
@@ -28,7 +28,7 @@ int NumOrientations = 0; #undef SUPERDEBUG #ifdef SUPERDEBUG -#define printf LOGE +#define printf ALOGE #endif //-------------------------------------------------------------------------- @@ -1208,7 +1208,7 @@ static void create_EXIF_internal(ExifElement_t* elements, int exifTagCount, int int DirExifLink = 0; #ifdef SUPERDEBUG - LOGE("create_EXIF %d exif elements, %d gps elements", exifTagCount, gpsTagCount); + ALOGE("create_EXIF %d exif elements, %d gps elements", exifTagCount, gpsTagCount); #endif MotorolaOrder = 0; @@ -1264,7 +1264,7 @@ static void create_EXIF_internal(ExifElement_t* elements, int exifTagCount, int continue; } #ifdef SUPERDEBUG - LOGE("create_EXIF saving tag %x value \"%s\"",elements[i].Tag, elements[i].Value); + ALOGE("create_EXIF saving tag %x value \"%s\"",elements[i].Tag, elements[i].Value); #endif writeExifTagAndData(elements[i].Tag, entry->Format, @@ -1330,7 +1330,7 @@ static void create_EXIF_internal(ExifElement_t* elements, int exifTagCount, int continue; } #ifdef SUPERDEBUG - LOGE("create_EXIF saving GPS tag %x value \"%s\"",elements[i].Tag, elements[i].Value); + ALOGE("create_EXIF saving GPS tag %x value \"%s\"",elements[i].Tag, elements[i].Value); #endif writeExifTagAndData(elements[i].Tag, entry->Format, @@ -60,7 +60,7 @@ static TagTable_t GpsTags[]= { #undef SUPERDEBUG #ifdef SUPERDEBUG -#define printf LOGE +#define printf ALOGE #endif @@ -104,7 +104,7 @@ static int ShowFileInfo = TRUE; // Indicates to show standard file info //-------------------------------------------------------------------------- void ErrFatal(char * msg) { - LOGE("Error : %s\n", msg); + ALOGE("Error : %s\n", msg); if (CurrentFile) fprintf(stderr,"in file '%s'\n",CurrentFile); exit(EXIT_FAILURE); } @@ -24,7 +24,7 @@ static int HaveAll; #undef SUPERDEBUG #ifdef SUPERDEBUG -#define printf LOGE +#define printf ALOGE #endif @@ -165,7 +165,7 @@ int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) if (itemlen < 2){ // ErrFatal("invalid marker"); - LOGE("invalid marker"); + ALOGE("invalid marker"); return FALSE; } @@ -174,7 +174,7 @@ int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) Data = (uchar *)malloc(itemlen); if (Data == NULL){ // ErrFatal("Could not allocate memory"); - LOGE("Could not allocate memory"); + ALOGE("Could not allocate memory"); return 0; } Sections[SectionsRead].Data = Data; @@ -186,7 +186,7 @@ int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section. if (got != itemlen-2){ // ErrFatal("Premature end of file?"); - LOGE("Premature end of file?"); + ALOGE("Premature end of file?"); return FALSE; } SectionsRead += 1; @@ -208,14 +208,14 @@ int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) Data = (uchar *)malloc(size); if (Data == NULL){ // ErrFatal("could not allocate data for entire image"); - LOGE("could not allocate data for entire image"); + ALOGE("could not allocate data for entire image"); return FALSE; } got = fread(Data, 1, size, infile); if (got != size){ // ErrFatal("could not read the rest of the image"); - LOGE("could not read the rest of the image"); + ALOGE("could not read the rest of the image"); return FALSE; } @@ -359,7 +359,7 @@ int ReadJpegSectionsFromBuffer (unsigned char* buffer, unsigned int buffer_size, itemlen = (lh << 8) | ll; if (itemlen < 2) { - LOGE("invalid marker"); + ALOGE("invalid marker"); return FALSE; } @@ -367,7 +367,7 @@ int ReadJpegSectionsFromBuffer (unsigned char* buffer, unsigned int buffer_size, Data = (uchar *)malloc(itemlen); if (Data == NULL) { - LOGE("Could not allocate memory"); + ALOGE("Could not allocate memory"); return 0; } Sections[SectionsRead].Data = Data; @@ -377,7 +377,7 @@ int ReadJpegSectionsFromBuffer (unsigned char* buffer, unsigned int buffer_size, Data[1] = (uchar)ll; if (pos+itemlen-2 > buffer_size) { - LOGE("Premature end of file?"); + ALOGE("Premature end of file?"); return FALSE; } @@ -397,12 +397,12 @@ int ReadJpegSectionsFromBuffer (unsigned char* buffer, unsigned int buffer_size, size = buffer_size - pos; if (size < 1) { - LOGE("could not read the rest of the image"); + ALOGE("could not read the rest of the image"); return FALSE; } Data = (uchar *)malloc(size); if (Data == NULL) { - LOGE("%d: could not allocate data for entire image size: %d", __LINE__, size); + ALOGE("%d: could not allocate data for entire image size: %d", __LINE__, size); return FALSE; } @@ -418,7 +418,7 @@ int ReadJpegSectionsFromBuffer (unsigned char* buffer, unsigned int buffer_size, return TRUE; case M_EOI: // in case it's a tables-only JPEG stream - LOGE("No image in jpeg!\n"); + ALOGE("No image in jpeg!\n"); return FALSE; case M_COM: // Comment section @@ -525,7 +525,7 @@ int ReadJpegFile(const char * FileName, ReadMode_t ReadMode) infile = fopen(FileName, "rb"); // Unix ignores 'b', windows needs it. if (infile == NULL) { - LOGE("can't open '%s'", FileName); + ALOGE("can't open '%s'", FileName); fprintf(stderr, "can't open '%s'\n", FileName); return FALSE; } @@ -578,7 +578,7 @@ int SaveThumbnail(char * ThumbFileName) return TRUE; }else{ // ErrFatal("Could not write thumbnail file"); - LOGE("Could not write thumbnail file"); + ALOGE("Could not write thumbnail file"); return FALSE; } } @@ -603,7 +603,7 @@ int ReplaceThumbnailFromBuffer(const char * Thumb, int ThumbLen) // of the exif header, which is risky, and jhad doesn't know how to do. fprintf(stderr,"Image contains no thumbnail to replace - add is not possible\n"); #ifdef SUPERDEBUG - LOGE("Image contains no thumbnail to replace - add is not possible\n"); + ALOGE("Image contains no thumbnail to replace - add is not possible\n"); #endif return FALSE; } @@ -611,7 +611,7 @@ int ReplaceThumbnailFromBuffer(const char * Thumb, int ThumbLen) if (Thumb) { if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){ //ErrFatal("Thumbnail is too large to insert into exif header"); - LOGE("Thumbnail is too large to insert into exif header"); + ALOGE("Thumbnail is too large to insert into exif header"); return FALSE; } } else { @@ -642,7 +642,7 @@ int ReplaceThumbnailFromBuffer(const char * Thumb, int ThumbLen) ExifSection->Size = NewExifSize; #ifdef SUPERDEBUG - LOGE("ReplaceThumbnail successful thumblen %d", ThumbLen); + ALOGE("ReplaceThumbnail successful thumblen %d", ThumbLen); #endif return TRUE; } @@ -668,7 +668,7 @@ int ReplaceThumbnail(const char * ThumbFileName) // of the exif header, which is risky, and jhad doesn't know how to do. fprintf(stderr,"Image contains no thumbnail to replace - add is not possible\n"); #ifdef SUPERDEBUG - LOGE("Image contains no thumbnail to replace - add is not possible\n"); + ALOGE("Image contains no thumbnail to replace - add is not possible\n"); #endif return FALSE; } @@ -678,7 +678,7 @@ int ReplaceThumbnail(const char * ThumbFileName) if (ThumbnailFile == NULL){ //ErrFatal("Could not read thumbnail file"); - LOGE("Could not read thumbnail file"); + ALOGE("Could not read thumbnail file"); return FALSE; } @@ -690,7 +690,7 @@ int ReplaceThumbnail(const char * ThumbFileName) if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){ //ErrFatal("Thumbnail is too large to insert into exif header"); - LOGE("Thumbnail is too large to insert into exif header"); + ALOGE("Thumbnail is too large to insert into exif header"); return FALSE; } }else{ @@ -723,7 +723,7 @@ int ReplaceThumbnail(const char * ThumbFileName) ExifSection->Size = NewExifSize; #ifdef SUPERDEBUG - LOGE("ReplaceThumbnail successful thumblen %d", ThumbLen); + ALOGE("ReplaceThumbnail successful thumblen %d", ThumbLen); #endif return TRUE; } @@ -787,13 +787,13 @@ int WriteJpegFile(const char * FileName) int a; if (!HaveAll){ - LOGE("Can't write back - didn't read all"); + ALOGE("Can't write back - didn't read all"); return FALSE; } outfile = fopen(FileName,"wb"); if (outfile == NULL){ - LOGE("Could not open file for write"); + ALOGE("Could not open file for write"); return FALSE; } @@ -820,7 +820,7 @@ int WriteJpegFile(const char * FileName) nWrite = fwrite(Sections[a].Data, 1, Sections[a].Size, outfile); writeOk = (nWrite == Sections[a].Size); if(!writeOk){ - LOGE("write section %d failed expect %d actual %d",a,Sections[a].Size,nWrite); + ALOGE("write section %d failed expect %d actual %d",a,Sections[a].Size,nWrite); break; } } @@ -830,7 +830,7 @@ int WriteJpegFile(const char * FileName) nWrite = fwrite(Sections[a].Data, 1,Sections[a].Size, outfile); writeOk = (nWrite == Sections[a].Size); if (!writeOk){ - LOGE("write section %d failed expect %d actual %d",a,Sections[a].Size,nWrite); + ALOGE("write section %d failed expect %d actual %d",a,Sections[a].Size,nWrite); } } @@ -855,7 +855,7 @@ int WriteJpegToBuffer(unsigned char* buffer, unsigned int buffer_size) } if (!HaveAll){ - LOGE("Can't write back - didn't read all"); + ALOGE("Can't write back - didn't read all"); return FALSE; } @@ -1004,7 +1004,7 @@ Section_t * CreateSection(int SectionType, unsigned char * Data, int Size) if (SectionsRead < NewIndex){ // ErrFatal("Too few sections!"); - LOGE("Too few sections!"); + ALOGE("Too few sections!"); return FALSE; } @@ -69,7 +69,7 @@ extern void ResetJpgfile(); static int loadExifInfo(const char* FileName, int readJPG) { #ifdef SUPERDEBUG - LOGE("loadExifInfo"); + ALOGE("loadExifInfo"); #endif int Modified = FALSE; ReadMode_t ReadMode = READ_METADATA; @@ -79,7 +79,7 @@ static int loadExifInfo(const char* FileName, int readJPG) { } #ifdef SUPERDEBUG - LOGE("ResetJpgfile"); + ALOGE("ResetJpgfile"); #endif ResetJpgfile(); @@ -100,7 +100,7 @@ static int loadExifInfo(const char* FileName, int readJPG) { strncpy(ImageInfo.FileName, FileName, PATH_MAX); #ifdef SUPERDEBUG - LOGE("ReadJpegFile"); + ALOGE("ReadJpegFile"); #endif return ReadJpegFile(FileName, ReadMode); } @@ -110,7 +110,7 @@ static void saveJPGFile(const char* filename) { struct stat buf; #ifdef SUPERDEBUG - LOGE("Modified: %s\n", filename); + ALOGE("Modified: %s\n", filename); #endif strncpy(backupName, filename, 395); @@ -118,25 +118,25 @@ static void saveJPGFile(const char* filename) { // Remove any .old file name that may pre-exist #ifdef SUPERDEBUG - LOGE("removing backup %s", backupName); + ALOGE("removing backup %s", backupName); #endif unlink(backupName); // Rename the old file. #ifdef SUPERDEBUG - LOGE("rename %s to %s", filename, backupName); + ALOGE("rename %s to %s", filename, backupName); #endif rename(filename, backupName); // Write the new file. #ifdef SUPERDEBUG - LOGE("WriteJpegFile %s", filename); + ALOGE("WriteJpegFile %s", filename); #endif if (WriteJpegFile(filename)) { // Copy the access rights from original file #ifdef SUPERDEBUG - LOGE("stating old file %s", backupName); + ALOGE("stating old file %s", backupName); #endif if (stat(backupName, &buf) == 0){ // set Unix access rights and time to new file @@ -151,15 +151,15 @@ static void saveJPGFile(const char* filename) { // Now that we are done, remove original file. #ifdef SUPERDEBUG - LOGE("unlinking old file %s", backupName); + ALOGE("unlinking old file %s", backupName); #endif unlink(backupName); #ifdef SUPERDEBUG - LOGE("returning from saveJPGFile"); + ALOGE("returning from saveJPGFile"); #endif } else { #ifdef SUPERDEBUG - LOGE("WriteJpegFile failed, restoring from backup file"); + ALOGE("WriteJpegFile failed, restoring from backup file"); #endif // move back the backup file rename(backupName, filename); @@ -168,7 +168,7 @@ static void saveJPGFile(const char* filename) { void copyThumbnailData(uchar* thumbnailData, int thumbnailLen) { #ifdef SUPERDEBUG - LOGE("******************************** copyThumbnailData\n"); + ALOGE("******************************** copyThumbnailData\n"); #endif Section_t* ExifSection = FindSection(M_EXIF); if (ExifSection == NULL) { @@ -195,7 +195,7 @@ void copyThumbnailData(uchar* thumbnailData, int thumbnailLen) { static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring jattributes) { #ifdef SUPERDEBUG - LOGE("******************************** saveAttributes\n"); + ALOGE("******************************** saveAttributes\n"); #endif // format of attributes string passed from java: // "attrCnt attr1=valueLen value1attr2=value2Len value2..." @@ -209,14 +209,14 @@ static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring goto exit; } #ifdef SUPERDEBUG - LOGE("attributes %s\n", attributes); + ALOGE("attributes %s\n", attributes); #endif // Get the number of attributes - it's the first number in the string. attrCnt = atoi(attributes); char* attrPtr = strchr(attributes, ' ') + 1; #ifdef SUPERDEBUG - LOGE("attribute count %d attrPtr %s\n", attrCnt, attrPtr); + ALOGE("attribute count %d attrPtr %s\n", attrCnt, attrPtr); #endif // Load all the hash exif elements into a more c-like structure @@ -239,13 +239,13 @@ static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring char* tagEnd = strchr(attrPtr, '='); if (tagEnd == 0) { #ifdef SUPERDEBUG - LOGE("saveAttributes: couldn't find end of tag"); + ALOGE("saveAttributes: couldn't find end of tag"); #endif goto exit; } if (tagEnd - attrPtr > 99) { #ifdef SUPERDEBUG - LOGE("saveAttributes: attribute tag way too long"); + ALOGE("saveAttributes: attribute tag way too long"); #endif goto exit; } @@ -268,7 +268,7 @@ static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring attrPtr = strchr(attrPtr, ' ') + 1; if (attrPtr == 0) { #ifdef SUPERDEBUG - LOGE("saveAttributes: couldn't find end of value len"); + ALOGE("saveAttributes: couldn't find end of value len"); #endif goto exit; } @@ -283,14 +283,14 @@ static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring attrPtr += valueLen; #ifdef SUPERDEBUG - LOGE("tag %s id %d value %s data length=%d isGps=%d", tag, exifElementTable[i].Tag, + ALOGE("tag %s id %d value %s data length=%d isGps=%d", tag, exifElementTable[i].Tag, exifElementTable[i].Value, exifElementTable[i].DataLength, exifElementTable[i].GpsTag); #endif } filename = (*env)->GetStringUTFChars(env, jfilename, NULL); #ifdef SUPERDEBUG - LOGE("Call loadAttributes() with filename is %s. Loading exif info\n", filename); + ALOGE("Call loadAttributes() with filename is %s. Loading exif info\n", filename); #endif loadExifInfo(filename, TRUE); @@ -298,7 +298,7 @@ static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring // DumpExifMap = TRUE; ShowTags = TRUE; ShowImageInfo(TRUE); - LOGE("create exif 2"); + ALOGE("create exif 2"); #endif // If the jpg file has a thumbnail, preserve it. @@ -323,7 +323,7 @@ static void saveAttributes(JNIEnv *env, jobject jobj, jstring jfilename, jstring exit: #ifdef SUPERDEBUG - LOGE("cleaning up now in saveAttributes"); + ALOGE("cleaning up now in saveAttributes"); #endif // try to clean up resources if (attributes) { @@ -343,7 +343,7 @@ exit: free(thumbnailData); } #ifdef SUPERDEBUG - LOGE("returning from saveAttributes"); + ALOGE("returning from saveAttributes"); #endif // Temporarily saving these commented out lines because they represent a lot of figuring out @@ -390,7 +390,7 @@ exit: static jboolean appendThumbnail(JNIEnv *env, jobject jobj, jstring jfilename, jstring jthumbnailfilename) { #ifdef SUPERDEBUG - LOGE("******************************** appendThumbnail\n"); + ALOGE("******************************** appendThumbnail\n"); #endif const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL); @@ -402,7 +402,7 @@ static jboolean appendThumbnail(JNIEnv *env, jobject jobj, jstring jfilename, js return JNI_FALSE; } #ifdef SUPERDEBUG - LOGE("*******before actual call to ReplaceThumbnail\n"); + ALOGE("*******before actual call to ReplaceThumbnail\n"); ShowImageInfo(TRUE); #endif ReplaceThumbnail(thumbnailfilename); @@ -419,7 +419,7 @@ static jboolean appendThumbnail(JNIEnv *env, jobject jobj, jstring jfilename, js static void commitChanges(JNIEnv *env, jobject jobj, jstring jfilename) { #ifdef SUPERDEBUG - LOGE("******************************** commitChanges\n"); + ALOGE("******************************** commitChanges\n"); #endif const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL); if (filename) { @@ -432,7 +432,7 @@ static void commitChanges(JNIEnv *env, jobject jobj, jstring jfilename) static jbyteArray getThumbnail(JNIEnv *env, jobject jobj, jstring jfilename) { #ifdef SUPERDEBUG - LOGE("******************************** getThumbnail\n"); + ALOGE("******************************** getThumbnail\n"); #endif const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL); @@ -441,7 +441,7 @@ static jbyteArray getThumbnail(JNIEnv *env, jobject jobj, jstring jfilename) Section_t* ExifSection = FindSection(M_EXIF); if (ExifSection == NULL || ImageInfo.ThumbnailSize == 0) { #ifdef SUPERDEBUG - LOGE("no exif section or size == 0, so no thumbnail\n"); + ALOGE("no exif section or size == 0, so no thumbnail\n"); #endif goto noThumbnail; } @@ -450,13 +450,13 @@ static jbyteArray getThumbnail(JNIEnv *env, jobject jobj, jstring jfilename) jbyteArray byteArray = (*env)->NewByteArray(env, ImageInfo.ThumbnailSize); if (byteArray == NULL) { #ifdef SUPERDEBUG - LOGE("couldn't allocate thumbnail memory, so no thumbnail\n"); + ALOGE("couldn't allocate thumbnail memory, so no thumbnail\n"); #endif goto noThumbnail; } (*env)->SetByteArrayRegion(env, byteArray, 0, ImageInfo.ThumbnailSize, thumbnailPointer); #ifdef SUPERDEBUG - LOGE("thumbnail size %d\n", ImageInfo.ThumbnailSize); + ALOGE("thumbnail size %d\n", ImageInfo.ThumbnailSize); #endif (*env)->ReleaseStringUTFChars(env, jfilename, filename); DiscardData(); @@ -485,7 +485,7 @@ static int addKeyValueString(char** buf, int bufLen, const char* key, const char if (newLen >= bufLen) { #ifdef REALLOCTEST bufLen = newLen + 5; - LOGE("reallocing to %d", bufLen); + ALOGE("reallocing to %d", bufLen); #else bufLen = newLen + 500; #endif @@ -497,7 +497,7 @@ static int addKeyValueString(char** buf, int bufLen, const char* key, const char // append the new attribute and value snprintf(*buf + strlen(*buf), bufLen, "%s%s%s", key, valueLen, value); #ifdef SUPERDEBUG - LOGE("buf %s", *buf); + ALOGE("buf %s", *buf); #endif ++attributeCount; return bufLen; @@ -529,7 +529,7 @@ static int addKeyValueRational(char** buf, int bufLen, const char* key, rat_t va static jstring getAttributes(JNIEnv *env, jobject jobj, jstring jfilename) { #ifdef SUPERDEBUG - LOGE("******************************** getAttributes\n"); + ALOGE("******************************** getAttributes\n"); #endif const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL); loadExifInfo(filename, FALSE); @@ -707,7 +707,7 @@ static jstring getAttributes(JNIEnv *env, jobject jobj, jstring jfilename) free(buf); #ifdef SUPERDEBUG - LOGE("*********Returning result \"%s\"", finalResult); + ALOGE("*********Returning result \"%s\"", finalResult); #endif jstring result = ((*env)->NewStringUTF(env, finalResult)); free(finalResult); |