summaryrefslogtreecommitdiffstats
path: root/src/file_ddf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-04-08 11:21:28 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-04-08 11:21:28 +0200
commitb9980e498714e98e53688906ed3b876a1ad79ad1 (patch)
tree72aaf61157292c52d547be093f4668900115b4f1 /src/file_ddf.c
parent821d1e698a15c29b3c20b4585c804e96ba317784 (diff)
PhotoRec: use get_time_from_xxx() new functions
Diffstat (limited to 'src/file_ddf.c')
-rw-r--r--src/file_ddf.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/file_ddf.c b/src/file_ddf.c
index 80a87fb..805c95c 100644
--- a/src/file_ddf.c
+++ b/src/file_ddf.c
@@ -81,21 +81,12 @@ struct MasterHeader
static int header_check_aux(const unsigned char *buffer, file_recovery_t *file_recovery_new)
{
+ const char *date_asc=(const char *)&buffer[0x3f];
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_ddf.extension;
- if(buffer[0x43]=='-' && buffer[0x46]=='-' && buffer[0x49]=='_')
+ if(date_asc[4]=='-' && date_asc[7]=='-' && date_asc[10]=='_')
{
- struct tm tm_time;
- memset(&tm_time, 0, sizeof(tm_time));
- tm_time.tm_sec=(buffer[0x4e]-'0')*10+(buffer[0x4f]-'0'); /* seconds 0-59 */
- tm_time.tm_min=(buffer[0x4c]-'0')*10+(buffer[0x4d]-'0'); /* minutes 0-59 */
- tm_time.tm_hour=(buffer[0x4a]-'0')*10+(buffer[0x4b]-'0'); /* hours 0-23*/
- tm_time.tm_mday=(buffer[0x47]-'0')*10+(buffer[0x48]-'0'); /* day of the month 1-31 */
- tm_time.tm_mon=(buffer[0x44]-'0')*10+(buffer[0x45]-'0')-1; /* month 0-11 */
- tm_time.tm_year=(buffer[0x3f]-'0')*1000+(buffer[0x40]-'0')*100+
- (buffer[0x41]-'0')*10+(buffer[0x42]-'0')-1900; /* year */
- tm_time.tm_isdst = -1; /* unknown daylight saving time */
- file_recovery_new->time=mktime(&tm_time);
+ file_recovery_new->time=get_time_from_YYYY_MM_DD_HHMMSS(date_asc);
}
return 1;
}