Skip to content

Commit

Permalink
Stops using udid for naming filenames. Refs #37.
Browse files Browse the repository at this point in the history
The udid is not available any more. There are replacements, but I don't
think we really need this.
  • Loading branch information
gradha committed May 30, 2015
1 parent ff7c0e9 commit eb00fb5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
4 changes: 1 addition & 3 deletions external/egf/hardware.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// vim:tabstop=4 shiftwidth=4 syntax=objc
/**
* \file hardware.h
* \brief Functions to query the underlying hardware.
Expand Down Expand Up @@ -47,7 +48,6 @@ struct Hardware_info_t
HW_FAMILY family; // Hardware family.
char version; // Zero or positive means recognised version.
char *name; // Hardware name as C string.
char udid[UDID_LEN + 1]; // UDID plus NULL terminator.
};


Expand All @@ -56,5 +56,3 @@ void destroy_hardware_info(Hardware_info **info);


#endif // __EGF_HARDWARE_H__

// vim:tabstop=4 shiftwidth=4 syntax=objc
18 changes: 2 additions & 16 deletions external/egf/hardware.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// vim:tabstop=4 shiftwidth=4 encoding=utf-8 syntax=objc
// vim:tabstop=4 shiftwidth=4 syntax=objc

#include "egf/hardware.h"

Expand Down Expand Up @@ -34,26 +34,12 @@
}
info->name = calloc(1, size);
if (!info->name) {
DLOG(@"Not enough memory to get hardware name (%lu).", size);
DLOG(@"Not enough memory to get hardware name (%ld).", size);
free(info);
info = 0;
goto exit;
}

info->udid[0] = 0;
UIDevice *dev = [UIDevice currentDevice];
NSString *udid = dev.uniqueIdentifier;
if (udid) {
if (UDID_LEN == strlen([udid cStringUsingEncoding:1])) {
strncpy(info->udid, [udid cStringUsingEncoding:1], UDID_LEN);
info->udid[UDID_LEN] = 0;
} else {
DLOG(@"Unexpected UDID length for '%@'.", udid);
}
} else {
DLOG(@"Couldn't read UDID.");
}

sysctlbyname("hw.machine", info->name, &size, 0, 0);
DLOG(@"Retrieved hardware string '%s'.", info->name);

Expand Down
5 changes: 2 additions & 3 deletions src/controllers/Share_tab.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,9 @@ - (NSString*)get_export_filename
Hardware_info *info = get_hardware_info();

NSString *ret = [NSString stringWithFormat:@"positions %04d-%02d-%02d "
@"%02d:%02d:%02d %s %s", [now year], [now month], [now day],
@"%02d:%02d:%02d %s", [now year], [now month], [now day],
[now hour], [now minute], [now second],
(info && info->name) ? (info->name) : ("unknown"),
(info && info->udid[0]) ? (info->udid) : ("no udid"), nil];
(info && info->name) ? (info->name) : ("unknown"), nil];

destroy_hardware_info(&info);
return ret;
Expand Down

0 comments on commit eb00fb5

Please sign in to comment.