Modified in acordance to coding guidelines.
[glsdk/dual-decode.git] / src / main.c
index dca5863d43e1a19a23626be0822aff12ace34cd1..37121748e95fae2b01af97fe43c5a751600f8ad8 100644 (file)
@@ -66,12 +66,11 @@ gint setAbsolutePathname (gchar *file, gchar **uri)
        gchar *realPath = NULL;
        gint ret                = ERR_SUCCESS;
 
-       if(NULL == uri){
+       if (NULL == uri){
                return ERR_INVALIDPARAM;
        }       
 
-       if(NULL == file){
-               /*A BUG Here*/
+       if (NULL == file){
                g_printerr("BUG: file: " __FILE__ " line: %d" "\n", __LINE__);          
                return ERR_BUG;
        }
@@ -79,18 +78,17 @@ gint setAbsolutePathname (gchar *file, gchar **uri)
        *uri = (gchar *) g_malloc (sizeof(gchar) * PATH_MAX_LEN);          
        realPath = realpath (file, realPath);
        if (NULL == realPath) {
-               /*TODO: a debug trace here*/
                g_printerr ("File %s not found\n", file);
                ret = ERR_FILENOTFOUND;
                goto destroy;   
        }
-       g_snprintf(*uri,PATH_MAX_LEN,"file://%s",realPath);
+       g_snprintf (*uri,PATH_MAX_LEN,"file://%s",realPath);
 
        goto last;      
 
 destroy:
        g_free(*uri);
-       *uri=NULL;
+       *uri = NULL;
 last:
        free (realPath);
        return ret;                                                                                                                                
@@ -102,24 +100,23 @@ gint processOpts()
        gchar *uri                      = NULL;
        gint ret                        = ERR_SUCCESS;
        if (version) {
-               g_print ("VERSION %s", version_text);
+               g_print ("VERSION %s\n", version_text);
                exit (ERR_SUCCESS);
        }
 
-       if(NULL == files){
+       if (NULL == files){
                return ERR_SUCCESS;
        }
-       while(NULL != files[fileCount]){
-               if(fileCount < NUM_MAX_FILES){
+       while (NULL != files[fileCount]){
+               if (fileCount < NUM_MAX_FILES){
                        uri = NULL;
-                       ret = setAbsolutePathname(files[fileCount],&uri);
-                       if(ERR_SUCCESS != ret){
+                       ret = setAbsolutePathname (files[fileCount], &uri);
+                       if (ERR_SUCCESS != ret){
                                return ret;
                        }
                        decodeMode++;
                        filename[fileCount] = uri;
                }else{
-                       /*TODO: A debug trace here*/
                        g_printerr("Ignoring file : %s\n",files[fileCount]);
                }
                fileCount++;
@@ -149,7 +146,6 @@ gint processArgs (int *argc, char **argv[])
                                                                                                                                                                
        /* Parse the command line arguments and options*/                                                  
        if (!g_option_context_parse (context, argc, argv, &error)) {                       
-               /*TODO: a debug trace here*/
                g_printerr ("option parsing failed: %s\n", error->message);                               
                g_error_free(error);
                return ERR_OPTIONPARSE;                                                                                                                          
@@ -163,7 +159,7 @@ int main(int argc, char *argv[])
 {
        gint ret = ERR_SUCCESS;
 
-       ret = processArgs(&argc, &argv);
+       ret = processArgs (&argc, &argv);
        if(ERR_SUCCESS != ret){
                return ret;
        }