From bcc8c0c249591a81407499fea46b35d1c9b2bde2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 13 Sep 2012 19:33:17 -0700 Subject: [PATCH] remove code figuring md5sum on full dict file; the sum on data is all we're using now. --- .../org/eehouse/android/xw4/DictUtils.java | 43 ------------------- .../android/xw4/UpdateCheckReceiver.java | 2 +- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java index 02a519bdc..1a3f5767e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java @@ -527,49 +527,6 @@ public class DictUtils { // want this later? Environment.MEDIA_MOUNTED_READ_ONLY } - private static String figureMD5Sum( Context context, DictAndLoc dandl ) - { - byte[] digest = null; - String result = null; - String name = dandl.name; - File path = getDictFile( context, addDictExtn( name ), dandl.loc ); - try { - InputStream fis = new FileInputStream( path ); - byte[] buffer = new byte[1024]; - MessageDigest md = MessageDigest.getInstance("MD5"); - for ( ; ; ) { - int nRead = fis.read( buffer ); - if ( 0 > nRead ) { - break; - } - md.update( buffer, 0, nRead ); - } - fis.close(); - - digest = md.digest(); - } catch ( java.io.FileNotFoundException fnfe ) { - DbgUtils.loge( fnfe ); - } catch( java.security.NoSuchAlgorithmException nsae ) { - DbgUtils.loge( nsae ); - } catch( java.io.IOException ioe ) { - DbgUtils.loge( ioe ); - } - - return Utils.digestToString( digest ); - } // figureMD5Sum - - public static String getMD5SumFor( Context context, DictAndLoc dandl ) - { - String sum = null; // DBUtils.getDictMD5Sum( context, dandl.name, - // dandl.loc.ordinal() ); - if ( null == sum ) { - sum = figureMD5Sum( context, dandl ); - // DBUtils.setDictMD5Sum( context, dandl.name, - // dandl.loc.ordinal(), sum ); - } - return sum; - } - private static File getSDDir( Context context ) { File result = null; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java index 36c14d98f..bda133c38 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java @@ -253,7 +253,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { JSONObject params = new JSONObject(); int lang = DictLangCache.getDictLangCode( context, dal ); String langStr = DictLangCache.getLangName( context, lang ); - String sum = DictUtils.getMD5SumFor( context, dal ); + String sum = DictLangCache.getDictMD5Sum( context, dal.name ); try { params.put( k_NAME, dal.name ); params.put( k_LANG, langStr );