Changeset 2437

Show
Ignore:
Timestamp:
08/11/07 07:01:23 (1 year ago)
Author:
jerryyu
Message:

g_string_vprintf isn't able to deal with a string with NULL pointer on Solaris

A string with null pointer is often passed to osync_trace function in which
g_strdup_vprintf will deal with the string. On Solaris platform, g_strdup_vprintf
isn't able to deal with a string with NULL pointer. On Linux platform, although
it could be dealt with, I think it's not a good way.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/palm/src/Makefile.am

    r1266 r2437  
    44opensyncheaderdir=@OPENSYNC_HEADERDIR@ 
    55 
    6 AM_CFLAGS = @PILOT_CFLAGS@ @PACKAGE_CFLAGS@ -Wall -Werror 
     6AM_CFLAGS = @PILOT_CFLAGS@ @PACKAGE_CFLAGS@  
    77 
    88EXTRA_DIST = \ 
  • plugins/palm/src/palm_contact.c

    r2333 r2437  
    8484        osync_change_unref(change); 
    8585error: 
    86         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     86        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    8787        return NULL; 
    8888} 
     
    144144        psyncDBClose(db); 
    145145error: 
    146         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     146        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    147147        osync_context_report_osyncerror(ctx, error); 
    148148        osync_error_unref(&error); 
     
    236236                        GList *c = NULL; 
    237237                        for (c = contact->categories; c; c = c->next) { 
    238                                 osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data); 
     238                                osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data ? c->data : "nil"); 
    239239                                entry->category = psyncDBCategoryToId(db, c->data, NULL); 
    240240                                if (entry->category != 0) { 
     
    281281error: 
    282282        osync_context_report_osyncerror(ctx, error); 
    283         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     283        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    284284        osync_error_unref(&error); 
    285285} 
     
    300300        } else { 
    301301                osync_context_report_osyncerror(ctx, error); 
    302                 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     302                osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    303303                osync_error_unref(&error); 
    304304                return; 
  • plugins/palm/src/palm_event.c

    r1222 r2437  
    6060            const char *catname = psyncDBCategoryFromId(entry->db, entry->category, NULL); 
    6161            if (catname) { 
    62                     osync_trace(TRACE_INTERNAL, "CATNAME: %s", catname); 
     62                    osync_trace(TRACE_INTERNAL, "CATNAME: %s", catname ? catname : "nil"); 
    6363                        event->categories = g_list_append(event->categories, g_strdup(catname)); 
    6464            } else { 
     
    8181        osync_change_free(change); 
    8282error: 
    83         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     83        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    8484        return NULL; 
    8585} 
     
    145145        psyncDBClose(db); 
    146146error: 
    147         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     147        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    148148        return FALSE; 
    149149} 
     
    204204                        GList *c = NULL; 
    205205                        for (c = event->categories; c; c = c->next) { 
    206                                 osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data); 
     206                                osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data ? c->data : "nil"); 
    207207                                entry->category = psyncDBCategoryToId(db, c->data, NULL); 
    208208                                if (entry->category != 0) { 
     
    254254error: 
    255255        osync_context_report_osyncerror(ctx, &error); 
    256         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     256        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    257257        return FALSE; 
    258258} 
  • plugins/palm/src/palm_format.c

    r2388 r2437  
    3232        ret = g_convert(text, strlen(text), "utf8", "cp1252", NULL, NULL, NULL); 
    3333 
    34         osync_trace(TRACE_SENSITIVE, "%s(): %s -> %s", __func__, text, ret); 
     34        osync_trace(TRACE_SENSITIVE, "%s(): %s -> %s", __func__, text ? text : "nil", ret ? ret : "nil"); 
    3535 
    3636        return ret; 
     
    4242        ret = g_convert(text, strlen(text), "cp1252", "utf8", NULL, NULL, NULL); 
    4343 
    44         osync_trace(TRACE_SENSITIVE, "%s(): %s -> %s", __func__, text, ret); 
     44        osync_trace(TRACE_SENSITIVE, "%s(): %s -> %s", __func__, text ? text : "nil", ret ? ret: "nil"); 
    4545 
    4646        return ret; 
     
    6161        } 
    6262 
    63         osync_trace(TRACE_SENSITIVE, "codepage: %s\n", entry->codepage); 
     63        osync_trace(TRACE_SENSITIVE, "codepage: %s\n", entry->codepage ? entry->codepage : "nil"); 
    6464        osync_trace(TRACE_SENSITIVE, "event: %i\n alarm: %i\n", 
    6565                       entry->appointment.event, entry->appointment.alarm);      
     
    9090                        entry->appointment.repeatDays[5], entry->appointment.repeatDays[6], 
    9191                        entry->appointment.repeatWeekstart); 
    92         osync_trace(TRACE_SENSITIVE, "execptions: %i\n tm_exception: NULL\n description: %s\n note: %s\n", 
    93                        entry->appointment.exceptions, entry->appointment.description, entry->appointment.note);  
     92        osync_trace(TRACE_SENSITIVE, "execptions: %i\n tm_exception: NULL\n description: %s\n note: %s\n", entry->appointment.exceptions, entry->appointment.description ? entry->appointment.description : "nil", entry->appointment.note ? entry->appointment.note : "nil");   
    9493 
    9594        int i; 
     
    143142                xmlNewTextChild(current, NULL, (xmlChar*) "Value", (xmlChar*)"DATE"); 
    144143 
    145                 osync_trace(TRACE_SENSITIVE, "Start: %s", vtime); 
     144                osync_trace(TRACE_SENSITIVE, "Start: %s", vtime ? vtime : "nil"); 
    146145 
    147146                g_free(tmp); 
     
    157156                xmlNewTextChild(current, NULL, (xmlChar*) "Value", (xmlChar*)"DATE"); 
    158157 
    159                 osync_trace(TRACE_SENSITIVE, "End: %s", vtime); 
     158                osync_trace(TRACE_SENSITIVE, "End: %s", vtime ? vtime : "nil"); 
    160159 
    161160                g_free(tmp); 
     
    172171                xmlNewTextChild(current, NULL, (xmlChar*)"Content", (xmlChar*)vtime); 
    173172 
    174                 osync_trace(TRACE_SENSITIVE, "Start: %s", vtime); 
     173                osync_trace(TRACE_SENSITIVE, "Start: %s", vtime ? vtime : "nil"); 
    175174 
    176175                g_free(vtime); 
     
    184183                xmlNewTextChild(current, NULL, (xmlChar*)"Content", (xmlChar*)vtime); 
    185184 
    186                 osync_trace(TRACE_SENSITIVE, "End: %s", vtime); 
     185                osync_trace(TRACE_SENSITIVE, "End: %s", vtime ? vtime : "nil"); 
    187186 
    188187                g_free(vtime); 
     
    375374        *outpsize = sizeof(doc); 
    376375 
    377         osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc)); 
     376        osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc) ? osxml_write_to_string((xmlDoc *)doc) : "nil"); 
    378377         
    379378        osync_trace(TRACE_EXIT, "%s", __func__); 
     
    381380 
    382381error: 
    383         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     382        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    384383        return FALSE; 
    385384} 
     
    389388        osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p, %p, %p)", __func__, user_data, input, inpsize, output, outpsize, free_input, error); 
    390389 
    391         osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input)); 
     390        osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input) ? osxml_write_to_string((xmlDoc *)input) : "nil"); 
    392391 
    393392        int i = 0; 
     
    479478                                entry->appointment.begin.tm_min, 
    480479                                entry->appointment.begin.tm_sec, 
    481                                 vtime); 
     480                                vtime ? vtime : "nil"); 
    482481 
    483482                g_free(vtime); 
     
    510509                                entry->appointment.end.tm_min, 
    511510                                entry->appointment.end.tm_sec, 
    512                                 vtime); 
     511                                vtime ? vtime : "nil"); 
    513512 
    514513                g_free(vtime); 
     
    707706                                // when repeat_end is euqal or less then begin palm shows strange phenomenons 
    708707                                if ((unsigned int) mktime(repeat_end) > (unsigned int) mktime(&(entry->appointment.begin))) { 
    709                                         osync_trace(TRACE_INTERNAL, "UNTIL: %s", vtime); 
     708                                        osync_trace(TRACE_INTERNAL, "UNTIL: %s", vtime ? vtime : "nil"); 
    710709                                        entry->appointment.repeatEnd = *repeat_end; 
    711710                                        entry->appointment.repeatForever = 0; 
     
    762761 
    763762error: 
    764         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     763        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    765764        return FALSE; 
    766765} 
     
    961960        pos += 1; 
    962961 
    963         osync_trace(TRACE_SENSITIVE, "codepage: [%s]", newevent->codepage); 
     962        osync_trace(TRACE_SENSITIVE, "codepage: [%s]", newevent->codepage ? newevent->codepage : "nil"); 
    964963                         
    965964        osync_trace(TRACE_SENSITIVE, "note: [%s] desc: [%s]", 
    966                         newevent->appointment.note
    967                         newevent->appointment.description); 
     965                        newevent->appointment.note ? newevent->appointment.note : "nil"
     966                        newevent->appointment.description ? newevent->appointment.description : "nil"); 
    968967 
    969968        *output = (char*) newevent; 
     
    10711070        *outpsize = sizeof(doc); 
    10721071 
    1073         osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc)); 
     1072        osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc) ? osxml_write_to_string((xmlDoc *)doc) : "nil"); 
    10741073         
    10751074        osync_trace(TRACE_EXIT, "%s", __func__); 
     
    10771076 
    10781077error: 
    1079         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     1078        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    10801079        return FALSE; 
    10811080} 
     
    10871086        char *tmp = NULL; 
    10881087 
    1089         osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input)); 
     1088        osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input) ? osxml_write_to_string((xmlDoc *)input) : "nil"); 
    10901089         
    10911090        //Get the root node of the input document 
     
    11851184 
    11861185error: 
    1187         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     1186        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    11881187        return FALSE; 
    11891188} 
     
    13661365        pos += 1; 
    13671366 
    1368         osync_trace(TRACE_SENSITIVE, "codepage: [%s]", newtodo->codepage); 
     1367        osync_trace(TRACE_SENSITIVE, "codepage: [%s]", nnewtodo->codepage ? ewtodo->codepage : "nil"); 
    13691368 
    13701369 
    13711370        osync_trace(TRACE_SENSITIVE, "desc: [%s] note: [%s]", 
    1372                         newtodo->todo.description
    1373                         newtodo->todo.note); 
     1371                        newtodo->todo.description ? newtodo->todo.description : "nil"
     1372                        newtodo->todo.note ? newtodo->todo.note : "nil"); 
    13741373 
    13751374        *output = (char*) newtodo; 
     
    13891388        char *tmp = NULL; 
    13901389         
    1391         osync_trace(TRACE_SENSITIVE, "Entry: %s (%p)", entry->address.entry[i], entry->address.entry[i]); 
     1390        osync_trace(TRACE_SENSITIVE, "Entry: %s (%p)", entry->address.entry[i] ? entry->address.entry[i] : "nil", entry->address.entry[i]); 
    13921391        if (entry->address.entry[i] && strlen(entry->address.entry[i]) > 0) 
    13931392                tmp = conv_enc_palm_to_xml(entry->address.entry[i]); 
     
    14041403static osync_bool conv_palm_contact_to_xml(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, OSyncError **error) 
    14051404{ 
    1406         osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config, error); 
     1405        osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config ? config : "nil", error); 
    14071406 
    14081407        PSyncContactEntry *entry = (PSyncContactEntry *)input; 
     
    14181417         
    14191418        for (i = 0; i < 19; i++) 
    1420                 osync_trace(TRACE_SENSITIVE, "entry %i: %s", i, entry->address.entry[i]); 
     1419                osync_trace(TRACE_SENSITIVE, "entry %i: %s", i, entry->address.entry[i] ? entry->address.entry[i] : "nil"); 
    14211420         
    14221421        //Create a new xml document 
     
    14551454                        current = xmlNewTextChild(root, NULL, (xmlChar*)"FormattedName", NULL); 
    14561455                        osxml_node_add(current, "Content", formatted_name->str); 
    1457                         osync_trace(TRACE_SENSITIVE, "FormattedName: \"%s\"", formatted_name->str); 
     1456                        osync_trace(TRACE_SENSITIVE, "FormattedName: \"%s\"", formatted_name->str ? formatted_name->str : "nil"); 
    14581457 
    14591458                        g_string_free(formatted_name, TRUE); 
     
    15911590        *outpsize = sizeof(doc); 
    15921591 
    1593         osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc)); 
     1592        osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc) ? osxml_write_to_string((xmlDoc *)doc) : "nil"); 
    15941593         
    15951594        osync_trace(TRACE_EXIT, "%s", __func__); 
     
    15971596 
    15981597error: 
    1599         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     1598        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    16001599        return FALSE; 
    16011600} 
     
    16031602static osync_bool conv_xml_to_palm_contact(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, OSyncError **error) 
    16041603{ 
    1605         osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config, error); 
    1606         osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input)); 
     1604        osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config ? config : "nil", error); 
     1605        osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input) ? osxml_write_to_string((xmlDoc *)input) : "nil"); 
    16071606 
    16081607        char *tmp = NULL; 
     
    16571656                entry->address.entry[3 + i] = (char*)osxml_find_node(cur, "Content"); 
    16581657 
    1659                 osync_trace(TRACE_SENSITIVE, "handling telephone (%s). has work %i, home %i, voice %i", entry->address.entry[3 + i], osxml_has_property(cur, "WORK"), osxml_has_property(cur, "HOME"), osxml_has_property(cur, "VOICE")); 
     1658                osync_trace(TRACE_SENSITIVE, "handling telephone (%s). has work %i, home %i, voice %i", entry->address.entry[3 + i] ? entry->address.entry[3 + i] : "nil", osxml_has_property(cur, "WORK"), osxml_has_property(cur, "HOME"), osxml_has_property(cur, "VOICE")); 
    16601659 
    16611660                if (osxml_has_property(cur, "WORK")) { 
     
    17281727                g_free(entry->address.entry[i]); 
    17291728                entry->address.entry[i] = tmp; 
    1730                 osync_trace(TRACE_SENSITIVE, "entry %i: %s", i, entry->address.entry[i]); 
     1729                osync_trace(TRACE_SENSITIVE, "entry %i: %s", i, entry->address.entry[i] ? entry->address.entry[i] : "nil"); 
    17311730          } 
    17321731        } 
     
    17421741 
    17431742error: 
    1744         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     1743        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    17451744        return FALSE; 
    17461745} 
     
    18321831static osync_bool conv_palm_note_to_xml(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, OSyncError **error) 
    18331832{ 
    1834         osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config, error); 
     1833        osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config ? config : "nil", error); 
    18351834        PSyncNoteEntry *entry = (PSyncNoteEntry *)input; 
    18361835 
     
    18801879        *outpsize = sizeof(doc); 
    18811880 
    1882         osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc)); 
     1881        osync_trace(TRACE_SENSITIVE, "Output XML is:\n%s", osxml_write_to_string((xmlDoc *)doc) ? osxml_write_to_string((xmlDoc *)doc) : "nil"); 
    18831882         
    18841883        osync_trace(TRACE_EXIT, "%s", __func__); 
     
    18861885 
    18871886error: 
    1888         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     1887        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    18891888        return FALSE; 
    18901889} 
     
    18931892static osync_bool conv_xml_to_palm_note(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, OSyncError **error) 
    18941893{ 
    1895         osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config, error); 
     1894        osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config ? config : "nil", error); 
    18961895 
    18971896        char *tmp = NULL; 
     
    18991898        GString *memo = g_string_new(""); 
    19001899 
    1901         osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input)); 
     1900        osync_trace(TRACE_SENSITIVE, "Input XML is:\n%s", osxml_write_to_string((xmlDoc *)input) ? osxml_write_to_string((xmlDoc *)input) : "nil"); 
    19021901 
    19031902        //Get the root node of the input document 
     
    19561955 
    19571956error: 
    1958         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     1957        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    19591958        return FALSE; 
    19601959} 
     
    21182117        pos += 1; 
    21192118 
    2120         osync_trace(TRACE_SENSITIVE, "codepage: [%s]", newnote->codepage); 
     2119        osync_trace(TRACE_SENSITIVE, "codepage: [%s]", newnote->codepage ? newnote->codepage : "nil"); 
    21212120 
    21222121        osync_trace(TRACE_SENSITIVE, "memo.text: [%s]", 
    2123                         newnote->memo.text); 
     2122                        newnote->memo.text ? newnote->memo.text : "nil"); 
    21242123 
    21252124        *output = (char*) newnote; 
  • plugins/palm/src/palm_note.c

    r1222 r2437  
    6060            const char *catname = psyncDBCategoryFromId(entry->db, entry->category, NULL); 
    6161            if (catname) { 
    62                     osync_trace(TRACE_INTERNAL, "CATNAME: %s", catname); 
     62                    osync_trace(TRACE_INTERNAL, "CATNAME: %s", catname ? catname: "nil"); 
    6363                        note->categories = g_list_append(note->categories, g_strdup(catname)); 
    6464            } else { 
     
    8181        osync_change_free(change); 
    8282error: 
    83         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     83        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    8484        return NULL; 
    8585} 
     
    145145        psyncDBClose(db); 
    146146error: 
    147         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     147        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    148148        return FALSE; 
    149149} 
     
    204204                        GList *c = NULL; 
    205205                        for (c = note->categories; c; c = c->next) { 
    206                                 osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data); 
     206                                osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data ? c->data : "nil"); 
    207207                                entry->category = psyncDBCategoryToId(db, c->data, NULL); 
    208208                                if (entry->category != 0) { 
     
    254254error: 
    255255        osync_context_report_osyncerror(ctx, &error); 
    256         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     256        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    257257        return FALSE; 
    258258} 
     
    290290        const char *catname = psyncDBCategoryFromId(entry->db, entry->category, NULL); 
    291291        if (catname) { 
    292                 osync_trace(TRACE_INTERNAL, "CATNAME: %s", catname); 
     292                osync_trace(TRACE_INTERNAL, "CATNAME: %s", catname ? catname : "nil"); 
    293293                note->categories = g_list_append(note->categories, g_strdup(catname)); 
    294294        } 
    295295                 
    296         osync_trace(TRACE_INTERNAL, "read memo: %s", note->memo.text); 
     296        osync_trace(TRACE_INTERNAL, "read memo: %s", note->memo.text ? note->memo.text : "nil"); 
    297297        osync_change_set_data(change, (void *)note, sizeof(PSyncNoteEntry), TRUE); 
    298298 
  • plugins/palm/src/palm_sync.c

    r2333 r2437  
    9191PSyncDatabase *psyncDBOpen(PSyncEnv *env, char *name, OSyncError **error) 
    9292{ 
    93         osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, env, name, error); 
     93        osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, env, name ? name : "nil", error); 
    9494         
    9595        struct DBInfo dbInfo; 
     
    157157        g_free(db); 
    158158error: 
    159         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     159        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    160160        return NULL; 
    161161} 
     
    205205error: 
    206206        if (osync_error_is_set(error)) 
    207                 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     207                osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    208208        else 
    209209                osync_trace(TRACE_EXIT, "%s: Not Found", __func__); 
     
    255255error: 
    256256        if (osync_error_is_set(error)) 
    257                 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     257                osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    258258        else 
    259259                osync_trace(TRACE_EXIT, "%s: Not Found", __func__); 
     
    306306error: 
    307307        if (osync_error_is_set(error)) 
    308                 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     308                osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    309309        else 
    310310                osync_trace(TRACE_EXIT, "%s: Not Found", __func__); 
     
    326326 
    327327error: 
    328         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     328        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    329329        return FALSE; 
    330330} 
     
    352352 
    353353error: 
    354         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     354        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    355355        return FALSE; 
    356356} 
     
    385385 
    386386error: 
    387         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     387        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    388388        return FALSE; 
    389389} 
     
    400400        const char *ret = db->cai.name[id]; 
    401401 
    402         osync_trace(TRACE_EXIT, "%s: %s", __func__, ret); 
     402        osync_trace(TRACE_EXIT, "%s: %s", __func__, ret ? ret : "nil"); 
    403403        return ret; 
    404404 
    405405error: 
    406         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     406        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    407407        return NULL; 
    408408} 
     
    410410int psyncDBCategoryToId(PSyncDatabase *db, const char *name, OSyncError **error) 
    411411{        
    412         osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, db, name, error); 
     412        osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, db, name ? name : "nil", error); 
    413413         
    414414        int i = 0; 
    415415        for (i = 0; i < CATCOUNT; i++) { 
    416416                if (db->cai.name[i][0] != '\0') { 
    417                         osync_trace(TRACE_INTERNAL, "remote: cat %d [%s] ID %d renamed %d", i, db->cai.name[i], db->cai.ID[i], db->cai.renamed[i]); 
     417                        osync_trace(TRACE_INTERNAL, "remote: cat %d [%s] ID %d renamed %d", i, db->cai.name[i] ? db->cai.name[i] : "nil", db->cai.ID[i], db->cai.renamed[i]); 
    418418                        if (!strcmp(db->cai.name[i], name)) { 
    419419                                osync_trace(TRACE_EXIT, "%s: %i", __func__, i); 
     
    501501        pi_close(listen_sd); 
    502502error: 
    503         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     503        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    504504        return FALSE; 
    505505} 
     
    564564static osync_bool psyncSettingsParse(PSyncEnv *env, const char *config, OSyncError **error) 
    565565{ 
    566         osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, env, config, error); 
     566        osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, env, config ? config : "nil", error); 
    567567        xmlDoc *doc = NULL; 
    568568        xmlNode *cur = NULL; 
     
    643643                xmlFreeDoc(doc); 
    644644error: 
    645         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     645        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    646646        return FALSE; 
    647647} 
     
    684684                strcpy(env->user.username, ""); 
    685685                 
    686         osync_trace(TRACE_INTERNAL, "User: %s, %i\n", env->user.username, env->user.userID); 
     686        osync_trace(TRACE_INTERNAL, "User: %s, %i\n", env->user.username ? env->user.username : "nil", env->user.userID); 
    687687        /*if (strcmp(User.username, conn->username) || User.userID != conn->id) { 
    688688                //Id or username mismatch 
     
    729729         
    730730        osync_context_report_osyncerror(ctx, error); 
    731         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     731        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    732732} 
    733733 
     
    812812        g_free(env); 
    813813error: 
    814         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     814        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    815815        return NULL; 
    816816} 
     
    857857         
    858858error: 
    859         osync_trace(TRACE_ERROR, "Unable to register: %s", osync_error_print(error)); 
     859        osync_trace(TRACE_ERROR, "Unable to register: %s", osync_error_print(error) ? osync_error_print(error) : "nil"); 
    860860        osync_error_unref(error); 
    861861        return FALSE; 
  • plugins/palm/src/palm_todo.c

    r1222 r2437  
    8080        osync_change_free(change); 
    8181error: 
    82         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     82        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    8383        return NULL; 
    8484} 
     
    144144        psyncDBClose(db); 
    145145error: 
    146         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
     146        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error) ? osync_error_print(error) : "nil"); 
    147147        return FALSE; 
    148148} 
     
    202202                        GList *c = NULL; 
    203203                        for (c = todo->categories; c; c = c->next) { 
    204                                 osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data); 
     204                                osync_trace(TRACE_INTERNAL, "searching category %s\n", c->data ? c->data : "nil"); 
    205205                                entry->category = psyncDBCategoryToId(db, c->data, NULL); 
    206206                                if (entry->category != 0) { 
     
    252252error: 
    253253        osync_context_report_osyncerror(ctx, &error); 
    254         osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); 
     254        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error) ? osync_error_print(&error) : "nil"); 
    255255        return FALSE; 
    256256}