diff options
author | Matthieu Herrb <matthieu@herrb.eu> | 2019-07-17 17:33:35 +0200 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2019-07-17 17:33:35 +0200 |
commit | 879fca731c241d59dcfcfdb4d4d67d2df996a4d7 (patch) | |
tree | 7a45752897099e4fa4382ab3e0a7aada9aef60f3 /src/session.c | |
parent | 6197a5f16dbc71d6199615ceec0caf676e8aa1b2 (diff) | |
parent | 2e0923ba703d040160bac1deb05d5d6d4cbd62aa (diff) |
Merge remote-tracking branch 'origin/master' into obsd
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/session.c b/src/session.c index e12a6c0..a908efc 100644 --- a/src/session.c +++ b/src/session.c @@ -145,8 +145,8 @@ write_ushort (FILE *file, unsigned short s) { unsigned char file_short[2]; - file_short[0] = (s & (unsigned)0xff00) >> 8; - file_short[1] = s & 0xff; + file_short[0] = (unsigned char)((s & (unsigned)0xff00) >> 8); + file_short[1] = (unsigned char)(s & 0xff); if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; return 1; @@ -158,8 +158,8 @@ write_short (FILE *file, short s) { unsigned char file_short[2]; - file_short[0] = (s & (unsigned)0xff00) >> 8; - file_short[1] = s & 0xff; + file_short[0] = (unsigned char)(((unsigned)s & (unsigned)0xff00) >> 8); + file_short[1] = (unsigned char)(s & 0xff); if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; return 1; @@ -171,7 +171,7 @@ write_counted_string (FILE *file, char *string) { if (string) { - unsigned char count = strlen (string); + unsigned char count = (unsigned char)strlen (string); if (write_byte (file, count) == 0) return 0; @@ -205,7 +205,7 @@ read_ushort (FILE *file, unsigned short *shortp) if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; - *shortp = file_short[0] * 256 + file_short[1]; + *shortp = (unsigned short)(file_short[0] * 256 + file_short[1]); return 1; } @@ -217,7 +217,7 @@ read_short (FILE *file, short *shortp) if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; - *shortp = file_short[0] * 256 + file_short[1]; + *shortp = (short)(file_short[0] * 256 + file_short[1]); return 1; } @@ -335,7 +335,7 @@ WriteWinConfigEntry (FILE *configFile, TwmWindow *theWindow, } else { - if (!write_byte (configFile, (char) wm_command_count)) + if (!write_byte (configFile, (unsigned char) wm_command_count)) return 0; for (i = 0; i < wm_command_count; i++) if (!write_counted_string (configFile, wm_command[i])) @@ -426,7 +426,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version, entry->wm_command = NULL; else { - entry->wm_command = malloc (entry->wm_command_count * + entry->wm_command = malloc ((size_t)entry->wm_command_count * sizeof (char *)); if (!entry->wm_command) @@ -720,7 +720,7 @@ unique_filename ( static void -SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) +SaveYourselfPhase2CB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) { int scrnum; ScreenInfo *theScreen; @@ -744,23 +744,23 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) char userId[20]; char hint = SmRestartIfRunning; - prop1.name = SmProgram; - prop1.type = SmARRAY8; + prop1.name = strdup(SmProgram); + prop1.type = strdup(SmARRAY8); prop1.num_vals = 1; prop1.vals = &prop1val; prop1val.value = Argv[0]; - prop1val.length = strlen (Argv[0]); + prop1val.length = (int)strlen (Argv[0]); snprintf (userId, sizeof(userId), "%ld", (long)getuid()); - prop2.name = SmUserID; - prop2.type = SmARRAY8; + prop2.name = strdup(SmUserID); + prop2.type = strdup(SmARRAY8); prop2.num_vals = 1; prop2.vals = &prop2val; prop2val.value = (SmPointer) userId; - prop2val.length = strlen (userId); + prop2val.length = (int)strlen (userId); - prop3.name = SmRestartStyleHint; - prop3.type = SmCARD8; + prop3.name = strdup(SmRestartStyleHint); + prop3.type = strdup(SmCARD8); prop3.num_vals = 1; prop3.vals = &prop3val; prop3val.value = (SmPointer) &hint; @@ -770,7 +770,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) props[1] = &prop2; props[2] = &prop3; - SmcSetProperties (smcConn, 3, props); + SmcSetProperties (smcConn2, 3, props); first_time = 0; } @@ -828,10 +828,10 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) } } - prop1.name = SmRestartCommand; - prop1.type = SmLISTofARRAY8; + prop1.name = strdup(SmRestartCommand); + prop1.type = strdup(SmLISTofARRAY8); - prop1.vals = malloc ((Argc + 4) * sizeof (SmPropValue)); + prop1.vals = malloc ((size_t)(Argc + 4) * sizeof (SmPropValue)); if (!prop1.vals) { @@ -851,40 +851,40 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) else { prop1.vals[numVals].value = (SmPointer) Argv[i]; - prop1.vals[numVals++].length = strlen (Argv[i]); + prop1.vals[numVals++].length = (int)strlen (Argv[i]); } } - prop1.vals[numVals].value = (SmPointer) "-clientId"; + prop1.vals[numVals].value = strdup("-clientId"); prop1.vals[numVals++].length = 9; - prop1.vals[numVals].value = (SmPointer) twm_clientId; - prop1.vals[numVals++].length = strlen (twm_clientId); + prop1.vals[numVals].value = strdup(twm_clientId); + prop1.vals[numVals++].length = (int)strlen (twm_clientId); - prop1.vals[numVals].value = (SmPointer) "-restore"; + prop1.vals[numVals].value = strdup("-restore"); prop1.vals[numVals++].length = 8; - prop1.vals[numVals].value = (SmPointer) filename; - prop1.vals[numVals++].length = strlen (filename); + prop1.vals[numVals].value = strdup(filename); + prop1.vals[numVals++].length = (int)strlen (filename); prop1.num_vals = numVals; snprintf (discardCommand, sizeof(discardCommand), "rm %s", filename); - prop2.name = SmDiscardCommand; - prop2.type = SmARRAY8; + prop2.name = strdup(SmDiscardCommand); + prop2.type = strdup(SmARRAY8); prop2.num_vals = 1; prop2.vals = &prop2val; prop2val.value = (SmPointer) discardCommand; - prop2val.length = strlen (discardCommand); + prop2val.length = (int)strlen (discardCommand); props[0] = &prop1; props[1] = &prop2; - SmcSetProperties (smcConn, 2, props); + SmcSetProperties (smcConn2, 2, props); free (prop1.vals); bad: - SmcSaveYourselfDone (smcConn, success); + SmcSaveYourselfDone (smcConn2, success); sent_save_done = 1; if (configFile) @@ -898,16 +898,16 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) static void SaveYourselfCB ( - SmcConn smcConn, - SmPointer clientData, - int saveType, - Bool shutdown, - int interactStyle, - Bool fast) + SmcConn smcConn2, + SmPointer clientData _X_UNUSED, + int saveType _X_UNUSED, + Bool shutdown _X_UNUSED, + int interactStyle _X_UNUSED, + Bool fast _X_UNUSED) { - if (!SmcRequestSaveYourselfPhase2 (smcConn, SaveYourselfPhase2CB, NULL)) + if (!SmcRequestSaveYourselfPhase2 (smcConn2, SaveYourselfPhase2CB, NULL)) { - SmcSaveYourselfDone (smcConn, False); + SmcSaveYourselfDone (smcConn2, False); sent_save_done = 1; } else @@ -917,9 +917,9 @@ SaveYourselfCB ( static void -DieCB (SmcConn smcConn, SmPointer clientData) +DieCB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) { - SmcCloseConnection (smcConn, 0, NULL); + SmcCloseConnection (smcConn2, 0, NULL); XtRemoveInput (iceInputId); Done(NULL, NULL); } @@ -927,7 +927,7 @@ DieCB (SmcConn smcConn, SmPointer clientData) static void -SaveCompleteCB (SmcConn smcConnm, SmPointer clientData) +SaveCompleteCB (SmcConn smcConnm _X_UNUSED, SmPointer clientData _X_UNUSED) { ; } @@ -935,11 +935,11 @@ SaveCompleteCB (SmcConn smcConnm, SmPointer clientData) static void -ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData) +ShutdownCancelledCB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) { if (!sent_save_done) { - SmcSaveYourselfDone (smcConn, False); + SmcSaveYourselfDone (smcConn2, False); sent_save_done = 1; } } @@ -947,7 +947,7 @@ ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData) static void -ProcessIceMsgProc (XtPointer client_data, int *source, XtInputId *id) +ProcessIceMsgProc (XtPointer client_data, int *source _X_UNUSED, XtInputId *id _X_UNUSED) { IceConn ice_conn = (IceConn) client_data; |