Extend return codes for chinachip_patch().

Instead of passing error messages using a callback function (which becomes
awkward when used from a C++ class object) return distinct error codes from
chinachip_patch(). This also removes the kludge to support translations for
Rockbox Utility and moves the strings to translate to the installation class
where they belong.

As a side effect info messages won't be passed to Rockbox Utility anymore, but
the details of the patching progress aren't of that much interest for the user
anyway.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31115 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2011-12-03 09:41:44 +00:00
parent 07da9ce5ea
commit 059cb71c96
5 changed files with 110 additions and 103 deletions

View file

@ -25,24 +25,6 @@
#define VERSION "0.1"
#define PRINT(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__)
static void info(void* userdata, char* fmt, ...)
{
(void)userdata;
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
static void err(void* userdata, char* fmt, ...)
{
(void)userdata;
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
void usage(char* name)
{
PRINT("Usage:");
@ -66,7 +48,6 @@ int main(int argc, char* argv[])
return 1;
}
return chinachip_patch(argv[1], argv[2], argv[3], argc > 4 ? argv[4] : NULL,
&info, &err, NULL);
return chinachip_patch(argv[1], argv[2], argv[3], argc > 4 ? argv[4] : NULL);
}