(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/webbrowser.c) |
| |
| 270 | | | gchar * |
| 271 | | | filename2uri(const gchar *filename) |
| 272 | | | { |
| 273 | | | int i = 0; |
| 274 | | | gchar *file_tmp; |
| 275 | | | GString *filestr; |
| 276 | | | |
| 277 | | | |
| 278 | | | filestr = g_string_sized_new(200); |
| 279 | | | |
| 280 | | | |
| 281 | | | for(i=0; filename[i]; i++) { |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 282 | | | switch(filename[i]) { |
| 283 | | | case(' '): |
| 284 | | | g_string_append(filestr, "%20"); |
| 285 | | | break; |
| 286 | | | case('%'): |
| 287 | | | g_string_append(filestr, "%%"); |
| 288 | | | break; |
| 289 | | | case('\\'): |
| 290 | | | g_string_append_c(filestr, '/');
x /usr/include/glib-2.0/glib/gstring.h |
| |
156 | #define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c) |
| |
|
| 291 | | | break; |
| 292 | | | |
| 293 | | | default: |
| 294 | | | g_string_append_c(filestr, filename[i]);
x /usr/include/glib-2.0/glib/gstring.h |
| |
156 | #define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c) |
| |
|
| 295 | | | } |
| 296 | | | } |
| 297 | | | |
| 298 | | | |
| 299 | | | |
| 300 | | | #ifdef G_OS_WIN32 |
| 301 | | | |
| 302 | | | g_string_prepend(filestr, "file:///"); |
| 303 | | | #else |
| 304 | | | g_string_prepend(filestr, "file://"); |
| 305 | | | #endif |
| 306 | | | |
| 307 | | | file_tmp = filestr->str; |
| 308 | | | |
| 309 | | | g_string_free(filestr, FALSE ); |
| 310 | | | |
| 311 | | | return file_tmp; |
| 312 | | | } |
| |