Hello nigeltao,
I'd like you to do a code review. Please execute
g4 diff -c 10082587
or point your web browser to
http://mondrian/10082587
(this changelist has been uploaded to Mondrian)
to review the following code:
Change 10082587 by n...@noel-gears on 2009/02/10 20:23:22 *pending*
Change ToJsArray() to to use post increment iteration: prevents the
STL iterator exceptions I'm seeing in DEBUG builds of Chrome on XP
and Vista. Remove the related TODO's; global state is fine.
PRESUBMIT=passed
R=nigeltao
[email protected]
DELTA=12 (1 added, 8 deleted, 3 changed)
OCL=10082587
Affected files ...
... //depot/googleclient/gears/opensource/gears/desktop/drop_target_cr.cc#1 edit
12 delta lines: 1 added, 8 deleted, 3 changed
Also consider running:
g4 lint -c 10082587
which verifies that the changelist doesn't introduce new style violations.
If you can't do the review, please let me know as soon as possible. During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately. Visit
http://www/eng/code_review.html for more information.
This is a semiautomated message from "g4 mail". Complaints or suggestions?
Mail [email protected].
Change 10082587 by n...@noel-gears on 2009/02/10 20:23:22 *pending*
Change ToJsArray() to to use post increment iteration: prevents the
STL iterator exceptions I'm seeing in DEBUG builds of Chrome on XP
and Vista. Remove the related TODO's; global state is fine.
OCL=10082587
Affected files ...
... //depot/googleclient/gears/opensource/gears/desktop/drop_target_cr.cc#1 edit
==== //depot/googleclient/gears/opensource/gears/desktop/drop_target_cr.cc#1 -
c:\Users\noel.GOOGLE\src-gears/googleclient/gears/opensource/gears/desktop/drop_target_cr.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drop_target_cr.cc
2009-02-10 20:15:09.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/drop_target_cr.cc
2009-02-10 20:14:47.000000000 +1100
@@ -40,12 +40,6 @@
#include "gears/desktop/file_dialog.h"
// Global drag state
-// For a multi-tabbed browser environment, we'll need to fix this, eg., one
-// tab might accept .txt files and another .pdf only, event may get out of
-// sequence. So global state is dicey; make it per-NPP-instance state.
-//
-// TODO(noel) fix this in V2, fix the FF/Safari drivers since they maintain
-// global drag state too. IE should be fine (IDropTarget).
static std::set<std::string16> g_mime_set;
static std::set<std::string16> g_type_set;
@@ -659,19 +653,18 @@
// AddFileMetaData() helper.
static bool ToJsArray(std::set<std::string16> const &s, JsArray *array) {
- typedef std::set<std::string16> string16_set;
-
int length = 0;
if (!array || !array->GetLength(&length))
return false;
- for (string16_set::const_iterator it = s.begin(); it != s.end(); ++it) {
- if (!array->SetElementString(length++, *it))
+ std::set<std::string16>::const_iterator it = s.begin();
+ while (it != s.end()) {
+ if (!array->SetElementString(length++, *it++))
return false;
}
return true;
-};
+}
static bool AddFileMetaData(JsRunnerInterface *runner,
JsObject *event, JsObject *context) {