mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
remove code figuring md5sum on full dict file; the sum on data is all
we're using now.
This commit is contained in:
parent
a5bd932e0a
commit
bcc8c0c249
2 changed files with 1 additions and 44 deletions
|
@ -527,49 +527,6 @@ public class DictUtils {
|
||||||
// want this later? Environment.MEDIA_MOUNTED_READ_ONLY
|
// 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 )
|
private static File getSDDir( Context context )
|
||||||
{
|
{
|
||||||
File result = null;
|
File result = null;
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
|
||||||
JSONObject params = new JSONObject();
|
JSONObject params = new JSONObject();
|
||||||
int lang = DictLangCache.getDictLangCode( context, dal );
|
int lang = DictLangCache.getDictLangCode( context, dal );
|
||||||
String langStr = DictLangCache.getLangName( context, lang );
|
String langStr = DictLangCache.getLangName( context, lang );
|
||||||
String sum = DictUtils.getMD5SumFor( context, dal );
|
String sum = DictLangCache.getDictMD5Sum( context, dal.name );
|
||||||
try {
|
try {
|
||||||
params.put( k_NAME, dal.name );
|
params.put( k_NAME, dal.name );
|
||||||
params.put( k_LANG, langStr );
|
params.put( k_LANG, langStr );
|
||||||
|
|
Loading…
Reference in a new issue