summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-08-31 09:58:49 +0800
committerEarl Ou <shunhsingou@google.com>2012-08-31 10:00:23 +0800
commitd4295b44baead5276704016a37ade53075fc209e (patch)
tree41c2ee9898c2432ccf2c7e8ff22999f86d150b2d /src
parent1c6566dfa563ece622df26a851e10c1c3b371a52 (diff)
downloadandroid_packages_apps_Snap-d4295b44baead5276704016a37ade53075fc209e.tar.gz
android_packages_apps_Snap-d4295b44baead5276704016a37ade53075fc209e.tar.bz2
android_packages_apps_Snap-d4295b44baead5276704016a37ade53075fc209e.zip
Fix some typos and style in previous CL
Change-Id: If78c0bfebccb20b0c4dad42a11b5dd0946b4e172
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) {