summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2012-09-02 20:12:12 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-02 20:12:13 -0700
commit3a1a370a96a2a09e640e67e370aec8f6a9d93bb4 (patch)
treef5452ce346dbef36081168dd15144bbf63963998 /src
parent8a81312ec4065063ed69147a0340ab96d77b6d7d (diff)
parentd4295b44baead5276704016a37ade53075fc209e (diff)
downloadandroid_packages_apps_Snap-3a1a370a96a2a09e640e67e370aec8f6a9d93bb4.tar.gz
android_packages_apps_Snap-3a1a370a96a2a09e640e67e370aec8f6a9d93bb4.tar.bz2
android_packages_apps_Snap-3a1a370a96a2a09e640e67e370aec8f6a9d93bb4.zip
Merge "Fix some typos and style in previous CL" into gb-ub-photos-arches
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/exif/ExifData.java4
-rw-r--r--src/com/android/gallery3d/exif/ExifOutputStream.java19
-rw-r--r--src/com/android/gallery3d/exif/OrderedDataOutputStream.java2
3 files changed, 13 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/exif/ExifData.java b/src/com/android/gallery3d/exif/ExifData.java
index 0251c74b1..88fa13cab 100644
--- a/src/com/android/gallery3d/exif/ExifData.java
+++ b/src/com/android/gallery3d/exif/ExifData.java
@@ -95,7 +95,7 @@ public class ExifData {
}
/**
- * Gets the strip count
+ * Gets the strip count.
*/
public int getStripCount() {
return mStripBytes.size();
@@ -117,7 +117,7 @@ public class ExifData {
}
/**
- * Returns true if this header contains compressed strip of thumbnail.
+ * Returns true if this header contains uncompressed strip of thumbnail.
*/
public boolean hasUncompressedStrip() {
return mStripBytes.size() != 0;
diff --git a/src/com/android/gallery3d/exif/ExifOutputStream.java b/src/com/android/gallery3d/exif/ExifOutputStream.java
index 1c0baf251..6c3335d3d 100644
--- a/src/com/android/gallery3d/exif/ExifOutputStream.java
+++ b/src/com/android/gallery3d/exif/ExifOutputStream.java
@@ -40,7 +40,7 @@ public class ExifOutputStream extends FilterOutputStream {
private static final short TIFF_HEADER_SIZE = 8;
private ExifData mExifData;
- private int mState;
+ private int mState = STATE_SOI;
private int mByteToSkip;
private int mByteToCopy;
private ByteBuffer mBuffer = ByteBuffer.allocate(4);
@@ -136,6 +136,7 @@ public class ExifOutputStream extends FilterOutputStream {
createRequiredIfdAndTag();
int exifSize = calculateAllOffset();
OrderedDataOutputStream dataOutputStream = new OrderedDataOutputStream(out);
+ dataOutputStream.setByteOrder(ByteOrder.BIG_ENDIAN);
dataOutputStream.writeShort(APP1);
dataOutputStream.writeShort((short) (exifSize + 8));
dataOutputStream.writeInt(EXIF_HEADER);
@@ -148,7 +149,7 @@ public class ExifOutputStream extends FilterOutputStream {
dataOutputStream.setByteOrder(mExifData.getByteOrder());
dataOutputStream.writeShort(TIFF_HEADER);
dataOutputStream.writeInt(8);
- writeAllTag(dataOutputStream);
+ writeAllTags(dataOutputStream);
writeThumbnail(dataOutputStream);
}
@@ -162,7 +163,7 @@ public class ExifOutputStream extends FilterOutputStream {
}
}
- private void writeAllTag(OrderedDataOutputStream dataOutputStream) throws IOException {
+ private void writeAllTags(OrderedDataOutputStream dataOutputStream) throws IOException {
writeIfd(mExifData.getIfdData(IfdId.TYPE_IFD_0), dataOutputStream);
writeIfd(mExifData.getIfdData(IfdId.TYPE_IFD_EXIF), dataOutputStream);
IfdData interoperabilityIfd = mExifData.getIfdData(IfdId.TYPE_IFD_INTEROPERABILITY);
@@ -191,7 +192,7 @@ public class ExifOutputStream extends FilterOutputStream {
dataOutputStream.writeInt(tag.getOffset());
} else {
writeTagValue(tag, dataOutputStream);
- for (int i = 0; i < 4 - tag.getDataSize(); i++) {
+ for (int i = 0, n = 4 - tag.getDataSize(); i < n; i++) {
dataOutputStream.write(0);
}
}
@@ -209,19 +210,19 @@ public class ExifOutputStream extends FilterOutputStream {
switch (tag.getDataType()) {
case ExifTag.TYPE_ASCII:
dataOutputStream.write(tag.getString().getBytes());
- int remain = tag.getComponentCount() - tag.getString().getBytes().length;
+ int remain = tag.getComponentCount() - tag.getString().length();
for (int i = 0; i < remain; i++) {
dataOutputStream.write(0);
}
break;
case ExifTag.TYPE_INT:
- for (int i = 0; i < tag.getComponentCount(); i++) {
+ for (int i = 0, n = tag.getComponentCount(); i < n; i++) {
dataOutputStream.writeInt(tag.getInt(i));
}
break;
case ExifTag.TYPE_RATIONAL:
case ExifTag.TYPE_UNSIGNED_RATIONAL:
- for (int i = 0; i < tag.getComponentCount(); i++) {
+ for (int i = 0, n = tag.getComponentCount(); i < n; i++) {
dataOutputStream.writeRational(tag.getRational(i));
}
break;
@@ -232,12 +233,12 @@ public class ExifOutputStream extends FilterOutputStream {
dataOutputStream.write(buf);
break;
case ExifTag.TYPE_UNSIGNED_INT:
- for (int i = 0; i < tag.getComponentCount(); i++) {
+ for (int i = 0, n = tag.getComponentCount(); i < n; i++) {
dataOutputStream.writeInt((int) tag.getUnsignedInt(i));
}
break;
case ExifTag.TYPE_UNSIGNED_SHORT:
- for (int i = 0; i < tag.getComponentCount(); i++) {
+ for (int i = 0, n = tag.getComponentCount(); i < n; i++) {
dataOutputStream.writeShort((short) tag.getUnsignedShort(i));
}
break;
diff --git a/src/com/android/gallery3d/exif/OrderedDataOutputStream.java b/src/com/android/gallery3d/exif/OrderedDataOutputStream.java
index 9244be329..4f785a889 100644
--- a/src/com/android/gallery3d/exif/OrderedDataOutputStream.java
+++ b/src/com/android/gallery3d/exif/OrderedDataOutputStream.java
@@ -22,7 +22,7 @@ import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-public class OrderedDataOutputStream extends FilterOutputStream {
+class OrderedDataOutputStream extends FilterOutputStream {
private final ByteBuffer mByteBuffer = ByteBuffer.allocate(4);
public OrderedDataOutputStream(OutputStream out) {